@typicalday/firegraph 0.6.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,411 @@
1
+ var t4=Object.defineProperty;var Y1=t=>{throw TypeError(t)};var r4=(t,e,r)=>e in t?t4(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var kp=(t,e,r)=>r4(t,typeof e!="symbol"?e+"":e,r),Dp=(t,e,r)=>e.has(t)||Y1("Cannot "+r);var Z=(t,e,r)=>(Dp(t,e,"read from private field"),r?r.call(t):e.get(t)),qe=(t,e,r)=>e.has(t)?Y1("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Me=(t,e,r,a)=>(Dp(t,e,"write to private field"),a?a.call(t,r):e.set(t,r),r),at=(t,e,r)=>(Dp(t,e,"access private method"),r);var Kd=(t,e,r,a)=>({set _(i){Me(t,e,i,r)},get _(){return Z(t,e,a)}});function a4(t,e){for(var r=0;r<e.length;r++){const a=e[r];if(typeof a!="string"&&!Array.isArray(a)){for(const i in a)if(i!=="default"&&!(i in t)){const s=Object.getOwnPropertyDescriptor(a,i);s&&Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:()=>a[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(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 s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&a(o)}).observe(document,{childList:!0,subtree:!0});function r(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function a(i){if(i.ep)return;i.ep=!0;const s=r(i);fetch(i.href,s)}})();function PE(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Op={exports:{}},Mu={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var K1;function n4(){if(K1)return Mu;K1=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function r(a,i,s){var o=null;if(s!==void 0&&(o=""+s),i.key!==void 0&&(o=""+i.key),"key"in i){s={};for(var u in i)u!=="key"&&(s[u]=i[u])}else s=i;return i=s.ref,{$$typeof:t,type:a,key:o,ref:i!==void 0?i:null,props:s}}return Mu.Fragment=e,Mu.jsx=r,Mu.jsxs=r,Mu}var X1;function i4(){return X1||(X1=1,Op.exports=n4()),Op.exports}var g=i4(),Rp={exports:{}},lt={};/**
10
+ * @license React
11
+ * react.production.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var Z1;function s4(){if(Z1)return lt;Z1=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"),s=Symbol.for("react.consumer"),o=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),m=Symbol.iterator;function y(L){return L===null||typeof L!="object"?null:(L=m&&L[m]||L["@@iterator"],typeof L=="function"?L:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,w={};function T(L,Q,X){this.props=L,this.context=Q,this.refs=w,this.updater=X||x}T.prototype.isReactComponent={},T.prototype.setState=function(L,Q){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,Q,"setState")},T.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function C(){}C.prototype=T.prototype;function N(L,Q,X){this.props=L,this.context=Q,this.refs=w,this.updater=X||x}var A=N.prototype=new C;A.constructor=N,E(A,T.prototype),A.isPureReactComponent=!0;var D=Array.isArray;function M(){}var j={H:null,A:null,T:null,S:null},k=Object.prototype.hasOwnProperty;function B(L,Q,X){var W=X.ref;return{$$typeof:t,type:L,key:Q,ref:W!==void 0?W:null,props:X}}function P(L,Q){return B(L.type,Q,L.props)}function U(L){return typeof L=="object"&&L!==null&&L.$$typeof===t}function R(L){var Q={"=":"=0",":":"=2"};return"$"+L.replace(/[=:]/g,function(X){return Q[X]})}var V=/\/+/g;function _(L,Q){return typeof L=="object"&&L!==null&&L.key!=null?R(""+L.key):Q.toString(36)}function H(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(Q){L.status==="pending"&&(L.status="fulfilled",L.value=Q)},function(Q){L.status==="pending"&&(L.status="rejected",L.reason=Q)})),L.status){case"fulfilled":return L.value;case"rejected":throw L.reason}}throw L}function z(L,Q,X,W,te){var Y=typeof L;(Y==="undefined"||Y==="boolean")&&(L=null);var ne=!1;if(L===null)ne=!0;else switch(Y){case"bigint":case"string":case"number":ne=!0;break;case"object":switch(L.$$typeof){case t:case e:ne=!0;break;case h:return ne=L._init,z(ne(L._payload),Q,X,W,te)}}if(ne)return te=te(L),ne=W===""?"."+_(L,0):W,D(te)?(X="",ne!=null&&(X=ne.replace(V,"$&/")+"/"),z(te,Q,X,"",function(ae){return ae})):te!=null&&(U(te)&&(te=P(te,X+(te.key==null||L&&L.key===te.key?"":(""+te.key).replace(V,"$&/")+"/")+ne)),Q.push(te)),1;ne=0;var he=W===""?".":W+":";if(D(L))for(var oe=0;oe<L.length;oe++)W=L[oe],Y=he+_(W,oe),ne+=z(W,Q,X,Y,te);else if(oe=y(L),typeof oe=="function")for(L=oe.call(L),oe=0;!(W=L.next()).done;)W=W.value,Y=he+_(W,oe++),ne+=z(W,Q,X,Y,te);else if(Y==="object"){if(typeof L.then=="function")return z(H(L),Q,X,W,te);throw Q=String(L),Error("Objects are not valid as a React child (found: "+(Q==="[object Object]"?"object with keys {"+Object.keys(L).join(", ")+"}":Q)+"). If you meant to render a collection of children, use an array instead.")}return ne}function I(L,Q,X){if(L==null)return L;var W=[],te=0;return z(L,W,"","",function(Y){return Q.call(X,Y,te++)}),W}function F(L){if(L._status===-1){var Q=L._result;Q=Q(),Q.then(function(X){(L._status===0||L._status===-1)&&(L._status=1,L._result=X)},function(X){(L._status===0||L._status===-1)&&(L._status=2,L._result=X)}),L._status===-1&&(L._status=0,L._result=Q)}if(L._status===1)return L._result.default;throw L._result}var K=typeof reportError=="function"?reportError:function(L){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Q=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof L=="object"&&L!==null&&typeof L.message=="string"?String(L.message):String(L),error:L});if(!window.dispatchEvent(Q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",L);return}console.error(L)},J={map:I,forEach:function(L,Q,X){I(L,function(){Q.apply(this,arguments)},X)},count:function(L){var Q=0;return I(L,function(){Q++}),Q},toArray:function(L){return I(L,function(Q){return Q})||[]},only:function(L){if(!U(L))throw Error("React.Children.only expected to receive a single React element child.");return L}};return lt.Activity=p,lt.Children=J,lt.Component=T,lt.Fragment=r,lt.Profiler=i,lt.PureComponent=N,lt.StrictMode=a,lt.Suspense=d,lt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=j,lt.__COMPILER_RUNTIME={__proto__:null,c:function(L){return j.H.useMemoCache(L)}},lt.cache=function(L){return function(){return L.apply(null,arguments)}},lt.cacheSignal=function(){return null},lt.cloneElement=function(L,Q,X){if(L==null)throw Error("The argument must be a React element, but you passed "+L+".");var W=E({},L.props),te=L.key;if(Q!=null)for(Y in Q.key!==void 0&&(te=""+Q.key),Q)!k.call(Q,Y)||Y==="key"||Y==="__self"||Y==="__source"||Y==="ref"&&Q.ref===void 0||(W[Y]=Q[Y]);var Y=arguments.length-2;if(Y===1)W.children=X;else if(1<Y){for(var ne=Array(Y),he=0;he<Y;he++)ne[he]=arguments[he+2];W.children=ne}return B(L.type,te,W)},lt.createContext=function(L){return L={$$typeof:o,_currentValue:L,_currentValue2:L,_threadCount:0,Provider:null,Consumer:null},L.Provider=L,L.Consumer={$$typeof:s,_context:L},L},lt.createElement=function(L,Q,X){var W,te={},Y=null;if(Q!=null)for(W in Q.key!==void 0&&(Y=""+Q.key),Q)k.call(Q,W)&&W!=="key"&&W!=="__self"&&W!=="__source"&&(te[W]=Q[W]);var ne=arguments.length-2;if(ne===1)te.children=X;else if(1<ne){for(var he=Array(ne),oe=0;oe<ne;oe++)he[oe]=arguments[oe+2];te.children=he}if(L&&L.defaultProps)for(W in ne=L.defaultProps,ne)te[W]===void 0&&(te[W]=ne[W]);return B(L,Y,te)},lt.createRef=function(){return{current:null}},lt.forwardRef=function(L){return{$$typeof:u,render:L}},lt.isValidElement=U,lt.lazy=function(L){return{$$typeof:h,_payload:{_status:-1,_result:L},_init:F}},lt.memo=function(L,Q){return{$$typeof:f,type:L,compare:Q===void 0?null:Q}},lt.startTransition=function(L){var Q=j.T,X={};j.T=X;try{var W=L(),te=j.S;te!==null&&te(X,W),typeof W=="object"&&W!==null&&typeof W.then=="function"&&W.then(M,K)}catch(Y){K(Y)}finally{Q!==null&&X.types!==null&&(Q.types=X.types),j.T=Q}},lt.unstable_useCacheRefresh=function(){return j.H.useCacheRefresh()},lt.use=function(L){return j.H.use(L)},lt.useActionState=function(L,Q,X){return j.H.useActionState(L,Q,X)},lt.useCallback=function(L,Q){return j.H.useCallback(L,Q)},lt.useContext=function(L){return j.H.useContext(L)},lt.useDebugValue=function(){},lt.useDeferredValue=function(L,Q){return j.H.useDeferredValue(L,Q)},lt.useEffect=function(L,Q){return j.H.useEffect(L,Q)},lt.useEffectEvent=function(L){return j.H.useEffectEvent(L)},lt.useId=function(){return j.H.useId()},lt.useImperativeHandle=function(L,Q,X){return j.H.useImperativeHandle(L,Q,X)},lt.useInsertionEffect=function(L,Q){return j.H.useInsertionEffect(L,Q)},lt.useLayoutEffect=function(L,Q){return j.H.useLayoutEffect(L,Q)},lt.useMemo=function(L,Q){return j.H.useMemo(L,Q)},lt.useOptimistic=function(L,Q){return j.H.useOptimistic(L,Q)},lt.useReducer=function(L,Q,X){return j.H.useReducer(L,Q,X)},lt.useRef=function(L){return j.H.useRef(L)},lt.useState=function(L){return j.H.useState(L)},lt.useSyncExternalStore=function(L,Q,X){return j.H.useSyncExternalStore(L,Q,X)},lt.useTransition=function(){return j.H.useTransition()},lt.version="19.2.4",lt}var W1;function ym(){return W1||(W1=1,Rp.exports=s4()),Rp.exports}var q=ym();const zE=PE(q),_E=a4({__proto__:null,default:zE},[q]);var Bp={exports:{}},ku={},Lp={exports:{}},Pp={};/**
18
+ * @license React
19
+ * scheduler.production.js
20
+ *
21
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */var J1;function l4(){return J1||(J1=1,(function(t){function e(z,I){var F=z.length;z.push(I);e:for(;0<F;){var K=F-1>>>1,J=z[K];if(0<i(J,I))z[K]=I,z[F]=J,F=K;else break e}}function r(z){return z.length===0?null:z[0]}function a(z){if(z.length===0)return null;var I=z[0],F=z.pop();if(F!==I){z[0]=F;e:for(var K=0,J=z.length,L=J>>>1;K<L;){var Q=2*(K+1)-1,X=z[Q],W=Q+1,te=z[W];if(0>i(X,F))W<J&&0>i(te,X)?(z[K]=te,z[W]=F,K=W):(z[K]=X,z[Q]=F,K=Q);else if(W<J&&0>i(te,F))z[K]=te,z[W]=F,K=W;else break e}}return I}function i(z,I){var F=z.sortIndex-I.sortIndex;return F!==0?F:z.id-I.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,u=o.now();t.unstable_now=function(){return o.now()-u}}var d=[],f=[],h=1,p=null,m=3,y=!1,x=!1,E=!1,w=!1,T=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function A(z){for(var I=r(f);I!==null;){if(I.callback===null)a(f);else if(I.startTime<=z)a(f),I.sortIndex=I.expirationTime,e(d,I);else break;I=r(f)}}function D(z){if(E=!1,A(z),!x)if(r(d)!==null)x=!0,M||(M=!0,R());else{var I=r(f);I!==null&&H(D,I.startTime-z)}}var M=!1,j=-1,k=5,B=-1;function P(){return w?!0:!(t.unstable_now()-B<k)}function U(){if(w=!1,M){var z=t.unstable_now();B=z;var I=!0;try{e:{x=!1,E&&(E=!1,C(j),j=-1),y=!0;var F=m;try{t:{for(A(z),p=r(d);p!==null&&!(p.expirationTime>z&&P());){var K=p.callback;if(typeof K=="function"){p.callback=null,m=p.priorityLevel;var J=K(p.expirationTime<=z);if(z=t.unstable_now(),typeof J=="function"){p.callback=J,A(z),I=!0;break t}p===r(d)&&a(d),A(z)}else a(d);p=r(d)}if(p!==null)I=!0;else{var L=r(f);L!==null&&H(D,L.startTime-z),I=!1}}break e}finally{p=null,m=F,y=!1}I=void 0}}finally{I?R():M=!1}}}var R;if(typeof N=="function")R=function(){N(U)};else if(typeof MessageChannel<"u"){var V=new MessageChannel,_=V.port2;V.port1.onmessage=U,R=function(){_.postMessage(null)}}else R=function(){T(U,0)};function H(z,I){j=T(function(){z(t.unstable_now())},I)}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(z){z.callback=null},t.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):k=0<z?Math.floor(1e3/z):5},t.unstable_getCurrentPriorityLevel=function(){return m},t.unstable_next=function(z){switch(m){case 1:case 2:case 3:var I=3;break;default:I=m}var F=m;m=I;try{return z()}finally{m=F}},t.unstable_requestPaint=function(){w=!0},t.unstable_runWithPriority=function(z,I){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var F=m;m=z;try{return I()}finally{m=F}},t.unstable_scheduleCallback=function(z,I,F){var K=t.unstable_now();switch(typeof F=="object"&&F!==null?(F=F.delay,F=typeof F=="number"&&0<F?K+F:K):F=K,z){case 1:var J=-1;break;case 2:J=250;break;case 5:J=1073741823;break;case 4:J=1e4;break;default:J=5e3}return J=F+J,z={id:h++,callback:I,priorityLevel:z,startTime:F,expirationTime:J,sortIndex:-1},F>K?(z.sortIndex=F,e(f,z),r(d)===null&&z===r(f)&&(E?(C(j),j=-1):E=!0,H(D,F-K))):(z.sortIndex=J,e(d,z),x||y||(x=!0,M||(M=!0,R()))),z},t.unstable_shouldYield=P,t.unstable_wrapCallback=function(z){var I=m;return function(){var F=m;m=I;try{return z.apply(this,arguments)}finally{m=F}}}})(Pp)),Pp}var e2;function o4(){return e2||(e2=1,Lp.exports=l4()),Lp.exports}var zp={exports:{}},$r={};/**
26
+ * @license React
27
+ * react-dom.production.js
28
+ *
29
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */var t2;function u4(){if(t2)return $r;t2=1;var t=ym();function e(d){var f="https://react.dev/errors/"+d;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var h=2;h<arguments.length;h++)f+="&args[]="+encodeURIComponent(arguments[h])}return"Minified React error #"+d+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var a={d:{f:r,r:function(){throw Error(e(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},i=Symbol.for("react.portal");function s(d,f,h){var p=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:p==null?null:""+p,children:d,containerInfo:f,implementation:h}}var o=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(d,f){if(d==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return $r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,$r.createPortal=function(d,f){var h=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(e(299));return s(d,f,null,h)},$r.flushSync=function(d){var f=o.T,h=a.p;try{if(o.T=null,a.p=2,d)return d()}finally{o.T=f,a.p=h,a.d.f()}},$r.preconnect=function(d,f){typeof d=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,a.d.C(d,f))},$r.prefetchDNS=function(d){typeof d=="string"&&a.d.D(d)},$r.preinit=function(d,f){if(typeof d=="string"&&f&&typeof f.as=="string"){var h=f.as,p=u(h,f.crossOrigin),m=typeof f.integrity=="string"?f.integrity:void 0,y=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;h==="style"?a.d.S(d,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:p,integrity:m,fetchPriority:y}):h==="script"&&a.d.X(d,{crossOrigin:p,integrity:m,fetchPriority:y,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},$r.preinitModule=function(d,f){if(typeof d=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var h=u(f.as,f.crossOrigin);a.d.M(d,{crossOrigin:h,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&a.d.M(d)},$r.preload=function(d,f){if(typeof d=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var h=f.as,p=u(h,f.crossOrigin);a.d.L(d,h,{crossOrigin:p,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},$r.preloadModule=function(d,f){if(typeof d=="string")if(f){var h=u(f.as,f.crossOrigin);a.d.m(d,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:h,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else a.d.m(d)},$r.requestFormReset=function(d){a.d.r(d)},$r.unstable_batchedUpdates=function(d,f){return d(f)},$r.useFormState=function(d,f,h){return o.H.useFormState(d,f,h)},$r.useFormStatus=function(){return o.H.useHostTransitionStatus()},$r.version="19.2.4",$r}var r2;function UE(){if(r2)return zp.exports;r2=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),zp.exports=u4(),zp.exports}/**
34
+ * @license React
35
+ * react-dom-client.production.js
36
+ *
37
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
38
+ *
39
+ * This source code is licensed under the MIT license found in the
40
+ * LICENSE file in the root directory of this source tree.
41
+ */var a2;function c4(){if(a2)return ku;a2=1;var t=o4(),e=ym(),r=UE();function a(n){var l="https://react.dev/errors/"+n;if(1<arguments.length){l+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)l+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+n+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function s(n){var l=n,c=n;if(n.alternate)for(;l.return;)l=l.return;else{n=l;do l=n,(l.flags&4098)!==0&&(c=l.return),n=l.return;while(n)}return l.tag===3?c:null}function o(n){if(n.tag===13){var l=n.memoizedState;if(l===null&&(n=n.alternate,n!==null&&(l=n.memoizedState)),l!==null)return l.dehydrated}return null}function u(n){if(n.tag===31){var l=n.memoizedState;if(l===null&&(n=n.alternate,n!==null&&(l=n.memoizedState)),l!==null)return l.dehydrated}return null}function d(n){if(s(n)!==n)throw Error(a(188))}function f(n){var l=n.alternate;if(!l){if(l=s(n),l===null)throw Error(a(188));return l!==n?null:n}for(var c=n,v=l;;){var b=c.return;if(b===null)break;var S=b.alternate;if(S===null){if(v=b.return,v!==null){c=v;continue}break}if(b.child===S.child){for(S=b.child;S;){if(S===c)return d(b),n;if(S===v)return d(b),l;S=S.sibling}throw Error(a(188))}if(c.return!==v.return)c=b,v=S;else{for(var O=!1,G=b.child;G;){if(G===c){O=!0,c=b,v=S;break}if(G===v){O=!0,v=b,c=S;break}G=G.sibling}if(!O){for(G=S.child;G;){if(G===c){O=!0,c=S,v=b;break}if(G===v){O=!0,v=S,c=b;break}G=G.sibling}if(!O)throw Error(a(189))}}if(c.alternate!==v)throw Error(a(190))}if(c.tag!==3)throw Error(a(188));return c.stateNode.current===c?n:l}function h(n){var l=n.tag;if(l===5||l===26||l===27||l===6)return n;for(n=n.child;n!==null;){if(l=h(n),l!==null)return l;n=n.sibling}return null}var p=Object.assign,m=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),C=Symbol.for("react.consumer"),N=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),M=Symbol.for("react.suspense_list"),j=Symbol.for("react.memo"),k=Symbol.for("react.lazy"),B=Symbol.for("react.activity"),P=Symbol.for("react.memo_cache_sentinel"),U=Symbol.iterator;function R(n){return n===null||typeof n!="object"?null:(n=U&&n[U]||n["@@iterator"],typeof n=="function"?n:null)}var V=Symbol.for("react.client.reference");function _(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===V?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case E:return"Fragment";case T:return"Profiler";case w:return"StrictMode";case D:return"Suspense";case M:return"SuspenseList";case B:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case x:return"Portal";case N:return n.displayName||"Context";case C:return(n._context.displayName||"Context")+".Consumer";case A:var l=n.render;return n=n.displayName,n||(n=l.displayName||l.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case j:return l=n.displayName||null,l!==null?l:_(n.type)||"Memo";case k:l=n._payload,n=n._init;try{return _(n(l))}catch{}}return null}var H=Array.isArray,z=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F={pending:!1,data:null,method:null,action:null},K=[],J=-1;function L(n){return{current:n}}function Q(n){0>J||(n.current=K[J],K[J]=null,J--)}function X(n,l){J++,K[J]=n.current,n.current=l}var W=L(null),te=L(null),Y=L(null),ne=L(null);function he(n,l){switch(X(Y,l),X(te,n),X(W,null),l.nodeType){case 9:case 11:n=(n=l.documentElement)&&(n=n.namespaceURI)?m1(n):0;break;default:if(n=l.tagName,l=l.namespaceURI)l=m1(l),n=y1(l,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}Q(W),X(W,n)}function oe(){Q(W),Q(te),Q(Y)}function ae(n){n.memoizedState!==null&&X(ne,n);var l=W.current,c=y1(l,n.type);l!==c&&(X(te,n),X(W,c))}function re(n){te.current===n&&(Q(W),Q(te)),ne.current===n&&(Q(ne),Cu._currentValue=F)}var le,se;function Ne(n){if(le===void 0)try{throw Error()}catch(c){var l=c.stack.trim().match(/\n( *(at )?)/);le=l&&l[1]||"",se=-1<c.stack.indexOf(`
42
+ at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
43
+ `+le+n+se}var Ae=!1;function Ze(n,l){if(!n||Ae)return"";Ae=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var v={DetermineComponentFrameRoot:function(){try{if(l){var Ce=function(){throw Error()};if(Object.defineProperty(Ce.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ce,[])}catch(me){var ve=me}Reflect.construct(n,[],Ce)}else{try{Ce.call()}catch(me){ve=me}n.call(Ce.prototype)}}else{try{throw Error()}catch(me){ve=me}(Ce=n())&&typeof Ce.catch=="function"&&Ce.catch(function(){})}}catch(me){if(me&&ve&&typeof me.stack=="string")return[me.stack,ve.stack]}return[null,null]}};v.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var b=Object.getOwnPropertyDescriptor(v.DetermineComponentFrameRoot,"name");b&&b.configurable&&Object.defineProperty(v.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var S=v.DetermineComponentFrameRoot(),O=S[0],G=S[1];if(O&&G){var ee=O.split(`
44
+ `),fe=G.split(`
45
+ `);for(b=v=0;v<ee.length&&!ee[v].includes("DetermineComponentFrameRoot");)v++;for(;b<fe.length&&!fe[b].includes("DetermineComponentFrameRoot");)b++;if(v===ee.length||b===fe.length)for(v=ee.length-1,b=fe.length-1;1<=v&&0<=b&&ee[v]!==fe[b];)b--;for(;1<=v&&0<=b;v--,b--)if(ee[v]!==fe[b]){if(v!==1||b!==1)do if(v--,b--,0>b||ee[v]!==fe[b]){var be=`
46
+ `+ee[v].replace(" at new "," at ");return n.displayName&&be.includes("<anonymous>")&&(be=be.replace("<anonymous>",n.displayName)),be}while(1<=v&&0<=b);break}}}finally{Ae=!1,Error.prepareStackTrace=c}return(c=n?n.displayName||n.name:"")?Ne(c):""}function Qe(n,l){switch(n.tag){case 26:case 27:case 5:return Ne(n.type);case 16:return Ne("Lazy");case 13:return n.child!==l&&l!==null?Ne("Suspense Fallback"):Ne("Suspense");case 19:return Ne("SuspenseList");case 0:case 15:return Ze(n.type,!1);case 11:return Ze(n.type.render,!1);case 1:return Ze(n.type,!0);case 31:return Ne("Activity");default:return""}}function Se(n){try{var l="",c=null;do l+=Qe(n,c),c=n,n=n.return;while(n);return l}catch(v){return`
47
+ Error generating stack: `+v.message+`
48
+ `+v.stack}}var Oe=Object.prototype.hasOwnProperty,ke=t.unstable_scheduleCallback,Pe=t.unstable_cancelCallback,Ge=t.unstable_shouldYield,Je=t.unstable_requestPaint,Be=t.unstable_now,nt=t.unstable_getCurrentPriorityLevel,ye=t.unstable_ImmediatePriority,$e=t.unstable_UserBlockingPriority,et=t.unstable_NormalPriority,xe=t.unstable_LowPriority,ze=t.unstable_IdlePriority,Re=t.log,we=t.unstable_setDisableYieldValue,$=null,ce=null;function ge(n){if(typeof Re=="function"&&we(n),ce&&typeof ce.setStrictMode=="function")try{ce.setStrictMode($,n)}catch{}}var pe=Math.clz32?Math.clz32:je,Ee=Math.log,Ue=Math.LN2;function je(n){return n>>>=0,n===0?32:31-(Ee(n)/Ue|0)|0}var He=256,_e=262144,Ke=4194304;function it(n){var l=n&42;if(l!==0)return l;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 st(n,l,c){var v=n.pendingLanes;if(v===0)return 0;var b=0,S=n.suspendedLanes,O=n.pingedLanes;n=n.warmLanes;var G=v&134217727;return G!==0?(v=G&~S,v!==0?b=it(v):(O&=G,O!==0?b=it(O):c||(c=G&~n,c!==0&&(b=it(c))))):(G=v&~S,G!==0?b=it(G):O!==0?b=it(O):c||(c=v&~n,c!==0&&(b=it(c)))),b===0?0:l!==0&&l!==b&&(l&S)===0&&(S=b&-b,c=l&-l,S>=c||S===32&&(c&4194048)!==0)?l:b}function Ve(n,l){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&l)===0}function dt(n,l){switch(n){case 1:case 2:case 4:case 8:case 64:return l+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 l+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 ut(){var n=Ke;return Ke<<=1,(Ke&62914560)===0&&(Ke=4194304),n}function Yt(n){for(var l=[],c=0;31>c;c++)l.push(n);return l}function Ot(n,l){n.pendingLanes|=l,l!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function Lr(n,l,c,v,b,S){var O=n.pendingLanes;n.pendingLanes=c,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=c,n.entangledLanes&=c,n.errorRecoveryDisabledLanes&=c,n.shellSuspendCounter=0;var G=n.entanglements,ee=n.expirationTimes,fe=n.hiddenUpdates;for(c=O&~c;0<c;){var be=31-pe(c),Ce=1<<be;G[be]=0,ee[be]=-1;var ve=fe[be];if(ve!==null)for(fe[be]=null,be=0;be<ve.length;be++){var me=ve[be];me!==null&&(me.lane&=-536870913)}c&=~Ce}v!==0&&Kt(n,v,0),S!==0&&b===0&&n.tag!==0&&(n.suspendedLanes|=S&~(O&~l))}function Kt(n,l,c){n.pendingLanes|=l,n.suspendedLanes&=~l;var v=31-pe(l);n.entangledLanes|=l,n.entanglements[v]=n.entanglements[v]|1073741824|c&261930}function sr(n,l){var c=n.entangledLanes|=l;for(n=n.entanglements;c;){var v=31-pe(c),b=1<<v;b&l|n[v]&l&&(n[v]|=l),c&=~b}}function Jt(n,l){var c=l&-l;return c=(c&42)!==0?1:lr(c),(c&(n.suspendedLanes|l))!==0?0:c}function lr(n){switch(n){case 2:n=1;break;case 8:n=4;break;case 32:n=16;break;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:case 4194304:case 8388608:case 16777216:case 33554432:n=128;break;case 268435456:n=134217728;break;default:n=0}return n}function Ra(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function Xt(){var n=I.p;return n!==0?n:(n=window.event,n===void 0?32:I1(n.type))}function Ba(n,l){var c=I.p;try{return I.p=n,l()}finally{I.p=c}}var Cr=Math.random().toString(36).slice(2),Ht="__reactFiber$"+Cr,xr="__reactProps$"+Cr,sa="__reactContainer$"+Cr,Nr="__reactEvents$"+Cr,jr="__reactListeners$"+Cr,Gr="__reactHandles$"+Cr,ni="__reactResources$"+Cr,Ar="__reactMarker$"+Cr;function dl(n){delete n[Ht],delete n[xr],delete n[Nr],delete n[jr],delete n[Gr]}function ii(n){var l=n[Ht];if(l)return l;for(var c=n.parentNode;c;){if(l=c[sa]||c[Ht]){if(c=l.alternate,l.child!==null||c!==null&&c.child!==null)for(n=C1(n);n!==null;){if(c=n[Ht])return c;n=C1(n)}return l}n=c,c=n.parentNode}return null}function si(n){if(n=n[Ht]||n[sa]){var l=n.tag;if(l===5||l===6||l===13||l===31||l===26||l===27||l===3)return n}return null}function ps(n){var l=n.tag;if(l===5||l===26||l===27||l===6)return n.stateNode;throw Error(a(33))}function li(n){var l=n[ni];return l||(l=n[ni]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function dr(n){n[Ar]=!0}var Lc=new Set,Pc={};function wa(n,l){cn(n,l),cn(n+"Capture",l)}function cn(n,l){for(Pc[n]=l,n=0;n<l.length;n++)Lc.add(l[n])}var fl=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),qo={},Io={};function Sh(n){return Oe.call(Io,n)?!0:Oe.call(qo,n)?!1:fl.test(n)?Io[n]=!0:(qo[n]=!0,!1)}function Qr(n,l,c){if(Sh(l))if(c===null)n.removeAttribute(l);else{switch(typeof c){case"undefined":case"function":case"symbol":n.removeAttribute(l);return;case"boolean":var v=l.toLowerCase().slice(0,5);if(v!=="data-"&&v!=="aria-"){n.removeAttribute(l);return}}n.setAttribute(l,""+c)}}function oi(n,l,c){if(c===null)n.removeAttribute(l);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(l);return}n.setAttribute(l,""+c)}}function La(n,l,c,v){if(v===null)n.removeAttribute(c);else{switch(typeof v){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(c);return}n.setAttributeNS(l,c,""+v)}}function Mr(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function la(n){var l=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function Eh(n,l,c){var v=Object.getOwnPropertyDescriptor(n.constructor.prototype,l);if(!n.hasOwnProperty(l)&&typeof v<"u"&&typeof v.get=="function"&&typeof v.set=="function"){var b=v.get,S=v.set;return Object.defineProperty(n,l,{configurable:!0,get:function(){return b.call(this)},set:function(O){c=""+O,S.call(this,O)}}),Object.defineProperty(n,l,{enumerable:v.enumerable}),{getValue:function(){return c},setValue:function(O){c=""+O},stopTracking:function(){n._valueTracker=null,delete n[l]}}}}function zc(n){if(!n._valueTracker){var l=la(n)?"checked":"value";n._valueTracker=Eh(n,l,""+n[l])}}function _c(n){if(!n)return!1;var l=n._valueTracker;if(!l)return!0;var c=l.getValue(),v="";return n&&(v=la(n)?n.checked?"true":"false":n.value),n=v,n!==c?(l.setValue(n),!0):!1}function Uc(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}var KN=/[\n"\\]/g;function Pa(n){return n.replace(KN,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function Th(n,l,c,v,b,S,O,G){n.name="",O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"?n.type=O:n.removeAttribute("type"),l!=null?O==="number"?(l===0&&n.value===""||n.value!=l)&&(n.value=""+Mr(l)):n.value!==""+Mr(l)&&(n.value=""+Mr(l)):O!=="submit"&&O!=="reset"||n.removeAttribute("value"),l!=null?Ch(n,O,Mr(l)):c!=null?Ch(n,O,Mr(c)):v!=null&&n.removeAttribute("value"),b==null&&S!=null&&(n.defaultChecked=!!S),b!=null&&(n.checked=b&&typeof b!="function"&&typeof b!="symbol"),G!=null&&typeof G!="function"&&typeof G!="symbol"&&typeof G!="boolean"?n.name=""+Mr(G):n.removeAttribute("name")}function dy(n,l,c,v,b,S,O,G){if(S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(n.type=S),l!=null||c!=null){if(!(S!=="submit"&&S!=="reset"||l!=null)){zc(n);return}c=c!=null?""+Mr(c):"",l=l!=null?""+Mr(l):c,G||l===n.value||(n.value=l),n.defaultValue=l}v=v??b,v=typeof v!="function"&&typeof v!="symbol"&&!!v,n.checked=G?n.checked:!!v,n.defaultChecked=!!v,O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"&&(n.name=O),zc(n)}function Ch(n,l,c){l==="number"&&Uc(n.ownerDocument)===n||n.defaultValue===""+c||(n.defaultValue=""+c)}function hl(n,l,c,v){if(n=n.options,l){l={};for(var b=0;b<c.length;b++)l["$"+c[b]]=!0;for(c=0;c<n.length;c++)b=l.hasOwnProperty("$"+n[c].value),n[c].selected!==b&&(n[c].selected=b),b&&v&&(n[c].defaultSelected=!0)}else{for(c=""+Mr(c),l=null,b=0;b<n.length;b++){if(n[b].value===c){n[b].selected=!0,v&&(n[b].defaultSelected=!0);return}l!==null||n[b].disabled||(l=n[b])}l!==null&&(l.selected=!0)}}function fy(n,l,c){if(l!=null&&(l=""+Mr(l),l!==n.value&&(n.value=l),c==null)){n.defaultValue!==l&&(n.defaultValue=l);return}n.defaultValue=c!=null?""+Mr(c):""}function hy(n,l,c,v){if(l==null){if(v!=null){if(c!=null)throw Error(a(92));if(H(v)){if(1<v.length)throw Error(a(93));v=v[0]}c=v}c==null&&(c=""),l=c}c=Mr(l),n.defaultValue=c,v=n.textContent,v===c&&v!==""&&v!==null&&(n.value=v),zc(n)}function vl(n,l){if(l){var c=n.firstChild;if(c&&c===n.lastChild&&c.nodeType===3){c.nodeValue=l;return}}n.textContent=l}var XN=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function vy(n,l,c){var v=l.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?v?n.setProperty(l,""):l==="float"?n.cssFloat="":n[l]="":v?n.setProperty(l,c):typeof c!="number"||c===0||XN.has(l)?l==="float"?n.cssFloat=c:n[l]=(""+c).trim():n[l]=c+"px"}function py(n,l,c){if(l!=null&&typeof l!="object")throw Error(a(62));if(n=n.style,c!=null){for(var v in c)!c.hasOwnProperty(v)||l!=null&&l.hasOwnProperty(v)||(v.indexOf("--")===0?n.setProperty(v,""):v==="float"?n.cssFloat="":n[v]="");for(var b in l)v=l[b],l.hasOwnProperty(b)&&c[b]!==v&&vy(n,b,v)}else for(var S in l)l.hasOwnProperty(S)&&vy(n,S,l[S])}function Nh(n){if(n.indexOf("-")===-1)return!1;switch(n){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var ZN=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),WN=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function qc(n){return WN.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function jn(){}var jh=null;function Ah(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var pl=null,gl=null;function gy(n){var l=si(n);if(l&&(n=l.stateNode)){var c=n[xr]||null;e:switch(n=l.stateNode,l.type){case"input":if(Th(n,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),l=c.name,c.type==="radio"&&l!=null){for(c=n;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+Pa(""+l)+'"][type="radio"]'),l=0;l<c.length;l++){var v=c[l];if(v!==n&&v.form===n.form){var b=v[xr]||null;if(!b)throw Error(a(90));Th(v,b.value,b.defaultValue,b.defaultValue,b.checked,b.defaultChecked,b.type,b.name)}}for(l=0;l<c.length;l++)v=c[l],v.form===n.form&&_c(v)}break e;case"textarea":fy(n,c.value,c.defaultValue);break e;case"select":l=c.value,l!=null&&hl(n,!!c.multiple,l,!1)}}}var Mh=!1;function my(n,l,c){if(Mh)return n(l,c);Mh=!0;try{var v=n(l);return v}finally{if(Mh=!1,(pl!==null||gl!==null)&&(jd(),pl&&(l=pl,n=gl,gl=pl=null,gy(l),n)))for(l=0;l<n.length;l++)gy(n[l])}}function Vo(n,l){var c=n.stateNode;if(c===null)return null;var v=c[xr]||null;if(v===null)return null;c=v[l];e:switch(l){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(v=!v.disabled)||(n=n.type,v=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!v;break e;default:n=!1}if(n)return null;if(c&&typeof c!="function")throw Error(a(231,l,typeof c));return c}var An=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),kh=!1;if(An)try{var Fo={};Object.defineProperty(Fo,"passive",{get:function(){kh=!0}}),window.addEventListener("test",Fo,Fo),window.removeEventListener("test",Fo,Fo)}catch{kh=!1}var ui=null,Dh=null,Ic=null;function yy(){if(Ic)return Ic;var n,l=Dh,c=l.length,v,b="value"in ui?ui.value:ui.textContent,S=b.length;for(n=0;n<c&&l[n]===b[n];n++);var O=c-n;for(v=1;v<=O&&l[c-v]===b[S-v];v++);return Ic=b.slice(n,1<v?1-v:void 0)}function Vc(n){var l=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&l===13&&(n=13)):n=l,n===10&&(n=13),32<=n||n===13?n:0}function Fc(){return!0}function xy(){return!1}function oa(n){function l(c,v,b,S,O){this._reactName=c,this._targetInst=b,this.type=v,this.nativeEvent=S,this.target=O,this.currentTarget=null;for(var G in n)n.hasOwnProperty(G)&&(c=n[G],this[G]=c?c(S):S[G]);return this.isDefaultPrevented=(S.defaultPrevented!=null?S.defaultPrevented:S.returnValue===!1)?Fc:xy,this.isPropagationStopped=xy,this}return p(l.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=Fc)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=Fc)},persist:function(){},isPersistent:Fc}),l}var gs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Hc=oa(gs),Ho=p({},gs,{view:0,detail:0}),JN=oa(Ho),Oh,Rh,Go,Gc=p({},Ho,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Lh,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==Go&&(Go&&n.type==="mousemove"?(Oh=n.screenX-Go.screenX,Rh=n.screenY-Go.screenY):Rh=Oh=0,Go=n),Oh)},movementY:function(n){return"movementY"in n?n.movementY:Rh}}),by=oa(Gc),ej=p({},Gc,{dataTransfer:0}),tj=oa(ej),rj=p({},Ho,{relatedTarget:0}),Bh=oa(rj),aj=p({},gs,{animationName:0,elapsedTime:0,pseudoElement:0}),nj=oa(aj),ij=p({},gs,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),sj=oa(ij),lj=p({},gs,{data:0}),wy=oa(lj),oj={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},uj={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},cj={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function dj(n){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(n):(n=cj[n])?!!l[n]:!1}function Lh(){return dj}var fj=p({},Ho,{key:function(n){if(n.key){var l=oj[n.key]||n.key;if(l!=="Unidentified")return l}return n.type==="keypress"?(n=Vc(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?uj[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Lh,charCode:function(n){return n.type==="keypress"?Vc(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?Vc(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),hj=oa(fj),vj=p({},Gc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Sy=oa(vj),pj=p({},Ho,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Lh}),gj=oa(pj),mj=p({},gs,{propertyName:0,elapsedTime:0,pseudoElement:0}),yj=oa(mj),xj=p({},Gc,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),bj=oa(xj),wj=p({},gs,{newState:0,oldState:0}),Sj=oa(wj),Ej=[9,13,27,32],Ph=An&&"CompositionEvent"in window,Qo=null;An&&"documentMode"in document&&(Qo=document.documentMode);var Tj=An&&"TextEvent"in window&&!Qo,Ey=An&&(!Ph||Qo&&8<Qo&&11>=Qo),Ty=" ",Cy=!1;function Ny(n,l){switch(n){case"keyup":return Ej.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function jy(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var ml=!1;function Cj(n,l){switch(n){case"compositionend":return jy(l);case"keypress":return l.which!==32?null:(Cy=!0,Ty);case"textInput":return n=l.data,n===Ty&&Cy?null:n;default:return null}}function Nj(n,l){if(ml)return n==="compositionend"||!Ph&&Ny(n,l)?(n=yy(),Ic=Dh=ui=null,ml=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1<l.char.length)return l.char;if(l.which)return String.fromCharCode(l.which)}return null;case"compositionend":return Ey&&l.locale!=="ko"?null:l.data;default:return null}}var jj={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Ay(n){var l=n&&n.nodeName&&n.nodeName.toLowerCase();return l==="input"?!!jj[n.type]:l==="textarea"}function My(n,l,c,v){pl?gl?gl.push(v):gl=[v]:pl=v,l=Bd(l,"onChange"),0<l.length&&(c=new Hc("onChange","change",null,c,v),n.push({event:c,listeners:l}))}var $o=null,Yo=null;function Aj(n){d1(n,0)}function Qc(n){var l=ps(n);if(_c(l))return n}function ky(n,l){if(n==="change")return l}var Dy=!1;if(An){var zh;if(An){var _h="oninput"in document;if(!_h){var Oy=document.createElement("div");Oy.setAttribute("oninput","return;"),_h=typeof Oy.oninput=="function"}zh=_h}else zh=!1;Dy=zh&&(!document.documentMode||9<document.documentMode)}function Ry(){$o&&($o.detachEvent("onpropertychange",By),Yo=$o=null)}function By(n){if(n.propertyName==="value"&&Qc(Yo)){var l=[];My(l,Yo,n,Ah(n)),my(Aj,l)}}function Mj(n,l,c){n==="focusin"?(Ry(),$o=l,Yo=c,$o.attachEvent("onpropertychange",By)):n==="focusout"&&Ry()}function kj(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return Qc(Yo)}function Dj(n,l){if(n==="click")return Qc(l)}function Oj(n,l){if(n==="input"||n==="change")return Qc(l)}function Rj(n,l){return n===l&&(n!==0||1/n===1/l)||n!==n&&l!==l}var Sa=typeof Object.is=="function"?Object.is:Rj;function Ko(n,l){if(Sa(n,l))return!0;if(typeof n!="object"||n===null||typeof l!="object"||l===null)return!1;var c=Object.keys(n),v=Object.keys(l);if(c.length!==v.length)return!1;for(v=0;v<c.length;v++){var b=c[v];if(!Oe.call(l,b)||!Sa(n[b],l[b]))return!1}return!0}function Ly(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function Py(n,l){var c=Ly(n);n=0;for(var v;c;){if(c.nodeType===3){if(v=n+c.textContent.length,n<=l&&v>=l)return{node:c,offset:l-n};n=v}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=Ly(c)}}function zy(n,l){return n&&l?n===l?!0:n&&n.nodeType===3?!1:l&&l.nodeType===3?zy(n,l.parentNode):"contains"in n?n.contains(l):n.compareDocumentPosition?!!(n.compareDocumentPosition(l)&16):!1:!1}function _y(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var l=Uc(n.document);l instanceof n.HTMLIFrameElement;){try{var c=typeof l.contentWindow.location.href=="string"}catch{c=!1}if(c)n=l.contentWindow;else break;l=Uc(n.document)}return l}function Uh(n){var l=n&&n.nodeName&&n.nodeName.toLowerCase();return l&&(l==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||l==="textarea"||n.contentEditable==="true")}var Bj=An&&"documentMode"in document&&11>=document.documentMode,yl=null,qh=null,Xo=null,Ih=!1;function Uy(n,l,c){var v=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;Ih||yl==null||yl!==Uc(v)||(v=yl,"selectionStart"in v&&Uh(v)?v={start:v.selectionStart,end:v.selectionEnd}:(v=(v.ownerDocument&&v.ownerDocument.defaultView||window).getSelection(),v={anchorNode:v.anchorNode,anchorOffset:v.anchorOffset,focusNode:v.focusNode,focusOffset:v.focusOffset}),Xo&&Ko(Xo,v)||(Xo=v,v=Bd(qh,"onSelect"),0<v.length&&(l=new Hc("onSelect","select",null,l,c),n.push({event:l,listeners:v}),l.target=yl)))}function ms(n,l){var c={};return c[n.toLowerCase()]=l.toLowerCase(),c["Webkit"+n]="webkit"+l,c["Moz"+n]="moz"+l,c}var xl={animationend:ms("Animation","AnimationEnd"),animationiteration:ms("Animation","AnimationIteration"),animationstart:ms("Animation","AnimationStart"),transitionrun:ms("Transition","TransitionRun"),transitionstart:ms("Transition","TransitionStart"),transitioncancel:ms("Transition","TransitionCancel"),transitionend:ms("Transition","TransitionEnd")},Vh={},qy={};An&&(qy=document.createElement("div").style,"AnimationEvent"in window||(delete xl.animationend.animation,delete xl.animationiteration.animation,delete xl.animationstart.animation),"TransitionEvent"in window||delete xl.transitionend.transition);function ys(n){if(Vh[n])return Vh[n];if(!xl[n])return n;var l=xl[n],c;for(c in l)if(l.hasOwnProperty(c)&&c in qy)return Vh[n]=l[c];return n}var Iy=ys("animationend"),Vy=ys("animationiteration"),Fy=ys("animationstart"),Lj=ys("transitionrun"),Pj=ys("transitionstart"),zj=ys("transitioncancel"),Hy=ys("transitionend"),Gy=new Map,Fh="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Fh.push("scrollEnd");function Za(n,l){Gy.set(n,l),wa(l,[n])}var $c=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var l=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof n=="object"&&n!==null&&typeof n.message=="string"?String(n.message):String(n),error:n});if(!window.dispatchEvent(l))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)},za=[],bl=0,Hh=0;function Yc(){for(var n=bl,l=Hh=bl=0;l<n;){var c=za[l];za[l++]=null;var v=za[l];za[l++]=null;var b=za[l];za[l++]=null;var S=za[l];if(za[l++]=null,v!==null&&b!==null){var O=v.pending;O===null?b.next=b:(b.next=O.next,O.next=b),v.pending=b}S!==0&&Qy(c,b,S)}}function Kc(n,l,c,v){za[bl++]=n,za[bl++]=l,za[bl++]=c,za[bl++]=v,Hh|=v,n.lanes|=v,n=n.alternate,n!==null&&(n.lanes|=v)}function Gh(n,l,c,v){return Kc(n,l,c,v),Xc(n)}function xs(n,l){return Kc(n,null,null,l),Xc(n)}function Qy(n,l,c){n.lanes|=c;var v=n.alternate;v!==null&&(v.lanes|=c);for(var b=!1,S=n.return;S!==null;)S.childLanes|=c,v=S.alternate,v!==null&&(v.childLanes|=c),S.tag===22&&(n=S.stateNode,n===null||n._visibility&1||(b=!0)),n=S,S=S.return;return n.tag===3?(S=n.stateNode,b&&l!==null&&(b=31-pe(c),n=S.hiddenUpdates,v=n[b],v===null?n[b]=[l]:v.push(l),l.lane=c|536870912),S):null}function Xc(n){if(50<yu)throw yu=0,ep=null,Error(a(185));for(var l=n.return;l!==null;)n=l,l=n.return;return n.tag===3?n.stateNode:null}var wl={};function _j(n,l,c,v){this.tag=n,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=l,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=v,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ea(n,l,c,v){return new _j(n,l,c,v)}function Qh(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Mn(n,l){var c=n.alternate;return c===null?(c=Ea(n.tag,l,n.key,n.mode),c.elementType=n.elementType,c.type=n.type,c.stateNode=n.stateNode,c.alternate=n,n.alternate=c):(c.pendingProps=l,c.type=n.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=n.flags&65011712,c.childLanes=n.childLanes,c.lanes=n.lanes,c.child=n.child,c.memoizedProps=n.memoizedProps,c.memoizedState=n.memoizedState,c.updateQueue=n.updateQueue,l=n.dependencies,c.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},c.sibling=n.sibling,c.index=n.index,c.ref=n.ref,c.refCleanup=n.refCleanup,c}function $y(n,l){n.flags&=65011714;var c=n.alternate;return c===null?(n.childLanes=0,n.lanes=l,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=c.childLanes,n.lanes=c.lanes,n.child=c.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=c.memoizedProps,n.memoizedState=c.memoizedState,n.updateQueue=c.updateQueue,n.type=c.type,l=c.dependencies,n.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),n}function Zc(n,l,c,v,b,S){var O=0;if(v=n,typeof n=="function")Qh(n)&&(O=1);else if(typeof n=="string")O=F5(n,c,W.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case B:return n=Ea(31,c,l,b),n.elementType=B,n.lanes=S,n;case E:return bs(c.children,b,S,l);case w:O=8,b|=24;break;case T:return n=Ea(12,c,l,b|2),n.elementType=T,n.lanes=S,n;case D:return n=Ea(13,c,l,b),n.elementType=D,n.lanes=S,n;case M:return n=Ea(19,c,l,b),n.elementType=M,n.lanes=S,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case N:O=10;break e;case C:O=9;break e;case A:O=11;break e;case j:O=14;break e;case k:O=16,v=null;break e}O=29,c=Error(a(130,n===null?"null":typeof n,"")),v=null}return l=Ea(O,c,l,b),l.elementType=n,l.type=v,l.lanes=S,l}function bs(n,l,c,v){return n=Ea(7,n,v,l),n.lanes=c,n}function $h(n,l,c){return n=Ea(6,n,null,l),n.lanes=c,n}function Yy(n){var l=Ea(18,null,null,0);return l.stateNode=n,l}function Yh(n,l,c){return l=Ea(4,n.children!==null?n.children:[],n.key,l),l.lanes=c,l.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},l}var Ky=new WeakMap;function _a(n,l){if(typeof n=="object"&&n!==null){var c=Ky.get(n);return c!==void 0?c:(l={value:n,source:l,stack:Se(l)},Ky.set(n,l),l)}return{value:n,source:l,stack:Se(l)}}var Sl=[],El=0,Wc=null,Zo=0,Ua=[],qa=0,ci=null,dn=1,fn="";function kn(n,l){Sl[El++]=Zo,Sl[El++]=Wc,Wc=n,Zo=l}function Xy(n,l,c){Ua[qa++]=dn,Ua[qa++]=fn,Ua[qa++]=ci,ci=n;var v=dn;n=fn;var b=32-pe(v)-1;v&=~(1<<b),c+=1;var S=32-pe(l)+b;if(30<S){var O=b-b%5;S=(v&(1<<O)-1).toString(32),v>>=O,b-=O,dn=1<<32-pe(l)+b|c<<b|v,fn=S+n}else dn=1<<S|c<<b|v,fn=n}function Kh(n){n.return!==null&&(kn(n,1),Xy(n,1,0))}function Xh(n){for(;n===Wc;)Wc=Sl[--El],Sl[El]=null,Zo=Sl[--El],Sl[El]=null;for(;n===ci;)ci=Ua[--qa],Ua[qa]=null,fn=Ua[--qa],Ua[qa]=null,dn=Ua[--qa],Ua[qa]=null}function Zy(n,l){Ua[qa++]=dn,Ua[qa++]=fn,Ua[qa++]=ci,dn=l.id,fn=l.overflow,ci=n}var Pr=null,It=null,mt=!1,di=null,Ia=!1,Zh=Error(a(519));function fi(n){var l=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Wo(_a(l,n)),Zh}function Wy(n){var l=n.stateNode,c=n.type,v=n.memoizedProps;switch(l[Ht]=n,l[xr]=v,c){case"dialog":vt("cancel",l),vt("close",l);break;case"iframe":case"object":case"embed":vt("load",l);break;case"video":case"audio":for(c=0;c<bu.length;c++)vt(bu[c],l);break;case"source":vt("error",l);break;case"img":case"image":case"link":vt("error",l),vt("load",l);break;case"details":vt("toggle",l);break;case"input":vt("invalid",l),dy(l,v.value,v.defaultValue,v.checked,v.defaultChecked,v.type,v.name,!0);break;case"select":vt("invalid",l);break;case"textarea":vt("invalid",l),hy(l,v.value,v.defaultValue,v.children)}c=v.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||l.textContent===""+c||v.suppressHydrationWarning===!0||p1(l.textContent,c)?(v.popover!=null&&(vt("beforetoggle",l),vt("toggle",l)),v.onScroll!=null&&vt("scroll",l),v.onScrollEnd!=null&&vt("scrollend",l),v.onClick!=null&&(l.onclick=jn),l=!0):l=!1,l||fi(n,!0)}function Jy(n){for(Pr=n.return;Pr;)switch(Pr.tag){case 5:case 31:case 13:Ia=!1;return;case 27:case 3:Ia=!0;return;default:Pr=Pr.return}}function Tl(n){if(n!==Pr)return!1;if(!mt)return Jy(n),mt=!0,!1;var l=n.tag,c;if((c=l!==3&&l!==27)&&((c=l===5)&&(c=n.type,c=!(c!=="form"&&c!=="button")||pp(n.type,n.memoizedProps)),c=!c),c&&It&&fi(n),Jy(n),l===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(a(317));It=T1(n)}else if(l===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(a(317));It=T1(n)}else l===27?(l=It,Ni(n.type)?(n=bp,bp=null,It=n):It=l):It=Pr?Fa(n.stateNode.nextSibling):null;return!0}function ws(){It=Pr=null,mt=!1}function Wh(){var n=di;return n!==null&&(fa===null?fa=n:fa.push.apply(fa,n),di=null),n}function Wo(n){di===null?di=[n]:di.push(n)}var Jh=L(null),Ss=null,Dn=null;function hi(n,l,c){X(Jh,l._currentValue),l._currentValue=c}function On(n){n._currentValue=Jh.current,Q(Jh)}function ev(n,l,c){for(;n!==null;){var v=n.alternate;if((n.childLanes&l)!==l?(n.childLanes|=l,v!==null&&(v.childLanes|=l)):v!==null&&(v.childLanes&l)!==l&&(v.childLanes|=l),n===c)break;n=n.return}}function tv(n,l,c,v){var b=n.child;for(b!==null&&(b.return=n);b!==null;){var S=b.dependencies;if(S!==null){var O=b.child;S=S.firstContext;e:for(;S!==null;){var G=S;S=b;for(var ee=0;ee<l.length;ee++)if(G.context===l[ee]){S.lanes|=c,G=S.alternate,G!==null&&(G.lanes|=c),ev(S.return,c,n),v||(O=null);break e}S=G.next}}else if(b.tag===18){if(O=b.return,O===null)throw Error(a(341));O.lanes|=c,S=O.alternate,S!==null&&(S.lanes|=c),ev(O,c,n),O=null}else O=b.child;if(O!==null)O.return=b;else for(O=b;O!==null;){if(O===n){O=null;break}if(b=O.sibling,b!==null){b.return=O.return,O=b;break}O=O.return}b=O}}function Cl(n,l,c,v){n=null;for(var b=l,S=!1;b!==null;){if(!S){if((b.flags&524288)!==0)S=!0;else if((b.flags&262144)!==0)break}if(b.tag===10){var O=b.alternate;if(O===null)throw Error(a(387));if(O=O.memoizedProps,O!==null){var G=b.type;Sa(b.pendingProps.value,O.value)||(n!==null?n.push(G):n=[G])}}else if(b===ne.current){if(O=b.alternate,O===null)throw Error(a(387));O.memoizedState.memoizedState!==b.memoizedState.memoizedState&&(n!==null?n.push(Cu):n=[Cu])}b=b.return}n!==null&&tv(l,n,c,v),l.flags|=262144}function Jc(n){for(n=n.firstContext;n!==null;){if(!Sa(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function Es(n){Ss=n,Dn=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function zr(n){return ex(Ss,n)}function ed(n,l){return Ss===null&&Es(n),ex(n,l)}function ex(n,l){var c=l._currentValue;if(l={context:l,memoizedValue:c,next:null},Dn===null){if(n===null)throw Error(a(308));Dn=l,n.dependencies={lanes:0,firstContext:l},n.flags|=524288}else Dn=Dn.next=l;return c}var Uj=typeof AbortController<"u"?AbortController:function(){var n=[],l=this.signal={aborted:!1,addEventListener:function(c,v){n.push(v)}};this.abort=function(){l.aborted=!0,n.forEach(function(c){return c()})}},qj=t.unstable_scheduleCallback,Ij=t.unstable_NormalPriority,fr={$$typeof:N,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function rv(){return{controller:new Uj,data:new Map,refCount:0}}function Jo(n){n.refCount--,n.refCount===0&&qj(Ij,function(){n.controller.abort()})}var eu=null,av=0,Nl=0,jl=null;function Vj(n,l){if(eu===null){var c=eu=[];av=0,Nl=sp(),jl={status:"pending",value:void 0,then:function(v){c.push(v)}}}return av++,l.then(tx,tx),l}function tx(){if(--av===0&&eu!==null){jl!==null&&(jl.status="fulfilled");var n=eu;eu=null,Nl=0,jl=null;for(var l=0;l<n.length;l++)(0,n[l])()}}function Fj(n,l){var c=[],v={status:"pending",value:null,reason:null,then:function(b){c.push(b)}};return n.then(function(){v.status="fulfilled",v.value=l;for(var b=0;b<c.length;b++)(0,c[b])(l)},function(b){for(v.status="rejected",v.reason=b,b=0;b<c.length;b++)(0,c[b])(void 0)}),v}var rx=z.S;z.S=function(n,l){Ub=Be(),typeof l=="object"&&l!==null&&typeof l.then=="function"&&Vj(n,l),rx!==null&&rx(n,l)};var Ts=L(null);function nv(){var n=Ts.current;return n!==null?n:zt.pooledCache}function td(n,l){l===null?X(Ts,Ts.current):X(Ts,l.pool)}function ax(){var n=nv();return n===null?null:{parent:fr._currentValue,pool:n}}var Al=Error(a(460)),iv=Error(a(474)),rd=Error(a(542)),ad={then:function(){}};function nx(n){return n=n.status,n==="fulfilled"||n==="rejected"}function ix(n,l,c){switch(c=n[c],c===void 0?n.push(l):c!==l&&(l.then(jn,jn),l=c),l.status){case"fulfilled":return l.value;case"rejected":throw n=l.reason,lx(n),n;default:if(typeof l.status=="string")l.then(jn,jn);else{if(n=zt,n!==null&&100<n.shellSuspendCounter)throw Error(a(482));n=l,n.status="pending",n.then(function(v){if(l.status==="pending"){var b=l;b.status="fulfilled",b.value=v}},function(v){if(l.status==="pending"){var b=l;b.status="rejected",b.reason=v}})}switch(l.status){case"fulfilled":return l.value;case"rejected":throw n=l.reason,lx(n),n}throw Ns=l,Al}}function Cs(n){try{var l=n._init;return l(n._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(Ns=c,Al):c}}var Ns=null;function sx(){if(Ns===null)throw Error(a(459));var n=Ns;return Ns=null,n}function lx(n){if(n===Al||n===rd)throw Error(a(483))}var Ml=null,tu=0;function nd(n){var l=tu;return tu+=1,Ml===null&&(Ml=[]),ix(Ml,n,l)}function ru(n,l){l=l.props.ref,n.ref=l!==void 0?l:null}function id(n,l){throw l.$$typeof===m?Error(a(525)):(n=Object.prototype.toString.call(l),Error(a(31,n==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":n)))}function ox(n){function l(ue,ie){if(n){var de=ue.deletions;de===null?(ue.deletions=[ie],ue.flags|=16):de.push(ie)}}function c(ue,ie){if(!n)return null;for(;ie!==null;)l(ue,ie),ie=ie.sibling;return null}function v(ue){for(var ie=new Map;ue!==null;)ue.key!==null?ie.set(ue.key,ue):ie.set(ue.index,ue),ue=ue.sibling;return ie}function b(ue,ie){return ue=Mn(ue,ie),ue.index=0,ue.sibling=null,ue}function S(ue,ie,de){return ue.index=de,n?(de=ue.alternate,de!==null?(de=de.index,de<ie?(ue.flags|=67108866,ie):de):(ue.flags|=67108866,ie)):(ue.flags|=1048576,ie)}function O(ue){return n&&ue.alternate===null&&(ue.flags|=67108866),ue}function G(ue,ie,de,Te){return ie===null||ie.tag!==6?(ie=$h(de,ue.mode,Te),ie.return=ue,ie):(ie=b(ie,de),ie.return=ue,ie)}function ee(ue,ie,de,Te){var We=de.type;return We===E?be(ue,ie,de.props.children,Te,de.key):ie!==null&&(ie.elementType===We||typeof We=="object"&&We!==null&&We.$$typeof===k&&Cs(We)===ie.type)?(ie=b(ie,de.props),ru(ie,de),ie.return=ue,ie):(ie=Zc(de.type,de.key,de.props,null,ue.mode,Te),ru(ie,de),ie.return=ue,ie)}function fe(ue,ie,de,Te){return ie===null||ie.tag!==4||ie.stateNode.containerInfo!==de.containerInfo||ie.stateNode.implementation!==de.implementation?(ie=Yh(de,ue.mode,Te),ie.return=ue,ie):(ie=b(ie,de.children||[]),ie.return=ue,ie)}function be(ue,ie,de,Te,We){return ie===null||ie.tag!==7?(ie=bs(de,ue.mode,Te,We),ie.return=ue,ie):(ie=b(ie,de),ie.return=ue,ie)}function Ce(ue,ie,de){if(typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint")return ie=$h(""+ie,ue.mode,de),ie.return=ue,ie;if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case y:return de=Zc(ie.type,ie.key,ie.props,null,ue.mode,de),ru(de,ie),de.return=ue,de;case x:return ie=Yh(ie,ue.mode,de),ie.return=ue,ie;case k:return ie=Cs(ie),Ce(ue,ie,de)}if(H(ie)||R(ie))return ie=bs(ie,ue.mode,de,null),ie.return=ue,ie;if(typeof ie.then=="function")return Ce(ue,nd(ie),de);if(ie.$$typeof===N)return Ce(ue,ed(ue,ie),de);id(ue,ie)}return null}function ve(ue,ie,de,Te){var We=ie!==null?ie.key:null;if(typeof de=="string"&&de!==""||typeof de=="number"||typeof de=="bigint")return We!==null?null:G(ue,ie,""+de,Te);if(typeof de=="object"&&de!==null){switch(de.$$typeof){case y:return de.key===We?ee(ue,ie,de,Te):null;case x:return de.key===We?fe(ue,ie,de,Te):null;case k:return de=Cs(de),ve(ue,ie,de,Te)}if(H(de)||R(de))return We!==null?null:be(ue,ie,de,Te,null);if(typeof de.then=="function")return ve(ue,ie,nd(de),Te);if(de.$$typeof===N)return ve(ue,ie,ed(ue,de),Te);id(ue,de)}return null}function me(ue,ie,de,Te,We){if(typeof Te=="string"&&Te!==""||typeof Te=="number"||typeof Te=="bigint")return ue=ue.get(de)||null,G(ie,ue,""+Te,We);if(typeof Te=="object"&&Te!==null){switch(Te.$$typeof){case y:return ue=ue.get(Te.key===null?de:Te.key)||null,ee(ie,ue,Te,We);case x:return ue=ue.get(Te.key===null?de:Te.key)||null,fe(ie,ue,Te,We);case k:return Te=Cs(Te),me(ue,ie,de,Te,We)}if(H(Te)||R(Te))return ue=ue.get(de)||null,be(ie,ue,Te,We,null);if(typeof Te.then=="function")return me(ue,ie,de,nd(Te),We);if(Te.$$typeof===N)return me(ue,ie,de,ed(ie,Te),We);id(ie,Te)}return null}function Fe(ue,ie,de,Te){for(var We=null,St=null,Ye=ie,ct=ie=0,gt=null;Ye!==null&&ct<de.length;ct++){Ye.index>ct?(gt=Ye,Ye=null):gt=Ye.sibling;var Et=ve(ue,Ye,de[ct],Te);if(Et===null){Ye===null&&(Ye=gt);break}n&&Ye&&Et.alternate===null&&l(ue,Ye),ie=S(Et,ie,ct),St===null?We=Et:St.sibling=Et,St=Et,Ye=gt}if(ct===de.length)return c(ue,Ye),mt&&kn(ue,ct),We;if(Ye===null){for(;ct<de.length;ct++)Ye=Ce(ue,de[ct],Te),Ye!==null&&(ie=S(Ye,ie,ct),St===null?We=Ye:St.sibling=Ye,St=Ye);return mt&&kn(ue,ct),We}for(Ye=v(Ye);ct<de.length;ct++)gt=me(Ye,ue,ct,de[ct],Te),gt!==null&&(n&&gt.alternate!==null&&Ye.delete(gt.key===null?ct:gt.key),ie=S(gt,ie,ct),St===null?We=gt:St.sibling=gt,St=gt);return n&&Ye.forEach(function(Di){return l(ue,Di)}),mt&&kn(ue,ct),We}function rt(ue,ie,de,Te){if(de==null)throw Error(a(151));for(var We=null,St=null,Ye=ie,ct=ie=0,gt=null,Et=de.next();Ye!==null&&!Et.done;ct++,Et=de.next()){Ye.index>ct?(gt=Ye,Ye=null):gt=Ye.sibling;var Di=ve(ue,Ye,Et.value,Te);if(Di===null){Ye===null&&(Ye=gt);break}n&&Ye&&Di.alternate===null&&l(ue,Ye),ie=S(Di,ie,ct),St===null?We=Di:St.sibling=Di,St=Di,Ye=gt}if(Et.done)return c(ue,Ye),mt&&kn(ue,ct),We;if(Ye===null){for(;!Et.done;ct++,Et=de.next())Et=Ce(ue,Et.value,Te),Et!==null&&(ie=S(Et,ie,ct),St===null?We=Et:St.sibling=Et,St=Et);return mt&&kn(ue,ct),We}for(Ye=v(Ye);!Et.done;ct++,Et=de.next())Et=me(Ye,ue,ct,Et.value,Te),Et!==null&&(n&&Et.alternate!==null&&Ye.delete(Et.key===null?ct:Et.key),ie=S(Et,ie,ct),St===null?We=Et:St.sibling=Et,St=Et);return n&&Ye.forEach(function(e4){return l(ue,e4)}),mt&&kn(ue,ct),We}function Lt(ue,ie,de,Te){if(typeof de=="object"&&de!==null&&de.type===E&&de.key===null&&(de=de.props.children),typeof de=="object"&&de!==null){switch(de.$$typeof){case y:e:{for(var We=de.key;ie!==null;){if(ie.key===We){if(We=de.type,We===E){if(ie.tag===7){c(ue,ie.sibling),Te=b(ie,de.props.children),Te.return=ue,ue=Te;break e}}else if(ie.elementType===We||typeof We=="object"&&We!==null&&We.$$typeof===k&&Cs(We)===ie.type){c(ue,ie.sibling),Te=b(ie,de.props),ru(Te,de),Te.return=ue,ue=Te;break e}c(ue,ie);break}else l(ue,ie);ie=ie.sibling}de.type===E?(Te=bs(de.props.children,ue.mode,Te,de.key),Te.return=ue,ue=Te):(Te=Zc(de.type,de.key,de.props,null,ue.mode,Te),ru(Te,de),Te.return=ue,ue=Te)}return O(ue);case x:e:{for(We=de.key;ie!==null;){if(ie.key===We)if(ie.tag===4&&ie.stateNode.containerInfo===de.containerInfo&&ie.stateNode.implementation===de.implementation){c(ue,ie.sibling),Te=b(ie,de.children||[]),Te.return=ue,ue=Te;break e}else{c(ue,ie);break}else l(ue,ie);ie=ie.sibling}Te=Yh(de,ue.mode,Te),Te.return=ue,ue=Te}return O(ue);case k:return de=Cs(de),Lt(ue,ie,de,Te)}if(H(de))return Fe(ue,ie,de,Te);if(R(de)){if(We=R(de),typeof We!="function")throw Error(a(150));return de=We.call(de),rt(ue,ie,de,Te)}if(typeof de.then=="function")return Lt(ue,ie,nd(de),Te);if(de.$$typeof===N)return Lt(ue,ie,ed(ue,de),Te);id(ue,de)}return typeof de=="string"&&de!==""||typeof de=="number"||typeof de=="bigint"?(de=""+de,ie!==null&&ie.tag===6?(c(ue,ie.sibling),Te=b(ie,de),Te.return=ue,ue=Te):(c(ue,ie),Te=$h(de,ue.mode,Te),Te.return=ue,ue=Te),O(ue)):c(ue,ie)}return function(ue,ie,de,Te){try{tu=0;var We=Lt(ue,ie,de,Te);return Ml=null,We}catch(Ye){if(Ye===Al||Ye===rd)throw Ye;var St=Ea(29,Ye,null,ue.mode);return St.lanes=Te,St.return=ue,St}finally{}}}var js=ox(!0),ux=ox(!1),vi=!1;function sv(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function lv(n,l){n=n.updateQueue,l.updateQueue===n&&(l.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function pi(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function gi(n,l,c){var v=n.updateQueue;if(v===null)return null;if(v=v.shared,(Nt&2)!==0){var b=v.pending;return b===null?l.next=l:(l.next=b.next,b.next=l),v.pending=l,l=Xc(n),Qy(n,null,c),l}return Kc(n,v,l,c),Xc(n)}function au(n,l,c){if(l=l.updateQueue,l!==null&&(l=l.shared,(c&4194048)!==0)){var v=l.lanes;v&=n.pendingLanes,c|=v,l.lanes=c,sr(n,c)}}function ov(n,l){var c=n.updateQueue,v=n.alternate;if(v!==null&&(v=v.updateQueue,c===v)){var b=null,S=null;if(c=c.firstBaseUpdate,c!==null){do{var O={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};S===null?b=S=O:S=S.next=O,c=c.next}while(c!==null);S===null?b=S=l:S=S.next=l}else b=S=l;c={baseState:v.baseState,firstBaseUpdate:b,lastBaseUpdate:S,shared:v.shared,callbacks:v.callbacks},n.updateQueue=c;return}n=c.lastBaseUpdate,n===null?c.firstBaseUpdate=l:n.next=l,c.lastBaseUpdate=l}var uv=!1;function nu(){if(uv){var n=jl;if(n!==null)throw n}}function iu(n,l,c,v){uv=!1;var b=n.updateQueue;vi=!1;var S=b.firstBaseUpdate,O=b.lastBaseUpdate,G=b.shared.pending;if(G!==null){b.shared.pending=null;var ee=G,fe=ee.next;ee.next=null,O===null?S=fe:O.next=fe,O=ee;var be=n.alternate;be!==null&&(be=be.updateQueue,G=be.lastBaseUpdate,G!==O&&(G===null?be.firstBaseUpdate=fe:G.next=fe,be.lastBaseUpdate=ee))}if(S!==null){var Ce=b.baseState;O=0,be=fe=ee=null,G=S;do{var ve=G.lane&-536870913,me=ve!==G.lane;if(me?(pt&ve)===ve:(v&ve)===ve){ve!==0&&ve===Nl&&(uv=!0),be!==null&&(be=be.next={lane:0,tag:G.tag,payload:G.payload,callback:null,next:null});e:{var Fe=n,rt=G;ve=l;var Lt=c;switch(rt.tag){case 1:if(Fe=rt.payload,typeof Fe=="function"){Ce=Fe.call(Lt,Ce,ve);break e}Ce=Fe;break e;case 3:Fe.flags=Fe.flags&-65537|128;case 0:if(Fe=rt.payload,ve=typeof Fe=="function"?Fe.call(Lt,Ce,ve):Fe,ve==null)break e;Ce=p({},Ce,ve);break e;case 2:vi=!0}}ve=G.callback,ve!==null&&(n.flags|=64,me&&(n.flags|=8192),me=b.callbacks,me===null?b.callbacks=[ve]:me.push(ve))}else me={lane:ve,tag:G.tag,payload:G.payload,callback:G.callback,next:null},be===null?(fe=be=me,ee=Ce):be=be.next=me,O|=ve;if(G=G.next,G===null){if(G=b.shared.pending,G===null)break;me=G,G=me.next,me.next=null,b.lastBaseUpdate=me,b.shared.pending=null}}while(!0);be===null&&(ee=Ce),b.baseState=ee,b.firstBaseUpdate=fe,b.lastBaseUpdate=be,S===null&&(b.shared.lanes=0),wi|=O,n.lanes=O,n.memoizedState=Ce}}function cx(n,l){if(typeof n!="function")throw Error(a(191,n));n.call(l)}function dx(n,l){var c=n.callbacks;if(c!==null)for(n.callbacks=null,n=0;n<c.length;n++)cx(c[n],l)}var kl=L(null),sd=L(0);function fx(n,l){n=In,X(sd,n),X(kl,l),In=n|l.baseLanes}function cv(){X(sd,In),X(kl,kl.current)}function dv(){In=sd.current,Q(kl),Q(sd)}var Ta=L(null),Va=null;function mi(n){var l=n.alternate;X(or,or.current&1),X(Ta,n),Va===null&&(l===null||kl.current!==null||l.memoizedState!==null)&&(Va=n)}function fv(n){X(or,or.current),X(Ta,n),Va===null&&(Va=n)}function hx(n){n.tag===22?(X(or,or.current),X(Ta,n),Va===null&&(Va=n)):yi()}function yi(){X(or,or.current),X(Ta,Ta.current)}function Ca(n){Q(Ta),Va===n&&(Va=null),Q(or)}var or=L(0);function ld(n){for(var l=n;l!==null;){if(l.tag===13){var c=l.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||yp(c)||xp(c)))return l}else if(l.tag===19&&(l.memoizedProps.revealOrder==="forwards"||l.memoizedProps.revealOrder==="backwards"||l.memoizedProps.revealOrder==="unstable_legacy-backwards"||l.memoizedProps.revealOrder==="together")){if((l.flags&128)!==0)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===n)break;for(;l.sibling===null;){if(l.return===null||l.return===n)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var Rn=0,ot=null,Rt=null,hr=null,od=!1,Dl=!1,As=!1,ud=0,su=0,Ol=null,Hj=0;function er(){throw Error(a(321))}function hv(n,l){if(l===null)return!1;for(var c=0;c<l.length&&c<n.length;c++)if(!Sa(n[c],l[c]))return!1;return!0}function vv(n,l,c,v,b,S){return Rn=S,ot=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,z.H=n===null||n.memoizedState===null?Xx:Mv,As=!1,S=c(v,b),As=!1,Dl&&(S=px(l,c,v,b)),vx(n),S}function vx(n){z.H=uu;var l=Rt!==null&&Rt.next!==null;if(Rn=0,hr=Rt=ot=null,od=!1,su=0,Ol=null,l)throw Error(a(300));n===null||vr||(n=n.dependencies,n!==null&&Jc(n)&&(vr=!0))}function px(n,l,c,v){ot=n;var b=0;do{if(Dl&&(Ol=null),su=0,Dl=!1,25<=b)throw Error(a(301));if(b+=1,hr=Rt=null,n.updateQueue!=null){var S=n.updateQueue;S.lastEffect=null,S.events=null,S.stores=null,S.memoCache!=null&&(S.memoCache.index=0)}z.H=Zx,S=l(c,v)}while(Dl);return S}function Gj(){var n=z.H,l=n.useState()[0];return l=typeof l.then=="function"?lu(l):l,n=n.useState()[0],(Rt!==null?Rt.memoizedState:null)!==n&&(ot.flags|=1024),l}function pv(){var n=ud!==0;return ud=0,n}function gv(n,l,c){l.updateQueue=n.updateQueue,l.flags&=-2053,n.lanes&=~c}function mv(n){if(od){for(n=n.memoizedState;n!==null;){var l=n.queue;l!==null&&(l.pending=null),n=n.next}od=!1}Rn=0,hr=Rt=ot=null,Dl=!1,su=ud=0,Ol=null}function Jr(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return hr===null?ot.memoizedState=hr=n:hr=hr.next=n,hr}function ur(){if(Rt===null){var n=ot.alternate;n=n!==null?n.memoizedState:null}else n=Rt.next;var l=hr===null?ot.memoizedState:hr.next;if(l!==null)hr=l,Rt=n;else{if(n===null)throw ot.alternate===null?Error(a(467)):Error(a(310));Rt=n,n={memoizedState:Rt.memoizedState,baseState:Rt.baseState,baseQueue:Rt.baseQueue,queue:Rt.queue,next:null},hr===null?ot.memoizedState=hr=n:hr=hr.next=n}return hr}function cd(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function lu(n){var l=su;return su+=1,Ol===null&&(Ol=[]),n=ix(Ol,n,l),l=ot,(hr===null?l.memoizedState:hr.next)===null&&(l=l.alternate,z.H=l===null||l.memoizedState===null?Xx:Mv),n}function dd(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return lu(n);if(n.$$typeof===N)return zr(n)}throw Error(a(438,String(n)))}function yv(n){var l=null,c=ot.updateQueue;if(c!==null&&(l=c.memoCache),l==null){var v=ot.alternate;v!==null&&(v=v.updateQueue,v!==null&&(v=v.memoCache,v!=null&&(l={data:v.data.map(function(b){return b.slice()}),index:0})))}if(l==null&&(l={data:[],index:0}),c===null&&(c=cd(),ot.updateQueue=c),c.memoCache=l,c=l.data[l.index],c===void 0)for(c=l.data[l.index]=Array(n),v=0;v<n;v++)c[v]=P;return l.index++,c}function Bn(n,l){return typeof l=="function"?l(n):l}function fd(n){var l=ur();return xv(l,Rt,n)}function xv(n,l,c){var v=n.queue;if(v===null)throw Error(a(311));v.lastRenderedReducer=c;var b=n.baseQueue,S=v.pending;if(S!==null){if(b!==null){var O=b.next;b.next=S.next,S.next=O}l.baseQueue=b=S,v.pending=null}if(S=n.baseState,b===null)n.memoizedState=S;else{l=b.next;var G=O=null,ee=null,fe=l,be=!1;do{var Ce=fe.lane&-536870913;if(Ce!==fe.lane?(pt&Ce)===Ce:(Rn&Ce)===Ce){var ve=fe.revertLane;if(ve===0)ee!==null&&(ee=ee.next={lane:0,revertLane:0,gesture:null,action:fe.action,hasEagerState:fe.hasEagerState,eagerState:fe.eagerState,next:null}),Ce===Nl&&(be=!0);else if((Rn&ve)===ve){fe=fe.next,ve===Nl&&(be=!0);continue}else Ce={lane:0,revertLane:fe.revertLane,gesture:null,action:fe.action,hasEagerState:fe.hasEagerState,eagerState:fe.eagerState,next:null},ee===null?(G=ee=Ce,O=S):ee=ee.next=Ce,ot.lanes|=ve,wi|=ve;Ce=fe.action,As&&c(S,Ce),S=fe.hasEagerState?fe.eagerState:c(S,Ce)}else ve={lane:Ce,revertLane:fe.revertLane,gesture:fe.gesture,action:fe.action,hasEagerState:fe.hasEagerState,eagerState:fe.eagerState,next:null},ee===null?(G=ee=ve,O=S):ee=ee.next=ve,ot.lanes|=Ce,wi|=Ce;fe=fe.next}while(fe!==null&&fe!==l);if(ee===null?O=S:ee.next=G,!Sa(S,n.memoizedState)&&(vr=!0,be&&(c=jl,c!==null)))throw c;n.memoizedState=S,n.baseState=O,n.baseQueue=ee,v.lastRenderedState=S}return b===null&&(v.lanes=0),[n.memoizedState,v.dispatch]}function bv(n){var l=ur(),c=l.queue;if(c===null)throw Error(a(311));c.lastRenderedReducer=n;var v=c.dispatch,b=c.pending,S=l.memoizedState;if(b!==null){c.pending=null;var O=b=b.next;do S=n(S,O.action),O=O.next;while(O!==b);Sa(S,l.memoizedState)||(vr=!0),l.memoizedState=S,l.baseQueue===null&&(l.baseState=S),c.lastRenderedState=S}return[S,v]}function gx(n,l,c){var v=ot,b=ur(),S=mt;if(S){if(c===void 0)throw Error(a(407));c=c()}else c=l();var O=!Sa((Rt||b).memoizedState,c);if(O&&(b.memoizedState=c,vr=!0),b=b.queue,Ev(xx.bind(null,v,b,n),[n]),b.getSnapshot!==l||O||hr!==null&&hr.memoizedState.tag&1){if(v.flags|=2048,Rl(9,{destroy:void 0},yx.bind(null,v,b,c,l),null),zt===null)throw Error(a(349));S||(Rn&127)!==0||mx(v,l,c)}return c}function mx(n,l,c){n.flags|=16384,n={getSnapshot:l,value:c},l=ot.updateQueue,l===null?(l=cd(),ot.updateQueue=l,l.stores=[n]):(c=l.stores,c===null?l.stores=[n]:c.push(n))}function yx(n,l,c,v){l.value=c,l.getSnapshot=v,bx(l)&&wx(n)}function xx(n,l,c){return c(function(){bx(l)&&wx(n)})}function bx(n){var l=n.getSnapshot;n=n.value;try{var c=l();return!Sa(n,c)}catch{return!0}}function wx(n){var l=xs(n,2);l!==null&&ha(l,n,2)}function wv(n){var l=Jr();if(typeof n=="function"){var c=n;if(n=c(),As){ge(!0);try{c()}finally{ge(!1)}}}return l.memoizedState=l.baseState=n,l.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bn,lastRenderedState:n},l}function Sx(n,l,c,v){return n.baseState=c,xv(n,Rt,typeof v=="function"?v:Bn)}function Qj(n,l,c,v,b){if(pd(n))throw Error(a(485));if(n=l.action,n!==null){var S={payload:b,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(O){S.listeners.push(O)}};z.T!==null?c(!0):S.isTransition=!1,v(S),c=l.pending,c===null?(S.next=l.pending=S,Ex(l,S)):(S.next=c.next,l.pending=c.next=S)}}function Ex(n,l){var c=l.action,v=l.payload,b=n.state;if(l.isTransition){var S=z.T,O={};z.T=O;try{var G=c(b,v),ee=z.S;ee!==null&&ee(O,G),Tx(n,l,G)}catch(fe){Sv(n,l,fe)}finally{S!==null&&O.types!==null&&(S.types=O.types),z.T=S}}else try{S=c(b,v),Tx(n,l,S)}catch(fe){Sv(n,l,fe)}}function Tx(n,l,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(v){Cx(n,l,v)},function(v){return Sv(n,l,v)}):Cx(n,l,c)}function Cx(n,l,c){l.status="fulfilled",l.value=c,Nx(l),n.state=c,l=n.pending,l!==null&&(c=l.next,c===l?n.pending=null:(c=c.next,l.next=c,Ex(n,c)))}function Sv(n,l,c){var v=n.pending;if(n.pending=null,v!==null){v=v.next;do l.status="rejected",l.reason=c,Nx(l),l=l.next;while(l!==v)}n.action=null}function Nx(n){n=n.listeners;for(var l=0;l<n.length;l++)(0,n[l])()}function jx(n,l){return l}function Ax(n,l){if(mt){var c=zt.formState;if(c!==null){e:{var v=ot;if(mt){if(It){t:{for(var b=It,S=Ia;b.nodeType!==8;){if(!S){b=null;break t}if(b=Fa(b.nextSibling),b===null){b=null;break t}}S=b.data,b=S==="F!"||S==="F"?b:null}if(b){It=Fa(b.nextSibling),v=b.data==="F!";break e}}fi(v)}v=!1}v&&(l=c[0])}}return c=Jr(),c.memoizedState=c.baseState=l,v={pending:null,lanes:0,dispatch:null,lastRenderedReducer:jx,lastRenderedState:l},c.queue=v,c=$x.bind(null,ot,v),v.dispatch=c,v=wv(!1),S=Av.bind(null,ot,!1,v.queue),v=Jr(),b={state:l,dispatch:null,action:n,pending:null},v.queue=b,c=Qj.bind(null,ot,b,S,c),b.dispatch=c,v.memoizedState=n,[l,c,!1]}function Mx(n){var l=ur();return kx(l,Rt,n)}function kx(n,l,c){if(l=xv(n,l,jx)[0],n=fd(Bn)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var v=lu(l)}catch(O){throw O===Al?rd:O}else v=l;l=ur();var b=l.queue,S=b.dispatch;return c!==l.memoizedState&&(ot.flags|=2048,Rl(9,{destroy:void 0},$j.bind(null,b,c),null)),[v,S,n]}function $j(n,l){n.action=l}function Dx(n){var l=ur(),c=Rt;if(c!==null)return kx(l,c,n);ur(),l=l.memoizedState,c=ur();var v=c.queue.dispatch;return c.memoizedState=n,[l,v,!1]}function Rl(n,l,c,v){return n={tag:n,create:c,deps:v,inst:l,next:null},l=ot.updateQueue,l===null&&(l=cd(),ot.updateQueue=l),c=l.lastEffect,c===null?l.lastEffect=n.next=n:(v=c.next,c.next=n,n.next=v,l.lastEffect=n),n}function Ox(){return ur().memoizedState}function hd(n,l,c,v){var b=Jr();ot.flags|=n,b.memoizedState=Rl(1|l,{destroy:void 0},c,v===void 0?null:v)}function vd(n,l,c,v){var b=ur();v=v===void 0?null:v;var S=b.memoizedState.inst;Rt!==null&&v!==null&&hv(v,Rt.memoizedState.deps)?b.memoizedState=Rl(l,S,c,v):(ot.flags|=n,b.memoizedState=Rl(1|l,S,c,v))}function Rx(n,l){hd(8390656,8,n,l)}function Ev(n,l){vd(2048,8,n,l)}function Yj(n){ot.flags|=4;var l=ot.updateQueue;if(l===null)l=cd(),ot.updateQueue=l,l.events=[n];else{var c=l.events;c===null?l.events=[n]:c.push(n)}}function Bx(n){var l=ur().memoizedState;return Yj({ref:l,nextImpl:n}),function(){if((Nt&2)!==0)throw Error(a(440));return l.impl.apply(void 0,arguments)}}function Lx(n,l){return vd(4,2,n,l)}function Px(n,l){return vd(4,4,n,l)}function zx(n,l){if(typeof l=="function"){n=n();var c=l(n);return function(){typeof c=="function"?c():l(null)}}if(l!=null)return n=n(),l.current=n,function(){l.current=null}}function _x(n,l,c){c=c!=null?c.concat([n]):null,vd(4,4,zx.bind(null,l,n),c)}function Tv(){}function Ux(n,l){var c=ur();l=l===void 0?null:l;var v=c.memoizedState;return l!==null&&hv(l,v[1])?v[0]:(c.memoizedState=[n,l],n)}function qx(n,l){var c=ur();l=l===void 0?null:l;var v=c.memoizedState;if(l!==null&&hv(l,v[1]))return v[0];if(v=n(),As){ge(!0);try{n()}finally{ge(!1)}}return c.memoizedState=[v,l],v}function Cv(n,l,c){return c===void 0||(Rn&1073741824)!==0&&(pt&261930)===0?n.memoizedState=l:(n.memoizedState=c,n=Ib(),ot.lanes|=n,wi|=n,c)}function Ix(n,l,c,v){return Sa(c,l)?c:kl.current!==null?(n=Cv(n,c,v),Sa(n,l)||(vr=!0),n):(Rn&42)===0||(Rn&1073741824)!==0&&(pt&261930)===0?(vr=!0,n.memoizedState=c):(n=Ib(),ot.lanes|=n,wi|=n,l)}function Vx(n,l,c,v,b){var S=I.p;I.p=S!==0&&8>S?S:8;var O=z.T,G={};z.T=G,Av(n,!1,l,c);try{var ee=b(),fe=z.S;if(fe!==null&&fe(G,ee),ee!==null&&typeof ee=="object"&&typeof ee.then=="function"){var be=Fj(ee,v);ou(n,l,be,Aa(n))}else ou(n,l,v,Aa(n))}catch(Ce){ou(n,l,{then:function(){},status:"rejected",reason:Ce},Aa())}finally{I.p=S,O!==null&&G.types!==null&&(O.types=G.types),z.T=O}}function Kj(){}function Nv(n,l,c,v){if(n.tag!==5)throw Error(a(476));var b=Fx(n).queue;Vx(n,b,l,F,c===null?Kj:function(){return Hx(n),c(v)})}function Fx(n){var l=n.memoizedState;if(l!==null)return l;l={memoizedState:F,baseState:F,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bn,lastRenderedState:F},next:null};var c={};return l.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bn,lastRenderedState:c},next:null},n.memoizedState=l,n=n.alternate,n!==null&&(n.memoizedState=l),l}function Hx(n){var l=Fx(n);l.next===null&&(l=n.alternate.memoizedState),ou(n,l.next.queue,{},Aa())}function jv(){return zr(Cu)}function Gx(){return ur().memoizedState}function Qx(){return ur().memoizedState}function Xj(n){for(var l=n.return;l!==null;){switch(l.tag){case 24:case 3:var c=Aa();n=pi(c);var v=gi(l,n,c);v!==null&&(ha(v,l,c),au(v,l,c)),l={cache:rv()},n.payload=l;return}l=l.return}}function Zj(n,l,c){var v=Aa();c={lane:v,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},pd(n)?Yx(l,c):(c=Gh(n,l,c,v),c!==null&&(ha(c,n,v),Kx(c,l,v)))}function $x(n,l,c){var v=Aa();ou(n,l,c,v)}function ou(n,l,c,v){var b={lane:v,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(pd(n))Yx(l,b);else{var S=n.alternate;if(n.lanes===0&&(S===null||S.lanes===0)&&(S=l.lastRenderedReducer,S!==null))try{var O=l.lastRenderedState,G=S(O,c);if(b.hasEagerState=!0,b.eagerState=G,Sa(G,O))return Kc(n,l,b,0),zt===null&&Yc(),!1}catch{}finally{}if(c=Gh(n,l,b,v),c!==null)return ha(c,n,v),Kx(c,l,v),!0}return!1}function Av(n,l,c,v){if(v={lane:2,revertLane:sp(),gesture:null,action:v,hasEagerState:!1,eagerState:null,next:null},pd(n)){if(l)throw Error(a(479))}else l=Gh(n,c,v,2),l!==null&&ha(l,n,2)}function pd(n){var l=n.alternate;return n===ot||l!==null&&l===ot}function Yx(n,l){Dl=od=!0;var c=n.pending;c===null?l.next=l:(l.next=c.next,c.next=l),n.pending=l}function Kx(n,l,c){if((c&4194048)!==0){var v=l.lanes;v&=n.pendingLanes,c|=v,l.lanes=c,sr(n,c)}}var uu={readContext:zr,use:dd,useCallback:er,useContext:er,useEffect:er,useImperativeHandle:er,useLayoutEffect:er,useInsertionEffect:er,useMemo:er,useReducer:er,useRef:er,useState:er,useDebugValue:er,useDeferredValue:er,useTransition:er,useSyncExternalStore:er,useId:er,useHostTransitionStatus:er,useFormState:er,useActionState:er,useOptimistic:er,useMemoCache:er,useCacheRefresh:er};uu.useEffectEvent=er;var Xx={readContext:zr,use:dd,useCallback:function(n,l){return Jr().memoizedState=[n,l===void 0?null:l],n},useContext:zr,useEffect:Rx,useImperativeHandle:function(n,l,c){c=c!=null?c.concat([n]):null,hd(4194308,4,zx.bind(null,l,n),c)},useLayoutEffect:function(n,l){return hd(4194308,4,n,l)},useInsertionEffect:function(n,l){hd(4,2,n,l)},useMemo:function(n,l){var c=Jr();l=l===void 0?null:l;var v=n();if(As){ge(!0);try{n()}finally{ge(!1)}}return c.memoizedState=[v,l],v},useReducer:function(n,l,c){var v=Jr();if(c!==void 0){var b=c(l);if(As){ge(!0);try{c(l)}finally{ge(!1)}}}else b=l;return v.memoizedState=v.baseState=b,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:b},v.queue=n,n=n.dispatch=Zj.bind(null,ot,n),[v.memoizedState,n]},useRef:function(n){var l=Jr();return n={current:n},l.memoizedState=n},useState:function(n){n=wv(n);var l=n.queue,c=$x.bind(null,ot,l);return l.dispatch=c,[n.memoizedState,c]},useDebugValue:Tv,useDeferredValue:function(n,l){var c=Jr();return Cv(c,n,l)},useTransition:function(){var n=wv(!1);return n=Vx.bind(null,ot,n.queue,!0,!1),Jr().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,l,c){var v=ot,b=Jr();if(mt){if(c===void 0)throw Error(a(407));c=c()}else{if(c=l(),zt===null)throw Error(a(349));(pt&127)!==0||mx(v,l,c)}b.memoizedState=c;var S={value:c,getSnapshot:l};return b.queue=S,Rx(xx.bind(null,v,S,n),[n]),v.flags|=2048,Rl(9,{destroy:void 0},yx.bind(null,v,S,c,l),null),c},useId:function(){var n=Jr(),l=zt.identifierPrefix;if(mt){var c=fn,v=dn;c=(v&~(1<<32-pe(v)-1)).toString(32)+c,l="_"+l+"R_"+c,c=ud++,0<c&&(l+="H"+c.toString(32)),l+="_"}else c=Hj++,l="_"+l+"r_"+c.toString(32)+"_";return n.memoizedState=l},useHostTransitionStatus:jv,useFormState:Ax,useActionState:Ax,useOptimistic:function(n){var l=Jr();l.memoizedState=l.baseState=n;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return l.queue=c,l=Av.bind(null,ot,!0,c),c.dispatch=l,[n,l]},useMemoCache:yv,useCacheRefresh:function(){return Jr().memoizedState=Xj.bind(null,ot)},useEffectEvent:function(n){var l=Jr(),c={impl:n};return l.memoizedState=c,function(){if((Nt&2)!==0)throw Error(a(440));return c.impl.apply(void 0,arguments)}}},Mv={readContext:zr,use:dd,useCallback:Ux,useContext:zr,useEffect:Ev,useImperativeHandle:_x,useInsertionEffect:Lx,useLayoutEffect:Px,useMemo:qx,useReducer:fd,useRef:Ox,useState:function(){return fd(Bn)},useDebugValue:Tv,useDeferredValue:function(n,l){var c=ur();return Ix(c,Rt.memoizedState,n,l)},useTransition:function(){var n=fd(Bn)[0],l=ur().memoizedState;return[typeof n=="boolean"?n:lu(n),l]},useSyncExternalStore:gx,useId:Gx,useHostTransitionStatus:jv,useFormState:Mx,useActionState:Mx,useOptimistic:function(n,l){var c=ur();return Sx(c,Rt,n,l)},useMemoCache:yv,useCacheRefresh:Qx};Mv.useEffectEvent=Bx;var Zx={readContext:zr,use:dd,useCallback:Ux,useContext:zr,useEffect:Ev,useImperativeHandle:_x,useInsertionEffect:Lx,useLayoutEffect:Px,useMemo:qx,useReducer:bv,useRef:Ox,useState:function(){return bv(Bn)},useDebugValue:Tv,useDeferredValue:function(n,l){var c=ur();return Rt===null?Cv(c,n,l):Ix(c,Rt.memoizedState,n,l)},useTransition:function(){var n=bv(Bn)[0],l=ur().memoizedState;return[typeof n=="boolean"?n:lu(n),l]},useSyncExternalStore:gx,useId:Gx,useHostTransitionStatus:jv,useFormState:Dx,useActionState:Dx,useOptimistic:function(n,l){var c=ur();return Rt!==null?Sx(c,Rt,n,l):(c.baseState=n,[n,c.queue.dispatch])},useMemoCache:yv,useCacheRefresh:Qx};Zx.useEffectEvent=Bx;function kv(n,l,c,v){l=n.memoizedState,c=c(v,l),c=c==null?l:p({},l,c),n.memoizedState=c,n.lanes===0&&(n.updateQueue.baseState=c)}var Dv={enqueueSetState:function(n,l,c){n=n._reactInternals;var v=Aa(),b=pi(v);b.payload=l,c!=null&&(b.callback=c),l=gi(n,b,v),l!==null&&(ha(l,n,v),au(l,n,v))},enqueueReplaceState:function(n,l,c){n=n._reactInternals;var v=Aa(),b=pi(v);b.tag=1,b.payload=l,c!=null&&(b.callback=c),l=gi(n,b,v),l!==null&&(ha(l,n,v),au(l,n,v))},enqueueForceUpdate:function(n,l){n=n._reactInternals;var c=Aa(),v=pi(c);v.tag=2,l!=null&&(v.callback=l),l=gi(n,v,c),l!==null&&(ha(l,n,c),au(l,n,c))}};function Wx(n,l,c,v,b,S,O){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(v,S,O):l.prototype&&l.prototype.isPureReactComponent?!Ko(c,v)||!Ko(b,S):!0}function Jx(n,l,c,v){n=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(c,v),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(c,v),l.state!==n&&Dv.enqueueReplaceState(l,l.state,null)}function Ms(n,l){var c=l;if("ref"in l){c={};for(var v in l)v!=="ref"&&(c[v]=l[v])}if(n=n.defaultProps){c===l&&(c=p({},c));for(var b in n)c[b]===void 0&&(c[b]=n[b])}return c}function eb(n){$c(n)}function tb(n){console.error(n)}function rb(n){$c(n)}function gd(n,l){try{var c=n.onUncaughtError;c(l.value,{componentStack:l.stack})}catch(v){setTimeout(function(){throw v})}}function ab(n,l,c){try{var v=n.onCaughtError;v(c.value,{componentStack:c.stack,errorBoundary:l.tag===1?l.stateNode:null})}catch(b){setTimeout(function(){throw b})}}function Ov(n,l,c){return c=pi(c),c.tag=3,c.payload={element:null},c.callback=function(){gd(n,l)},c}function nb(n){return n=pi(n),n.tag=3,n}function ib(n,l,c,v){var b=c.type.getDerivedStateFromError;if(typeof b=="function"){var S=v.value;n.payload=function(){return b(S)},n.callback=function(){ab(l,c,v)}}var O=c.stateNode;O!==null&&typeof O.componentDidCatch=="function"&&(n.callback=function(){ab(l,c,v),typeof b!="function"&&(Si===null?Si=new Set([this]):Si.add(this));var G=v.stack;this.componentDidCatch(v.value,{componentStack:G!==null?G:""})})}function Wj(n,l,c,v,b){if(c.flags|=32768,v!==null&&typeof v=="object"&&typeof v.then=="function"){if(l=c.alternate,l!==null&&Cl(l,c,b,!0),c=Ta.current,c!==null){switch(c.tag){case 31:case 13:return Va===null?Ad():c.alternate===null&&tr===0&&(tr=3),c.flags&=-257,c.flags|=65536,c.lanes=b,v===ad?c.flags|=16384:(l=c.updateQueue,l===null?c.updateQueue=new Set([v]):l.add(v),ap(n,v,b)),!1;case 22:return c.flags|=65536,v===ad?c.flags|=16384:(l=c.updateQueue,l===null?(l={transitions:null,markerInstances:null,retryQueue:new Set([v])},c.updateQueue=l):(c=l.retryQueue,c===null?l.retryQueue=new Set([v]):c.add(v)),ap(n,v,b)),!1}throw Error(a(435,c.tag))}return ap(n,v,b),Ad(),!1}if(mt)return l=Ta.current,l!==null?((l.flags&65536)===0&&(l.flags|=256),l.flags|=65536,l.lanes=b,v!==Zh&&(n=Error(a(422),{cause:v}),Wo(_a(n,c)))):(v!==Zh&&(l=Error(a(423),{cause:v}),Wo(_a(l,c))),n=n.current.alternate,n.flags|=65536,b&=-b,n.lanes|=b,v=_a(v,c),b=Ov(n.stateNode,v,b),ov(n,b),tr!==4&&(tr=2)),!1;var S=Error(a(520),{cause:v});if(S=_a(S,c),mu===null?mu=[S]:mu.push(S),tr!==4&&(tr=2),l===null)return!0;v=_a(v,c),c=l;do{switch(c.tag){case 3:return c.flags|=65536,n=b&-b,c.lanes|=n,n=Ov(c.stateNode,v,n),ov(c,n),!1;case 1:if(l=c.type,S=c.stateNode,(c.flags&128)===0&&(typeof l.getDerivedStateFromError=="function"||S!==null&&typeof S.componentDidCatch=="function"&&(Si===null||!Si.has(S))))return c.flags|=65536,b&=-b,c.lanes|=b,b=nb(b),ib(b,n,c,v),ov(c,b),!1}c=c.return}while(c!==null);return!1}var Rv=Error(a(461)),vr=!1;function _r(n,l,c,v){l.child=n===null?ux(l,null,c,v):js(l,n.child,c,v)}function sb(n,l,c,v,b){c=c.render;var S=l.ref;if("ref"in v){var O={};for(var G in v)G!=="ref"&&(O[G]=v[G])}else O=v;return Es(l),v=vv(n,l,c,O,S,b),G=pv(),n!==null&&!vr?(gv(n,l,b),Ln(n,l,b)):(mt&&G&&Kh(l),l.flags|=1,_r(n,l,v,b),l.child)}function lb(n,l,c,v,b){if(n===null){var S=c.type;return typeof S=="function"&&!Qh(S)&&S.defaultProps===void 0&&c.compare===null?(l.tag=15,l.type=S,ob(n,l,S,v,b)):(n=Zc(c.type,null,v,l,l.mode,b),n.ref=l.ref,n.return=l,l.child=n)}if(S=n.child,!Iv(n,b)){var O=S.memoizedProps;if(c=c.compare,c=c!==null?c:Ko,c(O,v)&&n.ref===l.ref)return Ln(n,l,b)}return l.flags|=1,n=Mn(S,v),n.ref=l.ref,n.return=l,l.child=n}function ob(n,l,c,v,b){if(n!==null){var S=n.memoizedProps;if(Ko(S,v)&&n.ref===l.ref)if(vr=!1,l.pendingProps=v=S,Iv(n,b))(n.flags&131072)!==0&&(vr=!0);else return l.lanes=n.lanes,Ln(n,l,b)}return Bv(n,l,c,v,b)}function ub(n,l,c,v){var b=v.children,S=n!==null?n.memoizedState:null;if(n===null&&l.stateNode===null&&(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),v.mode==="hidden"){if((l.flags&128)!==0){if(S=S!==null?S.baseLanes|c:c,n!==null){for(v=l.child=n.child,b=0;v!==null;)b=b|v.lanes|v.childLanes,v=v.sibling;v=b&~S}else v=0,l.child=null;return cb(n,l,S,c,v)}if((c&536870912)!==0)l.memoizedState={baseLanes:0,cachePool:null},n!==null&&td(l,S!==null?S.cachePool:null),S!==null?fx(l,S):cv(),hx(l);else return v=l.lanes=536870912,cb(n,l,S!==null?S.baseLanes|c:c,c,v)}else S!==null?(td(l,S.cachePool),fx(l,S),yi(),l.memoizedState=null):(n!==null&&td(l,null),cv(),yi());return _r(n,l,b,c),l.child}function cu(n,l){return n!==null&&n.tag===22||l.stateNode!==null||(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.sibling}function cb(n,l,c,v,b){var S=nv();return S=S===null?null:{parent:fr._currentValue,pool:S},l.memoizedState={baseLanes:c,cachePool:S},n!==null&&td(l,null),cv(),hx(l),n!==null&&Cl(n,l,v,!0),l.childLanes=b,null}function md(n,l){return l=xd({mode:l.mode,children:l.children},n.mode),l.ref=n.ref,n.child=l,l.return=n,l}function db(n,l,c){return js(l,n.child,null,c),n=md(l,l.pendingProps),n.flags|=2,Ca(l),l.memoizedState=null,n}function Jj(n,l,c){var v=l.pendingProps,b=(l.flags&128)!==0;if(l.flags&=-129,n===null){if(mt){if(v.mode==="hidden")return n=md(l,v),l.lanes=536870912,cu(null,n);if(fv(l),(n=It)?(n=E1(n,Ia),n=n!==null&&n.data==="&"?n:null,n!==null&&(l.memoizedState={dehydrated:n,treeContext:ci!==null?{id:dn,overflow:fn}:null,retryLane:536870912,hydrationErrors:null},c=Yy(n),c.return=l,l.child=c,Pr=l,It=null)):n=null,n===null)throw fi(l);return l.lanes=536870912,null}return md(l,v)}var S=n.memoizedState;if(S!==null){var O=S.dehydrated;if(fv(l),b)if(l.flags&256)l.flags&=-257,l=db(n,l,c);else if(l.memoizedState!==null)l.child=n.child,l.flags|=128,l=null;else throw Error(a(558));else if(vr||Cl(n,l,c,!1),b=(c&n.childLanes)!==0,vr||b){if(v=zt,v!==null&&(O=Jt(v,c),O!==0&&O!==S.retryLane))throw S.retryLane=O,xs(n,O),ha(v,n,O),Rv;Ad(),l=db(n,l,c)}else n=S.treeContext,It=Fa(O.nextSibling),Pr=l,mt=!0,di=null,Ia=!1,n!==null&&Zy(l,n),l=md(l,v),l.flags|=4096;return l}return n=Mn(n.child,{mode:v.mode,children:v.children}),n.ref=l.ref,l.child=n,n.return=l,n}function yd(n,l){var c=l.ref;if(c===null)n!==null&&n.ref!==null&&(l.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(a(284));(n===null||n.ref!==c)&&(l.flags|=4194816)}}function Bv(n,l,c,v,b){return Es(l),c=vv(n,l,c,v,void 0,b),v=pv(),n!==null&&!vr?(gv(n,l,b),Ln(n,l,b)):(mt&&v&&Kh(l),l.flags|=1,_r(n,l,c,b),l.child)}function fb(n,l,c,v,b,S){return Es(l),l.updateQueue=null,c=px(l,v,c,b),vx(n),v=pv(),n!==null&&!vr?(gv(n,l,S),Ln(n,l,S)):(mt&&v&&Kh(l),l.flags|=1,_r(n,l,c,S),l.child)}function hb(n,l,c,v,b){if(Es(l),l.stateNode===null){var S=wl,O=c.contextType;typeof O=="object"&&O!==null&&(S=zr(O)),S=new c(v,S),l.memoizedState=S.state!==null&&S.state!==void 0?S.state:null,S.updater=Dv,l.stateNode=S,S._reactInternals=l,S=l.stateNode,S.props=v,S.state=l.memoizedState,S.refs={},sv(l),O=c.contextType,S.context=typeof O=="object"&&O!==null?zr(O):wl,S.state=l.memoizedState,O=c.getDerivedStateFromProps,typeof O=="function"&&(kv(l,c,O,v),S.state=l.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof S.getSnapshotBeforeUpdate=="function"||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(O=S.state,typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount(),O!==S.state&&Dv.enqueueReplaceState(S,S.state,null),iu(l,v,S,b),nu(),S.state=l.memoizedState),typeof S.componentDidMount=="function"&&(l.flags|=4194308),v=!0}else if(n===null){S=l.stateNode;var G=l.memoizedProps,ee=Ms(c,G);S.props=ee;var fe=S.context,be=c.contextType;O=wl,typeof be=="object"&&be!==null&&(O=zr(be));var Ce=c.getDerivedStateFromProps;be=typeof Ce=="function"||typeof S.getSnapshotBeforeUpdate=="function",G=l.pendingProps!==G,be||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(G||fe!==O)&&Jx(l,S,v,O),vi=!1;var ve=l.memoizedState;S.state=ve,iu(l,v,S,b),nu(),fe=l.memoizedState,G||ve!==fe||vi?(typeof Ce=="function"&&(kv(l,c,Ce,v),fe=l.memoizedState),(ee=vi||Wx(l,c,ee,v,ve,fe,O))?(be||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount()),typeof S.componentDidMount=="function"&&(l.flags|=4194308)):(typeof S.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=v,l.memoizedState=fe),S.props=v,S.state=fe,S.context=O,v=ee):(typeof S.componentDidMount=="function"&&(l.flags|=4194308),v=!1)}else{S=l.stateNode,lv(n,l),O=l.memoizedProps,be=Ms(c,O),S.props=be,Ce=l.pendingProps,ve=S.context,fe=c.contextType,ee=wl,typeof fe=="object"&&fe!==null&&(ee=zr(fe)),G=c.getDerivedStateFromProps,(fe=typeof G=="function"||typeof S.getSnapshotBeforeUpdate=="function")||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(O!==Ce||ve!==ee)&&Jx(l,S,v,ee),vi=!1,ve=l.memoizedState,S.state=ve,iu(l,v,S,b),nu();var me=l.memoizedState;O!==Ce||ve!==me||vi||n!==null&&n.dependencies!==null&&Jc(n.dependencies)?(typeof G=="function"&&(kv(l,c,G,v),me=l.memoizedState),(be=vi||Wx(l,c,be,v,ve,me,ee)||n!==null&&n.dependencies!==null&&Jc(n.dependencies))?(fe||typeof S.UNSAFE_componentWillUpdate!="function"&&typeof S.componentWillUpdate!="function"||(typeof S.componentWillUpdate=="function"&&S.componentWillUpdate(v,me,ee),typeof S.UNSAFE_componentWillUpdate=="function"&&S.UNSAFE_componentWillUpdate(v,me,ee)),typeof S.componentDidUpdate=="function"&&(l.flags|=4),typeof S.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof S.componentDidUpdate!="function"||O===n.memoizedProps&&ve===n.memoizedState||(l.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||O===n.memoizedProps&&ve===n.memoizedState||(l.flags|=1024),l.memoizedProps=v,l.memoizedState=me),S.props=v,S.state=me,S.context=ee,v=be):(typeof S.componentDidUpdate!="function"||O===n.memoizedProps&&ve===n.memoizedState||(l.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||O===n.memoizedProps&&ve===n.memoizedState||(l.flags|=1024),v=!1)}return S=v,yd(n,l),v=(l.flags&128)!==0,S||v?(S=l.stateNode,c=v&&typeof c.getDerivedStateFromError!="function"?null:S.render(),l.flags|=1,n!==null&&v?(l.child=js(l,n.child,null,b),l.child=js(l,null,c,b)):_r(n,l,c,b),l.memoizedState=S.state,n=l.child):n=Ln(n,l,b),n}function vb(n,l,c,v){return ws(),l.flags|=256,_r(n,l,c,v),l.child}var Lv={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Pv(n){return{baseLanes:n,cachePool:ax()}}function zv(n,l,c){return n=n!==null?n.childLanes&~c:0,l&&(n|=ja),n}function pb(n,l,c){var v=l.pendingProps,b=!1,S=(l.flags&128)!==0,O;if((O=S)||(O=n!==null&&n.memoizedState===null?!1:(or.current&2)!==0),O&&(b=!0,l.flags&=-129),O=(l.flags&32)!==0,l.flags&=-33,n===null){if(mt){if(b?mi(l):yi(),(n=It)?(n=E1(n,Ia),n=n!==null&&n.data!=="&"?n:null,n!==null&&(l.memoizedState={dehydrated:n,treeContext:ci!==null?{id:dn,overflow:fn}:null,retryLane:536870912,hydrationErrors:null},c=Yy(n),c.return=l,l.child=c,Pr=l,It=null)):n=null,n===null)throw fi(l);return xp(n)?l.lanes=32:l.lanes=536870912,null}var G=v.children;return v=v.fallback,b?(yi(),b=l.mode,G=xd({mode:"hidden",children:G},b),v=bs(v,b,c,null),G.return=l,v.return=l,G.sibling=v,l.child=G,v=l.child,v.memoizedState=Pv(c),v.childLanes=zv(n,O,c),l.memoizedState=Lv,cu(null,v)):(mi(l),_v(l,G))}var ee=n.memoizedState;if(ee!==null&&(G=ee.dehydrated,G!==null)){if(S)l.flags&256?(mi(l),l.flags&=-257,l=Uv(n,l,c)):l.memoizedState!==null?(yi(),l.child=n.child,l.flags|=128,l=null):(yi(),G=v.fallback,b=l.mode,v=xd({mode:"visible",children:v.children},b),G=bs(G,b,c,null),G.flags|=2,v.return=l,G.return=l,v.sibling=G,l.child=v,js(l,n.child,null,c),v=l.child,v.memoizedState=Pv(c),v.childLanes=zv(n,O,c),l.memoizedState=Lv,l=cu(null,v));else if(mi(l),xp(G)){if(O=G.nextSibling&&G.nextSibling.dataset,O)var fe=O.dgst;O=fe,v=Error(a(419)),v.stack="",v.digest=O,Wo({value:v,source:null,stack:null}),l=Uv(n,l,c)}else if(vr||Cl(n,l,c,!1),O=(c&n.childLanes)!==0,vr||O){if(O=zt,O!==null&&(v=Jt(O,c),v!==0&&v!==ee.retryLane))throw ee.retryLane=v,xs(n,v),ha(O,n,v),Rv;yp(G)||Ad(),l=Uv(n,l,c)}else yp(G)?(l.flags|=192,l.child=n.child,l=null):(n=ee.treeContext,It=Fa(G.nextSibling),Pr=l,mt=!0,di=null,Ia=!1,n!==null&&Zy(l,n),l=_v(l,v.children),l.flags|=4096);return l}return b?(yi(),G=v.fallback,b=l.mode,ee=n.child,fe=ee.sibling,v=Mn(ee,{mode:"hidden",children:v.children}),v.subtreeFlags=ee.subtreeFlags&65011712,fe!==null?G=Mn(fe,G):(G=bs(G,b,c,null),G.flags|=2),G.return=l,v.return=l,v.sibling=G,l.child=v,cu(null,v),v=l.child,G=n.child.memoizedState,G===null?G=Pv(c):(b=G.cachePool,b!==null?(ee=fr._currentValue,b=b.parent!==ee?{parent:ee,pool:ee}:b):b=ax(),G={baseLanes:G.baseLanes|c,cachePool:b}),v.memoizedState=G,v.childLanes=zv(n,O,c),l.memoizedState=Lv,cu(n.child,v)):(mi(l),c=n.child,n=c.sibling,c=Mn(c,{mode:"visible",children:v.children}),c.return=l,c.sibling=null,n!==null&&(O=l.deletions,O===null?(l.deletions=[n],l.flags|=16):O.push(n)),l.child=c,l.memoizedState=null,c)}function _v(n,l){return l=xd({mode:"visible",children:l},n.mode),l.return=n,n.child=l}function xd(n,l){return n=Ea(22,n,null,l),n.lanes=0,n}function Uv(n,l,c){return js(l,n.child,null,c),n=_v(l,l.pendingProps.children),n.flags|=2,l.memoizedState=null,n}function gb(n,l,c){n.lanes|=l;var v=n.alternate;v!==null&&(v.lanes|=l),ev(n.return,l,c)}function qv(n,l,c,v,b,S){var O=n.memoizedState;O===null?n.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:v,tail:c,tailMode:b,treeForkCount:S}:(O.isBackwards=l,O.rendering=null,O.renderingStartTime=0,O.last=v,O.tail=c,O.tailMode=b,O.treeForkCount=S)}function mb(n,l,c){var v=l.pendingProps,b=v.revealOrder,S=v.tail;v=v.children;var O=or.current,G=(O&2)!==0;if(G?(O=O&1|2,l.flags|=128):O&=1,X(or,O),_r(n,l,v,c),v=mt?Zo:0,!G&&n!==null&&(n.flags&128)!==0)e:for(n=l.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&gb(n,c,l);else if(n.tag===19)gb(n,c,l);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===l)break e;for(;n.sibling===null;){if(n.return===null||n.return===l)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}switch(b){case"forwards":for(c=l.child,b=null;c!==null;)n=c.alternate,n!==null&&ld(n)===null&&(b=c),c=c.sibling;c=b,c===null?(b=l.child,l.child=null):(b=c.sibling,c.sibling=null),qv(l,!1,b,c,S,v);break;case"backwards":case"unstable_legacy-backwards":for(c=null,b=l.child,l.child=null;b!==null;){if(n=b.alternate,n!==null&&ld(n)===null){l.child=b;break}n=b.sibling,b.sibling=c,c=b,b=n}qv(l,!0,c,null,S,v);break;case"together":qv(l,!1,null,null,void 0,v);break;default:l.memoizedState=null}return l.child}function Ln(n,l,c){if(n!==null&&(l.dependencies=n.dependencies),wi|=l.lanes,(c&l.childLanes)===0)if(n!==null){if(Cl(n,l,c,!1),(c&l.childLanes)===0)return null}else return null;if(n!==null&&l.child!==n.child)throw Error(a(153));if(l.child!==null){for(n=l.child,c=Mn(n,n.pendingProps),l.child=c,c.return=l;n.sibling!==null;)n=n.sibling,c=c.sibling=Mn(n,n.pendingProps),c.return=l;c.sibling=null}return l.child}function Iv(n,l){return(n.lanes&l)!==0?!0:(n=n.dependencies,!!(n!==null&&Jc(n)))}function e5(n,l,c){switch(l.tag){case 3:he(l,l.stateNode.containerInfo),hi(l,fr,n.memoizedState.cache),ws();break;case 27:case 5:ae(l);break;case 4:he(l,l.stateNode.containerInfo);break;case 10:hi(l,l.type,l.memoizedProps.value);break;case 31:if(l.memoizedState!==null)return l.flags|=128,fv(l),null;break;case 13:var v=l.memoizedState;if(v!==null)return v.dehydrated!==null?(mi(l),l.flags|=128,null):(c&l.child.childLanes)!==0?pb(n,l,c):(mi(l),n=Ln(n,l,c),n!==null?n.sibling:null);mi(l);break;case 19:var b=(n.flags&128)!==0;if(v=(c&l.childLanes)!==0,v||(Cl(n,l,c,!1),v=(c&l.childLanes)!==0),b){if(v)return mb(n,l,c);l.flags|=128}if(b=l.memoizedState,b!==null&&(b.rendering=null,b.tail=null,b.lastEffect=null),X(or,or.current),v)break;return null;case 22:return l.lanes=0,ub(n,l,c,l.pendingProps);case 24:hi(l,fr,n.memoizedState.cache)}return Ln(n,l,c)}function yb(n,l,c){if(n!==null)if(n.memoizedProps!==l.pendingProps)vr=!0;else{if(!Iv(n,c)&&(l.flags&128)===0)return vr=!1,e5(n,l,c);vr=(n.flags&131072)!==0}else vr=!1,mt&&(l.flags&1048576)!==0&&Xy(l,Zo,l.index);switch(l.lanes=0,l.tag){case 16:e:{var v=l.pendingProps;if(n=Cs(l.elementType),l.type=n,typeof n=="function")Qh(n)?(v=Ms(n,v),l.tag=1,l=hb(null,l,n,v,c)):(l.tag=0,l=Bv(null,l,n,v,c));else{if(n!=null){var b=n.$$typeof;if(b===A){l.tag=11,l=sb(null,l,n,v,c);break e}else if(b===j){l.tag=14,l=lb(null,l,n,v,c);break e}}throw l=_(n)||n,Error(a(306,l,""))}}return l;case 0:return Bv(n,l,l.type,l.pendingProps,c);case 1:return v=l.type,b=Ms(v,l.pendingProps),hb(n,l,v,b,c);case 3:e:{if(he(l,l.stateNode.containerInfo),n===null)throw Error(a(387));v=l.pendingProps;var S=l.memoizedState;b=S.element,lv(n,l),iu(l,v,null,c);var O=l.memoizedState;if(v=O.cache,hi(l,fr,v),v!==S.cache&&tv(l,[fr],c,!0),nu(),v=O.element,S.isDehydrated)if(S={element:v,isDehydrated:!1,cache:O.cache},l.updateQueue.baseState=S,l.memoizedState=S,l.flags&256){l=vb(n,l,v,c);break e}else if(v!==b){b=_a(Error(a(424)),l),Wo(b),l=vb(n,l,v,c);break e}else{switch(n=l.stateNode.containerInfo,n.nodeType){case 9:n=n.body;break;default:n=n.nodeName==="HTML"?n.ownerDocument.body:n}for(It=Fa(n.firstChild),Pr=l,mt=!0,di=null,Ia=!0,c=ux(l,null,v,c),l.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling}else{if(ws(),v===b){l=Ln(n,l,c);break e}_r(n,l,v,c)}l=l.child}return l;case 26:return yd(n,l),n===null?(c=M1(l.type,null,l.pendingProps,null))?l.memoizedState=c:mt||(c=l.type,n=l.pendingProps,v=Ld(Y.current).createElement(c),v[Ht]=l,v[xr]=n,Ur(v,c,n),dr(v),l.stateNode=v):l.memoizedState=M1(l.type,n.memoizedProps,l.pendingProps,n.memoizedState),null;case 27:return ae(l),n===null&&mt&&(v=l.stateNode=N1(l.type,l.pendingProps,Y.current),Pr=l,Ia=!0,b=It,Ni(l.type)?(bp=b,It=Fa(v.firstChild)):It=b),_r(n,l,l.pendingProps.children,c),yd(n,l),n===null&&(l.flags|=4194304),l.child;case 5:return n===null&&mt&&((b=v=It)&&(v=k5(v,l.type,l.pendingProps,Ia),v!==null?(l.stateNode=v,Pr=l,It=Fa(v.firstChild),Ia=!1,b=!0):b=!1),b||fi(l)),ae(l),b=l.type,S=l.pendingProps,O=n!==null?n.memoizedProps:null,v=S.children,pp(b,S)?v=null:O!==null&&pp(b,O)&&(l.flags|=32),l.memoizedState!==null&&(b=vv(n,l,Gj,null,null,c),Cu._currentValue=b),yd(n,l),_r(n,l,v,c),l.child;case 6:return n===null&&mt&&((n=c=It)&&(c=D5(c,l.pendingProps,Ia),c!==null?(l.stateNode=c,Pr=l,It=null,n=!0):n=!1),n||fi(l)),null;case 13:return pb(n,l,c);case 4:return he(l,l.stateNode.containerInfo),v=l.pendingProps,n===null?l.child=js(l,null,v,c):_r(n,l,v,c),l.child;case 11:return sb(n,l,l.type,l.pendingProps,c);case 7:return _r(n,l,l.pendingProps,c),l.child;case 8:return _r(n,l,l.pendingProps.children,c),l.child;case 12:return _r(n,l,l.pendingProps.children,c),l.child;case 10:return v=l.pendingProps,hi(l,l.type,v.value),_r(n,l,v.children,c),l.child;case 9:return b=l.type._context,v=l.pendingProps.children,Es(l),b=zr(b),v=v(b),l.flags|=1,_r(n,l,v,c),l.child;case 14:return lb(n,l,l.type,l.pendingProps,c);case 15:return ob(n,l,l.type,l.pendingProps,c);case 19:return mb(n,l,c);case 31:return Jj(n,l,c);case 22:return ub(n,l,c,l.pendingProps);case 24:return Es(l),v=zr(fr),n===null?(b=nv(),b===null&&(b=zt,S=rv(),b.pooledCache=S,S.refCount++,S!==null&&(b.pooledCacheLanes|=c),b=S),l.memoizedState={parent:v,cache:b},sv(l),hi(l,fr,b)):((n.lanes&c)!==0&&(lv(n,l),iu(l,null,null,c),nu()),b=n.memoizedState,S=l.memoizedState,b.parent!==v?(b={parent:v,cache:v},l.memoizedState=b,l.lanes===0&&(l.memoizedState=l.updateQueue.baseState=b),hi(l,fr,v)):(v=S.cache,hi(l,fr,v),v!==b.cache&&tv(l,[fr],c,!0))),_r(n,l,l.pendingProps.children,c),l.child;case 29:throw l.pendingProps}throw Error(a(156,l.tag))}function Pn(n){n.flags|=4}function Vv(n,l,c,v,b){if((l=(n.mode&32)!==0)&&(l=!1),l){if(n.flags|=16777216,(b&335544128)===b)if(n.stateNode.complete)n.flags|=8192;else if(Gb())n.flags|=8192;else throw Ns=ad,iv}else n.flags&=-16777217}function xb(n,l){if(l.type!=="stylesheet"||(l.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!B1(l))if(Gb())n.flags|=8192;else throw Ns=ad,iv}function bd(n,l){l!==null&&(n.flags|=4),n.flags&16384&&(l=n.tag!==22?ut():536870912,n.lanes|=l,zl|=l)}function du(n,l){if(!mt)switch(n.tailMode){case"hidden":l=n.tail;for(var c=null;l!==null;)l.alternate!==null&&(c=l),l=l.sibling;c===null?n.tail=null:c.sibling=null;break;case"collapsed":c=n.tail;for(var v=null;c!==null;)c.alternate!==null&&(v=c),c=c.sibling;v===null?l||n.tail===null?n.tail=null:n.tail.sibling=null:v.sibling=null}}function Vt(n){var l=n.alternate!==null&&n.alternate.child===n.child,c=0,v=0;if(l)for(var b=n.child;b!==null;)c|=b.lanes|b.childLanes,v|=b.subtreeFlags&65011712,v|=b.flags&65011712,b.return=n,b=b.sibling;else for(b=n.child;b!==null;)c|=b.lanes|b.childLanes,v|=b.subtreeFlags,v|=b.flags,b.return=n,b=b.sibling;return n.subtreeFlags|=v,n.childLanes=c,l}function t5(n,l,c){var v=l.pendingProps;switch(Xh(l),l.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Vt(l),null;case 1:return Vt(l),null;case 3:return c=l.stateNode,v=null,n!==null&&(v=n.memoizedState.cache),l.memoizedState.cache!==v&&(l.flags|=2048),On(fr),oe(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(n===null||n.child===null)&&(Tl(l)?Pn(l):n===null||n.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,Wh())),Vt(l),null;case 26:var b=l.type,S=l.memoizedState;return n===null?(Pn(l),S!==null?(Vt(l),xb(l,S)):(Vt(l),Vv(l,b,null,v,c))):S?S!==n.memoizedState?(Pn(l),Vt(l),xb(l,S)):(Vt(l),l.flags&=-16777217):(n=n.memoizedProps,n!==v&&Pn(l),Vt(l),Vv(l,b,n,v,c)),null;case 27:if(re(l),c=Y.current,b=l.type,n!==null&&l.stateNode!=null)n.memoizedProps!==v&&Pn(l);else{if(!v){if(l.stateNode===null)throw Error(a(166));return Vt(l),null}n=W.current,Tl(l)?Wy(l):(n=N1(b,v,c),l.stateNode=n,Pn(l))}return Vt(l),null;case 5:if(re(l),b=l.type,n!==null&&l.stateNode!=null)n.memoizedProps!==v&&Pn(l);else{if(!v){if(l.stateNode===null)throw Error(a(166));return Vt(l),null}if(S=W.current,Tl(l))Wy(l);else{var O=Ld(Y.current);switch(S){case 1:S=O.createElementNS("http://www.w3.org/2000/svg",b);break;case 2:S=O.createElementNS("http://www.w3.org/1998/Math/MathML",b);break;default:switch(b){case"svg":S=O.createElementNS("http://www.w3.org/2000/svg",b);break;case"math":S=O.createElementNS("http://www.w3.org/1998/Math/MathML",b);break;case"script":S=O.createElement("div"),S.innerHTML="<script><\/script>",S=S.removeChild(S.firstChild);break;case"select":S=typeof v.is=="string"?O.createElement("select",{is:v.is}):O.createElement("select"),v.multiple?S.multiple=!0:v.size&&(S.size=v.size);break;default:S=typeof v.is=="string"?O.createElement(b,{is:v.is}):O.createElement(b)}}S[Ht]=l,S[xr]=v;e:for(O=l.child;O!==null;){if(O.tag===5||O.tag===6)S.appendChild(O.stateNode);else if(O.tag!==4&&O.tag!==27&&O.child!==null){O.child.return=O,O=O.child;continue}if(O===l)break e;for(;O.sibling===null;){if(O.return===null||O.return===l)break e;O=O.return}O.sibling.return=O.return,O=O.sibling}l.stateNode=S;e:switch(Ur(S,b,v),b){case"button":case"input":case"select":case"textarea":v=!!v.autoFocus;break e;case"img":v=!0;break e;default:v=!1}v&&Pn(l)}}return Vt(l),Vv(l,l.type,n===null?null:n.memoizedProps,l.pendingProps,c),null;case 6:if(n&&l.stateNode!=null)n.memoizedProps!==v&&Pn(l);else{if(typeof v!="string"&&l.stateNode===null)throw Error(a(166));if(n=Y.current,Tl(l)){if(n=l.stateNode,c=l.memoizedProps,v=null,b=Pr,b!==null)switch(b.tag){case 27:case 5:v=b.memoizedProps}n[Ht]=l,n=!!(n.nodeValue===c||v!==null&&v.suppressHydrationWarning===!0||p1(n.nodeValue,c)),n||fi(l,!0)}else n=Ld(n).createTextNode(v),n[Ht]=l,l.stateNode=n}return Vt(l),null;case 31:if(c=l.memoizedState,n===null||n.memoizedState!==null){if(v=Tl(l),c!==null){if(n===null){if(!v)throw Error(a(318));if(n=l.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(a(557));n[Ht]=l}else ws(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Vt(l),n=!1}else c=Wh(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=c),n=!0;if(!n)return l.flags&256?(Ca(l),l):(Ca(l),null);if((l.flags&128)!==0)throw Error(a(558))}return Vt(l),null;case 13:if(v=l.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(b=Tl(l),v!==null&&v.dehydrated!==null){if(n===null){if(!b)throw Error(a(318));if(b=l.memoizedState,b=b!==null?b.dehydrated:null,!b)throw Error(a(317));b[Ht]=l}else ws(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Vt(l),b=!1}else b=Wh(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=b),b=!0;if(!b)return l.flags&256?(Ca(l),l):(Ca(l),null)}return Ca(l),(l.flags&128)!==0?(l.lanes=c,l):(c=v!==null,n=n!==null&&n.memoizedState!==null,c&&(v=l.child,b=null,v.alternate!==null&&v.alternate.memoizedState!==null&&v.alternate.memoizedState.cachePool!==null&&(b=v.alternate.memoizedState.cachePool.pool),S=null,v.memoizedState!==null&&v.memoizedState.cachePool!==null&&(S=v.memoizedState.cachePool.pool),S!==b&&(v.flags|=2048)),c!==n&&c&&(l.child.flags|=8192),bd(l,l.updateQueue),Vt(l),null);case 4:return oe(),n===null&&cp(l.stateNode.containerInfo),Vt(l),null;case 10:return On(l.type),Vt(l),null;case 19:if(Q(or),v=l.memoizedState,v===null)return Vt(l),null;if(b=(l.flags&128)!==0,S=v.rendering,S===null)if(b)du(v,!1);else{if(tr!==0||n!==null&&(n.flags&128)!==0)for(n=l.child;n!==null;){if(S=ld(n),S!==null){for(l.flags|=128,du(v,!1),n=S.updateQueue,l.updateQueue=n,bd(l,n),l.subtreeFlags=0,n=c,c=l.child;c!==null;)$y(c,n),c=c.sibling;return X(or,or.current&1|2),mt&&kn(l,v.treeForkCount),l.child}n=n.sibling}v.tail!==null&&Be()>Cd&&(l.flags|=128,b=!0,du(v,!1),l.lanes=4194304)}else{if(!b)if(n=ld(S),n!==null){if(l.flags|=128,b=!0,n=n.updateQueue,l.updateQueue=n,bd(l,n),du(v,!0),v.tail===null&&v.tailMode==="hidden"&&!S.alternate&&!mt)return Vt(l),null}else 2*Be()-v.renderingStartTime>Cd&&c!==536870912&&(l.flags|=128,b=!0,du(v,!1),l.lanes=4194304);v.isBackwards?(S.sibling=l.child,l.child=S):(n=v.last,n!==null?n.sibling=S:l.child=S,v.last=S)}return v.tail!==null?(n=v.tail,v.rendering=n,v.tail=n.sibling,v.renderingStartTime=Be(),n.sibling=null,c=or.current,X(or,b?c&1|2:c&1),mt&&kn(l,v.treeForkCount),n):(Vt(l),null);case 22:case 23:return Ca(l),dv(),v=l.memoizedState!==null,n!==null?n.memoizedState!==null!==v&&(l.flags|=8192):v&&(l.flags|=8192),v?(c&536870912)!==0&&(l.flags&128)===0&&(Vt(l),l.subtreeFlags&6&&(l.flags|=8192)):Vt(l),c=l.updateQueue,c!==null&&bd(l,c.retryQueue),c=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(c=n.memoizedState.cachePool.pool),v=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(v=l.memoizedState.cachePool.pool),v!==c&&(l.flags|=2048),n!==null&&Q(Ts),null;case 24:return c=null,n!==null&&(c=n.memoizedState.cache),l.memoizedState.cache!==c&&(l.flags|=2048),On(fr),Vt(l),null;case 25:return null;case 30:return null}throw Error(a(156,l.tag))}function r5(n,l){switch(Xh(l),l.tag){case 1:return n=l.flags,n&65536?(l.flags=n&-65537|128,l):null;case 3:return On(fr),oe(),n=l.flags,(n&65536)!==0&&(n&128)===0?(l.flags=n&-65537|128,l):null;case 26:case 27:case 5:return re(l),null;case 31:if(l.memoizedState!==null){if(Ca(l),l.alternate===null)throw Error(a(340));ws()}return n=l.flags,n&65536?(l.flags=n&-65537|128,l):null;case 13:if(Ca(l),n=l.memoizedState,n!==null&&n.dehydrated!==null){if(l.alternate===null)throw Error(a(340));ws()}return n=l.flags,n&65536?(l.flags=n&-65537|128,l):null;case 19:return Q(or),null;case 4:return oe(),null;case 10:return On(l.type),null;case 22:case 23:return Ca(l),dv(),n!==null&&Q(Ts),n=l.flags,n&65536?(l.flags=n&-65537|128,l):null;case 24:return On(fr),null;case 25:return null;default:return null}}function bb(n,l){switch(Xh(l),l.tag){case 3:On(fr),oe();break;case 26:case 27:case 5:re(l);break;case 4:oe();break;case 31:l.memoizedState!==null&&Ca(l);break;case 13:Ca(l);break;case 19:Q(or);break;case 10:On(l.type);break;case 22:case 23:Ca(l),dv(),n!==null&&Q(Ts);break;case 24:On(fr)}}function fu(n,l){try{var c=l.updateQueue,v=c!==null?c.lastEffect:null;if(v!==null){var b=v.next;c=b;do{if((c.tag&n)===n){v=void 0;var S=c.create,O=c.inst;v=S(),O.destroy=v}c=c.next}while(c!==b)}}catch(G){Dt(l,l.return,G)}}function xi(n,l,c){try{var v=l.updateQueue,b=v!==null?v.lastEffect:null;if(b!==null){var S=b.next;v=S;do{if((v.tag&n)===n){var O=v.inst,G=O.destroy;if(G!==void 0){O.destroy=void 0,b=l;var ee=c,fe=G;try{fe()}catch(be){Dt(b,ee,be)}}}v=v.next}while(v!==S)}}catch(be){Dt(l,l.return,be)}}function wb(n){var l=n.updateQueue;if(l!==null){var c=n.stateNode;try{dx(l,c)}catch(v){Dt(n,n.return,v)}}}function Sb(n,l,c){c.props=Ms(n.type,n.memoizedProps),c.state=n.memoizedState;try{c.componentWillUnmount()}catch(v){Dt(n,l,v)}}function hu(n,l){try{var c=n.ref;if(c!==null){switch(n.tag){case 26:case 27:case 5:var v=n.stateNode;break;case 30:v=n.stateNode;break;default:v=n.stateNode}typeof c=="function"?n.refCleanup=c(v):c.current=v}}catch(b){Dt(n,l,b)}}function hn(n,l){var c=n.ref,v=n.refCleanup;if(c!==null)if(typeof v=="function")try{v()}catch(b){Dt(n,l,b)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(b){Dt(n,l,b)}else c.current=null}function Eb(n){var l=n.type,c=n.memoizedProps,v=n.stateNode;try{e:switch(l){case"button":case"input":case"select":case"textarea":c.autoFocus&&v.focus();break e;case"img":c.src?v.src=c.src:c.srcSet&&(v.srcset=c.srcSet)}}catch(b){Dt(n,n.return,b)}}function Fv(n,l,c){try{var v=n.stateNode;T5(v,n.type,c,l),v[xr]=l}catch(b){Dt(n,n.return,b)}}function Tb(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&Ni(n.type)||n.tag===4}function Hv(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||Tb(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&&Ni(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 Gv(n,l,c){var v=n.tag;if(v===5||v===6)n=n.stateNode,l?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(n,l):(l=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,l.appendChild(n),c=c._reactRootContainer,c!=null||l.onclick!==null||(l.onclick=jn));else if(v!==4&&(v===27&&Ni(n.type)&&(c=n.stateNode,l=null),n=n.child,n!==null))for(Gv(n,l,c),n=n.sibling;n!==null;)Gv(n,l,c),n=n.sibling}function wd(n,l,c){var v=n.tag;if(v===5||v===6)n=n.stateNode,l?c.insertBefore(n,l):c.appendChild(n);else if(v!==4&&(v===27&&Ni(n.type)&&(c=n.stateNode),n=n.child,n!==null))for(wd(n,l,c),n=n.sibling;n!==null;)wd(n,l,c),n=n.sibling}function Cb(n){var l=n.stateNode,c=n.memoizedProps;try{for(var v=n.type,b=l.attributes;b.length;)l.removeAttributeNode(b[0]);Ur(l,v,c),l[Ht]=n,l[xr]=c}catch(S){Dt(n,n.return,S)}}var zn=!1,pr=!1,Qv=!1,Nb=typeof WeakSet=="function"?WeakSet:Set,kr=null;function a5(n,l){if(n=n.containerInfo,hp=Vd,n=_y(n),Uh(n)){if("selectionStart"in n)var c={start:n.selectionStart,end:n.selectionEnd};else e:{c=(c=n.ownerDocument)&&c.defaultView||window;var v=c.getSelection&&c.getSelection();if(v&&v.rangeCount!==0){c=v.anchorNode;var b=v.anchorOffset,S=v.focusNode;v=v.focusOffset;try{c.nodeType,S.nodeType}catch{c=null;break e}var O=0,G=-1,ee=-1,fe=0,be=0,Ce=n,ve=null;t:for(;;){for(var me;Ce!==c||b!==0&&Ce.nodeType!==3||(G=O+b),Ce!==S||v!==0&&Ce.nodeType!==3||(ee=O+v),Ce.nodeType===3&&(O+=Ce.nodeValue.length),(me=Ce.firstChild)!==null;)ve=Ce,Ce=me;for(;;){if(Ce===n)break t;if(ve===c&&++fe===b&&(G=O),ve===S&&++be===v&&(ee=O),(me=Ce.nextSibling)!==null)break;Ce=ve,ve=Ce.parentNode}Ce=me}c=G===-1||ee===-1?null:{start:G,end:ee}}else c=null}c=c||{start:0,end:0}}else c=null;for(vp={focusedElem:n,selectionRange:c},Vd=!1,kr=l;kr!==null;)if(l=kr,n=l.child,(l.subtreeFlags&1028)!==0&&n!==null)n.return=l,kr=n;else for(;kr!==null;){switch(l=kr,S=l.alternate,n=l.flags,l.tag){case 0:if((n&4)!==0&&(n=l.updateQueue,n=n!==null?n.events:null,n!==null))for(c=0;c<n.length;c++)b=n[c],b.ref.impl=b.nextImpl;break;case 11:case 15:break;case 1:if((n&1024)!==0&&S!==null){n=void 0,c=l,b=S.memoizedProps,S=S.memoizedState,v=c.stateNode;try{var Fe=Ms(c.type,b);n=v.getSnapshotBeforeUpdate(Fe,S),v.__reactInternalSnapshotBeforeUpdate=n}catch(rt){Dt(c,c.return,rt)}}break;case 3:if((n&1024)!==0){if(n=l.stateNode.containerInfo,c=n.nodeType,c===9)mp(n);else if(c===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":mp(n);break;default:n.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((n&1024)!==0)throw Error(a(163))}if(n=l.sibling,n!==null){n.return=l.return,kr=n;break}kr=l.return}}function jb(n,l,c){var v=c.flags;switch(c.tag){case 0:case 11:case 15:Un(n,c),v&4&&fu(5,c);break;case 1:if(Un(n,c),v&4)if(n=c.stateNode,l===null)try{n.componentDidMount()}catch(O){Dt(c,c.return,O)}else{var b=Ms(c.type,l.memoizedProps);l=l.memoizedState;try{n.componentDidUpdate(b,l,n.__reactInternalSnapshotBeforeUpdate)}catch(O){Dt(c,c.return,O)}}v&64&&wb(c),v&512&&hu(c,c.return);break;case 3:if(Un(n,c),v&64&&(n=c.updateQueue,n!==null)){if(l=null,c.child!==null)switch(c.child.tag){case 27:case 5:l=c.child.stateNode;break;case 1:l=c.child.stateNode}try{dx(n,l)}catch(O){Dt(c,c.return,O)}}break;case 27:l===null&&v&4&&Cb(c);case 26:case 5:Un(n,c),l===null&&v&4&&Eb(c),v&512&&hu(c,c.return);break;case 12:Un(n,c);break;case 31:Un(n,c),v&4&&kb(n,c);break;case 13:Un(n,c),v&4&&Db(n,c),v&64&&(n=c.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(c=f5.bind(null,c),O5(n,c))));break;case 22:if(v=c.memoizedState!==null||zn,!v){l=l!==null&&l.memoizedState!==null||pr,b=zn;var S=pr;zn=v,(pr=l)&&!S?qn(n,c,(c.subtreeFlags&8772)!==0):Un(n,c),zn=b,pr=S}break;case 30:break;default:Un(n,c)}}function Ab(n){var l=n.alternate;l!==null&&(n.alternate=null,Ab(l)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(l=n.stateNode,l!==null&&dl(l)),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}var Gt=null,ua=!1;function _n(n,l,c){for(c=c.child;c!==null;)Mb(n,l,c),c=c.sibling}function Mb(n,l,c){if(ce&&typeof ce.onCommitFiberUnmount=="function")try{ce.onCommitFiberUnmount($,c)}catch{}switch(c.tag){case 26:pr||hn(c,l),_n(n,l,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:pr||hn(c,l);var v=Gt,b=ua;Ni(c.type)&&(Gt=c.stateNode,ua=!1),_n(n,l,c),Su(c.stateNode),Gt=v,ua=b;break;case 5:pr||hn(c,l);case 6:if(v=Gt,b=ua,Gt=null,_n(n,l,c),Gt=v,ua=b,Gt!==null)if(ua)try{(Gt.nodeType===9?Gt.body:Gt.nodeName==="HTML"?Gt.ownerDocument.body:Gt).removeChild(c.stateNode)}catch(S){Dt(c,l,S)}else try{Gt.removeChild(c.stateNode)}catch(S){Dt(c,l,S)}break;case 18:Gt!==null&&(ua?(n=Gt,w1(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,c.stateNode),Gl(n)):w1(Gt,c.stateNode));break;case 4:v=Gt,b=ua,Gt=c.stateNode.containerInfo,ua=!0,_n(n,l,c),Gt=v,ua=b;break;case 0:case 11:case 14:case 15:xi(2,c,l),pr||xi(4,c,l),_n(n,l,c);break;case 1:pr||(hn(c,l),v=c.stateNode,typeof v.componentWillUnmount=="function"&&Sb(c,l,v)),_n(n,l,c);break;case 21:_n(n,l,c);break;case 22:pr=(v=pr)||c.memoizedState!==null,_n(n,l,c),pr=v;break;default:_n(n,l,c)}}function kb(n,l){if(l.memoizedState===null&&(n=l.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{Gl(n)}catch(c){Dt(l,l.return,c)}}}function Db(n,l){if(l.memoizedState===null&&(n=l.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{Gl(n)}catch(c){Dt(l,l.return,c)}}function n5(n){switch(n.tag){case 31:case 13:case 19:var l=n.stateNode;return l===null&&(l=n.stateNode=new Nb),l;case 22:return n=n.stateNode,l=n._retryCache,l===null&&(l=n._retryCache=new Nb),l;default:throw Error(a(435,n.tag))}}function Sd(n,l){var c=n5(n);l.forEach(function(v){if(!c.has(v)){c.add(v);var b=h5.bind(null,n,v);v.then(b,b)}})}function ca(n,l){var c=l.deletions;if(c!==null)for(var v=0;v<c.length;v++){var b=c[v],S=n,O=l,G=O;e:for(;G!==null;){switch(G.tag){case 27:if(Ni(G.type)){Gt=G.stateNode,ua=!1;break e}break;case 5:Gt=G.stateNode,ua=!1;break e;case 3:case 4:Gt=G.stateNode.containerInfo,ua=!0;break e}G=G.return}if(Gt===null)throw Error(a(160));Mb(S,O,b),Gt=null,ua=!1,S=b.alternate,S!==null&&(S.return=null),b.return=null}if(l.subtreeFlags&13886)for(l=l.child;l!==null;)Ob(l,n),l=l.sibling}var Wa=null;function Ob(n,l){var c=n.alternate,v=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:ca(l,n),da(n),v&4&&(xi(3,n,n.return),fu(3,n),xi(5,n,n.return));break;case 1:ca(l,n),da(n),v&512&&(pr||c===null||hn(c,c.return)),v&64&&zn&&(n=n.updateQueue,n!==null&&(v=n.callbacks,v!==null&&(c=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=c===null?v:c.concat(v))));break;case 26:var b=Wa;if(ca(l,n),da(n),v&512&&(pr||c===null||hn(c,c.return)),v&4){var S=c!==null?c.memoizedState:null;if(v=n.memoizedState,c===null)if(v===null)if(n.stateNode===null){e:{v=n.type,c=n.memoizedProps,b=b.ownerDocument||b;t:switch(v){case"title":S=b.getElementsByTagName("title")[0],(!S||S[Ar]||S[Ht]||S.namespaceURI==="http://www.w3.org/2000/svg"||S.hasAttribute("itemprop"))&&(S=b.createElement(v),b.head.insertBefore(S,b.querySelector("head > title"))),Ur(S,v,c),S[Ht]=n,dr(S),v=S;break e;case"link":var O=O1("link","href",b).get(v+(c.href||""));if(O){for(var G=0;G<O.length;G++)if(S=O[G],S.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&S.getAttribute("rel")===(c.rel==null?null:c.rel)&&S.getAttribute("title")===(c.title==null?null:c.title)&&S.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){O.splice(G,1);break t}}S=b.createElement(v),Ur(S,v,c),b.head.appendChild(S);break;case"meta":if(O=O1("meta","content",b).get(v+(c.content||""))){for(G=0;G<O.length;G++)if(S=O[G],S.getAttribute("content")===(c.content==null?null:""+c.content)&&S.getAttribute("name")===(c.name==null?null:c.name)&&S.getAttribute("property")===(c.property==null?null:c.property)&&S.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&S.getAttribute("charset")===(c.charSet==null?null:c.charSet)){O.splice(G,1);break t}}S=b.createElement(v),Ur(S,v,c),b.head.appendChild(S);break;default:throw Error(a(468,v))}S[Ht]=n,dr(S),v=S}n.stateNode=v}else R1(b,n.type,n.stateNode);else n.stateNode=D1(b,v,n.memoizedProps);else S!==v?(S===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):S.count--,v===null?R1(b,n.type,n.stateNode):D1(b,v,n.memoizedProps)):v===null&&n.stateNode!==null&&Fv(n,n.memoizedProps,c.memoizedProps)}break;case 27:ca(l,n),da(n),v&512&&(pr||c===null||hn(c,c.return)),c!==null&&v&4&&Fv(n,n.memoizedProps,c.memoizedProps);break;case 5:if(ca(l,n),da(n),v&512&&(pr||c===null||hn(c,c.return)),n.flags&32){b=n.stateNode;try{vl(b,"")}catch(Fe){Dt(n,n.return,Fe)}}v&4&&n.stateNode!=null&&(b=n.memoizedProps,Fv(n,b,c!==null?c.memoizedProps:b)),v&1024&&(Qv=!0);break;case 6:if(ca(l,n),da(n),v&4){if(n.stateNode===null)throw Error(a(162));v=n.memoizedProps,c=n.stateNode;try{c.nodeValue=v}catch(Fe){Dt(n,n.return,Fe)}}break;case 3:if(_d=null,b=Wa,Wa=Pd(l.containerInfo),ca(l,n),Wa=b,da(n),v&4&&c!==null&&c.memoizedState.isDehydrated)try{Gl(l.containerInfo)}catch(Fe){Dt(n,n.return,Fe)}Qv&&(Qv=!1,Rb(n));break;case 4:v=Wa,Wa=Pd(n.stateNode.containerInfo),ca(l,n),da(n),Wa=v;break;case 12:ca(l,n),da(n);break;case 31:ca(l,n),da(n),v&4&&(v=n.updateQueue,v!==null&&(n.updateQueue=null,Sd(n,v)));break;case 13:ca(l,n),da(n),n.child.flags&8192&&n.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(Td=Be()),v&4&&(v=n.updateQueue,v!==null&&(n.updateQueue=null,Sd(n,v)));break;case 22:b=n.memoizedState!==null;var ee=c!==null&&c.memoizedState!==null,fe=zn,be=pr;if(zn=fe||b,pr=be||ee,ca(l,n),pr=be,zn=fe,da(n),v&8192)e:for(l=n.stateNode,l._visibility=b?l._visibility&-2:l._visibility|1,b&&(c===null||ee||zn||pr||ks(n)),c=null,l=n;;){if(l.tag===5||l.tag===26){if(c===null){ee=c=l;try{if(S=ee.stateNode,b)O=S.style,typeof O.setProperty=="function"?O.setProperty("display","none","important"):O.display="none";else{G=ee.stateNode;var Ce=ee.memoizedProps.style,ve=Ce!=null&&Ce.hasOwnProperty("display")?Ce.display:null;G.style.display=ve==null||typeof ve=="boolean"?"":(""+ve).trim()}}catch(Fe){Dt(ee,ee.return,Fe)}}}else if(l.tag===6){if(c===null){ee=l;try{ee.stateNode.nodeValue=b?"":ee.memoizedProps}catch(Fe){Dt(ee,ee.return,Fe)}}}else if(l.tag===18){if(c===null){ee=l;try{var me=ee.stateNode;b?S1(me,!0):S1(ee.stateNode,!1)}catch(Fe){Dt(ee,ee.return,Fe)}}}else if((l.tag!==22&&l.tag!==23||l.memoizedState===null||l===n)&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===n)break e;for(;l.sibling===null;){if(l.return===null||l.return===n)break e;c===l&&(c=null),l=l.return}c===l&&(c=null),l.sibling.return=l.return,l=l.sibling}v&4&&(v=n.updateQueue,v!==null&&(c=v.retryQueue,c!==null&&(v.retryQueue=null,Sd(n,c))));break;case 19:ca(l,n),da(n),v&4&&(v=n.updateQueue,v!==null&&(n.updateQueue=null,Sd(n,v)));break;case 30:break;case 21:break;default:ca(l,n),da(n)}}function da(n){var l=n.flags;if(l&2){try{for(var c,v=n.return;v!==null;){if(Tb(v)){c=v;break}v=v.return}if(c==null)throw Error(a(160));switch(c.tag){case 27:var b=c.stateNode,S=Hv(n);wd(n,S,b);break;case 5:var O=c.stateNode;c.flags&32&&(vl(O,""),c.flags&=-33);var G=Hv(n);wd(n,G,O);break;case 3:case 4:var ee=c.stateNode.containerInfo,fe=Hv(n);Gv(n,fe,ee);break;default:throw Error(a(161))}}catch(be){Dt(n,n.return,be)}n.flags&=-3}l&4096&&(n.flags&=-4097)}function Rb(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var l=n;Rb(l),l.tag===5&&l.flags&1024&&l.stateNode.reset(),n=n.sibling}}function Un(n,l){if(l.subtreeFlags&8772)for(l=l.child;l!==null;)jb(n,l.alternate,l),l=l.sibling}function ks(n){for(n=n.child;n!==null;){var l=n;switch(l.tag){case 0:case 11:case 14:case 15:xi(4,l,l.return),ks(l);break;case 1:hn(l,l.return);var c=l.stateNode;typeof c.componentWillUnmount=="function"&&Sb(l,l.return,c),ks(l);break;case 27:Su(l.stateNode);case 26:case 5:hn(l,l.return),ks(l);break;case 22:l.memoizedState===null&&ks(l);break;case 30:ks(l);break;default:ks(l)}n=n.sibling}}function qn(n,l,c){for(c=c&&(l.subtreeFlags&8772)!==0,l=l.child;l!==null;){var v=l.alternate,b=n,S=l,O=S.flags;switch(S.tag){case 0:case 11:case 15:qn(b,S,c),fu(4,S);break;case 1:if(qn(b,S,c),v=S,b=v.stateNode,typeof b.componentDidMount=="function")try{b.componentDidMount()}catch(fe){Dt(v,v.return,fe)}if(v=S,b=v.updateQueue,b!==null){var G=v.stateNode;try{var ee=b.shared.hiddenCallbacks;if(ee!==null)for(b.shared.hiddenCallbacks=null,b=0;b<ee.length;b++)cx(ee[b],G)}catch(fe){Dt(v,v.return,fe)}}c&&O&64&&wb(S),hu(S,S.return);break;case 27:Cb(S);case 26:case 5:qn(b,S,c),c&&v===null&&O&4&&Eb(S),hu(S,S.return);break;case 12:qn(b,S,c);break;case 31:qn(b,S,c),c&&O&4&&kb(b,S);break;case 13:qn(b,S,c),c&&O&4&&Db(b,S);break;case 22:S.memoizedState===null&&qn(b,S,c),hu(S,S.return);break;case 30:break;default:qn(b,S,c)}l=l.sibling}}function $v(n,l){var c=null;n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(c=n.memoizedState.cachePool.pool),n=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(n=l.memoizedState.cachePool.pool),n!==c&&(n!=null&&n.refCount++,c!=null&&Jo(c))}function Yv(n,l){n=null,l.alternate!==null&&(n=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==n&&(l.refCount++,n!=null&&Jo(n))}function Ja(n,l,c,v){if(l.subtreeFlags&10256)for(l=l.child;l!==null;)Bb(n,l,c,v),l=l.sibling}function Bb(n,l,c,v){var b=l.flags;switch(l.tag){case 0:case 11:case 15:Ja(n,l,c,v),b&2048&&fu(9,l);break;case 1:Ja(n,l,c,v);break;case 3:Ja(n,l,c,v),b&2048&&(n=null,l.alternate!==null&&(n=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==n&&(l.refCount++,n!=null&&Jo(n)));break;case 12:if(b&2048){Ja(n,l,c,v),n=l.stateNode;try{var S=l.memoizedProps,O=S.id,G=S.onPostCommit;typeof G=="function"&&G(O,l.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(ee){Dt(l,l.return,ee)}}else Ja(n,l,c,v);break;case 31:Ja(n,l,c,v);break;case 13:Ja(n,l,c,v);break;case 23:break;case 22:S=l.stateNode,O=l.alternate,l.memoizedState!==null?S._visibility&2?Ja(n,l,c,v):vu(n,l):S._visibility&2?Ja(n,l,c,v):(S._visibility|=2,Bl(n,l,c,v,(l.subtreeFlags&10256)!==0||!1)),b&2048&&$v(O,l);break;case 24:Ja(n,l,c,v),b&2048&&Yv(l.alternate,l);break;default:Ja(n,l,c,v)}}function Bl(n,l,c,v,b){for(b=b&&((l.subtreeFlags&10256)!==0||!1),l=l.child;l!==null;){var S=n,O=l,G=c,ee=v,fe=O.flags;switch(O.tag){case 0:case 11:case 15:Bl(S,O,G,ee,b),fu(8,O);break;case 23:break;case 22:var be=O.stateNode;O.memoizedState!==null?be._visibility&2?Bl(S,O,G,ee,b):vu(S,O):(be._visibility|=2,Bl(S,O,G,ee,b)),b&&fe&2048&&$v(O.alternate,O);break;case 24:Bl(S,O,G,ee,b),b&&fe&2048&&Yv(O.alternate,O);break;default:Bl(S,O,G,ee,b)}l=l.sibling}}function vu(n,l){if(l.subtreeFlags&10256)for(l=l.child;l!==null;){var c=n,v=l,b=v.flags;switch(v.tag){case 22:vu(c,v),b&2048&&$v(v.alternate,v);break;case 24:vu(c,v),b&2048&&Yv(v.alternate,v);break;default:vu(c,v)}l=l.sibling}}var pu=8192;function Ll(n,l,c){if(n.subtreeFlags&pu)for(n=n.child;n!==null;)Lb(n,l,c),n=n.sibling}function Lb(n,l,c){switch(n.tag){case 26:Ll(n,l,c),n.flags&pu&&n.memoizedState!==null&&H5(c,Wa,n.memoizedState,n.memoizedProps);break;case 5:Ll(n,l,c);break;case 3:case 4:var v=Wa;Wa=Pd(n.stateNode.containerInfo),Ll(n,l,c),Wa=v;break;case 22:n.memoizedState===null&&(v=n.alternate,v!==null&&v.memoizedState!==null?(v=pu,pu=16777216,Ll(n,l,c),pu=v):Ll(n,l,c));break;default:Ll(n,l,c)}}function Pb(n){var l=n.alternate;if(l!==null&&(n=l.child,n!==null)){l.child=null;do l=n.sibling,n.sibling=null,n=l;while(n!==null)}}function gu(n){var l=n.deletions;if((n.flags&16)!==0){if(l!==null)for(var c=0;c<l.length;c++){var v=l[c];kr=v,_b(v,n)}Pb(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)zb(n),n=n.sibling}function zb(n){switch(n.tag){case 0:case 11:case 15:gu(n),n.flags&2048&&xi(9,n,n.return);break;case 3:gu(n);break;case 12:gu(n);break;case 22:var l=n.stateNode;n.memoizedState!==null&&l._visibility&2&&(n.return===null||n.return.tag!==13)?(l._visibility&=-3,Ed(n)):gu(n);break;default:gu(n)}}function Ed(n){var l=n.deletions;if((n.flags&16)!==0){if(l!==null)for(var c=0;c<l.length;c++){var v=l[c];kr=v,_b(v,n)}Pb(n)}for(n=n.child;n!==null;){switch(l=n,l.tag){case 0:case 11:case 15:xi(8,l,l.return),Ed(l);break;case 22:c=l.stateNode,c._visibility&2&&(c._visibility&=-3,Ed(l));break;default:Ed(l)}n=n.sibling}}function _b(n,l){for(;kr!==null;){var c=kr;switch(c.tag){case 0:case 11:case 15:xi(8,c,l);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var v=c.memoizedState.cachePool.pool;v!=null&&v.refCount++}break;case 24:Jo(c.memoizedState.cache)}if(v=c.child,v!==null)v.return=c,kr=v;else e:for(c=n;kr!==null;){v=kr;var b=v.sibling,S=v.return;if(Ab(v),v===c){kr=null;break e}if(b!==null){b.return=S,kr=b;break e}kr=S}}}var i5={getCacheForType:function(n){var l=zr(fr),c=l.data.get(n);return c===void 0&&(c=n(),l.data.set(n,c)),c},cacheSignal:function(){return zr(fr).controller.signal}},s5=typeof WeakMap=="function"?WeakMap:Map,Nt=0,zt=null,ht=null,pt=0,kt=0,Na=null,bi=!1,Pl=!1,Kv=!1,In=0,tr=0,wi=0,Ds=0,Xv=0,ja=0,zl=0,mu=null,fa=null,Zv=!1,Td=0,Ub=0,Cd=1/0,Nd=null,Si=null,br=0,Ei=null,_l=null,Vn=0,Wv=0,Jv=null,qb=null,yu=0,ep=null;function Aa(){return(Nt&2)!==0&&pt!==0?pt&-pt:z.T!==null?sp():Xt()}function Ib(){if(ja===0)if((pt&536870912)===0||mt){var n=_e;_e<<=1,(_e&3932160)===0&&(_e=262144),ja=n}else ja=536870912;return n=Ta.current,n!==null&&(n.flags|=32),ja}function ha(n,l,c){(n===zt&&(kt===2||kt===9)||n.cancelPendingCommit!==null)&&(Ul(n,0),Ti(n,pt,ja,!1)),Ot(n,c),((Nt&2)===0||n!==zt)&&(n===zt&&((Nt&2)===0&&(Ds|=c),tr===4&&Ti(n,pt,ja,!1)),vn(n))}function Vb(n,l,c){if((Nt&6)!==0)throw Error(a(327));var v=!c&&(l&127)===0&&(l&n.expiredLanes)===0||Ve(n,l),b=v?u5(n,l):rp(n,l,!0),S=v;do{if(b===0){Pl&&!v&&Ti(n,l,0,!1);break}else{if(c=n.current.alternate,S&&!l5(c)){b=rp(n,l,!1),S=!1;continue}if(b===2){if(S=l,n.errorRecoveryDisabledLanes&S)var O=0;else O=n.pendingLanes&-536870913,O=O!==0?O:O&536870912?536870912:0;if(O!==0){l=O;e:{var G=n;b=mu;var ee=G.current.memoizedState.isDehydrated;if(ee&&(Ul(G,O).flags|=256),O=rp(G,O,!1),O!==2){if(Kv&&!ee){G.errorRecoveryDisabledLanes|=S,Ds|=S,b=4;break e}S=fa,fa=b,S!==null&&(fa===null?fa=S:fa.push.apply(fa,S))}b=O}if(S=!1,b!==2)continue}}if(b===1){Ul(n,0),Ti(n,l,0,!0);break}e:{switch(v=n,S=b,S){case 0:case 1:throw Error(a(345));case 4:if((l&4194048)!==l)break;case 6:Ti(v,l,ja,!bi);break e;case 2:fa=null;break;case 3:case 5:break;default:throw Error(a(329))}if((l&62914560)===l&&(b=Td+300-Be(),10<b)){if(Ti(v,l,ja,!bi),st(v,0,!0)!==0)break e;Vn=l,v.timeoutHandle=x1(Fb.bind(null,v,c,fa,Nd,Zv,l,ja,Ds,zl,bi,S,"Throttled",-0,0),b);break e}Fb(v,c,fa,Nd,Zv,l,ja,Ds,zl,bi,S,null,-0,0)}}break}while(!0);vn(n)}function Fb(n,l,c,v,b,S,O,G,ee,fe,be,Ce,ve,me){if(n.timeoutHandle=-1,Ce=l.subtreeFlags,Ce&8192||(Ce&16785408)===16785408){Ce={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:jn},Lb(l,S,Ce);var Fe=(S&62914560)===S?Td-Be():(S&4194048)===S?Ub-Be():0;if(Fe=G5(Ce,Fe),Fe!==null){Vn=S,n.cancelPendingCommit=Fe(Zb.bind(null,n,l,S,c,v,b,O,G,ee,be,Ce,null,ve,me)),Ti(n,S,O,!fe);return}}Zb(n,l,S,c,v,b,O,G,ee)}function l5(n){for(var l=n;;){var c=l.tag;if((c===0||c===11||c===15)&&l.flags&16384&&(c=l.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var v=0;v<c.length;v++){var b=c[v],S=b.getSnapshot;b=b.value;try{if(!Sa(S(),b))return!1}catch{return!1}}if(c=l.child,l.subtreeFlags&16384&&c!==null)c.return=l,l=c;else{if(l===n)break;for(;l.sibling===null;){if(l.return===null||l.return===n)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function Ti(n,l,c,v){l&=~Xv,l&=~Ds,n.suspendedLanes|=l,n.pingedLanes&=~l,v&&(n.warmLanes|=l),v=n.expirationTimes;for(var b=l;0<b;){var S=31-pe(b),O=1<<S;v[S]=-1,b&=~O}c!==0&&Kt(n,c,l)}function jd(){return(Nt&6)===0?(xu(0),!1):!0}function tp(){if(ht!==null){if(kt===0)var n=ht.return;else n=ht,Dn=Ss=null,mv(n),Ml=null,tu=0,n=ht;for(;n!==null;)bb(n.alternate,n),n=n.return;ht=null}}function Ul(n,l){var c=n.timeoutHandle;c!==-1&&(n.timeoutHandle=-1,j5(c)),c=n.cancelPendingCommit,c!==null&&(n.cancelPendingCommit=null,c()),Vn=0,tp(),zt=n,ht=c=Mn(n.current,null),pt=l,kt=0,Na=null,bi=!1,Pl=Ve(n,l),Kv=!1,zl=ja=Xv=Ds=wi=tr=0,fa=mu=null,Zv=!1,(l&8)!==0&&(l|=l&32);var v=n.entangledLanes;if(v!==0)for(n=n.entanglements,v&=l;0<v;){var b=31-pe(v),S=1<<b;l|=n[b],v&=~S}return In=l,Yc(),c}function Hb(n,l){ot=null,z.H=uu,l===Al||l===rd?(l=sx(),kt=3):l===iv?(l=sx(),kt=4):kt=l===Rv?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,Na=l,ht===null&&(tr=1,gd(n,_a(l,n.current)))}function Gb(){var n=Ta.current;return n===null?!0:(pt&4194048)===pt?Va===null:(pt&62914560)===pt||(pt&536870912)!==0?n===Va:!1}function Qb(){var n=z.H;return z.H=uu,n===null?uu:n}function $b(){var n=z.A;return z.A=i5,n}function Ad(){tr=4,bi||(pt&4194048)!==pt&&Ta.current!==null||(Pl=!0),(wi&134217727)===0&&(Ds&134217727)===0||zt===null||Ti(zt,pt,ja,!1)}function rp(n,l,c){var v=Nt;Nt|=2;var b=Qb(),S=$b();(zt!==n||pt!==l)&&(Nd=null,Ul(n,l)),l=!1;var O=tr;e:do try{if(kt!==0&&ht!==null){var G=ht,ee=Na;switch(kt){case 8:tp(),O=6;break e;case 3:case 2:case 9:case 6:Ta.current===null&&(l=!0);var fe=kt;if(kt=0,Na=null,ql(n,G,ee,fe),c&&Pl){O=0;break e}break;default:fe=kt,kt=0,Na=null,ql(n,G,ee,fe)}}o5(),O=tr;break}catch(be){Hb(n,be)}while(!0);return l&&n.shellSuspendCounter++,Dn=Ss=null,Nt=v,z.H=b,z.A=S,ht===null&&(zt=null,pt=0,Yc()),O}function o5(){for(;ht!==null;)Yb(ht)}function u5(n,l){var c=Nt;Nt|=2;var v=Qb(),b=$b();zt!==n||pt!==l?(Nd=null,Cd=Be()+500,Ul(n,l)):Pl=Ve(n,l);e:do try{if(kt!==0&&ht!==null){l=ht;var S=Na;t:switch(kt){case 1:kt=0,Na=null,ql(n,l,S,1);break;case 2:case 9:if(nx(S)){kt=0,Na=null,Kb(l);break}l=function(){kt!==2&&kt!==9||zt!==n||(kt=7),vn(n)},S.then(l,l);break e;case 3:kt=7;break e;case 4:kt=5;break e;case 7:nx(S)?(kt=0,Na=null,Kb(l)):(kt=0,Na=null,ql(n,l,S,7));break;case 5:var O=null;switch(ht.tag){case 26:O=ht.memoizedState;case 5:case 27:var G=ht;if(O?B1(O):G.stateNode.complete){kt=0,Na=null;var ee=G.sibling;if(ee!==null)ht=ee;else{var fe=G.return;fe!==null?(ht=fe,Md(fe)):ht=null}break t}}kt=0,Na=null,ql(n,l,S,5);break;case 6:kt=0,Na=null,ql(n,l,S,6);break;case 8:tp(),tr=6;break e;default:throw Error(a(462))}}c5();break}catch(be){Hb(n,be)}while(!0);return Dn=Ss=null,z.H=v,z.A=b,Nt=c,ht!==null?0:(zt=null,pt=0,Yc(),tr)}function c5(){for(;ht!==null&&!Ge();)Yb(ht)}function Yb(n){var l=yb(n.alternate,n,In);n.memoizedProps=n.pendingProps,l===null?Md(n):ht=l}function Kb(n){var l=n,c=l.alternate;switch(l.tag){case 15:case 0:l=fb(c,l,l.pendingProps,l.type,void 0,pt);break;case 11:l=fb(c,l,l.pendingProps,l.type.render,l.ref,pt);break;case 5:mv(l);default:bb(c,l),l=ht=$y(l,In),l=yb(c,l,In)}n.memoizedProps=n.pendingProps,l===null?Md(n):ht=l}function ql(n,l,c,v){Dn=Ss=null,mv(l),Ml=null,tu=0;var b=l.return;try{if(Wj(n,b,l,c,pt)){tr=1,gd(n,_a(c,n.current)),ht=null;return}}catch(S){if(b!==null)throw ht=b,S;tr=1,gd(n,_a(c,n.current)),ht=null;return}l.flags&32768?(mt||v===1?n=!0:Pl||(pt&536870912)!==0?n=!1:(bi=n=!0,(v===2||v===9||v===3||v===6)&&(v=Ta.current,v!==null&&v.tag===13&&(v.flags|=16384))),Xb(l,n)):Md(l)}function Md(n){var l=n;do{if((l.flags&32768)!==0){Xb(l,bi);return}n=l.return;var c=t5(l.alternate,l,In);if(c!==null){ht=c;return}if(l=l.sibling,l!==null){ht=l;return}ht=l=n}while(l!==null);tr===0&&(tr=5)}function Xb(n,l){do{var c=r5(n.alternate,n);if(c!==null){c.flags&=32767,ht=c;return}if(c=n.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!l&&(n=n.sibling,n!==null)){ht=n;return}ht=n=c}while(n!==null);tr=6,ht=null}function Zb(n,l,c,v,b,S,O,G,ee){n.cancelPendingCommit=null;do kd();while(br!==0);if((Nt&6)!==0)throw Error(a(327));if(l!==null){if(l===n.current)throw Error(a(177));if(S=l.lanes|l.childLanes,S|=Hh,Lr(n,c,S,O,G,ee),n===zt&&(ht=zt=null,pt=0),_l=l,Ei=n,Vn=c,Wv=S,Jv=b,qb=v,(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,v5(et,function(){return r1(),null})):(n.callbackNode=null,n.callbackPriority=0),v=(l.flags&13878)!==0,(l.subtreeFlags&13878)!==0||v){v=z.T,z.T=null,b=I.p,I.p=2,O=Nt,Nt|=4;try{a5(n,l,c)}finally{Nt=O,I.p=b,z.T=v}}br=1,Wb(),Jb(),e1()}}function Wb(){if(br===1){br=0;var n=Ei,l=_l,c=(l.flags&13878)!==0;if((l.subtreeFlags&13878)!==0||c){c=z.T,z.T=null;var v=I.p;I.p=2;var b=Nt;Nt|=4;try{Ob(l,n);var S=vp,O=_y(n.containerInfo),G=S.focusedElem,ee=S.selectionRange;if(O!==G&&G&&G.ownerDocument&&zy(G.ownerDocument.documentElement,G)){if(ee!==null&&Uh(G)){var fe=ee.start,be=ee.end;if(be===void 0&&(be=fe),"selectionStart"in G)G.selectionStart=fe,G.selectionEnd=Math.min(be,G.value.length);else{var Ce=G.ownerDocument||document,ve=Ce&&Ce.defaultView||window;if(ve.getSelection){var me=ve.getSelection(),Fe=G.textContent.length,rt=Math.min(ee.start,Fe),Lt=ee.end===void 0?rt:Math.min(ee.end,Fe);!me.extend&&rt>Lt&&(O=Lt,Lt=rt,rt=O);var ue=Py(G,rt),ie=Py(G,Lt);if(ue&&ie&&(me.rangeCount!==1||me.anchorNode!==ue.node||me.anchorOffset!==ue.offset||me.focusNode!==ie.node||me.focusOffset!==ie.offset)){var de=Ce.createRange();de.setStart(ue.node,ue.offset),me.removeAllRanges(),rt>Lt?(me.addRange(de),me.extend(ie.node,ie.offset)):(de.setEnd(ie.node,ie.offset),me.addRange(de))}}}}for(Ce=[],me=G;me=me.parentNode;)me.nodeType===1&&Ce.push({element:me,left:me.scrollLeft,top:me.scrollTop});for(typeof G.focus=="function"&&G.focus(),G=0;G<Ce.length;G++){var Te=Ce[G];Te.element.scrollLeft=Te.left,Te.element.scrollTop=Te.top}}Vd=!!hp,vp=hp=null}finally{Nt=b,I.p=v,z.T=c}}n.current=l,br=2}}function Jb(){if(br===2){br=0;var n=Ei,l=_l,c=(l.flags&8772)!==0;if((l.subtreeFlags&8772)!==0||c){c=z.T,z.T=null;var v=I.p;I.p=2;var b=Nt;Nt|=4;try{jb(n,l.alternate,l)}finally{Nt=b,I.p=v,z.T=c}}br=3}}function e1(){if(br===4||br===3){br=0,Je();var n=Ei,l=_l,c=Vn,v=qb;(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?br=5:(br=0,_l=Ei=null,t1(n,n.pendingLanes));var b=n.pendingLanes;if(b===0&&(Si=null),Ra(c),l=l.stateNode,ce&&typeof ce.onCommitFiberRoot=="function")try{ce.onCommitFiberRoot($,l,void 0,(l.current.flags&128)===128)}catch{}if(v!==null){l=z.T,b=I.p,I.p=2,z.T=null;try{for(var S=n.onRecoverableError,O=0;O<v.length;O++){var G=v[O];S(G.value,{componentStack:G.stack})}}finally{z.T=l,I.p=b}}(Vn&3)!==0&&kd(),vn(n),b=n.pendingLanes,(c&261930)!==0&&(b&42)!==0?n===ep?yu++:(yu=0,ep=n):yu=0,xu(0)}}function t1(n,l){(n.pooledCacheLanes&=l)===0&&(l=n.pooledCache,l!=null&&(n.pooledCache=null,Jo(l)))}function kd(){return Wb(),Jb(),e1(),r1()}function r1(){if(br!==5)return!1;var n=Ei,l=Wv;Wv=0;var c=Ra(Vn),v=z.T,b=I.p;try{I.p=32>c?32:c,z.T=null,c=Jv,Jv=null;var S=Ei,O=Vn;if(br=0,_l=Ei=null,Vn=0,(Nt&6)!==0)throw Error(a(331));var G=Nt;if(Nt|=4,zb(S.current),Bb(S,S.current,O,c),Nt=G,xu(0,!1),ce&&typeof ce.onPostCommitFiberRoot=="function")try{ce.onPostCommitFiberRoot($,S)}catch{}return!0}finally{I.p=b,z.T=v,t1(n,l)}}function a1(n,l,c){l=_a(c,l),l=Ov(n.stateNode,l,2),n=gi(n,l,2),n!==null&&(Ot(n,2),vn(n))}function Dt(n,l,c){if(n.tag===3)a1(n,n,c);else for(;l!==null;){if(l.tag===3){a1(l,n,c);break}else if(l.tag===1){var v=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof v.componentDidCatch=="function"&&(Si===null||!Si.has(v))){n=_a(c,n),c=nb(2),v=gi(l,c,2),v!==null&&(ib(c,v,l,n),Ot(v,2),vn(v));break}}l=l.return}}function ap(n,l,c){var v=n.pingCache;if(v===null){v=n.pingCache=new s5;var b=new Set;v.set(l,b)}else b=v.get(l),b===void 0&&(b=new Set,v.set(l,b));b.has(c)||(Kv=!0,b.add(c),n=d5.bind(null,n,l,c),l.then(n,n))}function d5(n,l,c){var v=n.pingCache;v!==null&&v.delete(l),n.pingedLanes|=n.suspendedLanes&c,n.warmLanes&=~c,zt===n&&(pt&c)===c&&(tr===4||tr===3&&(pt&62914560)===pt&&300>Be()-Td?(Nt&2)===0&&Ul(n,0):Xv|=c,zl===pt&&(zl=0)),vn(n)}function n1(n,l){l===0&&(l=ut()),n=xs(n,l),n!==null&&(Ot(n,l),vn(n))}function f5(n){var l=n.memoizedState,c=0;l!==null&&(c=l.retryLane),n1(n,c)}function h5(n,l){var c=0;switch(n.tag){case 31:case 13:var v=n.stateNode,b=n.memoizedState;b!==null&&(c=b.retryLane);break;case 19:v=n.stateNode;break;case 22:v=n.stateNode._retryCache;break;default:throw Error(a(314))}v!==null&&v.delete(l),n1(n,c)}function v5(n,l){return ke(n,l)}var Dd=null,Il=null,np=!1,Od=!1,ip=!1,Ci=0;function vn(n){n!==Il&&n.next===null&&(Il===null?Dd=Il=n:Il=Il.next=n),Od=!0,np||(np=!0,g5())}function xu(n,l){if(!ip&&Od){ip=!0;do for(var c=!1,v=Dd;v!==null;){if(n!==0){var b=v.pendingLanes;if(b===0)var S=0;else{var O=v.suspendedLanes,G=v.pingedLanes;S=(1<<31-pe(42|n)+1)-1,S&=b&~(O&~G),S=S&201326741?S&201326741|1:S?S|2:0}S!==0&&(c=!0,o1(v,S))}else S=pt,S=st(v,v===zt?S:0,v.cancelPendingCommit!==null||v.timeoutHandle!==-1),(S&3)===0||Ve(v,S)||(c=!0,o1(v,S));v=v.next}while(c);ip=!1}}function p5(){i1()}function i1(){Od=np=!1;var n=0;Ci!==0&&N5()&&(n=Ci);for(var l=Be(),c=null,v=Dd;v!==null;){var b=v.next,S=s1(v,l);S===0?(v.next=null,c===null?Dd=b:c.next=b,b===null&&(Il=c)):(c=v,(n!==0||(S&3)!==0)&&(Od=!0)),v=b}br!==0&&br!==5||xu(n),Ci!==0&&(Ci=0)}function s1(n,l){for(var c=n.suspendedLanes,v=n.pingedLanes,b=n.expirationTimes,S=n.pendingLanes&-62914561;0<S;){var O=31-pe(S),G=1<<O,ee=b[O];ee===-1?((G&c)===0||(G&v)!==0)&&(b[O]=dt(G,l)):ee<=l&&(n.expiredLanes|=G),S&=~G}if(l=zt,c=pt,c=st(n,n===l?c:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),v=n.callbackNode,c===0||n===l&&(kt===2||kt===9)||n.cancelPendingCommit!==null)return v!==null&&v!==null&&Pe(v),n.callbackNode=null,n.callbackPriority=0;if((c&3)===0||Ve(n,c)){if(l=c&-c,l===n.callbackPriority)return l;switch(v!==null&&Pe(v),Ra(c)){case 2:case 8:c=$e;break;case 32:c=et;break;case 268435456:c=ze;break;default:c=et}return v=l1.bind(null,n),c=ke(c,v),n.callbackPriority=l,n.callbackNode=c,l}return v!==null&&v!==null&&Pe(v),n.callbackPriority=2,n.callbackNode=null,2}function l1(n,l){if(br!==0&&br!==5)return n.callbackNode=null,n.callbackPriority=0,null;var c=n.callbackNode;if(kd()&&n.callbackNode!==c)return null;var v=pt;return v=st(n,n===zt?v:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),v===0?null:(Vb(n,v,l),s1(n,Be()),n.callbackNode!=null&&n.callbackNode===c?l1.bind(null,n):null)}function o1(n,l){if(kd())return null;Vb(n,l,!0)}function g5(){A5(function(){(Nt&6)!==0?ke(ye,p5):i1()})}function sp(){if(Ci===0){var n=Nl;n===0&&(n=He,He<<=1,(He&261888)===0&&(He=256)),Ci=n}return Ci}function u1(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:qc(""+n)}function c1(n,l){var c=l.ownerDocument.createElement("input");return c.name=l.name,c.value=l.value,n.id&&c.setAttribute("form",n.id),l.parentNode.insertBefore(c,l),n=new FormData(n),c.parentNode.removeChild(c),n}function m5(n,l,c,v,b){if(l==="submit"&&c&&c.stateNode===b){var S=u1((b[xr]||null).action),O=v.submitter;O&&(l=(l=O[xr]||null)?u1(l.formAction):O.getAttribute("formAction"),l!==null&&(S=l,O=null));var G=new Hc("action","action",null,v,b);n.push({event:G,listeners:[{instance:null,listener:function(){if(v.defaultPrevented){if(Ci!==0){var ee=O?c1(b,O):new FormData(b);Nv(c,{pending:!0,data:ee,method:b.method,action:S},null,ee)}}else typeof S=="function"&&(G.preventDefault(),ee=O?c1(b,O):new FormData(b),Nv(c,{pending:!0,data:ee,method:b.method,action:S},S,ee))},currentTarget:b}]})}}for(var lp=0;lp<Fh.length;lp++){var op=Fh[lp],y5=op.toLowerCase(),x5=op[0].toUpperCase()+op.slice(1);Za(y5,"on"+x5)}Za(Iy,"onAnimationEnd"),Za(Vy,"onAnimationIteration"),Za(Fy,"onAnimationStart"),Za("dblclick","onDoubleClick"),Za("focusin","onFocus"),Za("focusout","onBlur"),Za(Lj,"onTransitionRun"),Za(Pj,"onTransitionStart"),Za(zj,"onTransitionCancel"),Za(Hy,"onTransitionEnd"),cn("onMouseEnter",["mouseout","mouseover"]),cn("onMouseLeave",["mouseout","mouseover"]),cn("onPointerEnter",["pointerout","pointerover"]),cn("onPointerLeave",["pointerout","pointerover"]),wa("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),wa("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),wa("onBeforeInput",["compositionend","keypress","textInput","paste"]),wa("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),wa("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),wa("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var bu="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),b5=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(bu));function d1(n,l){l=(l&4)!==0;for(var c=0;c<n.length;c++){var v=n[c],b=v.event;v=v.listeners;e:{var S=void 0;if(l)for(var O=v.length-1;0<=O;O--){var G=v[O],ee=G.instance,fe=G.currentTarget;if(G=G.listener,ee!==S&&b.isPropagationStopped())break e;S=G,b.currentTarget=fe;try{S(b)}catch(be){$c(be)}b.currentTarget=null,S=ee}else for(O=0;O<v.length;O++){if(G=v[O],ee=G.instance,fe=G.currentTarget,G=G.listener,ee!==S&&b.isPropagationStopped())break e;S=G,b.currentTarget=fe;try{S(b)}catch(be){$c(be)}b.currentTarget=null,S=ee}}}}function vt(n,l){var c=l[Nr];c===void 0&&(c=l[Nr]=new Set);var v=n+"__bubble";c.has(v)||(f1(l,n,2,!1),c.add(v))}function up(n,l,c){var v=0;l&&(v|=4),f1(c,n,v,l)}var Rd="_reactListening"+Math.random().toString(36).slice(2);function cp(n){if(!n[Rd]){n[Rd]=!0,Lc.forEach(function(c){c!=="selectionchange"&&(b5.has(c)||up(c,!1,n),up(c,!0,n))});var l=n.nodeType===9?n:n.ownerDocument;l===null||l[Rd]||(l[Rd]=!0,up("selectionchange",!1,l))}}function f1(n,l,c,v){switch(I1(l)){case 2:var b=Y5;break;case 8:b=K5;break;default:b=Cp}c=b.bind(null,l,c,n),b=void 0,!kh||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(b=!0),v?b!==void 0?n.addEventListener(l,c,{capture:!0,passive:b}):n.addEventListener(l,c,!0):b!==void 0?n.addEventListener(l,c,{passive:b}):n.addEventListener(l,c,!1)}function dp(n,l,c,v,b){var S=v;if((l&1)===0&&(l&2)===0&&v!==null)e:for(;;){if(v===null)return;var O=v.tag;if(O===3||O===4){var G=v.stateNode.containerInfo;if(G===b)break;if(O===4)for(O=v.return;O!==null;){var ee=O.tag;if((ee===3||ee===4)&&O.stateNode.containerInfo===b)return;O=O.return}for(;G!==null;){if(O=ii(G),O===null)return;if(ee=O.tag,ee===5||ee===6||ee===26||ee===27){v=S=O;continue e}G=G.parentNode}}v=v.return}my(function(){var fe=S,be=Ah(c),Ce=[];e:{var ve=Gy.get(n);if(ve!==void 0){var me=Hc,Fe=n;switch(n){case"keypress":if(Vc(c)===0)break e;case"keydown":case"keyup":me=hj;break;case"focusin":Fe="focus",me=Bh;break;case"focusout":Fe="blur",me=Bh;break;case"beforeblur":case"afterblur":me=Bh;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":me=by;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":me=tj;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":me=gj;break;case Iy:case Vy:case Fy:me=nj;break;case Hy:me=yj;break;case"scroll":case"scrollend":me=JN;break;case"wheel":me=bj;break;case"copy":case"cut":case"paste":me=sj;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":me=Sy;break;case"toggle":case"beforetoggle":me=Sj}var rt=(l&4)!==0,Lt=!rt&&(n==="scroll"||n==="scrollend"),ue=rt?ve!==null?ve+"Capture":null:ve;rt=[];for(var ie=fe,de;ie!==null;){var Te=ie;if(de=Te.stateNode,Te=Te.tag,Te!==5&&Te!==26&&Te!==27||de===null||ue===null||(Te=Vo(ie,ue),Te!=null&&rt.push(wu(ie,Te,de))),Lt)break;ie=ie.return}0<rt.length&&(ve=new me(ve,Fe,null,c,be),Ce.push({event:ve,listeners:rt}))}}if((l&7)===0){e:{if(ve=n==="mouseover"||n==="pointerover",me=n==="mouseout"||n==="pointerout",ve&&c!==jh&&(Fe=c.relatedTarget||c.fromElement)&&(ii(Fe)||Fe[sa]))break e;if((me||ve)&&(ve=be.window===be?be:(ve=be.ownerDocument)?ve.defaultView||ve.parentWindow:window,me?(Fe=c.relatedTarget||c.toElement,me=fe,Fe=Fe?ii(Fe):null,Fe!==null&&(Lt=s(Fe),rt=Fe.tag,Fe!==Lt||rt!==5&&rt!==27&&rt!==6)&&(Fe=null)):(me=null,Fe=fe),me!==Fe)){if(rt=by,Te="onMouseLeave",ue="onMouseEnter",ie="mouse",(n==="pointerout"||n==="pointerover")&&(rt=Sy,Te="onPointerLeave",ue="onPointerEnter",ie="pointer"),Lt=me==null?ve:ps(me),de=Fe==null?ve:ps(Fe),ve=new rt(Te,ie+"leave",me,c,be),ve.target=Lt,ve.relatedTarget=de,Te=null,ii(be)===fe&&(rt=new rt(ue,ie+"enter",Fe,c,be),rt.target=de,rt.relatedTarget=Lt,Te=rt),Lt=Te,me&&Fe)t:{for(rt=w5,ue=me,ie=Fe,de=0,Te=ue;Te;Te=rt(Te))de++;Te=0;for(var We=ie;We;We=rt(We))Te++;for(;0<de-Te;)ue=rt(ue),de--;for(;0<Te-de;)ie=rt(ie),Te--;for(;de--;){if(ue===ie||ie!==null&&ue===ie.alternate){rt=ue;break t}ue=rt(ue),ie=rt(ie)}rt=null}else rt=null;me!==null&&h1(Ce,ve,me,rt,!1),Fe!==null&&Lt!==null&&h1(Ce,Lt,Fe,rt,!0)}}e:{if(ve=fe?ps(fe):window,me=ve.nodeName&&ve.nodeName.toLowerCase(),me==="select"||me==="input"&&ve.type==="file")var St=ky;else if(Ay(ve))if(Dy)St=Oj;else{St=kj;var Ye=Mj}else me=ve.nodeName,!me||me.toLowerCase()!=="input"||ve.type!=="checkbox"&&ve.type!=="radio"?fe&&Nh(fe.elementType)&&(St=ky):St=Dj;if(St&&(St=St(n,fe))){My(Ce,St,c,be);break e}Ye&&Ye(n,ve,fe),n==="focusout"&&fe&&ve.type==="number"&&fe.memoizedProps.value!=null&&Ch(ve,"number",ve.value)}switch(Ye=fe?ps(fe):window,n){case"focusin":(Ay(Ye)||Ye.contentEditable==="true")&&(yl=Ye,qh=fe,Xo=null);break;case"focusout":Xo=qh=yl=null;break;case"mousedown":Ih=!0;break;case"contextmenu":case"mouseup":case"dragend":Ih=!1,Uy(Ce,c,be);break;case"selectionchange":if(Bj)break;case"keydown":case"keyup":Uy(Ce,c,be)}var ct;if(Ph)e:{switch(n){case"compositionstart":var gt="onCompositionStart";break e;case"compositionend":gt="onCompositionEnd";break e;case"compositionupdate":gt="onCompositionUpdate";break e}gt=void 0}else ml?Ny(n,c)&&(gt="onCompositionEnd"):n==="keydown"&&c.keyCode===229&&(gt="onCompositionStart");gt&&(Ey&&c.locale!=="ko"&&(ml||gt!=="onCompositionStart"?gt==="onCompositionEnd"&&ml&&(ct=yy()):(ui=be,Dh="value"in ui?ui.value:ui.textContent,ml=!0)),Ye=Bd(fe,gt),0<Ye.length&&(gt=new wy(gt,n,null,c,be),Ce.push({event:gt,listeners:Ye}),ct?gt.data=ct:(ct=jy(c),ct!==null&&(gt.data=ct)))),(ct=Tj?Cj(n,c):Nj(n,c))&&(gt=Bd(fe,"onBeforeInput"),0<gt.length&&(Ye=new wy("onBeforeInput","beforeinput",null,c,be),Ce.push({event:Ye,listeners:gt}),Ye.data=ct)),m5(Ce,n,fe,c,be)}d1(Ce,l)})}function wu(n,l,c){return{instance:n,listener:l,currentTarget:c}}function Bd(n,l){for(var c=l+"Capture",v=[];n!==null;){var b=n,S=b.stateNode;if(b=b.tag,b!==5&&b!==26&&b!==27||S===null||(b=Vo(n,c),b!=null&&v.unshift(wu(n,b,S)),b=Vo(n,l),b!=null&&v.push(wu(n,b,S))),n.tag===3)return v;n=n.return}return[]}function w5(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function h1(n,l,c,v,b){for(var S=l._reactName,O=[];c!==null&&c!==v;){var G=c,ee=G.alternate,fe=G.stateNode;if(G=G.tag,ee!==null&&ee===v)break;G!==5&&G!==26&&G!==27||fe===null||(ee=fe,b?(fe=Vo(c,S),fe!=null&&O.unshift(wu(c,fe,ee))):b||(fe=Vo(c,S),fe!=null&&O.push(wu(c,fe,ee)))),c=c.return}O.length!==0&&n.push({event:l,listeners:O})}var S5=/\r\n?/g,E5=/\u0000|\uFFFD/g;function v1(n){return(typeof n=="string"?n:""+n).replace(S5,`
49
+ `).replace(E5,"")}function p1(n,l){return l=v1(l),v1(n)===l}function Bt(n,l,c,v,b,S){switch(c){case"children":typeof v=="string"?l==="body"||l==="textarea"&&v===""||vl(n,v):(typeof v=="number"||typeof v=="bigint")&&l!=="body"&&vl(n,""+v);break;case"className":oi(n,"class",v);break;case"tabIndex":oi(n,"tabindex",v);break;case"dir":case"role":case"viewBox":case"width":case"height":oi(n,c,v);break;case"style":py(n,v,S);break;case"data":if(l!=="object"){oi(n,"data",v);break}case"src":case"href":if(v===""&&(l!=="a"||c!=="href")){n.removeAttribute(c);break}if(v==null||typeof v=="function"||typeof v=="symbol"||typeof v=="boolean"){n.removeAttribute(c);break}v=qc(""+v),n.setAttribute(c,v);break;case"action":case"formAction":if(typeof v=="function"){n.setAttribute(c,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof S=="function"&&(c==="formAction"?(l!=="input"&&Bt(n,l,"name",b.name,b,null),Bt(n,l,"formEncType",b.formEncType,b,null),Bt(n,l,"formMethod",b.formMethod,b,null),Bt(n,l,"formTarget",b.formTarget,b,null)):(Bt(n,l,"encType",b.encType,b,null),Bt(n,l,"method",b.method,b,null),Bt(n,l,"target",b.target,b,null)));if(v==null||typeof v=="symbol"||typeof v=="boolean"){n.removeAttribute(c);break}v=qc(""+v),n.setAttribute(c,v);break;case"onClick":v!=null&&(n.onclick=jn);break;case"onScroll":v!=null&&vt("scroll",n);break;case"onScrollEnd":v!=null&&vt("scrollend",n);break;case"dangerouslySetInnerHTML":if(v!=null){if(typeof v!="object"||!("__html"in v))throw Error(a(61));if(c=v.__html,c!=null){if(b.children!=null)throw Error(a(60));n.innerHTML=c}}break;case"multiple":n.multiple=v&&typeof v!="function"&&typeof v!="symbol";break;case"muted":n.muted=v&&typeof v!="function"&&typeof v!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(v==null||typeof v=="function"||typeof v=="boolean"||typeof v=="symbol"){n.removeAttribute("xlink:href");break}c=qc(""+v),n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":v!=null&&typeof v!="function"&&typeof v!="symbol"?n.setAttribute(c,""+v):n.removeAttribute(c);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":v&&typeof v!="function"&&typeof v!="symbol"?n.setAttribute(c,""):n.removeAttribute(c);break;case"capture":case"download":v===!0?n.setAttribute(c,""):v!==!1&&v!=null&&typeof v!="function"&&typeof v!="symbol"?n.setAttribute(c,v):n.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":v!=null&&typeof v!="function"&&typeof v!="symbol"&&!isNaN(v)&&1<=v?n.setAttribute(c,v):n.removeAttribute(c);break;case"rowSpan":case"start":v==null||typeof v=="function"||typeof v=="symbol"||isNaN(v)?n.removeAttribute(c):n.setAttribute(c,v);break;case"popover":vt("beforetoggle",n),vt("toggle",n),Qr(n,"popover",v);break;case"xlinkActuate":La(n,"http://www.w3.org/1999/xlink","xlink:actuate",v);break;case"xlinkArcrole":La(n,"http://www.w3.org/1999/xlink","xlink:arcrole",v);break;case"xlinkRole":La(n,"http://www.w3.org/1999/xlink","xlink:role",v);break;case"xlinkShow":La(n,"http://www.w3.org/1999/xlink","xlink:show",v);break;case"xlinkTitle":La(n,"http://www.w3.org/1999/xlink","xlink:title",v);break;case"xlinkType":La(n,"http://www.w3.org/1999/xlink","xlink:type",v);break;case"xmlBase":La(n,"http://www.w3.org/XML/1998/namespace","xml:base",v);break;case"xmlLang":La(n,"http://www.w3.org/XML/1998/namespace","xml:lang",v);break;case"xmlSpace":La(n,"http://www.w3.org/XML/1998/namespace","xml:space",v);break;case"is":Qr(n,"is",v);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=ZN.get(c)||c,Qr(n,c,v))}}function fp(n,l,c,v,b,S){switch(c){case"style":py(n,v,S);break;case"dangerouslySetInnerHTML":if(v!=null){if(typeof v!="object"||!("__html"in v))throw Error(a(61));if(c=v.__html,c!=null){if(b.children!=null)throw Error(a(60));n.innerHTML=c}}break;case"children":typeof v=="string"?vl(n,v):(typeof v=="number"||typeof v=="bigint")&&vl(n,""+v);break;case"onScroll":v!=null&&vt("scroll",n);break;case"onScrollEnd":v!=null&&vt("scrollend",n);break;case"onClick":v!=null&&(n.onclick=jn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Pc.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(b=c.endsWith("Capture"),l=c.slice(2,b?c.length-7:void 0),S=n[xr]||null,S=S!=null?S[c]:null,typeof S=="function"&&n.removeEventListener(l,S,b),typeof v=="function")){typeof S!="function"&&S!==null&&(c in n?n[c]=null:n.hasAttribute(c)&&n.removeAttribute(c)),n.addEventListener(l,v,b);break e}c in n?n[c]=v:v===!0?n.setAttribute(c,""):Qr(n,c,v)}}}function Ur(n,l,c){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":vt("error",n),vt("load",n);var v=!1,b=!1,S;for(S in c)if(c.hasOwnProperty(S)){var O=c[S];if(O!=null)switch(S){case"src":v=!0;break;case"srcSet":b=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,l));default:Bt(n,l,S,O,c,null)}}b&&Bt(n,l,"srcSet",c.srcSet,c,null),v&&Bt(n,l,"src",c.src,c,null);return;case"input":vt("invalid",n);var G=S=O=b=null,ee=null,fe=null;for(v in c)if(c.hasOwnProperty(v)){var be=c[v];if(be!=null)switch(v){case"name":b=be;break;case"type":O=be;break;case"checked":ee=be;break;case"defaultChecked":fe=be;break;case"value":S=be;break;case"defaultValue":G=be;break;case"children":case"dangerouslySetInnerHTML":if(be!=null)throw Error(a(137,l));break;default:Bt(n,l,v,be,c,null)}}dy(n,S,G,ee,fe,O,b,!1);return;case"select":vt("invalid",n),v=O=S=null;for(b in c)if(c.hasOwnProperty(b)&&(G=c[b],G!=null))switch(b){case"value":S=G;break;case"defaultValue":O=G;break;case"multiple":v=G;default:Bt(n,l,b,G,c,null)}l=S,c=O,n.multiple=!!v,l!=null?hl(n,!!v,l,!1):c!=null&&hl(n,!!v,c,!0);return;case"textarea":vt("invalid",n),S=b=v=null;for(O in c)if(c.hasOwnProperty(O)&&(G=c[O],G!=null))switch(O){case"value":v=G;break;case"defaultValue":b=G;break;case"children":S=G;break;case"dangerouslySetInnerHTML":if(G!=null)throw Error(a(91));break;default:Bt(n,l,O,G,c,null)}hy(n,v,b,S);return;case"option":for(ee in c)if(c.hasOwnProperty(ee)&&(v=c[ee],v!=null))switch(ee){case"selected":n.selected=v&&typeof v!="function"&&typeof v!="symbol";break;default:Bt(n,l,ee,v,c,null)}return;case"dialog":vt("beforetoggle",n),vt("toggle",n),vt("cancel",n),vt("close",n);break;case"iframe":case"object":vt("load",n);break;case"video":case"audio":for(v=0;v<bu.length;v++)vt(bu[v],n);break;case"image":vt("error",n),vt("load",n);break;case"details":vt("toggle",n);break;case"embed":case"source":case"link":vt("error",n),vt("load",n);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(fe in c)if(c.hasOwnProperty(fe)&&(v=c[fe],v!=null))switch(fe){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,l));default:Bt(n,l,fe,v,c,null)}return;default:if(Nh(l)){for(be in c)c.hasOwnProperty(be)&&(v=c[be],v!==void 0&&fp(n,l,be,v,c,void 0));return}}for(G in c)c.hasOwnProperty(G)&&(v=c[G],v!=null&&Bt(n,l,G,v,c,null))}function T5(n,l,c,v){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var b=null,S=null,O=null,G=null,ee=null,fe=null,be=null;for(me in c){var Ce=c[me];if(c.hasOwnProperty(me)&&Ce!=null)switch(me){case"checked":break;case"value":break;case"defaultValue":ee=Ce;default:v.hasOwnProperty(me)||Bt(n,l,me,null,v,Ce)}}for(var ve in v){var me=v[ve];if(Ce=c[ve],v.hasOwnProperty(ve)&&(me!=null||Ce!=null))switch(ve){case"type":S=me;break;case"name":b=me;break;case"checked":fe=me;break;case"defaultChecked":be=me;break;case"value":O=me;break;case"defaultValue":G=me;break;case"children":case"dangerouslySetInnerHTML":if(me!=null)throw Error(a(137,l));break;default:me!==Ce&&Bt(n,l,ve,me,v,Ce)}}Th(n,O,G,ee,fe,be,S,b);return;case"select":me=O=G=ve=null;for(S in c)if(ee=c[S],c.hasOwnProperty(S)&&ee!=null)switch(S){case"value":break;case"multiple":me=ee;default:v.hasOwnProperty(S)||Bt(n,l,S,null,v,ee)}for(b in v)if(S=v[b],ee=c[b],v.hasOwnProperty(b)&&(S!=null||ee!=null))switch(b){case"value":ve=S;break;case"defaultValue":G=S;break;case"multiple":O=S;default:S!==ee&&Bt(n,l,b,S,v,ee)}l=G,c=O,v=me,ve!=null?hl(n,!!c,ve,!1):!!v!=!!c&&(l!=null?hl(n,!!c,l,!0):hl(n,!!c,c?[]:"",!1));return;case"textarea":me=ve=null;for(G in c)if(b=c[G],c.hasOwnProperty(G)&&b!=null&&!v.hasOwnProperty(G))switch(G){case"value":break;case"children":break;default:Bt(n,l,G,null,v,b)}for(O in v)if(b=v[O],S=c[O],v.hasOwnProperty(O)&&(b!=null||S!=null))switch(O){case"value":ve=b;break;case"defaultValue":me=b;break;case"children":break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(a(91));break;default:b!==S&&Bt(n,l,O,b,v,S)}fy(n,ve,me);return;case"option":for(var Fe in c)if(ve=c[Fe],c.hasOwnProperty(Fe)&&ve!=null&&!v.hasOwnProperty(Fe))switch(Fe){case"selected":n.selected=!1;break;default:Bt(n,l,Fe,null,v,ve)}for(ee in v)if(ve=v[ee],me=c[ee],v.hasOwnProperty(ee)&&ve!==me&&(ve!=null||me!=null))switch(ee){case"selected":n.selected=ve&&typeof ve!="function"&&typeof ve!="symbol";break;default:Bt(n,l,ee,ve,v,me)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var rt in c)ve=c[rt],c.hasOwnProperty(rt)&&ve!=null&&!v.hasOwnProperty(rt)&&Bt(n,l,rt,null,v,ve);for(fe in v)if(ve=v[fe],me=c[fe],v.hasOwnProperty(fe)&&ve!==me&&(ve!=null||me!=null))switch(fe){case"children":case"dangerouslySetInnerHTML":if(ve!=null)throw Error(a(137,l));break;default:Bt(n,l,fe,ve,v,me)}return;default:if(Nh(l)){for(var Lt in c)ve=c[Lt],c.hasOwnProperty(Lt)&&ve!==void 0&&!v.hasOwnProperty(Lt)&&fp(n,l,Lt,void 0,v,ve);for(be in v)ve=v[be],me=c[be],!v.hasOwnProperty(be)||ve===me||ve===void 0&&me===void 0||fp(n,l,be,ve,v,me);return}}for(var ue in c)ve=c[ue],c.hasOwnProperty(ue)&&ve!=null&&!v.hasOwnProperty(ue)&&Bt(n,l,ue,null,v,ve);for(Ce in v)ve=v[Ce],me=c[Ce],!v.hasOwnProperty(Ce)||ve===me||ve==null&&me==null||Bt(n,l,Ce,ve,v,me)}function g1(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function C5(){if(typeof performance.getEntriesByType=="function"){for(var n=0,l=0,c=performance.getEntriesByType("resource"),v=0;v<c.length;v++){var b=c[v],S=b.transferSize,O=b.initiatorType,G=b.duration;if(S&&G&&g1(O)){for(O=0,G=b.responseEnd,v+=1;v<c.length;v++){var ee=c[v],fe=ee.startTime;if(fe>G)break;var be=ee.transferSize,Ce=ee.initiatorType;be&&g1(Ce)&&(ee=ee.responseEnd,O+=be*(ee<G?1:(G-fe)/(ee-fe)))}if(--v,l+=8*(S+O)/(b.duration/1e3),n++,10<n)break}}if(0<n)return l/n/1e6}return navigator.connection&&(n=navigator.connection.downlink,typeof n=="number")?n:5}var hp=null,vp=null;function Ld(n){return n.nodeType===9?n:n.ownerDocument}function m1(n){switch(n){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function y1(n,l){if(n===0)switch(l){case"svg":return 1;case"math":return 2;default:return 0}return n===1&&l==="foreignObject"?0:n}function pp(n,l){return n==="textarea"||n==="noscript"||typeof l.children=="string"||typeof l.children=="number"||typeof l.children=="bigint"||typeof l.dangerouslySetInnerHTML=="object"&&l.dangerouslySetInnerHTML!==null&&l.dangerouslySetInnerHTML.__html!=null}var gp=null;function N5(){var n=window.event;return n&&n.type==="popstate"?n===gp?!1:(gp=n,!0):(gp=null,!1)}var x1=typeof setTimeout=="function"?setTimeout:void 0,j5=typeof clearTimeout=="function"?clearTimeout:void 0,b1=typeof Promise=="function"?Promise:void 0,A5=typeof queueMicrotask=="function"?queueMicrotask:typeof b1<"u"?function(n){return b1.resolve(null).then(n).catch(M5)}:x1;function M5(n){setTimeout(function(){throw n})}function Ni(n){return n==="head"}function w1(n,l){var c=l,v=0;do{var b=c.nextSibling;if(n.removeChild(c),b&&b.nodeType===8)if(c=b.data,c==="/$"||c==="/&"){if(v===0){n.removeChild(b),Gl(l);return}v--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")v++;else if(c==="html")Su(n.ownerDocument.documentElement);else if(c==="head"){c=n.ownerDocument.head,Su(c);for(var S=c.firstChild;S;){var O=S.nextSibling,G=S.nodeName;S[Ar]||G==="SCRIPT"||G==="STYLE"||G==="LINK"&&S.rel.toLowerCase()==="stylesheet"||c.removeChild(S),S=O}}else c==="body"&&Su(n.ownerDocument.body);c=b}while(c);Gl(l)}function S1(n,l){var c=n;n=0;do{var v=c.nextSibling;if(c.nodeType===1?l?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(l?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),v&&v.nodeType===8)if(c=v.data,c==="/$"){if(n===0)break;n--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||n++;c=v}while(c)}function mp(n){var l=n.firstChild;for(l&&l.nodeType===10&&(l=l.nextSibling);l;){var c=l;switch(l=l.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":mp(c),dl(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}n.removeChild(c)}}function k5(n,l,c,v){for(;n.nodeType===1;){var b=c;if(n.nodeName.toLowerCase()!==l.toLowerCase()){if(!v&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(v){if(!n[Ar])switch(l){case"meta":if(!n.hasAttribute("itemprop"))break;return n;case"link":if(S=n.getAttribute("rel"),S==="stylesheet"&&n.hasAttribute("data-precedence"))break;if(S!==b.rel||n.getAttribute("href")!==(b.href==null||b.href===""?null:b.href)||n.getAttribute("crossorigin")!==(b.crossOrigin==null?null:b.crossOrigin)||n.getAttribute("title")!==(b.title==null?null:b.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(S=n.getAttribute("src"),(S!==(b.src==null?null:b.src)||n.getAttribute("type")!==(b.type==null?null:b.type)||n.getAttribute("crossorigin")!==(b.crossOrigin==null?null:b.crossOrigin))&&S&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(l==="input"&&n.type==="hidden"){var S=b.name==null?null:""+b.name;if(b.type==="hidden"&&n.getAttribute("name")===S)return n}else return n;if(n=Fa(n.nextSibling),n===null)break}return null}function D5(n,l,c){if(l==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!c||(n=Fa(n.nextSibling),n===null))return null;return n}function E1(n,l){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!l||(n=Fa(n.nextSibling),n===null))return null;return n}function yp(n){return n.data==="$?"||n.data==="$~"}function xp(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function O5(n,l){var c=n.ownerDocument;if(n.data==="$~")n._reactRetry=l;else if(n.data!=="$?"||c.readyState!=="loading")l();else{var v=function(){l(),c.removeEventListener("DOMContentLoaded",v)};c.addEventListener("DOMContentLoaded",v),n._reactRetry=v}}function Fa(n){for(;n!=null;n=n.nextSibling){var l=n.nodeType;if(l===1||l===3)break;if(l===8){if(l=n.data,l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"||l==="F!"||l==="F")break;if(l==="/$"||l==="/&")return null}}return n}var bp=null;function T1(n){n=n.nextSibling;for(var l=0;n;){if(n.nodeType===8){var c=n.data;if(c==="/$"||c==="/&"){if(l===0)return Fa(n.nextSibling);l--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||l++}n=n.nextSibling}return null}function C1(n){n=n.previousSibling;for(var l=0;n;){if(n.nodeType===8){var c=n.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(l===0)return n;l--}else c!=="/$"&&c!=="/&"||l++}n=n.previousSibling}return null}function N1(n,l,c){switch(l=Ld(c),n){case"html":if(n=l.documentElement,!n)throw Error(a(452));return n;case"head":if(n=l.head,!n)throw Error(a(453));return n;case"body":if(n=l.body,!n)throw Error(a(454));return n;default:throw Error(a(451))}}function Su(n){for(var l=n.attributes;l.length;)n.removeAttributeNode(l[0]);dl(n)}var Ha=new Map,j1=new Set;function Pd(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var Fn=I.d;I.d={f:R5,r:B5,D:L5,C:P5,L:z5,m:_5,X:q5,S:U5,M:I5};function R5(){var n=Fn.f(),l=jd();return n||l}function B5(n){var l=si(n);l!==null&&l.tag===5&&l.type==="form"?Hx(l):Fn.r(n)}var Vl=typeof document>"u"?null:document;function A1(n,l,c){var v=Vl;if(v&&typeof l=="string"&&l){var b=Pa(l);b='link[rel="'+n+'"][href="'+b+'"]',typeof c=="string"&&(b+='[crossorigin="'+c+'"]'),j1.has(b)||(j1.add(b),n={rel:n,crossOrigin:c,href:l},v.querySelector(b)===null&&(l=v.createElement("link"),Ur(l,"link",n),dr(l),v.head.appendChild(l)))}}function L5(n){Fn.D(n),A1("dns-prefetch",n,null)}function P5(n,l){Fn.C(n,l),A1("preconnect",n,l)}function z5(n,l,c){Fn.L(n,l,c);var v=Vl;if(v&&n&&l){var b='link[rel="preload"][as="'+Pa(l)+'"]';l==="image"&&c&&c.imageSrcSet?(b+='[imagesrcset="'+Pa(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(b+='[imagesizes="'+Pa(c.imageSizes)+'"]')):b+='[href="'+Pa(n)+'"]';var S=b;switch(l){case"style":S=Fl(n);break;case"script":S=Hl(n)}Ha.has(S)||(n=p({rel:"preload",href:l==="image"&&c&&c.imageSrcSet?void 0:n,as:l},c),Ha.set(S,n),v.querySelector(b)!==null||l==="style"&&v.querySelector(Eu(S))||l==="script"&&v.querySelector(Tu(S))||(l=v.createElement("link"),Ur(l,"link",n),dr(l),v.head.appendChild(l)))}}function _5(n,l){Fn.m(n,l);var c=Vl;if(c&&n){var v=l&&typeof l.as=="string"?l.as:"script",b='link[rel="modulepreload"][as="'+Pa(v)+'"][href="'+Pa(n)+'"]',S=b;switch(v){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":S=Hl(n)}if(!Ha.has(S)&&(n=p({rel:"modulepreload",href:n},l),Ha.set(S,n),c.querySelector(b)===null)){switch(v){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(Tu(S)))return}v=c.createElement("link"),Ur(v,"link",n),dr(v),c.head.appendChild(v)}}}function U5(n,l,c){Fn.S(n,l,c);var v=Vl;if(v&&n){var b=li(v).hoistableStyles,S=Fl(n);l=l||"default";var O=b.get(S);if(!O){var G={loading:0,preload:null};if(O=v.querySelector(Eu(S)))G.loading=5;else{n=p({rel:"stylesheet",href:n,"data-precedence":l},c),(c=Ha.get(S))&&wp(n,c);var ee=O=v.createElement("link");dr(ee),Ur(ee,"link",n),ee._p=new Promise(function(fe,be){ee.onload=fe,ee.onerror=be}),ee.addEventListener("load",function(){G.loading|=1}),ee.addEventListener("error",function(){G.loading|=2}),G.loading|=4,zd(O,l,v)}O={type:"stylesheet",instance:O,count:1,state:G},b.set(S,O)}}}function q5(n,l){Fn.X(n,l);var c=Vl;if(c&&n){var v=li(c).hoistableScripts,b=Hl(n),S=v.get(b);S||(S=c.querySelector(Tu(b)),S||(n=p({src:n,async:!0},l),(l=Ha.get(b))&&Sp(n,l),S=c.createElement("script"),dr(S),Ur(S,"link",n),c.head.appendChild(S)),S={type:"script",instance:S,count:1,state:null},v.set(b,S))}}function I5(n,l){Fn.M(n,l);var c=Vl;if(c&&n){var v=li(c).hoistableScripts,b=Hl(n),S=v.get(b);S||(S=c.querySelector(Tu(b)),S||(n=p({src:n,async:!0,type:"module"},l),(l=Ha.get(b))&&Sp(n,l),S=c.createElement("script"),dr(S),Ur(S,"link",n),c.head.appendChild(S)),S={type:"script",instance:S,count:1,state:null},v.set(b,S))}}function M1(n,l,c,v){var b=(b=Y.current)?Pd(b):null;if(!b)throw Error(a(446));switch(n){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(l=Fl(c.href),c=li(b).hoistableStyles,v=c.get(l),v||(v={type:"style",instance:null,count:0,state:null},c.set(l,v)),v):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){n=Fl(c.href);var S=li(b).hoistableStyles,O=S.get(n);if(O||(b=b.ownerDocument||b,O={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},S.set(n,O),(S=b.querySelector(Eu(n)))&&!S._p&&(O.instance=S,O.state.loading=5),Ha.has(n)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},Ha.set(n,c),S||V5(b,n,c,O.state))),l&&v===null)throw Error(a(528,""));return O}if(l&&v!==null)throw Error(a(529,""));return null;case"script":return l=c.async,c=c.src,typeof c=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=Hl(c),c=li(b).hoistableScripts,v=c.get(l),v||(v={type:"script",instance:null,count:0,state:null},c.set(l,v)),v):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,n))}}function Fl(n){return'href="'+Pa(n)+'"'}function Eu(n){return'link[rel="stylesheet"]['+n+"]"}function k1(n){return p({},n,{"data-precedence":n.precedence,precedence:null})}function V5(n,l,c,v){n.querySelector('link[rel="preload"][as="style"]['+l+"]")?v.loading=1:(l=n.createElement("link"),v.preload=l,l.addEventListener("load",function(){return v.loading|=1}),l.addEventListener("error",function(){return v.loading|=2}),Ur(l,"link",c),dr(l),n.head.appendChild(l))}function Hl(n){return'[src="'+Pa(n)+'"]'}function Tu(n){return"script[async]"+n}function D1(n,l,c){if(l.count++,l.instance===null)switch(l.type){case"style":var v=n.querySelector('style[data-href~="'+Pa(c.href)+'"]');if(v)return l.instance=v,dr(v),v;var b=p({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return v=(n.ownerDocument||n).createElement("style"),dr(v),Ur(v,"style",b),zd(v,c.precedence,n),l.instance=v;case"stylesheet":b=Fl(c.href);var S=n.querySelector(Eu(b));if(S)return l.state.loading|=4,l.instance=S,dr(S),S;v=k1(c),(b=Ha.get(b))&&wp(v,b),S=(n.ownerDocument||n).createElement("link"),dr(S);var O=S;return O._p=new Promise(function(G,ee){O.onload=G,O.onerror=ee}),Ur(S,"link",v),l.state.loading|=4,zd(S,c.precedence,n),l.instance=S;case"script":return S=Hl(c.src),(b=n.querySelector(Tu(S)))?(l.instance=b,dr(b),b):(v=c,(b=Ha.get(S))&&(v=p({},c),Sp(v,b)),n=n.ownerDocument||n,b=n.createElement("script"),dr(b),Ur(b,"link",v),n.head.appendChild(b),l.instance=b);case"void":return null;default:throw Error(a(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(v=l.instance,l.state.loading|=4,zd(v,c.precedence,n));return l.instance}function zd(n,l,c){for(var v=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),b=v.length?v[v.length-1]:null,S=b,O=0;O<v.length;O++){var G=v[O];if(G.dataset.precedence===l)S=G;else if(S!==b)break}S?S.parentNode.insertBefore(n,S.nextSibling):(l=c.nodeType===9?c.head:c,l.insertBefore(n,l.firstChild))}function wp(n,l){n.crossOrigin==null&&(n.crossOrigin=l.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=l.referrerPolicy),n.title==null&&(n.title=l.title)}function Sp(n,l){n.crossOrigin==null&&(n.crossOrigin=l.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=l.referrerPolicy),n.integrity==null&&(n.integrity=l.integrity)}var _d=null;function O1(n,l,c){if(_d===null){var v=new Map,b=_d=new Map;b.set(c,v)}else b=_d,v=b.get(c),v||(v=new Map,b.set(c,v));if(v.has(n))return v;for(v.set(n,null),c=c.getElementsByTagName(n),b=0;b<c.length;b++){var S=c[b];if(!(S[Ar]||S[Ht]||n==="link"&&S.getAttribute("rel")==="stylesheet")&&S.namespaceURI!=="http://www.w3.org/2000/svg"){var O=S.getAttribute(l)||"";O=n+O;var G=v.get(O);G?G.push(S):v.set(O,[S])}}return v}function R1(n,l,c){n=n.ownerDocument||n,n.head.insertBefore(c,l==="title"?n.querySelector("head > title"):null)}function F5(n,l,c){if(c===1||l.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof l.precedence!="string"||typeof l.href!="string"||l.href==="")break;return!0;case"link":if(typeof l.rel!="string"||typeof l.href!="string"||l.href===""||l.onLoad||l.onError)break;switch(l.rel){case"stylesheet":return n=l.disabled,typeof l.precedence=="string"&&n==null;default:return!0}case"script":if(l.async&&typeof l.async!="function"&&typeof l.async!="symbol"&&!l.onLoad&&!l.onError&&l.src&&typeof l.src=="string")return!0}return!1}function B1(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function H5(n,l,c,v){if(c.type==="stylesheet"&&(typeof v.media!="string"||matchMedia(v.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var b=Fl(v.href),S=l.querySelector(Eu(b));if(S){l=S._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(n.count++,n=Ud.bind(n),l.then(n,n)),c.state.loading|=4,c.instance=S,dr(S);return}S=l.ownerDocument||l,v=k1(v),(b=Ha.get(b))&&wp(v,b),S=S.createElement("link"),dr(S);var O=S;O._p=new Promise(function(G,ee){O.onload=G,O.onerror=ee}),Ur(S,"link",v),c.instance=S}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(c,l),(l=c.state.preload)&&(c.state.loading&3)===0&&(n.count++,c=Ud.bind(n),l.addEventListener("load",c),l.addEventListener("error",c))}}var Ep=0;function G5(n,l){return n.stylesheets&&n.count===0&&Id(n,n.stylesheets),0<n.count||0<n.imgCount?function(c){var v=setTimeout(function(){if(n.stylesheets&&Id(n,n.stylesheets),n.unsuspend){var S=n.unsuspend;n.unsuspend=null,S()}},6e4+l);0<n.imgBytes&&Ep===0&&(Ep=62500*C5());var b=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&Id(n,n.stylesheets),n.unsuspend)){var S=n.unsuspend;n.unsuspend=null,S()}},(n.imgBytes>Ep?50:800)+l);return n.unsuspend=c,function(){n.unsuspend=null,clearTimeout(v),clearTimeout(b)}}:null}function Ud(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Id(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var qd=null;function Id(n,l){n.stylesheets=null,n.unsuspend!==null&&(n.count++,qd=new Map,l.forEach(Q5,n),qd=null,Ud.call(n))}function Q5(n,l){if(!(l.state.loading&4)){var c=qd.get(n);if(c)var v=c.get(null);else{c=new Map,qd.set(n,c);for(var b=n.querySelectorAll("link[data-precedence],style[data-precedence]"),S=0;S<b.length;S++){var O=b[S];(O.nodeName==="LINK"||O.getAttribute("media")!=="not all")&&(c.set(O.dataset.precedence,O),v=O)}v&&c.set(null,v)}b=l.instance,O=b.getAttribute("data-precedence"),S=c.get(O)||v,S===v&&c.set(null,b),c.set(O,b),this.count++,v=Ud.bind(this),b.addEventListener("load",v),b.addEventListener("error",v),S?S.parentNode.insertBefore(b,S.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(b,n.firstChild)),l.state.loading|=4}}var Cu={$$typeof:N,Provider:null,Consumer:null,_currentValue:F,_currentValue2:F,_threadCount:0};function $5(n,l,c,v,b,S,O,G,ee){this.tag=1,this.containerInfo=n,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Yt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Yt(0),this.hiddenUpdates=Yt(null),this.identifierPrefix=v,this.onUncaughtError=b,this.onCaughtError=S,this.onRecoverableError=O,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ee,this.incompleteTransitions=new Map}function L1(n,l,c,v,b,S,O,G,ee,fe,be,Ce){return n=new $5(n,l,c,O,ee,fe,be,Ce,G),l=1,S===!0&&(l|=24),S=Ea(3,null,null,l),n.current=S,S.stateNode=n,l=rv(),l.refCount++,n.pooledCache=l,l.refCount++,S.memoizedState={element:v,isDehydrated:c,cache:l},sv(S),n}function P1(n){return n?(n=wl,n):wl}function z1(n,l,c,v,b,S){b=P1(b),v.context===null?v.context=b:v.pendingContext=b,v=pi(l),v.payload={element:c},S=S===void 0?null:S,S!==null&&(v.callback=S),c=gi(n,v,l),c!==null&&(ha(c,n,l),au(c,n,l))}function _1(n,l){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var c=n.retryLane;n.retryLane=c!==0&&c<l?c:l}}function Tp(n,l){_1(n,l),(n=n.alternate)&&_1(n,l)}function U1(n){if(n.tag===13||n.tag===31){var l=xs(n,67108864);l!==null&&ha(l,n,67108864),Tp(n,67108864)}}function q1(n){if(n.tag===13||n.tag===31){var l=Aa();l=lr(l);var c=xs(n,l);c!==null&&ha(c,n,l),Tp(n,l)}}var Vd=!0;function Y5(n,l,c,v){var b=z.T;z.T=null;var S=I.p;try{I.p=2,Cp(n,l,c,v)}finally{I.p=S,z.T=b}}function K5(n,l,c,v){var b=z.T;z.T=null;var S=I.p;try{I.p=8,Cp(n,l,c,v)}finally{I.p=S,z.T=b}}function Cp(n,l,c,v){if(Vd){var b=Np(v);if(b===null)dp(n,l,v,Fd,c),V1(n,v);else if(Z5(b,n,l,c,v))v.stopPropagation();else if(V1(n,v),l&4&&-1<X5.indexOf(n)){for(;b!==null;){var S=si(b);if(S!==null)switch(S.tag){case 3:if(S=S.stateNode,S.current.memoizedState.isDehydrated){var O=it(S.pendingLanes);if(O!==0){var G=S;for(G.pendingLanes|=2,G.entangledLanes|=2;O;){var ee=1<<31-pe(O);G.entanglements[1]|=ee,O&=~ee}vn(S),(Nt&6)===0&&(Cd=Be()+500,xu(0))}}break;case 31:case 13:G=xs(S,2),G!==null&&ha(G,S,2),jd(),Tp(S,2)}if(S=Np(v),S===null&&dp(n,l,v,Fd,c),S===b)break;b=S}b!==null&&v.stopPropagation()}else dp(n,l,v,null,c)}}function Np(n){return n=Ah(n),jp(n)}var Fd=null;function jp(n){if(Fd=null,n=ii(n),n!==null){var l=s(n);if(l===null)n=null;else{var c=l.tag;if(c===13){if(n=o(l),n!==null)return n;n=null}else if(c===31){if(n=u(l),n!==null)return n;n=null}else if(c===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;n=null}else l!==n&&(n=null)}}return Fd=n,null}function I1(n){switch(n){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(nt()){case ye:return 2;case $e:return 8;case et:case xe:return 32;case ze:return 268435456;default:return 32}default:return 32}}var Ap=!1,ji=null,Ai=null,Mi=null,Nu=new Map,ju=new Map,ki=[],X5="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function V1(n,l){switch(n){case"focusin":case"focusout":ji=null;break;case"dragenter":case"dragleave":Ai=null;break;case"mouseover":case"mouseout":Mi=null;break;case"pointerover":case"pointerout":Nu.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":ju.delete(l.pointerId)}}function Au(n,l,c,v,b,S){return n===null||n.nativeEvent!==S?(n={blockedOn:l,domEventName:c,eventSystemFlags:v,nativeEvent:S,targetContainers:[b]},l!==null&&(l=si(l),l!==null&&U1(l)),n):(n.eventSystemFlags|=v,l=n.targetContainers,b!==null&&l.indexOf(b)===-1&&l.push(b),n)}function Z5(n,l,c,v,b){switch(l){case"focusin":return ji=Au(ji,n,l,c,v,b),!0;case"dragenter":return Ai=Au(Ai,n,l,c,v,b),!0;case"mouseover":return Mi=Au(Mi,n,l,c,v,b),!0;case"pointerover":var S=b.pointerId;return Nu.set(S,Au(Nu.get(S)||null,n,l,c,v,b)),!0;case"gotpointercapture":return S=b.pointerId,ju.set(S,Au(ju.get(S)||null,n,l,c,v,b)),!0}return!1}function F1(n){var l=ii(n.target);if(l!==null){var c=s(l);if(c!==null){if(l=c.tag,l===13){if(l=o(c),l!==null){n.blockedOn=l,Ba(n.priority,function(){q1(c)});return}}else if(l===31){if(l=u(c),l!==null){n.blockedOn=l,Ba(n.priority,function(){q1(c)});return}}else if(l===3&&c.stateNode.current.memoizedState.isDehydrated){n.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}n.blockedOn=null}function Hd(n){if(n.blockedOn!==null)return!1;for(var l=n.targetContainers;0<l.length;){var c=Np(n.nativeEvent);if(c===null){c=n.nativeEvent;var v=new c.constructor(c.type,c);jh=v,c.target.dispatchEvent(v),jh=null}else return l=si(c),l!==null&&U1(l),n.blockedOn=c,!1;l.shift()}return!0}function H1(n,l,c){Hd(n)&&c.delete(l)}function W5(){Ap=!1,ji!==null&&Hd(ji)&&(ji=null),Ai!==null&&Hd(Ai)&&(Ai=null),Mi!==null&&Hd(Mi)&&(Mi=null),Nu.forEach(H1),ju.forEach(H1)}function Gd(n,l){n.blockedOn===l&&(n.blockedOn=null,Ap||(Ap=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,W5)))}var Qd=null;function G1(n){Qd!==n&&(Qd=n,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Qd===n&&(Qd=null);for(var l=0;l<n.length;l+=3){var c=n[l],v=n[l+1],b=n[l+2];if(typeof v!="function"){if(jp(v||c)===null)continue;break}var S=si(c);S!==null&&(n.splice(l,3),l-=3,Nv(S,{pending:!0,data:b,method:c.method,action:v},v,b))}}))}function Gl(n){function l(ee){return Gd(ee,n)}ji!==null&&Gd(ji,n),Ai!==null&&Gd(Ai,n),Mi!==null&&Gd(Mi,n),Nu.forEach(l),ju.forEach(l);for(var c=0;c<ki.length;c++){var v=ki[c];v.blockedOn===n&&(v.blockedOn=null)}for(;0<ki.length&&(c=ki[0],c.blockedOn===null);)F1(c),c.blockedOn===null&&ki.shift();if(c=(n.ownerDocument||n).$$reactFormReplay,c!=null)for(v=0;v<c.length;v+=3){var b=c[v],S=c[v+1],O=b[xr]||null;if(typeof S=="function")O||G1(c);else if(O){var G=null;if(S&&S.hasAttribute("formAction")){if(b=S,O=S[xr]||null)G=O.formAction;else if(jp(b)!==null)continue}else G=O.action;typeof G=="function"?c[v+1]=G:(c.splice(v,3),v-=3),G1(c)}}}function Q1(){function n(S){S.canIntercept&&S.info==="react-transition"&&S.intercept({handler:function(){return new Promise(function(O){return b=O})},focusReset:"manual",scroll:"manual"})}function l(){b!==null&&(b(),b=null),v||setTimeout(c,20)}function c(){if(!v&&!navigation.transition){var S=navigation.currentEntry;S&&S.url!=null&&navigation.navigate(S.url,{state:S.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var v=!1,b=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",l),navigation.addEventListener("navigateerror",l),setTimeout(c,100),function(){v=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",l),navigation.removeEventListener("navigateerror",l),b!==null&&(b(),b=null)}}}function Mp(n){this._internalRoot=n}$d.prototype.render=Mp.prototype.render=function(n){var l=this._internalRoot;if(l===null)throw Error(a(409));var c=l.current,v=Aa();z1(c,v,n,l,null,null)},$d.prototype.unmount=Mp.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var l=n.containerInfo;z1(n.current,2,null,n,null,null),jd(),l[sa]=null}};function $d(n){this._internalRoot=n}$d.prototype.unstable_scheduleHydration=function(n){if(n){var l=Xt();n={blockedOn:null,target:n,priority:l};for(var c=0;c<ki.length&&l!==0&&l<ki[c].priority;c++);ki.splice(c,0,n),c===0&&F1(n)}};var $1=e.version;if($1!=="19.2.4")throw Error(a(527,$1,"19.2.4"));I.findDOMNode=function(n){var l=n._reactInternals;if(l===void 0)throw typeof n.render=="function"?Error(a(188)):(n=Object.keys(n).join(","),Error(a(268,n)));return n=f(l),n=n!==null?h(n):null,n=n===null?null:n.stateNode,n};var J5={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:z,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Yd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Yd.isDisabled&&Yd.supportsFiber)try{$=Yd.inject(J5),ce=Yd}catch{}}return ku.createRoot=function(n,l){if(!i(n))throw Error(a(299));var c=!1,v="",b=eb,S=tb,O=rb;return l!=null&&(l.unstable_strictMode===!0&&(c=!0),l.identifierPrefix!==void 0&&(v=l.identifierPrefix),l.onUncaughtError!==void 0&&(b=l.onUncaughtError),l.onCaughtError!==void 0&&(S=l.onCaughtError),l.onRecoverableError!==void 0&&(O=l.onRecoverableError)),l=L1(n,1,!1,null,null,c,v,null,b,S,O,Q1),n[sa]=l.current,cp(n),new Mp(l)},ku.hydrateRoot=function(n,l,c){if(!i(n))throw Error(a(299));var v=!1,b="",S=eb,O=tb,G=rb,ee=null;return c!=null&&(c.unstable_strictMode===!0&&(v=!0),c.identifierPrefix!==void 0&&(b=c.identifierPrefix),c.onUncaughtError!==void 0&&(S=c.onUncaughtError),c.onCaughtError!==void 0&&(O=c.onCaughtError),c.onRecoverableError!==void 0&&(G=c.onRecoverableError),c.formState!==void 0&&(ee=c.formState)),l=L1(n,1,!0,l,c??null,v,b,ee,S,O,G,Q1),l.context=P1(null),c=l.current,v=Aa(),v=lr(v),b=pi(v),b.callback=null,gi(c,b,v),c=v,l.current.lanes=c,Ot(l,c),vn(l),n[sa]=l.current,cp(n),new $d(l)},ku.version="19.2.4",ku}var n2;function d4(){if(n2)return Bp.exports;n2=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Bp.exports=c4(),Bp.exports}var f4=d4();const h4=PE(f4);var $u=UE();/**
50
+ * @remix-run/router v1.23.2
51
+ *
52
+ * Copyright (c) Remix Software Inc.
53
+ *
54
+ * This source code is licensed under the MIT license found in the
55
+ * LICENSE.md file in the root directory of this source tree.
56
+ *
57
+ * @license MIT
58
+ */function Yu(){return Yu=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},Yu.apply(this,arguments)}var $i;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})($i||($i={}));const i2="popstate";function v4(t){t===void 0&&(t={});function e(a,i){let{pathname:s,search:o,hash:u}=a.location;return wg("",{pathname:s,search:o,hash:u},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function r(a,i){return typeof i=="string"?i:Df(i)}return g4(e,r,null,t)}function yr(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function xm(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function p4(){return Math.random().toString(36).substr(2,8)}function s2(t,e){return{usr:t.state,key:t.key,idx:e}}function wg(t,e,r,a){return r===void 0&&(r=null),Yu({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?Oo(e):e,{state:r,key:e&&e.key||a||p4()})}function Df(t){let{pathname:e="/",search:r="",hash:a=""}=t;return r&&r!=="?"&&(e+=r.charAt(0)==="?"?r:"?"+r),a&&a!=="#"&&(e+=a.charAt(0)==="#"?a:"#"+a),e}function Oo(t){let e={};if(t){let r=t.indexOf("#");r>=0&&(e.hash=t.substr(r),t=t.substr(0,r));let a=t.indexOf("?");a>=0&&(e.search=t.substr(a),t=t.substr(0,a)),t&&(e.pathname=t)}return e}function g4(t,e,r,a){a===void 0&&(a={});let{window:i=document.defaultView,v5Compat:s=!1}=a,o=i.history,u=$i.Pop,d=null,f=h();f==null&&(f=0,o.replaceState(Yu({},o.state,{idx:f}),""));function h(){return(o.state||{idx:null}).idx}function p(){u=$i.Pop;let w=h(),T=w==null?null:w-f;f=w,d&&d({action:u,location:E.location,delta:T})}function m(w,T){u=$i.Push;let C=wg(E.location,w,T);f=h()+1;let N=s2(C,f),A=E.createHref(C);try{o.pushState(N,"",A)}catch(D){if(D instanceof DOMException&&D.name==="DataCloneError")throw D;i.location.assign(A)}s&&d&&d({action:u,location:E.location,delta:1})}function y(w,T){u=$i.Replace;let C=wg(E.location,w,T);f=h();let N=s2(C,f),A=E.createHref(C);o.replaceState(N,"",A),s&&d&&d({action:u,location:E.location,delta:0})}function x(w){let T=i.location.origin!=="null"?i.location.origin:i.location.href,C=typeof w=="string"?w:Df(w);return C=C.replace(/ $/,"%20"),yr(T,"No window.location.(origin|href) available to create URL for href: "+C),new URL(C,T)}let E={get action(){return u},get location(){return t(i,o)},listen(w){if(d)throw new Error("A history only accepts one active listener");return i.addEventListener(i2,p),d=w,()=>{i.removeEventListener(i2,p),d=null}},createHref(w){return e(i,w)},createURL:x,encodeLocation(w){let T=x(w);return{pathname:T.pathname,search:T.search,hash:T.hash}},push:m,replace:y,go(w){return o.go(w)}};return E}var l2;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(l2||(l2={}));function m4(t,e,r){return r===void 0&&(r="/"),y4(t,e,r)}function y4(t,e,r,a){let i=typeof e=="string"?Oo(e):e,s=bm(i.pathname||"/",r);if(s==null)return null;let o=qE(t);x4(o);let u=null;for(let d=0;u==null&&d<o.length;++d){let f=D4(s);u=A4(o[d],f)}return u}function qE(t,e,r,a){e===void 0&&(e=[]),r===void 0&&(r=[]),a===void 0&&(a="");let i=(s,o,u)=>{let d={relativePath:u===void 0?s.path||"":u,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};d.relativePath.startsWith("/")&&(yr(d.relativePath.startsWith(a),'Absolute route path "'+d.relativePath+'" nested under path '+('"'+a+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),d.relativePath=d.relativePath.slice(a.length));let f=Zi([a,d.relativePath]),h=r.concat(d);s.children&&s.children.length>0&&(yr(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+f+'".')),qE(s.children,e,h,f)),!(s.path==null&&!s.index)&&e.push({path:f,score:N4(f,s.index),routesMeta:h})};return t.forEach((s,o)=>{var u;if(s.path===""||!((u=s.path)!=null&&u.includes("?")))i(s,o);else for(let d of IE(s.path))i(s,o,d)}),e}function IE(t){let e=t.split("/");if(e.length===0)return[];let[r,...a]=e,i=r.endsWith("?"),s=r.replace(/\?$/,"");if(a.length===0)return i?[s,""]:[s];let o=IE(a.join("/")),u=[];return u.push(...o.map(d=>d===""?s:[s,d].join("/"))),i&&u.push(...o),u.map(d=>t.startsWith("/")&&d===""?"/":d)}function x4(t){t.sort((e,r)=>e.score!==r.score?r.score-e.score:j4(e.routesMeta.map(a=>a.childrenIndex),r.routesMeta.map(a=>a.childrenIndex)))}const b4=/^:[\w-]+$/,w4=3,S4=2,E4=1,T4=10,C4=-2,o2=t=>t==="*";function N4(t,e){let r=t.split("/"),a=r.length;return r.some(o2)&&(a+=C4),e&&(a+=S4),r.filter(i=>!o2(i)).reduce((i,s)=>i+(b4.test(s)?w4:s===""?E4:T4),a)}function j4(t,e){return t.length===e.length&&t.slice(0,-1).every((a,i)=>a===e[i])?t[t.length-1]-e[e.length-1]:0}function A4(t,e,r){let{routesMeta:a}=t,i={},s="/",o=[];for(let u=0;u<a.length;++u){let d=a[u],f=u===a.length-1,h=s==="/"?e:e.slice(s.length)||"/",p=M4({path:d.relativePath,caseSensitive:d.caseSensitive,end:f},h),m=d.route;if(!p)return null;Object.assign(i,p.params),o.push({params:i,pathname:Zi([s,p.pathname]),pathnameBase:P4(Zi([s,p.pathnameBase])),route:m}),p.pathnameBase!=="/"&&(s=Zi([s,p.pathnameBase]))}return o}function M4(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[r,a]=k4(t.path,t.caseSensitive,t.end),i=e.match(r);if(!i)return null;let s=i[0],o=s.replace(/(.)\/+$/,"$1"),u=i.slice(1);return{params:a.reduce((f,h,p)=>{let{paramName:m,isOptional:y}=h;if(m==="*"){let E=u[p]||"";o=s.slice(0,s.length-E.length).replace(/(.)\/+$/,"$1")}const x=u[p];return y&&!x?f[m]=void 0:f[m]=(x||"").replace(/%2F/g,"/"),f},{}),pathname:s,pathnameBase:o,pattern:t}}function k4(t,e,r){e===void 0&&(e=!1),r===void 0&&(r=!0),xm(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let a=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,u,d)=>(a.push({paramName:u,isOptional:d!=null}),d?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(a.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),a]}function D4(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return xm(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function bm(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let r=e.endsWith("/")?e.length-1:e.length,a=t.charAt(r);return a&&a!=="/"?null:t.slice(r)||"/"}const O4=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,R4=t=>O4.test(t);function B4(t,e){e===void 0&&(e="/");let{pathname:r,search:a="",hash:i=""}=typeof t=="string"?Oo(t):t,s;if(r)if(R4(r))s=r;else{if(r.includes("//")){let o=r;r=r.replace(/\/\/+/g,"/"),xm(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+r))}r.startsWith("/")?s=u2(r.substring(1),"/"):s=u2(r,e)}else s=e;return{pathname:s,search:z4(a),hash:_4(i)}}function u2(t,e){let r=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?r.length>1&&r.pop():i!=="."&&r.push(i)}),r.length>1?r.join("/"):"/"}function _p(t,e,r,a){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(a)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function L4(t){return t.filter((e,r)=>r===0||e.route.path&&e.route.path.length>0)}function VE(t,e){let r=L4(t);return e?r.map((a,i)=>i===r.length-1?a.pathname:a.pathnameBase):r.map(a=>a.pathnameBase)}function FE(t,e,r,a){a===void 0&&(a=!1);let i;typeof t=="string"?i=Oo(t):(i=Yu({},t),yr(!i.pathname||!i.pathname.includes("?"),_p("?","pathname","search",i)),yr(!i.pathname||!i.pathname.includes("#"),_p("#","pathname","hash",i)),yr(!i.search||!i.search.includes("#"),_p("#","search","hash",i)));let s=t===""||i.pathname==="",o=s?"/":i.pathname,u;if(o==null)u=r;else{let p=e.length-1;if(!a&&o.startsWith("..")){let m=o.split("/");for(;m[0]==="..";)m.shift(),p-=1;i.pathname=m.join("/")}u=p>=0?e[p]:"/"}let d=B4(i,u),f=o&&o!=="/"&&o.endsWith("/"),h=(s||o===".")&&r.endsWith("/");return!d.pathname.endsWith("/")&&(f||h)&&(d.pathname+="/"),d}const Zi=t=>t.join("/").replace(/\/\/+/g,"/"),P4=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),z4=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,_4=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function U4(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const HE=["post","put","patch","delete"];new Set(HE);const q4=["get",...HE];new Set(q4);/**
59
+ * React Router v6.30.3
60
+ *
61
+ * Copyright (c) Remix Software Inc.
62
+ *
63
+ * This source code is licensed under the MIT license found in the
64
+ * LICENSE.md file in the root directory of this source tree.
65
+ *
66
+ * @license MIT
67
+ */function Ku(){return Ku=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},Ku.apply(this,arguments)}const wm=q.createContext(null),I4=q.createContext(null),nl=q.createContext(null),Xf=q.createContext(null),os=q.createContext({outlet:null,matches:[],isDataRoute:!1}),GE=q.createContext(null);function V4(t,e){let{relative:r}=e===void 0?{}:e;yc()||yr(!1);let{basename:a,navigator:i}=q.useContext(nl),{hash:s,pathname:o,search:u}=$E(t,{relative:r}),d=o;return a!=="/"&&(d=o==="/"?a:Zi([a,o])),i.createHref({pathname:d,search:u,hash:s})}function yc(){return q.useContext(Xf)!=null}function il(){return yc()||yr(!1),q.useContext(Xf).location}function QE(t){q.useContext(nl).static||q.useLayoutEffect(t)}function on(){let{isDataRoute:t}=q.useContext(os);return t?tA():F4()}function F4(){yc()||yr(!1);let t=q.useContext(wm),{basename:e,future:r,navigator:a}=q.useContext(nl),{matches:i}=q.useContext(os),{pathname:s}=il(),o=JSON.stringify(VE(i,r.v7_relativeSplatPath)),u=q.useRef(!1);return QE(()=>{u.current=!0}),q.useCallback(function(f,h){if(h===void 0&&(h={}),!u.current)return;if(typeof f=="number"){a.go(f);return}let p=FE(f,JSON.parse(o),s,h.relative==="path");t==null&&e!=="/"&&(p.pathname=p.pathname==="/"?e:Zi([e,p.pathname])),(h.replace?a.replace:a.push)(p,h.state,h)},[e,a,o,s,t])}function Sm(){let{matches:t}=q.useContext(os),e=t[t.length-1];return e?e.params:{}}function $E(t,e){let{relative:r}=e===void 0?{}:e,{future:a}=q.useContext(nl),{matches:i}=q.useContext(os),{pathname:s}=il(),o=JSON.stringify(VE(i,a.v7_relativeSplatPath));return q.useMemo(()=>FE(t,JSON.parse(o),s,r==="path"),[t,o,s,r])}function H4(t,e){return G4(t,e)}function G4(t,e,r,a){yc()||yr(!1);let{navigator:i}=q.useContext(nl),{matches:s}=q.useContext(os),o=s[s.length-1],u=o?o.params:{};o&&o.pathname;let d=o?o.pathnameBase:"/";o&&o.route;let f=il(),h;if(e){var p;let w=typeof e=="string"?Oo(e):e;d==="/"||(p=w.pathname)!=null&&p.startsWith(d)||yr(!1),h=w}else h=f;let m=h.pathname||"/",y=m;if(d!=="/"){let w=d.replace(/^\//,"").split("/");y="/"+m.replace(/^\//,"").split("/").slice(w.length).join("/")}let x=m4(t,{pathname:y}),E=X4(x&&x.map(w=>Object.assign({},w,{params:Object.assign({},u,w.params),pathname:Zi([d,i.encodeLocation?i.encodeLocation(w.pathname).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?d:Zi([d,i.encodeLocation?i.encodeLocation(w.pathnameBase).pathname:w.pathnameBase])})),s,r,a);return e&&E?q.createElement(Xf.Provider,{value:{location:Ku({pathname:"/",search:"",hash:"",state:null,key:"default"},h),navigationType:$i.Pop}},E):E}function Q4(){let t=eA(),e=U4(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),r=t instanceof Error?t.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return q.createElement(q.Fragment,null,q.createElement("h2",null,"Unexpected Application Error!"),q.createElement("h3",{style:{fontStyle:"italic"}},e),r?q.createElement("pre",{style:i},r):null,null)}const $4=q.createElement(Q4,null);class Y4 extends q.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,r){return r.location!==e.location||r.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:r.error,location:r.location,revalidation:e.revalidation||r.revalidation}}componentDidCatch(e,r){console.error("React Router caught the following error during render",e,r)}render(){return this.state.error!==void 0?q.createElement(os.Provider,{value:this.props.routeContext},q.createElement(GE.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function K4(t){let{routeContext:e,match:r,children:a}=t,i=q.useContext(wm);return i&&i.static&&i.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=r.route.id),q.createElement(os.Provider,{value:e},a)}function X4(t,e,r,a){var i;if(e===void 0&&(e=[]),r===void 0&&(r=null),a===void 0&&(a=null),t==null){var s;if(!r)return null;if(r.errors)t=r.matches;else if((s=a)!=null&&s.v7_partialHydration&&e.length===0&&!r.initialized&&r.matches.length>0)t=r.matches;else return null}let o=t,u=(i=r)==null?void 0:i.errors;if(u!=null){let h=o.findIndex(p=>p.route.id&&(u==null?void 0:u[p.route.id])!==void 0);h>=0||yr(!1),o=o.slice(0,Math.min(o.length,h+1))}let d=!1,f=-1;if(r&&a&&a.v7_partialHydration)for(let h=0;h<o.length;h++){let p=o[h];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(f=h),p.route.id){let{loaderData:m,errors:y}=r,x=p.route.loader&&m[p.route.id]===void 0&&(!y||y[p.route.id]===void 0);if(p.route.lazy||x){d=!0,f>=0?o=o.slice(0,f+1):o=[o[0]];break}}}return o.reduceRight((h,p,m)=>{let y,x=!1,E=null,w=null;r&&(y=u&&p.route.id?u[p.route.id]:void 0,E=p.route.errorElement||$4,d&&(f<0&&m===0?(rA("route-fallback"),x=!0,w=null):f===m&&(x=!0,w=p.route.hydrateFallbackElement||null)));let T=e.concat(o.slice(0,m+1)),C=()=>{let N;return y?N=E:x?N=w:p.route.Component?N=q.createElement(p.route.Component,null):p.route.element?N=p.route.element:N=h,q.createElement(K4,{match:p,routeContext:{outlet:h,matches:T,isDataRoute:r!=null},children:N})};return r&&(p.route.ErrorBoundary||p.route.errorElement||m===0)?q.createElement(Y4,{location:r.location,revalidation:r.revalidation,component:E,error:y,children:C(),routeContext:{outlet:null,matches:T,isDataRoute:!0}}):C()},null)}var YE=(function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t})(YE||{}),KE=(function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t})(KE||{});function Z4(t){let e=q.useContext(wm);return e||yr(!1),e}function W4(t){let e=q.useContext(I4);return e||yr(!1),e}function J4(t){let e=q.useContext(os);return e||yr(!1),e}function XE(t){let e=J4(),r=e.matches[e.matches.length-1];return r.route.id||yr(!1),r.route.id}function eA(){var t;let e=q.useContext(GE),r=W4(),a=XE();return e!==void 0?e:(t=r.errors)==null?void 0:t[a]}function tA(){let{router:t}=Z4(YE.UseNavigateStable),e=XE(KE.UseNavigateStable),r=q.useRef(!1);return QE(()=>{r.current=!0}),q.useCallback(function(i,s){s===void 0&&(s={}),r.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,Ku({fromRouteId:e},s)))},[t,e])}const c2={};function rA(t,e,r){c2[t]||(c2[t]=!0)}function aA(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function Sg(t){yr(!1)}function nA(t){let{basename:e="/",children:r=null,location:a,navigationType:i=$i.Pop,navigator:s,static:o=!1,future:u}=t;yc()&&yr(!1);let d=e.replace(/^\/*/,"/"),f=q.useMemo(()=>({basename:d,navigator:s,static:o,future:Ku({v7_relativeSplatPath:!1},u)}),[d,u,s,o]);typeof a=="string"&&(a=Oo(a));let{pathname:h="/",search:p="",hash:m="",state:y=null,key:x="default"}=a,E=q.useMemo(()=>{let w=bm(h,d);return w==null?null:{location:{pathname:w,search:p,hash:m,state:y,key:x},navigationType:i}},[d,h,p,m,y,x,i]);return E==null?null:q.createElement(nl.Provider,{value:f},q.createElement(Xf.Provider,{children:r,value:E}))}function iA(t){let{children:e,location:r}=t;return H4(Eg(e),r)}new Promise(()=>{});function Eg(t,e){e===void 0&&(e=[]);let r=[];return q.Children.forEach(t,(a,i)=>{if(!q.isValidElement(a))return;let s=[...e,i];if(a.type===q.Fragment){r.push.apply(r,Eg(a.props.children,s));return}a.type!==Sg&&yr(!1),!a.props.index||!a.props.children||yr(!1);let o={id:a.props.id||s.join("-"),caseSensitive:a.props.caseSensitive,element:a.props.element,Component:a.props.Component,index:a.props.index,path:a.props.path,loader:a.props.loader,action:a.props.action,errorElement:a.props.errorElement,ErrorBoundary:a.props.ErrorBoundary,hasErrorBoundary:a.props.ErrorBoundary!=null||a.props.errorElement!=null,shouldRevalidate:a.props.shouldRevalidate,handle:a.props.handle,lazy:a.props.lazy};a.props.children&&(o.children=Eg(a.props.children,s)),r.push(o)}),r}/**
68
+ * React Router DOM v6.30.3
69
+ *
70
+ * Copyright (c) Remix Software Inc.
71
+ *
72
+ * This source code is licensed under the MIT license found in the
73
+ * LICENSE.md file in the root directory of this source tree.
74
+ *
75
+ * @license MIT
76
+ */function Tg(){return Tg=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},Tg.apply(this,arguments)}function sA(t,e){if(t==null)return{};var r={},a=Object.keys(t),i,s;for(s=0;s<a.length;s++)i=a[s],!(e.indexOf(i)>=0)&&(r[i]=t[i]);return r}function lA(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function oA(t,e){return t.button===0&&(!e||e==="_self")&&!lA(t)}const uA=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],cA="6";try{window.__reactRouterVersion=cA}catch{}const dA="startTransition",d2=_E[dA];function fA(t){let{basename:e,children:r,future:a,window:i}=t,s=q.useRef();s.current==null&&(s.current=v4({window:i,v5Compat:!0}));let o=s.current,[u,d]=q.useState({action:o.action,location:o.location}),{v7_startTransition:f}=a||{},h=q.useCallback(p=>{f&&d2?d2(()=>d(p)):d(p)},[d,f]);return q.useLayoutEffect(()=>o.listen(h),[o,h]),q.useEffect(()=>aA(a),[a]),q.createElement(nA,{basename:e,children:r,location:u.location,navigationType:u.action,navigator:o,future:a})}const hA=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",vA=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Qt=q.forwardRef(function(e,r){let{onClick:a,relative:i,reloadDocument:s,replace:o,state:u,target:d,to:f,preventScrollReset:h,viewTransition:p}=e,m=sA(e,uA),{basename:y}=q.useContext(nl),x,E=!1;if(typeof f=="string"&&vA.test(f)&&(x=f,hA))try{let N=new URL(window.location.href),A=f.startsWith("//")?new URL(N.protocol+f):new URL(f),D=bm(A.pathname,y);A.origin===N.origin&&D!=null?f=D+A.search+A.hash:E=!0}catch{}let w=V4(f,{relative:i}),T=pA(f,{replace:o,state:u,target:d,preventScrollReset:h,relative:i,viewTransition:p});function C(N){a&&a(N),N.defaultPrevented||T(N)}return q.createElement("a",Tg({},m,{href:x||w,onClick:E||s?a:C,ref:r,target:d}))});var f2;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(f2||(f2={}));var h2;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(h2||(h2={}));function pA(t,e){let{target:r,replace:a,state:i,preventScrollReset:s,relative:o,viewTransition:u}=e===void 0?{}:e,d=on(),f=il(),h=$E(t,{relative:o});return q.useCallback(p=>{if(oA(p,r)){p.preventDefault();let m=a!==void 0?a:Df(f)===Df(h);d(t,{replace:m,state:i,preventScrollReset:s,relative:o,viewTransition:u})}},[f,d,h,a,i,r,t,s,o,u])}var sl=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},gA={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},zi,mm,TE,mA=(TE=class{constructor(){qe(this,zi,gA);qe(this,mm,!1)}setTimeoutProvider(t){Me(this,zi,t)}setTimeout(t,e){return Z(this,zi).setTimeout(t,e)}clearTimeout(t){Z(this,zi).clearTimeout(t)}setInterval(t,e){return Z(this,zi).setInterval(t,e)}clearInterval(t){Z(this,zi).clearInterval(t)}},zi=new WeakMap,mm=new WeakMap,TE),Us=new mA;function yA(t){setTimeout(t,0)}var Xs=typeof window>"u"||"Deno"in globalThis;function Kr(){}function xA(t,e){return typeof t=="function"?t(e):t}function Cg(t){return typeof t=="number"&&t>=0&&t!==1/0}function ZE(t,e){return Math.max(t+(e||0)-Date.now(),0)}function Wi(t,e){return typeof t=="function"?t(e):t}function Ya(t,e){return typeof t=="function"?t(e):t}function v2(t,e){const{type:r="all",exact:a,fetchStatus:i,predicate:s,queryKey:o,stale:u}=t;if(o){if(a){if(e.queryHash!==Em(o,e.options))return!1}else if(!Xu(e.queryKey,o))return!1}if(r!=="all"){const d=e.isActive();if(r==="active"&&!d||r==="inactive"&&d)return!1}return!(typeof u=="boolean"&&e.isStale()!==u||i&&i!==e.state.fetchStatus||s&&!s(e))}function p2(t,e){const{exact:r,status:a,predicate:i,mutationKey:s}=t;if(s){if(!e.options.mutationKey)return!1;if(r){if(ts(e.options.mutationKey)!==ts(s))return!1}else if(!Xu(e.options.mutationKey,s))return!1}return!(a&&e.state.status!==a||i&&!i(e))}function Em(t,e){return((e==null?void 0:e.queryKeyHashFn)||ts)(t)}function ts(t){return JSON.stringify(t,(e,r)=>Ng(r)?Object.keys(r).sort().reduce((a,i)=>(a[i]=r[i],a),{}):r)}function Xu(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(r=>Xu(t[r],e[r])):!1}var bA=Object.prototype.hasOwnProperty;function Tm(t,e,r=0){if(t===e)return t;if(r>500)return e;const a=g2(t)&&g2(e);if(!a&&!(Ng(t)&&Ng(e)))return e;const s=(a?t:Object.keys(t)).length,o=a?e:Object.keys(e),u=o.length,d=a?new Array(u):{};let f=0;for(let h=0;h<u;h++){const p=a?h:o[h],m=t[p],y=e[p];if(m===y){d[p]=m,(a?h<s:bA.call(t,p))&&f++;continue}if(m===null||y===null||typeof m!="object"||typeof y!="object"){d[p]=y;continue}const x=Tm(m,y,r+1);d[p]=x,x===m&&f++}return s===u&&f===s?t:d}function Zu(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(const r in t)if(t[r]!==e[r])return!1;return!0}function g2(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function Ng(t){if(!m2(t))return!1;const e=t.constructor;if(e===void 0)return!0;const r=e.prototype;return!(!m2(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function m2(t){return Object.prototype.toString.call(t)==="[object Object]"}function wA(t){return new Promise(e=>{Us.setTimeout(e,t)})}function jg(t,e,r){return typeof r.structuralSharing=="function"?r.structuralSharing(t,e):r.structuralSharing!==!1?Tm(t,e):e}function SA(t,e,r=0){const a=[...t,e];return r&&a.length>r?a.slice(1):a}function EA(t,e,r=0){const a=[e,...t];return r&&a.length>r?a.slice(0,-1):a}var ka=Symbol();function WE(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===ka?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function Cm(t,e){return typeof t=="function"?t(...e):!!t}function TA(t,e,r){let a=!1,i;return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(i??(i=e()),a||(a=!0,i.aborted?r():i.addEventListener("abort",r,{once:!0})),i)}),t}var Is,_i,ho,CE,CA=(CE=class extends sl{constructor(){super();qe(this,Is);qe(this,_i);qe(this,ho);Me(this,ho,e=>{if(!Xs&&window.addEventListener){const r=()=>e();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){Z(this,_i)||this.setEventListener(Z(this,ho))}onUnsubscribe(){var e;this.hasListeners()||((e=Z(this,_i))==null||e.call(this),Me(this,_i,void 0))}setEventListener(e){var r;Me(this,ho,e),(r=Z(this,_i))==null||r.call(this),Me(this,_i,e(a=>{typeof a=="boolean"?this.setFocused(a):this.onFocus()}))}setFocused(e){Z(this,Is)!==e&&(Me(this,Is,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(r=>{r(e)})}isFocused(){var e;return typeof Z(this,Is)=="boolean"?Z(this,Is):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},Is=new WeakMap,_i=new WeakMap,ho=new WeakMap,CE),Nm=new CA;function Ag(){let t,e;const r=new Promise((i,s)=>{t=i,e=s});r.status="pending",r.catch(()=>{});function a(i){Object.assign(r,i),delete r.resolve,delete r.reject}return r.resolve=i=>{a({status:"fulfilled",value:i}),t(i)},r.reject=i=>{a({status:"rejected",reason:i}),e(i)},r}var NA=yA;function jA(){let t=[],e=0,r=u=>{u()},a=u=>{u()},i=NA;const s=u=>{e?t.push(u):i(()=>{r(u)})},o=()=>{const u=t;t=[],u.length&&i(()=>{a(()=>{u.forEach(d=>{r(d)})})})};return{batch:u=>{let d;e++;try{d=u()}finally{e--,e||o()}return d},batchCalls:u=>(...d)=>{s(()=>{u(...d)})},schedule:s,setNotifyFunction:u=>{r=u},setBatchNotifyFunction:u=>{a=u},setScheduler:u=>{i=u}}}var ar=jA(),vo,Ui,po,NE,AA=(NE=class extends sl{constructor(){super();qe(this,vo,!0);qe(this,Ui);qe(this,po);Me(this,po,e=>{if(!Xs&&window.addEventListener){const r=()=>e(!0),a=()=>e(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",a,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",a)}}})}onSubscribe(){Z(this,Ui)||this.setEventListener(Z(this,po))}onUnsubscribe(){var e;this.hasListeners()||((e=Z(this,Ui))==null||e.call(this),Me(this,Ui,void 0))}setEventListener(e){var r;Me(this,po,e),(r=Z(this,Ui))==null||r.call(this),Me(this,Ui,e(this.setOnline.bind(this)))}setOnline(e){Z(this,vo)!==e&&(Me(this,vo,e),this.listeners.forEach(a=>{a(e)}))}isOnline(){return Z(this,vo)}},vo=new WeakMap,Ui=new WeakMap,po=new WeakMap,NE),Of=new AA;function MA(t){return Math.min(1e3*2**t,3e4)}function JE(t){return(t??"online")==="online"?Of.isOnline():!0}var Mg=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function eT(t){let e=!1,r=0,a;const i=Ag(),s=()=>i.status!=="pending",o=E=>{var w;if(!s()){const T=new Mg(E);m(T),(w=t.onCancel)==null||w.call(t,T)}},u=()=>{e=!0},d=()=>{e=!1},f=()=>Nm.isFocused()&&(t.networkMode==="always"||Of.isOnline())&&t.canRun(),h=()=>JE(t.networkMode)&&t.canRun(),p=E=>{s()||(a==null||a(),i.resolve(E))},m=E=>{s()||(a==null||a(),i.reject(E))},y=()=>new Promise(E=>{var w;a=T=>{(s()||f())&&E(T)},(w=t.onPause)==null||w.call(t)}).then(()=>{var E;a=void 0,s()||(E=t.onContinue)==null||E.call(t)}),x=()=>{if(s())return;let E;const w=r===0?t.initialPromise:void 0;try{E=w??t.fn()}catch(T){E=Promise.reject(T)}Promise.resolve(E).then(p).catch(T=>{var M;if(s())return;const C=t.retry??(Xs?0:3),N=t.retryDelay??MA,A=typeof N=="function"?N(r,T):N,D=C===!0||typeof C=="number"&&r<C||typeof C=="function"&&C(r,T);if(e||!D){m(T);return}r++,(M=t.onFail)==null||M.call(t,r,T),wA(A).then(()=>f()?void 0:y()).then(()=>{e?m(T):x()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(a==null||a(),i),cancelRetry:u,continueRetry:d,canStart:h,start:()=>(h()?x():y().then(x),i)}}var Vs,jE,tT=(jE=class{constructor(){qe(this,Vs)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Cg(this.gcTime)&&Me(this,Vs,Us.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Xs?1/0:300*1e3))}clearGcTimeout(){Z(this,Vs)&&(Us.clearTimeout(Z(this,Vs)),Me(this,Vs,void 0))}},Vs=new WeakMap,jE),Fs,go,Qa,Hs,Dr,uc,Gs,en,Gn,AE,kA=(AE=class extends tT{constructor(e){super();qe(this,en);qe(this,Fs);qe(this,go);qe(this,Qa);qe(this,Hs);qe(this,Dr);qe(this,uc);qe(this,Gs);Me(this,Gs,!1),Me(this,uc,e.defaultOptions),this.setOptions(e.options),this.observers=[],Me(this,Hs,e.client),Me(this,Qa,Z(this,Hs).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,Me(this,Fs,x2(this.options)),this.state=e.state??Z(this,Fs),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=Z(this,Dr))==null?void 0:e.promise}setOptions(e){if(this.options={...Z(this,uc),...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=x2(this.options);r.data!==void 0&&(this.setState(y2(r.data,r.dataUpdatedAt)),Me(this,Fs,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&Z(this,Qa).remove(this)}setData(e,r){const a=jg(this.state.data,e,this.options);return at(this,en,Gn).call(this,{data:a,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),a}setState(e,r){at(this,en,Gn).call(this,{type:"setState",state:e,setStateOptions:r})}cancel(e){var a,i;const r=(a=Z(this,Dr))==null?void 0:a.promise;return(i=Z(this,Dr))==null||i.cancel(e),r?r.then(Kr).catch(Kr):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(Z(this,Fs))}isActive(){return this.observers.some(e=>Ya(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ka||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Wi(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!ZE(this.state.dataUpdatedAt,e)}onFocus(){var r;const e=this.observers.find(a=>a.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(r=Z(this,Dr))==null||r.continue()}onOnline(){var r;const e=this.observers.find(a=>a.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(r=Z(this,Dr))==null||r.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),Z(this,Qa).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(r=>r!==e),this.observers.length||(Z(this,Dr)&&(Z(this,Gs)?Z(this,Dr).cancel({revert:!0}):Z(this,Dr).cancelRetry()),this.scheduleGc()),Z(this,Qa).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||at(this,en,Gn).call(this,{type:"invalidate"})}async fetch(e,r){var d,f,h,p,m,y,x,E,w,T,C,N;if(this.state.fetchStatus!=="idle"&&((d=Z(this,Dr))==null?void 0:d.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(Z(this,Dr))return Z(this,Dr).continueRetry(),Z(this,Dr).promise}if(e&&this.setOptions(e),!this.options.queryFn){const A=this.observers.find(D=>D.options.queryFn);A&&this.setOptions(A.options)}const a=new AbortController,i=A=>{Object.defineProperty(A,"signal",{enumerable:!0,get:()=>(Me(this,Gs,!0),a.signal)})},s=()=>{const A=WE(this.options,r),M=(()=>{const j={client:Z(this,Hs),queryKey:this.queryKey,meta:this.meta};return i(j),j})();return Me(this,Gs,!1),this.options.persister?this.options.persister(A,M,this):A(M)},u=(()=>{const A={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:Z(this,Hs),state:this.state,fetchFn:s};return i(A),A})();(f=this.options.behavior)==null||f.onFetch(u,this),Me(this,go,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((h=u.fetchOptions)==null?void 0:h.meta))&&at(this,en,Gn).call(this,{type:"fetch",meta:(p=u.fetchOptions)==null?void 0:p.meta}),Me(this,Dr,eT({initialPromise:r==null?void 0:r.initialPromise,fn:u.fetchFn,onCancel:A=>{A instanceof Mg&&A.revert&&this.setState({...Z(this,go),fetchStatus:"idle"}),a.abort()},onFail:(A,D)=>{at(this,en,Gn).call(this,{type:"failed",failureCount:A,error:D})},onPause:()=>{at(this,en,Gn).call(this,{type:"pause"})},onContinue:()=>{at(this,en,Gn).call(this,{type:"continue"})},retry:u.options.retry,retryDelay:u.options.retryDelay,networkMode:u.options.networkMode,canRun:()=>!0}));try{const A=await Z(this,Dr).start();if(A===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(A),(y=(m=Z(this,Qa).config).onSuccess)==null||y.call(m,A,this),(E=(x=Z(this,Qa).config).onSettled)==null||E.call(x,A,this.state.error,this),A}catch(A){if(A instanceof Mg){if(A.silent)return Z(this,Dr).promise;if(A.revert){if(this.state.data===void 0)throw A;return this.state.data}}throw at(this,en,Gn).call(this,{type:"error",error:A}),(T=(w=Z(this,Qa).config).onError)==null||T.call(w,A,this),(N=(C=Z(this,Qa).config).onSettled)==null||N.call(C,this.state.data,A,this),A}finally{this.scheduleGc()}}},Fs=new WeakMap,go=new WeakMap,Qa=new WeakMap,Hs=new WeakMap,Dr=new WeakMap,uc=new WeakMap,Gs=new WeakMap,en=new WeakSet,Gn=function(e){const r=a=>{switch(e.type){case"failed":return{...a,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...a,fetchStatus:"paused"};case"continue":return{...a,fetchStatus:"fetching"};case"fetch":return{...a,...rT(a.data,this.options),fetchMeta:e.meta??null};case"success":const i={...a,...y2(e.data,e.dataUpdatedAt),dataUpdateCount:a.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Me(this,go,e.manual?i:void 0),i;case"error":const s=e.error;return{...a,error:s,errorUpdateCount:a.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:a.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...a,isInvalidated:!0};case"setState":return{...a,...e.state}}};this.state=r(this.state),ar.batch(()=>{this.observers.forEach(a=>{a.onQueryUpdate()}),Z(this,Qa).notify({query:this,type:"updated",action:e})})},AE);function rT(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:JE(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function y2(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function x2(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,r=e!==void 0,a=r?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:r?a??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var va,yt,cc,ea,Qs,mo,$n,qi,dc,yo,xo,$s,Ys,Ii,bo,Mt,Uu,kg,Dg,Og,Rg,Bg,Lg,Pg,aT,ME,xc=(ME=class extends sl{constructor(e,r){super();qe(this,Mt);qe(this,va);qe(this,yt);qe(this,cc);qe(this,ea);qe(this,Qs);qe(this,mo);qe(this,$n);qe(this,qi);qe(this,dc);qe(this,yo);qe(this,xo);qe(this,$s);qe(this,Ys);qe(this,Ii);qe(this,bo,new Set);this.options=r,Me(this,va,e),Me(this,qi,null),Me(this,$n,Ag()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(Z(this,yt).addObserver(this),b2(Z(this,yt),this.options)?at(this,Mt,Uu).call(this):this.updateResult(),at(this,Mt,Rg).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return zg(Z(this,yt),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return zg(Z(this,yt),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,at(this,Mt,Bg).call(this),at(this,Mt,Lg).call(this),Z(this,yt).removeObserver(this)}setOptions(e){const r=this.options,a=Z(this,yt);if(this.options=Z(this,va).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ya(this.options.enabled,Z(this,yt))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");at(this,Mt,Pg).call(this),Z(this,yt).setOptions(this.options),r._defaulted&&!Zu(this.options,r)&&Z(this,va).getQueryCache().notify({type:"observerOptionsUpdated",query:Z(this,yt),observer:this});const i=this.hasListeners();i&&w2(Z(this,yt),a,this.options,r)&&at(this,Mt,Uu).call(this),this.updateResult(),i&&(Z(this,yt)!==a||Ya(this.options.enabled,Z(this,yt))!==Ya(r.enabled,Z(this,yt))||Wi(this.options.staleTime,Z(this,yt))!==Wi(r.staleTime,Z(this,yt)))&&at(this,Mt,kg).call(this);const s=at(this,Mt,Dg).call(this);i&&(Z(this,yt)!==a||Ya(this.options.enabled,Z(this,yt))!==Ya(r.enabled,Z(this,yt))||s!==Z(this,Ii))&&at(this,Mt,Og).call(this,s)}getOptimisticResult(e){const r=Z(this,va).getQueryCache().build(Z(this,va),e),a=this.createResult(r,e);return OA(this,a)&&(Me(this,ea,a),Me(this,mo,this.options),Me(this,Qs,Z(this,yt).state)),a}getCurrentResult(){return Z(this,ea)}trackResult(e,r){return new Proxy(e,{get:(a,i)=>(this.trackProp(i),r==null||r(i),i==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&Z(this,$n).status==="pending"&&Z(this,$n).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(a,i))})}trackProp(e){Z(this,bo).add(e)}getCurrentQuery(){return Z(this,yt)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const r=Z(this,va).defaultQueryOptions(e),a=Z(this,va).getQueryCache().build(Z(this,va),r);return a.fetch().then(()=>this.createResult(a,r))}fetch(e){return at(this,Mt,Uu).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),Z(this,ea)))}createResult(e,r){var B;const a=Z(this,yt),i=this.options,s=Z(this,ea),o=Z(this,Qs),u=Z(this,mo),f=e!==a?e.state:Z(this,cc),{state:h}=e;let p={...h},m=!1,y;if(r._optimisticResults){const P=this.hasListeners(),U=!P&&b2(e,r),R=P&&w2(e,a,r,i);(U||R)&&(p={...p,...rT(h.data,e.options)}),r._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:x,errorUpdatedAt:E,status:w}=p;y=p.data;let T=!1;if(r.placeholderData!==void 0&&y===void 0&&w==="pending"){let P;s!=null&&s.isPlaceholderData&&r.placeholderData===(u==null?void 0:u.placeholderData)?(P=s.data,T=!0):P=typeof r.placeholderData=="function"?r.placeholderData((B=Z(this,xo))==null?void 0:B.state.data,Z(this,xo)):r.placeholderData,P!==void 0&&(w="success",y=jg(s==null?void 0:s.data,P,r),m=!0)}if(r.select&&y!==void 0&&!T)if(s&&y===(o==null?void 0:o.data)&&r.select===Z(this,dc))y=Z(this,yo);else try{Me(this,dc,r.select),y=r.select(y),y=jg(s==null?void 0:s.data,y,r),Me(this,yo,y),Me(this,qi,null)}catch(P){Me(this,qi,P)}Z(this,qi)&&(x=Z(this,qi),y=Z(this,yo),E=Date.now(),w="error");const C=p.fetchStatus==="fetching",N=w==="pending",A=w==="error",D=N&&C,M=y!==void 0,k={status:w,fetchStatus:p.fetchStatus,isPending:N,isSuccess:w==="success",isError:A,isInitialLoading:D,isLoading:D,data:y,dataUpdatedAt:p.dataUpdatedAt,error:x,errorUpdatedAt:E,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:p.dataUpdateCount>0||p.errorUpdateCount>0,isFetchedAfterMount:p.dataUpdateCount>f.dataUpdateCount||p.errorUpdateCount>f.errorUpdateCount,isFetching:C,isRefetching:C&&!N,isLoadingError:A&&!M,isPaused:p.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:A&&M,isStale:jm(e,r),refetch:this.refetch,promise:Z(this,$n),isEnabled:Ya(r.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const P=k.data!==void 0,U=k.status==="error"&&!P,R=H=>{U?H.reject(k.error):P&&H.resolve(k.data)},V=()=>{const H=Me(this,$n,k.promise=Ag());R(H)},_=Z(this,$n);switch(_.status){case"pending":e.queryHash===a.queryHash&&R(_);break;case"fulfilled":(U||k.data!==_.value)&&V();break;case"rejected":(!U||k.error!==_.reason)&&V();break}}return k}updateResult(){const e=Z(this,ea),r=this.createResult(Z(this,yt),this.options);if(Me(this,Qs,Z(this,yt).state),Me(this,mo,this.options),Z(this,Qs).data!==void 0&&Me(this,xo,Z(this,yt)),Zu(r,e))return;Me(this,ea,r);const a=()=>{if(!e)return!0;const{notifyOnChangeProps:i}=this.options,s=typeof i=="function"?i():i;if(s==="all"||!s&&!Z(this,bo).size)return!0;const o=new Set(s??Z(this,bo));return this.options.throwOnError&&o.add("error"),Object.keys(Z(this,ea)).some(u=>{const d=u;return Z(this,ea)[d]!==e[d]&&o.has(d)})};at(this,Mt,aT).call(this,{listeners:a()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&at(this,Mt,Rg).call(this)}},va=new WeakMap,yt=new WeakMap,cc=new WeakMap,ea=new WeakMap,Qs=new WeakMap,mo=new WeakMap,$n=new WeakMap,qi=new WeakMap,dc=new WeakMap,yo=new WeakMap,xo=new WeakMap,$s=new WeakMap,Ys=new WeakMap,Ii=new WeakMap,bo=new WeakMap,Mt=new WeakSet,Uu=function(e){at(this,Mt,Pg).call(this);let r=Z(this,yt).fetch(this.options,e);return e!=null&&e.throwOnError||(r=r.catch(Kr)),r},kg=function(){at(this,Mt,Bg).call(this);const e=Wi(this.options.staleTime,Z(this,yt));if(Xs||Z(this,ea).isStale||!Cg(e))return;const a=ZE(Z(this,ea).dataUpdatedAt,e)+1;Me(this,$s,Us.setTimeout(()=>{Z(this,ea).isStale||this.updateResult()},a))},Dg=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(Z(this,yt)):this.options.refetchInterval)??!1},Og=function(e){at(this,Mt,Lg).call(this),Me(this,Ii,e),!(Xs||Ya(this.options.enabled,Z(this,yt))===!1||!Cg(Z(this,Ii))||Z(this,Ii)===0)&&Me(this,Ys,Us.setInterval(()=>{(this.options.refetchIntervalInBackground||Nm.isFocused())&&at(this,Mt,Uu).call(this)},Z(this,Ii)))},Rg=function(){at(this,Mt,kg).call(this),at(this,Mt,Og).call(this,at(this,Mt,Dg).call(this))},Bg=function(){Z(this,$s)&&(Us.clearTimeout(Z(this,$s)),Me(this,$s,void 0))},Lg=function(){Z(this,Ys)&&(Us.clearInterval(Z(this,Ys)),Me(this,Ys,void 0))},Pg=function(){const e=Z(this,va).getQueryCache().build(Z(this,va),this.options);if(e===Z(this,yt))return;const r=Z(this,yt);Me(this,yt,e),Me(this,cc,e.state),this.hasListeners()&&(r==null||r.removeObserver(this),e.addObserver(this))},aT=function(e){ar.batch(()=>{e.listeners&&this.listeners.forEach(r=>{r(Z(this,ea))}),Z(this,va).getQueryCache().notify({query:Z(this,yt),type:"observerResultsUpdated"})})},ME);function DA(t,e){return Ya(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function b2(t,e){return DA(t,e)||t.state.data!==void 0&&zg(t,e,e.refetchOnMount)}function zg(t,e,r){if(Ya(e.enabled,t)!==!1&&Wi(e.staleTime,t)!=="static"){const a=typeof r=="function"?r(t):r;return a==="always"||a!==!1&&jm(t,e)}return!1}function w2(t,e,r,a){return(t!==e||Ya(a.enabled,t)===!1)&&(!r.suspense||t.state.status!=="error")&&jm(t,r)}function jm(t,e){return Ya(e.enabled,t)!==!1&&t.isStaleByTime(Wi(e.staleTime,t))}function OA(t,e){return!Zu(t.getCurrentResult(),e)}function Rf(t){return{onFetch:(e,r)=>{var h,p,m,y,x;const a=e.options,i=(m=(p=(h=e.fetchOptions)==null?void 0:h.meta)==null?void 0:p.fetchMore)==null?void 0:m.direction,s=((y=e.state.data)==null?void 0:y.pages)||[],o=((x=e.state.data)==null?void 0:x.pageParams)||[];let u={pages:[],pageParams:[]},d=0;const f=async()=>{let E=!1;const w=N=>{TA(N,()=>e.signal,()=>E=!0)},T=WE(e.options,e.fetchOptions),C=async(N,A,D)=>{if(E)return Promise.reject();if(A==null&&N.pages.length)return Promise.resolve(N);const j=(()=>{const U={client:e.client,queryKey:e.queryKey,pageParam:A,direction:D?"backward":"forward",meta:e.options.meta};return w(U),U})(),k=await T(j),{maxPages:B}=e.options,P=D?EA:SA;return{pages:P(N.pages,k,B),pageParams:P(N.pageParams,A,B)}};if(i&&s.length){const N=i==="backward",A=N?nT:_g,D={pages:s,pageParams:o},M=A(a,D);u=await C(D,M,N)}else{const N=t??s.length;do{const A=d===0?o[0]??a.initialPageParam:_g(a,u);if(d>0&&A==null)break;u=await C(u,A),d++}while(d<N)}return u};e.options.persister?e.fetchFn=()=>{var E,w;return(w=(E=e.options).persister)==null?void 0:w.call(E,f,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},r)}:e.fetchFn=f}}}function _g(t,{pages:e,pageParams:r}){const a=e.length-1;return e.length>0?t.getNextPageParam(e[a],e,r[a],r):void 0}function nT(t,{pages:e,pageParams:r}){var a;return e.length>0?(a=t.getPreviousPageParam)==null?void 0:a.call(t,e[0],e,r[0],r):void 0}function RA(t,e){return e?_g(t,e)!=null:!1}function BA(t,e){return!e||!t.getPreviousPageParam?!1:nT(t,e)!=null}var iT=class extends xc{constructor(t,e){super(t,e)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(t){super.setOptions({...t,behavior:Rf()})}getOptimisticResult(t){return t.behavior=Rf(),super.getOptimisticResult(t)}fetchNextPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"backward"}}})}createResult(t,e){var x,E;const{state:r}=t,a=super.createResult(t,e),{isFetching:i,isRefetching:s,isError:o,isRefetchError:u}=a,d=(E=(x=r.fetchMeta)==null?void 0:x.fetchMore)==null?void 0:E.direction,f=o&&d==="forward",h=i&&d==="forward",p=o&&d==="backward",m=i&&d==="backward";return{...a,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:RA(e,r.data),hasPreviousPage:BA(e,r.data),isFetchNextPageError:f,isFetchingNextPage:h,isFetchPreviousPageError:p,isFetchingPreviousPage:m,isRefetchError:u&&!f&&!p,isRefetching:s&&!h&&!m}}},fc,xn,Yr,Ks,bn,Bi,kE,LA=(kE=class extends tT{constructor(e){super();qe(this,bn);qe(this,fc);qe(this,xn);qe(this,Yr);qe(this,Ks);Me(this,fc,e.client),this.mutationId=e.mutationId,Me(this,Yr,e.mutationCache),Me(this,xn,[]),this.state=e.state||sT(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){Z(this,xn).includes(e)||(Z(this,xn).push(e),this.clearGcTimeout(),Z(this,Yr).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){Me(this,xn,Z(this,xn).filter(r=>r!==e)),this.scheduleGc(),Z(this,Yr).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){Z(this,xn).length||(this.state.status==="pending"?this.scheduleGc():Z(this,Yr).remove(this))}continue(){var e;return((e=Z(this,Ks))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var o,u,d,f,h,p,m,y,x,E,w,T,C,N,A,D,M,j;const r=()=>{at(this,bn,Bi).call(this,{type:"continue"})},a={client:Z(this,fc),meta:this.options.meta,mutationKey:this.options.mutationKey};Me(this,Ks,eT({fn:()=>this.options.mutationFn?this.options.mutationFn(e,a):Promise.reject(new Error("No mutationFn found")),onFail:(k,B)=>{at(this,bn,Bi).call(this,{type:"failed",failureCount:k,error:B})},onPause:()=>{at(this,bn,Bi).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>Z(this,Yr).canRun(this)}));const i=this.state.status==="pending",s=!Z(this,Ks).canStart();try{if(i)r();else{at(this,bn,Bi).call(this,{type:"pending",variables:e,isPaused:s}),Z(this,Yr).config.onMutate&&await Z(this,Yr).config.onMutate(e,this,a);const B=await((u=(o=this.options).onMutate)==null?void 0:u.call(o,e,a));B!==this.state.context&&at(this,bn,Bi).call(this,{type:"pending",context:B,variables:e,isPaused:s})}const k=await Z(this,Ks).start();return await((f=(d=Z(this,Yr).config).onSuccess)==null?void 0:f.call(d,k,e,this.state.context,this,a)),await((p=(h=this.options).onSuccess)==null?void 0:p.call(h,k,e,this.state.context,a)),await((y=(m=Z(this,Yr).config).onSettled)==null?void 0:y.call(m,k,null,this.state.variables,this.state.context,this,a)),await((E=(x=this.options).onSettled)==null?void 0:E.call(x,k,null,e,this.state.context,a)),at(this,bn,Bi).call(this,{type:"success",data:k}),k}catch(k){try{await((T=(w=Z(this,Yr).config).onError)==null?void 0:T.call(w,k,e,this.state.context,this,a))}catch(B){Promise.reject(B)}try{await((N=(C=this.options).onError)==null?void 0:N.call(C,k,e,this.state.context,a))}catch(B){Promise.reject(B)}try{await((D=(A=Z(this,Yr).config).onSettled)==null?void 0:D.call(A,void 0,k,this.state.variables,this.state.context,this,a))}catch(B){Promise.reject(B)}try{await((j=(M=this.options).onSettled)==null?void 0:j.call(M,void 0,k,e,this.state.context,a))}catch(B){Promise.reject(B)}throw at(this,bn,Bi).call(this,{type:"error",error:k}),k}finally{Z(this,Yr).runNext(this)}}},fc=new WeakMap,xn=new WeakMap,Yr=new WeakMap,Ks=new WeakMap,bn=new WeakSet,Bi=function(e){const r=a=>{switch(e.type){case"failed":return{...a,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...a,isPaused:!0};case"continue":return{...a,isPaused:!1};case"pending":return{...a,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...a,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...a,data:void 0,error:e.error,failureCount:a.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=r(this.state),ar.batch(()=>{Z(this,xn).forEach(a=>{a.onMutationUpdate(e)}),Z(this,Yr).notify({mutation:this,type:"updated",action:e})})},kE);function sT(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Yn,tn,hc,DE,PA=(DE=class extends sl{constructor(e={}){super();qe(this,Yn);qe(this,tn);qe(this,hc);this.config=e,Me(this,Yn,new Set),Me(this,tn,new Map),Me(this,hc,0)}build(e,r,a){const i=new LA({client:e,mutationCache:this,mutationId:++Kd(this,hc)._,options:e.defaultMutationOptions(r),state:a});return this.add(i),i}add(e){Z(this,Yn).add(e);const r=Xd(e);if(typeof r=="string"){const a=Z(this,tn).get(r);a?a.push(e):Z(this,tn).set(r,[e])}this.notify({type:"added",mutation:e})}remove(e){if(Z(this,Yn).delete(e)){const r=Xd(e);if(typeof r=="string"){const a=Z(this,tn).get(r);if(a)if(a.length>1){const i=a.indexOf(e);i!==-1&&a.splice(i,1)}else a[0]===e&&Z(this,tn).delete(r)}}this.notify({type:"removed",mutation:e})}canRun(e){const r=Xd(e);if(typeof r=="string"){const a=Z(this,tn).get(r),i=a==null?void 0:a.find(s=>s.state.status==="pending");return!i||i===e}else return!0}runNext(e){var a;const r=Xd(e);if(typeof r=="string"){const i=(a=Z(this,tn).get(r))==null?void 0:a.find(s=>s!==e&&s.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){ar.batch(()=>{Z(this,Yn).forEach(e=>{this.notify({type:"removed",mutation:e})}),Z(this,Yn).clear(),Z(this,tn).clear()})}getAll(){return Array.from(Z(this,Yn))}find(e){const r={exact:!0,...e};return this.getAll().find(a=>p2(r,a))}findAll(e={}){return this.getAll().filter(r=>p2(e,r))}notify(e){ar.batch(()=>{this.listeners.forEach(r=>{r(e)})})}resumePausedMutations(){const e=this.getAll().filter(r=>r.state.isPaused);return ar.batch(()=>Promise.all(e.map(r=>r.continue().catch(Kr))))}},Yn=new WeakMap,tn=new WeakMap,hc=new WeakMap,DE);function Xd(t){var e;return(e=t.options.scope)==null?void 0:e.id}var Kn,Vi,pa,Xn,Wn,gf,Ug,OE,zA=(OE=class extends sl{constructor(r,a){super();qe(this,Wn);qe(this,Kn);qe(this,Vi);qe(this,pa);qe(this,Xn);Me(this,Kn,r),this.setOptions(a),this.bindMethods(),at(this,Wn,gf).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(r){var i;const a=this.options;this.options=Z(this,Kn).defaultMutationOptions(r),Zu(this.options,a)||Z(this,Kn).getMutationCache().notify({type:"observerOptionsUpdated",mutation:Z(this,pa),observer:this}),a!=null&&a.mutationKey&&this.options.mutationKey&&ts(a.mutationKey)!==ts(this.options.mutationKey)?this.reset():((i=Z(this,pa))==null?void 0:i.state.status)==="pending"&&Z(this,pa).setOptions(this.options)}onUnsubscribe(){var r;this.hasListeners()||(r=Z(this,pa))==null||r.removeObserver(this)}onMutationUpdate(r){at(this,Wn,gf).call(this),at(this,Wn,Ug).call(this,r)}getCurrentResult(){return Z(this,Vi)}reset(){var r;(r=Z(this,pa))==null||r.removeObserver(this),Me(this,pa,void 0),at(this,Wn,gf).call(this),at(this,Wn,Ug).call(this)}mutate(r,a){var i;return Me(this,Xn,a),(i=Z(this,pa))==null||i.removeObserver(this),Me(this,pa,Z(this,Kn).getMutationCache().build(Z(this,Kn),this.options)),Z(this,pa).addObserver(this),Z(this,pa).execute(r)}},Kn=new WeakMap,Vi=new WeakMap,pa=new WeakMap,Xn=new WeakMap,Wn=new WeakSet,gf=function(){var a;const r=((a=Z(this,pa))==null?void 0:a.state)??sT();Me(this,Vi,{...r,isPending:r.status==="pending",isSuccess:r.status==="success",isError:r.status==="error",isIdle:r.status==="idle",mutate:this.mutate,reset:this.reset})},Ug=function(r){ar.batch(()=>{var a,i,s,o,u,d,f,h;if(Z(this,Xn)&&this.hasListeners()){const p=Z(this,Vi).variables,m=Z(this,Vi).context,y={client:Z(this,Kn),meta:this.options.meta,mutationKey:this.options.mutationKey};if((r==null?void 0:r.type)==="success"){try{(i=(a=Z(this,Xn)).onSuccess)==null||i.call(a,r.data,p,m,y)}catch(x){Promise.reject(x)}try{(o=(s=Z(this,Xn)).onSettled)==null||o.call(s,r.data,null,p,m,y)}catch(x){Promise.reject(x)}}else if((r==null?void 0:r.type)==="error"){try{(d=(u=Z(this,Xn)).onError)==null||d.call(u,r.error,p,m,y)}catch(x){Promise.reject(x)}try{(h=(f=Z(this,Xn)).onSettled)==null||h.call(f,void 0,r.error,p,m,y)}catch(x){Promise.reject(x)}}}this.listeners.forEach(p=>{p(Z(this,Vi))})})},OE);function S2(t,e){const r=new Set(e);return t.filter(a=>!r.has(a))}function _A(t,e,r){const a=t.slice(0);return a[e]=r,a}var wo,Ma,So,Eo,$a,Fi,vc,pc,gc,mc,Vr,qg,Ig,Vg,Fg,Hg,RE,UA=(RE=class extends sl{constructor(e,r,a){super();qe(this,Vr);qe(this,wo);qe(this,Ma);qe(this,So);qe(this,Eo);qe(this,$a);qe(this,Fi);qe(this,vc);qe(this,pc);qe(this,gc);qe(this,mc,[]);Me(this,wo,e),Me(this,Eo,a),Me(this,So,[]),Me(this,$a,[]),Me(this,Ma,[]),this.setQueries(r)}onSubscribe(){this.listeners.size===1&&Z(this,$a).forEach(e=>{e.subscribe(r=>{at(this,Vr,Fg).call(this,e,r)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,Z(this,$a).forEach(e=>{e.destroy()})}setQueries(e,r){Me(this,So,e),Me(this,Eo,r),ar.batch(()=>{const a=Z(this,$a),i=at(this,Vr,Vg).call(this,Z(this,So));i.forEach(p=>p.observer.setOptions(p.defaultedQueryOptions));const s=i.map(p=>p.observer),o=s.map(p=>p.getCurrentResult()),u=a.length!==s.length,d=s.some((p,m)=>p!==a[m]),f=u||d,h=f?!0:o.some((p,m)=>{const y=Z(this,Ma)[m];return!y||!Zu(p,y)});!f&&!h||(f&&(Me(this,mc,i),Me(this,$a,s)),Me(this,Ma,o),this.hasListeners()&&(f&&(S2(a,s).forEach(p=>{p.destroy()}),S2(s,a).forEach(p=>{p.subscribe(m=>{at(this,Vr,Fg).call(this,p,m)})})),at(this,Vr,Hg).call(this)))})}getCurrentResult(){return Z(this,Ma)}getQueries(){return Z(this,$a).map(e=>e.getCurrentQuery())}getObservers(){return Z(this,$a)}getOptimisticResult(e,r){const a=at(this,Vr,Vg).call(this,e),i=a.map(o=>o.observer.getOptimisticResult(o.defaultedQueryOptions)),s=a.map(o=>o.defaultedQueryOptions.queryHash);return[i,o=>at(this,Vr,Ig).call(this,o??i,r,s),()=>at(this,Vr,qg).call(this,i,a)]}},wo=new WeakMap,Ma=new WeakMap,So=new WeakMap,Eo=new WeakMap,$a=new WeakMap,Fi=new WeakMap,vc=new WeakMap,pc=new WeakMap,gc=new WeakMap,mc=new WeakMap,Vr=new WeakSet,qg=function(e,r){return r.map((a,i)=>{const s=e[i];return a.defaultedQueryOptions.notifyOnChangeProps?s:a.observer.trackResult(s,o=>{r.forEach(u=>{u.observer.trackProp(o)})})})},Ig=function(e,r,a){if(r){const i=Z(this,gc),s=a!==void 0&&i!==void 0&&(i.length!==a.length||a.some((o,u)=>o!==i[u]));return(!Z(this,Fi)||Z(this,Ma)!==Z(this,pc)||s||r!==Z(this,vc))&&(Me(this,vc,r),Me(this,pc,Z(this,Ma)),a!==void 0&&Me(this,gc,a),Me(this,Fi,Tm(Z(this,Fi),r(e)))),Z(this,Fi)}return e},Vg=function(e){const r=new Map;Z(this,$a).forEach(i=>{const s=i.options.queryHash;if(!s)return;const o=r.get(s);o?o.push(i):r.set(s,[i])});const a=[];return e.forEach(i=>{var d;const s=Z(this,wo).defaultQueryOptions(i),u=((d=r.get(s.queryHash))==null?void 0:d.shift())??new xc(Z(this,wo),s);a.push({defaultedQueryOptions:s,observer:u})}),a},Fg=function(e,r){const a=Z(this,$a).indexOf(e);a!==-1&&(Me(this,Ma,_A(Z(this,Ma),a,r)),at(this,Vr,Hg).call(this))},Hg=function(){var e;if(this.hasListeners()){const r=Z(this,Fi),a=at(this,Vr,qg).call(this,Z(this,Ma),Z(this,mc)),i=at(this,Vr,Ig).call(this,a,(e=Z(this,Eo))==null?void 0:e.combine);r!==i&&ar.batch(()=>{this.listeners.forEach(s=>{s(Z(this,Ma))})})}},RE),wn,BE,qA=(BE=class extends sl{constructor(e={}){super();qe(this,wn);this.config=e,Me(this,wn,new Map)}build(e,r,a){const i=r.queryKey,s=r.queryHash??Em(i,r);let o=this.get(s);return o||(o=new kA({client:e,queryKey:i,queryHash:s,options:e.defaultQueryOptions(r),state:a,defaultOptions:e.getQueryDefaults(i)}),this.add(o)),o}add(e){Z(this,wn).has(e.queryHash)||(Z(this,wn).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const r=Z(this,wn).get(e.queryHash);r&&(e.destroy(),r===e&&Z(this,wn).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){ar.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return Z(this,wn).get(e)}getAll(){return[...Z(this,wn).values()]}find(e){const r={exact:!0,...e};return this.getAll().find(a=>v2(r,a))}findAll(e={}){const r=this.getAll();return Object.keys(e).length>0?r.filter(a=>v2(e,a)):r}notify(e){ar.batch(()=>{this.listeners.forEach(r=>{r(e)})})}onFocus(){ar.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){ar.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},wn=new WeakMap,BE),rr,Hi,Gi,To,Co,Qi,No,jo,LE,IA=(LE=class{constructor(t={}){qe(this,rr);qe(this,Hi);qe(this,Gi);qe(this,To);qe(this,Co);qe(this,Qi);qe(this,No);qe(this,jo);Me(this,rr,t.queryCache||new qA),Me(this,Hi,t.mutationCache||new PA),Me(this,Gi,t.defaultOptions||{}),Me(this,To,new Map),Me(this,Co,new Map),Me(this,Qi,0)}mount(){Kd(this,Qi)._++,Z(this,Qi)===1&&(Me(this,No,Nm.subscribe(async t=>{t&&(await this.resumePausedMutations(),Z(this,rr).onFocus())})),Me(this,jo,Of.subscribe(async t=>{t&&(await this.resumePausedMutations(),Z(this,rr).onOnline())})))}unmount(){var t,e;Kd(this,Qi)._--,Z(this,Qi)===0&&((t=Z(this,No))==null||t.call(this),Me(this,No,void 0),(e=Z(this,jo))==null||e.call(this),Me(this,jo,void 0))}isFetching(t){return Z(this,rr).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return Z(this,Hi).findAll({...t,status:"pending"}).length}getQueryData(t){var r;const e=this.defaultQueryOptions({queryKey:t});return(r=Z(this,rr).get(e.queryHash))==null?void 0:r.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),r=Z(this,rr).build(this,e),a=r.state.data;return a===void 0?this.fetchQuery(t):(t.revalidateIfStale&&r.isStaleByTime(Wi(e.staleTime,r))&&this.prefetchQuery(e),Promise.resolve(a))}getQueriesData(t){return Z(this,rr).findAll(t).map(({queryKey:e,state:r})=>{const a=r.data;return[e,a]})}setQueryData(t,e,r){const a=this.defaultQueryOptions({queryKey:t}),i=Z(this,rr).get(a.queryHash),s=i==null?void 0:i.state.data,o=xA(e,s);if(o!==void 0)return Z(this,rr).build(this,a).setData(o,{...r,manual:!0})}setQueriesData(t,e,r){return ar.batch(()=>Z(this,rr).findAll(t).map(({queryKey:a})=>[a,this.setQueryData(a,e,r)]))}getQueryState(t){var r;const e=this.defaultQueryOptions({queryKey:t});return(r=Z(this,rr).get(e.queryHash))==null?void 0:r.state}removeQueries(t){const e=Z(this,rr);ar.batch(()=>{e.findAll(t).forEach(r=>{e.remove(r)})})}resetQueries(t,e){const r=Z(this,rr);return ar.batch(()=>(r.findAll(t).forEach(a=>{a.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const r={revert:!0,...e},a=ar.batch(()=>Z(this,rr).findAll(t).map(i=>i.cancel(r)));return Promise.all(a).then(Kr).catch(Kr)}invalidateQueries(t,e={}){return ar.batch(()=>(Z(this,rr).findAll(t).forEach(r=>{r.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const r={...e,cancelRefetch:e.cancelRefetch??!0},a=ar.batch(()=>Z(this,rr).findAll(t).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let s=i.fetch(void 0,r);return r.throwOnError||(s=s.catch(Kr)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(a).then(Kr)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const r=Z(this,rr).build(this,e);return r.isStaleByTime(Wi(e.staleTime,r))?r.fetch(e):Promise.resolve(r.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Kr).catch(Kr)}fetchInfiniteQuery(t){return t.behavior=Rf(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Kr).catch(Kr)}ensureInfiniteQueryData(t){return t.behavior=Rf(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return Of.isOnline()?Z(this,Hi).resumePausedMutations():Promise.resolve()}getQueryCache(){return Z(this,rr)}getMutationCache(){return Z(this,Hi)}getDefaultOptions(){return Z(this,Gi)}setDefaultOptions(t){Me(this,Gi,t)}setQueryDefaults(t,e){Z(this,To).set(ts(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...Z(this,To).values()],r={};return e.forEach(a=>{Xu(t,a.queryKey)&&Object.assign(r,a.defaultOptions)}),r}setMutationDefaults(t,e){Z(this,Co).set(ts(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...Z(this,Co).values()],r={};return e.forEach(a=>{Xu(t,a.mutationKey)&&Object.assign(r,a.defaultOptions)}),r}defaultQueryOptions(t){if(t._defaulted)return t;const e={...Z(this,Gi).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=Em(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===ka&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...Z(this,Gi).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){Z(this,rr).clear(),Z(this,Hi).clear()}},rr=new WeakMap,Hi=new WeakMap,Gi=new WeakMap,To=new WeakMap,Co=new WeakMap,Qi=new WeakMap,No=new WeakMap,jo=new WeakMap,LE),lT=q.createContext(void 0),bc=t=>{const e=q.useContext(lT);if(t)return t;if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},VA=({client:t,children:e})=>(q.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),g.jsx(lT.Provider,{value:t,children:e})),oT=q.createContext(!1),uT=()=>q.useContext(oT);oT.Provider;function FA(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var HA=q.createContext(FA()),cT=()=>q.useContext(HA),dT=(t,e,r)=>{const a=r!=null&&r.state.error&&typeof t.throwOnError=="function"?Cm(t.throwOnError,[r.state.error,r]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||a)&&(e.isReset()||(t.retryOnMount=!1))},fT=t=>{q.useEffect(()=>{t.clearReset()},[t])},hT=({result:t,errorResetBoundary:e,throwOnError:r,query:a,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&a&&(i&&t.data===void 0||Cm(r,[t.error,a])),Am=(t,e)=>e.state.data===void 0,vT=t=>{if(t.suspense){const r=i=>i==="static"?i:Math.max(i??1e3,1e3),a=t.staleTime;t.staleTime=typeof a=="function"?(...i)=>r(a(...i)):r(a),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},GA=(t,e)=>t.isLoading&&t.isFetching&&!e,Gg=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,Qg=(t,e,r)=>e.fetchOptimistic(t).catch(()=>{r.clearReset()});function pT({queries:t,...e},r){const a=bc(r),i=uT(),s=cT(),o=q.useMemo(()=>t.map(E=>{const w=a.defaultQueryOptions(E);return w._optimisticResults=i?"isRestoring":"optimistic",w}),[t,a,i]);o.forEach(E=>{vT(E);const w=a.getQueryCache().get(E.queryHash);dT(E,s,w)}),fT(s);const[u]=q.useState(()=>new UA(a,o,e)),[d,f,h]=u.getOptimisticResult(o,e.combine),p=!i&&e.subscribed!==!1;q.useSyncExternalStore(q.useCallback(E=>p?u.subscribe(ar.batchCalls(E)):Kr,[u,p]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),q.useEffect(()=>{u.setQueries(o,e)},[o,e,u]);const y=d.some((E,w)=>Gg(o[w],E))?d.flatMap((E,w)=>{const T=o[w];if(T&&Gg(T,E)){const C=new xc(a,T);return Qg(T,C,s)}return[]}):[];if(y.length>0)throw Promise.all(y);const x=d.find((E,w)=>{const T=o[w];return T&&hT({result:E,errorResetBoundary:s,throwOnError:T.throwOnError,query:a.getQueryCache().get(T.queryHash),suspense:T.suspense})});if(x!=null&&x.error)throw x.error;return f(h())}function Zf(t,e,r){var m,y,x,E;const a=uT(),i=cT(),s=bc(r),o=s.defaultQueryOptions(t);(y=(m=s.getDefaultOptions().queries)==null?void 0:m._experimental_beforeQuery)==null||y.call(m,o);const u=s.getQueryCache().get(o.queryHash);o._optimisticResults=a?"isRestoring":"optimistic",vT(o),dT(o,i,u),fT(i);const d=!s.getQueryCache().get(o.queryHash),[f]=q.useState(()=>new e(s,o)),h=f.getOptimisticResult(o),p=!a&&t.subscribed!==!1;if(q.useSyncExternalStore(q.useCallback(w=>{const T=p?f.subscribe(ar.batchCalls(w)):Kr;return f.updateResult(),T},[f,p]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),q.useEffect(()=>{f.setOptions(o)},[o,f]),Gg(o,h))throw Qg(o,f,i);if(hT({result:h,errorResetBoundary:i,throwOnError:o.throwOnError,query:u,suspense:o.suspense}))throw h.error;if((E=(x=s.getDefaultOptions().queries)==null?void 0:x._experimental_afterQuery)==null||E.call(x,o,h),o.experimental_prefetchInRender&&!Xs&&GA(h,a)){const w=d?Qg(o,f,i):u==null?void 0:u.promise;w==null||w.catch(Kr).finally(()=>{f.updateResult()})}return o.notifyOnChangeProps?h:f.trackResult(h)}function QA(t,e){return Zf(t,xc,e)}function $A(t,e){return Zf({...t,enabled:!0,suspense:!0,throwOnError:Am,placeholderData:void 0},xc,e)}function YA(t,e){return Zf({...t,enabled:!0,suspense:!0,throwOnError:Am},iT,e)}function KA(t,e){return pT({...t,queries:t.queries.map(r=>({...r,suspense:!0,throwOnError:Am,enabled:!0,placeholderData:void 0}))},e)}function XA(t,e){const r=bc(e);r.getQueryState(t.queryKey)||r.prefetchQuery(t)}function ZA(t,e){const r=bc(e);r.getQueryState(t.queryKey)||r.prefetchInfiniteQuery(t)}function WA(t,e){const r=bc(e),[a]=q.useState(()=>new zA(r,t));q.useEffect(()=>{a.setOptions(t)},[a,t]);const i=q.useSyncExternalStore(q.useCallback(o=>a.subscribe(ar.batchCalls(o)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),s=q.useCallback((o,u)=>{a.mutate(o,u).catch(Kr)},[a]);if(i.error&&Cm(a.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:s,mutateAsync:i.mutate}}function JA(t,e){return Zf(t,iT,e)}var eM=Object.create,gT=Object.defineProperty,tM=Object.getOwnPropertyDescriptor,mT=Object.getOwnPropertyNames,rM=Object.getPrototypeOf,aM=Object.prototype.hasOwnProperty,Tn=(t,e)=>function(){return e||(0,t[mT(t)[0]])((e={exports:{}}).exports,e),e.exports},nM=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(var i=mT(e),s=0,o=i.length,u;s<o;s++)u=i[s],!aM.call(t,u)&&u!==r&&gT(t,u,{get:(d=>e[d]).bind(null,u),enumerable:!(a=tM(e,u))||a.enumerable});return t},cr=(t,e,r)=>(r=t!=null?eM(rM(t)):{},nM(e||!t||!t.__esModule?gT(r,"default",{value:t,enumerable:!0}):r,t)),yT=Tn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(t,e){function r(a){"@babel/helpers - typeof";return e.exports=r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(i){return typeof i}:function(i){return i&&typeof Symbol=="function"&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},e.exports.__esModule=!0,e.exports.default=e.exports,r(a)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),iM=Tn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(t,e){var r=yT().default;function a(i,s){if(r(i)!="object"||!i)return i;var o=i[Symbol.toPrimitive];if(o!==void 0){var u=o.call(i,s||"default");if(r(u)!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(i)}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports}}),sM=Tn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(t,e){var r=yT().default,a=iM();function i(s){var o=a(s,"string");return r(o)=="symbol"?o:o+""}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports}}),ll=Tn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(t,e){var r=sM();function a(i,s,o){return(s=r(s))in i?Object.defineProperty(i,s,{value:o,enumerable:!0,configurable:!0,writable:!0}):i[s]=o,i}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports}}),un=Tn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(t,e){var r=ll();function a(s,o){var u=Object.keys(s);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(s);o&&(d=d.filter(function(f){return Object.getOwnPropertyDescriptor(s,f).enumerable})),u.push.apply(u,d)}return u}function i(s){for(var o=1;o<arguments.length;o++){var u=arguments[o]!=null?arguments[o]:{};o%2?a(Object(u),!0).forEach(function(d){r(s,d,u[d])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(u)):a(Object(u)).forEach(function(d){Object.defineProperty(s,d,Object.getOwnPropertyDescriptor(u,d))})}return s}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports}});function Wf(t){const e={subscribe(r){let a=null,i=!1,s=!1,o=!1;function u(){if(a===null){o=!0;return}s||(s=!0,typeof a=="function"?a():a&&a.unsubscribe())}return a=t({next(d){var f;i||(f=r.next)===null||f===void 0||f.call(r,d)},error(d){var f;i||(i=!0,(f=r.error)===null||f===void 0||f.call(r,d),u())},complete(){var d;i||(i=!0,(d=r.complete)===null||d===void 0||d.call(r),u())}}),o&&u(),{unsubscribe:u}},pipe(...r){return r.reduce(lM,e)}};return e}function lM(t,e){return e(t)}function oM(t){const e=new AbortController;return new Promise((a,i)=>{let s=!1;function o(){s||(s=!0,u.unsubscribe())}e.signal.addEventListener("abort",()=>{i(e.signal.reason)});const u=t.subscribe({next(d){s=!0,a(d),o()},error(d){i(d)},complete(){e.abort(),o()}})})}function uM(t){return e=>{let r=0,a=null;const i=[];function s(){a||(a=e.subscribe({next(u){for(const f of i){var d;(d=f.next)===null||d===void 0||d.call(f,u)}},error(u){for(const f of i){var d;(d=f.error)===null||d===void 0||d.call(f,u)}},complete(){for(const d of i){var u;(u=d.complete)===null||u===void 0||u.call(d)}}}))}function o(){if(r===0&&a){const u=a;a=null,u.unsubscribe()}}return Wf(u=>(r++,i.push(u),s(),{unsubscribe(){r--,o();const d=i.findIndex(f=>f===u);d>-1&&i.splice(d,1)}}))}}function cM(t){let e=t;const r=[],a=o=>{e!==void 0&&o.next(e),r.push(o)},i=o=>{r.splice(r.indexOf(o),1)},s=Wf(o=>(a(o),()=>{i(o)}));return s.next=o=>{if(e!==o){e=o;for(const u of r)u.next(o)}},s.get=()=>e,s}function dM(t){return Wf(e=>{function r(i=0,s=t.op){const o=t.links[i];if(!o)throw new Error("No more links to execute - did you forget to add an ending link?");return o({op:s,next(d){return r(i+1,d)}})}return r().subscribe(e)})}function Zs(t){return!!t&&!Array.isArray(t)&&typeof t=="object"}function fM(){return Object.create(null)}const hM=typeof Symbol=="function"&&!!Symbol.asyncIterator;function xT(t){return hM&&Zs(t)&&Symbol.asyncIterator in t}var vM=Object.create,bT=Object.defineProperty,pM=Object.getOwnPropertyDescriptor,wT=Object.getOwnPropertyNames,gM=Object.getPrototypeOf,mM=Object.prototype.hasOwnProperty,wc=(t,e)=>function(){return e||(0,t[wT(t)[0]])((e={exports:{}}).exports,e),e.exports},yM=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(var i=wT(e),s=0,o=i.length,u;s<o;s++)u=i[s],!mM.call(t,u)&&u!==r&&bT(t,u,{get:(d=>e[d]).bind(null,u),enumerable:!(a=pM(e,u))||a.enumerable});return t},Jf=(t,e,r)=>(r=t!=null?vM(gM(t)):{},yM(bT(r,"default",{value:t,enumerable:!0}),t));const ST=()=>{},E2=t=>{Object.freeze&&Object.freeze(t)};function ET(t,e,r){var a;const i=e.join(".");return(a=r[i])!==null&&a!==void 0||(r[i]=new Proxy(ST,{get(s,o){if(!(typeof o!="string"||o==="then"))return ET(t,[...e,o],r)},apply(s,o,u){const d=e[e.length-1];let f={args:u,path:e};return d==="call"?f={args:u.length>=2?[u[1]]:[],path:e.slice(0,-1)}:d==="apply"&&(f={args:u.length>=2?u[1]:[],path:e.slice(0,-1)}),E2(f.args),E2(f.path),t(f)}})),r[i]}const eh=t=>ET(t,[],fM()),Mm=t=>new Proxy(ST,{get(e,r){if(r!=="then")return t(r)}});var TT=wc({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(t,e){function r(a){"@babel/helpers - typeof";return e.exports=r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(i){return typeof i}:function(i){return i&&typeof Symbol=="function"&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},e.exports.__esModule=!0,e.exports.default=e.exports,r(a)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),xM=wc({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(t,e){var r=TT().default;function a(i,s){if(r(i)!="object"||!i)return i;var o=i[Symbol.toPrimitive];if(o!==void 0){var u=o.call(i,s||"default");if(r(u)!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(i)}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports}}),bM=wc({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(t,e){var r=TT().default,a=xM();function i(s){var o=a(s,"string");return r(o)=="symbol"?o:o+""}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports}}),CT=wc({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(t,e){var r=bM();function a(i,s,o){return(s=r(s))in i?Object.defineProperty(i,s,{value:o,enumerable:!0,configurable:!0,writable:!0}):i[s]=o,i}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports}}),km=wc({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(t,e){var r=CT();function a(s,o){var u=Object.keys(s);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(s);o&&(d=d.filter(function(f){return Object.getOwnPropertyDescriptor(s,f).enumerable})),u.push.apply(u,d)}return u}function i(s){for(var o=1;o<arguments.length;o++){var u=arguments[o]!=null?arguments[o]:{};o%2?a(Object(u),!0).forEach(function(d){r(s,d,u[d])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(u)):a(Object(u)).forEach(function(d){Object.defineProperty(s,d,Object.getOwnPropertyDescriptor(u,d))})}return s}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports}});Jf(km());Jf(CT());var Zd=Jf(km());function wM(t,e){if("error"in t){const a=e.deserialize(t.error);return{ok:!1,error:(0,Zd.default)((0,Zd.default)({},t),{},{error:a})}}return{ok:!0,result:(0,Zd.default)((0,Zd.default)({},t.result),(!t.result.type||t.result.type==="data")&&{type:"data",data:e.deserialize(t.result.data)})}}var Up=class extends Error{constructor(){super("Unable to transform response from server")}};function SM(t,e){let r;try{r=wM(t,e)}catch{throw new Up}if(!r.ok&&(!Zs(r.error.error)||typeof r.error.error.code!="number"))throw new Up;if(r.ok&&!Zs(r.result))throw new Up;return r}Jf(km());var Wd=cr(ll(),1),Ql=cr(un(),1);function EM(t){return t instanceof Bf}function TM(t){return Zs(t)&&Zs(t.error)&&typeof t.error.code=="number"&&typeof t.error.message=="string"}function CM(t,e){return typeof t=="string"?t:Zs(t)&&typeof t.message=="string"?t.message:e}var Bf=class mf extends Error{constructor(e,r){var a,i;const s=r==null?void 0:r.cause;super(e,{cause:s}),(0,Wd.default)(this,"cause",void 0),(0,Wd.default)(this,"shape",void 0),(0,Wd.default)(this,"data",void 0),(0,Wd.default)(this,"meta",void 0),this.meta=r==null?void 0:r.meta,this.cause=s,this.shape=r==null||(a=r.result)===null||a===void 0?void 0:a.error,this.data=r==null||(i=r.result)===null||i===void 0?void 0:i.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,mf.prototype)}static from(e,r={}){const a=e;return EM(a)?(r.meta&&(a.meta=(0,Ql.default)((0,Ql.default)({},a.meta),r.meta)),a):TM(a)?new mf(a.error.message,(0,Ql.default)((0,Ql.default)({},r),{},{result:a,cause:r.cause})):new mf(CM(a,"Unknown error"),(0,Ql.default)((0,Ql.default)({},r),{},{cause:a}))}};function NM(t){const e=t;return e?"input"in e?e:{input:e,output:e}:{input:{serialize:r=>r,deserialize:r=>r},output:{serialize:r=>r,deserialize:r=>r}}}const T2=t=>typeof t=="function";function jM(t){if(t)return t;if(typeof window<"u"&&T2(window.fetch))return window.fetch;if(typeof globalThis<"u"&&T2(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}var Fu=cr(un());function AM(t){return{url:t.url.toString(),fetch:t.fetch,transformer:NM(t.transformer),methodOverride:t.methodOverride}}function MM(t){const e={};for(let r=0;r<t.length;r++){const a=t[r];e[r]=a}return e}const kM={query:"GET",mutation:"POST",subscription:"PATCH"};function NT(t){return"input"in t?t.transformer.input.serialize(t.input):MM(t.inputs.map(e=>t.transformer.input.serialize(e)))}const jT=t=>{const e=t.url.split("?");let a=e[0].replace(/\/$/,"")+"/"+t.path;const i=[];if(e[1]&&i.push(e[1]),"inputs"in t&&i.push("batch=1"),t.type==="query"||t.type==="subscription"){const s=NT(t);s!==void 0&&t.methodOverride!=="POST"&&i.push(`input=${encodeURIComponent(JSON.stringify(s))}`)}return i.length&&(a+="?"+i.join("&")),a},DM=t=>{if(t.type==="query"&&t.methodOverride!=="POST")return;const e=NT(t);return e!==void 0?JSON.stringify(e):void 0},OM=t=>PM((0,Fu.default)((0,Fu.default)({},t),{},{contentTypeHeader:"application/json",getUrl:jT,getBody:DM}));var RM=class extends Error{constructor(){const t="AbortError";super(t),this.name=t,this.message=t}};const BM=t=>{var e;if(t!=null&&t.aborted)throw(e=t.throwIfAborted)===null||e===void 0||e.call(t),typeof DOMException<"u"?new DOMException("AbortError","AbortError"):new RM};async function LM(t){var e;BM(t.signal);const r=t.getUrl(t),a=t.getBody(t),i=(e=t.methodOverride)!==null&&e!==void 0?e:kM[t.type],s=await(async()=>{const u=await t.headers();return Symbol.iterator in u?Object.fromEntries(u):u})(),o=(0,Fu.default)((0,Fu.default)((0,Fu.default)({},t.contentTypeHeader&&i!=="GET"?{"content-type":t.contentTypeHeader}:{}),t.trpcAcceptHeader?{"trpc-accept":t.trpcAcceptHeader}:void 0),s);return jM(t.fetch)(r,{method:i,signal:t.signal,body:a,headers:o})}async function PM(t){const e={},r=await LM(t);e.response=r;const a=await r.json();return e.responseJSON=a,{json:a,meta:e}}cr(un(),1);const C2=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function N2(t){let e=null,r=null;const a=()=>{clearTimeout(r),r=null,e=null};function i(u){const d=[[]];let f=0;for(;;){const m=u[f];if(!m)break;const y=d[d.length-1];if(m.aborted){var h;(h=m.reject)===null||h===void 0||h.call(m,new Error("Aborted")),f++;continue}if(t.validate(y.concat(m).map(E=>E.key))){y.push(m),f++;continue}if(y.length===0){var p;(p=m.reject)===null||p===void 0||p.call(m,new Error("Input is too big for a single dispatch")),f++;continue}d.push([])}return d}function s(){const u=i(e);a();for(const d of u){if(!d.length)continue;const f={items:d};for(const p of d)p.batch=f;t.fetch(f.items.map(p=>p.key)).then(async p=>{await Promise.all(p.map(async(y,x)=>{const E=f.items[x];try{var w;const C=await Promise.resolve(y);(w=E.resolve)===null||w===void 0||w.call(E,C)}catch(C){var T;(T=E.reject)===null||T===void 0||T.call(E,C)}E.batch=null,E.reject=null,E.resolve=null}));for(const y of f.items){var m;(m=y.reject)===null||m===void 0||m.call(y,new Error("Missing result")),y.batch=null}}).catch(p=>{for(const y of f.items){var m;(m=y.reject)===null||m===void 0||m.call(y,p),y.batch=null}})}}function o(u){var d;const f={aborted:!1,key:u,batch:null,resolve:C2,reject:C2},h=new Promise((p,m)=>{var y;f.reject=m,f.resolve=p,(y=e)!==null&&y!==void 0||(e=[]),e.push(f)});return(d=r)!==null&&d!==void 0||(r=setTimeout(s)),h}return{load:o}}function zM(...t){const e=new AbortController,r=t.length;let a=0;const i=()=>{++a===r&&e.abort()};for(const s of t)s!=null&&s.aborted?i():s==null||s.addEventListener("abort",i,{once:!0});return e.signal}var Jd=cr(un(),1);function _M(t){var e,r;const a=AM(t),i=(e=t.maxURLLength)!==null&&e!==void 0?e:1/0,s=(r=t.maxItems)!==null&&r!==void 0?r:1/0;return()=>{const o=h=>({validate(p){if(i===1/0&&s===1/0)return!0;if(p.length>s)return!1;const m=p.map(E=>E.path).join(","),y=p.map(E=>E.input);return jT((0,Jd.default)((0,Jd.default)({},a),{},{type:h,path:m,inputs:y,signal:null})).length<=i},async fetch(p){const m=p.map(C=>C.path).join(","),y=p.map(C=>C.input),x=zM(...p.map(C=>C.signal)),E=await OM((0,Jd.default)((0,Jd.default)({},a),{},{path:m,inputs:y,type:h,headers(){return t.headers?typeof t.headers=="function"?t.headers({opList:p}):t.headers:{}},signal:x}));return(Array.isArray(E.json)?E.json:p.map(()=>E.json)).map(C=>({meta:E.meta,json:C}))}}),u=N2(o("query")),d=N2(o("mutation")),f={query:u,mutation:d};return({op:h})=>Wf(p=>{/* istanbul ignore if -- @preserve */if(h.type==="subscription")throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");const y=f[h.type].load(h);let x;return y.then(E=>{x=E;const w=SM(E.json,a.transformer.output);if(!w.ok){p.error(Bf.from(w.error,{meta:E.meta}));return}p.next({context:E.meta,result:w.result}),p.complete()}).catch(E=>{p.error(Bf.from(E,{meta:x==null?void 0:x.meta}))}),()=>{}})}}cr(un(),1);const AT=(t,...e)=>typeof t=="function"?t(...e):t;cr(ll(),1);function UM(){let t,e;return{promise:new Promise((a,i)=>{t=a,e=i}),resolve:t,reject:e}}async function qM(t){const e=await AT(t.url);if(!t.connectionParams)return e;const a=`${e.includes("?")?"&":"?"}connectionParams=1`;return e+a}async function IM(t,e){const r={method:"connectionParams",data:await AT(t)};return e.encode(r)}cr(ll(),1);var Li=cr(ll(),1);function VM(t){const{promise:e,resolve:r,reject:a}=UM();return t.addEventListener("open",()=>{t.removeEventListener("error",a),r()}),t.addEventListener("error",a),e}function FM(t,{intervalMs:e,pongTimeoutMs:r}){let a,i;function s(){a=setTimeout(()=>{t.send("PING"),i=setTimeout(()=>{t.close()},r)},e)}function o(){clearTimeout(a),s()}function u(){clearTimeout(i),o()}t.addEventListener("open",s),t.addEventListener("message",({data:d})=>{clearTimeout(a),s(),d==="PONG"&&u()}),t.addEventListener("close",()=>{clearTimeout(a),clearTimeout(i)})}var HM=class $g{constructor(e){var r;if((0,Li.default)(this,"id",++$g.connectCount),(0,Li.default)(this,"WebSocketPonyfill",void 0),(0,Li.default)(this,"urlOptions",void 0),(0,Li.default)(this,"keepAliveOpts",void 0),(0,Li.default)(this,"encoder",void 0),(0,Li.default)(this,"wsObservable",cM(null)),(0,Li.default)(this,"openPromise",null),this.WebSocketPonyfill=(r=e.WebSocketPonyfill)!==null&&r!==void 0?r:WebSocket,!this.WebSocketPonyfill)throw new Error("No WebSocket implementation found - you probably don't want to use this on the server, but if you do you need to pass a `WebSocket`-ponyfill");this.urlOptions=e.urlOptions,this.keepAliveOpts=e.keepAlive,this.encoder=e.encoder}get ws(){return this.wsObservable.get()}set ws(e){this.wsObservable.next(e)}isOpen(){return!!this.ws&&this.ws.readyState===this.WebSocketPonyfill.OPEN&&!this.openPromise}isClosed(){return!!this.ws&&(this.ws.readyState===this.WebSocketPonyfill.CLOSING||this.ws.readyState===this.WebSocketPonyfill.CLOSED)}async open(){var e=this;if(e.openPromise)return e.openPromise;e.id=++$g.connectCount;const r=qM(e.urlOptions).then(a=>new e.WebSocketPonyfill(a));e.openPromise=r.then(async a=>{e.ws=a,a.binaryType="arraybuffer",a.addEventListener("message",function({data:i}){i==="PING"&&this.send("PONG")}),e.keepAliveOpts.enabled&&FM(a,e.keepAliveOpts),a.addEventListener("close",()=>{e.ws===a&&(e.ws=null)}),await VM(a),e.urlOptions.connectionParams&&a.send(await IM(e.urlOptions.connectionParams,e.encoder))});try{await e.openPromise}finally{e.openPromise=null}}async close(){var e=this;try{await e.openPromise}finally{var r;(r=e.ws)===null||r===void 0||r.close()}}};(0,Li.default)(HM,"connectCount",0);cr(ll(),1);cr(un(),1);var qp=cr(ll(),1),j2=cr(un(),1),th=class{constructor(t){(0,qp.default)(this,"links",void 0),(0,qp.default)(this,"runtime",void 0),(0,qp.default)(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=t.links.map(e=>e(this.runtime))}$request(t){var e;return dM({links:this.links,op:(0,j2.default)((0,j2.default)({},t),{},{context:(e=t.context)!==null&&e!==void 0?e:{},id:++this.requestId})}).pipe(uM())}async requestAsPromise(t){var e=this;try{const r=e.$request(t);return(await oM(r)).result.data}catch(r){throw Bf.from(r)}}query(t,e,r){return this.requestAsPromise({type:"query",path:t,input:e,context:r==null?void 0:r.context,signal:r==null?void 0:r.signal})}mutation(t,e,r){return this.requestAsPromise({type:"mutation",path:t,input:e,context:r==null?void 0:r.context,signal:r==null?void 0:r.signal})}subscription(t,e,r){return this.$request({type:"subscription",path:t,input:e,context:r.context,signal:r.signal}).subscribe({next(i){switch(i.result.type){case"state":{var s;(s=r.onConnectionStateChange)===null||s===void 0||s.call(r,i.result);break}case"started":{var o;(o=r.onStarted)===null||o===void 0||o.call(r,{context:i.context});break}case"stopped":{var u;(u=r.onStopped)===null||u===void 0||u.call(r);break}case"data":case void 0:{var d;(d=r.onData)===null||d===void 0||d.call(r,i.result.data);break}}},error(i){var s;(s=r.onError)===null||s===void 0||s.call(r,i)},complete(){var i;(i=r.onComplete)===null||i===void 0||i.call(r)}})}};const MT=Symbol.for("trpc_untypedClient"),GM={query:"query",mutate:"mutation",subscribe:"subscription"},QM=t=>GM[t];function kT(t){const e=eh(({path:r,args:a})=>{const i=[...r],s=QM(i.pop()),o=i.join(".");return t[s](o,...a)});return Mm(r=>r===MT?t:e[r])}function $M(t){const e=new th(t);return kT(e)}function Dm(t){return t[MT]}cr(un(),1);cr(un(),1);var YM=Tn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(t,e){function r(i){var s,o,u,d=2;for(typeof Symbol<"u"&&(o=Symbol.asyncIterator,u=Symbol.iterator);d--;){if(o&&(s=i[o])!=null)return s.call(i);if(u&&(s=i[u])!=null)return new a(s.call(i));o="@@asyncIterator",u="@@iterator"}throw new TypeError("Object is not async iterable")}function a(i){function s(o){if(Object(o)!==o)return Promise.reject(new TypeError(o+" is not an object."));var u=o.done;return Promise.resolve(o.value).then(function(d){return{value:d,done:u}})}return a=function(u){this.s=u,this.n=u.next},a.prototype={s:null,n:null,next:function(){return s(this.n.apply(this.s,arguments))},return:function(u){var d=this.s.return;return d===void 0?Promise.resolve({value:u,done:!0}):s(d.apply(this.s,arguments))},throw:function(u){var d=this.s.return;return d===void 0?Promise.reject(u):s(d.apply(this.s,arguments))}},new a(i)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}});cr(YM(),1);cr(un(),1);var KM=Tn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js"(t,e){function r(){var a=typeof SuppressedError=="function"?SuppressedError:function(u,d){var f=Error();return f.name="SuppressedError",f.error=u,f.suppressed=d,f},i={},s=[];function o(u,d){if(d!=null){if(Object(d)!==d)throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");if(u)var f=d[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")];if(f===void 0&&(f=d[Symbol.dispose||Symbol.for("Symbol.dispose")],u))var h=f;if(typeof f!="function")throw new TypeError("Object is not disposable.");h&&(f=function(){try{h.call(d)}catch(m){return Promise.reject(m)}}),s.push({v:d,d:f,a:u})}else u&&s.push({d,a:u});return d}return{e:i,u:o.bind(null,!1),a:o.bind(null,!0),d:function(){var d,f=this.e,h=0;function p(){for(;d=s.pop();)try{if(!d.a&&h===1)return h=0,s.push(d),Promise.resolve().then(p);if(d.d){var y=d.d.call(d.v);if(d.a)return h|=2,Promise.resolve(y).then(p,m)}else h|=1}catch(x){return m(x)}if(h===1)return f!==i?Promise.reject(f):Promise.resolve();if(f!==i)throw f}function m(y){return f=f!==i?new a(y,f):y,p()}return p()}}}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),DT=Tn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/OverloadYield.js"(t,e){function r(a,i){this.v=a,this.k=i}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),XM=Tn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js"(t,e){var r=DT();function a(i){return new r(i,0)}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports}}),ZM=Tn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js"(t,e){var r=DT();function a(s){return function(){return new i(s.apply(this,arguments))}}function i(s){var o,u;function d(h,p){try{var m=s[h](p),y=m.value,x=y instanceof r;Promise.resolve(x?y.v:y).then(function(E){if(x){var w=h==="return"?"return":"next";if(!y.k||E.done)return d(w,E);E=s[w](E).value}f(m.done?"return":"normal",E)},function(E){d("throw",E)})}catch(E){f("throw",E)}}function f(h,p){switch(h){case"return":o.resolve({value:p,done:!0});break;case"throw":o.reject(p);break;default:o.resolve({value:p,done:!1})}(o=o.next)?d(o.key,o.arg):u=null}this._invoke=function(h,p){return new Promise(function(m,y){var x={key:h,arg:p,resolve:m,reject:y,next:null};u?u=u.next=x:(o=u=x,d(h,p))})},typeof s.return!="function"&&(this.return=void 0)}i.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},i.prototype.next=function(s){return this._invoke("next",s)},i.prototype.throw=function(s){return this._invoke("throw",s)},i.prototype.return=function(s){return this._invoke("return",s)},e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports}});cr(KM(),1);cr(XM(),1);cr(ZM(),1);cr(un(),1);var WM=Object.create,OT=Object.defineProperty,JM=Object.getOwnPropertyDescriptor,RT=Object.getOwnPropertyNames,ek=Object.getPrototypeOf,tk=Object.prototype.hasOwnProperty,us=(t,e)=>function(){return e||(0,t[RT(t)[0]])((e={exports:{}}).exports,e),e.exports},rk=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(var i=RT(e),s=0,o=i.length,u;s<o;s++)u=i[s],!tk.call(t,u)&&u!==r&&OT(t,u,{get:(d=>e[d]).bind(null,u),enumerable:!(a=JM(e,u))||a.enumerable});return t},ol=(t,e,r)=>(r=t!=null?WM(ek(t)):{},rk(e||!t||!t.__esModule?OT(r,"default",{value:t,enumerable:!0}):r,t)),ak=us({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectWithoutPropertiesLoose.js"(t,e){function r(a,i){if(a==null)return{};var s={};for(var o in a)if({}.hasOwnProperty.call(a,o)){if(i.includes(o))continue;s[o]=a[o]}return s}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),nk=us({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectWithoutProperties.js"(t,e){var r=ak();function a(i,s){if(i==null)return{};var o,u,d=r(i,s);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(i);for(u=0;u<f.length;u++)o=f[u],s.includes(o)||{}.propertyIsEnumerable.call(i,o)&&(d[o]=i[o])}return d}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports}}),BT=us({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(t,e){function r(a){"@babel/helpers - typeof";return e.exports=r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(i){return typeof i}:function(i){return i&&typeof Symbol=="function"&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},e.exports.__esModule=!0,e.exports.default=e.exports,r(a)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),ik=us({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(t,e){var r=BT().default;function a(i,s){if(r(i)!="object"||!i)return i;var o=i[Symbol.toPrimitive];if(o!==void 0){var u=o.call(i,s||"default");if(r(u)!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(i)}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports}}),sk=us({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(t,e){var r=BT().default,a=ik();function i(s){var o=a(s,"string");return r(o)=="symbol"?o:o+""}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports}}),lk=us({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(t,e){var r=sk();function a(i,s,o){return(s=r(s))in i?Object.defineProperty(i,s,{value:o,enumerable:!0,configurable:!0,writable:!0}):i[s]=o,i}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports}}),Sc=us({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(t,e){var r=lk();function a(s,o){var u=Object.keys(s);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(s);o&&(d=d.filter(function(f){return Object.getOwnPropertyDescriptor(s,f).enumerable})),u.push.apply(u,d)}return u}function i(s){for(var o=1;o<arguments.length;o++){var u=arguments[o]!=null?arguments[o]:{};o%2?a(Object(u),!0).forEach(function(d){r(s,d,u[d])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(u)):a(Object(u)).forEach(function(d){Object.defineProperty(s,d,Object.getOwnPropertyDescriptor(u,d))})}return s}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports}}),ok=ol(nk(),1),A2=ol(Sc(),1);const uk=["cursor","direction"];function yn(t,e,r){const a=t.flatMap(i=>i.split("."));if(!e&&(!r||r==="any"))return a.length?[a]:[];if(r==="infinite"&&Zs(e)&&("direction"in e||"cursor"in e)){const{cursor:i,direction:s}=e,o=(0,ok.default)(e,uk);return[a,{input:o,type:"infinite"}]}return[a,(0,A2.default)((0,A2.default)({},typeof e<"u"&&e!==ka&&{input:e}),r&&r!=="any"&&{type:r})]}function yf(t){return yn(t,void 0,"any")}function ck(t){return eh(({path:e,args:r})=>{var a;const i=[...e],s=i.pop();if(s==="useMutation")return t[s](i,...r);if(s==="_def")return{path:i};const[o,...u]=r,d=(a=u[0])!==null&&a!==void 0?a:{};return t[s](i,o,d)})}var Ip;const dk=["client","ssrContext","ssrState","abortOnUnmount"],fk=(Ip=q.createContext)===null||Ip===void 0?void 0:Ip.call(_E,null),hk=t=>{switch(t){case"queryOptions":case"fetch":case"ensureData":case"prefetch":case"getData":case"setData":case"setQueriesData":return"query";case"infiniteQueryOptions":case"fetchInfinite":case"prefetchInfinite":case"getInfiniteData":case"setInfiniteData":return"infinite";case"setMutationDefaults":case"getMutationDefaults":case"isMutating":case"cancel":case"invalidate":case"refetch":case"reset":return"any"}};function vk(t){return eh(e=>{const r=[...e.path],a=r.pop(),i=[...e.args],s=i.shift(),o=hk(a),u=yn(r,s,o);return{infiniteQueryOptions:()=>t.infiniteQueryOptions(r,u,i[0]),queryOptions:()=>t.queryOptions(r,u,...i),fetch:()=>t.fetchQuery(u,...i),fetchInfinite:()=>t.fetchInfiniteQuery(u,i[0]),prefetch:()=>t.prefetchQuery(u,...i),prefetchInfinite:()=>t.prefetchInfiniteQuery(u,i[0]),ensureData:()=>t.ensureQueryData(u,...i),invalidate:()=>t.invalidateQueries(u,...i),reset:()=>t.resetQueries(u,...i),refetch:()=>t.refetchQueries(u,...i),cancel:()=>t.cancelQuery(u,...i),setData:()=>{t.setQueryData(u,i[0],i[1])},setQueriesData:()=>t.setQueriesData(u,i[0],i[1],i[2]),setInfiniteData:()=>{t.setInfiniteQueryData(u,i[0],i[1])},getData:()=>t.getQueryData(u),getInfiniteData:()=>t.getInfiniteQueryData(u),setMutationDefaults:()=>t.setMutationDefaults(yf(r),s),getMutationDefaults:()=>t.getMutationDefaults(yf(r)),isMutating:()=>t.isMutating({mutationKey:yf(r)})}[a]()})}function pk(t){const e=kT(t.client),r=vk(t);return Mm(a=>{const i=a;return i==="client"?e:dk.includes(i)?t[i]:r[a]})}var gk=ol(Sc(),1);function M2(t){const e=t instanceof th?t:Dm(t);return eh(r=>{const a=r.path,i=a.join("."),[s,o]=r.args;return(0,gk.default)({queryKey:yn(a,s,"query"),queryFn:()=>e.query(i,s,o==null?void 0:o.trpc)},o)})}var Vp=ol(Sc(),1);function ra(t,e,r){var a;const i=t[0];let s=(a=t[1])===null||a===void 0?void 0:a.input;if(r){var o;s=(0,Vp.default)((0,Vp.default)((0,Vp.default)({},(o=s)!==null&&o!==void 0?o:{}),r.pageParam?{cursor:r.pageParam}:{}),{},{direction:r.direction})}return[i.join("."),s,e==null?void 0:e.trpc]}var mk=us({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(t,e){function r(i){var s,o,u,d=2;for(typeof Symbol<"u"&&(o=Symbol.asyncIterator,u=Symbol.iterator);d--;){if(o&&(s=i[o])!=null)return s.call(i);if(u&&(s=i[u])!=null)return new a(s.call(i));o="@@asyncIterator",u="@@iterator"}throw new TypeError("Object is not async iterable")}function a(i){function s(o){if(Object(o)!==o)return Promise.reject(new TypeError(o+" is not an object."));var u=o.done;return Promise.resolve(o.value).then(function(d){return{value:d,done:u}})}return a=function(u){this.s=u,this.n=u.next},a.prototype={s:null,n:null,next:function(){return s(this.n.apply(this.s,arguments))},return:function(u){var d=this.s.return;return d===void 0?Promise.resolve({value:u,done:!0}):s(d.apply(this.s,arguments))},throw:function(u){var d=this.s.return;return d===void 0?Promise.reject(u):s(d.apply(this.s,arguments))}},new a(i)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),yk=ol(mk(),1);function Yg(t){return{path:t.path.join(".")}}function Du(t){const e=Yg(t);return q.useMemo(()=>e,[e])}async function LT(t,e,r){const i=e.getQueryCache().build(e,{queryKey:r});i.setState({data:[],status:"success"});const s=[];var o=!1,u=!1,d;try{for(var f=(0,yk.default)(t),h;o=!(h=await f.next()).done;o=!1){const p=h.value;s.push(p),i.setState({data:[...s]})}}catch(p){u=!0,d=p}finally{try{o&&f.return!=null&&await f.return()}finally{if(u)throw d}}return s}var Tt=ol(Sc(),1);function xk(t){const{client:e,queryClient:r}=t,a=e instanceof th?e:Dm(e);return{infiniteQueryOptions:(i,s,o)=>{var u,d;const f=((u=s[1])===null||u===void 0?void 0:u.input)===ka,h=async p=>{var m;const y=(0,Tt.default)((0,Tt.default)({},o),{},{trpc:(0,Tt.default)((0,Tt.default)({},o==null?void 0:o.trpc),!(o==null||(m=o.trpc)===null||m===void 0)&&m.abortOnUnmount?{signal:p.signal}:{signal:null})});return await a.query(...ra(s,y,{direction:p.direction,pageParam:p.pageParam}))};return Object.assign((0,Tt.default)((0,Tt.default)({},o),{},{initialData:o==null?void 0:o.initialData,queryKey:s,queryFn:f?ka:h,initialPageParam:(d=o==null?void 0:o.initialCursor)!==null&&d!==void 0?d:null}),{trpc:Yg({path:i})})},queryOptions:(i,s,o)=>{var u;const d=((u=s[1])===null||u===void 0?void 0:u.input)===ka,f=async h=>{var p;const m=(0,Tt.default)((0,Tt.default)({},o),{},{trpc:(0,Tt.default)((0,Tt.default)({},o==null?void 0:o.trpc),!(o==null||(p=o.trpc)===null||p===void 0)&&p.abortOnUnmount?{signal:h.signal}:{signal:null})}),y=await a.query(...ra(s,m));return xT(y)?LT(y,r,s):y};return Object.assign((0,Tt.default)((0,Tt.default)({},o),{},{initialData:o==null?void 0:o.initialData,queryKey:s,queryFn:d?ka:f}),{trpc:Yg({path:i})})},fetchQuery:(i,s)=>r.fetchQuery((0,Tt.default)((0,Tt.default)({},s),{},{queryKey:i,queryFn:()=>a.query(...ra(i,s))})),fetchInfiniteQuery:(i,s)=>{var o;return r.fetchInfiniteQuery((0,Tt.default)((0,Tt.default)({},s),{},{queryKey:i,queryFn:({pageParam:u,direction:d})=>a.query(...ra(i,s,{pageParam:u,direction:d})),initialPageParam:(o=s==null?void 0:s.initialCursor)!==null&&o!==void 0?o:null}))},prefetchQuery:(i,s)=>r.prefetchQuery((0,Tt.default)((0,Tt.default)({},s),{},{queryKey:i,queryFn:()=>a.query(...ra(i,s))})),prefetchInfiniteQuery:(i,s)=>{var o;return r.prefetchInfiniteQuery((0,Tt.default)((0,Tt.default)({},s),{},{queryKey:i,queryFn:({pageParam:u,direction:d})=>a.query(...ra(i,s,{pageParam:u,direction:d})),initialPageParam:(o=s==null?void 0:s.initialCursor)!==null&&o!==void 0?o:null}))},ensureQueryData:(i,s)=>r.ensureQueryData((0,Tt.default)((0,Tt.default)({},s),{},{queryKey:i,queryFn:()=>a.query(...ra(i,s))})),invalidateQueries:(i,s,o)=>r.invalidateQueries((0,Tt.default)((0,Tt.default)({},s),{},{queryKey:i}),o),resetQueries:(i,s,o)=>r.resetQueries((0,Tt.default)((0,Tt.default)({},s),{},{queryKey:i}),o),refetchQueries:(i,s,o)=>r.refetchQueries((0,Tt.default)((0,Tt.default)({},s),{},{queryKey:i}),o),cancelQuery:(i,s)=>r.cancelQueries({queryKey:i},s),setQueryData:(i,s,o)=>r.setQueryData(i,s,o),setQueriesData:(i,s,o,u)=>r.setQueriesData((0,Tt.default)((0,Tt.default)({},s),{},{queryKey:i}),o,u),getQueryData:i=>r.getQueryData(i),setInfiniteQueryData:(i,s,o)=>r.setQueryData(i,s,o),getInfiniteQueryData:i=>r.getQueryData(i),setMutationDefaults:(i,s)=>{const o=i[0],u=d=>a.mutation(...ra([o,{input:d}],t));return r.setMutationDefaults(i,typeof s=="function"?s({canonicalMutationFn:u}):s)},getMutationDefaults:i=>r.getMutationDefaults(i),isMutating:i=>r.isMutating((0,Tt.default)((0,Tt.default)({},i),{},{exact:!0}))}}var Le=ol(Sc());const k2=(t,e)=>new Proxy(t,{get(a,i){return e(i),a[i]}});function bk(t){var e,r;const a=(e=void 0)!==null&&e!==void 0?e:D=>D.originalFn(),i=(r=void 0)!==null&&r!==void 0?r:fk,s=$M,o=D=>{var M;const{abortOnUnmount:j=!1,queryClient:k,ssrContext:B}=D,[P,U]=q.useState((M=D.ssrState)!==null&&M!==void 0?M:!1),R=D.client instanceof th?D.client:Dm(D.client),V=q.useMemo(()=>xk({client:R,queryClient:k}),[R,k]),_=q.useMemo(()=>(0,Le.default)({abortOnUnmount:j,queryClient:k,client:R,ssrContext:B??null,ssrState:P},V),[j,R,V,k,B,P]);return q.useEffect(()=>{U(H=>H?"mounted":!1)},[]),g.jsx(i.Provider,{value:_,children:D.children})};function u(){const D=q.useContext(i);if(!D)throw new Error("Unable to find tRPC Context. Did you forget to wrap your App inside `withTRPC` HoC?");return D}function d(D,M){var j;const{queryClient:k,ssrState:B}=u();return B&&B!=="mounted"&&((j=k.getQueryCache().find({queryKey:D}))===null||j===void 0?void 0:j.state.status)==="error"?(0,Le.default)({retryOnMount:!1},M):M}function f(D,M,j){var k,B,P,U,R;const V=u(),{abortOnUnmount:_,client:H,ssrState:z,queryClient:I,prefetchQuery:F}=V,K=yn(D,M,"query"),J=I.getQueryDefaults(K),L=M===ka;typeof window>"u"&&z==="prepass"&&(j==null||(k=j.trpc)===null||k===void 0?void 0:k.ssr)!==!1&&((B=j==null?void 0:j.enabled)!==null&&B!==void 0?B:J==null?void 0:J.enabled)!==!1&&!L&&!I.getQueryCache().find({queryKey:K})&&F(K,j);const Q=d(K,(0,Le.default)((0,Le.default)({},J),j)),X=(P=(U=j==null||(R=j.trpc)===null||R===void 0?void 0:R.abortOnUnmount)!==null&&U!==void 0?U:void 0)!==null&&P!==void 0?P:_,W=QA((0,Le.default)((0,Le.default)({},Q),{},{queryKey:K,queryFn:L?M:async te=>{const Y=(0,Le.default)((0,Le.default)({},Q),{},{trpc:(0,Le.default)((0,Le.default)({},Q==null?void 0:Q.trpc),X?{signal:te.signal}:{signal:null})}),ne=await H.query(...ra(K,Y));return xT(ne)?LT(ne,I,K):ne}}),I);return W.trpc=Du({path:D}),W}function h(D,M,j){var k,B,P;const U=u(),R=yn(D,M,"query"),V=M===ka,_=(k=(B=j==null||(P=j.trpc)===null||P===void 0?void 0:P.abortOnUnmount)!==null&&B!==void 0?B:void 0)!==null&&k!==void 0?k:U.abortOnUnmount;XA((0,Le.default)((0,Le.default)({},j),{},{queryKey:R,queryFn:V?M:H=>{const z={trpc:(0,Le.default)((0,Le.default)({},j==null?void 0:j.trpc),_?{signal:H.signal}:{})};return U.client.query(...ra(R,z))}}))}function p(D,M,j){var k,B,P;const U=u(),R=yn(D,M,"query"),V=(k=(B=j==null||(P=j.trpc)===null||P===void 0?void 0:P.abortOnUnmount)!==null&&B!==void 0?B:void 0)!==null&&k!==void 0?k:U.abortOnUnmount,_=$A((0,Le.default)((0,Le.default)({},j),{},{queryKey:R,queryFn:H=>{const z=(0,Le.default)((0,Le.default)({},j),{},{trpc:(0,Le.default)((0,Le.default)({},j==null?void 0:j.trpc),V?{signal:H.signal}:{signal:null})});return U.client.query(...ra(R,z))}}),U.queryClient);return _.trpc=Du({path:D}),[_.data,_]}function m(D,M){const{client:j,queryClient:k}=u(),B=yf(D),P=k.defaultMutationOptions(k.getMutationDefaults(B)),U=WA((0,Le.default)((0,Le.default)({},M),{},{mutationKey:B,mutationFn:R=>j.mutation(...ra([D,{input:R}],M)),onSuccess(...R){var V,_;return a({originalFn:()=>{var z,I,F;return(z=M==null||(I=M.onSuccess)===null||I===void 0?void 0:I.call(M,...R))!==null&&z!==void 0?z:P==null||(F=P.onSuccess)===null||F===void 0?void 0:F.call(P,...R)},queryClient:k,meta:(V=(_=M==null?void 0:M.meta)!==null&&_!==void 0?_:P==null?void 0:P.meta)!==null&&V!==void 0?V:{}})}}),k);return U.trpc=Du({path:D}),U}const y={data:void 0,error:null,status:"idle"},x={data:void 0,error:null,status:"connecting"};/* istanbul ignore next -- @preserve */function E(D,M,j){var k;const B=(k=j==null?void 0:j.enabled)!==null&&k!==void 0?k:M!==ka,P=ts(yn(D,M,"any")),{client:U}=u(),R=q.useRef(j);q.useEffect(()=>{R.current=j});const[V]=q.useState(new Set([])),_=q.useCallback(L=>{V.add(L)},[V]),H=q.useRef(null),z=q.useCallback(L=>{const Q=F.current,X=F.current=L(Q);let W=!1;for(const te of V)if(Q[te]!==X[te]){W=!0;break}W&&J(k2(X,_))},[_,V]),I=q.useCallback(()=>{var L;if((L=H.current)===null||L===void 0||L.unsubscribe(),!B){z(()=>(0,Le.default)((0,Le.default)({},y),{},{reset:I}));return}z(()=>(0,Le.default)((0,Le.default)({},x),{},{reset:I}));const Q=U.subscription(D.join("."),M??void 0,{onStarted:()=>{var X,W;(X=(W=R.current).onStarted)===null||X===void 0||X.call(W),z(te=>(0,Le.default)((0,Le.default)({},te),{},{status:"pending",error:null}))},onData:X=>{var W,te;(W=(te=R.current).onData)===null||W===void 0||W.call(te,X),z(Y=>(0,Le.default)((0,Le.default)({},Y),{},{status:"pending",data:X,error:null}))},onError:X=>{var W,te;(W=(te=R.current).onError)===null||W===void 0||W.call(te,X),z(Y=>(0,Le.default)((0,Le.default)({},Y),{},{status:"error",error:X}))},onConnectionStateChange:X=>{z(W=>{switch(X.state){case"idle":return(0,Le.default)((0,Le.default)({},W),{},{status:X.state,error:null,data:void 0});case"connecting":return(0,Le.default)((0,Le.default)({},W),{},{error:X.error,status:X.state});case"pending":return W}})},onComplete:()=>{var X,W;(X=(W=R.current).onComplete)===null||X===void 0||X.call(W),z(te=>(0,Le.default)((0,Le.default)({},te),{},{status:"idle",error:null,data:void 0}))}});H.current=Q},[U,P,B,z]);q.useEffect(()=>(I(),()=>{var L;(L=H.current)===null||L===void 0||L.unsubscribe()}),[I]);const F=q.useRef(B?(0,Le.default)((0,Le.default)({},x),{},{reset:I}):(0,Le.default)((0,Le.default)({},y),{},{reset:I})),[K,J]=q.useState(k2(F.current,_));return K}function w(D,M,j){var k,B,P,U,R;const{client:V,ssrState:_,prefetchInfiniteQuery:H,queryClient:z,abortOnUnmount:I}=u(),F=yn(D,M,"infinite"),K=z.getQueryDefaults(F),J=M===ka;typeof window>"u"&&_==="prepass"&&(j==null||(k=j.trpc)===null||k===void 0?void 0:k.ssr)!==!1&&((B=j==null?void 0:j.enabled)!==null&&B!==void 0?B:K==null?void 0:K.enabled)!==!1&&!J&&!z.getQueryCache().find({queryKey:F})&&H(F,(0,Le.default)((0,Le.default)({},K),j));const L=d(F,(0,Le.default)((0,Le.default)({},K),j)),Q=(P=j==null||(U=j.trpc)===null||U===void 0?void 0:U.abortOnUnmount)!==null&&P!==void 0?P:I,X=JA((0,Le.default)((0,Le.default)({},L),{},{initialPageParam:(R=j.initialCursor)!==null&&R!==void 0?R:null,persister:j.persister,queryKey:F,queryFn:J?M:W=>{var te;const Y=(0,Le.default)((0,Le.default)({},L),{},{trpc:(0,Le.default)((0,Le.default)({},L==null?void 0:L.trpc),Q?{signal:W.signal}:{signal:null})});return V.query(...ra(F,Y,{pageParam:(te=W.pageParam)!==null&&te!==void 0?te:j.initialCursor,direction:W.direction}))}}),z);return X.trpc=Du({path:D}),X}function T(D,M,j){var k,B,P;const U=u(),R=yn(D,M,"infinite"),V=U.queryClient.getQueryDefaults(R),_=M===ka,H=d(R,(0,Le.default)((0,Le.default)({},V),j)),z=(k=j==null||(B=j.trpc)===null||B===void 0?void 0:B.abortOnUnmount)!==null&&k!==void 0?k:U.abortOnUnmount;ZA((0,Le.default)((0,Le.default)({},j),{},{initialPageParam:(P=j.initialCursor)!==null&&P!==void 0?P:null,queryKey:R,queryFn:_?M:I=>{var F;const K=(0,Le.default)((0,Le.default)({},H),{},{trpc:(0,Le.default)((0,Le.default)({},H==null?void 0:H.trpc),z?{signal:I.signal}:{})});return U.client.query(...ra(R,K,{pageParam:(F=I.pageParam)!==null&&F!==void 0?F:j.initialCursor,direction:I.direction}))}}))}function C(D,M,j){var k,B,P;const U=u(),R=yn(D,M,"infinite"),V=U.queryClient.getQueryDefaults(R),_=d(R,(0,Le.default)((0,Le.default)({},V),j)),H=(k=j==null||(B=j.trpc)===null||B===void 0?void 0:B.abortOnUnmount)!==null&&k!==void 0?k:U.abortOnUnmount,z=YA((0,Le.default)((0,Le.default)({},j),{},{initialPageParam:(P=j.initialCursor)!==null&&P!==void 0?P:null,queryKey:R,queryFn:I=>{var F;const K=(0,Le.default)((0,Le.default)({},_),{},{trpc:(0,Le.default)((0,Le.default)({},_==null?void 0:_.trpc),H?{signal:I.signal}:{})});return U.client.query(...ra(R,K,{pageParam:(F=I.pageParam)!==null&&F!==void 0?F:j.initialCursor,direction:I.direction}))}}),U.queryClient);return z.trpc=Du({path:D}),[z.data,z]}return{Provider:o,createClient:s,useContext:u,useUtils:u,useQuery:f,usePrefetchQuery:h,useSuspenseQuery:p,useQueries:(D,M)=>{const{ssrState:j,queryClient:k,prefetchQuery:B,client:P}=u(),U=M2(P),R=D(U);if(typeof window>"u"&&j==="prepass")for(const _ of R){var V;const H=_;((V=H.trpc)===null||V===void 0?void 0:V.ssr)!==!1&&!k.getQueryCache().find({queryKey:H.queryKey})&&B(H.queryKey,H)}return pT({queries:R.map(_=>(0,Le.default)((0,Le.default)({},_),{},{queryKey:_.queryKey})),combine:M==null?void 0:M.combine},k)},useSuspenseQueries:D=>{const{queryClient:M,client:j}=u(),k=M2(j),B=D(k),P=KA({queries:B.map(U=>(0,Le.default)((0,Le.default)({},U),{},{queryFn:U.queryFn,queryKey:U.queryKey}))},M);return[P.map(U=>U.data),P]},useMutation:m,useSubscription:E,useInfiniteQuery:w,usePrefetchInfiniteQuery:T,useSuspenseInfiniteQuery:C}}function wk(t){const e=ck(t);return Mm(r=>r==="useContext"||r==="useUtils"?()=>{const a=t.useUtils();return q.useMemo(()=>pk(a),[a])}:t.hasOwnProperty(r)?t[r]:e[r])}function Sk(t){const e=bk();return wk(e)}const xt=Sk(),D2=["bg-blue-500","bg-emerald-500","bg-amber-500","bg-rose-500","bg-violet-500","bg-cyan-500","bg-pink-500","bg-lime-500","bg-teal-500","bg-orange-500"],O2=["bg-blue-500/15 text-blue-400","bg-emerald-500/15 text-emerald-400","bg-amber-500/15 text-amber-400","bg-rose-500/15 text-rose-400","bg-violet-500/15 text-violet-400","bg-cyan-500/15 text-cyan-400","bg-pink-500/15 text-pink-400","bg-lime-500/15 text-lime-400","bg-teal-500/15 text-teal-400","bg-orange-500/15 text-orange-400"],R2=["#3b82f6","#10b981","#f59e0b","#f43f5e","#8b5cf6","#06b6d4","#ec4899","#84cc16","#14b8a6","#f97316"];function Om(t){let e=0;for(let r=0;r<t.length;r++)e=e*31+t.charCodeAt(r)|0;return Math.abs(e)}function Ek(t){return D2[Om(t)%D2.length]}function nr(t){return O2[Om(t)%O2.length]}function B2(t){return R2[Om(t)%R2.length]}function so(t){if(!t)return"--";try{return new Date(t).toLocaleString()}catch{return String(t)}}function PT(t,e=80){const r=JSON.stringify(t);return r.length<=e?r:r.slice(0,e)+"..."}function Zt(t){return t?{scope:t}:{}}function xf(t,e,r,a){if(e===t.length&&a===r.length)return!0;if(a===r.length)return!1;const i=r[a];if(i==="**"){if(a===r.length-1)return!0;for(let s=0;s<=t.length-e;s++)if(xf(t,e+s,r,a+1))return!0;return!1}return e===t.length?!1:i==="*"||t[e]===i?xf(t,e+1,r,a+1):!1}function Tk(t,e){if(e==="root")return t==="";if(e==="**")return!0;const r=t===""?[]:t.split("/"),a=e.split("/");return xf(r,0,a,0)}function L2(t,e){return!e||e.length===0?!0:e.some(r=>Tk(t,r))}function zT(t,e){return t&&(!e||e.length===0)?!1:L2(t,e)}function P2(t,e){return e?t.split("/")[0]===e:!0}function ya(t){return t.replace(/\//g,"~2F")}function _T(t){return t.replace(/~2F/g,"/")}function UT(t,e){return e?t===e||t.startsWith(e+"/"):!1}function qT(t,e){return t===e?"":t.slice(e.length+1)}function IT(t){return t?t.split("/").filter((r,a)=>a%2===1).join("/"):""}function z2(t){if(!t)return[];const e=t.split("/"),r=[];for(let a=0;a+1<e.length;a+=2)r.push({parentUid:e[a],subgraphName:e[a+1]});return r}function Kg(t,e){const r=t.split("/"),a=e.split("/");if(r.length!==a.length)return null;const i={};for(let s=0;s<a.length;s++){const o=a[s],u=o.match(/^\{(.+)\}$/);if(u)i[u[1]]=r[s];else if(o!==r[s])return null}return i}function an(t,e){return t.replace(/\{([^}]+)\}/g,(r,a)=>e[a]??`{${a}}`)}function aa(t,e){const r=ya(t);return e?`/${r}/${e}`:`/${r}`}function nn(t,e,r){const a=new Set(e.map(i=>i.viewName));if(!t)return"json";if(r){const i=t[r];if(i&&a.has(i))return i}return t.default&&a.has(t.default)?t.default:"json"}const _2={edges:[],hasMore:!1,loading:!1},Rm=q.createContext(null);function Ck({children:t}){const[e,r]=q.useState(null),[a,i]=q.useState({out:_2,in:_2}),s=q.useRef(null),o=q.useCallback(p=>{s.current=p},[]),u=q.useCallback(p=>{var m;(m=s.current)==null||m.peek(p)},[]),d=q.useCallback(()=>{var p;(p=s.current)==null||p.clearPeek()},[]),f=q.useCallback((p,m)=>{i(y=>({...y,[p]:m}))},[]),h=q.useMemo(()=>({focused:e,setFocused:r,onPeekNearby:u,onClearPeek:d,registerCallbacks:o,edgeResults:a,setEdgeResults:f}),[e,r,u,d,o,a,f]);return g.jsx(Rm.Provider,{value:h,children:t})}function Nk(){const t=q.useContext(Rm);if(!t)throw new Error("useFocus must be used within a FocusProvider");return t}function Ro(){return q.useContext(Rm)}const Bm="firegraph:recents",jk=20,Ak=8;function Mk(){try{const t=localStorage.getItem(Bm);return t?JSON.parse(t):[]}catch{return[]}}function kk(t){try{localStorage.setItem(Bm,JSON.stringify(t))}catch{}}const VT=q.createContext(null);function Dk({children:t}){const[e,r]=q.useState(Mk),a=q.useCallback(u=>{r(d=>{const f=[{...u,timestamp:Date.now()},...d.filter(h=>h.url!==u.url)].slice(0,jk);return kk(f),f})},[]),i=q.useCallback(()=>{r([]);try{localStorage.removeItem(Bm)}catch{}},[]),s=q.useMemo(()=>e.slice(0,Ak),[e]),o=q.useMemo(()=>({recents:e,displayRecents:s,addRecent:a,clearRecents:i}),[e,s,a,i]);return g.jsx(VT.Provider,{value:o,children:t})}function rh(){const t=q.useContext(VT);if(!t)throw new Error("useRecents must be used within a RecentsProvider");return t}const Lm=q.createContext(null);function Ok({children:t,graphCollection:e,collections:r}){const{encodedPath:a}=Sm(),i=on(),s=a??"",o=q.useMemo(()=>_T(s),[s]),u=q.useMemo(()=>{if(r){for(const A of r)if(Kg(o,A.path))return"collection"}return UT(o,e)?"graph":"unknown"},[o,e,r]),d=q.useMemo(()=>u==="graph"&&e?qT(o,e):"",[u,o,e]),f=q.useMemo(()=>IT(d),[d]),h=q.useMemo(()=>z2(d),[d]),p=q.useMemo(()=>{if(u!=="collection"||!r)return null;for(const A of r){const D=Kg(o,A.path);if(D)return{collection:A,params:D}}return null},[u,o,r]),m=q.useMemo(()=>`/${s}`,[s]),y=q.useCallback(A=>{if(!A)return m;const D=A.startsWith("/")?A.slice(1):A;return`${m}/${D}`},[m]),x=q.useCallback((A,D)=>{const M=o+"/"+A+"/"+D;i(`/${ya(M)}`)},[i,o]),E=q.useCallback(()=>{const A=o.split("/");if(A.length<=1){i("/");return}if(u==="graph"&&A.length>=3){const D=A.slice(0,-2).join("/");i(`/${ya(D)}`)}else i("/")},[i,o,u]),w=q.useCallback(()=>{i(e?`/${ya(e)}`:"/")},[i,e]),T=w,C=q.useCallback(A=>{if(!e){i("/");return}if(A===0){i(`/${ya(e)}`);return}const j=z2(d).slice(0,A).map(B=>`${B.parentUid}/${B.subgraphName}`).join("/"),k=j?`${e}/${j}`:e;i(`/${ya(k)}`)},[i,e,d]),N=q.useMemo(()=>({firestorePath:o,encodedPath:s,pathType:u,graphScope:d,scopeNamesPath:f,scopeSegments:h,collectionMatch:p,pathUrl:y,enterSubgraph:x,navigateUp:E,navigateToRoot:w,scopePath:d,isScoped:d!=="",scopedPath:y,scopeUrlPrefix:m,exitToRoot:T,popToDepth:C}),[o,s,u,d,f,h,p,y,x,E,w,m,T,C]);return g.jsx(Lm.Provider,{value:N,children:t})}function FT(){const t=q.useContext(Lm);if(!t)throw new Error("usePath must be used within a PathProvider");return t}function Rk(){return q.useContext(Lm)}const ba=FT;function Bk({schema:t}){const{focused:e,onPeekNearby:r,onClearPeek:a,edgeResults:i}=Nk(),s=on(),o=q.useMemo(()=>e?{uid:e.uid,nodeType:e.nodeType,edgeType:"",direction:"out"}:{uid:"",nodeType:"",edgeType:"",direction:"out"},[e==null?void 0:e.uid,e==null?void 0:e.nodeType]);return e?g.jsxs("div",{className:"flex flex-col h-full overflow-auto",children:[g.jsx("div",{className:"px-3 py-2 border-b border-slate-800 shrink-0 cursor-pointer hover:bg-slate-800/50 transition-colors",onMouseEnter:()=>r(o),children:g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("span",{className:`px-1.5 py-0.5 rounded text-[9px] font-mono ${nr(e.nodeType)}`,children:e.nodeType}),g.jsx("span",{className:"text-[11px] font-mono text-slate-300 truncate",children:e.uid})]})}),g.jsx(U2,{direction:"out",results:i.out,schema:t,onPeek:r,onClearPeek:a,navigate:s}),g.jsx(U2,{direction:"in",results:i.in,schema:t,onPeek:r,onClearPeek:a,navigate:s})]}):g.jsxs("div",{className:"px-3 py-6 text-center",children:[g.jsx("svg",{className:"w-6 h-6 mx-auto mb-2 text-slate-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),g.jsx("p",{className:"text-[11px] text-slate-500",children:"Navigate to a node to explore nearby relationships"})]})}function U2({direction:t,results:e,schema:r,onPeek:a,onClearPeek:i,navigate:s}){const{edges:o,hasMore:u,loading:d}=e,f=q.useMemo(()=>{const m={};for(const y of r.edgeTypes)y.inverseLabel&&(m[y.axbType]=y.inverseLabel);return m},[r.edgeTypes]),h=q.useMemo(()=>{const m={};for(const y of o)m[y.axbType]||(m[y.axbType]=[]),m[y.axbType].push(y);return m},[o]),p=Object.entries(h);return d?g.jsxs("div",{className:"px-3 py-2",children:[g.jsx("h3",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold mb-1",children:t==="out"?"Outgoing":"Incoming"}),g.jsxs("div",{className:"flex items-center gap-1.5 py-1",children:[g.jsx("span",{className:"w-2.5 h-2.5 border border-slate-600 border-t-transparent rounded-full animate-spin"}),g.jsx("span",{className:"text-[10px] text-slate-600",children:"Loading..."})]})]}):g.jsxs("div",{className:"px-2 py-2",children:[g.jsx("h3",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold mb-1 px-1",children:t==="out"?"Outgoing":"Incoming"}),p.length===0?g.jsx("p",{className:"text-[10px] text-slate-600 px-1",children:"None"}):p.map(([m,y])=>g.jsx(Lk,{axbType:m,edges:y,direction:t,inverseLabel:t==="in"?f[m]:void 0,onPeek:a,onClearPeek:i,navigate:s},m)),u&&g.jsx("p",{className:"text-[10px] text-slate-600 px-1 mt-1",children:"and more..."})]})}function Lk({axbType:t,edges:e,direction:r,inverseLabel:a,onPeek:i,onClearPeek:s,navigate:o}){const[u,d]=q.useState(!0);return g.jsxs("div",{className:"mb-1",children:[g.jsxs("button",{onClick:()=>d(!u),className:"w-full flex items-center gap-1 px-1 py-0.5 rounded text-left hover:bg-slate-800/50 transition-colors group",children:[g.jsx("svg",{className:`w-3 h-3 text-slate-600 transition-transform ${u?"rotate-90":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),a?g.jsx("span",{className:"text-amber-400/80 text-[11px] font-mono cursor-help",title:`Inverse of: ${t}`,children:a}):g.jsx("span",{className:"text-indigo-400/80 text-[11px] font-mono",children:t}),g.jsxs("span",{className:"text-slate-600 text-[10px]",children:["(",e.length,")"]})]}),u&&g.jsx("div",{className:"ml-3 space-y-px",children:e.map(f=>{const h=r==="out"?f.bUid:f.aUid,p=r==="out"?f.bType:f.aType;return g.jsx(Pk,{targetUid:h,targetType:p,edgeType:f.axbType,direction:r,onPeek:i,onClearPeek:s,navigate:o},`${f.aUid}:${f.axbType}:${f.bUid}`)})})]})}function Pk({targetUid:t,targetType:e,edgeType:r,direction:a,onPeek:i,onClearPeek:s,navigate:o}){const{scopedPath:u}=ba(),d=q.useRef(null),f=q.useMemo(()=>({uid:t,nodeType:e,edgeType:r,direction:a}),[t,e,r,a]),h=q.useCallback(()=>{d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{d.current=null,i(f)},150)},[f,i]),p=q.useCallback(()=>{d.current&&(clearTimeout(d.current),d.current=null)},[]),m=q.useCallback(()=>{d.current&&(clearTimeout(d.current),d.current=null),s(),o(u(`/node/${encodeURIComponent(t)}`))},[t,s,o]);return q.useEffect(()=>()=>{d.current&&clearTimeout(d.current)},[]),g.jsxs("button",{onClick:m,onMouseEnter:h,onMouseLeave:p,className:"w-full flex items-center gap-1.5 px-2 py-1 rounded text-left transition-colors text-slate-400 hover:bg-slate-800 hover:text-slate-200",children:[g.jsx("span",{className:`px-1 py-px rounded text-[9px] font-mono shrink-0 ${nr(e)}`,children:e}),g.jsx("span",{className:"text-[11px] font-mono truncate",children:t})]})}function zk(t){const e=Math.floor((Date.now()-t)/1e3);return e<60?"just now":e<3600?`${Math.floor(e/60)}m ago`:e<86400?`${Math.floor(e/3600)}h ago`:`${Math.floor(e/86400)}d ago`}const _k={node:g.jsx("svg",{className:"w-3 h-3 shrink-0 text-indigo-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2V6zM14 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2V6zM4 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2v-2zM14 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2v-2z"})}),collection:g.jsx("svg",{className:"w-3 h-3 shrink-0 text-amber-500/80",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),"collection-doc":g.jsx("svg",{className:"w-3 h-3 shrink-0 text-amber-400/80",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})};function Uk({entry:t,onClose:e}){return g.jsxs(Qt,{to:t.url,onClick:e,className:"flex items-center gap-2 px-3 py-1.5 hover:bg-slate-800/50 transition-colors group",title:t.label,children:[_k[t.type],g.jsxs("span",{className:"flex-1 min-w-0",children:[g.jsx("span",{className:"block text-[11px] text-slate-300 truncate font-mono",children:t.label.length>14?`${t.label.slice(0,12)}…`:t.label}),t.sublabel&&g.jsx("span",{className:"block text-[9px] text-slate-500 truncate",children:t.sublabel})]}),g.jsx("span",{className:"text-[9px] text-slate-600 shrink-0 group-hover:text-slate-500",children:zk(t.timestamp)})]})}function q2({entries:t,triggerRef:e,onClose:r,onClear:a}){const i=q.useRef(null),[s,o]=q.useState(null);return q.useEffect(()=>{if(e.current){const u=e.current.getBoundingClientRect();o({top:u.top,left:u.right+8})}},[e]),q.useEffect(()=>{const u=d=>{const f=d.target;i.current&&!i.current.contains(f)&&e.current&&!e.current.contains(f)&&r()};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r,e]),s?$u.createPortal(g.jsxs("div",{ref:i,style:{position:"fixed",top:s.top,left:s.left,zIndex:9999},className:"w-64 bg-slate-900 border border-slate-700 rounded-xl shadow-xl shadow-black/50",onMouseLeave:r,children:[g.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-slate-800",children:[g.jsx("span",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold",children:"Recent"}),g.jsx("button",{onClick:u=>{u.stopPropagation(),a(),r()},className:"text-[10px] text-slate-600 hover:text-slate-400 transition-colors",children:"Clear"})]}),g.jsx("div",{className:"py-1 max-h-80 overflow-auto",children:t.map(u=>g.jsx(Uk,{entry:u,onClose:r},u.url+u.timestamp))})]}),document.body):null}function qk(t,e){const r=il();return q.useMemo(()=>{const a=r.pathname;if(a==="/")return{pathType:"root",firestorePath:"",encodedPath:"",graphScope:"",scopeNamesPath:"",isScoped:!1,collectionMatch:null,pageAction:"",isOnNodePage:!1};const i=a.slice(1),s=i.indexOf("/"),o=s>=0?i.slice(0,s):i,u=s>=0?i.slice(s):"",d=_T(o),f=u.startsWith("/node/");if(e)for(const h of e){const p=Kg(d,h.path);if(p)return{pathType:"collection",firestorePath:d,encodedPath:o,graphScope:"",scopeNamesPath:"",isScoped:!1,collectionMatch:{collection:h,params:p},pageAction:u,isOnNodePage:f}}if(UT(d,t)){const h=qT(d,t);return{pathType:"graph",firestorePath:d,encodedPath:o,graphScope:h,scopeNamesPath:IT(h),isScoped:h!=="",collectionMatch:null,pageAction:u,isOnNodePage:f}}return{pathType:"unknown",firestorePath:d,encodedPath:o,graphScope:"",scopeNamesPath:"",isScoped:!1,collectionMatch:null,pageAction:u,isOnNodePage:f}},[r.pathname,t,e])}function Ik({schema:t,config:e,viewRegistry:r}){var V;const a=il(),i=on(),[s,o]=q.useState(""),[u,d]=q.useState(!1),{displayRecents:f,clearRecents:h}=rh(),p=Ro(),m=q.useRef(null),y=qk(e.collection,t.collections),x=xt.useUtils(),E=xt.reloadSchema.useMutation({onSuccess:()=>{x.getSchema.invalidate(),x.getViews.invalidate(),x.getWarnings.invalidate()}}),[w,T]=q.useState(null),C=q.useCallback(_=>{if(!y.encodedPath)return"/";const H=`/${y.encodedPath}`;if(!_)return H;const z=_.startsWith("/")?_.slice(1):_;return`${H}/${z}`},[y.encodedPath]),N=q.useCallback((_,H)=>{const z=y.firestorePath+"/"+_+"/"+H;i(`/${ya(z)}`)},[i,y.firestorePath]),A=q.useCallback(()=>{e.collection?i(`/${ya(e.collection)}`):i("/")},[i,e.collection]),D=q.useMemo(()=>{const _=t.nodeSchemas??[];return t.nodeTypes.filter(H=>{const z=_.find(I=>I.aType===H.type&&I.isNodeEntry);return zT(y.scopeNamesPath,z==null?void 0:z.allowedIn)})},[t.nodeTypes,t.nodeSchemas,y.scopeNamesPath]),M=q.useCallback(_=>{_.preventDefault();const H=s.trim();H&&(y.pathType==="collection"&&y.collectionMatch?i(aa(y.firestorePath,`doc/${encodeURIComponent(H)}`)):i(C(`/node/${encodeURIComponent(H)}`)),o(""))},[s,y,i,C]),j=y.pathType==="graph"&&y.isOnNodePage&&!!(p!=null&&p.focused),k=q.useMemo(()=>{if(!(p!=null&&p.focused))return[];const _=[],H=new Set;for(const z of t.edgeTypes)z.aType===p.focused.nodeType&&z.targetGraph&&!H.has(z.targetGraph)&&(H.add(z.targetGraph),_.push({name:z.targetGraph,edgeType:z.axbType,targetType:z.bType}));return _},[t.edgeTypes,p==null?void 0:p.focused]),B=q.useMemo(()=>(t.collections??[]).filter(_=>{var H;return _.parentNodeType===((H=p==null?void 0:p.focused)==null?void 0:H.nodeType)&&P2(_.path,e.collection)}),[t.collections,(V=p==null?void 0:p.focused)==null?void 0:V.nodeType,e.collection]),P=q.useMemo(()=>(t.collections??[]).filter(_=>!_.parentNodeType&&P2(_.path,e.collection)),[t.collections,e.collection]),U=q.useMemo(()=>(t.collections??[]).filter(_=>!_.path.includes("/")),[t.collections]),R=q.useCallback(_=>{if(_.pathParams.length===0)return aa(_.path);const H={};return p!=null&&p.focused&&_.pathParams.length>0&&(H[_.pathParams[0]]=p.focused.uid),aa(an(_.path,H))},[p==null?void 0:p.focused]);return g.jsxs("aside",{className:"w-64 bg-slate-900 border-r border-slate-800 flex flex-col h-full shrink-0",children:[g.jsxs("div",{className:"p-4 border-b border-slate-800",children:[g.jsxs(Qt,{to:"/",className:"flex items-center gap-2 group",children:[g.jsx("div",{className:"w-7 h-7 bg-indigo-600 rounded-lg flex items-center justify-center text-xs font-bold",children:"FG"}),g.jsx("span",{className:"font-semibold text-sm group-hover:text-indigo-400 transition-colors",children:"Firegraph Editor"})]}),g.jsx("div",{className:"mt-2 text-[10px] text-slate-500 font-mono truncate",title:e.projectId,children:e.projectId}),y.isScoped&&g.jsxs("div",{className:"mt-1 flex items-center gap-1.5",children:[g.jsx("svg",{className:"w-3 h-3 text-indigo-400 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4"})}),g.jsx("span",{className:"text-[10px] text-indigo-400 font-mono truncate",title:y.graphScope,children:y.graphScope}),g.jsx("button",{onClick:A,className:"text-[9px] text-slate-500 hover:text-slate-300 underline shrink-0 transition-colors",children:"exit"})]}),(t.dynamicMode||t.readonly)&&g.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5",children:[t.dynamicMode&&g.jsx("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-medium bg-violet-500/15 text-violet-400",children:"Dynamic"}),t.readonly&&g.jsx("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-medium bg-slate-500/15 text-slate-400",children:"Read-Only"})]}),t.dynamicMode&&g.jsxs("div",{className:"mt-2",children:[g.jsxs("button",{onClick:()=>{T(null),E.mutate(void 0,{onSuccess:_=>{T(`Loaded ${_.nodeTypeCount} node, ${_.edgeTypeCount} edge types`),setTimeout(()=>T(null),3e3)},onError:_=>{T(`Error: ${_.message}`),setTimeout(()=>T(null),5e3)}})},disabled:E.isPending,className:"w-full flex items-center justify-center gap-1.5 px-2 py-1 rounded-md text-[10px] font-medium bg-violet-600/20 text-violet-300 hover:bg-violet-600/30 transition-colors disabled:opacity-50",children:[g.jsx("svg",{className:`w-3 h-3 ${E.isPending?"animate-spin":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),E.isPending?"Refreshing...":"Refresh Schemas"]}),w&&g.jsx("p",{className:`mt-1 text-[9px] ${E.isError?"text-red-400":"text-emerald-400"}`,children:w})]})]}),(y.pathType==="graph"||y.pathType==="collection")&&g.jsx("div",{className:"p-3 border-b border-slate-800",children:g.jsx("form",{onSubmit:M,children:g.jsx("input",{type:"text",value:s,onChange:_=>o(_.target.value),placeholder:y.pathType==="collection"?"Go to document by ID...":"Go to node by UID...",className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-xs text-slate-200 placeholder:text-slate-500 focus:outline-none focus:border-indigo-500 transition-colors"})})}),g.jsxs("nav",{className:"flex-1 overflow-auto p-3",children:[y.pathType==="root"&&g.jsxs("div",{className:"mb-4",children:[e.collection&&g.jsxs(g.Fragment,{children:[g.jsx("h3",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold mb-2 px-3",children:"Graphs"}),g.jsxs(Qt,{to:`/${ya(e.collection)}`,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs text-slate-400 hover:text-slate-200 hover:bg-slate-800 transition-colors",children:[g.jsx("svg",{className:"w-3.5 h-3.5 text-indigo-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4"})}),e.collection]})]}),U.length>0&&g.jsxs(g.Fragment,{children:[g.jsx("h3",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold mb-2 mt-3 px-3",children:"Collections"}),U.map(_=>g.jsxs(Qt,{to:aa(_.path),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs text-slate-400 hover:text-slate-200 hover:bg-slate-800/50 transition-colors",children:[g.jsx("svg",{className:"w-3 h-3 shrink-0 text-amber-500/70",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),g.jsx("span",{className:"flex-1 truncate",children:_.name})]},_.name))]})]}),y.pathType==="graph"&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"mb-4",children:[g.jsxs(Qt,{to:C(),className:`flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors ${a.pathname===C()?"bg-indigo-600/20 text-indigo-400":"text-slate-400 hover:text-slate-200 hover:bg-slate-800"}`,children:[g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2V6zM14 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2V6zM4 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2v-2zM14 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2v-2z"})}),"Graph"]}),g.jsxs(Qt,{to:C("/traverse"),className:`flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors ${a.pathname===C("/traverse")?"bg-indigo-600/20 text-indigo-400":"text-slate-400 hover:text-slate-200 hover:bg-slate-800"}`,children:[g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),"Traverse"]}),(r==null?void 0:r.hasViews)&&g.jsxs(Qt,{to:C("/views"),className:`flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors ${a.pathname===C("/views")?"bg-indigo-600/20 text-indigo-400":"text-slate-400 hover:text-slate-200 hover:bg-slate-800"}`,children:[g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 5a1 1 0 011-1h14a1 1 0 011 1v2a1 1 0 01-1 1H5a1 1 0 01-1-1V5zM4 13a1 1 0 011-1h6a1 1 0 011 1v6a1 1 0 01-1 1H5a1 1 0 01-1-1v-6zM16 13a1 1 0 011-1h2a1 1 0 011 1v6a1 1 0 01-1 1h-2a1 1 0 01-1-1v-6z"})}),"Views"]}),f.length>0&&g.jsxs(g.Fragment,{children:[g.jsxs("button",{ref:m,onClick:()=>d(_=>!_),onMouseEnter:()=>d(!0),className:`flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors w-full text-left ${u?"bg-slate-800 text-slate-200":"text-slate-400 hover:text-slate-200 hover:bg-slate-800"}`,children:[g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Recent"]}),u&&g.jsx(q2,{entries:f,triggerRef:m,onClose:()=>d(!1),onClear:h})]})]}),j?g.jsx("div",{className:"mb-4",children:g.jsx(Bk,{schema:t})}):g.jsxs("div",{className:"mb-4",children:[g.jsx("h3",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold mb-2 px-3",children:"Nodes"}),D.length===0?g.jsx("p",{className:"text-xs text-slate-600 px-3",children:t.nodeTypes.length===0?"No nodes registered":"No nodes allowed in this scope"}):D.map(_=>g.jsxs(Qt,{to:C(`/browse/${encodeURIComponent(_.type)}`),className:`flex items-center justify-between px-3 py-1.5 rounded-lg text-xs transition-colors ${a.pathname===C(`/browse/${encodeURIComponent(_.type)}`)?"bg-slate-800 text-slate-100":"text-slate-400 hover:text-slate-200 hover:bg-slate-800/50"}`,children:[g.jsxs("span",{className:"flex items-center gap-2",children:[g.jsx("span",{className:`w-2 h-2 rounded-full ${Ek(_.type)}`}),_.type]}),_.isDynamic&&g.jsx("span",{className:"px-1 py-px rounded text-[8px] font-semibold bg-violet-500/20 text-violet-400",title:"Dynamic type (from Firestore)",children:"D"})]},_.type))]})]}),y.pathType==="collection"&&g.jsx("div",{className:"mb-4",children:f.length>0&&g.jsxs(g.Fragment,{children:[g.jsxs("button",{ref:m,onClick:()=>d(_=>!_),onMouseEnter:()=>d(!0),className:`flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors w-full text-left ${u?"bg-slate-800 text-slate-200":"text-slate-400 hover:text-slate-200 hover:bg-slate-800"}`,children:[g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Recent"]}),u&&g.jsx(q2,{entries:f,triggerRef:m,onClose:()=>d(!1),onClear:h})]})}),j&&(k.length>0||B.length>0)&&g.jsxs("div",{className:"mb-4",children:[k.length>0&&g.jsxs(g.Fragment,{children:[g.jsx("h3",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold mb-2 px-3",children:"Subgraphs"}),k.map(_=>g.jsxs("button",{onClick:()=>(p==null?void 0:p.focused)&&N(p.focused.uid,_.name),className:"w-full flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs text-slate-400 hover:text-slate-200 hover:bg-slate-800/50 transition-colors text-left",children:[g.jsx("svg",{className:"w-3 h-3 shrink-0 text-indigo-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4"})}),g.jsx("span",{className:"flex-1 truncate",children:_.name})]},_.name))]}),B.length>0&&g.jsxs(g.Fragment,{children:[g.jsx("h3",{className:`text-[10px] uppercase tracking-wider text-slate-500 font-semibold mb-2 px-3 ${k.length>0?"mt-3":""}`,children:"Collections"}),B.map(_=>g.jsxs(Qt,{to:R(_),className:`flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors ${a.pathname.startsWith(R(_))?"bg-slate-800 text-slate-100":"text-slate-400 hover:text-slate-200 hover:bg-slate-800/50"}`,children:[g.jsx("svg",{className:"w-3 h-3 shrink-0 text-amber-500/70",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),g.jsx("span",{className:"flex-1 truncate",children:_.name})]},_.name))]})]}),!j&&P.length>0&&g.jsxs("div",{children:[g.jsx("h3",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold mb-2 px-3",children:"Collections"}),P.map(_=>g.jsxs(Qt,{to:aa(_.path),className:`flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors ${a.pathname.startsWith(aa(_.path))?"bg-slate-800 text-slate-100":"text-slate-400 hover:text-slate-200 hover:bg-slate-800/50"}`,children:[g.jsx("svg",{className:"w-3 h-3 shrink-0 text-amber-500/70",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),g.jsx("span",{className:"flex-1 truncate",children:_.name}),_.pathParams.length>0&&g.jsx("span",{className:"text-[9px] text-slate-600 shrink-0",children:_.pathParams.map(H=>`{${H}}`).join("/")})]},_.name))]})]}),g.jsx("div",{className:"p-3 border-t border-slate-800"})]})}function Vk(){const t=Rk();if(!t||!t.isScoped)return null;const{scopeSegments:e,firestorePath:r}=t,i=r.split("/")[0];return g.jsxs("nav",{className:"flex items-center px-4 py-2 bg-indigo-950/40 border-b border-indigo-500/20 text-xs gap-1 flex-wrap",children:[g.jsx("svg",{className:"w-3.5 h-3.5 text-indigo-400 mr-1 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4"})}),g.jsx(Qt,{to:`/${ya(i)}`,className:"text-indigo-400 hover:text-indigo-300 font-medium transition-colors",children:i}),e.map((s,o)=>{const u=[i];for(let p=0;p<o;p++)u.push(e[p].parentUid,e[p].subgraphName);const d=u.join("/"),h=[...u,s.parentUid,s.subgraphName].join("/");return g.jsxs("span",{className:"flex items-center gap-1",children:[g.jsx("span",{className:"text-slate-600",children:"/"}),g.jsx(Qt,{to:`/${ya(d)}/node/${encodeURIComponent(s.parentUid)}`,className:"text-slate-400 hover:text-slate-200 font-mono transition-colors",title:s.parentUid,children:s.parentUid.length>10?`${s.parentUid.slice(0,8)}…`:s.parentUid}),g.jsx("span",{className:"text-slate-600",children:"/"}),g.jsx(Qt,{to:`/${ya(h)}`,className:"text-indigo-400 hover:text-indigo-300 font-medium transition-colors",children:s.subgraphName})]},o)})]})}function Fk({warnings:t}){const[e,r]=q.useState(!1),[a,i]=q.useState(!1);return t.length===0||a?null:g.jsx("div",{className:"mx-6 mt-4",children:g.jsxs("div",{className:"bg-amber-500/10 border border-amber-500/30 rounded-lg px-4 py-3",children:[g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsxs("button",{onClick:()=>r(!e),className:"flex items-center gap-2 text-left",children:[g.jsx("svg",{className:"w-4 h-4 text-amber-400 shrink-0",fill:"none",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"})}),g.jsxs("span",{className:"text-amber-400 text-sm font-medium",children:[t.length," schema/views warning",t.length!==1?"s":""]}),g.jsx("svg",{className:`w-3.5 h-3.5 text-amber-400/60 transition-transform ${e?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"})})]}),g.jsx("button",{onClick:()=>i(!0),className:"text-amber-400/40 hover:text-amber-400/70 transition-colors p-1",title:"Dismiss",children:g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18 18 6M6 6l12 12"})})})]}),e&&g.jsx("ul",{className:"mt-3 space-y-1.5",children:t.map((s,o)=>g.jsxs("li",{className:"text-xs text-amber-300/80 flex items-start gap-2",children:[g.jsx("span",{className:"shrink-0 mt-1 w-1.5 h-1.5 rounded-full bg-amber-400"}),g.jsxs("span",{children:[g.jsxs("span",{className:"text-amber-400/50 font-mono mr-1",children:["[",s.code,"]"]}),s.message]})]},o))})]})})}class Hk{constructor(e){kp(this,"baseUrl");this.baseUrl=e??""}async request(e){const r=await fetch(`${this.baseUrl}/api/chat`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!r.ok){const i=await r.json().catch(()=>({}));throw new Error(i.error??`HTTP ${r.status}`)}const{requestId:a}=await r.json();return new Gk(this.baseUrl,a)}async status(){const e=await fetch(`${this.baseUrl}/api/chat/status`);if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}async health(){try{const e=await fetch(`${this.baseUrl}/api/chat/status`,{signal:AbortSignal.timeout(3e3)});return e.ok?(await e.json()).enabled:!1}catch{return!1}}}class Gk{constructor(e,r){this.baseUrl=e,this.requestId=r}async*stream(){const e=`${this.baseUrl}/api/chat/stream?requestId=${this.requestId}`,r=await fetch(e,{headers:{Accept:"text/event-stream"}});if(!r.ok||!r.body)throw new Error("Failed to open SSE stream");const a=r.body.getReader(),i=new TextDecoder;let s="",o=null;try{for(;;){const{value:u,done:d}=await a.read();if(d)break;s+=i.decode(u,{stream:!0});const f=s.split(`
77
+
78
+ `);s=f.pop()??"";for(const h of f){const p=h.split(`
79
+ `);let m="",y="";for(const x of p)x.startsWith("event: ")?m=x.slice(7):x.startsWith("data: ")&&(y=x.slice(6));if(m==="chunk"&&y)yield{kind:"text",text:JSON.parse(y).text};else if(m==="artifact"&&y)yield{kind:"artifact",artifact:JSON.parse(y)};else if(m==="tool_start"&&y)yield{kind:"tool_start",command:JSON.parse(y).command};else if(m==="session"&&y)o=JSON.parse(y).sessionId;else{if(m==="done")return{sessionId:o};if(m==="error"&&y)throw new Error(JSON.parse(y).message)}}}}finally{a.cancel()}return{sessionId:o}}}const HT=q.createContext(null),Pm="fg-chat-history",Fp="fg-chat-session";function I2(){return Date.now().toString(36)+Math.random().toString(36).slice(2,8)}function Qk(){try{const t=sessionStorage.getItem(Pm);if(t)return JSON.parse(t).map(r=>({...r,streaming:!1,activeToolCall:null}))}catch{}return[]}function $k(t){try{sessionStorage.setItem(Pm,JSON.stringify(t))}catch{}}function Yk({chatEnabled:t,children:e}){const[r,a]=q.useState(Qk),[i,s]=q.useState(t?"checking":"disconnected"),[o,u]=q.useState(!1),[d,f]=q.useState(()=>{try{return sessionStorage.getItem(Fp)}catch{return null}}),h=q.useRef(null);q.useEffect(()=>{t?(h.current=new Hk,s("checking")):(h.current=null,s("disconnected"))},[t]),q.useEffect(()=>{$k(r)},[r]),q.useEffect(()=>{try{d?sessionStorage.setItem(Fp,d):sessionStorage.removeItem(Fp)}catch{}},[d]),q.useEffect(()=>{if(!h.current)return;let y=!0;const x=h.current,E=async()=>{const T=await x.health();y&&s(T?"connected":"disconnected")};E();const w=setInterval(E,3e4);return()=>{y=!1,clearInterval(w)}},[t]);const p=q.useCallback(async(y,x)=>{var N;const E=h.current;if(!E||o)return;const w={id:I2(),role:"user",content:y,timestamp:new Date().toISOString()},T=I2(),C={id:T,role:"assistant",content:"",timestamp:new Date().toISOString(),streaming:!0};a(A=>[...A,w,C]),u(!0);try{const D=(await E.request({prompt:y,context:x,sessionId:d??void 0})).stream();let M=await D.next();for(;!M.done;){const j=M.value;j.kind==="text"?a(k=>k.map(B=>B.id===T?{...B,content:B.content+j.text}:B)):j.kind==="artifact"?a(k=>k.map(B=>B.id===T?{...B,artifacts:[...B.artifacts??[],j.artifact],activeToolCall:null}:B)):j.kind==="tool_start"&&a(k=>k.map(B=>B.id===T?{...B,activeToolCall:j.command}:B)),M=await D.next()}(N=M.value)!=null&&N.sessionId&&f(M.value.sessionId),a(j=>j.map(k=>k.id===T?{...k,streaming:!1,activeToolCall:null}:k))}catch(A){const D=A instanceof Error?A.message:"Unknown error";a(M=>M.map(j=>j.id===T?{...j,role:"error",content:D,streaming:!1}:j))}finally{u(!1)}},[o,d]),m=q.useCallback(()=>{a([]),sessionStorage.removeItem(Pm),f(null)},[]);return g.jsx(HT.Provider,{value:{messages:r,status:i,isStreaming:o,sendMessage:p,clearHistory:m,chatEnabled:t},children:e})}function Kk(){const t=q.useContext(HT);if(!t)throw new Error("useChat must be used within ChatProvider");return t}const GT=q.createContext(null);function Xk({children:t}){const[e,r]=q.useState(null),a=q.useCallback(s=>{r(s)},[]),i=q.useCallback(()=>{r(null)},[]);return g.jsx(GT.Provider,{value:{activeArtifact:e,showArtifact:a,dismissArtifact:i},children:t})}function Zk(){const t=q.useContext(GT);if(!t)throw new Error("useArtifact must be used within ArtifactProvider");return t}const QT=q.createContext(null);function Wk({children:t}){const[e,r]=q.useState("collapsed"),a=q.useCallback(()=>r("expanded"),[]),i=q.useCallback(()=>r("collapsed"),[]);return g.jsx(QT.Provider,{value:{mode:e,expand:a,collapse:i},children:t})}function Jk(){const t=q.useContext(QT);if(!t)throw new Error("useChatBar must be used within ChatBarProvider");return t}function eD(t,e){var a;const r={};if(t!=null&&t.focused){r.focusedNode={uid:t.focused.uid,nodeType:t.focused.nodeType};const i=(a=e.nodeSchemas)==null?void 0:a.find(s=>s.aType===t.focused.nodeType&&s.isNodeEntry);if(i&&(r.nodeSchema={type:i.aType,description:i.description,fields:i.fields.map(s=>({name:s.name,type:s.type,required:s.required,description:s.description,enumValues:s.enumValues}))}),t.edgeResults.out.edges.length>0){const s={};for(const o of t.edgeResults.out.edges){const u=o.axbType;s[u]||(s[u]={targetType:o.bType,count:0}),s[u].count++}r.outgoingEdges=Object.entries(s).map(([o,u])=>({axbType:o,targetType:u.targetType,count:u.count,hasMore:t.edgeResults.out.hasMore}))}if(t.edgeResults.in.edges.length>0){const s={};for(const o of t.edgeResults.in.edges){const u=o.axbType;s[u]||(s[u]={sourceType:o.aType,count:0}),s[u].count++}r.incomingEdges=Object.entries(s).map(([o,u])=>({axbType:o,sourceType:u.sourceType,count:u.count,hasMore:t.edgeResults.in.hasMore}))}}return r.graphTopology=e.edgeTypes.map(i=>({aType:i.aType,axbType:i.axbType,bType:i.bType,inverseLabel:i.inverseLabel})),r}function tD(t){const e=t.data;switch(t.kind){case"node-detail":{const r=e.node,a=Array.isArray(e.outEdges)?e.outEdges.length:0,i=Array.isArray(e.inEdges)?e.inEdges.length:0;return{icon:"●",label:r?`${r.type}:${r.uid}`:"Node not found",detail:`${a+i} edges`}}case"nodes-list":return{icon:"≡",label:`${(Array.isArray(e.nodes)?e.nodes:[]).length} nodes`,detail:e.hasMore?"has more":""};case"edges-list":return{icon:"→",label:`${(Array.isArray(e.edges)?e.edges:[]).length} edges`,detail:e.hasMore?"has more":""};case"traverse":return{icon:"⚡",label:`Traversal: ${(Array.isArray(e.hops)?e.hops:[]).length} hops`,detail:`${e.totalReads??0} reads`};case"search":return{icon:"⌕",label:`${(Array.isArray(e.results)?e.results:[]).length} results`,detail:"search"};case"schema":{const r=Array.isArray(e.nodeTypes)?e.nodeTypes:[],a=Array.isArray(e.edgeTypes)?e.edgeTypes:[];return{icon:"⊞",label:`${r.length} node types`,detail:`${a.length} edge types`}}default:return{icon:"?",label:"Query result",detail:""}}}function Oa({data:t,defaultExpanded:e=!0,depth:r=0}){const[a,i]=q.useState(e&&r<2);if(t===null)return g.jsx("span",{className:"text-slate-500",children:"null"});if(t===void 0)return g.jsx("span",{className:"text-slate-500",children:"undefined"});if(typeof t=="string")return g.jsxs("span",{className:"text-emerald-400",children:['"',t,'"']});if(typeof t=="number")return g.jsx("span",{className:"text-amber-400",children:t});if(typeof t=="boolean")return g.jsx("span",{className:"text-violet-400",children:String(t)});if(Array.isArray(t))return t.length===0?g.jsx("span",{className:"text-slate-500",children:"[]"}):g.jsxs("span",{children:[g.jsx("button",{onClick:()=>i(!a),className:"text-slate-500 hover:text-slate-300 transition-colors",children:a?"[▾":`[▸ ${t.length} items]`}),a&&g.jsx("div",{className:"ml-4 border-l border-slate-800 pl-3",children:t.map((s,o)=>g.jsxs("div",{className:"py-0.5",children:[g.jsx("span",{className:"text-slate-600 text-xs mr-2",children:o}),g.jsx(Oa,{data:s,depth:r+1}),o<t.length-1&&g.jsx("span",{className:"text-slate-600",children:","})]},o))}),a&&g.jsx("span",{className:"text-slate-500",children:"]"})]});if(typeof t=="object"){const s=Object.entries(t);return s.length===0?g.jsx("span",{className:"text-slate-500",children:"{}"}):g.jsxs("span",{children:[g.jsx("button",{onClick:()=>i(!a),className:"text-slate-500 hover:text-slate-300 transition-colors",children:a?"{▾":`{▸ ${s.length} keys}`}),a&&g.jsx("div",{className:"ml-4 border-l border-slate-800 pl-3",children:s.map(([o,u],d)=>g.jsxs("div",{className:"py-0.5",children:[g.jsx("span",{className:"text-cyan-400",children:o}),g.jsx("span",{className:"text-slate-600",children:": "}),g.jsx(Oa,{data:u,depth:r+1}),d<s.length-1&&g.jsx("span",{className:"text-slate-600",children:","})]},o))}),a&&g.jsx("span",{className:"text-slate-500",children:"}"})]})}return g.jsx("span",{className:"text-slate-400",children:String(t)})}function rD({tagName:t,data:e,className:r,onError:a}){const i=q.useRef(null),s=q.useRef(null),o=q.useRef(a);return o.current=a,q.useEffect(()=>{var d,f;const u=i.current;if(u)try{if(!customElements.get(t)){console.warn(`[CustomView] <${t}> is not registered, falling back to JSON.`),s.current=null,(d=o.current)==null||d.call(o);return}if(!s.current||s.current.tagName.toLowerCase()!==t){u.innerHTML="";const h=document.createElement(t);h.style.display="block",u.appendChild(h),s.current=h}s.current.data=e}catch(h){console.error(`[CustomView] Error rendering <${t}>:`,h),u.innerHTML="",s.current=null,(f=o.current)==null||f.call(o)}},[t,e]),q.useEffect(()=>()=>{i.current&&(i.current.innerHTML=""),s.current=null},[]),g.jsx("div",{ref:i,className:r})}class aD extends q.Component{constructor(){super(...arguments);kp(this,"state",{error:null})}static getDerivedStateFromError(r){return{error:r}}componentDidCatch(r){var a,i;console.error("[CustomView] Boundary caught error:",r),(i=(a=this.props).onError)==null||i.call(a)}render(){return this.state.error?null:this.props.children}}function Jn(t){return g.jsx(aD,{...t,children:g.jsx(rD,{...t})})}function Ao({views:t,activeView:e,onSwitch:r}){return t.length===0?null:g.jsxs("select",{value:e,onChange:a=>r(a.target.value),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-xs text-slate-200 focus:outline-none focus:border-indigo-500",children:[g.jsx("option",{value:"json",children:"JSON"}),t.map(a=>g.jsx("option",{value:a.tagName,children:a.viewName},a.tagName))]})}let zm=0;function Ps(){return`lane-${++zm}`}function Lf(t){return{uid:t,nodeType:"",edgeType:"",direction:"out"}}function nD(t,e){switch(e.type){case"RESET":{zm=0;const r=Ps();return{lanes:[{id:r,frames:[Lf(e.rootUid)]}],activeLaneId:r,previewLaneId:void 0}}case"EXTEND_LANE":return{lanes:t.lanes.map(r=>r.id===e.laneId?{...r,frames:[...r.frames,e.frame]}:r),activeLaneId:e.laneId};case"EXTEND_PATH":return{lanes:t.lanes.map(r=>r.id===e.laneId?{...r,frames:[...r.frames,...e.frames]}:r),activeLaneId:e.laneId};case"FORK_AND_DRILL":{const r=t.lanes.find(i=>i.id===e.fromLaneId);if(!r)return t;const a={id:e.newLaneId,frames:[...r.frames.slice(0,e.fromIndex+1),e.frame]};return{lanes:[...t.lanes,a],activeLaneId:e.newLaneId}}case"FORK_AND_DRILL_PATH":{const r=t.lanes.find(i=>i.id===e.fromLaneId);if(!r)return t;const a={id:e.newLaneId,frames:[...r.frames.slice(0,e.fromIndex+1),...e.frames]};return{lanes:[...t.lanes,a],activeLaneId:e.newLaneId}}case"CREATE_LANE":return{lanes:[...t.lanes,{id:e.newLaneId,frames:e.frames}],activeLaneId:e.newLaneId};case"POP_TO":return{lanes:t.lanes.map(r=>r.id===e.laneId?{...r,frames:r.frames.slice(0,e.index+1)}:r),activeLaneId:e.laneId};case"CLOSE_LANE":{const r=t.lanes.filter(a=>a.id!==e.laneId);if(r.length===0){const a=Ps();return{lanes:[{id:a,frames:[Lf(e.rootUid)]}],activeLaneId:a}}return{lanes:r,activeLaneId:t.activeLaneId===e.laneId?r[0].id:t.activeLaneId}}case"SWITCH_LANE":return{...t,activeLaneId:e.laneId};case"SET_ROOT_TYPE":return{...t,lanes:t.lanes.map(r=>{var i;if(((i=r.frames[0])==null?void 0:i.nodeType)===e.nodeType)return r;const a=[...r.frames];return a[0]={...a[0],nodeType:e.nodeType},{...r,frames:a}})};case"PREVIEW_FRAME":{let r=t.lanes;t.previewLaneId&&(r=r.map(i=>i.id===t.previewLaneId?{...i,frames:i.frames.slice(0,-1)}:i));const a=r.find(i=>i.id===e.laneId);return a&&a.frames.some(i=>i.uid===e.frame.uid)?{...t,lanes:r,previewLaneId:void 0}:{...t,lanes:r.map(i=>i.id===e.laneId?{...i,frames:[...i.frames,e.frame]}:i),previewLaneId:e.laneId}}case"CLEAR_PREVIEW":return t.previewLaneId?{...t,lanes:t.lanes.map(r=>r.id===t.previewLaneId?{...r,frames:r.frames.slice(0,-1)}:r),previewLaneId:void 0}:t;case"COMMIT_PREVIEW":return{...t,previewLaneId:void 0};default:return t}}const _m=q.createContext(null),Um=q.createContext(null);function iD({rootUid:t,initialPaths:e,children:r}){const[a,i]=q.useReducer(nD,{rootUid:t,initialPaths:e},M=>{if(zm=0,M.initialPaths&&M.initialPaths.length>0){const k=M.initialPaths.map(B=>({id:Ps(),frames:[Lf(M.rootUid),...B]}));return{lanes:k,activeLaneId:k[0].id,previewLaneId:void 0}}const j=Ps();return{lanes:[{id:j,frames:[Lf(M.rootUid)]}],activeLaneId:j,previewLaneId:void 0}}),s=q.useRef(t);q.useEffect(()=>{s.current!==t&&(s.current=t,i({type:"RESET",rootUid:t}))},[t]);const o=q.useMemo(()=>a.lanes.find(M=>M.id===a.activeLaneId)??a.lanes[0],[a.lanes,a.activeLaneId]),u=q.useCallback(M=>{i({type:"EXTEND_LANE",laneId:a.activeLaneId,frame:M})},[a.activeLaneId]),d=q.useCallback(M=>{M.length!==0&&i({type:"EXTEND_PATH",laneId:a.activeLaneId,frames:M})},[a.activeLaneId]),f=q.useCallback((M,j)=>{i({type:"EXTEND_LANE",laneId:M,frame:j})},[]),h=q.useCallback((M,j)=>{j.length!==0&&i({type:"EXTEND_PATH",laneId:M,frames:j})},[]),p=q.useCallback((M,j,k)=>{const B=Ps();i({type:"FORK_AND_DRILL",fromLaneId:M,fromIndex:j,frame:k,newLaneId:B})},[]),m=q.useCallback((M,j,k)=>{if(k.length===0)return;const B=Ps();i({type:"FORK_AND_DRILL_PATH",fromLaneId:M,fromIndex:j,frames:k,newLaneId:B})},[]),y=q.useCallback(M=>{if(M.length===0)return;const j=Ps();i({type:"CREATE_LANE",newLaneId:j,frames:M})},[]),x=q.useCallback((M,j)=>{i({type:"POP_TO",laneId:M,index:j})},[]),E=q.useCallback(M=>{i({type:"CLOSE_LANE",laneId:M,rootUid:t})},[t]),w=q.useCallback(M=>{i({type:"SWITCH_LANE",laneId:M})},[]),T=q.useCallback(M=>{i({type:"SET_ROOT_TYPE",nodeType:M})},[]),C=q.useCallback(M=>{i({type:"PREVIEW_FRAME",laneId:a.activeLaneId,frame:M})},[a.activeLaneId]),N=q.useCallback(()=>{i({type:"CLEAR_PREVIEW"})},[]),A=q.useCallback(()=>{i({type:"COMMIT_PREVIEW"})},[]),D=q.useMemo(()=>({lanes:a.lanes,activeLaneId:a.activeLaneId,activeLane:o,activeIndex:o.frames.length-1,previewLaneId:a.previewLaneId,drillIn:u,drillPath:d,extendLane:f,extendPath:h,forkAndDrill:p,forkAndDrillPath:m,createLane:y,popTo:x,closeLane:E,switchLane:w,setRootType:T,previewFrame:C,clearPreview:N,commitPreview:A}),[a.lanes,a.activeLaneId,a.previewLaneId,o,u,d,f,h,p,m,y,x,E,w,T,C,N,A]);return g.jsx(_m.Provider,{value:D,children:r})}function ah(){const t=q.useContext(_m);if(!t)throw new Error("useDrill must be used within a DrillProvider");const e=q.useContext(Um);return e?{...t,...e}:t}function $T(){const t=q.useContext(_m),e=q.useContext(Um);return t?e?{...t,...e}:t:null}function Xg(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,a=Array(e);r<e;r++)a[r]=t[r];return a}function sD(t){if(Array.isArray(t))return t}function lD(t){if(Array.isArray(t))return Xg(t)}function cs(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function oD(t,e){for(var r=0;r<e.length;r++){var a=e[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,KT(a.key),a)}}function ds(t,e,r){return e&&oD(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function xa(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=qm(t))||e){r&&(t=r);var a=0,i=function(){};return{s:i,n:function(){return a>=t.length?{done:!0}:{done:!1,value:t[a++]}},e:function(d){throw d},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
80
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s,o=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var d=r.next();return o=d.done,d},e:function(d){u=!0,s=d},f:function(){try{o||r.return==null||r.return()}finally{if(u)throw s}}}}function YT(t,e,r){return(e=KT(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function uD(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function cD(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var a,i,s,o,u=[],d=!0,f=!1;try{if(s=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;d=!1}else for(;!(d=(a=s.call(r)).done)&&(u.push(a.value),u.length!==e);d=!0);}catch(h){f=!0,i=h}finally{try{if(!d&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(f)throw i}}return u}}function dD(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
81
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fD(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
82
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function mr(t,e){return sD(t)||cD(t,e)||qm(t,e)||dD()}function Pf(t){return lD(t)||uD(t)||qm(t)||fD()}function hD(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 KT(t){var e=hD(t,"string");return typeof e=="symbol"?e:e+""}function Er(t){"@babel/helpers - typeof";return Er=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},Er(t)}function qm(t,e){if(t){if(typeof t=="string")return Xg(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)?Xg(t,e):void 0}}var wr=typeof window>"u"?null:window,V2=wr?wr.navigator:null;wr&&wr.document;var vD=Er(""),XT=Er({}),pD=Er(function(){}),gD=typeof HTMLElement>"u"?"undefined":Er(HTMLElement),Ec=function(e){return e&&e.instanceString&&Wt(e.instanceString)?e.instanceString():null},Xe=function(e){return e!=null&&Er(e)==vD},Wt=function(e){return e!=null&&Er(e)===pD},_t=function(e){return!Da(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},wt=function(e){return e!=null&&Er(e)===XT&&!_t(e)&&e.constructor===Object},mD=function(e){return e!=null&&Er(e)===XT},De=function(e){return e!=null&&Er(e)===Er(1)&&!isNaN(e)},yD=function(e){return De(e)&&Math.floor(e)===e},zf=function(e){if(gD!=="undefined")return e!=null&&e instanceof HTMLElement},Da=function(e){return Tc(e)||ZT(e)},Tc=function(e){return Ec(e)==="collection"&&e._private.single},ZT=function(e){return Ec(e)==="collection"&&!e._private.single},Im=function(e){return Ec(e)==="core"},WT=function(e){return Ec(e)==="stylesheet"},xD=function(e){return Ec(e)==="event"},rs=function(e){return e==null?!0:!!(e===""||e.match(/^\s+$/))},bD=function(e){return typeof HTMLElement>"u"?!1:e instanceof HTMLElement},wD=function(e){return wt(e)&&De(e.x1)&&De(e.x2)&&De(e.y1)&&De(e.y2)},SD=function(e){return mD(e)&&Wt(e.then)},ED=function(){return V2&&V2.userAgent.match(/msie|trident|edge/i)},Mo=function(e,r){r||(r=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var s=[],o=0;o<arguments.length;o++)s.push(arguments[o]);return s.join("$")});var a=function(){var s=this,o=arguments,u,d=r.apply(s,o),f=a.cache;return(u=f[d])||(u=f[d]=e.apply(s,o)),u};return a.cache={},a},Vm=Mo(function(t){return t.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),nh=Mo(function(t){return t.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),JT=Mo(function(t,e){return t+e[0].toUpperCase()+e.substring(1)},function(t,e){return t+"$"+e}),F2=function(e){return rs(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},Yi=function(e,r){return e.slice(-1*r.length)===r},Sr="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",TD="rgb[a]?\\(("+Sr+"[%]?)\\s*,\\s*("+Sr+"[%]?)\\s*,\\s*("+Sr+"[%]?)(?:\\s*,\\s*("+Sr+"))?\\)",CD="rgb[a]?\\((?:"+Sr+"[%]?)\\s*,\\s*(?:"+Sr+"[%]?)\\s*,\\s*(?:"+Sr+"[%]?)(?:\\s*,\\s*(?:"+Sr+"))?\\)",ND="hsl[a]?\\(("+Sr+")\\s*,\\s*("+Sr+"[%])\\s*,\\s*("+Sr+"[%])(?:\\s*,\\s*("+Sr+"))?\\)",jD="hsl[a]?\\((?:"+Sr+")\\s*,\\s*(?:"+Sr+"[%])\\s*,\\s*(?:"+Sr+"[%])(?:\\s*,\\s*(?:"+Sr+"))?\\)",AD="\\#[0-9a-fA-F]{3}",MD="\\#[0-9a-fA-F]{6}",eC=function(e,r){return e<r?-1:e>r?1:0},kD=function(e,r){return-1*eC(e,r)},tt=Object.assign!=null?Object.assign.bind(Object):function(t){for(var e=arguments,r=1;r<e.length;r++){var a=e[r];if(a!=null)for(var i=Object.keys(a),s=0;s<i.length;s++){var o=i[s];t[o]=a[o]}}return t},DD=function(e){if(!(!(e.length===4||e.length===7)||e[0]!=="#")){var r=e.length===4,a,i,s,o=16;return r?(a=parseInt(e[1]+e[1],o),i=parseInt(e[2]+e[2],o),s=parseInt(e[3]+e[3],o)):(a=parseInt(e[1]+e[2],o),i=parseInt(e[3]+e[4],o),s=parseInt(e[5]+e[6],o)),[a,i,s]}},OD=function(e){var r,a,i,s,o,u,d,f;function h(x,E,w){return w<0&&(w+=1),w>1&&(w-=1),w<1/6?x+(E-x)*6*w:w<1/2?E:w<2/3?x+(E-x)*(2/3-w)*6:x}var p=new RegExp("^"+ND+"$").exec(e);if(p){if(a=parseInt(p[1]),a<0?a=(360- -1*a%360)%360:a>360&&(a=a%360),a/=360,i=parseFloat(p[2]),i<0||i>100||(i=i/100,s=parseFloat(p[3]),s<0||s>100)||(s=s/100,o=p[4],o!==void 0&&(o=parseFloat(o),o<0||o>1)))return;if(i===0)u=d=f=Math.round(s*255);else{var m=s<.5?s*(1+i):s+i-s*i,y=2*s-m;u=Math.round(255*h(y,m,a+1/3)),d=Math.round(255*h(y,m,a)),f=Math.round(255*h(y,m,a-1/3))}r=[u,d,f,o]}return r},RD=function(e){var r,a=new RegExp("^"+TD+"$").exec(e);if(a){r=[];for(var i=[],s=1;s<=3;s++){var o=a[s];if(o[o.length-1]==="%"&&(i[s]=!0),o=parseFloat(o),i[s]&&(o=o/100*255),o<0||o>255)return;r.push(Math.floor(o))}var u=i[1]||i[2]||i[3],d=i[1]&&i[2]&&i[3];if(u&&!d)return;var f=a[4];if(f!==void 0){if(f=parseFloat(f),f<0||f>1)return;r.push(f)}}return r},BD=function(e){return LD[e.toLowerCase()]},tC=function(e){return(_t(e)?e:null)||BD(e)||DD(e)||RD(e)||OD(e)},LD={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]},rC=function(e){for(var r=e.map,a=e.keys,i=a.length,s=0;s<i;s++){var o=a[s];if(wt(o))throw Error("Tried to set map with object key");s<a.length-1?(r[o]==null&&(r[o]={}),r=r[o]):r[o]=e.value}},aC=function(e){for(var r=e.map,a=e.keys,i=a.length,s=0;s<i;s++){var o=a[s];if(wt(o))throw Error("Tried to get map with object key");if(r=r[o],r==null)return r}return r},ef=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Cc(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Hp,H2;function Nc(){if(H2)return Hp;H2=1;function t(e){var r=typeof e;return e!=null&&(r=="object"||r=="function")}return Hp=t,Hp}var Gp,G2;function PD(){if(G2)return Gp;G2=1;var t=typeof ef=="object"&&ef&&ef.Object===Object&&ef;return Gp=t,Gp}var Qp,Q2;function ih(){if(Q2)return Qp;Q2=1;var t=PD(),e=typeof self=="object"&&self&&self.Object===Object&&self,r=t||e||Function("return this")();return Qp=r,Qp}var $p,$2;function zD(){if($2)return $p;$2=1;var t=ih(),e=function(){return t.Date.now()};return $p=e,$p}var Yp,Y2;function _D(){if(Y2)return Yp;Y2=1;var t=/\s/;function e(r){for(var a=r.length;a--&&t.test(r.charAt(a)););return a}return Yp=e,Yp}var Kp,K2;function UD(){if(K2)return Kp;K2=1;var t=_D(),e=/^\s+/;function r(a){return a&&a.slice(0,t(a)+1).replace(e,"")}return Kp=r,Kp}var Xp,X2;function Fm(){if(X2)return Xp;X2=1;var t=ih(),e=t.Symbol;return Xp=e,Xp}var Zp,Z2;function qD(){if(Z2)return Zp;Z2=1;var t=Fm(),e=Object.prototype,r=e.hasOwnProperty,a=e.toString,i=t?t.toStringTag:void 0;function s(o){var u=r.call(o,i),d=o[i];try{o[i]=void 0;var f=!0}catch{}var h=a.call(o);return f&&(u?o[i]=d:delete o[i]),h}return Zp=s,Zp}var Wp,W2;function ID(){if(W2)return Wp;W2=1;var t=Object.prototype,e=t.toString;function r(a){return e.call(a)}return Wp=r,Wp}var Jp,J2;function nC(){if(J2)return Jp;J2=1;var t=Fm(),e=qD(),r=ID(),a="[object Null]",i="[object Undefined]",s=t?t.toStringTag:void 0;function o(u){return u==null?u===void 0?i:a:s&&s in Object(u)?e(u):r(u)}return Jp=o,Jp}var e0,ew;function VD(){if(ew)return e0;ew=1;function t(e){return e!=null&&typeof e=="object"}return e0=t,e0}var t0,tw;function jc(){if(tw)return t0;tw=1;var t=nC(),e=VD(),r="[object Symbol]";function a(i){return typeof i=="symbol"||e(i)&&t(i)==r}return t0=a,t0}var r0,rw;function FD(){if(rw)return r0;rw=1;var t=UD(),e=Nc(),r=jc(),a=NaN,i=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,o=/^0o[0-7]+$/i,u=parseInt;function d(f){if(typeof f=="number")return f;if(r(f))return a;if(e(f)){var h=typeof f.valueOf=="function"?f.valueOf():f;f=e(h)?h+"":h}if(typeof f!="string")return f===0?f:+f;f=t(f);var p=s.test(f);return p||o.test(f)?u(f.slice(2),p?2:8):i.test(f)?a:+f}return r0=d,r0}var a0,aw;function HD(){if(aw)return a0;aw=1;var t=Nc(),e=zD(),r=FD(),a="Expected a function",i=Math.max,s=Math.min;function o(u,d,f){var h,p,m,y,x,E,w=0,T=!1,C=!1,N=!0;if(typeof u!="function")throw new TypeError(a);d=r(d)||0,t(f)&&(T=!!f.leading,C="maxWait"in f,m=C?i(r(f.maxWait)||0,d):m,N="trailing"in f?!!f.trailing:N);function A(V){var _=h,H=p;return h=p=void 0,w=V,y=u.apply(H,_),y}function D(V){return w=V,x=setTimeout(k,d),T?A(V):y}function M(V){var _=V-E,H=V-w,z=d-_;return C?s(z,m-H):z}function j(V){var _=V-E,H=V-w;return E===void 0||_>=d||_<0||C&&H>=m}function k(){var V=e();if(j(V))return B(V);x=setTimeout(k,M(V))}function B(V){return x=void 0,N&&h?A(V):(h=p=void 0,y)}function P(){x!==void 0&&clearTimeout(x),w=0,h=E=p=x=void 0}function U(){return x===void 0?y:B(e())}function R(){var V=e(),_=j(V);if(h=arguments,p=this,E=V,_){if(x===void 0)return D(E);if(C)return clearTimeout(x),x=setTimeout(k,d),A(E)}return x===void 0&&(x=setTimeout(k,d)),y}return R.cancel=P,R.flush=U,R}return a0=o,a0}var GD=HD(),Ac=Cc(GD),n0=wr?wr.performance:null,iC=n0&&n0.now?function(){return n0.now()}:function(){return Date.now()},QD=(function(){if(wr){if(wr.requestAnimationFrame)return function(t){wr.requestAnimationFrame(t)};if(wr.mozRequestAnimationFrame)return function(t){wr.mozRequestAnimationFrame(t)};if(wr.webkitRequestAnimationFrame)return function(t){wr.webkitRequestAnimationFrame(t)};if(wr.msRequestAnimationFrame)return function(t){wr.msRequestAnimationFrame(t)}}return function(t){t&&setTimeout(function(){t(iC())},1e3/60)}})(),_f=function(e){return QD(e)},ei=iC,zs=9261,sC=65599,to=5381,lC=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:zs,a=r,i;i=e.next(),!i.done;)a=a*sC+i.value|0;return a},Wu=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:zs;return r*sC+e|0},Ju=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:to;return(r<<5)+r+e|0},$D=function(e,r){return e*2097152+r},Oi=function(e){return e[0]*2097152+e[1]},tf=function(e,r){return[Wu(e[0],r[0]),Ju(e[1],r[1])]},nw=function(e,r){var a={value:0,done:!1},i=0,s=e.length,o={next:function(){return i<s?a.value=e[i++]:a.done=!0,a}};return lC(o,r)},Ws=function(e,r){var a={value:0,done:!1},i=0,s=e.length,o={next:function(){return i<s?a.value=e.charCodeAt(i++):a.done=!0,a}};return lC(o,r)},oC=function(){return YD(arguments)},YD=function(e){for(var r,a=0;a<e.length;a++){var i=e[a];a===0?r=Ws(i):r=Ws(i,r)}return r};function KD(t,e,r,a,i){var s=i*Math.PI/180,o=Math.cos(s)*(t-r)-Math.sin(s)*(e-a)+r,u=Math.sin(s)*(t-r)+Math.cos(s)*(e-a)+a;return{x:o,y:u}}var XD=function(e,r,a,i,s,o){return{x:(e-a)*s+a,y:(r-i)*o+i}};function ZD(t,e,r){if(r===0)return t;var a=(e.x1+e.x2)/2,i=(e.y1+e.y2)/2,s=e.w/e.h,o=1/s,u=KD(t.x,t.y,a,i,r),d=XD(u.x,u.y,a,i,s,o);return{x:d.x,y:d.y}}var iw=!0,WD=console.warn!=null,JD=console.trace!=null,Hm=Number.MAX_SAFE_INTEGER||9007199254740991,uC=function(){return!0},Uf=function(){return!1},sw=function(){return 0},Gm=function(){},$t=function(e){throw new Error(e)},cC=function(e){if(e!==void 0)iw=!!e;else return iw},At=function(e){cC()&&(WD?console.warn(e):(console.log(e),JD&&console.trace()))},eO=function(e){return tt({},e)},Sn=function(e){return e==null?e:_t(e)?e.slice():wt(e)?eO(e):e},tO=function(e){return e.slice()},dC=function(e,r){for(r=e="";e++<36;r+=e*51&52?(e^15?8^Math.random()*(e^20?16:4):4).toString(16):"-");return r},rO={},fC=function(){return rO},Fr=function(e){var r=Object.keys(e);return function(a){for(var i={},s=0;s<r.length;s++){var o=r[s],u=a==null?void 0:a[o];i[o]=u===void 0?e[o]:u}return i}},as=function(e,r,a){for(var i=e.length-1;i>=0;i--)e[i]===r&&e.splice(i,1)},Qm=function(e){e.splice(0,e.length)},aO=function(e,r){for(var a=0;a<r.length;a++){var i=r[a];e.push(i)}},ga=function(e,r,a){return a&&(r=JT(a,r)),e[r]},Qn=function(e,r,a,i){a&&(r=JT(a,r)),e[r]=i},nO=(function(){function t(){cs(this,t),this._obj={}}return ds(t,[{key:"set",value:function(r,a){return this._obj[r]=a,this}},{key:"delete",value:function(r){return this._obj[r]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(r){return this._obj[r]!==void 0}},{key:"get",value:function(r){return this._obj[r]}}])})(),Zn=typeof Map<"u"?Map:nO,iO="undefined",sO=(function(){function t(e){if(cs(this,t),this._obj=Object.create(null),this.size=0,e!=null){var r;e.instanceString!=null&&e.instanceString()===this.instanceString()?r=e.toArray():r=e;for(var a=0;a<r.length;a++)this.add(r[a])}}return ds(t,[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(r){var a=this._obj;a[r]!==1&&(a[r]=1,this.size++)}},{key:"delete",value:function(r){var a=this._obj;a[r]===1&&(a[r]=0,this.size--)}},{key:"clear",value:function(){this._obj=Object.create(null)}},{key:"has",value:function(r){return this._obj[r]===1}},{key:"toArray",value:function(){var r=this;return Object.keys(this._obj).filter(function(a){return r.has(a)})}},{key:"forEach",value:function(r,a){return this.toArray().forEach(r,a)}}])})(),Bo=(typeof Set>"u"?"undefined":Er(Set))!==iO?Set:sO,sh=function(e,r){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||r===void 0||!Im(e)){$t("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"){$t("An element must be of type `nodes` or `edges`; you specified `"+i+"`");return}this.length=1,this[0]=this;var s=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 Bo,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(s.position.x==null&&(s.position.x=0),s.position.y==null&&(s.position.y=0),r.renderedPosition){var o=r.renderedPosition,u=e.pan(),d=e.zoom();s.position={x:(o.x-u.x)/d,y:(o.y-u.y)/d}}var f=[];_t(r.classes)?f=r.classes:Xe(r.classes)&&(f=r.classes.split(/\s+/));for(var h=0,p=f.length;h<p;h++){var m=f[h];!m||m===""||s.classes.add(m)}this.createEmitter(),(a===void 0||a)&&this.restore();var y=r.style||r.css;y&&(At("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(y))},lw=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(a,i,s){var o;wt(a)&&!Da(a)&&(o=a,a=o.roots||o.root,i=o.visit,s=o.directed),s=arguments.length===2&&!Wt(i)?i:s,i=Wt(i)?i:function(){};for(var u=this._private.cy,d=a=Xe(a)?this.filter(a):a,f=[],h=[],p={},m={},y={},x=0,E,w=this.byGroup(),T=w.nodes,C=w.edges,N=0;N<d.length;N++){var A=d[N],D=A.id();A.isNode()&&(f.unshift(A),e.bfs&&(y[D]=!0,h.push(A)),m[D]=0)}for(var M=function(){var V=e.bfs?f.shift():f.pop(),_=V.id();if(e.dfs){if(y[_])return 0;y[_]=!0,h.push(V)}var H=m[_],z=p[_],I=z!=null?z.source():null,F=z!=null?z.target():null,K=z==null?void 0:V.same(I)?F[0]:I[0],J;if(J=i(V,z,K,x++,H),J===!0)return E=V,1;if(J===!1)return 1;for(var L=V.connectedEdges().filter(function(Y){return(!s||Y.source().same(V))&&C.has(Y)}),Q=0;Q<L.length;Q++){var X=L[Q],W=X.connectedNodes().filter(function(Y){return!Y.same(V)&&T.has(Y)}),te=W.id();W.length!==0&&!y[te]&&(W=W[0],f.push(W),e.bfs&&(y[te]=!0,h.push(W)),p[te]=X,m[te]=m[_]+1)}},j;f.length!==0&&(j=M(),!(j!==0&&j===1)););for(var k=u.collection(),B=0;B<h.length;B++){var P=h[B],U=p[P.id()];U!=null&&k.push(U),k.push(P)}return{path:u.collection(k),found:u.collection(E)}}},ec={breadthFirstSearch:lw({bfs:!0}),depthFirstSearch:lw({dfs:!0})};ec.bfs=ec.breadthFirstSearch;ec.dfs=ec.depthFirstSearch;var bf={exports:{}},lO=bf.exports,ow;function oO(){return ow||(ow=1,(function(t,e){(function(){var r,a,i,s,o,u,d,f,h,p,m,y,x,E,w;i=Math.floor,p=Math.min,a=function(T,C){return T<C?-1:T>C?1:0},h=function(T,C,N,A,D){var M;if(N==null&&(N=0),D==null&&(D=a),N<0)throw new Error("lo must be non-negative");for(A==null&&(A=T.length);N<A;)M=i((N+A)/2),D(C,T[M])<0?A=M:N=M+1;return[].splice.apply(T,[N,N-N].concat(C)),C},u=function(T,C,N){return N==null&&(N=a),T.push(C),E(T,0,T.length-1,N)},o=function(T,C){var N,A;return C==null&&(C=a),N=T.pop(),T.length?(A=T[0],T[0]=N,w(T,0,C)):A=N,A},f=function(T,C,N){var A;return N==null&&(N=a),A=T[0],T[0]=C,w(T,0,N),A},d=function(T,C,N){var A;return N==null&&(N=a),T.length&&N(T[0],C)<0&&(A=[T[0],C],C=A[0],T[0]=A[1],w(T,0,N)),C},s=function(T,C){var N,A,D,M,j,k;for(C==null&&(C=a),M=(function(){k=[];for(var B=0,P=i(T.length/2);0<=P?B<P:B>P;0<=P?B++:B--)k.push(B);return k}).apply(this).reverse(),j=[],A=0,D=M.length;A<D;A++)N=M[A],j.push(w(T,N,C));return j},x=function(T,C,N){var A;if(N==null&&(N=a),A=T.indexOf(C),A!==-1)return E(T,0,A,N),w(T,A,N)},m=function(T,C,N){var A,D,M,j,k;if(N==null&&(N=a),D=T.slice(0,C),!D.length)return D;for(s(D,N),k=T.slice(C),M=0,j=k.length;M<j;M++)A=k[M],d(D,A,N);return D.sort(N).reverse()},y=function(T,C,N){var A,D,M,j,k,B,P,U,R;if(N==null&&(N=a),C*10<=T.length){if(M=T.slice(0,C).sort(N),!M.length)return M;for(D=M[M.length-1],P=T.slice(C),j=0,B=P.length;j<B;j++)A=P[j],N(A,D)<0&&(h(M,A,0,null,N),M.pop(),D=M[M.length-1]);return M}for(s(T,N),R=[],k=0,U=p(C,T.length);0<=U?k<U:k>U;0<=U?++k:--k)R.push(o(T,N));return R},E=function(T,C,N,A){var D,M,j;for(A==null&&(A=a),D=T[N];N>C;){if(j=N-1>>1,M=T[j],A(D,M)<0){T[N]=M,N=j;continue}break}return T[N]=D},w=function(T,C,N){var A,D,M,j,k;for(N==null&&(N=a),D=T.length,k=C,M=T[C],A=2*C+1;A<D;)j=A+1,j<D&&!(N(T[A],T[j])<0)&&(A=j),T[C]=T[A],C=A,A=2*C+1;return T[C]=M,E(T,k,C,N)},r=(function(){T.push=u,T.pop=o,T.replace=f,T.pushpop=d,T.heapify=s,T.updateItem=x,T.nlargest=m,T.nsmallest=y;function T(C){this.cmp=C??a,this.nodes=[]}return T.prototype.push=function(C){return u(this.nodes,C,this.cmp)},T.prototype.pop=function(){return o(this.nodes,this.cmp)},T.prototype.peek=function(){return this.nodes[0]},T.prototype.contains=function(C){return this.nodes.indexOf(C)!==-1},T.prototype.replace=function(C){return f(this.nodes,C,this.cmp)},T.prototype.pushpop=function(C){return d(this.nodes,C,this.cmp)},T.prototype.heapify=function(){return s(this.nodes,this.cmp)},T.prototype.updateItem=function(C){return x(this.nodes,C,this.cmp)},T.prototype.clear=function(){return this.nodes=[]},T.prototype.empty=function(){return this.nodes.length===0},T.prototype.size=function(){return this.nodes.length},T.prototype.clone=function(){var C;return C=new T,C.nodes=this.nodes.slice(0),C},T.prototype.toArray=function(){return this.nodes.slice(0)},T.prototype.insert=T.prototype.push,T.prototype.top=T.prototype.peek,T.prototype.front=T.prototype.peek,T.prototype.has=T.prototype.contains,T.prototype.copy=T.prototype.clone,T})(),(function(T,C){return t.exports=C()})(this,function(){return r})}).call(lO)})(bf)),bf.exports}var i0,uw;function uO(){return uw||(uw=1,i0=oO()),i0}var cO=uO(),Mc=Cc(cO),dO=Fr({root:null,weight:function(e){return 1},directed:!1}),fO={dijkstra:function(e){if(!wt(e)){var r=arguments;e={root:r[0],weight:r[1],directed:r[2]}}var a=dO(e),i=a.root,s=a.weight,o=a.directed,u=this,d=s,f=Xe(i)?this.filter(i)[0]:i[0],h={},p={},m={},y=this.byGroup(),x=y.nodes,E=y.edges;E.unmergeBy(function(H){return H.isLoop()});for(var w=function(z){return h[z.id()]},T=function(z,I){h[z.id()]=I,C.updateItem(z)},C=new Mc(function(H,z){return w(H)-w(z)}),N=0;N<x.length;N++){var A=x[N];h[A.id()]=A.same(f)?0:1/0,C.push(A)}for(var D=function(z,I){for(var F=(o?z.edgesTo(I):z.edgesWith(I)).intersect(E),K=1/0,J,L=0;L<F.length;L++){var Q=F[L],X=d(Q);(X<K||!J)&&(K=X,J=Q)}return{edge:J,dist:K}};C.size()>0;){var M=C.pop(),j=w(M),k=M.id();if(m[k]=j,j!==1/0)for(var B=M.neighborhood().intersect(x),P=0;P<B.length;P++){var U=B[P],R=U.id(),V=D(M,U),_=j+V.dist;_<w(U)&&(T(U,_),p[R]={node:M,edge:V.edge})}}return{distanceTo:function(z){var I=Xe(z)?x.filter(z)[0]:z[0];return m[I.id()]},pathTo:function(z){var I=Xe(z)?x.filter(z)[0]:z[0],F=[],K=I,J=K.id();if(I.length>0)for(F.unshift(I);p[J];){var L=p[J];F.unshift(L.edge),F.unshift(L.node),K=L.node,J=K.id()}return u.spawn(F)}}}},hO={kruskal:function(e){e=e||function(N){return 1};for(var r=this.byGroup(),a=r.nodes,i=r.edges,s=a.length,o=new Array(s),u=a,d=function(A){for(var D=0;D<o.length;D++){var M=o[D];if(M.has(A))return D}},f=0;f<s;f++)o[f]=this.spawn(a[f]);for(var h=i.sort(function(N,A){return e(N)-e(A)}),p=0;p<h.length;p++){var m=h[p],y=m.source()[0],x=m.target()[0],E=d(y),w=d(x),T=o[E],C=o[w];E!==w&&(u.merge(m),T.merge(C),o.splice(w,1))}return u}},vO=Fr({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),pO={aStar:function(e){var r=this.cy(),a=vO(e),i=a.root,s=a.goal,o=a.heuristic,u=a.directed,d=a.weight;i=r.collection(i)[0],s=r.collection(s)[0];var f=i.id(),h=s.id(),p={},m={},y={},x=new Mc(function(J,L){return m[J.id()]-m[L.id()]}),E=new Bo,w={},T={},C=function(L,Q){x.push(L),E.add(Q)},N,A,D=function(){N=x.pop(),A=N.id(),E.delete(A)},M=function(L){return E.has(L)};C(i,f),p[f]=0,m[f]=o(i);for(var j=0;x.size()>0;){if(D(),j++,A===h){for(var k=[],B=s,P=h,U=T[P];k.unshift(B),U!=null&&k.unshift(U),B=w[P],B!=null;)P=B.id(),U=T[P];return{found:!0,distance:p[A],path:this.spawn(k),steps:j}}y[A]=!0;for(var R=N._private.edges,V=0;V<R.length;V++){var _=R[V];if(this.hasElementWithId(_.id())&&!(u&&_.data("source")!==A)){var H=_.source(),z=_.target(),I=H.id()!==A?H:z,F=I.id();if(this.hasElementWithId(F)&&!y[F]){var K=p[A]+d(_);if(!M(F)){p[F]=K,m[F]=K+o(I),C(I,F),w[F]=N,T[F]=_;continue}K<p[F]&&(p[F]=K,m[F]=K+o(I),w[F]=N,T[F]=_)}}}}return{found:!1,distance:void 0,path:void 0,steps:j}}},gO=Fr({weight:function(e){return 1},directed:!1}),mO={floydWarshall:function(e){for(var r=this.cy(),a=gO(e),i=a.weight,s=a.directed,o=i,u=this.byGroup(),d=u.nodes,f=u.edges,h=d.length,p=h*h,m=function(X){return d.indexOf(X)},y=function(X){return d[X]},x=new Array(p),E=0;E<p;E++){var w=E%h,T=(E-w)/h;T===w?x[E]=0:x[E]=1/0}for(var C=new Array(p),N=new Array(p),A=0;A<f.length;A++){var D=f[A],M=D.source()[0],j=D.target()[0];if(M!==j){var k=m(M),B=m(j),P=k*h+B,U=o(D);if(x[P]>U&&(x[P]=U,C[P]=B,N[P]=D),!s){var R=B*h+k;!s&&x[R]>U&&(x[R]=U,C[R]=k,N[R]=D)}}}for(var V=0;V<h;V++)for(var _=0;_<h;_++)for(var H=_*h+V,z=0;z<h;z++){var I=_*h+z,F=V*h+z;x[H]+x[F]<x[I]&&(x[I]=x[H]+x[F],C[I]=C[H])}var K=function(X){return(Xe(X)?r.filter(X):X)[0]},J=function(X){return m(K(X))},L={distance:function(X,W){var te=J(X),Y=J(W);return x[te*h+Y]},path:function(X,W){var te=J(X),Y=J(W),ne=y(te);if(te===Y)return ne.collection();if(C[te*h+Y]==null)return r.collection();var he=r.collection(),oe=te,ae;for(he.merge(ne);te!==Y;)oe=te,te=C[te*h+Y],ae=N[oe*h+te],he.merge(ae),he.merge(y(te));return he}};return L}},yO=Fr({weight:function(e){return 1},directed:!1,root:null}),xO={bellmanFord:function(e){var r=this,a=yO(e),i=a.weight,s=a.directed,o=a.root,u=i,d=this,f=this.cy(),h=this.byGroup(),p=h.edges,m=h.nodes,y=m.length,x=new Zn,E=!1,w=[];o=f.collection(o)[0],p.unmergeBy(function(Qe){return Qe.isLoop()});for(var T=p.length,C=function(Se){var Oe=x.get(Se.id());return Oe||(Oe={},x.set(Se.id(),Oe)),Oe},N=function(Se){return(Xe(Se)?f.$(Se):Se)[0]},A=function(Se){return C(N(Se)).dist},D=function(Se){for(var Oe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:o,ke=N(Se),Pe=[],Ge=ke;;){if(Ge==null)return r.spawn();var Je=C(Ge),Be=Je.edge,nt=Je.pred;if(Pe.unshift(Ge[0]),Ge.same(Oe)&&Pe.length>0)break;Be!=null&&Pe.unshift(Be),Ge=nt}return d.spawn(Pe)},M=0;M<y;M++){var j=m[M],k=C(j);j.same(o)?k.dist=0:k.dist=1/0,k.pred=null,k.edge=null}for(var B=!1,P=function(Se,Oe,ke,Pe,Ge,Je){var Be=Pe.dist+Je;Be<Ge.dist&&!ke.same(Pe.edge)&&(Ge.dist=Be,Ge.pred=Se,Ge.edge=ke,B=!0)},U=1;U<y;U++){B=!1;for(var R=0;R<T;R++){var V=p[R],_=V.source(),H=V.target(),z=u(V),I=C(_),F=C(H);P(_,H,V,I,F,z),s||P(H,_,V,F,I,z)}if(!B)break}if(B)for(var K=[],J=0;J<T;J++){var L=p[J],Q=L.source(),X=L.target(),W=u(L),te=C(Q).dist,Y=C(X).dist;if(te+W<Y||!s&&Y+W<te)if(E||(At("Graph contains a negative weight cycle for Bellman-Ford"),E=!0),e.findNegativeWeightCycles!==!1){var ne=[];te+W<Y&&ne.push(Q),!s&&Y+W<te&&ne.push(X);for(var he=ne.length,oe=0;oe<he;oe++){var ae=ne[oe],re=[ae];re.push(C(ae).edge);for(var le=C(ae).pred;re.indexOf(le)===-1;)re.push(le),re.push(C(le).edge),le=C(le).pred;re=re.slice(re.indexOf(le));for(var se=re[0].id(),Ne=0,Ae=2;Ae<re.length;Ae+=2)re[Ae].id()<se&&(se=re[Ae].id(),Ne=Ae);re=re.slice(Ne).concat(re.slice(0,Ne)),re.push(re[0]);var Ze=re.map(function(Qe){return Qe.id()}).join(",");K.indexOf(Ze)===-1&&(w.push(d.spawn(re)),K.push(Ze))}}else break}return{distanceTo:A,pathTo:D,hasNegativeWeightCycle:E,negativeWeightCycles:w}}},bO=Math.sqrt(2),wO=function(e,r,a){a.length===0&&$t("Karger-Stein must be run on a connected (sub)graph");for(var i=a[e],s=i[1],o=i[2],u=r[s],d=r[o],f=a,h=f.length-1;h>=0;h--){var p=f[h],m=p[1],y=p[2];(r[m]===u&&r[y]===d||r[m]===d&&r[y]===u)&&f.splice(h,1)}for(var x=0;x<f.length;x++){var E=f[x];E[1]===d?(f[x]=E.slice(),f[x][1]=u):E[2]===d&&(f[x]=E.slice(),f[x][2]=u)}for(var w=0;w<r.length;w++)r[w]===d&&(r[w]=u);return f},s0=function(e,r,a,i){for(;a>i;){var s=Math.floor(Math.random()*r.length);r=wO(s,e,r),a--}return r},SO={kargerStein:function(){var e=this,r=this.byGroup(),a=r.nodes,i=r.edges;i.unmergeBy(function(F){return F.isLoop()});var s=a.length,o=i.length,u=Math.ceil(Math.pow(Math.log(s)/Math.LN2,2)),d=Math.floor(s/bO);if(s<2){$t("At least 2 nodes are required for Karger-Stein algorithm");return}for(var f=[],h=0;h<o;h++){var p=i[h];f.push([h,a.indexOf(p.source()),a.indexOf(p.target())])}for(var m=1/0,y=[],x=new Array(s),E=new Array(s),w=new Array(s),T=function(K,J){for(var L=0;L<s;L++)J[L]=K[L]},C=0;C<=u;C++){for(var N=0;N<s;N++)E[N]=N;var A=s0(E,f.slice(),s,d),D=A.slice();T(E,w);var M=s0(E,A,d,2),j=s0(w,D,d,2);M.length<=j.length&&M.length<m?(m=M.length,y=M,T(E,x)):j.length<=M.length&&j.length<m&&(m=j.length,y=j,T(w,x))}for(var k=this.spawn(y.map(function(F){return i[F[0]]})),B=this.spawn(),P=this.spawn(),U=x[0],R=0;R<x.length;R++){var V=x[R],_=a[R];V===U?B.merge(_):P.merge(_)}var H=function(K){var J=e.spawn();return K.forEach(function(L){J.merge(L),L.connectedEdges().forEach(function(Q){e.contains(Q)&&!k.contains(Q)&&J.merge(Q)})}),J},z=[H(B),H(P)],I={cut:k,components:z,partition1:B,partition2:P};return I}},l0,EO=function(e){return{x:e.x,y:e.y}},lh=function(e,r,a){return{x:e.x*r+a.x,y:e.y*r+a.y}},hC=function(e,r,a){return{x:(e.x-a.x)/r,y:(e.y-a.y)/r}},ro=function(e){return{x:e[0],y:e[1]}},TO=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,i=1/0,s=r;s<a;s++){var o=e[s];isFinite(o)&&(i=Math.min(o,i))}return i},CO=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,i=-1/0,s=r;s<a;s++){var o=e[s];isFinite(o)&&(i=Math.max(o,i))}return i},NO=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,i=0,s=0,o=r;o<a;o++){var u=e[o];isFinite(u)&&(i+=u,s++)}return i/s},jO=function(e){var r=arguments.length>1&&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,s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;i?e=e.slice(r,a):(a<e.length&&e.splice(a,e.length-a),r>0&&e.splice(0,r));for(var u=0,d=e.length-1;d>=0;d--){var f=e[d];o?isFinite(f)||(e[d]=-1/0,u++):e.splice(d,1)}s&&e.sort(function(m,y){return m-y});var h=e.length,p=Math.floor(h/2);return h%2!==0?e[p+1+u]:(e[p-1+u]+e[p+u])/2},AO=function(e){return Math.PI*e/180},rf=function(e,r){return Math.atan2(r,e)-Math.PI/2},$m=Math.log2||function(t){return Math.log(t)/Math.log(2)},Ym=function(e){return e>0?1:e<0?-1:0},Js=function(e,r){return Math.sqrt(Bs(e,r))},Bs=function(e,r){var a=r.x-e.x,i=r.y-e.y;return a*a+i*i},MO=function(e){for(var r=e.length,a=0,i=0;i<r;i++)a+=e[i];for(var s=0;s<r;s++)e[s]=e[s]/a;return e},Or=function(e,r,a,i){return(1-i)*(1-i)*e+2*(1-i)*i*r+i*i*a},lo=function(e,r,a,i){return{x:Or(e.x,r.x,a.x,i),y:Or(e.y,r.y,a.y,i)}},kO=function(e,r,a,i){var s={x:r.x-e.x,y:r.y-e.y},o=Js(e,r),u={x:s.x/o,y:s.y/o};return a=a??0,i=i??a*o,{x:e.x+u.x*i,y:e.y+u.y*i}},tc=function(e,r,a){return Math.max(e,Math.min(a,r))},na=function(e){if(e==null)return{x1:1/0,y1:1/0,x2:-1/0,y2:-1/0,w:0,h:0};if(e.x1!=null&&e.y1!=null){if(e.x2!=null&&e.y2!=null&&e.x2>=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(e.w!=null&&e.h!=null&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},DO=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},OO=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},RO=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},vC=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},wf=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},Sf=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],a,i,s,o;if(r.length===1)a=i=s=o=r[0];else if(r.length===2)a=s=r[0],o=i=r[1];else if(r.length===4){var u=mr(r,4);a=u[0],i=u[1],s=u[2],o=u[3]}return e.x1-=o,e.x2+=i,e.y1-=a,e.y2+=s,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},cw=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},Km=function(e,r){return!(e.x1>r.x2||r.x1>e.x2||e.x2<r.x1||r.x2<e.x1||e.y2<r.y1||r.y2<e.y1||e.y1>r.y2||r.y1>e.y2)},Ki=function(e,r,a){return e.x1<=r&&r<=e.x2&&e.y1<=a&&a<=e.y2},dw=function(e,r){return Ki(e,r.x,r.y)},pC=function(e,r){return Ki(e,r.x1,r.y1)&&Ki(e,r.x2,r.y2)},BO=(l0=Math.hypot)!==null&&l0!==void 0?l0:function(t,e){return Math.sqrt(t*t+e*e)};function LO(t,e){if(t.length<3)throw new Error("Need at least 3 vertices");var r=function(k,B){return{x:k.x+B.x,y:k.y+B.y}},a=function(k,B){return{x:k.x-B.x,y:k.y-B.y}},i=function(k,B){return{x:k.x*B,y:k.y*B}},s=function(k,B){return k.x*B.y-k.y*B.x},o=function(k){var B=BO(k.x,k.y);return B===0?{x:0,y:0}:{x:k.x/B,y:k.y/B}},u=function(k){for(var B=0,P=0;P<k.length;P++){var U=k[P],R=k[(P+1)%k.length];B+=U.x*R.y-R.x*U.y}return B/2},d=function(k,B,P,U){var R=a(B,k),V=a(U,P),_=s(R,V);if(Math.abs(_)<1e-9)return r(k,i(R,.5));var H=s(a(P,k),V)/_;return r(k,i(R,H))},f=t.map(function(j){return{x:j.x,y:j.y}});u(f)<0&&f.reverse();for(var h=f.length,p=[],m=0;m<h;m++){var y=f[m],x=f[(m+1)%h],E=a(x,y),w=o({x:E.y,y:-E.x});p.push(w)}for(var T=p.map(function(j,k){var B=r(f[k],i(j,e)),P=r(f[(k+1)%h],i(j,e));return{p1:B,p2:P}}),C=[],N=0;N<h;N++){var A=T[(N-1+h)%h],D=T[N],M=d(A.p1,A.p2,D.p1,D.p2);C.push(M)}return C}function PO(t,e,r,a,i,s){var o=GO(t,e,r,a,i),u=LO(o,s),d=na();return u.forEach(function(f){return vC(d,f.x,f.y)}),d}var gC=function(e,r,a,i,s,o,u){var d=arguments.length>7&&arguments[7]!==void 0?arguments[7]:"auto",f=d==="auto"?ns(s,o):d,h=s/2,p=o/2;f=Math.min(f,h,p);var m=f!==h,y=f!==p,x;if(m){var E=a-h+f-u,w=i-p-u,T=a+h-f+u,C=w;if(x=Xi(e,r,a,i,E,w,T,C,!1),x.length>0)return x}if(y){var N=a+h+u,A=i-p+f-u,D=N,M=i+p-f+u;if(x=Xi(e,r,a,i,N,A,D,M,!1),x.length>0)return x}if(m){var j=a-h+f-u,k=i+p+u,B=a+h-f+u,P=k;if(x=Xi(e,r,a,i,j,k,B,P,!1),x.length>0)return x}if(y){var U=a-h-u,R=i-p+f-u,V=U,_=i+p-f+u;if(x=Xi(e,r,a,i,U,R,V,_,!1),x.length>0)return x}var H;{var z=a-h+f,I=i-p+f;if(H=qu(e,r,a,i,z,I,f+u),H.length>0&&H[0]<=z&&H[1]<=I)return[H[0],H[1]]}{var F=a+h-f,K=i-p+f;if(H=qu(e,r,a,i,F,K,f+u),H.length>0&&H[0]>=F&&H[1]<=K)return[H[0],H[1]]}{var J=a+h-f,L=i+p-f;if(H=qu(e,r,a,i,J,L,f+u),H.length>0&&H[0]>=J&&H[1]>=L)return[H[0],H[1]]}{var Q=a-h+f,X=i+p-f;if(H=qu(e,r,a,i,Q,X,f+u),H.length>0&&H[0]<=Q&&H[1]>=X)return[H[0],H[1]]}return[]},zO=function(e,r,a,i,s,o,u){var d=u,f=Math.min(a,s),h=Math.max(a,s),p=Math.min(i,o),m=Math.max(i,o);return f-d<=e&&e<=h+d&&p-d<=r&&r<=m+d},_O=function(e,r,a,i,s,o,u,d,f){var h={x1:Math.min(a,u,s)-f,x2:Math.max(a,u,s)+f,y1:Math.min(i,d,o)-f,y2:Math.max(i,d,o)+f};return!(e<h.x1||e>h.x2||r<h.y1||r>h.y2)},UO=function(e,r,a,i){a-=i;var s=r*r-4*e*a;if(s<0)return[];var o=Math.sqrt(s),u=2*e,d=(-r+o)/u,f=(-r-o)/u;return[d,f]},qO=function(e,r,a,i,s){var o=1e-5;e===0&&(e=o),r/=e,a/=e,i/=e;var u,d,f,h,p,m,y,x;if(d=(3*a-r*r)/9,f=-(27*i)+r*(9*a-2*(r*r)),f/=54,u=d*d*d+f*f,s[1]=0,y=r/3,u>0){p=f+Math.sqrt(u),p=p<0?-Math.pow(-p,1/3):Math.pow(p,1/3),m=f-Math.sqrt(u),m=m<0?-Math.pow(-m,1/3):Math.pow(m,1/3),s[0]=-y+p+m,y+=(p+m)/2,s[4]=s[2]=-y,y=Math.sqrt(3)*(-m+p)/2,s[3]=y,s[5]=-y;return}if(s[5]=s[3]=0,u===0){x=f<0?-Math.pow(-f,1/3):Math.pow(f,1/3),s[0]=-y+2*x,s[4]=s[2]=-(x+y);return}d=-d,h=d*d*d,h=Math.acos(f/Math.sqrt(h)),x=2*Math.sqrt(d),s[0]=-y+x*Math.cos(h/3),s[2]=-y+x*Math.cos((h+2*Math.PI)/3),s[4]=-y+x*Math.cos((h+4*Math.PI)/3)},IO=function(e,r,a,i,s,o,u,d){var f=1*a*a-4*a*s+2*a*u+4*s*s-4*s*u+u*u+i*i-4*i*o+2*i*d+4*o*o-4*o*d+d*d,h=9*a*s-3*a*a-3*a*u-6*s*s+3*s*u+9*i*o-3*i*i-3*i*d-6*o*o+3*o*d,p=3*a*a-6*a*s+a*u-a*e+2*s*s+2*s*e-u*e+3*i*i-6*i*o+i*d-i*r+2*o*o+2*o*r-d*r,m=1*a*s-a*a+a*e-s*e+i*o-i*i+i*r-o*r,y=[];qO(f,h,p,m,y);for(var x=1e-7,E=[],w=0;w<6;w+=2)Math.abs(y[w+1])<x&&y[w]>=0&&y[w]<=1&&E.push(y[w]);E.push(1),E.push(0);for(var T=-1,C,N,A,D=0;D<E.length;D++)C=Math.pow(1-E[D],2)*a+2*(1-E[D])*E[D]*s+E[D]*E[D]*u,N=Math.pow(1-E[D],2)*i+2*(1-E[D])*E[D]*o+E[D]*E[D]*d,A=Math.pow(C-e,2)+Math.pow(N-r,2),T>=0?A<T&&(T=A):T=A;return T},VO=function(e,r,a,i,s,o){var u=[e-a,r-i],d=[s-a,o-i],f=d[0]*d[0]+d[1]*d[1],h=u[0]*u[0]+u[1]*u[1],p=u[0]*d[0]+u[1]*d[1],m=p*p/f;return p<0?h:m>f?(e-s)*(e-s)+(r-o)*(r-o):h-m},ma=function(e,r,a){for(var i,s,o,u,d,f=0,h=0;h<a.length/2;h++)if(i=a[h*2],s=a[h*2+1],h+1<a.length/2?(o=a[(h+1)*2],u=a[(h+1)*2+1]):(o=a[(h+1-a.length/2)*2],u=a[(h+1-a.length/2)*2+1]),!(i==e&&o==e))if(i>=e&&e>=o||i<=e&&e<=o)d=(e-i)/(o-i)*(u-s)+s,d>r&&f++;else continue;return f%2!==0},ti=function(e,r,a,i,s,o,u,d,f){var h=new Array(a.length),p;d[0]!=null?(p=Math.atan(d[1]/d[0]),d[0]<0?p=p+Math.PI/2:p=-p-Math.PI/2):p=d;for(var m=Math.cos(-p),y=Math.sin(-p),x=0;x<h.length/2;x++)h[x*2]=o/2*(a[x*2]*m-a[x*2+1]*y),h[x*2+1]=u/2*(a[x*2+1]*m+a[x*2]*y),h[x*2]+=i,h[x*2+1]+=s;var E;if(f>0){var w=If(h,-f);E=qf(w)}else E=h;return ma(e,r,E)},FO=function(e,r,a,i,s,o,u,d){for(var f=new Array(a.length*2),h=0;h<d.length;h++){var p=d[h];f[h*4+0]=p.startX,f[h*4+1]=p.startY,f[h*4+2]=p.stopX,f[h*4+3]=p.stopY;var m=Math.pow(p.cx-e,2)+Math.pow(p.cy-r,2);if(m<=Math.pow(p.radius,2))return!0}return ma(e,r,f)},qf=function(e){for(var r=new Array(e.length/2),a,i,s,o,u,d,f,h,p=0;p<e.length/4;p++){a=e[p*4],i=e[p*4+1],s=e[p*4+2],o=e[p*4+3],p<e.length/4-1?(u=e[(p+1)*4],d=e[(p+1)*4+1],f=e[(p+1)*4+2],h=e[(p+1)*4+3]):(u=e[0],d=e[1],f=e[2],h=e[3]);var m=Xi(a,i,s,o,u,d,f,h,!0);r[p*2]=m[0],r[p*2+1]=m[1]}return r},If=function(e,r){for(var a=new Array(e.length*2),i,s,o,u,d=0;d<e.length/2;d++){i=e[d*2],s=e[d*2+1],d<e.length/2-1?(o=e[(d+1)*2],u=e[(d+1)*2+1]):(o=e[0],u=e[1]);var f=u-s,h=-(o-i),p=Math.sqrt(f*f+h*h),m=f/p,y=h/p;a[d*4]=i+m*r,a[d*4+1]=s+y*r,a[d*4+2]=o+m*r,a[d*4+3]=u+y*r}return a},HO=function(e,r,a,i,s,o){var u=a-e,d=i-r;u/=s,d/=o;var f=Math.sqrt(u*u+d*d),h=f-1;if(h<0)return[];var p=h/f;return[(a-e)*p+e,(i-r)*p+r]},qs=function(e,r,a,i,s,o,u){return e-=s,r-=o,e/=a/2+u,r/=i/2+u,e*e+r*r<=1},qu=function(e,r,a,i,s,o,u){var d=[a-e,i-r],f=[e-s,r-o],h=d[0]*d[0]+d[1]*d[1],p=2*(f[0]*d[0]+f[1]*d[1]),m=f[0]*f[0]+f[1]*f[1]-u*u,y=p*p-4*h*m;if(y<0)return[];var x=(-p+Math.sqrt(y))/(2*h),E=(-p-Math.sqrt(y))/(2*h),w=Math.min(x,E),T=Math.max(x,E),C=[];if(w>=0&&w<=1&&C.push(w),T>=0&&T<=1&&C.push(T),C.length===0)return[];var N=C[0]*d[0]+e,A=C[0]*d[1]+r;if(C.length>1){if(C[0]==C[1])return[N,A];var D=C[1]*d[0]+e,M=C[1]*d[1]+r;return[N,A,D,M]}else return[N,A]},o0=function(e,r,a){return r<=e&&e<=a||a<=e&&e<=r?e:e<=r&&r<=a||a<=r&&r<=e?r:a},Xi=function(e,r,a,i,s,o,u,d,f){var h=e-s,p=a-e,m=u-s,y=r-o,x=i-r,E=d-o,w=m*y-E*h,T=p*y-x*h,C=E*p-m*x;if(C!==0){var N=w/C,A=T/C,D=.001,M=0-D,j=1+D;return M<=N&&N<=j&&M<=A&&A<=j?[e+N*p,r+N*x]:f?[e+N*p,r+N*x]:[]}else return w===0||T===0?o0(e,a,u)===u?[u,d]:o0(e,a,s)===s?[s,o]:o0(s,u,a)===a?[a,i]:[]:[]},GO=function(e,r,a,i,s){var o=[],u=i/2,d=s/2,f=r,h=a;o.push({x:f+u*e[0],y:h+d*e[1]});for(var p=1;p<e.length/2;p++)o.push({x:f+u*e[p*2],y:h+d*e[p*2+1]});return o},rc=function(e,r,a,i,s,o,u,d){var f=[],h,p=new Array(a.length),m=!0;o==null&&(m=!1);var y;if(m){for(var x=0;x<p.length/2;x++)p[x*2]=a[x*2]*o+i,p[x*2+1]=a[x*2+1]*u+s;if(d>0){var E=If(p,-d);y=qf(E)}else y=p}else y=a;for(var w,T,C,N,A=0;A<y.length/2;A++)w=y[A*2],T=y[A*2+1],A<y.length/2-1?(C=y[(A+1)*2],N=y[(A+1)*2+1]):(C=y[0],N=y[1]),h=Xi(e,r,i,s,w,T,C,N),h.length!==0&&f.push(h[0],h[1]);return f},QO=function(e,r,a,i,s,o,u,d,f){var h=[],p,m=new Array(a.length*2);f.forEach(function(C,N){N===0?(m[m.length-2]=C.startX,m[m.length-1]=C.startY):(m[N*4-2]=C.startX,m[N*4-1]=C.startY),m[N*4]=C.stopX,m[N*4+1]=C.stopY,p=qu(e,r,i,s,C.cx,C.cy,C.radius),p.length!==0&&h.push(p[0],p[1])});for(var y=0;y<m.length/4;y++)p=Xi(e,r,i,s,m[y*4],m[y*4+1],m[y*4+2],m[y*4+3],!1),p.length!==0&&h.push(p[0],p[1]);if(h.length>2){for(var x=[h[0],h[1]],E=Math.pow(x[0]-e,2)+Math.pow(x[1]-r,2),w=1;w<h.length/2;w++){var T=Math.pow(h[w*2]-e,2)+Math.pow(h[w*2+1]-r,2);T<=E&&(x[0]=h[w*2],x[1]=h[w*2+1],E=T)}return x}return h},af=function(e,r,a){var i=[e[0]-r[0],e[1]-r[1]],s=Math.sqrt(i[0]*i[0]+i[1]*i[1]),o=(s-a)/s;return o<0&&(o=1e-5),[r[0]+o*i[0],r[1]+o*i[1]]},ta=function(e,r){var a=Zg(e,r);return a=mC(a),a},mC=function(e){for(var r,a,i=e.length/2,s=1/0,o=1/0,u=-1/0,d=-1/0,f=0;f<i;f++)r=e[2*f],a=e[2*f+1],s=Math.min(s,r),u=Math.max(u,r),o=Math.min(o,a),d=Math.max(d,a);for(var h=2/(u-s),p=2/(d-o),m=0;m<i;m++)r=e[2*m]=e[2*m]*h,a=e[2*m+1]=e[2*m+1]*p,s=Math.min(s,r),u=Math.max(u,r),o=Math.min(o,a),d=Math.max(d,a);if(o<-1)for(var y=0;y<i;y++)a=e[2*y+1]=e[2*y+1]+(-1-o);return e},Zg=function(e,r){var a=1/e*2*Math.PI,i=e%2===0?Math.PI/2+a/2:Math.PI/2;i+=r;for(var s=new Array(e*2),o,u=0;u<e;u++)o=u*a+i,s[2*u]=Math.cos(o),s[2*u+1]=Math.sin(-o);return s},ns=function(e,r){return Math.min(e/4,r/4,8)},yC=function(e,r){return Math.min(e/10,r/10,8)},Xm=function(){return 8},$O=function(e,r,a){return[e-2*r+a,2*(r-e),e]},Wg=function(e,r){return{heightOffset:Math.min(15,.05*r),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}};function u0(t,e){function r(p){for(var m=[],y=0;y<p.length;y++){var x=p[y],E=p[(y+1)%p.length],w={x:E.x-x.x,y:E.y-x.y},T={x:-w.y,y:w.x},C=Math.sqrt(T.x*T.x+T.y*T.y);m.push({x:T.x/C,y:T.y/C})}return m}function a(p,m){var y=1/0,x=-1/0,E=xa(p),w;try{for(E.s();!(w=E.n()).done;){var T=w.value,C=T.x*m.x+T.y*m.y;y=Math.min(y,C),x=Math.max(x,C)}}catch(N){E.e(N)}finally{E.f()}return{min:y,max:x}}function i(p,m){return!(p.max<m.min||m.max<p.min)}var s=[].concat(Pf(r(t)),Pf(r(e))),o=xa(s),u;try{for(o.s();!(u=o.n()).done;){var d=u.value,f=a(t,d),h=a(e,d);if(!i(f,h))return!1}}catch(p){o.e(p)}finally{o.f()}return!0}var YO=Fr({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),KO={pageRank:function(e){for(var r=YO(e),a=r.dampingFactor,i=r.precision,s=r.iterations,o=r.weight,u=this._private.cy,d=this.byGroup(),f=d.nodes,h=d.edges,p=f.length,m=p*p,y=h.length,x=new Array(m),E=new Array(p),w=(1-a)/p,T=0;T<p;T++){for(var C=0;C<p;C++){var N=T*p+C;x[N]=0}E[T]=0}for(var A=0;A<y;A++){var D=h[A],M=D.data("source"),j=D.data("target");if(M!==j){var k=f.indexOfId(M),B=f.indexOfId(j),P=o(D),U=B*p+k;x[U]+=P,E[k]+=P}}for(var R=1/p+w,V=0;V<p;V++)if(E[V]===0)for(var _=0;_<p;_++){var H=_*p+V;x[H]=R}else for(var z=0;z<p;z++){var I=z*p+V;x[I]=x[I]/E[V]+w}for(var F=new Array(p),K=new Array(p),J,L=0;L<p;L++)F[L]=1;for(var Q=0;Q<s;Q++){for(var X=0;X<p;X++)K[X]=0;for(var W=0;W<p;W++)for(var te=0;te<p;te++){var Y=W*p+te;K[W]+=x[Y]*F[te]}MO(K),J=F,F=K,K=J;for(var ne=0,he=0;he<p;he++){var oe=J[he]-F[he];ne+=oe*oe}if(ne<i)break}var ae={rank:function(le){return le=u.collection(le)[0],F[f.indexOf(le)]}};return ae}},fw=Fr({root:null,weight:function(e){return 1},directed:!1,alpha:0}),oo={degreeCentralityNormalized:function(e){e=fw(e);var r=this.cy(),a=this.nodes(),i=a.length;if(e.directed){for(var h={},p={},m=0,y=0,x=0;x<i;x++){var E=a[x],w=E.id();e.root=E;var T=this.degreeCentrality(e);m<T.indegree&&(m=T.indegree),y<T.outdegree&&(y=T.outdegree),h[w]=T.indegree,p[w]=T.outdegree}return{indegree:function(N){return m==0?0:(Xe(N)&&(N=r.filter(N)),h[N.id()]/m)},outdegree:function(N){return y===0?0:(Xe(N)&&(N=r.filter(N)),p[N.id()]/y)}}}else{for(var s={},o=0,u=0;u<i;u++){var d=a[u];e.root=d;var f=this.degreeCentrality(e);o<f.degree&&(o=f.degree),s[d.id()]=f.degree}return{degree:function(N){return o===0?0:(Xe(N)&&(N=r.filter(N)),s[N.id()]/o)}}}},degreeCentrality:function(e){e=fw(e);var r=this.cy(),a=this,i=e,s=i.root,o=i.weight,u=i.directed,d=i.alpha;if(s=r.collection(s)[0],u){for(var y=s.connectedEdges(),x=y.filter(function(M){return M.target().same(s)&&a.has(M)}),E=y.filter(function(M){return M.source().same(s)&&a.has(M)}),w=x.length,T=E.length,C=0,N=0,A=0;A<x.length;A++)C+=o(x[A]);for(var D=0;D<E.length;D++)N+=o(E[D]);return{indegree:Math.pow(w,1-d)*Math.pow(C,d),outdegree:Math.pow(T,1-d)*Math.pow(N,d)}}else{for(var f=s.connectedEdges().intersection(a),h=f.length,p=0,m=0;m<f.length;m++)p+=o(f[m]);return{degree:Math.pow(h,1-d)*Math.pow(p,d)}}}};oo.dc=oo.degreeCentrality;oo.dcn=oo.degreeCentralityNormalised=oo.degreeCentralityNormalized;var hw=Fr({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),uo={closenessCentralityNormalized:function(e){for(var r=hw(e),a=r.harmonic,i=r.weight,s=r.directed,o=this.cy(),u={},d=0,f=this.nodes(),h=this.floydWarshall({weight:i,directed:s}),p=0;p<f.length;p++){for(var m=0,y=f[p],x=0;x<f.length;x++)if(p!==x){var E=h.distance(y,f[x]);a?m+=1/E:m+=E}a||(m=1/m),d<m&&(d=m),u[y.id()]=m}return{closeness:function(T){return d==0?0:(Xe(T)?T=o.filter(T)[0].id():T=T.id(),u[T]/d)}}},closenessCentrality:function(e){var r=hw(e),a=r.root,i=r.weight,s=r.directed,o=r.harmonic;a=this.filter(a)[0];for(var u=this.dijkstra({root:a,weight:i,directed:s}),d=0,f=this.nodes(),h=0;h<f.length;h++){var p=f[h];if(!p.same(a)){var m=u.distanceTo(p);o?d+=1/m:d+=m}}return o?d:1/d}};uo.cc=uo.closenessCentrality;uo.ccn=uo.closenessCentralityNormalised=uo.closenessCentralityNormalized;var XO=Fr({weight:null,directed:!1}),Jg={betweennessCentrality:function(e){for(var r=XO(e),a=r.directed,i=r.weight,s=i!=null,o=this.cy(),u=this.nodes(),d={},f={},h=0,p={set:function(N,A){f[N]=A,A>h&&(h=A)},get:function(N){return f[N]}},m=0;m<u.length;m++){var y=u[m],x=y.id();a?d[x]=y.outgoers().nodes():d[x]=y.openNeighborhood().nodes(),p.set(x,0)}for(var E=function(){for(var N=u[w].id(),A=[],D={},M={},j={},k=new Mc(function(W,te){return j[W]-j[te]}),B=0;B<u.length;B++){var P=u[B].id();D[P]=[],M[P]=0,j[P]=1/0}for(M[N]=1,j[N]=0,k.push(N);!k.empty();){var U=k.pop();if(A.push(U),s)for(var R=0;R<d[U].length;R++){var V=d[U][R],_=o.getElementById(U),H=void 0;_.edgesTo(V).length>0?H=_.edgesTo(V)[0]:H=V.edgesTo(_)[0];var z=i(H);V=V.id(),j[V]>j[U]+z&&(j[V]=j[U]+z,k.nodes.indexOf(V)<0?k.push(V):k.updateItem(V),M[V]=0,D[V]=[]),j[V]==j[U]+z&&(M[V]=M[V]+M[U],D[V].push(U))}else for(var I=0;I<d[U].length;I++){var F=d[U][I].id();j[F]==1/0&&(k.push(F),j[F]=j[U]+1),j[F]==j[U]+1&&(M[F]=M[F]+M[U],D[F].push(U))}}for(var K={},J=0;J<u.length;J++)K[u[J].id()]=0;for(;A.length>0;){for(var L=A.pop(),Q=0;Q<D[L].length;Q++){var X=D[L][Q];K[X]=K[X]+M[X]/M[L]*(1+K[L])}L!=u[w].id()&&p.set(L,p.get(L)+K[L])}},w=0;w<u.length;w++)E();var T={betweenness:function(N){var A=o.collection(N).id();return p.get(A)},betweennessNormalized:function(N){if(h==0)return 0;var A=o.collection(N).id();return p.get(A)/h}};return T.betweennessNormalised=T.betweennessNormalized,T}};Jg.bc=Jg.betweennessCentrality;var ZO=Fr({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(t){return 1}]}),WO=function(e){return ZO(e)},JO=function(e,r){for(var a=0,i=0;i<r.length;i++)a+=r[i](e);return a},e3=function(e,r,a){for(var i=0;i<r;i++)e[i*r+i]=a},xC=function(e,r){for(var a,i=0;i<r;i++){a=0;for(var s=0;s<r;s++)a+=e[s*r+i];for(var o=0;o<r;o++)e[o*r+i]=e[o*r+i]/a}},t3=function(e,r,a){for(var i=new Array(a*a),s=0;s<a;s++){for(var o=0;o<a;o++)i[s*a+o]=0;for(var u=0;u<a;u++)for(var d=0;d<a;d++)i[s*a+d]+=e[s*a+u]*r[u*a+d]}return i},r3=function(e,r,a){for(var i=e.slice(0),s=1;s<a;s++)e=t3(e,i,r);return e},a3=function(e,r,a){for(var i=new Array(r*r),s=0;s<r*r;s++)i[s]=Math.pow(e[s],a);return xC(i,r),i},n3=function(e,r,a,i){for(var s=0;s<a;s++){var o=Math.round(e[s]*Math.pow(10,i))/Math.pow(10,i),u=Math.round(r[s]*Math.pow(10,i))/Math.pow(10,i);if(o!==u)return!1}return!0},i3=function(e,r,a,i){for(var s=[],o=0;o<r;o++){for(var u=[],d=0;d<r;d++)Math.round(e[o*r+d]*1e3)/1e3>0&&u.push(a[d]);u.length!==0&&s.push(i.collection(u))}return s},s3=function(e,r){for(var a=0;a<e.length;a++)if(!r[a]||e[a].id()!==r[a].id())return!1;return!0},l3=function(e){for(var r=0;r<e.length;r++)for(var a=0;a<e.length;a++)r!=a&&s3(e[r],e[a])&&e.splice(a,1);return e},vw=function(e){for(var r=this.nodes(),a=this.edges(),i=this.cy(),s=WO(e),o={},u=0;u<r.length;u++)o[r[u].id()]=u;for(var d=r.length,f=d*d,h=new Array(f),p,m=0;m<f;m++)h[m]=0;for(var y=0;y<a.length;y++){var x=a[y],E=o[x.source().id()],w=o[x.target().id()],T=JO(x,s.attributes);h[E*d+w]+=T,h[w*d+E]+=T}e3(h,d,s.multFactor),xC(h,d);for(var C=!0,N=0;C&&N<s.maxIterations;)C=!1,p=r3(h,d,s.expandFactor),h=a3(p,d,s.inflateFactor),n3(h,p,f,4)||(C=!0),N++;var A=i3(h,d,r,i);return A=l3(A),A},o3={markovClustering:vw,mcl:vw},u3=function(e){return e},bC=function(e,r){return Math.abs(r-e)},pw=function(e,r,a){return e+bC(r,a)},gw=function(e,r,a){return e+Math.pow(a-r,2)},c3=function(e){return Math.sqrt(e)},d3=function(e,r,a){return Math.max(e,bC(r,a))},Ou=function(e,r,a,i,s){for(var o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:u3,u=i,d,f,h=0;h<e;h++)d=r(h),f=a(h),u=s(u,d,f);return o(u)},ko={euclidean:function(e,r,a){return e>=2?Ou(e,r,a,0,gw,c3):Ou(e,r,a,0,pw)},squaredEuclidean:function(e,r,a){return Ou(e,r,a,0,gw)},manhattan:function(e,r,a){return Ou(e,r,a,0,pw)},max:function(e,r,a){return Ou(e,r,a,-1/0,d3)}};ko["squared-euclidean"]=ko.squaredEuclidean;ko.squaredeuclidean=ko.squaredEuclidean;function oh(t,e,r,a,i,s){var o;return Wt(t)?o=t:o=ko[t]||ko.euclidean,e===0&&Wt(t)?o(i,s):o(e,r,a,i,s)}var f3=Fr({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),Zm=function(e){return f3(e)},Vf=function(e,r,a,i,s){var o=s!=="kMedoids",u=o?function(p){return a[p]}:function(p){return i[p](a)},d=function(m){return i[m](r)},f=a,h=r;return oh(e,i.length,u,d,f,h)},c0=function(e,r,a){for(var i=a.length,s=new Array(i),o=new Array(i),u=new Array(r),d=null,f=0;f<i;f++)s[f]=e.min(a[f]).value,o[f]=e.max(a[f]).value;for(var h=0;h<r;h++){d=[];for(var p=0;p<i;p++)d[p]=Math.random()*(o[p]-s[p])+s[p];u[h]=d}return u},wC=function(e,r,a,i,s){for(var o=1/0,u=0,d=0;d<r.length;d++){var f=Vf(a,e,r[d],i,s);f<o&&(o=f,u=d)}return u},SC=function(e,r,a){for(var i=[],s=null,o=0;o<r.length;o++)s=r[o],a[s.id()]===e&&i.push(s);return i},h3=function(e,r,a){return Math.abs(r-e)<=a},v3=function(e,r,a){for(var i=0;i<e.length;i++)for(var s=0;s<e[i].length;s++){var o=Math.abs(e[i][s]-r[i][s]);if(o>a)return!1}return!0},p3=function(e,r,a){for(var i=0;i<a;i++)if(e===r[i])return!0;return!1},mw=function(e,r){var a=new Array(r);if(e.length<50)for(var i=0;i<r;i++){for(var s=e[Math.floor(Math.random()*e.length)];p3(s,a,i);)s=e[Math.floor(Math.random()*e.length)];a[i]=s}else for(var o=0;o<r;o++)a[o]=e[Math.floor(Math.random()*e.length)];return a},yw=function(e,r,a){for(var i=0,s=0;s<r.length;s++)i+=Vf("manhattan",r[s],e,a,"kMedoids");return i},g3=function(e){var r=this.cy(),a=this.nodes(),i=null,s=Zm(e),o=new Array(s.k),u={},d;s.testMode?typeof s.testCentroids=="number"?(s.testCentroids,d=c0(a,s.k,s.attributes)):Er(s.testCentroids)==="object"?d=s.testCentroids:d=c0(a,s.k,s.attributes):d=c0(a,s.k,s.attributes);for(var f=!0,h=0;f&&h<s.maxIterations;){for(var p=0;p<a.length;p++)i=a[p],u[i.id()]=wC(i,d,s.distance,s.attributes,"kMeans");f=!1;for(var m=0;m<s.k;m++){var y=SC(m,a,u);if(y.length!==0){for(var x=s.attributes.length,E=d[m],w=new Array(x),T=new Array(x),C=0;C<x;C++){T[C]=0;for(var N=0;N<y.length;N++)i=y[N],T[C]+=s.attributes[C](i);w[C]=T[C]/y.length,h3(w[C],E[C],s.sensitivityThreshold)||(f=!0)}d[m]=w,o[m]=r.collection(y)}}h++}return o},m3=function(e){var r=this.cy(),a=this.nodes(),i=null,s=Zm(e),o=new Array(s.k),u,d={},f,h=new Array(s.k);s.testMode?typeof s.testCentroids=="number"||(Er(s.testCentroids)==="object"?u=s.testCentroids:u=mw(a,s.k)):u=mw(a,s.k);for(var p=!0,m=0;p&&m<s.maxIterations;){for(var y=0;y<a.length;y++)i=a[y],d[i.id()]=wC(i,u,s.distance,s.attributes,"kMedoids");p=!1;for(var x=0;x<u.length;x++){var E=SC(x,a,d);if(E.length!==0){h[x]=yw(u[x],E,s.attributes);for(var w=0;w<E.length;w++)f=yw(E[w],E,s.attributes),f<h[x]&&(h[x]=f,u[x]=E[w],p=!0);o[x]=r.collection(E)}}m++}return o},y3=function(e,r,a,i,s){for(var o,u,d=0;d<r.length;d++)for(var f=0;f<e.length;f++)i[d][f]=Math.pow(a[d][f],s.m);for(var h=0;h<e.length;h++)for(var p=0;p<s.attributes.length;p++){o=0,u=0;for(var m=0;m<r.length;m++)o+=i[m][h]*s.attributes[p](r[m]),u+=i[m][h];e[h][p]=o/u}},x3=function(e,r,a,i,s){for(var o=0;o<e.length;o++)r[o]=e[o].slice();for(var u,d,f,h=2/(s.m-1),p=0;p<a.length;p++)for(var m=0;m<i.length;m++){u=0;for(var y=0;y<a.length;y++)d=Vf(s.distance,i[m],a[p],s.attributes,"cmeans"),f=Vf(s.distance,i[m],a[y],s.attributes,"cmeans"),u+=Math.pow(d/f,h);e[m][p]=1/u}},b3=function(e,r,a,i){for(var s=new Array(a.k),o=0;o<s.length;o++)s[o]=[];for(var u,d,f=0;f<r.length;f++){u=-1/0,d=-1;for(var h=0;h<r[0].length;h++)r[f][h]>u&&(u=r[f][h],d=h);s[d].push(e[f])}for(var p=0;p<s.length;p++)s[p]=i.collection(s[p]);return s},xw=function(e){var r=this.cy(),a=this.nodes(),i=Zm(e),s,o,u,d,f;d=new Array(a.length);for(var h=0;h<a.length;h++)d[h]=new Array(i.k);u=new Array(a.length);for(var p=0;p<a.length;p++)u[p]=new Array(i.k);for(var m=0;m<a.length;m++){for(var y=0,x=0;x<i.k;x++)u[m][x]=Math.random(),y+=u[m][x];for(var E=0;E<i.k;E++)u[m][E]=u[m][E]/y}o=new Array(i.k);for(var w=0;w<i.k;w++)o[w]=new Array(i.attributes.length);f=new Array(a.length);for(var T=0;T<a.length;T++)f[T]=new Array(i.k);for(var C=!0,N=0;C&&N<i.maxIterations;)C=!1,y3(o,a,u,f,i),x3(u,d,o,a,i),v3(u,d,i.sensitivityThreshold)||(C=!0),N++;return s=b3(a,u,i,r),{clusters:s,degreeOfMembership:u}},w3={kMeans:g3,kMedoids:m3,fuzzyCMeans:xw,fcm:xw},S3=Fr({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),E3={single:"min",complete:"max"},T3=function(e){var r=S3(e),a=E3[r.linkage];return a!=null&&(r.linkage=a),r},bw=function(e,r,a,i,s){for(var o=0,u=1/0,d,f=s.attributes,h=function(B,P){return oh(s.distance,f.length,function(U){return f[U](B)},function(U){return f[U](P)},B,P)},p=0;p<e.length;p++){var m=e[p].key,y=a[m][i[m]];y<u&&(o=m,u=y)}if(s.mode==="threshold"&&u>=s.threshold||s.mode==="dendrogram"&&e.length===1)return!1;var x=r[o],E=r[i[o]],w;s.mode==="dendrogram"?w={left:x,right:E,key:x.key}:w={value:x.value.concat(E.value),key:x.key},e[x.index]=w,e.splice(E.index,1),r[x.key]=w;for(var T=0;T<e.length;T++){var C=e[T];x.key===C.key?d=1/0:s.linkage==="min"?(d=a[x.key][C.key],a[x.key][C.key]>a[E.key][C.key]&&(d=a[E.key][C.key])):s.linkage==="max"?(d=a[x.key][C.key],a[x.key][C.key]<a[E.key][C.key]&&(d=a[E.key][C.key])):s.linkage==="mean"?d=(a[x.key][C.key]*x.size+a[E.key][C.key]*E.size)/(x.size+E.size):s.mode==="dendrogram"?d=h(C.value,x.value):d=h(C.value[0],x.value[0]),a[x.key][C.key]=a[C.key][x.key]=d}for(var N=0;N<e.length;N++){var A=e[N].key;if(i[A]===x.key||i[A]===E.key){for(var D=A,M=0;M<e.length;M++){var j=e[M].key;a[A][j]<a[A][D]&&(D=j)}i[A]=D}e[N].index=N}return x.key=E.key=x.index=E.index=null,!0},ao=function(e,r,a){e&&(e.value?r.push(e.value):(e.left&&ao(e.left,r),e.right&&ao(e.right,r)))},em=function(e,r){if(!e)return"";if(e.left&&e.right){var a=em(e.left,r),i=em(e.right,r),s=r.add({group:"nodes",data:{id:a+","+i}});return r.add({group:"edges",data:{source:a,target:s.id()}}),r.add({group:"edges",data:{source:i,target:s.id()}}),s.id()}else if(e.value)return e.value.id()},tm=function(e,r,a){if(!e)return[];var i=[],s=[],o=[];return r===0?(e.left&&ao(e.left,i),e.right&&ao(e.right,s),o=i.concat(s),[a.collection(o)]):r===1?e.value?[a.collection(e.value)]:(e.left&&ao(e.left,i),e.right&&ao(e.right,s),[a.collection(i),a.collection(s)]):e.value?[a.collection(e.value)]:(e.left&&(i=tm(e.left,r-1,a)),e.right&&(s=tm(e.right,r-1,a)),i.concat(s))},ww=function(e){for(var r=this.cy(),a=this.nodes(),i=T3(e),s=i.attributes,o=function(N,A){return oh(i.distance,s.length,function(D){return s[D](N)},function(D){return s[D](A)},N,A)},u=[],d=[],f=[],h=[],p=0;p<a.length;p++){var m={value:i.mode==="dendrogram"?a[p]:[a[p]],key:p,index:p};u[p]=m,h[p]=m,d[p]=[],f[p]=0}for(var y=0;y<u.length;y++)for(var x=0;x<=y;x++){var E=void 0;i.mode==="dendrogram"?E=y===x?1/0:o(u[y].value,u[x].value):E=y===x?1/0:o(u[y].value[0],u[x].value[0]),d[y][x]=E,d[x][y]=E,E<d[y][f[y]]&&(f[y]=x)}for(var w=bw(u,h,d,f,i);w;)w=bw(u,h,d,f,i);var T;return i.mode==="dendrogram"?(T=tm(u[0],i.dendrogramDepth,r),i.addDendrogram&&em(u[0],r)):(T=new Array(u.length),u.forEach(function(C,N){C.key=C.index=null,T[N]=r.collection(C.value)})),T},C3={hierarchicalClustering:ww,hca:ww},N3=Fr({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),j3=function(e){var r=e.damping,a=e.preference;.5<=r&&r<1||$t("Damping must range on [0.5, 1). Got: ".concat(r));var i=["median","mean","min","max"];return i.some(function(s){return s===a})||De(a)||$t("Preference must be one of [".concat(i.map(function(s){return"'".concat(s,"'")}).join(", "),"] or a number. Got: ").concat(a)),N3(e)},A3=function(e,r,a,i){var s=function(u,d){return i[d](u)};return-oh(e,i.length,function(o){return s(r,o)},function(o){return s(a,o)},r,a)},M3=function(e,r){var a=null;return r==="median"?a=jO(e):r==="mean"?a=NO(e):r==="min"?a=TO(e):r==="max"?a=CO(e):a=r,a},k3=function(e,r,a){for(var i=[],s=0;s<e;s++)r[s*e+s]+a[s*e+s]>0&&i.push(s);return i},Sw=function(e,r,a){for(var i=[],s=0;s<e;s++){for(var o=-1,u=-1/0,d=0;d<a.length;d++){var f=a[d];r[s*e+f]>u&&(o=f,u=r[s*e+f])}o>0&&i.push(o)}for(var h=0;h<a.length;h++)i[a[h]]=a[h];return i},D3=function(e,r,a){for(var i=Sw(e,r,a),s=0;s<a.length;s++){for(var o=[],u=0;u<i.length;u++)i[u]===a[s]&&o.push(u);for(var d=-1,f=-1/0,h=0;h<o.length;h++){for(var p=0,m=0;m<o.length;m++)p+=r[o[m]*e+o[h]];p>f&&(d=h,f=p)}a[s]=o[d]}return i=Sw(e,r,a),i},Ew=function(e){for(var r=this.cy(),a=this.nodes(),i=j3(e),s={},o=0;o<a.length;o++)s[a[o].id()]=o;var u,d,f,h,p,m;u=a.length,d=u*u,f=new Array(d);for(var y=0;y<d;y++)f[y]=-1/0;for(var x=0;x<u;x++)for(var E=0;E<u;E++)x!==E&&(f[x*u+E]=A3(i.distance,a[x],a[E],i.attributes));h=M3(f,i.preference);for(var w=0;w<u;w++)f[w*u+w]=h;p=new Array(d);for(var T=0;T<d;T++)p[T]=0;m=new Array(d);for(var C=0;C<d;C++)m[C]=0;for(var N=new Array(u),A=new Array(u),D=new Array(u),M=0;M<u;M++)N[M]=0,A[M]=0,D[M]=0;for(var j=new Array(u*i.minIterations),k=0;k<j.length;k++)j[k]=0;var B;for(B=0;B<i.maxIterations;B++){for(var P=0;P<u;P++){for(var U=-1/0,R=-1/0,V=-1,_=0,H=0;H<u;H++)N[H]=p[P*u+H],_=m[P*u+H]+f[P*u+H],_>=U?(R=U,U=_,V=H):_>R&&(R=_);for(var z=0;z<u;z++)p[P*u+z]=(1-i.damping)*(f[P*u+z]-U)+i.damping*N[z];p[P*u+V]=(1-i.damping)*(f[P*u+V]-R)+i.damping*N[V]}for(var I=0;I<u;I++){for(var F=0,K=0;K<u;K++)N[K]=m[K*u+I],A[K]=Math.max(0,p[K*u+I]),F+=A[K];F-=A[I],A[I]=p[I*u+I],F+=A[I];for(var J=0;J<u;J++)m[J*u+I]=(1-i.damping)*Math.min(0,F-A[J])+i.damping*N[J];m[I*u+I]=(1-i.damping)*(F-A[I])+i.damping*N[I]}for(var L=0,Q=0;Q<u;Q++){var X=m[Q*u+Q]+p[Q*u+Q]>0?1:0;j[B%i.minIterations*u+Q]=X,L+=X}if(L>0&&(B>=i.minIterations-1||B==i.maxIterations-1)){for(var W=0,te=0;te<u;te++){D[te]=0;for(var Y=0;Y<i.minIterations;Y++)D[te]+=j[Y*u+te];(D[te]===0||D[te]===i.minIterations)&&W++}if(W===u)break}}for(var ne=k3(u,p,m),he=D3(u,f,ne),oe={},ae=0;ae<ne.length;ae++)oe[ne[ae]]=[];for(var re=0;re<a.length;re++){var le=s[a[re].id()],se=he[le];se!=null&&oe[se].push(a[re])}for(var Ne=new Array(ne.length),Ae=0;Ae<ne.length;Ae++)Ne[Ae]=r.collection(oe[ne[Ae]]);return Ne},O3={affinityPropagation:Ew,ap:Ew},R3=Fr({root:void 0,directed:!1}),B3={hierholzer:function(e){if(!wt(e)){var r=arguments;e={root:r[0],directed:r[1]}}var a=R3(e),i=a.root,s=a.directed,o=this,u=!1,d,f,h;i&&(h=Xe(i)?this.filter(i)[0].id():i[0].id());var p={},m={};s?o.forEach(function(C){var N=C.id();if(C.isNode()){var A=C.indegree(!0),D=C.outdegree(!0),M=A-D,j=D-A;M==1?d?u=!0:d=N:j==1?f?u=!0:f=N:(j>1||M>1)&&(u=!0),p[N]=[],C.outgoers().forEach(function(k){k.isEdge()&&p[N].push(k.id())})}else m[N]=[void 0,C.target().id()]}):o.forEach(function(C){var N=C.id();if(C.isNode()){var A=C.degree(!0);A%2&&(d?f?u=!0:f=N:d=N),p[N]=[],C.connectedEdges().forEach(function(D){return p[N].push(D.id())})}else m[N]=[C.source().id(),C.target().id()]});var y={found:!1,trail:void 0};if(u)return y;if(f&&d)if(s){if(h&&f!=h)return y;h=f}else{if(h&&f!=h&&d!=h)return y;h||(h=f)}else h||(h=o[0].id());var x=function(N){for(var A=N,D=[N],M,j,k;p[A].length;)M=p[A].shift(),j=m[M][0],k=m[M][1],A!=k?(p[k]=p[k].filter(function(B){return B!=M}),A=k):!s&&A!=j&&(p[j]=p[j].filter(function(B){return B!=M}),A=j),D.unshift(M),D.unshift(A);return D},E=[],w=[];for(w=x(h);w.length!=1;)p[w[0]].length==0?(E.unshift(o.getElementById(w.shift())),E.unshift(o.getElementById(w.shift()))):w=x(w.shift()).concat(w);E.unshift(o.getElementById(w.shift()));for(var T in p)if(p[T].length)return y;return y.found=!0,y.trail=this.spawn(E,!0),y}},nf=function(){var e=this,r={},a=0,i=0,s=[],o=[],u={},d=function(m,y){for(var x=o.length-1,E=[],w=e.spawn();o[x].x!=m||o[x].y!=y;)E.push(o.pop().edge),x--;E.push(o.pop().edge),E.forEach(function(T){var C=T.connectedNodes().intersection(e);w.merge(T),C.forEach(function(N){var A=N.id(),D=N.connectedEdges().intersection(e);w.merge(N),r[A].cutVertex?w.merge(D.filter(function(M){return M.isLoop()})):w.merge(D)})}),s.push(w)},f=function(m,y,x){m===x&&(i+=1),r[y]={id:a,low:a++,cutVertex:!1};var E=e.getElementById(y).connectedEdges().intersection(e);if(E.size()===0)s.push(e.spawn(e.getElementById(y)));else{var w,T,C,N;E.forEach(function(A){w=A.source().id(),T=A.target().id(),C=w===y?T:w,C!==x&&(N=A.id(),u[N]||(u[N]=!0,o.push({x:y,y:C,edge:A})),C in r?r[y].low=Math.min(r[y].low,r[C].id):(f(m,C,y),r[y].low=Math.min(r[y].low,r[C].low),r[y].id<=r[C].low&&(r[y].cutVertex=!0,d(y,C))))})}};e.forEach(function(p){if(p.isNode()){var m=p.id();m in r||(i=0,f(m,m),r[m].cutVertex=i>1)}});var h=Object.keys(r).filter(function(p){return r[p].cutVertex}).map(function(p){return e.getElementById(p)});return{cut:e.spawn(h),components:s}},L3={hopcroftTarjanBiconnected:nf,htbc:nf,htb:nf,hopcroftTarjanBiconnectedComponents:nf},sf=function(){var e=this,r={},a=0,i=[],s=[],o=e.spawn(e),u=function(f){s.push(f),r[f]={index:a,low:a++,explored:!1};var h=e.getElementById(f).connectedEdges().intersection(e);if(h.forEach(function(E){var w=E.target().id();w!==f&&(w in r||u(w),r[w].explored||(r[f].low=Math.min(r[f].low,r[w].low)))}),r[f].index===r[f].low){for(var p=e.spawn();;){var m=s.pop();if(p.merge(e.getElementById(m)),r[m].low=r[f].index,r[m].explored=!0,m===f)break}var y=p.edgesWith(p),x=p.merge(y);i.push(x),o=o.difference(x)}};return e.forEach(function(d){if(d.isNode()){var f=d.id();f in r||u(f)}}),{cut:o,components:i}},P3={tarjanStronglyConnected:sf,tsc:sf,tscc:sf,tarjanStronglyConnectedComponents:sf},EC={};[ec,fO,hO,pO,mO,xO,SO,KO,oo,uo,Jg,o3,w3,C3,O3,B3,L3,P3].forEach(function(t){tt(EC,t)});/*!
83
+ Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable
84
+ Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com)
85
+ Licensed under The MIT License (http://opensource.org/licenses/MIT)
86
+ */var TC=0,CC=1,NC=2,ln=function(e){if(!(this instanceof ln))return new ln(e);this.id="Thenable/1.0.7",this.state=TC,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))};ln.prototype={fulfill:function(e){return Tw(this,CC,"fulfillValue",e)},reject:function(e){return Tw(this,NC,"rejectReason",e)},then:function(e,r){var a=this,i=new ln;return a.onFulfilled.push(Nw(e,i,"fulfill")),a.onRejected.push(Nw(r,i,"reject")),jC(a),i.proxy}};var Tw=function(e,r,a,i){return e.state===TC&&(e.state=r,e[a]=i,jC(e)),e},jC=function(e){e.state===CC?Cw(e,"onFulfilled",e.fulfillValue):e.state===NC&&Cw(e,"onRejected",e.rejectReason)},Cw=function(e,r,a){if(e[r].length!==0){var i=e[r];e[r]=[];var s=function(){for(var u=0;u<i.length;u++)i[u](a)};typeof setImmediate=="function"?setImmediate(s):setTimeout(s,0)}},Nw=function(e,r,a){return function(i){if(typeof e!="function")r[a].call(r,i);else{var s;try{s=e(i)}catch(o){r.reject(o);return}AC(r,s)}}},AC=function(e,r){if(e===r||e.proxy===r){e.reject(new TypeError("cannot resolve promise with itself"));return}var a;if(Er(r)==="object"&&r!==null||typeof r=="function")try{a=r.then}catch(s){e.reject(s);return}if(typeof a=="function"){var i=!1;try{a.call(r,function(s){i||(i=!0,s===r?e.reject(new TypeError("circular thenable chain")):AC(e,s))},function(s){i||(i=!0,e.reject(s))})}catch(s){i||e.reject(s)}return}e.fulfill(r)};ln.all=function(t){return new ln(function(e,r){for(var a=new Array(t.length),i=0,s=function(d,f){a[d]=f,i++,i===t.length&&e(a)},o=0;o<t.length;o++)(function(u){var d=t[u],f=d!=null&&d.then!=null;if(f)d.then(function(p){s(u,p)},function(p){r(p)});else{var h=d;s(u,h)}})(o)})};ln.resolve=function(t){return new ln(function(e,r){e(t)})};ln.reject=function(t){return new ln(function(e,r){r(t)})};var Lo=typeof Promise<"u"?Promise:ln,rm=function(e,r,a){var i=Im(e),s=!i,o=this._private=tt({duration:1e3},r,a);if(o.target=e,o.style=o.style||o.css,o.started=!1,o.playing=!1,o.hooked=!1,o.applying=!1,o.progress=0,o.completes=[],o.frames=[],o.complete&&Wt(o.complete)&&o.completes.push(o.complete),s){var u=e.position();o.startPosition=o.startPosition||{x:u.x,y:u.y},o.startStyle=o.startStyle||e.cy().style().getAnimationStartStyle(e,o.style)}if(i){var d=e.pan();o.startPan={x:d.x,y:d.y},o.startZoom=e.zoom()}this.length=1,this[0]=this},el=rm.prototype;tt(el,{instanceString:function(){return"animation"},hook:function(){var e=this._private;if(!e.hooked){var r,a=e.target._private.animation;e.queue?r=a.queue:r=a.current,r.push(this),Da(e.target)&&e.target.cy().addToAnimationPool(e.target),e.hooked=!0}return this},play:function(){var e=this._private;return e.progress===1&&(e.progress=0),e.playing=!0,e.started=!1,e.stopped=!1,this.hook(),this},playing:function(){return this._private.playing},apply:function(){var e=this._private;return e.applying=!0,e.started=!1,e.stopped=!1,this.hook(),this},applying:function(){return this._private.applying},pause:function(){var e=this._private;return e.playing=!1,e.started=!1,this},stop:function(){var e=this._private;return e.playing=!1,e.started=!1,e.stopped=!0,this},rewind:function(){return this.progress(0)},fastforward:function(){return this.progress(1)},time:function(e){var r=this._private;return e===void 0?r.progress*r.duration:this.progress(e/r.duration)},progress:function(e){var r=this._private,a=r.playing;return e===void 0?r.progress:(a&&this.pause(),r.progress=e,r.started=!1,a&&this.play(),this)},completed:function(){return this._private.progress===1},reverse:function(){var e=this._private,r=e.playing;r&&this.pause(),e.progress=1-e.progress,e.started=!1;var a=function(f,h){var p=e[f];p!=null&&(e[f]=e[h],e[h]=p)};if(a("zoom","startZoom"),a("pan","startPan"),a("position","startPosition"),e.style)for(var i=0;i<e.style.length;i++){var s=e.style[i],o=s.name,u=e.startStyle[o];e.startStyle[o]=s,e.style[i]=u}return r&&this.play(),this},promise:function(e){var r=this._private,a;switch(e){case"frame":a=r.frames;break;default:case"complete":case"completed":a=r.completes}return new Lo(function(i,s){a.push(function(){i()})})}});el.complete=el.completed;el.run=el.play;el.running=el.playing;var z3={animated:function(){return function(){var r=this,a=r.length!==void 0,i=a?r:[r],s=this._private.cy||this;if(!s.styleEnabled())return!1;var o=i[0];if(o)return o._private.animation.current.length>0}},clearQueue:function(){return function(){var r=this,a=r.length!==void 0,i=a?r:[r],s=this._private.cy||this;if(!s.styleEnabled())return this;for(var o=0;o<i.length;o++){var u=i[o];u._private.animation.queue=[]}return this}},delay:function(){return function(r,a){var i=this._private.cy||this;return i.styleEnabled()?this.animate({delay:r,duration:r,complete:a}):this}},delayAnimation:function(){return function(r,a){var i=this._private.cy||this;return i.styleEnabled()?this.animation({delay:r,duration:r,complete:a}):this}},animation:function(){return function(r,a){var i=this,s=i.length!==void 0,o=s?i:[i],u=this._private.cy||this,d=!s,f=!d;if(!u.styleEnabled())return this;var h=u.style();r=tt({},r,a);var p=Object.keys(r).length===0;if(p)return new rm(o[0],r);switch(r.duration===void 0&&(r.duration=400),r.duration){case"slow":r.duration=600;break;case"fast":r.duration=200;break}if(f&&(r.style=h.getPropsList(r.style||r.css),r.css=void 0),f&&r.renderedPosition!=null){var m=r.renderedPosition,y=u.pan(),x=u.zoom();r.position=hC(m,x,y)}if(d&&r.panBy!=null){var E=r.panBy,w=u.pan();r.pan={x:w.x+E.x,y:w.y+E.y}}var T=r.center||r.centre;if(d&&T!=null){var C=u.getCenterPan(T.eles,r.zoom);C!=null&&(r.pan=C)}if(d&&r.fit!=null){var N=r.fit,A=u.getFitViewport(N.eles||N.boundingBox,N.padding);A!=null&&(r.pan=A.pan,r.zoom=A.zoom)}if(d&&wt(r.zoom)){var D=u.getZoomedViewport(r.zoom);D!=null?(D.zoomed&&(r.zoom=D.zoom),D.panned&&(r.pan=D.pan)):r.zoom=null}return new rm(o[0],r)}},animate:function(){return function(r,a){var i=this,s=i.length!==void 0,o=s?i:[i],u=this._private.cy||this;if(!u.styleEnabled())return this;a&&(r=tt({},r,a));for(var d=0;d<o.length;d++){var f=o[d],h=f.animated()&&(r.queue===void 0||r.queue),p=f.animation(r,h?{queue:!0}:void 0);p.play()}return this}},stop:function(){return function(r,a){var i=this,s=i.length!==void 0,o=s?i:[i],u=this._private.cy||this;if(!u.styleEnabled())return this;for(var d=0;d<o.length;d++){for(var f=o[d],h=f._private,p=h.animation.current,m=0;m<p.length;m++){var y=p[m],x=y._private;a&&(x.duration=0)}r&&(h.animation.queue=[]),a||(h.animation.current=[])}return u.notify("draw"),this}}},d0,jw;function uh(){if(jw)return d0;jw=1;var t=Array.isArray;return d0=t,d0}var f0,Aw;function _3(){if(Aw)return f0;Aw=1;var t=uh(),e=jc(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;function i(s,o){if(t(s))return!1;var u=typeof s;return u=="number"||u=="symbol"||u=="boolean"||s==null||e(s)?!0:a.test(s)||!r.test(s)||o!=null&&s in Object(o)}return f0=i,f0}var h0,Mw;function U3(){if(Mw)return h0;Mw=1;var t=nC(),e=Nc(),r="[object AsyncFunction]",a="[object Function]",i="[object GeneratorFunction]",s="[object Proxy]";function o(u){if(!e(u))return!1;var d=t(u);return d==a||d==i||d==r||d==s}return h0=o,h0}var v0,kw;function q3(){if(kw)return v0;kw=1;var t=ih(),e=t["__core-js_shared__"];return v0=e,v0}var p0,Dw;function I3(){if(Dw)return p0;Dw=1;var t=q3(),e=(function(){var a=/[^.]+$/.exec(t&&t.keys&&t.keys.IE_PROTO||"");return a?"Symbol(src)_1."+a:""})();function r(a){return!!e&&e in a}return p0=r,p0}var g0,Ow;function V3(){if(Ow)return g0;Ow=1;var t=Function.prototype,e=t.toString;function r(a){if(a!=null){try{return e.call(a)}catch{}try{return a+""}catch{}}return""}return g0=r,g0}var m0,Rw;function F3(){if(Rw)return m0;Rw=1;var t=U3(),e=I3(),r=Nc(),a=V3(),i=/[\\^$.*+?()[\]{}|]/g,s=/^\[object .+?Constructor\]$/,o=Function.prototype,u=Object.prototype,d=o.toString,f=u.hasOwnProperty,h=RegExp("^"+d.call(f).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function p(m){if(!r(m)||e(m))return!1;var y=t(m)?h:s;return y.test(a(m))}return m0=p,m0}var y0,Bw;function H3(){if(Bw)return y0;Bw=1;function t(e,r){return e==null?void 0:e[r]}return y0=t,y0}var x0,Lw;function Wm(){if(Lw)return x0;Lw=1;var t=F3(),e=H3();function r(a,i){var s=e(a,i);return t(s)?s:void 0}return x0=r,x0}var b0,Pw;function ch(){if(Pw)return b0;Pw=1;var t=Wm(),e=t(Object,"create");return b0=e,b0}var w0,zw;function G3(){if(zw)return w0;zw=1;var t=ch();function e(){this.__data__=t?t(null):{},this.size=0}return w0=e,w0}var S0,_w;function Q3(){if(_w)return S0;_w=1;function t(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r}return S0=t,S0}var E0,Uw;function $3(){if(Uw)return E0;Uw=1;var t=ch(),e="__lodash_hash_undefined__",r=Object.prototype,a=r.hasOwnProperty;function i(s){var o=this.__data__;if(t){var u=o[s];return u===e?void 0:u}return a.call(o,s)?o[s]:void 0}return E0=i,E0}var T0,qw;function Y3(){if(qw)return T0;qw=1;var t=ch(),e=Object.prototype,r=e.hasOwnProperty;function a(i){var s=this.__data__;return t?s[i]!==void 0:r.call(s,i)}return T0=a,T0}var C0,Iw;function K3(){if(Iw)return C0;Iw=1;var t=ch(),e="__lodash_hash_undefined__";function r(a,i){var s=this.__data__;return this.size+=this.has(a)?0:1,s[a]=t&&i===void 0?e:i,this}return C0=r,C0}var N0,Vw;function X3(){if(Vw)return N0;Vw=1;var t=G3(),e=Q3(),r=$3(),a=Y3(),i=K3();function s(o){var u=-1,d=o==null?0:o.length;for(this.clear();++u<d;){var f=o[u];this.set(f[0],f[1])}}return s.prototype.clear=t,s.prototype.delete=e,s.prototype.get=r,s.prototype.has=a,s.prototype.set=i,N0=s,N0}var j0,Fw;function Z3(){if(Fw)return j0;Fw=1;function t(){this.__data__=[],this.size=0}return j0=t,j0}var A0,Hw;function MC(){if(Hw)return A0;Hw=1;function t(e,r){return e===r||e!==e&&r!==r}return A0=t,A0}var M0,Gw;function dh(){if(Gw)return M0;Gw=1;var t=MC();function e(r,a){for(var i=r.length;i--;)if(t(r[i][0],a))return i;return-1}return M0=e,M0}var k0,Qw;function W3(){if(Qw)return k0;Qw=1;var t=dh(),e=Array.prototype,r=e.splice;function a(i){var s=this.__data__,o=t(s,i);if(o<0)return!1;var u=s.length-1;return o==u?s.pop():r.call(s,o,1),--this.size,!0}return k0=a,k0}var D0,$w;function J3(){if($w)return D0;$w=1;var t=dh();function e(r){var a=this.__data__,i=t(a,r);return i<0?void 0:a[i][1]}return D0=e,D0}var O0,Yw;function eR(){if(Yw)return O0;Yw=1;var t=dh();function e(r){return t(this.__data__,r)>-1}return O0=e,O0}var R0,Kw;function tR(){if(Kw)return R0;Kw=1;var t=dh();function e(r,a){var i=this.__data__,s=t(i,r);return s<0?(++this.size,i.push([r,a])):i[s][1]=a,this}return R0=e,R0}var B0,Xw;function rR(){if(Xw)return B0;Xw=1;var t=Z3(),e=W3(),r=J3(),a=eR(),i=tR();function s(o){var u=-1,d=o==null?0:o.length;for(this.clear();++u<d;){var f=o[u];this.set(f[0],f[1])}}return s.prototype.clear=t,s.prototype.delete=e,s.prototype.get=r,s.prototype.has=a,s.prototype.set=i,B0=s,B0}var L0,Zw;function aR(){if(Zw)return L0;Zw=1;var t=Wm(),e=ih(),r=t(e,"Map");return L0=r,L0}var P0,Ww;function nR(){if(Ww)return P0;Ww=1;var t=X3(),e=rR(),r=aR();function a(){this.size=0,this.__data__={hash:new t,map:new(r||e),string:new t}}return P0=a,P0}var z0,Jw;function iR(){if(Jw)return z0;Jw=1;function t(e){var r=typeof e;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?e!=="__proto__":e===null}return z0=t,z0}var _0,eS;function fh(){if(eS)return _0;eS=1;var t=iR();function e(r,a){var i=r.__data__;return t(a)?i[typeof a=="string"?"string":"hash"]:i.map}return _0=e,_0}var U0,tS;function sR(){if(tS)return U0;tS=1;var t=fh();function e(r){var a=t(this,r).delete(r);return this.size-=a?1:0,a}return U0=e,U0}var q0,rS;function lR(){if(rS)return q0;rS=1;var t=fh();function e(r){return t(this,r).get(r)}return q0=e,q0}var I0,aS;function oR(){if(aS)return I0;aS=1;var t=fh();function e(r){return t(this,r).has(r)}return I0=e,I0}var V0,nS;function uR(){if(nS)return V0;nS=1;var t=fh();function e(r,a){var i=t(this,r),s=i.size;return i.set(r,a),this.size+=i.size==s?0:1,this}return V0=e,V0}var F0,iS;function cR(){if(iS)return F0;iS=1;var t=nR(),e=sR(),r=lR(),a=oR(),i=uR();function s(o){var u=-1,d=o==null?0:o.length;for(this.clear();++u<d;){var f=o[u];this.set(f[0],f[1])}}return s.prototype.clear=t,s.prototype.delete=e,s.prototype.get=r,s.prototype.has=a,s.prototype.set=i,F0=s,F0}var H0,sS;function dR(){if(sS)return H0;sS=1;var t=cR(),e="Expected a function";function r(a,i){if(typeof a!="function"||i!=null&&typeof i!="function")throw new TypeError(e);var s=function(){var o=arguments,u=i?i.apply(this,o):o[0],d=s.cache;if(d.has(u))return d.get(u);var f=a.apply(this,o);return s.cache=d.set(u,f)||d,f};return s.cache=new(r.Cache||t),s}return r.Cache=t,H0=r,H0}var G0,lS;function fR(){if(lS)return G0;lS=1;var t=dR(),e=500;function r(a){var i=t(a,function(o){return s.size===e&&s.clear(),o}),s=i.cache;return i}return G0=r,G0}var Q0,oS;function kC(){if(oS)return Q0;oS=1;var t=fR(),e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,a=t(function(i){var s=[];return i.charCodeAt(0)===46&&s.push(""),i.replace(e,function(o,u,d,f){s.push(d?f.replace(r,"$1"):u||o)}),s});return Q0=a,Q0}var $0,uS;function DC(){if(uS)return $0;uS=1;function t(e,r){for(var a=-1,i=e==null?0:e.length,s=Array(i);++a<i;)s[a]=r(e[a],a,e);return s}return $0=t,$0}var Y0,cS;function hR(){if(cS)return Y0;cS=1;var t=Fm(),e=DC(),r=uh(),a=jc(),i=t?t.prototype:void 0,s=i?i.toString:void 0;function o(u){if(typeof u=="string")return u;if(r(u))return e(u,o)+"";if(a(u))return s?s.call(u):"";var d=u+"";return d=="0"&&1/u==-1/0?"-0":d}return Y0=o,Y0}var K0,dS;function OC(){if(dS)return K0;dS=1;var t=hR();function e(r){return r==null?"":t(r)}return K0=e,K0}var X0,fS;function RC(){if(fS)return X0;fS=1;var t=uh(),e=_3(),r=kC(),a=OC();function i(s,o){return t(s)?s:e(s,o)?[s]:r(a(s))}return X0=i,X0}var Z0,hS;function Jm(){if(hS)return Z0;hS=1;var t=jc();function e(r){if(typeof r=="string"||t(r))return r;var a=r+"";return a=="0"&&1/r==-1/0?"-0":a}return Z0=e,Z0}var W0,vS;function vR(){if(vS)return W0;vS=1;var t=RC(),e=Jm();function r(a,i){i=t(i,a);for(var s=0,o=i.length;a!=null&&s<o;)a=a[e(i[s++])];return s&&s==o?a:void 0}return W0=r,W0}var J0,pS;function pR(){if(pS)return J0;pS=1;var t=vR();function e(r,a,i){var s=r==null?void 0:t(r,a);return s===void 0?i:s}return J0=e,J0}var gR=pR(),mR=Cc(gR),eg,gS;function yR(){if(gS)return eg;gS=1;var t=Wm(),e=(function(){try{var r=t(Object,"defineProperty");return r({},"",{}),r}catch{}})();return eg=e,eg}var tg,mS;function xR(){if(mS)return tg;mS=1;var t=yR();function e(r,a,i){a=="__proto__"&&t?t(r,a,{configurable:!0,enumerable:!0,value:i,writable:!0}):r[a]=i}return tg=e,tg}var rg,yS;function bR(){if(yS)return rg;yS=1;var t=xR(),e=MC(),r=Object.prototype,a=r.hasOwnProperty;function i(s,o,u){var d=s[o];(!(a.call(s,o)&&e(d,u))||u===void 0&&!(o in s))&&t(s,o,u)}return rg=i,rg}var ag,xS;function wR(){if(xS)return ag;xS=1;var t=9007199254740991,e=/^(?:0|[1-9]\d*)$/;function r(a,i){var s=typeof a;return i=i??t,!!i&&(s=="number"||s!="symbol"&&e.test(a))&&a>-1&&a%1==0&&a<i}return ag=r,ag}var ng,bS;function SR(){if(bS)return ng;bS=1;var t=bR(),e=RC(),r=wR(),a=Nc(),i=Jm();function s(o,u,d,f){if(!a(o))return o;u=e(u,o);for(var h=-1,p=u.length,m=p-1,y=o;y!=null&&++h<p;){var x=i(u[h]),E=d;if(x==="__proto__"||x==="constructor"||x==="prototype")return o;if(h!=m){var w=y[x];E=f?f(w,x,y):void 0,E===void 0&&(E=a(w)?w:r(u[h+1])?[]:{})}t(y,x,E),y=y[x]}return o}return ng=s,ng}var ig,wS;function ER(){if(wS)return ig;wS=1;var t=SR();function e(r,a,i){return r==null?r:t(r,a,i)}return ig=e,ig}var TR=ER(),CR=Cc(TR),sg,SS;function NR(){if(SS)return sg;SS=1;function t(e,r){var a=-1,i=e.length;for(r||(r=Array(i));++a<i;)r[a]=e[a];return r}return sg=t,sg}var lg,ES;function jR(){if(ES)return lg;ES=1;var t=DC(),e=NR(),r=uh(),a=jc(),i=kC(),s=Jm(),o=OC();function u(d){return r(d)?t(d,s):a(d)?[d]:e(i(o(d)))}return lg=u,lg}var AR=jR(),MR=Cc(AR),kR={data:function(e){var r={field:"data",bindingEvent:"data",allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:"data",settingTriggersEvent:!1,triggerFnName:"trigger",immutableKeys:{},updateStyle:!1,beforeGet:function(i){},beforeSet:function(i,s){},onSet:function(i){},canSet:function(i){return!0}};return e=tt({},r,e),function(i,s){var o=e,u=this,d=u.length!==void 0,f=d?u:[u],h=d?u[0]:u;if(Xe(i)){var p=i.indexOf(".")!==-1,m=p&&MR(i);if(o.allowGetting&&s===void 0){var y;return h&&(o.beforeGet(h),m&&h._private[o.field][i]===void 0?y=mR(h._private[o.field],m):y=h._private[o.field][i]),y}else if(o.allowSetting&&s!==void 0){var x=!o.immutableKeys[i];if(x){var E=YT({},i,s);o.beforeSet(u,E);for(var w=0,T=f.length;w<T;w++){var C=f[w];o.canSet(C)&&(m&&h._private[o.field][i]===void 0?CR(C._private[o.field],m,s):C._private[o.field][i]=s)}o.updateStyle&&u.updateStyle(),o.onSet(u),o.settingTriggersEvent&&u[o.triggerFnName](o.settingEvent)}}}else if(o.allowSetting&&wt(i)){var N=i,A,D,M=Object.keys(N);o.beforeSet(u,N);for(var j=0;j<M.length;j++){A=M[j],D=N[A];var k=!o.immutableKeys[A];if(k)for(var B=0;B<f.length;B++){var P=f[B];o.canSet(P)&&(P._private[o.field][A]=D)}}o.updateStyle&&u.updateStyle(),o.onSet(u),o.settingTriggersEvent&&u[o.triggerFnName](o.settingEvent)}else if(o.allowBinding&&Wt(i)){var U=i;u.on(o.bindingEvent,U)}else if(o.allowGetting&&i===void 0){var R;return h&&(o.beforeGet(h),R=h._private[o.field]),R}return u}},removeData:function(e){var r={field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}};return e=tt({},r,e),function(i){var s=e,o=this,u=o.length!==void 0,d=u?o:[o];if(Xe(i)){for(var f=i.split(/\s+/),h=f.length,p=0;p<h;p++){var m=f[p];if(!rs(m)){var y=!s.immutableKeys[m];if(y)for(var x=0,E=d.length;x<E;x++)d[x]._private[s.field][m]=void 0}}s.triggerEvent&&o[s.triggerFnName](s.event)}else if(i===void 0){for(var w=0,T=d.length;w<T;w++)for(var C=d[w]._private[s.field],N=Object.keys(C),A=0;A<N.length;A++){var D=N[A],M=!s.immutableKeys[D];M&&(C[D]=void 0)}s.triggerEvent&&o[s.triggerFnName](s.event)}return o}}},DR={eventAliasesOn:function(e){var r=e;r.addListener=r.listen=r.bind=r.on,r.unlisten=r.unbind=r.off=r.removeListener,r.trigger=r.emit,r.pon=r.promiseOn=function(a,i){var s=this,o=Array.prototype.slice.call(arguments,0);return new Lo(function(u,d){var f=function(y){s.off.apply(s,p),u(y)},h=o.concat([f]),p=h.concat([]);s.on.apply(s,h)})}}},jt={};[z3,kR,DR].forEach(function(t){tt(jt,t)});var OR={animate:jt.animate(),animation:jt.animation(),animated:jt.animated(),clearQueue:jt.clearQueue(),delay:jt.delay(),delayAnimation:jt.delayAnimation(),stop:jt.stop()},Ef={classes:function(e){var r=this;if(e===void 0){var a=[];return r[0]._private.classes.forEach(function(x){return a.push(x)}),a}else _t(e)||(e=(e||"").match(/\S+/g)||[]);for(var i=[],s=new Bo(e),o=0;o<r.length;o++){for(var u=r[o],d=u._private,f=d.classes,h=!1,p=0;p<e.length;p++){var m=e[p],y=f.has(m);if(!y){h=!0;break}}h||(h=f.size!==e.length),h&&(d.classes=s,i.push(u))}return i.length>0&&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){_t(e)||(e=e.match(/\S+/g)||[]);for(var a=this,i=r===void 0,s=[],o=0,u=a.length;o<u;o++)for(var d=a[o],f=d._private.classes,h=!1,p=0;p<e.length;p++){var m=e[p],y=f.has(m),x=!1;r||i&&!y?(f.add(m),x=!0):(!r||i&&y)&&(f.delete(m),x=!0),!h&&x&&(s.push(d),h=!0)}return s.length>0&&this.spawn(s).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}};Ef.className=Ef.classNames=Ef.classes;var bt={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+"};bt.variable="(?:[\\w-.]|(?:\\\\"+bt.metaChar+"))+";bt.className="(?:[\\w-]|(?:\\\\"+bt.metaChar+"))+";bt.value=bt.string+"|"+bt.number;bt.id=bt.variable;(function(){var t,e,r;for(t=bt.comparatorOp.split("|"),r=0;r<t.length;r++)e=t[r],bt.comparatorOp+="|@"+e;for(t=bt.comparatorOp.split("|"),r=0;r<t.length;r++)e=t[r],!(e.indexOf("!")>=0)&&e!=="="&&(bt.comparatorOp+="|\\!"+e)})();var Pt=function(){return{checks:[]}},Ie={GROUP:0,COLLECTION:1,FILTER:2,DATA_COMPARE:3,DATA_EXIST:4,DATA_BOOL:5,META_COMPARE:6,STATE:7,ID:8,CLASS:9,UNDIRECTED_EDGE:10,DIRECTED_EDGE:11,NODE_SOURCE:12,NODE_TARGET:13,NODE_NEIGHBOR:14,CHILD:15,DESCENDANT:16,PARENT:17,ANCESTOR:18,COMPOUND_SPLIT:19,TRUE:20},am=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort(function(t,e){return kD(t.selector,e.selector)}),RR=(function(){for(var t={},e,r=0;r<am.length;r++)e=am[r],t[e.selector]=e.matches;return t})(),BR=function(e,r){return RR[e](r)},LR="("+am.map(function(t){return t.selector}).join("|")+")",$l=function(e){return e.replace(new RegExp("\\\\("+bt.metaChar+")","g"),function(r,a){return a})},Ri=function(e,r,a){e[e.length-1]=a},nm=[{name:"group",query:!0,regex:"("+bt.group+")",populate:function(e,r,a){var i=mr(a,1),s=i[0];r.checks.push({type:Ie.GROUP,value:s==="*"?s:s+"s"})}},{name:"state",query:!0,regex:LR,populate:function(e,r,a){var i=mr(a,1),s=i[0];r.checks.push({type:Ie.STATE,value:s})}},{name:"id",query:!0,regex:"\\#("+bt.id+")",populate:function(e,r,a){var i=mr(a,1),s=i[0];r.checks.push({type:Ie.ID,value:$l(s)})}},{name:"className",query:!0,regex:"\\.("+bt.className+")",populate:function(e,r,a){var i=mr(a,1),s=i[0];r.checks.push({type:Ie.CLASS,value:$l(s)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+bt.variable+")\\s*\\]",populate:function(e,r,a){var i=mr(a,1),s=i[0];r.checks.push({type:Ie.DATA_EXIST,field:$l(s)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+bt.variable+")\\s*("+bt.comparatorOp+")\\s*("+bt.value+")\\s*\\]",populate:function(e,r,a){var i=mr(a,3),s=i[0],o=i[1],u=i[2],d=new RegExp("^"+bt.string+"$").exec(u)!=null;d?u=u.substring(1,u.length-1):u=parseFloat(u),r.checks.push({type:Ie.DATA_COMPARE,field:$l(s),operator:o,value:u})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+bt.boolOp+")\\s*("+bt.variable+")\\s*\\]",populate:function(e,r,a){var i=mr(a,2),s=i[0],o=i[1];r.checks.push({type:Ie.DATA_BOOL,field:$l(o),operator:s})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+bt.meta+")\\s*("+bt.comparatorOp+")\\s*("+bt.number+")\\s*\\]\\]",populate:function(e,r,a){var i=mr(a,3),s=i[0],o=i[1],u=i[2];r.checks.push({type:Ie.META_COMPARE,field:$l(s),operator:o,value:parseFloat(u)})}},{name:"nextQuery",separator:!0,regex:bt.separator,populate:function(e,r){var a=e.currentSubject,i=e.edgeCount,s=e.compoundCount,o=e[e.length-1];a!=null&&(o.subject=a,e.currentSubject=null),o.edgeCount=i,o.compoundCount=s,e.edgeCount=0,e.compoundCount=0;var u=e[e.length++]=Pt();return u}},{name:"directedEdge",separator:!0,regex:bt.directedEdge,populate:function(e,r){if(e.currentSubject==null){var a=Pt(),i=r,s=Pt();return a.checks.push({type:Ie.DIRECTED_EDGE,source:i,target:s}),Ri(e,r,a),e.edgeCount++,s}else{var o=Pt(),u=r,d=Pt();return o.checks.push({type:Ie.NODE_SOURCE,source:u,target:d}),Ri(e,r,o),e.edgeCount++,d}}},{name:"undirectedEdge",separator:!0,regex:bt.undirectedEdge,populate:function(e,r){if(e.currentSubject==null){var a=Pt(),i=r,s=Pt();return a.checks.push({type:Ie.UNDIRECTED_EDGE,nodes:[i,s]}),Ri(e,r,a),e.edgeCount++,s}else{var o=Pt(),u=r,d=Pt();return o.checks.push({type:Ie.NODE_NEIGHBOR,node:u,neighbor:d}),Ri(e,r,o),d}}},{name:"child",separator:!0,regex:bt.child,populate:function(e,r){if(e.currentSubject==null){var a=Pt(),i=Pt(),s=e[e.length-1];return a.checks.push({type:Ie.CHILD,parent:s,child:i}),Ri(e,r,a),e.compoundCount++,i}else if(e.currentSubject===r){var o=Pt(),u=e[e.length-1],d=Pt(),f=Pt(),h=Pt(),p=Pt();return o.checks.push({type:Ie.COMPOUND_SPLIT,left:u,right:d,subject:f}),f.checks=r.checks,r.checks=[{type:Ie.TRUE}],p.checks.push({type:Ie.TRUE}),d.checks.push({type:Ie.PARENT,parent:p,child:h}),Ri(e,u,o),e.currentSubject=f,e.compoundCount++,h}else{var m=Pt(),y=Pt(),x=[{type:Ie.PARENT,parent:m,child:y}];return m.checks=r.checks,r.checks=x,e.compoundCount++,y}}},{name:"descendant",separator:!0,regex:bt.descendant,populate:function(e,r){if(e.currentSubject==null){var a=Pt(),i=Pt(),s=e[e.length-1];return a.checks.push({type:Ie.DESCENDANT,ancestor:s,descendant:i}),Ri(e,r,a),e.compoundCount++,i}else if(e.currentSubject===r){var o=Pt(),u=e[e.length-1],d=Pt(),f=Pt(),h=Pt(),p=Pt();return o.checks.push({type:Ie.COMPOUND_SPLIT,left:u,right:d,subject:f}),f.checks=r.checks,r.checks=[{type:Ie.TRUE}],p.checks.push({type:Ie.TRUE}),d.checks.push({type:Ie.ANCESTOR,ancestor:p,descendant:h}),Ri(e,u,o),e.currentSubject=f,e.compoundCount++,h}else{var m=Pt(),y=Pt(),x=[{type:Ie.ANCESTOR,ancestor:m,descendant:y}];return m.checks=r.checks,r.checks=x,e.compoundCount++,y}}},{name:"subject",modifier:!0,regex:bt.subject,populate:function(e,r){if(e.currentSubject!=null&&e.currentSubject!==r)return At("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=r;var a=e[e.length-1],i=a.checks[0],s=i==null?null:i.type;s===Ie.DIRECTED_EDGE?i.type=Ie.NODE_TARGET:s===Ie.UNDIRECTED_EDGE&&(i.type=Ie.NODE_NEIGHBOR,i.node=i.nodes[1],i.neighbor=i.nodes[0],i.nodes=null)}}];nm.forEach(function(t){return t.regexObj=new RegExp("^"+t.regex)});var PR=function(e){for(var r,a,i,s=0;s<nm.length;s++){var o=nm[s],u=o.name,d=e.match(o.regexObj);if(d!=null){a=d,r=o,i=u;var f=d[0];e=e.substring(f.length);break}}return{expr:r,match:a,name:i,remaining:e}},zR=function(e){var r=e.match(/^\s+/);if(r){var a=r[0];e=e.substring(a.length)}return e},_R=function(e){var r=this,a=r.inputText=e,i=r[0]=Pt();for(r.length=1,a=zR(a);;){var s=PR(a);if(s.expr==null)return At("The selector `"+e+"`is invalid"),!1;var o=s.match.slice(1),u=s.expr.populate(r,i,o);if(u===!1)return!1;if(u!=null&&(i=u),a=s.remaining,a.match(/^\s*$/))break}var d=r[r.length-1];r.currentSubject!=null&&(d.subject=r.currentSubject),d.edgeCount=r.edgeCount,d.compoundCount=r.compoundCount;for(var f=0;f<r.length;f++){var h=r[f];if(h.compoundCount>0&&h.edgeCount>0)return At("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(h.edgeCount>1)return At("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;h.edgeCount===1&&At("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},UR=function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(h){return h??""},r=function(h){return Xe(h)?'"'+h+'"':e(h)},a=function(h){return" "+h+" "},i=function(h,p){var m=h.type,y=h.value;switch(m){case Ie.GROUP:{var x=e(y);return x.substring(0,x.length-1)}case Ie.DATA_COMPARE:{var E=h.field,w=h.operator;return"["+E+a(e(w))+r(y)+"]"}case Ie.DATA_BOOL:{var T=h.operator,C=h.field;return"["+e(T)+C+"]"}case Ie.DATA_EXIST:{var N=h.field;return"["+N+"]"}case Ie.META_COMPARE:{var A=h.operator,D=h.field;return"[["+D+a(e(A))+r(y)+"]]"}case Ie.STATE:return y;case Ie.ID:return"#"+y;case Ie.CLASS:return"."+y;case Ie.PARENT:case Ie.CHILD:return s(h.parent,p)+a(">")+s(h.child,p);case Ie.ANCESTOR:case Ie.DESCENDANT:return s(h.ancestor,p)+" "+s(h.descendant,p);case Ie.COMPOUND_SPLIT:{var M=s(h.left,p),j=s(h.subject,p),k=s(h.right,p);return M+(M.length>0?" ":"")+j+k}case Ie.TRUE:return""}},s=function(h,p){return h.checks.reduce(function(m,y,x){return m+(p===h&&x===0?"$":"")+i(y,p)},"")},o="",u=0;u<this.length;u++){var d=this[u];o+=s(d,d.subject),this.length>1&&u<this.length-1&&(o+=", ")}return this.toStringCache=o,o},qR={parse:_R,toString:UR},BC=function(e,r,a){var i,s=Xe(e),o=De(e),u=Xe(a),d,f,h=!1,p=!1,m=!1;switch(r.indexOf("!")>=0&&(r=r.replace("!",""),p=!0),r.indexOf("@")>=0&&(r=r.replace("@",""),h=!0),(s||u||h)&&(d=!s&&!o?"":""+e,f=""+a),h&&(e=d=d.toLowerCase(),a=f=f.toLowerCase()),r){case"*=":i=d.indexOf(f)>=0;break;case"$=":i=d.indexOf(f,d.length-f.length)>=0;break;case"^=":i=d.indexOf(f)===0;break;case"=":i=e===a;break;case">":m=!0,i=e>a;break;case">=":m=!0,i=e>=a;break;case"<":m=!0,i=e<a;break;case"<=":m=!0,i=e<=a;break;default:i=!1;break}return p&&(e!=null||!m)&&(i=!i),i},IR=function(e,r){switch(r){case"?":return!!e;case"!":return!e;case"^":return e===void 0}},VR=function(e){return e!==void 0},ey=function(e,r){return e.data(r)},FR=function(e,r){return e[r]()},ir=[],Ft=function(e,r){return e.checks.every(function(a){return ir[a.type](a,r)})};ir[Ie.GROUP]=function(t,e){var r=t.value;return r==="*"||r===e.group()};ir[Ie.STATE]=function(t,e){var r=t.value;return BR(r,e)};ir[Ie.ID]=function(t,e){var r=t.value;return e.id()===r};ir[Ie.CLASS]=function(t,e){var r=t.value;return e.hasClass(r)};ir[Ie.META_COMPARE]=function(t,e){var r=t.field,a=t.operator,i=t.value;return BC(FR(e,r),a,i)};ir[Ie.DATA_COMPARE]=function(t,e){var r=t.field,a=t.operator,i=t.value;return BC(ey(e,r),a,i)};ir[Ie.DATA_BOOL]=function(t,e){var r=t.field,a=t.operator;return IR(ey(e,r),a)};ir[Ie.DATA_EXIST]=function(t,e){var r=t.field;return t.operator,VR(ey(e,r))};ir[Ie.UNDIRECTED_EDGE]=function(t,e){var r=t.nodes[0],a=t.nodes[1],i=e.source(),s=e.target();return Ft(r,i)&&Ft(a,s)||Ft(a,i)&&Ft(r,s)};ir[Ie.NODE_NEIGHBOR]=function(t,e){return Ft(t.node,e)&&e.neighborhood().some(function(r){return r.isNode()&&Ft(t.neighbor,r)})};ir[Ie.DIRECTED_EDGE]=function(t,e){return Ft(t.source,e.source())&&Ft(t.target,e.target())};ir[Ie.NODE_SOURCE]=function(t,e){return Ft(t.source,e)&&e.outgoers().some(function(r){return r.isNode()&&Ft(t.target,r)})};ir[Ie.NODE_TARGET]=function(t,e){return Ft(t.target,e)&&e.incomers().some(function(r){return r.isNode()&&Ft(t.source,r)})};ir[Ie.CHILD]=function(t,e){return Ft(t.child,e)&&Ft(t.parent,e.parent())};ir[Ie.PARENT]=function(t,e){return Ft(t.parent,e)&&e.children().some(function(r){return Ft(t.child,r)})};ir[Ie.DESCENDANT]=function(t,e){return Ft(t.descendant,e)&&e.ancestors().some(function(r){return Ft(t.ancestor,r)})};ir[Ie.ANCESTOR]=function(t,e){return Ft(t.ancestor,e)&&e.descendants().some(function(r){return Ft(t.descendant,r)})};ir[Ie.COMPOUND_SPLIT]=function(t,e){return Ft(t.subject,e)&&Ft(t.left,e)&&Ft(t.right,e)};ir[Ie.TRUE]=function(){return!0};ir[Ie.COLLECTION]=function(t,e){var r=t.value;return r.has(e)};ir[Ie.FILTER]=function(t,e){var r=t.value;return r(e)};var HR=function(e){var r=this;if(r.length===1&&r[0].checks.length===1&&r[0].checks[0].type===Ie.ID)return e.getElementById(r[0].checks[0].value).collection();var a=function(s){for(var o=0;o<r.length;o++){var u=r[o];if(Ft(u,s))return!0}return!1};return r.text()==null&&(a=function(){return!0}),e.filter(a)},GR=function(e){for(var r=this,a=0;a<r.length;a++){var i=r[a];if(Ft(i,e))return!0}return!1},QR={matches:GR,filter:HR},is=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,e==null||Xe(e)&&e.match(/^\s*$/)||(Da(e)?this.addQuery({checks:[{type:Ie.COLLECTION,value:e.collection()}]}):Wt(e)?this.addQuery({checks:[{type:Ie.FILTER,value:e}]}):Xe(e)?this.parse(e)||(this.invalid=!0):$t("A selector must be created from a string; found "))},ss=is.prototype;[qR,QR].forEach(function(t){return tt(ss,t)});ss.text=function(){return this.inputText};ss.size=function(){return this.length};ss.eq=function(t){return this[t]};ss.sameText=function(t){return!this.invalid&&!t.invalid&&this.text()===t.text()};ss.addQuery=function(t){this[this.length++]=t};ss.selector=ss.toString;var Ji={allAre:function(e){var r=new is(e);return this.every(function(a){return r.matches(a)})},is:function(e){var r=new is(e);return this.some(function(a){return r.matches(a)})},some:function(e,r){for(var a=0;a<this.length;a++){var i=r?e.apply(r,[this[a],a,this]):e(this[a],a,this);if(i)return!0}return!1},every:function(e,r){for(var a=0;a<this.length;a++){var i=r?e.apply(r,[this[a],a,this]):e(this[a],a,this);if(!i)return!1}return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var r=this.length,a=e.length;return r!==a?!1:r===1?this[0]===e[0]:this.every(function(i){return e.hasElementWithId(i.id())})},anySame:function(e){return e=this.cy().collection(e),this.some(function(r){return e.hasElementWithId(r.id())})},allAreNeighbors:function(e){e=this.cy().collection(e);var r=this.neighborhood();return e.every(function(a){return r.hasElementWithId(a.id())})},contains:function(e){e=this.cy().collection(e);var r=this;return e.every(function(a){return r.hasElementWithId(a.id())})}};Ji.allAreNeighbours=Ji.allAreNeighbors;Ji.has=Ji.contains;Ji.equal=Ji.equals=Ji.same;var Xa=function(e,r){return function(i,s,o,u){var d=i,f=this,h;if(d==null?h="":Da(d)&&d.length===1&&(h=d.id()),f.length===1&&h){var p=f[0]._private,m=p.traversalCache=p.traversalCache||{},y=m[r]=m[r]||[],x=Ws(h),E=y[x];return E||(y[x]=e.call(f,i,s,o,u))}else return e.call(f,i,s,o,u)}},Do={parent:function(e){var r=[];if(this.length===1){var a=this[0]._private.parent;if(a)return a}for(var i=0;i<this.length;i++){var s=this[i],o=s._private.parent;o&&r.push(o)}return this.spawn(r,!0).filter(e)},parents:function(e){for(var r=[],a=this.parent();a.nonempty();){for(var i=0;i<a.length;i++){var s=a[i];r.push(s)}a=a.parent()}return this.spawn(r,!0).filter(e)},commonAncestors:function(e){for(var r,a=0;a<this.length;a++){var i=this[a],s=i.parents();r=r||s,r=r.intersect(s)}return r.filter(e)},orphans:function(e){return this.stdFilter(function(r){return r.isOrphan()}).filter(e)},nonorphans:function(e){return this.stdFilter(function(r){return r.isChild()}).filter(e)},children:Xa(function(t){for(var e=[],r=0;r<this.length;r++)for(var a=this[r],i=a._private.children,s=0;s<i.length;s++)e.push(i[s]);return this.spawn(e,!0).filter(t)},"children"),siblings:function(e){return this.parent().children().not(this).filter(e)},isParent:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length!==0},isChildless:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length===0},isChild:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent!=null},isOrphan:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent==null},descendants:function(e){var r=[];function a(i){for(var s=0;s<i.length;s++){var o=i[s];r.push(o),o.children().nonempty()&&a(o.children())}}return a(this.children()),this.spawn(r,!0).filter(e)}};function ty(t,e,r,a){for(var i=[],s=new Bo,o=t.cy(),u=o.hasCompoundNodes(),d=0;d<t.length;d++){var f=t[d];r?i.push(f):u&&a(i,s,f)}for(;i.length>0;){var h=i.shift();e(h),s.add(h.id()),u&&a(i,s,h)}return t}function LC(t,e,r){if(r.isParent())for(var a=r._private.children,i=0;i<a.length;i++){var s=a[i];e.has(s.id())||t.push(s)}}Do.forEachDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return ty(this,t,e,LC)};function PC(t,e,r){if(r.isChild()){var a=r._private.parent;e.has(a.id())||t.push(a)}}Do.forEachUp=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return ty(this,t,e,PC)};function $R(t,e,r){PC(t,e,r),LC(t,e,r)}Do.forEachUpAndDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return ty(this,t,e,$R)};Do.ancestors=Do.parents;var ac,zC;ac=zC={data:jt.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:jt.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:jt.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:jt.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:jt.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:jt.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}};ac.attr=ac.data;ac.removeAttr=ac.removeData;var YR=zC,hh={};function og(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],s=i._private.edges,o=0;o<s.length;o++){var u=s[o];!e&&u.isLoop()||(a+=t(i,u))}return a}else return}}tt(hh,{degree:og(function(t,e){return e.source().same(e.target())?2:1}),indegree:og(function(t,e){return e.target().same(t)?1:0}),outdegree:og(function(t,e){return e.source().same(t)?1:0})});function Yl(t,e){return function(r){for(var a,i=this.nodes(),s=0;s<i.length;s++){var o=i[s],u=o[t](r);u!==void 0&&(a===void 0||e(u,a))&&(a=u)}return a}}tt(hh,{minDegree:Yl("degree",function(t,e){return t<e}),maxDegree:Yl("degree",function(t,e){return t>e}),minIndegree:Yl("indegree",function(t,e){return t<e}),maxIndegree:Yl("indegree",function(t,e){return t>e}),minOutdegree:Yl("outdegree",function(t,e){return t<e}),maxOutdegree:Yl("outdegree",function(t,e){return t>e})});tt(hh,{totalDegree:function(e){for(var r=0,a=this.nodes(),i=0;i<a.length;i++)r+=a[i].degree(e);return r}});var sn,_C,UC=function(e,r,a){for(var i=0;i<e.length;i++){var s=e[i];if(!s.locked()){var o=s._private.position,u={x:r.x!=null?r.x-o.x:0,y:r.y!=null?r.y-o.y:0};s.isParent()&&!(u.x===0&&u.y===0)&&s.children().shift(u,a),s.dirtyBoundingBoxCache()}}},TS={field:"position",bindingEvent:"position",allowBinding:!0,allowSetting:!0,settingEvent:"position",settingTriggersEvent:!0,triggerFnName:"emitAndNotify",allowGetting:!0,validKeys:["x","y"],beforeGet:function(e){e.updateCompoundBounds()},beforeSet:function(e,r){UC(e,r,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};sn=_C={position:jt.data(TS),silentPosition:jt.data(tt({},TS,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,r){UC(e,r,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,r){if(wt(e))r?this.silentPosition(e):this.position(e);else if(Wt(e)){var a=e,i=this.cy();i.startBatch();for(var s=0;s<this.length;s++){var o=this[s],u=void 0;(u=a(o,s))&&(r?o.silentPosition(u):o.position(u))}i.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,r,a){var i;if(wt(e)?(i={x:De(e.x)?e.x:0,y:De(e.y)?e.y:0},a=r):Xe(e)&&De(r)&&(i={x:0,y:0},i[e]=r),i!=null){var s=this.cy();s.startBatch();for(var o=0;o<this.length;o++){var u=this[o];if(!(s.hasCompoundNodes()&&u.isChild()&&u.ancestors().anySame(this))){var d=u.position(),f={x:d.x+i.x,y:d.y+i.y};a?u.silentPosition(f):u.position(f)}}s.endBatch()}return this},silentShift:function(e,r){return wt(e)?this.shift(e,!0):Xe(e)&&De(r)&&this.shift(e,r,!0),this},renderedPosition:function(e,r){var a=this[0],i=this.cy(),s=i.zoom(),o=i.pan(),u=wt(e)?e:void 0,d=u!==void 0||r!==void 0&&Xe(e);if(a&&a.isNode())if(d)for(var f=0;f<this.length;f++){var h=this[f];r!==void 0?h.position(e,(r-o[e])/s):u!==void 0&&h.position(hC(u,s,o))}else{var p=a.position();return u=lh(p,s,o),e===void 0?u:u[e]}else if(!d)return;return this},relativePosition:function(e,r){var a=this[0],i=this.cy(),s=wt(e)?e:void 0,o=s!==void 0||r!==void 0&&Xe(e),u=i.hasCompoundNodes();if(a&&a.isNode())if(o)for(var d=0;d<this.length;d++){var f=this[d],h=u?f.parent():null,p=h&&h.length>0,m=p;p&&(h=h[0]);var y=m?h.position():{x:0,y:0};r!==void 0?f.position(e,r+y[e]):s!==void 0&&f.position({x:s.x+y.x,y:s.y+y.y})}else{var x=a.position(),E=u?a.parent():null,w=E&&E.length>0,T=w;w&&(E=E[0]);var C=T?E.position():{x:0,y:0};return s={x:x.x-C.x,y:x.y-C.y},e===void 0?s:s[e]}else if(!o)return;return this}};sn.modelPosition=sn.point=sn.position;sn.modelPositions=sn.points=sn.positions;sn.renderedPoint=sn.renderedPosition;sn.relativePoint=sn.relativePosition;var KR=_C,co,fs;co=fs={};fs.renderedBoundingBox=function(t){var e=this.boundingBox(t),r=this.cy(),a=r.zoom(),i=r.pan(),s=e.x1*a+i.x,o=e.x2*a+i.x,u=e.y1*a+i.y,d=e.y2*a+i.y;return{x1:s,x2:o,y1:u,y2:d,w:o-s,h:d-u}};fs.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)};fs.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(o){if(!o.isParent())return;var u=o._private,d=o.children(),f=o.pstyle("compound-sizing-wrt-labels").value==="include",h={width:{val:o.pstyle("min-width").pfValue,left:o.pstyle("min-width-bias-left"),right:o.pstyle("min-width-bias-right")},height:{val:o.pstyle("min-height").pfValue,top:o.pstyle("min-height-bias-top"),bottom:o.pstyle("min-height-bias-bottom")}},p=d.boundingBox({includeLabels:f,includeOverlays:!1,useCache:!1}),m=u.position;(p.w===0||p.h===0)&&(p={w:o.pstyle("width").pfValue,h:o.pstyle("height").pfValue},p.x1=m.x-p.w/2,p.x2=m.x+p.w/2,p.y1=m.y-p.h/2,p.y2=m.y+p.h/2);function y(B,P,U){var R=0,V=0,_=P+U;return B>0&&_>0&&(R=P/_*B,V=U/_*B),{biasDiff:R,biasComplementDiff:V}}function x(B,P,U,R){if(U.units==="%")switch(R){case"width":return B>0?U.pfValue*B:0;case"height":return P>0?U.pfValue*P:0;case"average":return B>0&&P>0?U.pfValue*(B+P)/2:0;case"min":return B>0&&P>0?B>P?U.pfValue*P:U.pfValue*B:0;case"max":return B>0&&P>0?B>P?U.pfValue*B:U.pfValue*P:0;default:return 0}else return U.units==="px"?U.pfValue:0}var E=h.width.left.value;h.width.left.units==="px"&&h.width.val>0&&(E=E*100/h.width.val);var w=h.width.right.value;h.width.right.units==="px"&&h.width.val>0&&(w=w*100/h.width.val);var T=h.height.top.value;h.height.top.units==="px"&&h.height.val>0&&(T=T*100/h.height.val);var C=h.height.bottom.value;h.height.bottom.units==="px"&&h.height.val>0&&(C=C*100/h.height.val);var N=y(h.width.val-p.w,E,w),A=N.biasDiff,D=N.biasComplementDiff,M=y(h.height.val-p.h,T,C),j=M.biasDiff,k=M.biasComplementDiff;u.autoPadding=x(p.w,p.h,o.pstyle("padding"),o.pstyle("padding-relative-to").value),u.autoWidth=Math.max(p.w,h.width.val),m.x=(-A+p.x1+p.x2+D)/2,u.autoHeight=Math.max(p.h,h.height.val),m.y=(-j+p.y1+p.y2+k)/2}for(var a=0;a<this.length;a++){var i=this[a],s=i._private;(!s.compoundBoundsClean||t)&&(r(i),e.batching()||(s.compoundBoundsClean=!0))}return this};var Ka=function(e){return e===1/0||e===-1/0?0:e},rn=function(e,r,a,i,s){i-r===0||s-a===0||r==null||a==null||i==null||s==null||(e.x1=r<e.x1?r:e.x1,e.x2=i>e.x2?i:e.x2,e.y1=a<e.y1?a:e.y1,e.y2=s>e.y2?s:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},Pi=function(e,r){return r==null?e:rn(e,r.x1,r.y1,r.x2,r.y2)},Ru=function(e,r,a){return ga(e,r,a)},lf=function(e,r,a){if(!r.cy().headless()){var i=r._private,s=i.rstyle,o=s.arrowWidth/2,u=r.pstyle(a+"-arrow-shape").value,d,f;if(u!=="none"){a==="source"?(d=s.srcX,f=s.srcY):a==="target"?(d=s.tgtX,f=s.tgtY):(d=s.midX,f=s.midY);var h=i.arrowBounds=i.arrowBounds||{},p=h[a]=h[a]||{};p.x1=d-o,p.y1=f-o,p.x2=d+o,p.y2=f+o,p.w=p.x2-p.x1,p.h=p.y2-p.y1,wf(p,1),rn(e,p.x1,p.y1,p.x2,p.y2)}}},ug=function(e,r,a){if(!r.cy().headless()){var i;a?i=a+"-":i="";var s=r._private,o=s.rstyle,u=r.pstyle(i+"label").strValue;if(u){var d=r.pstyle("text-halign"),f=r.pstyle("text-valign"),h=Ru(o,"labelWidth",a),p=Ru(o,"labelHeight",a),m=Ru(o,"labelX",a),y=Ru(o,"labelY",a),x=r.pstyle(i+"text-margin-x").pfValue,E=r.pstyle(i+"text-margin-y").pfValue,w=r.isEdge(),T=r.pstyle(i+"text-rotation"),C=r.pstyle("text-outline-width").pfValue,N=r.pstyle("text-border-width").pfValue,A=N/2,D=r.pstyle("text-background-padding").pfValue,M=2,j=p,k=h,B=k/2,P=j/2,U,R,V,_;if(w)U=m-B,R=m+B,V=y-P,_=y+P;else{switch(d.value){case"left":U=m-k,R=m;break;case"center":U=m-B,R=m+B;break;case"right":U=m,R=m+k;break}switch(f.value){case"top":V=y-j,_=y;break;case"center":V=y-P,_=y+P;break;case"bottom":V=y,_=y+j;break}}var H=x-Math.max(C,A)-D-M,z=x+Math.max(C,A)+D+M,I=E-Math.max(C,A)-D-M,F=E+Math.max(C,A)+D+M;U+=H,R+=z,V+=I,_+=F;var K=a||"main",J=s.labelBounds,L=J[K]=J[K]||{};L.x1=U,L.y1=V,L.x2=R,L.y2=_,L.w=R-U,L.h=_-V,L.leftPad=H,L.rightPad=z,L.topPad=I,L.botPad=F;var Q=w&&T.strValue==="autorotate",X=T.pfValue!=null&&T.pfValue!==0;if(Q||X){var W=Q?Ru(s.rstyle,"labelAngle",a):T.pfValue,te=Math.cos(W),Y=Math.sin(W),ne=(U+R)/2,he=(V+_)/2;if(!w){switch(d.value){case"left":ne=R;break;case"right":ne=U;break}switch(f.value){case"top":he=_;break;case"bottom":he=V;break}}var oe=function(Qe,Se){return Qe=Qe-ne,Se=Se-he,{x:Qe*te-Se*Y+ne,y:Qe*Y+Se*te+he}},ae=oe(U,V),re=oe(U,_),le=oe(R,V),se=oe(R,_);U=Math.min(ae.x,re.x,le.x,se.x),R=Math.max(ae.x,re.x,le.x,se.x),V=Math.min(ae.y,re.y,le.y,se.y),_=Math.max(ae.y,re.y,le.y,se.y)}var Ne=K+"Rot",Ae=J[Ne]=J[Ne]||{};Ae.x1=U,Ae.y1=V,Ae.x2=R,Ae.y2=_,Ae.w=R-U,Ae.h=_-V,rn(e,U,V,R,_),rn(s.labelBounds.all,U,V,R,_)}return e}},CS=function(e,r){if(!r.cy().headless()){var a=r.pstyle("outline-opacity").value,i=r.pstyle("outline-width").value,s=r.pstyle("outline-offset").value,o=i+s;qC(e,r,a,o,"outside",o/2)}},qC=function(e,r,a,i,s,o){if(!(a===0||i<=0||s==="inside")){var u=r.cy(),d=r.pstyle("shape").value,f=u.renderer().nodeShapes[d],h=r.position(),p=h.x,m=h.y,y=r.width(),x=r.height();if(f.hasMiterBounds){s==="center"&&(i/=2);var E=f.miterBounds(p,m,y,x,i);Pi(e,E)}else o!=null&&o>0&&Sf(e,[o,o,o,o])}},XR=function(e,r){if(!r.cy().headless()){var a=r.pstyle("border-opacity").value,i=r.pstyle("border-width").pfValue,s=r.pstyle("border-position").value;qC(e,r,a,i,s)}},ZR=function(e,r){var a=e._private.cy,i=a.styleEnabled(),s=a.headless(),o=na(),u=e._private,d=e.isNode(),f=e.isEdge(),h,p,m,y,x,E,w=u.rstyle,T=d&&i?e.pstyle("bounds-expansion").pfValue:[0],C=function(Ze){return Ze.pstyle("display").value!=="none"},N=!i||C(e)&&(!f||C(e.source())&&C(e.target()));if(N){var A=0,D=0;i&&r.includeOverlays&&(A=e.pstyle("overlay-opacity").value,A!==0&&(D=e.pstyle("overlay-padding").value));var M=0,j=0;i&&r.includeUnderlays&&(M=e.pstyle("underlay-opacity").value,M!==0&&(j=e.pstyle("underlay-padding").value));var k=Math.max(D,j),B=0,P=0;if(i&&(B=e.pstyle("width").pfValue,P=B/2),d&&r.includeNodes){var U=e.position();x=U.x,E=U.y;var R=e.outerWidth(),V=R/2,_=e.outerHeight(),H=_/2;h=x-V,p=x+V,m=E-H,y=E+H,rn(o,h,m,p,y),i&&CS(o,e),i&&r.includeOutlines&&!s&&CS(o,e),i&&XR(o,e)}else if(f&&r.includeEdges)if(i&&!s){var z=e.pstyle("curve-style").strValue;if(h=Math.min(w.srcX,w.midX,w.tgtX),p=Math.max(w.srcX,w.midX,w.tgtX),m=Math.min(w.srcY,w.midY,w.tgtY),y=Math.max(w.srcY,w.midY,w.tgtY),h-=P,p+=P,m-=P,y+=P,rn(o,h,m,p,y),z==="haystack"){var I=w.haystackPts;if(I&&I.length===2){if(h=I[0].x,m=I[0].y,p=I[1].x,y=I[1].y,h>p){var F=h;h=p,p=F}if(m>y){var K=m;m=y,y=K}rn(o,h-P,m-P,p+P,y+P)}}else if(z==="bezier"||z==="unbundled-bezier"||Yi(z,"segments")||Yi(z,"taxi")){var J;switch(z){case"bezier":case"unbundled-bezier":J=w.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":J=w.linePts;break}if(J!=null)for(var L=0;L<J.length;L++){var Q=J[L];h=Q.x-P,p=Q.x+P,m=Q.y-P,y=Q.y+P,rn(o,h,m,p,y)}}}else{var X=e.source(),W=X.position(),te=e.target(),Y=te.position();if(h=W.x,p=Y.x,m=W.y,y=Y.y,h>p){var ne=h;h=p,p=ne}if(m>y){var he=m;m=y,y=he}h-=P,p+=P,m-=P,y+=P,rn(o,h,m,p,y)}if(i&&r.includeEdges&&f&&(lf(o,e,"mid-source"),lf(o,e,"mid-target"),lf(o,e,"source"),lf(o,e,"target")),i){var oe=e.pstyle("ghost").value==="yes";if(oe){var ae=e.pstyle("ghost-offset-x").pfValue,re=e.pstyle("ghost-offset-y").pfValue;rn(o,o.x1+ae,o.y1+re,o.x2+ae,o.y2+re)}}var le=u.bodyBounds=u.bodyBounds||{};cw(le,o),Sf(le,T),wf(le,1),i&&(h=o.x1,p=o.x2,m=o.y1,y=o.y2,rn(o,h-k,m-k,p+k,y+k));var se=u.overlayBounds=u.overlayBounds||{};cw(se,o),Sf(se,T),wf(se,1);var Ne=u.labelBounds=u.labelBounds||{};Ne.all!=null?OO(Ne.all):Ne.all=na(),i&&r.includeLabels&&(r.includeMainLabels&&ug(o,e,null),f&&(r.includeSourceLabels&&ug(o,e,"source"),r.includeTargetLabels&&ug(o,e,"target")))}return o.x1=Ka(o.x1),o.y1=Ka(o.y1),o.x2=Ka(o.x2),o.y2=Ka(o.y2),o.w=Ka(o.x2-o.x1),o.h=Ka(o.y2-o.y1),o.w>0&&o.h>0&&N&&(Sf(o,T),wf(o,1)),o},IC=function(e){var r=0,a=function(o){return(o?1:0)<<r++},i=0;return i+=a(e.incudeNodes),i+=a(e.includeEdges),i+=a(e.includeLabels),i+=a(e.includeMainLabels),i+=a(e.includeSourceLabels),i+=a(e.includeTargetLabels),i+=a(e.includeOverlays),i+=a(e.includeOutlines),i},VC=function(e){var r=function(u){return Math.round(u)};if(e.isEdge()){var a=e.source().position(),i=e.target().position();return nw([r(a.x),r(a.y),r(i.x),r(i.y)])}else{var s=e.position();return nw([r(s.x),r(s.y)])}},NS=function(e,r){var a=e._private,i,s=e.isEdge(),o=r==null?jS:IC(r),u=o===jS;if(a.bbCache==null?(i=ZR(e,nc),a.bbCache=i,a.bbCachePosKey=VC(e)):i=a.bbCache,!u){var d=e.isNode();i=na(),(r.includeNodes&&d||r.includeEdges&&!d)&&(r.includeOverlays?Pi(i,a.overlayBounds):Pi(i,a.bodyBounds)),r.includeLabels&&(r.includeMainLabels&&(!s||r.includeSourceLabels&&r.includeTargetLabels)?Pi(i,a.labelBounds.all):(r.includeMainLabels&&Pi(i,a.labelBounds.mainRot),r.includeSourceLabels&&Pi(i,a.labelBounds.sourceRot),r.includeTargetLabels&&Pi(i,a.labelBounds.targetRot))),i.w=i.x2-i.x1,i.h=i.y2-i.y1}return i},nc={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},jS=IC(nc),AS=Fr(nc);fs.boundingBox=function(t){var e,r=t===void 0||t.useCache===void 0||t.useCache===!0,a=Mo(function(h){var p=h._private;return p.bbCache==null||p.styleDirty||p.bbCachePosKey!==VC(h)},function(h){return h.id()});if(r&&this.length===1&&!a(this[0]))t===void 0?t=nc:t=AS(t),e=NS(this[0],t);else{e=na(),t=t||nc;var i=AS(t),s=this,o=s.cy(),u=o.styleEnabled();this.edges().forEach(a),this.nodes().forEach(a),u&&this.recalculateRenderedStyle(r),this.updateCompoundBounds(!r);for(var d=0;d<s.length;d++){var f=s[d];a(f)&&f.dirtyBoundingBoxCache(),Pi(e,NS(f,i))}}return e.x1=Ka(e.x1),e.y1=Ka(e.y1),e.x2=Ka(e.x2),e.y2=Ka(e.y2),e.w=Ka(e.x2-e.x1),e.h=Ka(e.y2-e.y1),e};fs.dirtyBoundingBoxCache=function(){for(var t=0;t<this.length;t++){var e=this[t]._private;e.bbCache=null,e.bbCachePosKey=null,e.bodyBounds=null,e.overlayBounds=null,e.labelBounds.all=null,e.labelBounds.source=null,e.labelBounds.target=null,e.labelBounds.main=null,e.labelBounds.sourceRot=null,e.labelBounds.targetRot=null,e.labelBounds.mainRot=null,e.arrowBounds.source=null,e.arrowBounds.target=null,e.arrowBounds["mid-source"]=null,e.arrowBounds["mid-target"]=null}return this.emitAndNotify("bounds"),this};fs.boundingBoxAt=function(t){var e=this.nodes(),r=this.cy(),a=r.hasCompoundNodes(),i=r.collection();if(a&&(i=e.filter(function(f){return f.isParent()}),e=e.not(i)),wt(t)){var s=t;t=function(){return s}}var o=function(h,p){return h._private.bbAtOldPos=t(h,p)},u=function(h){return h._private.bbAtOldPos};r.startBatch(),e.forEach(o).silentPositions(t),a&&(i.dirtyCompoundBoundsCache(),i.dirtyBoundingBoxCache(),i.updateCompoundBounds(!0));var d=DO(this.boundingBox({useCache:!1}));return e.silentPositions(u),a&&(i.dirtyCompoundBoundsCache(),i.dirtyBoundingBoxCache(),i.updateCompoundBounds(!0)),r.endBatch(),d};co.boundingbox=co.bb=co.boundingBox;co.renderedBoundingbox=co.renderedBoundingBox;var WR=fs,Iu,kc;Iu=kc={};var FC=function(e){e.uppercaseName=F2(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=F2(e.outerName),Iu[e.name]=function(){var a=this[0],i=a._private,s=i.cy,o=s._private.styleEnabled;if(a)if(o){if(a.isParent())return a.updateCompoundBounds(),i[e.autoName]||0;var u=a.pstyle(e.name);switch(u.strValue){case"label":return a.recalculateRenderedStyle(),i.rstyle[e.labelName]||0;default:return u.pfValue}}else return 1},Iu["outer"+e.uppercaseName]=function(){var a=this[0],i=a._private,s=i.cy,o=s._private.styleEnabled;if(a)if(o){var u=a[e.name](),d=a.pstyle("border-position").value,f;d==="center"?f=a.pstyle("border-width").pfValue:d==="outside"?f=2*a.pstyle("border-width").pfValue:f=0;var h=2*a.padding();return u+f+h}else return 1},Iu["rendered"+e.uppercaseName]=function(){var a=this[0];if(a){var i=a[e.name]();return i*this.cy().zoom()}},Iu["rendered"+e.uppercaseOuterName]=function(){var a=this[0];if(a){var i=a[e.outerName]();return i*this.cy().zoom()}}};FC({name:"width"});FC({name:"height"});kc.padding=function(){var t=this[0],e=t._private;return t.isParent()?(t.updateCompoundBounds(),e.autoPadding!==void 0?e.autoPadding:t.pstyle("padding").pfValue):t.pstyle("padding").pfValue};kc.paddedHeight=function(){var t=this[0];return t.height()+2*t.padding()};kc.paddedWidth=function(){var t=this[0];return t.width()+2*t.padding()};var JR=kc,eB=function(e,r){if(e.isEdge()&&e.takesUpSpace())return r(e)},tB=function(e,r){if(e.isEdge()&&e.takesUpSpace()){var a=e.cy();return lh(r(e),a.zoom(),a.pan())}},rB=function(e,r){if(e.isEdge()&&e.takesUpSpace()){var a=e.cy(),i=a.pan(),s=a.zoom();return r(e).map(function(o){return lh(o,s,i)})}},aB=function(e){return e.renderer().getControlPoints(e)},nB=function(e){return e.renderer().getSegmentPoints(e)},iB=function(e){return e.renderer().getSourceEndpoint(e)},sB=function(e){return e.renderer().getTargetEndpoint(e)},lB=function(e){return e.renderer().getEdgeMidpoint(e)},MS={controlPoints:{get:aB,mult:!0},segmentPoints:{get:nB,mult:!0},sourceEndpoint:{get:iB},targetEndpoint:{get:sB},midpoint:{get:lB}},oB=function(e){return"rendered"+e[0].toUpperCase()+e.substr(1)},uB=Object.keys(MS).reduce(function(t,e){var r=MS[e],a=oB(e);return t[e]=function(){return eB(this,r.get)},r.mult?t[a]=function(){return rB(this,r.get)}:t[a]=function(){return tB(this,r.get)},t},{}),cB=tt({},KR,WR,JR,uB);/*!
87
+ Event object based on jQuery events, MIT license
88
+
89
+ https://jquery.org/license/
90
+ https://tldrlegal.com/license/mit-license
91
+ https://github.com/jquery/jquery/blob/master/src/event.js
92
+ */var HC=function(e,r){this.recycle(e,r)};function Bu(){return!1}function of(){return!0}HC.prototype={instanceString:function(){return"event"},recycle:function(e,r){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=Bu,e!=null&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?of:Bu):e!=null&&e.type?r=e:this.type=e,r!=null&&(this.originalEvent=r.originalEvent,this.type=r.type!=null?r.type:this.type,this.cy=r.cy,this.target=r.target,this.position=r.position,this.renderedPosition=r.renderedPosition,this.namespace=r.namespace,this.layout=r.layout),this.cy!=null&&this.position!=null&&this.renderedPosition==null){var a=this.position,i=this.cy.zoom(),s=this.cy.pan();this.renderedPosition={x:a.x*i+s.x,y:a.y*i+s.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=of;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=of;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=of,this.stopPropagation()},isDefaultPrevented:Bu,isPropagationStopped:Bu,isImmediatePropagationStopped:Bu};var GC=/^([^.]+)(\.(?:[^.]+))?$/,dB=".*",QC={qualifierCompare:function(e,r){return e===r},eventMatches:function(){return!0},addEventFields:function(){},callbackContext:function(e){return e},beforeEmit:function(){},afterEmit:function(){},bubble:function(){return!1},parent:function(){return null},context:null},kS=Object.keys(QC),fB={};function vh(){for(var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:fB,e=arguments.length>1?arguments[1]:void 0,r=0;r<kS.length;r++){var a=kS[r];this[a]=t[a]||QC[a]}this.context=e||this.context,this.listeners=[],this.emitting=0}var ls=vh.prototype,$C=function(e,r,a,i,s,o,u){Wt(i)&&(s=i,i=null),u&&(o==null?o=u:o=tt({},o,u));for(var d=_t(a)?a:a.split(/\s+/),f=0;f<d.length;f++){var h=d[f];if(!rs(h)){var p=h.match(GC);if(p){var m=p[1],y=p[2]?p[2]:null,x=r(e,h,m,y,i,s,o);if(x===!1)break}}}},DS=function(e,r){return e.addEventFields(e.context,r),new HC(r.type,r)},hB=function(e,r,a){if(xD(a)){r(e,a);return}else if(wt(a)){r(e,DS(e,a));return}for(var i=_t(a)?a:a.split(/\s+/),s=0;s<i.length;s++){var o=i[s];if(!rs(o)){var u=o.match(GC);if(u){var d=u[1],f=u[2]?u[2]:null,h=DS(e,{type:d,namespace:f,target:e.context});r(e,h)}}}};ls.on=ls.addListener=function(t,e,r,a,i){return $C(this,function(s,o,u,d,f,h,p){Wt(h)&&s.listeners.push({event:o,callback:h,type:u,namespace:d,qualifier:f,conf:p})},t,e,r,a,i),this};ls.one=function(t,e,r,a){return this.on(t,e,r,a,{one:!0})};ls.removeListener=ls.off=function(t,e,r,a){var i=this;this.emitting!==0&&(this.listeners=tO(this.listeners));for(var s=this.listeners,o=function(f){var h=s[f];$C(i,function(p,m,y,x,E,w){if((h.type===y||t==="*")&&(!x&&h.namespace!==".*"||h.namespace===x)&&(!E||p.qualifierCompare(h.qualifier,E))&&(!w||h.callback===w))return s.splice(f,1),!1},t,e,r,a)},u=s.length-1;u>=0;u--)o(u);return this};ls.removeAllListeners=function(){return this.removeListener("*")};ls.emit=ls.trigger=function(t,e,r){var a=this.listeners,i=a.length;return this.emitting++,_t(e)||(e=[e]),hB(this,function(s,o){r!=null&&(a=[{event:o.event,type:o.type,namespace:o.namespace,callback:r}],i=a.length);for(var u=function(){var h=a[d];if(h.type===o.type&&(!h.namespace||h.namespace===o.namespace||h.namespace===dB)&&s.eventMatches(s.context,h,o)){var p=[o];e!=null&&aO(p,e),s.beforeEmit(s.context,h,o),h.conf&&h.conf.one&&(s.listeners=s.listeners.filter(function(x){return x!==h}));var m=s.callbackContext(s.context,h,o),y=h.callback.apply(m,p);s.afterEmit(s.context,h,o),y===!1&&(o.stopPropagation(),o.preventDefault())}},d=0;d<i;d++)u();s.bubble(s.context)&&!o.isPropagationStopped()&&s.parent(s.context).emit(o,e)},t),this.emitting--,this};var vB={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&&Tc(a.target)&&i.matches(a.target):!0},addEventFields:function(e,r){r.cy=e.cy(),r.target=e},callbackContext:function(e,r,a){return r.qualifier!=null?a.target:e},beforeEmit:function(e,r){r.conf&&r.conf.once&&r.conf.onceCollection.removeListener(r.event,r.qualifier,r.callback)},bubble:function(){return!0},parent:function(e){return e.isChild()?e.parent():e.cy()}},uf=function(e){return Xe(e)?new is(e):e},YC={createEmitter:function(){for(var e=0;e<this.length;e++){var r=this[e],a=r._private;a.emitter||(a.emitter=new vh(vB,r))}return this},emitter:function(){return this._private.emitter},on:function(e,r,a){for(var i=uf(r),s=0;s<this.length;s++){var o=this[s];o.emitter().on(e,i,a)}return this},removeListener:function(e,r,a){for(var i=uf(r),s=0;s<this.length;s++){var o=this[s];o.emitter().removeListener(e,i,a)}return this},removeAllListeners:function(){for(var e=0;e<this.length;e++){var r=this[e];r.emitter().removeAllListeners()}return this},one:function(e,r,a){for(var i=uf(r),s=0;s<this.length;s++){var o=this[s];o.emitter().one(e,i,a)}return this},once:function(e,r,a){for(var i=uf(r),s=0;s<this.length;s++){var o=this[s];o.emitter().on(e,i,a,{once:!0,onceCollection:this})}},emit:function(e,r){for(var a=0;a<this.length;a++){var i=this[a];i.emitter().emit(e,r)}return this},emitAndNotify:function(e,r){if(this.length!==0)return this.cy().notify(e,this),this.emit(e,r),this}};jt.eventAliasesOn(YC);var KC={nodes:function(e){return this.filter(function(r){return r.isNode()}).filter(e)},edges:function(e){return this.filter(function(r){return r.isEdge()}).filter(e)},byGroup:function(){for(var e=this.spawn(),r=this.spawn(),a=0;a<this.length;a++){var i=this[a];i.isNode()?e.push(i):r.push(i)}return{nodes:e,edges:r}},filter:function(e,r){if(e===void 0)return this;if(Xe(e)||Da(e))return new is(e).filter(this);if(Wt(e)){for(var a=this.spawn(),i=this,s=0;s<i.length;s++){var o=i[s],u=r?e.apply(r,[o,s,i]):e(o,s,i);u&&a.push(o)}return a}return this.spawn()},not:function(e){if(e){Xe(e)&&(e=this.filter(e));for(var r=this.spawn(),a=0;a<this.length;a++){var i=this[a],s=e.has(i);s||r.push(i)}return r}else return this},absoluteComplement:function(){var e=this.cy();return e.mutableElements().not(this)},intersect:function(e){if(Xe(e)){var r=e;return this.filter(r)}for(var a=this.spawn(),i=this,s=e,o=this.length<e.length,u=o?i:s,d=o?s:i,f=0;f<u.length;f++){var h=u[f];d.has(h)&&a.push(h)}return a},xor:function(e){var r=this._private.cy;Xe(e)&&(e=r.$(e));var a=this.spawn(),i=this,s=e,o=function(d,f){for(var h=0;h<d.length;h++){var p=d[h],m=p._private.data.id,y=f.hasElementWithId(m);y||a.push(p)}};return o(i,s),o(s,i),a},diff:function(e){var r=this._private.cy;Xe(e)&&(e=r.$(e));var a=this.spawn(),i=this.spawn(),s=this.spawn(),o=this,u=e,d=function(h,p,m){for(var y=0;y<h.length;y++){var x=h[y],E=x._private.data.id,w=p.hasElementWithId(E);w?s.merge(x):m.push(x)}};return d(o,u,a),d(u,o,i),{left:a,right:i,both:s}},add:function(e){var r=this._private.cy;if(!e)return this;if(Xe(e)){var a=e;e=r.mutableElements().filter(a)}for(var i=this.spawnSelf(),s=0;s<e.length;s++){var o=e[s],u=!this.has(o);u&&i.push(o)}return i},merge:function(e){var r=this._private,a=r.cy;if(!e)return this;if(e&&Xe(e)){var i=e;e=a.mutableElements().filter(i)}for(var s=r.map,o=0;o<e.length;o++){var u=e[o],d=u._private.data.id,f=!s.has(d);if(f){var h=this.length++;this[h]=u,s.set(d,{ele:u,index:h})}}return this},unmergeAt:function(e){var r=this[e],a=r.id(),i=this._private,s=i.map;this[e]=void 0,s.delete(a);var o=e===this.length-1;if(this.length>1&&!o){var u=this.length-1,d=this[u],f=d._private.data.id;this[u]=void 0,this[e]=d,s.set(f,{ele:d,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var r=this._private,a=e._private.data.id,i=r.map,s=i.get(a);if(!s)return this;var o=s.index;return this.unmergeAt(o),this},unmerge:function(e){var r=this._private.cy;if(!e)return this;if(e&&Xe(e)){var a=e;e=r.mutableElements().filter(a)}for(var i=0;i<e.length;i++)this.unmergeOne(e[i]);return this},unmergeBy:function(e){for(var r=this.length-1;r>=0;r--){var a=this[r];e(a)&&this.unmergeAt(r)}return this},map:function(e,r){for(var a=[],i=this,s=0;s<i.length;s++){var o=i[s],u=r?e.apply(r,[o,s,i]):e(o,s,i);a.push(u)}return a},reduce:function(e,r){for(var a=r,i=this,s=0;s<i.length;s++)a=e(a,i[s],s,i);return a},max:function(e,r){for(var a=-1/0,i,s=this,o=0;o<s.length;o++){var u=s[o],d=r?e.apply(r,[u,o,s]):e(u,o,s);d>a&&(a=d,i=u)}return{value:a,ele:i}},min:function(e,r){for(var a=1/0,i,s=this,o=0;o<s.length;o++){var u=s[o],d=r?e.apply(r,[u,o,s]):e(u,o,s);d<a&&(a=d,i=u)}return{value:a,ele:i}}},Ct=KC;Ct.u=Ct["|"]=Ct["+"]=Ct.union=Ct.or=Ct.add;Ct["\\"]=Ct["!"]=Ct["-"]=Ct.difference=Ct.relativeComplement=Ct.subtract=Ct.not;Ct.n=Ct["&"]=Ct["."]=Ct.and=Ct.intersection=Ct.intersect;Ct["^"]=Ct["(+)"]=Ct["(-)"]=Ct.symmetricDifference=Ct.symdiff=Ct.xor;Ct.fnFilter=Ct.filterFn=Ct.stdFilter=Ct.filter;Ct.complement=Ct.abscomp=Ct.absoluteComplement;var pB={isNode:function(){return this.group()==="nodes"},isEdge:function(){return this.group()==="edges"},isLoop:function(){return this.isEdge()&&this.source()[0]===this.target()[0]},isSimple:function(){return this.isEdge()&&this.source()[0]!==this.target()[0]},group:function(){var e=this[0];if(e)return e._private.group}},XC=function(e,r){var a=e.cy(),i=a.hasCompoundNodes();function s(h){var p=h.pstyle("z-compound-depth");return p.value==="auto"?i?h.zDepth():0:p.value==="bottom"?-1:p.value==="top"?Hm:0}var o=s(e)-s(r);if(o!==0)return o;function u(h){var p=h.pstyle("z-index-compare");return p.value==="auto"&&h.isNode()?1:0}var d=u(e)-u(r);if(d!==0)return d;var f=e.pstyle("z-index").value-r.pstyle("z-index").value;return f!==0?f:e.poolIndex()-r.poolIndex()},Ff={forEach:function(e,r){if(Wt(e))for(var a=this.length,i=0;i<a;i++){var s=this[i],o=r?e.apply(r,[s,i,this]):e(s,i,this);if(o===!1)break}return this},toArray:function(){for(var e=[],r=0;r<this.length;r++)e.push(this[r]);return e},slice:function(e,r){var a=[],i=this.length;r==null&&(r=i),e==null&&(e=0),e<0&&(e=i+e),r<0&&(r=i+r);for(var s=e;s>=0&&s<r&&s<i;s++)a.push(this[s]);return this.spawn(a)},size:function(){return this.length},eq:function(e){return this[e]||this.spawn()},first:function(){return this[0]||this.spawn()},last:function(){return this[this.length-1]||this.spawn()},empty:function(){return this.length===0},nonempty:function(){return!this.empty()},sort:function(e){if(!Wt(e))return this;var r=this.toArray().sort(e);return this.spawn(r)},sortByZIndex:function(){return this.sort(XC)},zDepth:function(){var e=this[0];if(e){var r=e._private,a=r.group;if(a==="nodes"){var i=r.data.parent?e.parents().size():0;return e.isParent()?i:Hm-1}else{var s=r.source,o=r.target,u=s.zDepth(),d=o.zDepth();return Math.max(u,d,0)}}}};Ff.each=Ff.forEach;var gB=function(){var e="undefined",r=(typeof Symbol>"u"?"undefined":Er(Symbol))!=e&&Er(Symbol.iterator)!=e;r&&(Ff[Symbol.iterator]=function(){var a=this,i={value:void 0,done:!1},s=0,o=this.length;return YT({next:function(){return s<o?i.value=a[s++]:(i.value=void 0,i.done=!0),i}},Symbol.iterator,function(){return this})})};gB();var mB=Fr({nodeDimensionsIncludeLabels:!1}),Tf={layoutDimensions:function(e){e=mB(e);var r;if(!this.takesUpSpace())r={w:0,h:0};else if(e.nodeDimensionsIncludeLabels){var a=this.boundingBox();r={w:a.w,h:a.h}}else r={w:this.outerWidth(),h:this.outerHeight()};return(r.w===0||r.h===0)&&(r.w=r.h=1),r},layoutPositions:function(e,r,a){var i=this.nodes().filter(function(D){return!D.isParent()}),s=this.cy(),o=r.eles,u=function(M){return M.id()},d=Mo(a,u);e.emit({type:"layoutstart",layout:e}),e.animations=[];var f=function(M,j,k){var B={x:j.x1+j.w/2,y:j.y1+j.h/2},P={x:(k.x-B.x)*M,y:(k.y-B.y)*M};return{x:B.x+P.x,y:B.y+P.y}},h=r.spacingFactor&&r.spacingFactor!==1,p=function(){if(!h)return null;for(var M=na(),j=0;j<i.length;j++){var k=i[j],B=d(k,j);vC(M,B.x,B.y)}return M},m=p(),y=Mo(function(D,M){var j=d(D,M);if(h){var k=Math.abs(r.spacingFactor);j=f(k,m,j)}return r.transform!=null&&(j=r.transform(D,j)),j},u);if(r.animate){for(var x=0;x<i.length;x++){var E=i[x],w=y(E,x),T=r.animateFilter==null||r.animateFilter(E,x);if(T){var C=E.animation({position:w,duration:r.animationDuration,easing:r.animationEasing});e.animations.push(C)}else E.position(w)}if(r.fit){var N=s.animation({fit:{boundingBox:o.boundingBoxAt(y),padding:r.padding},duration:r.animationDuration,easing:r.animationEasing});e.animations.push(N)}else if(r.zoom!==void 0&&r.pan!==void 0){var A=s.animation({zoom:r.zoom,pan:r.pan,duration:r.animationDuration,easing:r.animationEasing});e.animations.push(A)}e.animations.forEach(function(D){return D.play()}),e.one("layoutready",r.ready),e.emit({type:"layoutready",layout:e}),Lo.all(e.animations.map(function(D){return D.promise()})).then(function(){e.one("layoutstop",r.stop),e.emit({type:"layoutstop",layout:e})})}else i.positions(y),r.fit&&s.fit(r.eles,r.padding),r.zoom!=null&&s.zoom(r.zoom),r.pan&&s.pan(r.pan),e.one("layoutready",r.ready),e.emit({type:"layoutready",layout:e}),e.one("layoutstop",r.stop),e.emit({type:"layoutstop",layout:e});return this},layout:function(e){var r=this.cy();return r.makeLayout(tt({},e,{eles:this}))}};Tf.createLayout=Tf.makeLayout=Tf.layout;function ZC(t,e,r){var a=r._private,i=a.styleCache=a.styleCache||[],s;return(s=i[t])!=null||(s=i[t]=e(r)),s}function ph(t,e){return t=Ws(t),function(a){return ZC(t,e,a)}}function gh(t,e){t=Ws(t);var r=function(i){return e.call(i)};return function(){var i=this[0];if(i)return ZC(t,r,i)}}var qr={recalculateRenderedStyle:function(e){var r=this.cy(),a=r.renderer(),i=r.styleEnabled();return a&&i&&a.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e=this.cy(),r=function(s){return s._private.styleCache=null};if(e.hasCompoundNodes()){var a;a=this.spawnSelf().merge(this.descendants()).merge(this.parents()),a.merge(a.connectedEdges()),a.forEach(r)}else this.forEach(function(i){r(i),i.connectedEdges().forEach(r)});return this},updateStyle:function(e){var r=this._private.cy;if(!r.styleEnabled())return this;if(r.batching()){var a=r._private.batchStyleEles;return a.merge(this),this}var i=r.hasCompoundNodes(),s=this;e=!!(e||e===void 0),i&&(s=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var o=s;return e?o.emitAndNotify("style"):o.emit("style"),s.forEach(function(u){return u._private.styleDirty=!0}),this},cleanStyle:function(){var e=this.cy();if(e.styleEnabled())for(var r=0;r<this.length;r++){var a=this[r];a._private.styleDirty&&(a._private.styleDirty=!1,e.style().apply(a))}},parsedStyle:function(e){var r=arguments.length>1&&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 s=a._private.style[e];return s??(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,s=a.style();if(wt(e)){var o=e;s.applyBypass(this,o,i),this.emitAndNotify("style")}else if(Xe(e))if(r===void 0){var u=this[0];return u?s.getStylePropertyValue(u,e):void 0}else s.applyBypass(this,e,r,i),this.emitAndNotify("style");else if(e===void 0){var d=this[0];return d?s.getRawStyle(d):void 0}return this},removeStyle:function(e){var r=this.cy();if(!r.styleEnabled())return this;var a=!1,i=r.style(),s=this;if(e===void 0)for(var o=0;o<s.length;o++){var u=s[o];i.removeAllBypasses(u,a)}else{e=e.split(/\s+/);for(var d=0;d<s.length;d++){var f=s[d];i.removeBypasses(f,e,a)}}return this.emitAndNotify("style"),this},show:function(){return this.css("display","element"),this},hide:function(){return this.css("display","none"),this},effectiveOpacity:function(){var e=this.cy();if(!e.styleEnabled())return 1;var r=e.hasCompoundNodes(),a=this[0];if(a){var i=a._private,s=a.pstyle("opacity").value;if(!r)return s;var o=i.data.parent?a.parents():null;if(o)for(var u=0;u<o.length;u++){var d=o[u],f=d.pstyle("opacity").value;s=f*s}return s}},transparent:function(){var e=this.cy();if(!e.styleEnabled())return!1;var r=this[0],a=r.cy().hasCompoundNodes();if(r)return a?r.effectiveOpacity()===0:r.pstyle("opacity").value===0},backgrounding:function(){var e=this.cy();if(!e.styleEnabled())return!1;var r=this[0];return!!r._private.backgrounding}};function cg(t,e){var r=t._private,a=r.data.parent?t.parents():null;if(a)for(var i=0;i<a.length;i++){var s=a[i];if(!e(s))return!1}return!0}function ry(t){var e=t.ok,r=t.edgeOkViaNode||t.ok,a=t.parentOk||t.ok;return function(){var i=this.cy();if(!i.styleEnabled())return!0;var s=this[0],o=i.hasCompoundNodes();if(s){var u=s._private;if(!e(s))return!1;if(s.isNode())return!o||cg(s,a);var d=u.source,f=u.target;return r(d)&&(!o||cg(d,r))&&(d===f||r(f)&&(!o||cg(f,r)))}}}var Po=ph("eleTakesUpSpace",function(t){return t.pstyle("display").value==="element"&&t.width()!==0&&(t.isNode()?t.height()!==0:!0)});qr.takesUpSpace=gh("takesUpSpace",ry({ok:Po}));var yB=ph("eleInteractive",function(t){return t.pstyle("events").value==="yes"&&t.pstyle("visibility").value==="visible"&&Po(t)}),xB=ph("parentInteractive",function(t){return t.pstyle("visibility").value==="visible"&&Po(t)});qr.interactive=gh("interactive",ry({ok:yB,parentOk:xB,edgeOkViaNode:Po}));qr.noninteractive=function(){var t=this[0];if(t)return!t.interactive()};var bB=ph("eleVisible",function(t){return t.pstyle("visibility").value==="visible"&&t.pstyle("opacity").pfValue!==0&&Po(t)}),wB=Po;qr.visible=gh("visible",ry({ok:bB,edgeOkViaNode:wB}));qr.hidden=function(){var t=this[0];if(t)return!t.visible()};qr.isBundledBezier=gh("isBundledBezier",function(){return this.cy().styleEnabled()?!this.removed()&&this.pstyle("curve-style").value==="bezier"&&this.takesUpSpace():!1});qr.bypass=qr.css=qr.style;qr.renderedCss=qr.renderedStyle;qr.removeBypass=qr.removeCss=qr.removeStyle;qr.pstyle=qr.parsedStyle;var es={};function OS(t){return function(){var e=arguments,r=[];if(e.length===2){var a=e[0],i=e[1];this.on(t.event,a,i)}else if(e.length===1&&Wt(e[0])){var s=e[0];this.on(t.event,s)}else if(e.length===0||e.length===1&&_t(e[0])){for(var o=e.length===1?e[0]:null,u=0;u<this.length;u++){var d=this[u],f=!t.ableField||d._private[t.ableField],h=d._private[t.field]!=t.value;if(t.overrideAble){var p=t.overrideAble(d);if(p!==void 0&&(f=p,!p))return this}f&&(d._private[t.field]=t.value,h&&r.push(d))}var m=this.spawn(r);m.updateStyle(),m.emit(t.event),o&&m.emit(o)}return this}}function zo(t){es[t.field]=function(){var e=this[0];if(e){if(t.overrideField){var r=t.overrideField(e);if(r!==void 0)return r}return e._private[t.field]}},es[t.on]=OS({event:t.on,field:t.field,ableField:t.ableField,overrideAble:t.overrideAble,value:!0}),es[t.off]=OS({event:t.off,field:t.field,ableField:t.ableField,overrideAble:t.overrideAble,value:!1})}zo({field:"locked",overrideField:function(e){return e.cy().autolock()?!0:void 0},on:"lock",off:"unlock"});zo({field:"grabbable",overrideField:function(e){return e.cy().autoungrabify()||e.pannable()?!1:void 0},on:"grabify",off:"ungrabify"});zo({field:"selected",ableField:"selectable",overrideAble:function(e){return e.cy().autounselectify()?!1:void 0},on:"select",off:"unselect"});zo({field:"selectable",overrideField:function(e){return e.cy().autounselectify()?!1:void 0},on:"selectify",off:"unselectify"});es.deselect=es.unselect;es.grabbed=function(){var t=this[0];if(t)return t._private.grabbed};zo({field:"active",on:"activate",off:"unactivate"});zo({field:"pannable",on:"panify",off:"unpanify"});es.inactive=function(){var t=this[0];if(t)return!t._private.active};var Xr={},RS=function(e){return function(a){for(var i=this,s=[],o=0;o<i.length;o++){var u=i[o];if(u.isNode()){for(var d=!1,f=u.connectedEdges(),h=0;h<f.length;h++){var p=f[h],m=p.source(),y=p.target();if(e.noIncomingEdges&&y===u&&m!==u||e.noOutgoingEdges&&m===u&&y!==u){d=!0;break}}d||s.push(u)}}return this.spawn(s,!0).filter(a)}},BS=function(e){return function(r){for(var a=this,i=[],s=0;s<a.length;s++){var o=a[s];if(o.isNode())for(var u=o.connectedEdges(),d=0;d<u.length;d++){var f=u[d],h=f.source(),p=f.target();e.outgoing&&h===o?(i.push(f),i.push(p)):e.incoming&&p===o&&(i.push(f),i.push(h))}}return this.spawn(i,!0).filter(r)}},LS=function(e){return function(r){for(var a=this,i=[],s={};;){var o=e.outgoing?a.outgoers():a.incomers();if(o.length===0)break;for(var u=!1,d=0;d<o.length;d++){var f=o[d],h=f.id();s[h]||(s[h]=!0,i.push(f),u=!0)}if(!u)break;a=o}return this.spawn(i,!0).filter(r)}};Xr.clearTraversalCache=function(){for(var t=0;t<this.length;t++)this[t]._private.traversalCache=null};tt(Xr,{roots:RS({noIncomingEdges:!0}),leaves:RS({noOutgoingEdges:!0}),outgoers:Xa(BS({outgoing:!0}),"outgoers"),successors:LS({outgoing:!0}),incomers:Xa(BS({incoming:!0}),"incomers"),predecessors:LS({})});tt(Xr,{neighborhood:Xa(function(t){for(var e=[],r=this.nodes(),a=0;a<r.length;a++)for(var i=r[a],s=i.connectedEdges(),o=0;o<s.length;o++){var u=s[o],d=u.source(),f=u.target(),h=i===d?f:d;h.length>0&&e.push(h[0]),e.push(u[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)}});Xr.neighbourhood=Xr.neighborhood;Xr.closedNeighbourhood=Xr.closedNeighborhood;Xr.openNeighbourhood=Xr.openNeighborhood;tt(Xr,{source:Xa(function(e){var r=this[0],a;return r&&(a=r._private.source||r.cy().collection()),a&&e?a.filter(e):a},"source"),target:Xa(function(e){var r=this[0],a;return r&&(a=r._private.target||r.cy().collection()),a&&e?a.filter(e):a},"target"),sources:PS({attr:"source"}),targets:PS({attr:"target"})});function PS(t){return function(r){for(var a=[],i=0;i<this.length;i++){var s=this[i],o=s._private[t.attr];o&&a.push(o)}return this.spawn(a,!0).filter(r)}}tt(Xr,{edgesWith:Xa(zS(),"edgesWith"),edgesTo:Xa(zS({thisIsSrc:!0}),"edgesTo")});function zS(t){return function(r){var a=[],i=this._private.cy,s=t||{};Xe(r)&&(r=i.$(r));for(var o=0;o<r.length;o++)for(var u=r[o]._private.edges,d=0;d<u.length;d++){var f=u[d],h=f._private.data,p=this.hasElementWithId(h.source)&&r.hasElementWithId(h.target),m=r.hasElementWithId(h.source)&&this.hasElementWithId(h.target),y=p||m;y&&((s.thisIsSrc||s.thisIsTgt)&&(s.thisIsSrc&&!p||s.thisIsTgt&&!m)||a.push(f))}return this.spawn(a,!0)}}tt(Xr,{connectedEdges:Xa(function(t){for(var e=[],r=this,a=0;a<r.length;a++){var i=r[a];if(i.isNode())for(var s=i._private.edges,o=0;o<s.length;o++){var u=s[o];e.push(u)}}return this.spawn(e,!0).filter(t)},"connectedEdges"),connectedNodes:Xa(function(t){for(var e=[],r=this,a=0;a<r.length;a++){var i=r[a];i.isEdge()&&(e.push(i.source()[0]),e.push(i.target()[0]))}return this.spawn(e,!0).filter(t)},"connectedNodes"),parallelEdges:Xa(_S(),"parallelEdges"),codirectedEdges:Xa(_S({codirected:!0}),"codirectedEdges")});function _S(t){var e={codirected:!1};return t=tt({},e,t),function(a){for(var i=[],s=this.edges(),o=t,u=0;u<s.length;u++)for(var d=s[u],f=d._private,h=f.source,p=h._private.data.id,m=f.data.target,y=h._private.edges,x=0;x<y.length;x++){var E=y[x],w=E._private.data,T=w.target,C=w.source,N=T===m&&C===p,A=p===T&&m===C;(o.codirected&&N||!o.codirected&&(N||A))&&i.push(E)}return this.spawn(i,!0).filter(a)}}tt(Xr,{components:function(e){var r=this,a=r.cy(),i=a.collection(),s=e==null?r.nodes():e.nodes(),o=[];e!=null&&s.empty()&&(s=e.sources());var u=function(h,p){i.merge(h),s.unmerge(h),p.merge(h)};if(s.empty())return r.spawn();var d=function(){var h=a.collection();o.push(h);var p=s[0];u(p,h),r.bfs({directed:!1,roots:p,visit:function(y){return u(y,h)}}),h.forEach(function(m){m.connectedEdges().forEach(function(y){r.has(y)&&h.has(y.source())&&h.has(y.target())&&h.merge(y)})})};do d();while(s.length>0);return o},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}});Xr.componentsOf=Xr.components;var Ir=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){$t("A collection must have a reference to the core");return}var s=new Zn,o=!1;if(!r)r=[];else if(r.length>0&&wt(r[0])&&!Tc(r[0])){o=!0;for(var u=[],d=new Bo,f=0,h=r.length;f<h;f++){var p=r[f];p.data==null&&(p.data={});var m=p.data;if(m.id==null)m.id=dC();else if(e.hasElementWithId(m.id)||d.has(m.id))continue;var y=new sh(e,p,!1);u.push(y),d.add(m.id)}r=u}this.length=0;for(var x=0,E=r.length;x<E;x++){var w=r[x][0];if(w!=null){var T=w._private.data.id;(!a||!s.has(T))&&(a&&s.set(T,{index:this.length,ele:w}),this[this.length]=w,this.length++)}}this._private={eles:this,cy:e,get map(){return this.lazyMap==null&&this.rebuildMap(),this.lazyMap},set map(C){this.lazyMap=C},rebuildMap:function(){for(var N=this.lazyMap=new Zn,A=this.eles,D=0;D<A.length;D++){var M=A[D];N.set(M.id(),{index:D,ele:M})}}},a&&(this._private.map=s),o&&!i&&this.restore()},qt=sh.prototype=Ir.prototype=Object.create(Array.prototype);qt.instanceString=function(){return"collection"};qt.spawn=function(t,e){return new Ir(this.cy(),t,e)};qt.spawnSelf=function(){return this.spawn(this)};qt.cy=function(){return this._private.cy};qt.renderer=function(){return this._private.cy.renderer()};qt.element=function(){return this[0]};qt.collection=function(){return ZT(this)?this:new Ir(this._private.cy,[this])};qt.unique=function(){return new Ir(this._private.cy,this,!0)};qt.hasElementWithId=function(t){return t=""+t,this._private.map.has(t)};qt.getElementById=function(t){t=""+t;var e=this._private.cy,r=this._private.map.get(t);return r?r.ele:new Ir(e)};qt.$id=qt.getElementById;qt.poolIndex=function(){var t=this._private.cy,e=t._private.elements,r=this[0]._private.data.id;return e._private.map.get(r).index};qt.indexOf=function(t){var e=t[0]._private.data.id;return this._private.map.get(e).index};qt.indexOfId=function(t){return t=""+t,this._private.map.get(t).index};qt.json=function(t){var e=this.element(),r=this.cy();if(e==null&&t)return this;if(e!=null){var a=e._private;if(wt(t)){if(r.startBatch(),t.data){e.data(t.data);var i=a.data;if(e.isEdge()){var s=!1,o={},u=t.data.source,d=t.data.target;u!=null&&u!=i.source&&(o.source=""+u,s=!0),d!=null&&d!=i.target&&(o.target=""+d,s=!0),s&&(e=e.move(o))}else{var f="parent"in t.data,h=t.data.parent;f&&(h!=null||i.parent!=null)&&h!=i.parent&&(h===void 0&&(h=null),h!=null&&(h=""+h),e=e.move({parent:h}))}}t.position&&e.position(t.position);var p=function(E,w,T){var C=t[E];C!=null&&C!==a[E]&&(C?e[w]():e[T]())};return p("removed","remove","restore"),p("selected","select","unselect"),p("selectable","selectify","unselectify"),p("locked","lock","unlock"),p("grabbable","grabify","ungrabify"),p("pannable","panify","unpanify"),t.classes!=null&&e.classes(t.classes),r.endBatch(),this}else if(t===void 0){var m={data:Sn(a.data),position:Sn(a.position),group:a.group,removed:a.removed,selected:a.selected,selectable:a.selectable,locked:a.locked,grabbable:a.grabbable,pannable:a.pannable,classes:null};m.classes="";var y=0;return a.classes.forEach(function(x){return m.classes+=y++===0?x:" "+x}),m}}};qt.jsons=function(){for(var t=[],e=0;e<this.length;e++){var r=this[e],a=r.json();t.push(a)}return t};qt.clone=function(){for(var t=this.cy(),e=[],r=0;r<this.length;r++){var a=this[r],i=a.json(),s=new sh(t,i,!1);e.push(s)}return new Ir(t,e)};qt.copy=qt.clone;qt.restore=function(){for(var t=arguments.length>0&&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,s=[],o=[],u,d=0,f=r.length;d<f;d++){var h=r[d];e&&!h.removed()||(h.isNode()?s.push(h):o.push(h))}u=s.concat(o);var p,m=function(){u.splice(p,1),p--};for(p=0;p<u.length;p++){var y=u[p],x=y._private,E=x.data;if(y.clearTraversalCache(),!(!e&&!x.removed)){if(E.id===void 0)E.id=dC();else if(De(E.id))E.id=""+E.id;else if(rs(E.id)||!Xe(E.id)){$t("Can not create element with invalid string ID `"+E.id+"`"),m();continue}else if(a.hasElementWithId(E.id)){$t("Can not create second element with ID `"+E.id+"`"),m();continue}}var w=E.id;if(y.isNode()){var T=x.position;T.x==null&&(T.x=0),T.y==null&&(T.y=0)}if(y.isEdge()){for(var C=y,N=["source","target"],A=N.length,D=!1,M=0;M<A;M++){var j=N[M],k=E[j];De(k)&&(k=E[j]=""+E[j]),k==null||k===""?($t("Can not create edge `"+w+"` with unspecified "+j),D=!0):a.hasElementWithId(k)||($t("Can not create edge `"+w+"` with nonexistant "+j+" `"+k+"`"),D=!0)}if(D){m();continue}var B=a.getElementById(E.source),P=a.getElementById(E.target);B.same(P)?B._private.edges.push(C):(B._private.edges.push(C),P._private.edges.push(C)),C._private.source=B,C._private.target=P}x.map=new Zn,x.map.set(w,{ele:y,index:0}),x.removed=!1,e&&a.addToPool(y)}for(var U=0;U<s.length;U++){var R=s[U],V=R._private.data;De(V.parent)&&(V.parent=""+V.parent);var _=V.parent,H=_!=null;if(H||R._private.parent){var z=R._private.parent?a.collection().merge(R._private.parent):a.getElementById(_);if(z.empty())V.parent=void 0;else if(z[0].removed())At("Node added with missing parent, reference to parent removed"),V.parent=void 0,R._private.parent=null;else{for(var I=!1,F=z;!F.empty();){if(R.same(F)){I=!0,V.parent=void 0;break}F=F.parent()}I||(z[0]._private.children.push(R),R._private.parent=z[0],i.hasCompoundNodes=!0)}}}if(u.length>0){for(var K=u.length===r.length?r:new Ir(a,u),J=0;J<K.length;J++){var L=K[J];L.isNode()||(L.parallelEdges().clearTraversalCache(),L.source().clearTraversalCache(),L.target().clearTraversalCache())}var Q;i.hasCompoundNodes?Q=a.collection().merge(K).merge(K.connectedNodes()).merge(K.parent()):Q=K,Q.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(t),t?K.emitAndNotify("add"):e&&K.emit("add")}return r};qt.removed=function(){var t=this[0];return t&&t._private.removed};qt.inside=function(){var t=this[0];return t&&!t._private.removed};qt.remove=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this,a=[],i={},s=r._private.cy;function o(_){for(var H=_._private.edges,z=0;z<H.length;z++)d(H[z])}function u(_){for(var H=_._private.children,z=0;z<H.length;z++)d(H[z])}function d(_){var H=i[_.id()];e&&_.removed()||H||(i[_.id()]=!0,_.isNode()?(a.push(_),o(_),u(_)):a.unshift(_))}for(var f=0,h=r.length;f<h;f++){var p=r[f];d(p)}function m(_,H){var z=_._private.edges;as(z,H),_.clearTraversalCache()}function y(_){_.clearTraversalCache()}var x=[];x.ids={};function E(_,H){H=H[0],_=_[0];var z=_._private.children,I=_.id();as(z,H),H._private.parent=null,x.ids[I]||(x.ids[I]=!0,x.push(_))}r.dirtyCompoundBoundsCache(),e&&s.removeFromPool(a);for(var w=0;w<a.length;w++){var T=a[w];if(T.isEdge()){var C=T.source()[0],N=T.target()[0];m(C,T),m(N,T);for(var A=T.parallelEdges(),D=0;D<A.length;D++){var M=A[D];y(M),M.isBundledBezier()&&M.dirtyBoundingBoxCache()}}else{var j=T.parent();j.length!==0&&E(j,T)}e&&(T._private.removed=!0)}var k=s._private.elements;s._private.hasCompoundNodes=!1;for(var B=0;B<k.length;B++){var P=k[B];if(P.isParent()){s._private.hasCompoundNodes=!0;break}}var U=new Ir(this.cy(),a);U.size()>0&&(t?U.emitAndNotify("remove"):e&&U.emit("remove"));for(var R=0;R<x.length;R++){var V=x[R];(!e||!V.removed())&&V.updateStyle()}return U};qt.move=function(t){var e=this._private.cy,r=this,a=!1,i=!1,s=function(x){return x==null?x:""+x};if(t.source!==void 0||t.target!==void 0){var o=s(t.source),u=s(t.target),d=o!=null&&e.hasElementWithId(o),f=u!=null&&e.hasElementWithId(u);(d||f)&&(e.batch(function(){r.remove(a,i),r.emitAndNotify("moveout");for(var y=0;y<r.length;y++){var x=r[y],E=x._private.data;x.isEdge()&&(d&&(E.source=o),f&&(E.target=u))}r.restore(a,i)}),r.emitAndNotify("move"))}else if(t.parent!==void 0){var h=s(t.parent),p=h===null||e.hasElementWithId(h);if(p){var m=h===null?void 0:h;e.batch(function(){var y=r.remove(a,i);y.emitAndNotify("moveout");for(var x=0;x<r.length;x++){var E=r[x],w=E._private.data;E.isNode()&&(w.parent=m)}y.restore(a,i)}),r.emitAndNotify("move")}}return this};[EC,OR,Ef,Ji,Do,YR,hh,cB,YC,KC,pB,Ff,Tf,qr,es,Xr].forEach(function(t){tt(qt,t)});var SB={add:function(e){var r,a=this;if(Da(e)){var i=e;if(i._private.cy===a)r=i.restore();else{for(var s=[],o=0;o<i.length;o++){var u=i[o];s.push(u.json())}r=new Ir(a,s)}}else if(_t(e)){var d=e;r=new Ir(a,d)}else if(wt(e)&&(_t(e.nodes)||_t(e.edges))){for(var f=e,h=[],p=["nodes","edges"],m=0,y=p.length;m<y;m++){var x=p[m],E=f[x];if(_t(E))for(var w=0,T=E.length;w<T;w++){var C=tt({group:x},E[w]);h.push(C)}}r=new Ir(a,h)}else{var N=e;r=new sh(a,N).collection()}return r},remove:function(e){if(!Da(e)){if(Xe(e)){var r=e;e=this.$(r)}}return e.remove()}};/*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */function EB(t,e,r,a){var i=4,s=.001,o=1e-7,u=10,d=11,f=1/(d-1),h=typeof Float32Array<"u";if(arguments.length!==4)return!1;for(var p=0;p<4;++p)if(typeof arguments[p]!="number"||isNaN(arguments[p])||!isFinite(arguments[p]))return!1;t=Math.min(t,1),r=Math.min(r,1),t=Math.max(t,0),r=Math.max(r,0);var m=h?new Float32Array(d):new Array(d);function y(P,U){return 1-3*U+3*P}function x(P,U){return 3*U-6*P}function E(P){return 3*P}function w(P,U,R){return((y(U,R)*P+x(U,R))*P+E(U))*P}function T(P,U,R){return 3*y(U,R)*P*P+2*x(U,R)*P+E(U)}function C(P,U){for(var R=0;R<i;++R){var V=T(U,t,r);if(V===0)return U;var _=w(U,t,r)-P;U-=_/V}return U}function N(){for(var P=0;P<d;++P)m[P]=w(P*f,t,r)}function A(P,U,R){var V,_,H=0;do _=U+(R-U)/2,V=w(_,t,r)-P,V>0?R=_:U=_;while(Math.abs(V)>o&&++H<u);return _}function D(P){for(var U=0,R=1,V=d-1;R!==V&&m[R]<=P;++R)U+=f;--R;var _=(P-m[R])/(m[R+1]-m[R]),H=U+_*f,z=T(H,t,r);return z>=s?C(P,H):z===0?H:A(P,U,U+f)}var M=!1;function j(){M=!0,(t!==e||r!==a)&&N()}var k=function(U){return M||j(),t===e&&r===a?U:U===0?0:U===1?1:w(D(U),e,a)};k.getControlPoints=function(){return[{x:t,y:e},{x:r,y:a}]};var B="generateBezier("+[t,e,r,a]+")";return k.toString=function(){return B},k}/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */var TB=(function(){function t(a){return-a.tension*a.x-a.friction*a.v}function e(a,i,s){var o={x:a.x+s.dx*i,v:a.v+s.dv*i,tension:a.tension,friction:a.friction};return{dx:o.v,dv:t(o)}}function r(a,i){var s={dx:a.v,dv:t(a)},o=e(a,i*.5,s),u=e(a,i*.5,o),d=e(a,i,u),f=1/6*(s.dx+2*(o.dx+u.dx)+d.dx),h=1/6*(s.dv+2*(o.dv+u.dv)+d.dv);return a.x=a.x+f*i,a.v=a.v+h*i,a}return function a(i,s,o){var u={x:-1,v:0,tension:null,friction:null},d=[0],f=0,h=1/1e4,p=16/1e3,m,y,x;for(i=parseFloat(i)||500,s=parseFloat(s)||20,o=o||null,u.tension=i,u.friction=s,m=o!==null,m?(f=a(i,s),y=f/o*p):y=p;x=r(x||u,y),d.push(1+x.x),f+=16,Math.abs(x.x)>h&&Math.abs(x.v)>h;);return m?function(E){return d[E*(d.length-1)|0]}:f}})(),Ut=function(e,r,a,i){var s=EB(e,r,a,i);return function(o,u,d){return o+(u-o)*s(d)}},Cf={linear:function(e,r,a){return e+(r-e)*a},ease:Ut(.25,.1,.25,1),"ease-in":Ut(.42,0,1,1),"ease-out":Ut(0,0,.58,1),"ease-in-out":Ut(.42,0,.58,1),"ease-in-sine":Ut(.47,0,.745,.715),"ease-out-sine":Ut(.39,.575,.565,1),"ease-in-out-sine":Ut(.445,.05,.55,.95),"ease-in-quad":Ut(.55,.085,.68,.53),"ease-out-quad":Ut(.25,.46,.45,.94),"ease-in-out-quad":Ut(.455,.03,.515,.955),"ease-in-cubic":Ut(.55,.055,.675,.19),"ease-out-cubic":Ut(.215,.61,.355,1),"ease-in-out-cubic":Ut(.645,.045,.355,1),"ease-in-quart":Ut(.895,.03,.685,.22),"ease-out-quart":Ut(.165,.84,.44,1),"ease-in-out-quart":Ut(.77,0,.175,1),"ease-in-quint":Ut(.755,.05,.855,.06),"ease-out-quint":Ut(.23,1,.32,1),"ease-in-out-quint":Ut(.86,0,.07,1),"ease-in-expo":Ut(.95,.05,.795,.035),"ease-out-expo":Ut(.19,1,.22,1),"ease-in-out-expo":Ut(1,0,0,1),"ease-in-circ":Ut(.6,.04,.98,.335),"ease-out-circ":Ut(.075,.82,.165,1),"ease-in-out-circ":Ut(.785,.135,.15,.86),spring:function(e,r,a){if(a===0)return Cf.linear;var i=TB(e,r,a);return function(s,o,u){return s+(o-s)*i(u)}},"cubic-bezier":Ut};function US(t,e,r,a,i){if(a===1||e===r)return r;var s=i(e,r,a);return t==null||((t.roundValue||t.color)&&(s=Math.round(s)),t.min!==void 0&&(s=Math.max(s,t.min)),t.max!==void 0&&(s=Math.min(s,t.max))),s}function qS(t,e){return t.pfValue!=null||t.value!=null?t.pfValue!=null&&(e==null||e.type.units!=="%")?t.pfValue:t.value:t}function Kl(t,e,r,a,i){var s=i!=null?i.type:null;r<0?r=0:r>1&&(r=1);var o=qS(t,i),u=qS(e,i);if(De(o)&&De(u))return US(s,o,u,r,a);if(_t(o)&&_t(u)){for(var d=[],f=0;f<u.length;f++){var h=o[f],p=u[f];if(h!=null&&p!=null){var m=US(s,h,p,r,a);d.push(m)}else d.push(p)}return d}}function CB(t,e,r,a){var i=!a,s=t._private,o=e._private,u=o.easing,d=o.startTime,f=a?t:t.cy(),h=f.style();if(!o.easingImpl)if(u==null)o.easingImpl=Cf.linear;else{var p;if(Xe(u)){var m=h.parse("transition-timing-function",u);p=m.value}else p=u;var y,x;Xe(p)?(y=p,x=[]):(y=p[1],x=p.slice(2).map(function(K){return+K})),x.length>0?(y==="spring"&&x.push(o.duration),o.easingImpl=Cf[y].apply(null,x)):o.easingImpl=Cf[y]}var E=o.easingImpl,w;if(o.duration===0?w=1:w=(r-d)/o.duration,o.applying&&(w=o.progress),w<0?w=0:w>1&&(w=1),o.delay==null){var T=o.startPosition,C=o.position;if(C&&i&&!t.locked()){var N={};Lu(T.x,C.x)&&(N.x=Kl(T.x,C.x,w,E)),Lu(T.y,C.y)&&(N.y=Kl(T.y,C.y,w,E)),t.position(N)}var A=o.startPan,D=o.pan,M=s.pan,j=D!=null&&a;j&&(Lu(A.x,D.x)&&(M.x=Kl(A.x,D.x,w,E)),Lu(A.y,D.y)&&(M.y=Kl(A.y,D.y,w,E)),t.emit("pan"));var k=o.startZoom,B=o.zoom,P=B!=null&&a;P&&(Lu(k,B)&&(s.zoom=tc(s.minZoom,Kl(k,B,w,E),s.maxZoom)),t.emit("zoom")),(j||P)&&t.emit("viewport");var U=o.style;if(U&&U.length>0&&i){for(var R=0;R<U.length;R++){var V=U[R],_=V.name,H=V,z=o.startStyle[_],I=h.properties[z.name],F=Kl(z,H,w,E,I);h.overrideBypass(t,_,F)}t.emit("style")}}return o.progress=w,w}function Lu(t,e){return t==null||e==null?!1:De(t)&&De(e)?!0:!!(t&&e)}function NB(t,e,r,a){var i=e._private;i.started=!0,i.startTime=r-i.progress*i.duration}function IS(t,e){var r=e._private.aniEles,a=[];function i(h,p){var m=h._private,y=m.animation.current,x=m.animation.queue,E=!1;if(y.length===0){var w=x.shift();w&&y.push(w)}for(var T=function(M){for(var j=M.length-1;j>=0;j--){var k=M[j];k()}M.splice(0,M.length)},C=y.length-1;C>=0;C--){var N=y[C],A=N._private;if(A.stopped){y.splice(C,1),A.hooked=!1,A.playing=!1,A.started=!1,T(A.frames);continue}!A.playing&&!A.applying||(A.playing&&A.applying&&(A.applying=!1),A.started||NB(h,N,t),CB(h,N,t,p),A.applying&&(A.applying=!1),T(A.frames),A.step!=null&&A.step(t),N.completed()&&(y.splice(C,1),A.hooked=!1,A.playing=!1,A.started=!1,T(A.completes)),E=!0)}return!p&&y.length===0&&x.length===0&&a.push(h),E}for(var s=!1,o=0;o<r.length;o++){var u=r[o],d=i(u);s=s||d}var f=i(e,!0);(s||f)&&(r.length>0?e.notify("draw",r):e.notify("draw")),r.unmerge(a),e.emit("step")}var jB={animate:jt.animate(),animation:jt.animation(),animated:jt.animated(),clearQueue:jt.clearQueue(),delay:jt.delay(),delayAnimation:jt.delayAnimation(),stop:jt.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&&_f(function(s){IS(s,e),r()})}var a=e.renderer();a&&a.beforeRender?a.beforeRender(function(s,o){IS(o,e)},a.beforeRenderPriorities.animations):r()}},AB={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&&Tc(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}},cf=function(e){return Xe(e)?new is(e):e},WC={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new vh(AB,this)),this},emitter:function(){return this._private.emitter},on:function(e,r,a){return this.emitter().on(e,cf(r),a),this},removeListener:function(e,r,a){return this.emitter().removeListener(e,cf(r),a),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,r,a){return this.emitter().one(e,cf(r),a),this},once:function(e,r,a){return this.emitter().one(e,cf(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}};jt.eventAliasesOn(WC);var im={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)}};im.jpeg=im.jpg;var Nf={layout:function(e){var r=this;if(e==null){$t("Layout options must be specified to make a layout");return}if(e.name==null){$t("A `name` must be specified to make a layout");return}var a=e.name,i=r.extension("layout",a);if(i==null){$t("No such layout `"+a+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var s;Xe(e.eles)?s=r.$(e.eles):s=e.eles!=null?e.eles:r.$();var o=new i(tt({},e,{cy:r,eles:s}));return o}};Nf.createLayout=Nf.makeLayout=Nf.layout;var MB={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 s=this.renderer();this.destroyed()||!s||s.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;i<a.length;i++){var s=a[i],o=e[s],u=r.getElementById(s);u.data(o)}})}},kB=Fr({hideEdgesOnViewport:!1,textureOnViewport:!1,motionBlur:!1,motionBlurOpacity:.05,pixelRatio:void 0,desktopTapThreshold:4,touchTapThreshold:8,wheelSensitivity:1,debug:!1,showFps:!1,webgl:!1,webglDebug:!1,webglDebugShowAtlases:!1,webglTexSize:2048,webglTexRows:36,webglTexRowsNodes:18,webglBatchSize:2048,webglTexPerBatch:14,webglBgColor:[255,255,255]}),sm={renderTo:function(e,r,a,i){var s=this._private.renderer;return s.renderTo(e,r,a,i),this},renderer:function(){return this._private.renderer},forceRender:function(){return this.notify("draw"),this},resize:function(){return this.invalidateSize(),this.emitAndNotify("resize"),this},initRenderer:function(e){var r=this,a=r.extension("renderer",e.name);if(a==null){$t("Can not initialise: No such renderer `".concat(e.name,"` found. Did you forget to import it and `cytoscape.use()` it?"));return}e.wheelSensitivity!==void 0&&At("You have set a custom wheel sensitivity. This will make your app zoom unnaturally when using mainstream mice. You should change this value from the default only if you can guarantee that all your users will use the same hardware and OS configuration as your current machine.");var i=kB(e);i.cy=r,r._private.renderer=new a(i),this.notify("init")},destroyRenderer:function(){var e=this;e.notify("destroy");var r=e.container();if(r)for(r._cyreg=null;r.childNodes.length>0;)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)}};sm.invalidateDimensions=sm.resize;var jf={collection:function(e,r){return Xe(e)?this.$(e):Da(e)?e.collection():_t(e)?(r||(r={}),new Ir(this,e,r.unique,r.removed)):new Ir(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}};jf.elements=jf.filter=jf.$;var Br={},Hu="t",DB="f";Br.apply=function(t){for(var e=this,r=e._private,a=r.cy,i=a.collection(),s=0;s<t.length;s++){var o=t[s],u=e.getContextMeta(o);if(!u.empty){var d=e.getContextStyle(u),f=e.applyContextStyle(u,d,o);o._private.appliedInitStyle?e.updateTransitions(o,f.diffProps):o._private.appliedInitStyle=!0;var h=e.updateStyleHints(o);h&&i.push(o)}}return i};Br.getPropertiesDiff=function(t,e){var r=this,a=r._private.propDiffs=r._private.propDiffs||{},i=t+"-"+e,s=a[i];if(s)return s;for(var o=[],u={},d=0;d<r.length;d++){var f=r[d],h=t[d]===Hu,p=e[d]===Hu,m=h!==p,y=f.mappedProperties.length>0;if(m||p&&y){var x=void 0;m&&y||m?x=f.properties:y&&(x=f.mappedProperties);for(var E=0;E<x.length;E++){for(var w=x[E],T=w.name,C=!1,N=d+1;N<r.length;N++){var A=r[N],D=e[N]===Hu;if(D&&(C=A.properties[w.name]!=null,C))break}!u[T]&&!C&&(u[T]=!0,o.push(T))}}}return a[i]=o,o};Br.getContextMeta=function(t){for(var e=this,r="",a,i=t._private.styleCxtKey||"",s=0;s<e.length;s++){var o=e[s],u=o.selector&&o.selector.matches(t);u?r+=Hu:r+=DB}return a=e.getPropertiesDiff(i,r),t._private.styleCxtKey=r,{key:r,diffPropNames:a,empty:a.length===0}};Br.getContextStyle=function(t){var e=t.key,r=this,a=this._private.contextStyles=this._private.contextStyles||{};if(a[e])return a[e];for(var i={_private:{key:e}},s=0;s<r.length;s++){var o=r[s],u=e[s]===Hu;if(u)for(var d=0;d<o.properties.length;d++){var f=o.properties[d];i[f.name]=f}}return a[e]=i,i};Br.applyContextStyle=function(t,e,r){for(var a=this,i=t.diffPropNames,s={},o=a.types,u=0;u<i.length;u++){var d=i[u],f=e[d],h=r.pstyle(d);if(!f)if(h)h.bypass?f={name:d,deleteBypassed:!0}:f={name:d,delete:!0};else continue;if(h!==f){if(f.mapped===o.fn&&h!=null&&h.mapping!=null&&h.mapping.value===f.value){var p=h.mapping,m=p.fnValue=f.value(r);if(m===p.prevFnValue)continue}var y=s[d]={prev:h};a.applyParsedProperty(r,f),y.next=r.pstyle(d),y.next&&y.next.bypass&&(y.next=y.next.bypassed)}}return{diffProps:s}};Br.updateStyleHints=function(t){var e=t._private,r=this,a=r.propertyGroupNames,i=r.propertyGroupKeys,s=function(le,se,Ne){return r.getPropertiesHash(le,se,Ne)},o=e.styleKey;if(t.removed())return!1;var u=e.group==="nodes",d=t._private.style;a=Object.keys(d);for(var f=0;f<i.length;f++){var h=i[f];e.styleKeys[h]=[zs,to]}for(var p=function(le,se){return e.styleKeys[se][0]=Wu(le,e.styleKeys[se][0])},m=function(le,se){return e.styleKeys[se][1]=Ju(le,e.styleKeys[se][1])},y=function(le,se){p(le,se),m(le,se)},x=function(le,se){for(var Ne=0;Ne<le.length;Ne++){var Ae=le.charCodeAt(Ne);p(Ae,se),m(Ae,se)}},E=2e9,w=function(le){return-128<le&&le<128&&Math.floor(le)!==le?E-(le*1024|0):le},T=0;T<a.length;T++){var C=a[T],N=d[C];if(N!=null){var A=this.properties[C],D=A.type,M=A.groupKey,j=void 0;A.hashOverride!=null?j=A.hashOverride(t,N):N.pfValue!=null&&(j=N.pfValue);var k=A.enums==null?N.value:null,B=j!=null,P=k!=null,U=B||P,R=N.units;if(D.number&&U&&!D.multiple){var V=B?j:k;y(w(V),M),!B&&R!=null&&x(R,M)}else x(N.strValue,M)}}for(var _=[zs,to],H=0;H<i.length;H++){var z=i[H],I=e.styleKeys[z];_[0]=Wu(I[0],_[0]),_[1]=Ju(I[1],_[1])}e.styleKey=$D(_[0],_[1]);var F=e.styleKeys;e.labelDimsKey=Oi(F.labelDimensions);var K=s(t,["label"],F.labelDimensions);if(e.labelKey=Oi(K),e.labelStyleKey=Oi(tf(F.commonLabel,K)),!u){var J=s(t,["source-label"],F.labelDimensions);e.sourceLabelKey=Oi(J),e.sourceLabelStyleKey=Oi(tf(F.commonLabel,J));var L=s(t,["target-label"],F.labelDimensions);e.targetLabelKey=Oi(L),e.targetLabelStyleKey=Oi(tf(F.commonLabel,L))}if(u){var Q=e.styleKeys,X=Q.nodeBody,W=Q.nodeBorder,te=Q.nodeOutline,Y=Q.backgroundImage,ne=Q.compound,he=Q.pie,oe=Q.stripe,ae=[X,W,te,Y,ne,he,oe].filter(function(re){return re!=null}).reduce(tf,[zs,to]);e.nodeKey=Oi(ae),e.hasPie=he!=null&&he[0]!==zs&&he[1]!==to,e.hasStripe=oe!=null&&oe[0]!==zs&&oe[1]!==to}return o!==e.styleKey};Br.clearStyleHints=function(t){var e=t._private;e.styleCxtKey="",e.styleKeys={},e.styleKey=null,e.labelKey=null,e.labelStyleKey=null,e.sourceLabelKey=null,e.sourceLabelStyleKey=null,e.targetLabelKey=null,e.targetLabelStyleKey=null,e.nodeKey=null,e.hasPie=null,e.hasStripe=null};Br.applyParsedProperty=function(t,e){var r=this,a=e,i=t._private.style,s,o=r.types,u=r.properties[a.name].type,d=a.bypass,f=i[a.name],h=f&&f.bypass,p=t._private,m="mapping",y=function(X){return X==null?null:X.pfValue!=null?X.pfValue:X.value},x=function(){var X=y(f),W=y(a);r.checkTriggers(t,a.name,X,W)};if(e.name==="curve-style"&&t.isEdge()&&(e.value!=="bezier"&&t.isLoop()||e.value==="haystack"&&(t.source().isParent()||t.target().isParent()))&&(a=e=this.parse(e.name,"bezier",d)),a.delete)return i[a.name]=void 0,x(),!0;if(a.deleteBypassed)return f?f.bypass?(f.bypassed=void 0,x(),!0):!1:(x(),!0);if(a.deleteBypass)return f?f.bypass?(i[a.name]=f.bypassed,x(),!0):!1:(x(),!0);var E=function(){At("Do not assign mappings to elements without corresponding data (i.e. ele `"+t.id()+"` has no mapping for property `"+a.name+"` with data field `"+a.field+"`); try a `["+a.field+"]` selector to limit scope to elements with `"+a.field+"` defined")};switch(a.mapped){case o.mapData:{for(var w=a.field.split("."),T=p.data,C=0;C<w.length&&T;C++){var N=w[C];T=T[N]}if(T==null)return E(),!1;var A;if(De(T)){var D=a.fieldMax-a.fieldMin;D===0?A=0:A=(T-a.fieldMin)/D}else return At("Do not use continuous mappers without specifying numeric data (i.e. `"+a.field+": "+T+"` for `"+t.id()+"` is non-numeric)"),!1;if(A<0?A=0:A>1&&(A=1),u.color){var M=a.valueMin[0],j=a.valueMax[0],k=a.valueMin[1],B=a.valueMax[1],P=a.valueMin[2],U=a.valueMax[2],R=a.valueMin[3]==null?1:a.valueMin[3],V=a.valueMax[3]==null?1:a.valueMax[3],_=[Math.round(M+(j-M)*A),Math.round(k+(B-k)*A),Math.round(P+(U-P)*A),Math.round(R+(V-R)*A)];s={bypass:a.bypass,name:a.name,value:_,strValue:"rgb("+_[0]+", "+_[1]+", "+_[2]+")"}}else if(u.number){var H=a.valueMin+(a.valueMax-a.valueMin)*A;s=this.parse(a.name,H,a.bypass,m)}else return!1;if(!s)return E(),!1;s.mapping=a,a=s;break}case o.data:{for(var z=a.field.split("."),I=p.data,F=0;F<z.length&&I;F++){var K=z[F];I=I[K]}if(I!=null&&(s=this.parse(a.name,I,a.bypass,m)),!s)return E(),!1;s.mapping=a,a=s;break}case o.fn:{var J=a.value,L=a.fnValue!=null?a.fnValue:J(t);if(a.prevFnValue=L,L==null)return At("Custom function mappers may not return null (i.e. `"+a.name+"` for ele `"+t.id()+"` is null)"),!1;if(s=this.parse(a.name,L,a.bypass,m),!s)return At("Custom function mappers may not return invalid values for the property type (i.e. `"+a.name+"` for ele `"+t.id()+"` is invalid)"),!1;s.mapping=Sn(a),a=s;break}case void 0:break;default:return!1}return d?(h?a.bypassed=f.bypassed:a.bypassed=f,i[a.name]=a):h?f.bypassed=a:i[a.name]=a,x(),!0};Br.cleanElements=function(t,e){for(var r=0;r<t.length;r++){var a=t[r];if(this.clearStyleHints(a),a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),!e)a._private.style={};else for(var i=a._private.style,s=Object.keys(i),o=0;o<s.length;o++){var u=s[o],d=i[u];d!=null&&(d.bypass?d.bypassed=null:i[u]=null)}}};Br.update=function(){var t=this._private.cy,e=t.mutableElements();e.updateStyle()};Br.updateTransitions=function(t,e){var r=this,a=t._private,i=t.pstyle("transition-property").value,s=t.pstyle("transition-duration").pfValue,o=t.pstyle("transition-delay").pfValue;if(i.length>0&&s>0){for(var u={},d=!1,f=0;f<i.length;f++){var h=i[f],p=t.pstyle(h),m=e[h];if(m){var y=m.prev,x=y,E=m.next!=null?m.next:p,w=!1,T=void 0,C=1e-6;x&&(De(x.pfValue)&&De(E.pfValue)?(w=E.pfValue-x.pfValue,T=x.pfValue+C*w):De(x.value)&&De(E.value)?(w=E.value-x.value,T=x.value+C*w):_t(x.value)&&_t(E.value)&&(w=x.value[0]!==E.value[0]||x.value[1]!==E.value[1]||x.value[2]!==E.value[2],T=x.strValue),w&&(u[h]=E.strValue,this.applyBypass(t,h,T),d=!0))}}if(!d)return;a.transitioning=!0,new Lo(function(N){o>0?t.delayAnimation(o).play().promise().then(N):N()}).then(function(){return t.animation({style:u,duration:s,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)};Br.checkTrigger=function(t,e,r,a,i,s){var o=this.properties[e],u=i(o);t.removed()||u!=null&&u(r,a,t)&&s(o)};Br.checkZOrderTrigger=function(t,e,r,a){var i=this;this.checkTrigger(t,e,r,a,function(s){return s.triggersZOrder},function(){i._private.cy.notify("zorder",t)})};Br.checkBoundsTrigger=function(t,e,r,a){this.checkTrigger(t,e,r,a,function(i){return i.triggersBounds},function(i){t.dirtyCompoundBoundsCache(),t.dirtyBoundingBoxCache()})};Br.checkConnectedEdgesBoundsTrigger=function(t,e,r,a){this.checkTrigger(t,e,r,a,function(i){return i.triggersBoundsOfConnectedEdges},function(i){t.connectedEdges().forEach(function(s){s.dirtyBoundingBoxCache()})})};Br.checkParallelEdgesBoundsTrigger=function(t,e,r,a){this.checkTrigger(t,e,r,a,function(i){return i.triggersBoundsOfParallelEdges},function(i){t.parallelEdges().forEach(function(s){s.dirtyBoundingBoxCache()})})};Br.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 Dc={};Dc.applyBypass=function(t,e,r,a){var i=this,s=[],o=!0;if(e==="*"||e==="**"){if(r!==void 0)for(var u=0;u<i.properties.length;u++){var d=i.properties[u],f=d.name,h=this.parse(f,r,!0);h&&s.push(h)}}else if(Xe(e)){var p=this.parse(e,r,!0);p&&s.push(p)}else if(wt(e)){var m=e;a=r;for(var y=Object.keys(m),x=0;x<y.length;x++){var E=y[x],w=m[E];if(w===void 0&&(w=m[nh(E)]),w!==void 0){var T=this.parse(E,w,!0);T&&s.push(T)}}}else return!1;if(s.length===0)return!1;for(var C=!1,N=0;N<t.length;N++){for(var A=t[N],D={},M=void 0,j=0;j<s.length;j++){var k=s[j];if(a){var B=A.pstyle(k.name);M=D[k.name]={prev:B}}C=this.applyParsedProperty(A,Sn(k))||C,a&&(M.next=A.pstyle(k.name))}C&&this.updateStyleHints(A),a&&this.updateTransitions(A,D,o)}return C};Dc.overrideBypass=function(t,e,r){e=Vm(e);for(var a=0;a<t.length;a++){var i=t[a],s=i._private.style[e],o=this.properties[e].type,u=o.color,d=o.mutiple,f=s?s.pfValue!=null?s.pfValue:s.value:null;!s||!s.bypass?this.applyBypass(i,e,r):(s.value=r,s.pfValue!=null&&(s.pfValue=r),u?s.strValue="rgb("+r.join(",")+")":d?s.strValue=r.join(" "):s.strValue=""+r,this.updateStyleHints(i)),this.checkTriggers(i,e,f,r)}};Dc.removeAllBypasses=function(t,e){return this.removeBypasses(t,this.propertyNames,e)};Dc.removeBypasses=function(t,e,r){for(var a=!0,i=0;i<t.length;i++){for(var s=t[i],o={},u=0;u<e.length;u++){var d=e[u],f=this.properties[d],h=s.pstyle(f.name);if(!(!h||!h.bypass)){var p="",m=this.parse(d,p,!0),y=o[f.name]={prev:h};this.applyParsedProperty(s,m),y.next=s.pstyle(f.name)}}this.updateStyleHints(s),r&&this.updateTransitions(s,o,a)}};var ay={};ay.getEmSizeInPixels=function(){var t=this.containerCss("font-size");return t!=null?parseFloat(t):1};ay.containerCss=function(t){var e=this._private.cy,r=e.container(),a=e.window();if(a&&r&&a.getComputedStyle)return a.getComputedStyle(r).getPropertyValue(t)};var En={};En.getRenderedStyle=function(t,e){return e?this.getStylePropertyValue(t,e,!0):this.getRawStyle(t,!0)};En.getRawStyle=function(t,e){var r=this;if(t=t[0],t){for(var a={},i=0;i<r.properties.length;i++){var s=r.properties[i],o=r.getStylePropertyValue(t,s.name,e);o!=null&&(a[s.name]=o,a[nh(s.name)]=o)}return a}};En.getIndexedStyle=function(t,e,r,a){var i=t.pstyle(e)[r][a];return i??t.cy().style().getDefaultProperty(e)[r][0]};En.getStylePropertyValue=function(t,e,r){var a=this;if(t=t[0],t){var i=a.properties[e];i.alias&&(i=i.pointsTo);var s=i.type,o=t.pstyle(i.name);if(o){var u=o.value,d=o.units,f=o.strValue;if(r&&s.number&&u!=null&&De(u)){var h=t.cy().zoom(),p=function(w){return w*h},m=function(w,T){return p(w)+T},y=_t(u),x=y?d.every(function(E){return E!=null}):d!=null;return x?y?u.map(function(E,w){return m(E,d[w])}).join(" "):m(u,d):y?u.map(function(E){return Xe(E)?E:""+p(E)}).join(" "):""+p(u)}else if(f!=null)return f}return null}};En.getAnimationStartStyle=function(t,e){for(var r={},a=0;a<e.length;a++){var i=e[a],s=i.name,o=t.pstyle(s);o!==void 0&&(wt(o)?o=this.parse(s,o.strValue):o=this.parse(s,o)),o&&(r[s]=o)}return r};En.getPropsList=function(t){var e=this,r=[],a=t,i=e.properties;if(a)for(var s=Object.keys(a),o=0;o<s.length;o++){var u=s[o],d=a[u],f=i[u]||i[Vm(u)],h=this.parse(f.name,d);h&&r.push(h)}return r};En.getNonDefaultPropertiesHash=function(t,e,r){var a=r.slice(),i,s,o,u,d,f;for(d=0;d<e.length;d++)if(i=e[d],s=t.pstyle(i,!1),s!=null)if(s.pfValue!=null)a[0]=Wu(u,a[0]),a[1]=Ju(u,a[1]);else for(o=s.strValue,f=0;f<o.length;f++)u=o.charCodeAt(f),a[0]=Wu(u,a[0]),a[1]=Ju(u,a[1]);return a};En.getPropertiesHash=En.getNonDefaultPropertiesHash;var mh={};mh.appendFromJson=function(t){for(var e=this,r=0;r<t.length;r++){var a=t[r],i=a.selector,s=a.style||a.css,o=Object.keys(s);e.selector(i);for(var u=0;u<o.length;u++){var d=o[u],f=s[d];e.css(d,f)}}return e};mh.fromJson=function(t){var e=this;return e.resetToDefault(),e.appendFromJson(t),e};mh.json=function(){for(var t=[],e=this.defaultLength;e<this.length;e++){for(var r=this[e],a=r.selector,i=r.properties,s={},o=0;o<i.length;o++){var u=i[o];s[u.name]=u.strValue}t.push({selector:a?a.toString():"core",style:s})}return t};var ny={};ny.appendFromString=function(t){var e=this,r=this,a=""+t,i,s,o;a=a.replace(/[/][*](\s|.)+?[*][/]/g,"");function u(){a.length>i.length?a=a.substr(i.length):a=""}function d(){s.length>o.length?s=s.substr(o.length):s=""}for(;;){var f=a.match(/^\s*$/);if(f)break;var h=a.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!h){At("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+a);break}i=h[0];var p=h[1];if(p!=="core"){var m=new is(p);if(m.invalid){At("Skipping parsing of block: Invalid selector found in string stylesheet: "+p),u();continue}}var y=h[2],x=!1;s=y;for(var E=[];;){var w=s.match(/^\s*$/);if(w)break;var T=s.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!T){At("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+y),x=!0;break}o=T[0];var C=T[1],N=T[2],A=e.properties[C];if(!A){At("Skipping property: Invalid property name in: "+o),d();continue}var D=r.parse(C,N);if(!D){At("Skipping property: Invalid property definition in: "+o),d();continue}E.push({name:C,val:N}),d()}if(x){u();break}r.selector(p);for(var M=0;M<E.length;M++){var j=E[M];r.css(j.name,j.val)}u()}return r};ny.fromString=function(t){var e=this;return e.resetToDefault(),e.appendFromString(t),e};var gr={};(function(){var t=Sr,e=CD,r=jD,a=AD,i=MD,s=function(re){return"^"+re+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},o=function(re){var le=t+"|\\w+|"+e+"|"+r+"|"+a+"|"+i;return"^"+re+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+t+")\\s*\\,\\s*("+t+")\\s*,\\s*("+le+")\\s*\\,\\s*("+le+")\\)$"},u=[`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`,"^(none)$","^(.+)$"];gr.types={time:{number:!0,min:0,units:"s|ms",implicitUnits:"ms"},percent:{number:!0,min:0,max:100,units:"%",implicitUnits:"%"},percentages:{number:!0,min:0,max:100,units:"%",implicitUnits:"%",multiple:!0},zeroOneNumber:{number:!0,min:0,max:1,unitless:!0},zeroOneNumbers:{number:!0,min:0,max:1,unitless:!0,multiple:!0},nOneOneNumber:{number:!0,min:-1,max:1,unitless:!0},nonNegativeInt:{number:!0,min:0,integer:!0,unitless:!0},nonNegativeNumber:{number:!0,min:0,unitless:!0},position:{enums:["parent","origin"]},nodeSize:{number:!0,min:0,enums:["label"]},number:{number:!0,unitless:!0},numbers:{number:!0,unitless:!0,multiple:!0},positiveNumber:{number:!0,unitless:!0,min:0,strictMin:!0},size:{number:!0,min:0},bidirectionalSize:{number:!0},bidirectionalSizeMaybePercent:{number:!0,allowPercent:!0},bidirectionalSizes:{number:!0,multiple:!0},sizeMaybePercent:{number:!0,min:0,allowPercent:!0},axisDirection:{enums:["horizontal","leftward","rightward","vertical","upward","downward","auto"]},axisDirectionExplicit:{enums:["leftward","rightward","upward","downward"]},axisDirectionPrimary:{enums:["horizontal","vertical"]},paddingRelativeTo:{enums:["width","height","average","min","max"]},bgWH:{number:!0,min:0,allowPercent:!0,enums:["auto"],multiple:!0},bgPos:{number:!0,allowPercent:!0,multiple:!0},bgRelativeTo:{enums:["inner","include-padding"],multiple:!0},bgRepeat:{enums:["repeat","repeat-x","repeat-y","no-repeat"],multiple:!0},bgFit:{enums:["none","contain","cover"],multiple:!0},bgCrossOrigin:{enums:["anonymous","use-credentials","null"],multiple:!0},bgClip:{enums:["none","node"],multiple:!0},bgContainment:{enums:["inside","over"],multiple:!0},boxSelection:{enums:["contain","overlap","none"]},color:{color:!0},colors:{color:!0,multiple:!0},fill:{enums:["solid","linear-gradient","radial-gradient"]},bool:{enums:["yes","no"]},bools:{enums:["yes","no"],multiple:!0},lineStyle:{enums:["solid","dotted","dashed"]},lineCap:{enums:["butt","round","square"]},linePosition:{enums:["center","inside","outside"]},lineJoin:{enums:["round","bevel","miter"]},borderStyle:{enums:["solid","dotted","dashed","double"]},curveStyle:{enums:["bezier","unbundled-bezier","haystack","segments","straight","straight-triangle","taxi","round-segments","round-taxi"]},radiusType:{enums:["arc-radius","influence-radius"],multiple:!0},fontFamily:{regex:'^([\\w- \\"]+(?:\\s*,\\s*[\\w- \\"]+)*)$'},fontStyle:{enums:["italic","normal","oblique"]},fontWeight:{enums:["normal","bold","bolder","lighter","100","200","300","400","500","600","800","900",100,200,300,400,500,600,700,800,900]},textDecoration:{enums:["none","underline","overline","line-through"]},textTransform:{enums:["none","uppercase","lowercase"]},textWrap:{enums:["none","wrap","ellipsis"]},textOverflowWrap:{enums:["whitespace","anywhere"]},textBackgroundShape:{enums:["rectangle","roundrectangle","round-rectangle","circle"]},nodeShape:{enums:["rectangle","roundrectangle","round-rectangle","cutrectangle","cut-rectangle","bottomroundrectangle","bottom-round-rectangle","barrel","ellipse","triangle","round-triangle","square","pentagon","round-pentagon","hexagon","round-hexagon","concavehexagon","concave-hexagon","heptagon","round-heptagon","octagon","round-octagon","tag","round-tag","star","diamond","round-diamond","vee","rhomboid","right-rhomboid","polygon"]},overlayShape:{enums:["roundrectangle","round-rectangle","ellipse"]},cornerRadius:{number:!0,min:0,units:"px|em",implicitUnits:"px",enums:["auto"]},compoundIncludeLabels:{enums:["include","exclude"]},arrowShape:{enums:["tee","triangle","triangle-tee","circle-triangle","triangle-cross","triangle-backcurve","vee","square","circle","diamond","chevron","none"]},arrowFill:{enums:["filled","hollow"]},arrowWidth:{number:!0,units:"%|px|em",implicitUnits:"px",enums:["match-line"]},display:{enums:["element","none"]},visibility:{enums:["hidden","visible"]},zCompoundDepth:{enums:["bottom","orphan","auto","top"]},zIndexCompare:{enums:["auto","manual"]},valign:{enums:["top","center","bottom"]},halign:{enums:["left","center","right"]},justification:{enums:["left","center","right","auto"]},text:{string:!0},data:{mapping:!0,regex:s("data")},layoutData:{mapping:!0,regex:s("layoutData")},scratch:{mapping:!0,regex:s("scratch")},mapData:{mapping:!0,regex:o("mapData")},mapLayoutData:{mapping:!0,regex:o("mapLayoutData")},mapScratch:{mapping:!0,regex:o("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:u,singleRegexMatchValue:!0},urls:{regexes:u,singleRegexMatchValue:!0,multiple:!0},propList:{propList:!0},angle:{number:!0,units:"deg|rad",implicitUnits:"rad"},textRotation:{number:!0,units:"deg|rad",implicitUnits:"rad",enums:["none","autorotate"]},polygonPointList:{number:!0,multiple:!0,evenMultiple:!0,min:-1,max:1,unitless:!0},edgeDistances:{enums:["intersection","node-position","endpoints"]},edgeEndpoint:{number:!0,multiple:!0,units:"%|px|em|deg|rad",implicitUnits:"px",enums:["inside-to-node","outside-to-node","outside-to-node-or-label","outside-to-line","outside-to-line-or-label"],singleEnum:!0,validate:function(re,le){switch(re.length){case 2:return le[0]!=="deg"&&le[0]!=="rad"&&le[1]!=="deg"&&le[1]!=="rad";case 1:return Xe(re[0])||le[0]==="deg"||le[0]==="rad";default:return!1}}},easing:{regexes:["^(spring)\\s*\\(\\s*("+t+")\\s*,\\s*("+t+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+t+")\\s*,\\s*("+t+")\\s*,\\s*("+t+")\\s*,\\s*("+t+")\\s*\\)$"],enums:["linear","ease","ease-in","ease-out","ease-in-out","ease-in-sine","ease-out-sine","ease-in-out-sine","ease-in-quad","ease-out-quad","ease-in-out-quad","ease-in-cubic","ease-out-cubic","ease-in-out-cubic","ease-in-quart","ease-out-quart","ease-in-out-quart","ease-in-quint","ease-out-quint","ease-in-out-quint","ease-in-expo","ease-out-expo","ease-in-out-expo","ease-in-circ","ease-out-circ","ease-in-out-circ"]},gradientDirection:{enums:["to-bottom","to-top","to-left","to-right","to-bottom-right","to-bottom-left","to-top-right","to-top-left","to-right-bottom","to-left-bottom","to-right-top","to-left-top"]},boundsExpansion:{number:!0,multiple:!0,min:0,validate:function(re){var le=re.length;return le===1||le===2||le===4}}};var d={zeroNonZero:function(re,le){return(re==null||le==null)&&re!==le||re==0&&le!=0?!0:re!=0&&le==0},any:function(re,le){return re!=le},emptyNonEmpty:function(re,le){var se=rs(re),Ne=rs(le);return se&&!Ne||!se&&Ne}},f=gr.types,h=[{name:"label",type:f.text,triggersBounds:d.any,triggersZOrder:d.emptyNonEmpty},{name:"text-rotation",type:f.textRotation,triggersBounds:d.any},{name:"text-margin-x",type:f.bidirectionalSize,triggersBounds:d.any},{name:"text-margin-y",type:f.bidirectionalSize,triggersBounds:d.any}],p=[{name:"source-label",type:f.text,triggersBounds:d.any},{name:"source-text-rotation",type:f.textRotation,triggersBounds:d.any},{name:"source-text-margin-x",type:f.bidirectionalSize,triggersBounds:d.any},{name:"source-text-margin-y",type:f.bidirectionalSize,triggersBounds:d.any},{name:"source-text-offset",type:f.size,triggersBounds:d.any}],m=[{name:"target-label",type:f.text,triggersBounds:d.any},{name:"target-text-rotation",type:f.textRotation,triggersBounds:d.any},{name:"target-text-margin-x",type:f.bidirectionalSize,triggersBounds:d.any},{name:"target-text-margin-y",type:f.bidirectionalSize,triggersBounds:d.any},{name:"target-text-offset",type:f.size,triggersBounds:d.any}],y=[{name:"font-family",type:f.fontFamily,triggersBounds:d.any},{name:"font-style",type:f.fontStyle,triggersBounds:d.any},{name:"font-weight",type:f.fontWeight,triggersBounds:d.any},{name:"font-size",type:f.size,triggersBounds:d.any},{name:"text-transform",type:f.textTransform,triggersBounds:d.any},{name:"text-wrap",type:f.textWrap,triggersBounds:d.any},{name:"text-overflow-wrap",type:f.textOverflowWrap,triggersBounds:d.any},{name:"text-max-width",type:f.size,triggersBounds:d.any},{name:"text-outline-width",type:f.size,triggersBounds:d.any},{name:"line-height",type:f.positiveNumber,triggersBounds:d.any}],x=[{name:"text-valign",type:f.valign,triggersBounds:d.any},{name:"text-halign",type:f.halign,triggersBounds:d.any},{name:"color",type:f.color},{name:"text-outline-color",type:f.color},{name:"text-outline-opacity",type:f.zeroOneNumber},{name:"text-background-color",type:f.color},{name:"text-background-opacity",type:f.zeroOneNumber},{name:"text-background-padding",type:f.size,triggersBounds:d.any},{name:"text-border-opacity",type:f.zeroOneNumber},{name:"text-border-color",type:f.color},{name:"text-border-width",type:f.size,triggersBounds:d.any},{name:"text-border-style",type:f.borderStyle,triggersBounds:d.any},{name:"text-background-shape",type:f.textBackgroundShape,triggersBounds:d.any},{name:"text-justification",type:f.justification},{name:"box-select-labels",type:f.bool,triggersBounds:d.any}],E=[{name:"events",type:f.bool,triggersZOrder:d.any},{name:"text-events",type:f.bool,triggersZOrder:d.any},{name:"box-selection",type:f.boxSelection,triggersZOrder:d.any}],w=[{name:"display",type:f.display,triggersZOrder:d.any,triggersBounds:d.any,triggersBoundsOfConnectedEdges:d.any,triggersBoundsOfParallelEdges:function(re,le,se){return re===le?!1:se.pstyle("curve-style").value==="bezier"}},{name:"visibility",type:f.visibility,triggersZOrder:d.any},{name:"opacity",type:f.zeroOneNumber,triggersZOrder:d.zeroNonZero},{name:"text-opacity",type:f.zeroOneNumber},{name:"min-zoomed-font-size",type:f.size},{name:"z-compound-depth",type:f.zCompoundDepth,triggersZOrder:d.any},{name:"z-index-compare",type:f.zIndexCompare,triggersZOrder:d.any},{name:"z-index",type:f.number,triggersZOrder:d.any}],T=[{name:"overlay-padding",type:f.size,triggersBounds:d.any},{name:"overlay-color",type:f.color},{name:"overlay-opacity",type:f.zeroOneNumber,triggersBounds:d.zeroNonZero},{name:"overlay-shape",type:f.overlayShape,triggersBounds:d.any},{name:"overlay-corner-radius",type:f.cornerRadius}],C=[{name:"underlay-padding",type:f.size,triggersBounds:d.any},{name:"underlay-color",type:f.color},{name:"underlay-opacity",type:f.zeroOneNumber,triggersBounds:d.zeroNonZero},{name:"underlay-shape",type:f.overlayShape,triggersBounds:d.any},{name:"underlay-corner-radius",type:f.cornerRadius}],N=[{name:"transition-property",type:f.propList},{name:"transition-duration",type:f.time},{name:"transition-delay",type:f.time},{name:"transition-timing-function",type:f.easing}],A=function(re,le){return le.value==="label"?-re.poolIndex():le.pfValue},D=[{name:"height",type:f.nodeSize,triggersBounds:d.any,hashOverride:A},{name:"width",type:f.nodeSize,triggersBounds:d.any,hashOverride:A},{name:"shape",type:f.nodeShape,triggersBounds:d.any},{name:"shape-polygon-points",type:f.polygonPointList,triggersBounds:d.any},{name:"corner-radius",type:f.cornerRadius},{name:"background-color",type:f.color},{name:"background-fill",type:f.fill},{name:"background-opacity",type:f.zeroOneNumber},{name:"background-blacken",type:f.nOneOneNumber},{name:"background-gradient-stop-colors",type:f.colors},{name:"background-gradient-stop-positions",type:f.percentages},{name:"background-gradient-direction",type:f.gradientDirection},{name:"padding",type:f.sizeMaybePercent,triggersBounds:d.any},{name:"padding-relative-to",type:f.paddingRelativeTo,triggersBounds:d.any},{name:"bounds-expansion",type:f.boundsExpansion,triggersBounds:d.any}],M=[{name:"border-color",type:f.color},{name:"border-opacity",type:f.zeroOneNumber},{name:"border-width",type:f.size,triggersBounds:d.any},{name:"border-style",type:f.borderStyle},{name:"border-cap",type:f.lineCap},{name:"border-join",type:f.lineJoin},{name:"border-dash-pattern",type:f.numbers},{name:"border-dash-offset",type:f.number},{name:"border-position",type:f.linePosition}],j=[{name:"outline-color",type:f.color},{name:"outline-opacity",type:f.zeroOneNumber},{name:"outline-width",type:f.size,triggersBounds:d.any},{name:"outline-style",type:f.borderStyle},{name:"outline-offset",type:f.size,triggersBounds:d.any}],k=[{name:"background-image",type:f.urls},{name:"background-image-crossorigin",type:f.bgCrossOrigin},{name:"background-image-opacity",type:f.zeroOneNumbers},{name:"background-image-containment",type:f.bgContainment},{name:"background-image-smoothing",type:f.bools},{name:"background-position-x",type:f.bgPos},{name:"background-position-y",type:f.bgPos},{name:"background-width-relative-to",type:f.bgRelativeTo},{name:"background-height-relative-to",type:f.bgRelativeTo},{name:"background-repeat",type:f.bgRepeat},{name:"background-fit",type:f.bgFit},{name:"background-clip",type:f.bgClip},{name:"background-width",type:f.bgWH},{name:"background-height",type:f.bgWH},{name:"background-offset-x",type:f.bgPos},{name:"background-offset-y",type:f.bgPos}],B=[{name:"position",type:f.position,triggersBounds:d.any},{name:"compound-sizing-wrt-labels",type:f.compoundIncludeLabels,triggersBounds:d.any},{name:"min-width",type:f.size,triggersBounds:d.any},{name:"min-width-bias-left",type:f.sizeMaybePercent,triggersBounds:d.any},{name:"min-width-bias-right",type:f.sizeMaybePercent,triggersBounds:d.any},{name:"min-height",type:f.size,triggersBounds:d.any},{name:"min-height-bias-top",type:f.sizeMaybePercent,triggersBounds:d.any},{name:"min-height-bias-bottom",type:f.sizeMaybePercent,triggersBounds:d.any}],P=[{name:"line-style",type:f.lineStyle},{name:"line-color",type:f.color},{name:"line-fill",type:f.fill},{name:"line-cap",type:f.lineCap},{name:"line-opacity",type:f.zeroOneNumber},{name:"line-dash-pattern",type:f.numbers},{name:"line-dash-offset",type:f.number},{name:"line-outline-width",type:f.size},{name:"line-outline-color",type:f.color},{name:"line-gradient-stop-colors",type:f.colors},{name:"line-gradient-stop-positions",type:f.percentages},{name:"curve-style",type:f.curveStyle,triggersBounds:d.any,triggersBoundsOfParallelEdges:function(re,le){return re===le?!1:re==="bezier"||le==="bezier"}},{name:"haystack-radius",type:f.zeroOneNumber,triggersBounds:d.any},{name:"source-endpoint",type:f.edgeEndpoint,triggersBounds:d.any},{name:"target-endpoint",type:f.edgeEndpoint,triggersBounds:d.any},{name:"control-point-step-size",type:f.size,triggersBounds:d.any},{name:"control-point-distances",type:f.bidirectionalSizes,triggersBounds:d.any},{name:"control-point-weights",type:f.numbers,triggersBounds:d.any},{name:"segment-distances",type:f.bidirectionalSizes,triggersBounds:d.any},{name:"segment-weights",type:f.numbers,triggersBounds:d.any},{name:"segment-radii",type:f.numbers,triggersBounds:d.any},{name:"radius-type",type:f.radiusType,triggersBounds:d.any},{name:"taxi-turn",type:f.bidirectionalSizeMaybePercent,triggersBounds:d.any},{name:"taxi-turn-min-distance",type:f.size,triggersBounds:d.any},{name:"taxi-direction",type:f.axisDirection,triggersBounds:d.any},{name:"taxi-radius",type:f.number,triggersBounds:d.any},{name:"edge-distances",type:f.edgeDistances,triggersBounds:d.any},{name:"arrow-scale",type:f.positiveNumber,triggersBounds:d.any},{name:"loop-direction",type:f.angle,triggersBounds:d.any},{name:"loop-sweep",type:f.angle,triggersBounds:d.any},{name:"source-distance-from-node",type:f.size,triggersBounds:d.any},{name:"target-distance-from-node",type:f.size,triggersBounds:d.any}],U=[{name:"ghost",type:f.bool,triggersBounds:d.any},{name:"ghost-offset-x",type:f.bidirectionalSize,triggersBounds:d.any},{name:"ghost-offset-y",type:f.bidirectionalSize,triggersBounds:d.any},{name:"ghost-opacity",type:f.zeroOneNumber}],R=[{name:"selection-box-color",type:f.color},{name:"selection-box-opacity",type:f.zeroOneNumber},{name:"selection-box-border-color",type:f.color},{name:"selection-box-border-width",type:f.size},{name:"active-bg-color",type:f.color},{name:"active-bg-opacity",type:f.zeroOneNumber},{name:"active-bg-size",type:f.size},{name:"outside-texture-bg-color",type:f.color},{name:"outside-texture-bg-opacity",type:f.zeroOneNumber}],V=[];gr.pieBackgroundN=16,V.push({name:"pie-size",type:f.sizeMaybePercent}),V.push({name:"pie-hole",type:f.sizeMaybePercent}),V.push({name:"pie-start-angle",type:f.angle});for(var _=1;_<=gr.pieBackgroundN;_++)V.push({name:"pie-"+_+"-background-color",type:f.color}),V.push({name:"pie-"+_+"-background-size",type:f.percent}),V.push({name:"pie-"+_+"-background-opacity",type:f.zeroOneNumber});var H=[];gr.stripeBackgroundN=16,H.push({name:"stripe-size",type:f.sizeMaybePercent}),H.push({name:"stripe-direction",type:f.axisDirectionPrimary});for(var z=1;z<=gr.stripeBackgroundN;z++)H.push({name:"stripe-"+z+"-background-color",type:f.color}),H.push({name:"stripe-"+z+"-background-size",type:f.percent}),H.push({name:"stripe-"+z+"-background-opacity",type:f.zeroOneNumber});var I=[],F=gr.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:f.arrowShape,triggersBounds:d.any},{name:"arrow-color",type:f.color},{name:"arrow-fill",type:f.arrowFill},{name:"arrow-width",type:f.arrowWidth}].forEach(function(ae){F.forEach(function(re){var le=re+"-"+ae.name,se=ae.type,Ne=ae.triggersBounds;I.push({name:le,type:se,triggersBounds:Ne})})},{});var K=gr.properties=[].concat(E,N,w,T,C,U,x,y,h,p,m,D,M,j,k,V,H,B,P,I,R),J=gr.propertyGroups={behavior:E,transition:N,visibility:w,overlay:T,underlay:C,ghost:U,commonLabel:x,labelDimensions:y,mainLabel:h,sourceLabel:p,targetLabel:m,nodeBody:D,nodeBorder:M,nodeOutline:j,backgroundImage:k,pie:V,stripe:H,compound:B,edgeLine:P,edgeArrow:I,core:R},L=gr.propertyGroupNames={},Q=gr.propertyGroupKeys=Object.keys(J);Q.forEach(function(ae){L[ae]=J[ae].map(function(re){return re.name}),J[ae].forEach(function(re){return re.groupKey=ae})});var X=gr.aliases=[{name:"content",pointsTo:"label"},{name:"control-point-distance",pointsTo:"control-point-distances"},{name:"control-point-weight",pointsTo:"control-point-weights"},{name:"segment-distance",pointsTo:"segment-distances"},{name:"segment-weight",pointsTo:"segment-weights"},{name:"segment-radius",pointsTo:"segment-radii"},{name:"edge-text-rotation",pointsTo:"text-rotation"},{name:"padding-left",pointsTo:"padding"},{name:"padding-right",pointsTo:"padding"},{name:"padding-top",pointsTo:"padding"},{name:"padding-bottom",pointsTo:"padding"}];gr.propertyNames=K.map(function(ae){return ae.name});for(var W=0;W<K.length;W++){var te=K[W];K[te.name]=te}for(var Y=0;Y<X.length;Y++){var ne=X[Y],he=K[ne.pointsTo],oe={name:ne.name,alias:!0,pointsTo:he};K.push(oe),K[ne.name]=oe}})();gr.getDefaultProperty=function(t){return this.getDefaultProperties()[t]};gr.getDefaultProperties=function(){var t=this._private;if(t.defaultProperties!=null)return t.defaultProperties;for(var e=tt({"selection-box-color":"#ddd","selection-box-opacity":.65,"selection-box-border-color":"#aaa","selection-box-border-width":1,"active-bg-color":"black","active-bg-opacity":.15,"active-bg-size":30,"outside-texture-bg-color":"#000","outside-texture-bg-opacity":.125,events:"yes","text-events":"no","text-valign":"top","text-halign":"center","text-justification":"auto","line-height":1,color:"#000","box-selection":"contain","text-outline-color":"#000","text-outline-width":0,"text-outline-opacity":1,"text-opacity":1,"text-decoration":"none","text-transform":"none","text-wrap":"none","text-overflow-wrap":"whitespace","text-max-width":9999,"text-background-color":"#000","text-background-opacity":0,"text-background-shape":"rectangle","text-background-padding":0,"text-border-opacity":0,"text-border-width":0,"text-border-style":"solid","text-border-color":"#000","font-family":"Helvetica Neue, Helvetica, sans-serif","font-style":"normal","font-weight":"normal","font-size":16,"min-zoomed-font-size":0,"text-rotation":"none","source-text-rotation":"none","target-text-rotation":"none",visibility:"visible",display:"element",opacity:1,"z-compound-depth":"auto","z-index-compare":"auto","z-index":0,label:"","text-margin-x":0,"text-margin-y":0,"source-label":"","source-text-offset":0,"source-text-margin-x":0,"source-text-margin-y":0,"target-label":"","target-text-offset":0,"target-text-margin-x":0,"target-text-margin-y":0,"overlay-opacity":0,"overlay-color":"#000","overlay-padding":10,"overlay-shape":"round-rectangle","overlay-corner-radius":"auto","underlay-opacity":0,"underlay-color":"#000","underlay-padding":10,"underlay-shape":"round-rectangle","underlay-corner-radius":"auto","transition-property":"none","transition-duration":0,"transition-delay":0,"transition-timing-function":"linear","box-select-labels":"no","background-blacken":0,"background-color":"#999","background-fill":"solid","background-opacity":1,"background-image":"none","background-image-crossorigin":"anonymous","background-image-opacity":1,"background-image-containment":"inside","background-image-smoothing":"yes","background-position-x":"50%","background-position-y":"50%","background-offset-x":0,"background-offset-y":0,"background-width-relative-to":"include-padding","background-height-relative-to":"include-padding","background-repeat":"no-repeat","background-fit":"none","background-clip":"node","background-width":"auto","background-height":"auto","border-color":"#000","border-opacity":1,"border-width":0,"border-style":"solid","border-dash-pattern":[4,2],"border-dash-offset":0,"border-cap":"butt","border-join":"miter","border-position":"center","outline-color":"#999","outline-opacity":1,"outline-width":0,"outline-offset":0,"outline-style":"solid",height:30,width:30,shape:"ellipse","shape-polygon-points":"-1, -1, 1, -1, 1, 1, -1, 1","corner-radius":"auto","bounds-expansion":0,"background-gradient-direction":"to-bottom","background-gradient-stop-colors":"#999","background-gradient-stop-positions":"0%",ghost:"no","ghost-offset-y":0,"ghost-offset-x":0,"ghost-opacity":0,padding:0,"padding-relative-to":"width",position:"origin","compound-sizing-wrt-labels":"include","min-width":0,"min-width-bias-left":0,"min-width-bias-right":0,"min-height":0,"min-height-bias-top":0,"min-height-bias-bottom":0},{"pie-size":"100%","pie-hole":0,"pie-start-angle":"0deg"},[{name:"pie-{{i}}-background-color",value:"black"},{name:"pie-{{i}}-background-size",value:"0%"},{name:"pie-{{i}}-background-opacity",value:1}].reduce(function(d,f){for(var h=1;h<=gr.pieBackgroundN;h++){var p=f.name.replace("{{i}}",h),m=f.value;d[p]=m}return d},{}),{"stripe-size":"100%","stripe-direction":"horizontal"},[{name:"stripe-{{i}}-background-color",value:"black"},{name:"stripe-{{i}}-background-size",value:"0%"},{name:"stripe-{{i}}-background-opacity",value:1}].reduce(function(d,f){for(var h=1;h<=gr.stripeBackgroundN;h++){var p=f.name.replace("{{i}}",h),m=f.value;d[p]=m}return d},{}),{"line-style":"solid","line-color":"#999","line-fill":"solid","line-cap":"butt","line-opacity":1,"line-outline-width":0,"line-outline-color":"#000","line-gradient-stop-colors":"#999","line-gradient-stop-positions":"0%","control-point-step-size":40,"control-point-weights":.5,"segment-weights":.5,"segment-distances":20,"segment-radii":15,"radius-type":"arc-radius","taxi-turn":"50%","taxi-radius":15,"taxi-turn-min-distance":10,"taxi-direction":"auto","edge-distances":"intersection","curve-style":"haystack","haystack-radius":0,"arrow-scale":1,"loop-direction":"-45deg","loop-sweep":"-90deg","source-distance-from-node":0,"target-distance-from-node":0,"source-endpoint":"outside-to-node","target-endpoint":"outside-to-node","line-dash-pattern":[6,3],"line-dash-offset":0},[{name:"arrow-shape",value:"none"},{name:"arrow-color",value:"#999"},{name:"arrow-fill",value:"filled"},{name:"arrow-width",value:1}].reduce(function(d,f){return gr.arrowPrefixes.forEach(function(h){var p=h+"-"+f.name,m=f.value;d[p]=m}),d},{})),r={},a=0;a<this.properties.length;a++){var i=this.properties[a];if(!i.pointsTo){var s=i.name,o=e[s],u=this.parse(s,o);r[s]=u}}return t.defaultProperties=r,t.defaultProperties};gr.addDefaultStylesheet=function(){this.selector(":parent").css({shape:"rectangle",padding:10,"background-color":"#eee","border-color":"#ccc","border-width":1}).selector("edge").css({width:3}).selector(":loop").css({"curve-style":"bezier"}).selector("edge:compound").css({"curve-style":"bezier","source-endpoint":"outside-to-line","target-endpoint":"outside-to-line"}).selector(":selected").css({"background-color":"#0169D9","line-color":"#0169D9","source-arrow-color":"#0169D9","target-arrow-color":"#0169D9","mid-source-arrow-color":"#0169D9","mid-target-arrow-color":"#0169D9"}).selector(":parent:selected").css({"background-color":"#CCE1F9","border-color":"#aec8e5"}).selector(":active").css({"overlay-color":"black","overlay-padding":10,"overlay-opacity":.25}),this.defaultLength=this.length};var yh={};yh.parse=function(t,e,r,a){var i=this;if(Wt(e))return i.parseImplWarn(t,e,r,a);var s=a==="mapping"||a===!0||a===!1||a==null?"dontcare":a,o=r?"t":"f",u=""+e,d=oC(t,u,o,s),f=i.propCache=i.propCache||[],h;return(h=f[d])||(h=f[d]=i.parseImplWarn(t,e,r,a)),(r||a==="mapping")&&(h=Sn(h),h&&(h.value=Sn(h.value))),h};yh.parseImplWarn=function(t,e,r,a){var i=this.parseImpl(t,e,r,a);return!i&&e!=null&&At("The style property `".concat(t,": ").concat(e,"` is invalid")),i&&(i.name==="width"||i.name==="height")&&e==="label"&&At("The style value of `label` is deprecated for `"+i.name+"`"),i};yh.parseImpl=function(t,e,r,a){var i=this;t=Vm(t);var s=i.properties[t],o=e,u=i.types;if(!s||e===void 0)return null;s.alias&&(s=s.pointsTo,t=s.name);var d=Xe(e);d&&(e=e.trim());var f=s.type;if(!f)return null;if(r&&(e===""||e===null))return{name:t,value:e,bypass:!0,deleteBypass:!0};if(Wt(e))return{name:t,value:e,strValue:"fn",mapped:u.fn,bypass:r};var h,p;if(!(!d||a||e.length<7||e[1]!=="a")){if(e.length>=7&&e[0]==="d"&&(h=new RegExp(u.data.regex).exec(e))){if(r)return!1;var m=u.data;return{name:t,value:h,strValue:""+e,mapped:m,field:h[1],bypass:r}}else if(e.length>=10&&e[0]==="m"&&(p=new RegExp(u.mapData.regex).exec(e))){if(r||f.multiple)return!1;var y=u.mapData;if(!(f.color||f.number))return!1;var x=this.parse(t,p[4]);if(!x||x.mapped)return!1;var E=this.parse(t,p[5]);if(!E||E.mapped)return!1;if(x.pfValue===E.pfValue||x.strValue===E.strValue)return At("`"+t+": "+e+"` is not a valid mapper because the output range is zero; converting to `"+t+": "+x.strValue+"`"),this.parse(t,x.strValue);if(f.color){var w=x.value,T=E.value,C=w[0]===T[0]&&w[1]===T[1]&&w[2]===T[2]&&(w[3]===T[3]||(w[3]==null||w[3]===1)&&(T[3]==null||T[3]===1));if(C)return!1}return{name:t,value:p,strValue:""+e,mapped:y,field:p[1],fieldMin:parseFloat(p[2]),fieldMax:parseFloat(p[3]),valueMin:x.value,valueMax:E.value,bypass:r}}}if(f.multiple&&a!=="multiple"){var N;if(d?N=e.split(/\s+/):_t(e)?N=e:N=[e],f.evenMultiple&&N.length%2!==0)return null;for(var A=[],D=[],M=[],j="",k=!1,B=0;B<N.length;B++){var P=i.parse(t,N[B],r,"multiple");k=k||Xe(P.value),A.push(P.value),M.push(P.pfValue!=null?P.pfValue:P.value),D.push(P.units),j+=(B>0?" ":"")+P.strValue}return f.validate&&!f.validate(A,D)?null:f.singleEnum&&k?A.length===1&&Xe(A[0])?{name:t,value:A[0],strValue:A[0],bypass:r}:null:{name:t,value:A,pfValue:M,strValue:j,bypass:r,units:D}}var U=function(){for(var oe=0;oe<f.enums.length;oe++){var ae=f.enums[oe];if(ae===e)return{name:t,value:e,strValue:""+e,bypass:r}}return null};if(f.number){var R,V="px";if(f.units&&(R=f.units),f.implicitUnits&&(V=f.implicitUnits),!f.unitless)if(d){var _="px|em"+(f.allowPercent?"|\\%":"");R&&(_=R);var H=e.match("^("+Sr+")("+_+")?$");H&&(e=H[1],R=H[2]||V)}else(!R||f.implicitUnits)&&(R=V);if(e=parseFloat(e),isNaN(e)&&f.enums===void 0)return null;if(isNaN(e)&&f.enums!==void 0)return e=o,U();if(f.integer&&!yD(e)||f.min!==void 0&&(e<f.min||f.strictMin&&e===f.min)||f.max!==void 0&&(e>f.max||f.strictMax&&e===f.max))return null;var z={name:t,value:e,strValue:""+e+(R||""),units:R,bypass:r};return f.unitless||R!=="px"&&R!=="em"?z.pfValue=e:z.pfValue=R==="px"||!R?e:this.getEmSizeInPixels()*e,(R==="ms"||R==="s")&&(z.pfValue=R==="ms"?e:1e3*e),(R==="deg"||R==="rad")&&(z.pfValue=R==="rad"?e:AO(e)),R==="%"&&(z.pfValue=e/100),z}else if(f.propList){var I=[],F=""+e;if(F!=="none"){for(var K=F.split(/\s*,\s*|\s+/),J=0;J<K.length;J++){var L=K[J].trim();i.properties[L]?I.push(L):At("`"+L+"` is not a valid property name")}if(I.length===0)return null}return{name:t,value:I,strValue:I.length===0?"none":I.join(" "),bypass:r}}else if(f.color){var Q=tC(e);return Q?{name:t,value:Q,pfValue:Q,strValue:"rgb("+Q[0]+","+Q[1]+","+Q[2]+")",bypass:r}:null}else if(f.regex||f.regexes){if(f.enums){var X=U();if(X)return X}for(var W=f.regexes?f.regexes:[f.regex],te=0;te<W.length;te++){var Y=new RegExp(W[te]),ne=Y.exec(e);if(ne)return{name:t,value:f.singleRegexMatchValue?ne[1]:ne,strValue:""+e,bypass:r}}return null}else return f.string?{name:t,value:""+e,strValue:""+e,bypass:r}:f.enums?U():null};var Rr=function(e){if(!(this instanceof Rr))return new Rr(e);if(!Im(e)){$t("A style must have a core reference");return}this._private={cy:e,coreStyle:{}},this.length=0,this.resetToDefault()},Zr=Rr.prototype;Zr.instanceString=function(){return"style"};Zr.clear=function(){for(var t=this._private,e=t.cy,r=e.elements(),a=0;a<this.length;a++)this[a]=void 0;return this.length=0,t.contextStyles={},t.propDiffs={},this.cleanElements(r,!0),r.forEach(function(i){var s=i[0]._private;s.styleDirty=!0,s.appliedInitStyle=!1}),this};Zr.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this};Zr.core=function(t){return this._private.coreStyle[t]||this.getDefaultProperty(t)};Zr.selector=function(t){var e=t==="core"?null:new is(t),r=this.length++;return this[r]={selector:e,properties:[],mappedProperties:[],index:r},this};Zr.css=function(){var t=this,e=arguments;if(e.length===1)for(var r=e[0],a=0;a<t.properties.length;a++){var i=t.properties[a],s=r[i.name];s===void 0&&(s=r[nh(i.name)]),s!==void 0&&this.cssRule(i.name,s)}else e.length===2&&this.cssRule(e[0],e[1]);return this};Zr.style=Zr.css;Zr.cssRule=function(t,e){var r=this.parse(t,e);if(r){var a=this.length-1;this[a].properties.push(r),this[a].properties[r.name]=r,r.name.match(/pie-(\d+)-background-size/)&&r.value&&(this._private.hasPie=!0),r.name.match(/stripe-(\d+)-background-size/)&&r.value&&(this._private.hasStripe=!0),r.mapped&&this[a].mappedProperties.push(r);var i=!this[a].selector;i&&(this._private.coreStyle[r.name]=r)}return this};Zr.append=function(t){return WT(t)?t.appendToStyle(this):_t(t)?this.appendFromJson(t):Xe(t)&&this.appendFromString(t),this};Rr.fromJson=function(t,e){var r=new Rr(t);return r.fromJson(e),r};Rr.fromString=function(t,e){return new Rr(t).fromString(e)};[Br,Dc,ay,En,mh,ny,gr,yh].forEach(function(t){tt(Zr,t)});Rr.types=Zr.types;Rr.properties=Zr.properties;Rr.propertyGroups=Zr.propertyGroups;Rr.propertyGroupNames=Zr.propertyGroupNames;Rr.propertyGroupKeys=Zr.propertyGroupKeys;var OB={style:function(e){if(e){var r=this.setStyle(e);r.update()}return this._private.style},setStyle:function(e){var r=this._private;return WT(e)?r.style=e.generateStyle(this):_t(e)?r.style=Rr.fromJson(this,e):Xe(e)?r.style=Rr.fromString(this,e):r.style=Rr(this),r.style},updateStyle:function(){this.mutableElements().updateStyle()}},RB="single",tl={autolock:function(e){if(e!==void 0)this._private.autolock=!!e;else return this._private.autolock;return this},autoungrabify:function(e){if(e!==void 0)this._private.autoungrabify=!!e;else return this._private.autoungrabify;return this},autounselectify:function(e){if(e!==void 0)this._private.autounselectify=!!e;else return this._private.autounselectify;return this},selectionType:function(e){var r=this._private;if(r.selectionType==null&&(r.selectionType=RB),e!==void 0)(e==="additive"||e==="single")&&(r.selectionType=e);else return r.selectionType;return this},panningEnabled:function(e){if(e!==void 0)this._private.panningEnabled=!!e;else return this._private.panningEnabled;return this},userPanningEnabled:function(e){if(e!==void 0)this._private.userPanningEnabled=!!e;else return this._private.userPanningEnabled;return this},zoomingEnabled:function(e){if(e!==void 0)this._private.zoomingEnabled=!!e;else return this._private.zoomingEnabled;return this},userZoomingEnabled:function(e){if(e!==void 0)this._private.userZoomingEnabled=!!e;else return this._private.userZoomingEnabled;return this},boxSelectionEnabled:function(e){if(e!==void 0)this._private.boxSelectionEnabled=!!e;else return this._private.boxSelectionEnabled;return this},pan:function(){var e=arguments,r=this._private.pan,a,i,s,o,u;switch(e.length){case 0:return r;case 1:if(Xe(e[0]))return a=e[0],r[a];if(wt(e[0])){if(!this._private.panningEnabled)return this;s=e[0],o=s.x,u=s.y,De(o)&&(r.x=o),De(u)&&(r.y=u),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;a=e[0],i=e[1],(a==="x"||a==="y")&&De(i)&&(r[a]=i),this.emit("pan viewport");break}return this.notify("viewport"),this},panBy:function(e,r){var a=arguments,i=this._private.pan,s,o,u,d,f;if(!this._private.panningEnabled)return this;switch(a.length){case 1:wt(e)&&(u=a[0],d=u.x,f=u.y,De(d)&&(i.x+=d),De(f)&&(i.y+=f),this.emit("pan viewport"));break;case 2:s=e,o=r,(s==="x"||s==="y")&&De(o)&&(i[s]+=o),this.emit("pan viewport");break}return this.notify("viewport"),this},gc:function(){this.notify("gc")},fit:function(e,r){var a=this.getFitViewport(e,r);if(a){var i=this._private;i.zoom=a.zoom,i.pan=a.pan,this.emit("pan zoom viewport"),this.notify("viewport")}return this},getFitViewport:function(e,r){if(De(e)&&r===void 0&&(r=e,e=void 0),!(!this._private.panningEnabled||!this._private.zoomingEnabled)){var a;if(Xe(e)){var i=e;e=this.$(i)}else if(wD(e)){var s=e;a={x1:s.x1,y1:s.y1,x2:s.x2,y2:s.y2},a.w=a.x2-a.x1,a.h=a.y2-a.y1}else Da(e)||(e=this.mutableElements());if(!(Da(e)&&e.empty())){a=a||e.boundingBox();var o=this.width(),u=this.height(),d;if(r=De(r)?r:0,!isNaN(o)&&!isNaN(u)&&o>0&&u>0&&!isNaN(a.w)&&!isNaN(a.h)&&a.w>0&&a.h>0){d=Math.min((o-2*r)/a.w,(u-2*r)/a.h),d=d>this._private.maxZoom?this._private.maxZoom:d,d=d<this._private.minZoom?this._private.minZoom:d;var f={x:(o-d*(a.x1+a.x2))/2,y:(u-d*(a.y1+a.y2))/2};return{zoom:d,pan:f}}}}},zoomRange:function(e,r){var a=this._private;if(r==null){var i=e;e=i.min,r=i.max}return De(e)&&De(r)&&e<=r?(a.minZoom=e,a.maxZoom=r):De(e)&&r===void 0&&e<=a.maxZoom?a.minZoom=e:De(r)&&e===void 0&&r>=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,s,o,u=!1;if(r.zoomingEnabled||(u=!0),De(e)?o=e:wt(e)&&(o=e.level,e.position!=null?s=lh(e.position,i,a):e.renderedPosition!=null&&(s=e.renderedPosition),s!=null&&!r.panningEnabled&&(u=!0)),o=o>r.maxZoom?r.maxZoom:o,o=o<r.minZoom?r.minZoom:o,u||!De(o)||o===i||s!=null&&(!De(s.x)||!De(s.y)))return null;if(s!=null){var d=a,f=i,h=o,p={x:-h/f*(s.x-d.x)+s.x,y:-h/f*(s.y-d.y)+s.y};return{zoomed:!0,panned:!0,zoom:h,pan:p}}else return{zoomed:!0,panned:!1,zoom:o,pan:a}},zoom:function(e){if(e===void 0)return this._private.zoom;var r=this.getZoomedViewport(e),a=this._private;return r==null||!r.zoomed?this:(a.zoom=r.zoom,r.panned&&(a.pan.x=r.pan.x,a.pan.y=r.pan.y),this.emit("zoom"+(r.panned?" pan":"")+" viewport"),this.notify("viewport"),this)},viewport:function(e){var r=this._private,a=!0,i=!0,s=[],o=!1,u=!1;if(!e)return this;if(De(e.zoom)||(a=!1),wt(e.pan)||(i=!1),!a&&!i)return this;if(a){var d=e.zoom;d<r.minZoom||d>r.maxZoom||!r.zoomingEnabled?o=!0:(r.zoom=d,s.push("zoom"))}if(i&&(!o||!e.cancelOnFailedZoom)&&r.panningEnabled){var f=e.pan;De(f.x)&&(r.pan.x=f.x,u=!1),De(f.y)&&(r.pan.y=f.y,u=!1),u||s.push("pan")}return s.length>0&&(s.push("viewport"),this.emit(s.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(Xe(e)){var a=e;e=this.mutableElements().filter(a)}else Da(e)||(e=this.mutableElements());if(e.length!==0){var i=e.boundingBox(),s=this.width(),o=this.height();r=r===void 0?this._private.zoom:r;var u={x:(s-r*(i.x1+i.x2))/2,y:(o-r*(i.y1+i.y2))/2};return u}}},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),s=function(u){return parseFloat(i.getPropertyValue(u))};return{width:r.clientWidth-s("padding-left")-s("padding-right"),height:r.clientHeight-s("padding-top")-s("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}};tl.centre=tl.center;tl.autolockNodes=tl.autolock;tl.autoungrabifyNodes=tl.autoungrabify;var ic={data:jt.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:jt.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:jt.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:jt.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};ic.attr=ic.data;ic.removeAttr=ic.removeData;var sc=function(e){var r=this;e=tt({},e);var a=e.container;a&&!zf(a)&&zf(a[0])&&(a=a[0]);var i=a?a._cyreg:null;i=i||{},i&&i.cy&&(i.cy.destroy(),i={});var s=i.readies=i.readies||[];a&&(a._cyreg=i),i.cy=r;var o=wr!==void 0&&a!==void 0&&!e.headless,u=e;u.layout=tt({name:o?"grid":"null"},u.layout),u.renderer=tt({name:o?"canvas":"null"},u.renderer);var d=function(x,E,w){return E!==void 0?E:w!==void 0?w:x},f=this._private={container:a,ready:!1,options:u,elements:new Ir(this),listeners:[],aniEles:new Ir(this),data:u.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:d(!0,u.zoomingEnabled),userZoomingEnabled:d(!0,u.userZoomingEnabled),panningEnabled:d(!0,u.panningEnabled),userPanningEnabled:d(!0,u.userPanningEnabled),boxSelectionEnabled:d(!0,u.boxSelectionEnabled),autolock:d(!1,u.autolock,u.autolockNodes),autoungrabify:d(!1,u.autoungrabify,u.autoungrabifyNodes),autounselectify:d(!1,u.autounselectify),styleEnabled:u.styleEnabled===void 0?o:u.styleEnabled,zoom:De(u.zoom)?u.zoom:1,pan:{x:wt(u.pan)&&De(u.pan.x)?u.pan.x:0,y:wt(u.pan)&&De(u.pan.y)?u.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:d(250,u.multiClickDebounceTime)};this.createEmitter(),this.selectionType(u.selectionType),this.zoomRange({min:u.minZoom,max:u.maxZoom});var h=function(x,E){var w=x.some(SD);if(w)return Lo.all(x).then(E);E(x)};f.styleEnabled&&r.setStyle([]);var p=tt({},u,u.renderer);r.initRenderer(p);var m=function(x,E,w){r.notifications(!1);var T=r.mutableElements();T.length>0&&T.remove(),x!=null&&(wt(x)||_t(x))&&r.add(x),r.one("layoutready",function(N){r.notifications(!0),r.emit(N),r.one("load",E),r.emitAndNotify("load")}).one("layoutstop",function(){r.one("done",w),r.emit("done")});var C=tt({},r._private.options.layout);C.eles=r.elements(),r.layout(C).run()};h([u.style,u.elements],function(y){var x=y[0],E=y[1];f.styleEnabled&&r.style().append(x),m(E,function(){r.startAnimationLoop(),f.ready=!0,Wt(u.ready)&&r.on("ready",u.ready);for(var w=0;w<s.length;w++){var T=s[w];r.on("ready",T)}i&&(i.readies=[]),r.emit("ready")},u.done)})},Hf=sc.prototype;tt(Hf,{instanceString:function(){return"core"},isReady:function(){return this._private.ready},destroyed:function(){return this._private.destroyed},ready:function(e){return this.isReady()?this.emitter().emit("ready",[],e):this.on("ready",e),this},destroy:function(){var e=this;if(!e.destroyed())return e.stopAnimationLoop(),e.destroyRenderer(),this.emit("destroy"),e._private.destroyed=!0,e},hasElementWithId:function(e){return this._private.elements.hasElementWithId(e)},getElementById:function(e){return this._private.elements.getElementById(e)},hasCompoundNodes:function(){return this._private.hasCompoundNodes},headless:function(){return this._private.renderer.isHeadless()},styleEnabled:function(){return this._private.styleEnabled},addToPool:function(e){return this._private.elements.merge(e),this},removeFromPool:function(e){return this._private.elements.unmerge(e),this},container:function(){return this._private.container||null},window:function(){var e=this._private.container;if(e==null)return wr;var r=this._private.container.ownerDocument;return r===void 0||r==null?wr:r.defaultView||wr},mount:function(e){if(e!=null){var r=this,a=r._private,i=a.options;return!zf(e)&&zf(e[0])&&(e=e[0]),r.stopAnimationLoop(),r.destroyRenderer(),a.container=e,a.styleEnabled=!0,r.invalidateSize(),r.initRenderer(tt({},i,i.renderer,{name:i.renderer.name==="null"?"canvas":i.renderer.name})),r.startAnimationLoop(),r.style(i.style),r.emit("mount"),r}},unmount:function(){var e=this;return e.stopAnimationLoop(),e.destroyRenderer(),e.initRenderer({name:"null"}),e.emit("unmount"),e},options:function(){return Sn(this._private.options)},json:function(e){var r=this,a=r._private,i=r.mutableElements(),s=function(A){return r.getElementById(A.id())};if(wt(e)){if(r.startBatch(),e.elements){var o={},u=function(A,D){for(var M=[],j=[],k=0;k<A.length;k++){var B=A[k];if(!B.data.id){At("cy.json() cannot handle elements without an ID attribute");continue}var P=""+B.data.id,U=r.getElementById(P);o[P]=!0,U.length!==0?j.push({ele:U,json:B}):(D&&(B.group=D),M.push(B))}r.add(M);for(var R=0;R<j.length;R++){var V=j[R],_=V.ele,H=V.json;_.json(H)}};if(_t(e.elements))u(e.elements);else for(var d=["nodes","edges"],f=0;f<d.length;f++){var h=d[f],p=e.elements[h];_t(p)&&u(p,h)}var m=r.collection();i.filter(function(N){return!o[N.id()]}).forEach(function(N){N.isParent()?m.merge(N):N.remove()}),m.forEach(function(N){return N.children().move({parent:null})}),m.forEach(function(N){return s(N).remove()})}e.style&&r.style(e.style),e.zoom!=null&&e.zoom!==a.zoom&&r.zoom(e.zoom),e.pan&&(e.pan.x!==a.pan.x||e.pan.y!==a.pan.y)&&r.pan(e.pan),e.data&&r.data(e.data);for(var y=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],x=0;x<y.length;x++){var E=y[x];e[E]!=null&&r[E](e[E])}return r.endBatch(),this}else{var w=!!e,T={};w?T.elements=this.elements().map(function(N){return N.json()}):(T.elements={},i.forEach(function(N){var A=N.group();T.elements[A]||(T.elements[A]=[]),T.elements[A].push(N.json())})),this._private.styleEnabled&&(T.style=r.style().json()),T.data=Sn(r.data());var C=a.options;return T.zoomingEnabled=a.zoomingEnabled,T.userZoomingEnabled=a.userZoomingEnabled,T.zoom=a.zoom,T.minZoom=a.minZoom,T.maxZoom=a.maxZoom,T.panningEnabled=a.panningEnabled,T.userPanningEnabled=a.userPanningEnabled,T.pan=Sn(a.pan),T.boxSelectionEnabled=a.boxSelectionEnabled,T.renderer=Sn(C.renderer),T.hideEdgesOnViewport=C.hideEdgesOnViewport,T.textureOnViewport=C.textureOnViewport,T.wheelSensitivity=C.wheelSensitivity,T.motionBlur=C.motionBlur,T.multiClickDebounceTime=C.multiClickDebounceTime,T}}});Hf.$id=Hf.getElementById;[SB,jB,WC,im,Nf,MB,sm,jf,OB,tl,ic].forEach(function(t){tt(Hf,t)});var BB={fit:!0,directed:!1,direction:"downward",padding:30,circle:!1,grid:!1,spacingFactor:1.75,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,roots:void 0,depthSort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}},LB={maximal:!1,acyclic:!1},Xl=function(e){return e.scratch("breadthfirst")},VS=function(e,r){return e.scratch("breadthfirst",r)};function JC(t){this.options=tt({},BB,LB,t)}JC.prototype.run=function(){var t=this.options,e=t.cy,r=t.eles,a=r.nodes().filter(function(Oe){return Oe.isChildless()}),i=r,s=t.directed,o=t.acyclic||t.maximal||t.maximalAdjustments>0,u=!!t.boundingBox,d=na(u?t.boundingBox:structuredClone(e.extent())),f;if(Da(t.roots))f=t.roots;else if(_t(t.roots)){for(var h=[],p=0;p<t.roots.length;p++){var m=t.roots[p],y=e.getElementById(m);h.push(y)}f=e.collection(h)}else if(Xe(t.roots))f=e.$(t.roots);else if(s)f=a.roots();else{var x=r.components();f=e.collection();for(var E=function(){var ke=x[w],Pe=ke.maxDegree(!1),Ge=ke.filter(function(Je){return Je.degree(!1)===Pe});f=f.add(Ge)},w=0;w<x.length;w++)E()}var T=[],C={},N=function(ke,Pe){T[Pe]==null&&(T[Pe]=[]);var Ge=T[Pe].length;T[Pe].push(ke),VS(ke,{index:Ge,depth:Pe})},A=function(ke,Pe){var Ge=Xl(ke),Je=Ge.depth,Be=Ge.index;T[Je][Be]=null,ke.isChildless()&&N(ke,Pe)};i.bfs({roots:f,directed:t.directed,visit:function(ke,Pe,Ge,Je,Be){var nt=ke[0],ye=nt.id();nt.isChildless()&&N(nt,Be),C[ye]=!0}});for(var D=[],M=0;M<a.length;M++){var j=a[M];C[j.id()]||D.push(j)}var k=function(ke){for(var Pe=T[ke],Ge=0;Ge<Pe.length;Ge++){var Je=Pe[Ge];if(Je==null){Pe.splice(Ge,1),Ge--;continue}VS(Je,{depth:ke,index:Ge})}},B=function(ke,Pe){for(var Ge=Xl(ke),Je=ke.incomers().filter(function(ze){return ze.isNode()&&r.has(ze)}),Be=-1,nt=ke.id(),ye=0;ye<Je.length;ye++){var $e=Je[ye],et=Xl($e);Be=Math.max(Be,et.depth)}if(Ge.depth<=Be){if(!t.acyclic&&Pe[nt])return null;var xe=Be+1;return A(ke,xe),Pe[nt]=xe,!0}return!1};if(s&&o){var P=[],U={},R=function(ke){return P.push(ke)},V=function(){return P.shift()};for(a.forEach(function(Oe){return P.push(Oe)});P.length>0;){var _=V(),H=B(_,U);if(H)_.outgoers().filter(function(Oe){return Oe.isNode()&&r.has(Oe)}).forEach(R);else if(H===null){At("Detected double maximal shift for node `"+_.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var z=0;if(t.avoidOverlap)for(var I=0;I<a.length;I++){var F=a[I],K=F.layoutDimensions(t),J=K.w,L=K.h;z=Math.max(z,J,L)}var Q={},X=function(ke){if(Q[ke.id()])return Q[ke.id()];for(var Pe=Xl(ke).depth,Ge=ke.neighborhood(),Je=0,Be=0,nt=0;nt<Ge.length;nt++){var ye=Ge[nt];if(!(ye.isEdge()||ye.isParent()||!a.has(ye))){var $e=Xl(ye);if($e!=null){var et=$e.index,xe=$e.depth;if(!(et==null||xe==null)){var ze=T[xe].length;xe<Pe&&(Je+=et/ze,Be++)}}}}return Be=Math.max(1,Be),Je=Je/Be,Be===0&&(Je=0),Q[ke.id()]=Je,Je},W=function(ke,Pe){var Ge=X(ke),Je=X(Pe),Be=Ge-Je;return Be===0?eC(ke.id(),Pe.id()):Be};t.depthSort!==void 0&&(W=t.depthSort);for(var te=T.length,Y=0;Y<te;Y++)T[Y].sort(W),k(Y);for(var ne=[],he=0;he<D.length;he++)ne.push(D[he]);var oe=function(){for(var ke=0;ke<te;ke++)k(ke)};ne.length&&(T.unshift(ne),te=T.length,oe());for(var ae=0,re=0;re<te;re++)ae=Math.max(T[re].length,ae);var le={x:d.x1+d.w/2,y:d.y1+d.h/2},se=a.reduce(function(Oe,ke){return(function(Pe){return{w:Oe.w===-1?Pe.w:(Oe.w+Pe.w)/2,h:Oe.h===-1?Pe.h:(Oe.h+Pe.h)/2}})(ke.boundingBox({includeLabels:t.nodeDimensionsIncludeLabels}))},{w:-1,h:-1}),Ne=Math.max(te===1?0:u?(d.h-t.padding*2-se.h)/(te-1):(d.h-t.padding*2-se.h)/(te+1),z),Ae=T.reduce(function(Oe,ke){return Math.max(Oe,ke.length)},0),Ze=function(ke){var Pe=Xl(ke),Ge=Pe.depth,Je=Pe.index;if(t.circle){var Be=Math.min(d.w/2/te,d.h/2/te);Be=Math.max(Be,z);var nt=Be*Ge+Be-(te>0&&T[0].length<=3?Be/2:0),ye=2*Math.PI/T[Ge].length*Je;return Ge===0&&T[0].length===1&&(nt=1),{x:le.x+nt*Math.cos(ye),y:le.y+nt*Math.sin(ye)}}else{var $e=T[Ge].length,et=Math.max($e===1?0:u?(d.w-t.padding*2-se.w)/((t.grid?Ae:$e)-1):(d.w-t.padding*2-se.w)/((t.grid?Ae:$e)+1),z),xe={x:le.x+(Je+1-($e+1)/2)*et,y:le.y+(Ge+1-(te+1)/2)*Ne};return xe}},Qe={downward:0,leftward:90,upward:180,rightward:-90};Object.keys(Qe).indexOf(t.direction)===-1&&$t("Invalid direction '".concat(t.direction,"' specified for breadthfirst layout. Valid values are: ").concat(Object.keys(Qe).join(", ")));var Se=function(ke){return ZD(Ze(ke),d,Qe[t.direction])};return r.nodes().layoutPositions(this,t,Se),this};var PB={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 eN(t){this.options=tt({},PB,t)}eN.prototype.run=function(){var t=this.options,e=t,r=t.cy,a=e.eles,i=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,s=a.nodes().not(":parent");e.sort&&(s=s.sort(e.sort));for(var o=na(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),u={x:o.x1+o.w/2,y:o.y1+o.h/2},d=e.sweep===void 0?2*Math.PI-2*Math.PI/s.length:e.sweep,f=d/Math.max(1,s.length-1),h,p=0,m=0;m<s.length;m++){var y=s[m],x=y.layoutDimensions(e),E=x.w,w=x.h;p=Math.max(p,E,w)}if(De(e.radius)?h=e.radius:s.length<=1?h=0:h=Math.min(o.h,o.w)/2-p,s.length>1&&e.avoidOverlap){p*=1.75;var T=Math.cos(f)-Math.cos(0),C=Math.sin(f)-Math.sin(0),N=Math.sqrt(p*p/(T*T+C*C));h=Math.max(N,h)}var A=function(M,j){var k=e.startAngle+j*f*(i?1:-1),B=h*Math.cos(k),P=h*Math.sin(k),U={x:u.x+B,y:u.y+P};return U};return a.nodes().layoutPositions(this,e,A),this};var zB={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 tN(t){this.options=tt({},zB,t)}tN.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,s=i.nodes().not(":parent"),o=na(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:a.width(),h:a.height()}),u={x:o.x1+o.w/2,y:o.y1+o.h/2},d=[],f=0,h=0;h<s.length;h++){var p=s[h],m=void 0;m=e.concentric(p),d.push({value:m,node:p}),p._private.scratch.concentric=m}s.updateStyle();for(var y=0;y<s.length;y++){var x=s[y],E=x.layoutDimensions(e);f=Math.max(f,E.w,E.h)}d.sort(function(Ne,Ae){return Ae.value-Ne.value});for(var w=e.levelWidth(s),T=[[]],C=T[0],N=0;N<d.length;N++){var A=d[N];if(C.length>0){var D=Math.abs(C[0].value-A.value);D>=w&&(C=[],T.push(C))}C.push(A)}var M=f+e.minNodeSpacing;if(!e.avoidOverlap){var j=T.length>0&&T[0].length>1,k=Math.min(o.w,o.h)/2-M,B=k/(T.length+j?1:0);M=Math.min(M,B)}for(var P=0,U=0;U<T.length;U++){var R=T[U],V=e.sweep===void 0?2*Math.PI-2*Math.PI/R.length:e.sweep,_=R.dTheta=V/Math.max(1,R.length-1);if(R.length>1&&e.avoidOverlap){var H=Math.cos(_)-Math.cos(0),z=Math.sin(_)-Math.sin(0),I=Math.sqrt(M*M/(H*H+z*z));P=Math.max(I,P)}R.r=P,P+=M}if(e.equidistant){for(var F=0,K=0,J=0;J<T.length;J++){var L=T[J],Q=L.r-K;F=Math.max(F,Q)}K=0;for(var X=0;X<T.length;X++){var W=T[X];X===0&&(K=W.r),W.r=K,K+=F}}for(var te={},Y=0;Y<T.length;Y++)for(var ne=T[Y],he=ne.dTheta,oe=ne.r,ae=0;ae<ne.length;ae++){var re=ne[ae],le=e.startAngle+(r?1:-1)*he*ae,se={x:u.x+oe*Math.cos(le),y:u.y+oe*Math.sin(le)};te[re.node.id()]=se}return i.nodes().layoutPositions(this,e,function(Ne){var Ae=Ne.id();return te[Ae]}),this};var dg,_B={ready:function(){},stop:function(){},animate:!0,animationEasing:void 0,animationDuration:void 0,animateFilter:function(e,r){return!0},animationThreshold:250,refresh:20,fit:!0,padding:30,boundingBox:void 0,nodeDimensionsIncludeLabels:!1,randomize:!1,componentSpacing:40,nodeRepulsion:function(e){return 2048},nodeOverlap:4,idealEdgeLength:function(e){return 32},edgeElasticity:function(e){return 32},nestingFactor:1.2,gravity:1,numIter:1e3,initialTemp:1e3,coolingFactor:.99,minTemp:1};function xh(t){this.options=tt({},_B,t),this.options.layout=this;var e=this.options.eles.nodes(),r=this.options.eles.edges(),a=r.filter(function(i){var s=i.source().data("id"),o=i.target().data("id"),u=e.some(function(f){return f.data("id")===s}),d=e.some(function(f){return f.data("id")===o});return!u||!d});this.options.eles=this.options.eles.not(a)}xh.prototype.run=function(){var t=this.options,e=t.cy,r=this;r.stopped=!1,(t.animate===!0||t.animate===!1)&&r.emit({type:"layoutstart",layout:r}),t.debug===!0?dg=!0:dg=!1;var a=UB(e,r,t);dg&&IB(a),t.randomize&&VB(a);var i=ei(),s=function(){FB(a,e,t),t.fit===!0&&e.fit(t.padding)},o=function(m){return!(r.stopped||m>=t.numIter||(HB(a,t),a.temperature=a.temperature*t.coolingFactor,a.temperature<t.minTemp))},u=function(){if(t.animate===!0||t.animate===!1)s(),r.one("layoutstop",t.stop),r.emit({type:"layoutstop",layout:r});else{var m=t.eles.nodes(),y=aN(a,t,m);m.layoutPositions(r,t,y)}},d=0,f=!0;if(t.animate===!0){var h=function(){for(var m=0;f&&m<t.refresh;)f=o(d),d++,m++;if(!f)HS(a,t),u();else{var y=ei();y-i>=t.animationThreshold&&s(),_f(h)}};h()}else{for(;f;)f=o(d),d++;HS(a,t),u()}return this};xh.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this};xh.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var UB=function(e,r,a){for(var i=a.eles.edges(),s=a.eles.nodes(),o=na(a.boundingBox?a.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),u={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:s.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:i.size(),temperature:a.initialTemp,clientWidth:o.w,clientHeight:o.h,boundingBox:o},d=a.eles.components(),f={},h=0;h<d.length;h++)for(var p=d[h],m=0;m<p.length;m++){var y=p[m];f[y.id()]=h}for(var h=0;h<u.nodeSize;h++){var x=s[h],E=x.layoutDimensions(a),w={};w.isLocked=x.locked(),w.id=x.data("id"),w.parentId=x.data("parent"),w.cmptId=f[x.id()],w.children=[],w.positionX=x.position("x"),w.positionY=x.position("y"),w.offsetX=0,w.offsetY=0,w.height=E.w,w.width=E.h,w.maxX=w.positionX+w.width/2,w.minX=w.positionX-w.width/2,w.maxY=w.positionY+w.height/2,w.minY=w.positionY-w.height/2,w.padLeft=parseFloat(x.style("padding")),w.padRight=parseFloat(x.style("padding")),w.padTop=parseFloat(x.style("padding")),w.padBottom=parseFloat(x.style("padding")),w.nodeRepulsion=Wt(a.nodeRepulsion)?a.nodeRepulsion(x):a.nodeRepulsion,u.layoutNodes.push(w),u.idToIndex[w.id]=h}for(var T=[],C=0,N=-1,A=[],h=0;h<u.nodeSize;h++){var x=u.layoutNodes[h],D=x.parentId;D!=null?u.layoutNodes[u.idToIndex[D]].children.push(x.id):(T[++N]=x.id,A.push(x.id))}for(u.graphSet.push(A);C<=N;){var M=T[C++],j=u.idToIndex[M],y=u.layoutNodes[j],k=y.children;if(k.length>0){u.graphSet.push(k);for(var h=0;h<k.length;h++)T[++N]=k[h]}}for(var h=0;h<u.graphSet.length;h++)for(var B=u.graphSet[h],m=0;m<B.length;m++){var P=u.idToIndex[B[m]];u.indexToGraph[P]=h}for(var h=0;h<u.edgeSize;h++){var U=i[h],R={};R.id=U.data("id"),R.sourceId=U.data("source"),R.targetId=U.data("target");var V=Wt(a.idealEdgeLength)?a.idealEdgeLength(U):a.idealEdgeLength,_=Wt(a.edgeElasticity)?a.edgeElasticity(U):a.edgeElasticity,H=u.idToIndex[R.sourceId],z=u.idToIndex[R.targetId],I=u.indexToGraph[H],F=u.indexToGraph[z];if(I!=F){for(var K=qB(R.sourceId,R.targetId,u),J=u.graphSet[K],L=0,w=u.layoutNodes[H];J.indexOf(w.id)===-1;)w=u.layoutNodes[u.idToIndex[w.parentId]],L++;for(w=u.layoutNodes[z];J.indexOf(w.id)===-1;)w=u.layoutNodes[u.idToIndex[w.parentId]],L++;V*=L*a.nestingFactor}R.idealLength=V,R.elasticity=_,u.layoutEdges.push(R)}return u},qB=function(e,r,a){var i=rN(e,r,0,a);return 2>i.count?0:i.graph},rN=function(e,r,a,i){var s=i.graphSet[a];if(-1<s.indexOf(e)&&-1<s.indexOf(r))return{count:2,graph:a};for(var o=0,u=0;u<s.length;u++){var d=s[u],f=i.idToIndex[d],h=i.layoutNodes[f].children;if(h.length!==0){var p=i.indexToGraph[i.idToIndex[h[0]]],m=rN(e,r,p,i);if(m.count!==0)if(m.count===1){if(o++,o===2)break}else return m}}return{count:o,graph:a}},IB,VB=function(e,r){for(var a=e.clientWidth,i=e.clientHeight,s=0;s<e.nodeSize;s++){var o=e.layoutNodes[s];o.children.length===0&&!o.isLocked&&(o.positionX=Math.random()*a,o.positionY=Math.random()*i)}},aN=function(e,r,a){var i=e.boundingBox,s={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return r.boundingBox&&(a.forEach(function(o){var u=e.layoutNodes[e.idToIndex[o.data("id")]];s.x1=Math.min(s.x1,u.positionX),s.x2=Math.max(s.x2,u.positionX),s.y1=Math.min(s.y1,u.positionY),s.y2=Math.max(s.y2,u.positionY)}),s.w=s.x2-s.x1,s.h=s.y2-s.y1),function(o,u){var d=e.layoutNodes[e.idToIndex[o.data("id")]];if(r.boundingBox){var f=s.w===0?.5:(d.positionX-s.x1)/s.w,h=s.h===0?.5:(d.positionY-s.y1)/s.h;return{x:i.x1+f*i.w,y:i.y1+h*i.h}}else return{x:d.positionX,y:d.positionY}}},FB=function(e,r,a){var i=a.layout,s=a.eles.nodes(),o=aN(e,a,s);s.positions(o),e.ready!==!0&&(e.ready=!0,i.one("layoutready",a.ready),i.emit({type:"layoutready",layout:this}))},HB=function(e,r,a){GB(e,r),YB(e),KB(e,r),XB(e),ZB(e)},GB=function(e,r){for(var a=0;a<e.graphSet.length;a++)for(var i=e.graphSet[a],s=i.length,o=0;o<s;o++)for(var u=e.layoutNodes[e.idToIndex[i[o]]],d=o+1;d<s;d++){var f=e.layoutNodes[e.idToIndex[i[d]]];QB(u,f,e,r)}},FS=function(e){return-1+2*e*Math.random()},QB=function(e,r,a,i){var s=e.cmptId,o=r.cmptId;if(!(s!==o&&!a.isCompound)){var u=r.positionX-e.positionX,d=r.positionY-e.positionY,f=1;u===0&&d===0&&(u=FS(f),d=FS(f));var h=$B(e,r,u,d);if(h>0)var p=i.nodeOverlap*h,m=Math.sqrt(u*u+d*d),y=p*u/m,x=p*d/m;else var E=Gf(e,u,d),w=Gf(r,-1*u,-1*d),T=w.x-E.x,C=w.y-E.y,N=T*T+C*C,m=Math.sqrt(N),p=(e.nodeRepulsion+r.nodeRepulsion)/N,y=p*T/m,x=p*C/m;e.isLocked||(e.offsetX-=y,e.offsetY-=x),r.isLocked||(r.offsetX+=y,r.offsetY+=x)}},$B=function(e,r,a,i){if(a>0)var s=e.maxX-r.minX;else var s=r.maxX-e.minX;if(i>0)var o=e.maxY-r.minY;else var o=r.maxY-e.minY;return s>=0&&o>=0?Math.sqrt(s*s+o*o):0},Gf=function(e,r,a){var i=e.positionX,s=e.positionY,o=e.height||1,u=e.width||1,d=a/r,f=o/u,h={};return r===0&&0<a||r===0&&0>a?(h.x=i,h.y=s+o/2,h):0<r&&-1*f<=d&&d<=f?(h.x=i+u/2,h.y=s+u*a/2/r,h):0>r&&-1*f<=d&&d<=f?(h.x=i-u/2,h.y=s-u*a/2/r,h):0<a&&(d<=-1*f||d>=f)?(h.x=i+o*r/2/a,h.y=s+o/2,h):(0>a&&(d<=-1*f||d>=f)&&(h.x=i-o*r/2/a,h.y=s-o/2),h)},YB=function(e,r){for(var a=0;a<e.edgeSize;a++){var i=e.layoutEdges[a],s=e.idToIndex[i.sourceId],o=e.layoutNodes[s],u=e.idToIndex[i.targetId],d=e.layoutNodes[u],f=d.positionX-o.positionX,h=d.positionY-o.positionY;if(!(f===0&&h===0)){var p=Gf(o,f,h),m=Gf(d,-1*f,-1*h),y=m.x-p.x,x=m.y-p.y,E=Math.sqrt(y*y+x*x),w=Math.pow(i.idealLength-E,2)/i.elasticity;if(E!==0)var T=w*y/E,C=w*x/E;else var T=0,C=0;o.isLocked||(o.offsetX+=T,o.offsetY+=C),d.isLocked||(d.offsetX-=T,d.offsetY-=C)}}},KB=function(e,r){if(r.gravity!==0)for(var a=1,i=0;i<e.graphSet.length;i++){var s=e.graphSet[i],o=s.length;if(i===0)var u=e.clientHeight/2,d=e.clientWidth/2;else var f=e.layoutNodes[e.idToIndex[s[0]]],h=e.layoutNodes[e.idToIndex[f.parentId]],u=h.positionX,d=h.positionY;for(var p=0;p<o;p++){var m=e.layoutNodes[e.idToIndex[s[p]]];if(!m.isLocked){var y=u-m.positionX,x=d-m.positionY,E=Math.sqrt(y*y+x*x);if(E>a){var w=r.gravity*y/E,T=r.gravity*x/E;m.offsetX+=w,m.offsetY+=T}}}}},XB=function(e,r){var a=[],i=0,s=-1;for(a.push.apply(a,e.graphSet[0]),s+=e.graphSet[0].length;i<=s;){var o=a[i++],u=e.idToIndex[o],d=e.layoutNodes[u],f=d.children;if(0<f.length&&!d.isLocked){for(var h=d.offsetX,p=d.offsetY,m=0;m<f.length;m++){var y=e.layoutNodes[e.idToIndex[f[m]]];y.offsetX+=h,y.offsetY+=p,a[++s]=f[m]}d.offsetX=0,d.offsetY=0}}},ZB=function(e,r){for(var a=0;a<e.nodeSize;a++){var i=e.layoutNodes[a];0<i.children.length&&(i.maxX=void 0,i.minX=void 0,i.maxY=void 0,i.minY=void 0)}for(var a=0;a<e.nodeSize;a++){var i=e.layoutNodes[a];if(!(0<i.children.length||i.isLocked)){var s=WB(i.offsetX,i.offsetY,e.temperature);i.positionX+=s.x,i.positionY+=s.y,i.offsetX=0,i.offsetY=0,i.minX=i.positionX-i.width,i.maxX=i.positionX+i.width,i.minY=i.positionY-i.height,i.maxY=i.positionY+i.height,nN(i,e)}}for(var a=0;a<e.nodeSize;a++){var i=e.layoutNodes[a];0<i.children.length&&!i.isLocked&&(i.positionX=(i.maxX+i.minX)/2,i.positionY=(i.maxY+i.minY)/2,i.width=i.maxX-i.minX,i.height=i.maxY-i.minY)}},WB=function(e,r,a){var i=Math.sqrt(e*e+r*r);if(i>a)var s={x:a*e/i,y:a*r/i};else var s={x:e,y:r};return s},nN=function(e,r){var a=e.parentId;if(a!=null){var i=r.layoutNodes[r.idToIndex[a]],s=!1;if((i.maxX==null||e.maxX+i.padRight>i.maxX)&&(i.maxX=e.maxX+i.padRight,s=!0),(i.minX==null||e.minX-i.padLeft<i.minX)&&(i.minX=e.minX-i.padLeft,s=!0),(i.maxY==null||e.maxY+i.padBottom>i.maxY)&&(i.maxY=e.maxY+i.padBottom,s=!0),(i.minY==null||e.minY-i.padTop<i.minY)&&(i.minY=e.minY-i.padTop,s=!0),s)return nN(i,r)}},HS=function(e,r){for(var a=e.layoutNodes,i=[],s=0;s<a.length;s++){var o=a[s],u=o.cmptId,d=i[u]=i[u]||[];d.push(o)}for(var f=0,s=0;s<i.length;s++){var h=i[s];if(h){h.x1=1/0,h.x2=-1/0,h.y1=1/0,h.y2=-1/0;for(var p=0;p<h.length;p++){var m=h[p];h.x1=Math.min(h.x1,m.positionX-m.width/2),h.x2=Math.max(h.x2,m.positionX+m.width/2),h.y1=Math.min(h.y1,m.positionY-m.height/2),h.y2=Math.max(h.y2,m.positionY+m.height/2)}h.w=h.x2-h.x1,h.h=h.y2-h.y1,f+=h.w*h.h}}i.sort(function(C,N){return N.w*N.h-C.w*C.h});for(var y=0,x=0,E=0,w=0,T=Math.sqrt(f)*e.clientWidth/e.clientHeight,s=0;s<i.length;s++){var h=i[s];if(h){for(var p=0;p<h.length;p++){var m=h[p];m.isLocked||(m.positionX+=y-h.x1,m.positionY+=x-h.y1)}y+=h.w+r.componentSpacing,E+=h.w+r.componentSpacing,w=Math.max(w,h.h),E>T&&(x+=w+r.componentSpacing,y=0,E=0,w=0)}}},JB={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 iN(t){this.options=tt({},JB,t)}iN.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 s=na(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(s.h===0||s.w===0)a.nodes().layoutPositions(this,e,function(X){return{x:s.x1,y:s.y1}});else{var o=i.size(),u=Math.sqrt(o*s.h/s.w),d=Math.round(u),f=Math.round(s.w/s.h*u),h=function(W){if(W==null)return Math.min(d,f);var te=Math.min(d,f);te==d?d=W:f=W},p=function(W){if(W==null)return Math.max(d,f);var te=Math.max(d,f);te==d?d=W:f=W},m=e.rows,y=e.cols!=null?e.cols:e.columns;if(m!=null&&y!=null)d=m,f=y;else if(m!=null&&y==null)d=m,f=Math.ceil(o/d);else if(m==null&&y!=null)f=y,d=Math.ceil(o/f);else if(f*d>o){var x=h(),E=p();(x-1)*E>=o?h(x-1):(E-1)*x>=o&&p(E-1)}else for(;f*d<o;){var w=h(),T=p();(T+1)*w>=o?p(T+1):h(w+1)}var C=s.w/f,N=s.h/d;if(e.condense&&(C=0,N=0),e.avoidOverlap)for(var A=0;A<i.length;A++){var D=i[A],M=D._private.position;(M.x==null||M.y==null)&&(M.x=0,M.y=0);var j=D.layoutDimensions(e),k=e.avoidOverlapPadding,B=j.w+k,P=j.h+k;C=Math.max(C,B),N=Math.max(N,P)}for(var U={},R=function(W,te){return!!U["c-"+W+"-"+te]},V=function(W,te){U["c-"+W+"-"+te]=!0},_=0,H=0,z=function(){H++,H>=f&&(H=0,_++)},I={},F=0;F<i.length;F++){var K=i[F],J=e.position(K);if(J&&(J.row!==void 0||J.col!==void 0)){var L={row:J.row,col:J.col};if(L.col===void 0)for(L.col=0;R(L.row,L.col);)L.col++;else if(L.row===void 0)for(L.row=0;R(L.row,L.col);)L.row++;I[K.id()]=L,V(L.row,L.col)}}var Q=function(W,te){var Y,ne;if(W.locked()||W.isParent())return!1;var he=I[W.id()];if(he)Y=he.col*C+C/2+s.x1,ne=he.row*N+N/2+s.y1;else{for(;R(_,H);)z();Y=H*C+C/2+s.x1,ne=_*N+N/2+s.y1,V(_,H),z()}return{x:Y,y:ne}};i.layoutPositions(this,e,Q)}return this};var eL={ready:function(){},stop:function(){}};function iy(t){this.options=tt({},eL,t)}iy.prototype.run=function(){var t=this.options,e=t.eles,r=this;return t.cy,r.emit("layoutstart"),e.nodes().positions(function(){return{x:0,y:0}}),r.one("layoutready",t.ready),r.emit("layoutready"),r.one("layoutstop",t.stop),r.emit("layoutstop"),this};iy.prototype.stop=function(){return this};var tL={positions:void 0,zoom:void 0,pan:void 0,fit:!0,padding:30,spacingFactor:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function sN(t){this.options=tt({},tL,t)}sN.prototype.run=function(){var t=this.options,e=t.eles,r=e.nodes(),a=Wt(t.positions);function i(s){if(t.positions==null)return EO(s.position());if(a)return t.positions(s);var o=t.positions[s._private.data.id];return o??null}return r.layoutPositions(this,t,function(s,o){var u=i(s);return s.locked()||u==null?!1:u}),this};var rL={fit:!0,padding:30,boundingBox: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 lN(t){this.options=tt({},rL,t)}lN.prototype.run=function(){var t=this.options,e=t.cy,r=t.eles,a=na(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),i=function(o,u){return{x:a.x1+Math.round(Math.random()*a.w),y:a.y1+Math.round(Math.random()*a.h)}};return r.nodes().layoutPositions(this,t,i),this};var aL=[{name:"breadthfirst",impl:JC},{name:"circle",impl:eN},{name:"concentric",impl:tN},{name:"cose",impl:xh},{name:"grid",impl:iN},{name:"null",impl:iy},{name:"preset",impl:sN},{name:"random",impl:lN}];function oN(t){this.options=t,this.notifications=0}var GS=function(){},QS=function(){throw new Error("A headless instance can not render images")};oN.prototype={recalculateRenderedStyle:GS,notify:function(){this.notifications++},init:GS,isHeadless:function(){return!0},png:QS,jpg:QS};var sy={};sy.arrowShapeWidth=.3;sy.registerArrowShapes=function(){var t=this.arrowShapes={},e=this,r=function(f,h,p,m,y,x,E){var w=y.x-p/2-E,T=y.x+p/2+E,C=y.y-p/2-E,N=y.y+p/2+E,A=w<=f&&f<=T&&C<=h&&h<=N;return A},a=function(f,h,p,m,y){var x=f*Math.cos(m)-h*Math.sin(m),E=f*Math.sin(m)+h*Math.cos(m),w=x*p,T=E*p,C=w+y.x,N=T+y.y;return{x:C,y:N}},i=function(f,h,p,m){for(var y=[],x=0;x<f.length;x+=2){var E=f[x],w=f[x+1];y.push(a(E,w,h,p,m))}return y},s=function(f){for(var h=[],p=0;p<f.length;p++){var m=f[p];h.push(m.x,m.y)}return h},o=function(f){return f.pstyle("width").pfValue*f.pstyle("arrow-scale").pfValue*2},u=function(f,h){Xe(h)&&(h=t[h]),t[f]=tt({name:f,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(m,y,x,E,w,T){var C=s(i(this.points,x+2*T,E,w)),N=ma(m,y,C);return N},roughCollide:r,draw:function(m,y,x,E){var w=i(this.points,y,x,E);e.arrowShapeImpl("polygon")(m,w)},spacing:function(m){return 0},gap:o},h)};u("none",{collide:Uf,roughCollide:Uf,draw:Gm,spacing:sw,gap:sw}),u("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),u("arrow","triangle"),u("triangle-backcurve",{points:t.triangle.points,controlPoint:[0,-.15],roughCollide:r,draw:function(f,h,p,m,y){var x=i(this.points,h,p,m),E=this.controlPoint,w=a(E[0],E[1],h,p,m);e.arrowShapeImpl(this.name)(f,x,w)},gap:function(f){return o(f)*.8}}),u("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(f,h,p,m,y,x,E){var w=s(i(this.points,p+2*E,m,y)),T=s(i(this.pointsTee,p+2*E,m,y)),C=ma(f,h,w)||ma(f,h,T);return C},draw:function(f,h,p,m,y){var x=i(this.points,h,p,m),E=i(this.pointsTee,h,p,m);e.arrowShapeImpl(this.name)(f,x,E)}}),u("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(f,h,p,m,y,x,E){var w=y,T=Math.pow(w.x-f,2)+Math.pow(w.y-h,2)<=Math.pow((p+2*E)*this.radius,2),C=s(i(this.points,p+2*E,m,y));return ma(f,h,C)||T},draw:function(f,h,p,m,y){var x=i(this.pointsTr,h,p,m);e.arrowShapeImpl(this.name)(f,x,m.x,m.y,this.radius*h)},spacing:function(f){return e.getArrowWidth(f.pstyle("width").pfValue,f.pstyle("arrow-scale").value)*this.radius}}),u("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(f,h){var p=this.baseCrossLinePts.slice(),m=h/f,y=3,x=5;return p[y]=p[y]-m,p[x]=p[x]-m,p},collide:function(f,h,p,m,y,x,E){var w=s(i(this.points,p+2*E,m,y)),T=s(i(this.crossLinePts(p,x),p+2*E,m,y)),C=ma(f,h,w)||ma(f,h,T);return C},draw:function(f,h,p,m,y){var x=i(this.points,h,p,m),E=i(this.crossLinePts(h,y),h,p,m);e.arrowShapeImpl(this.name)(f,x,E)}}),u("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(f){return o(f)*.525}}),u("circle",{radius:.15,collide:function(f,h,p,m,y,x,E){var w=y,T=Math.pow(w.x-f,2)+Math.pow(w.y-h,2)<=Math.pow((p+2*E)*this.radius,2);return T},draw:function(f,h,p,m,y){e.arrowShapeImpl(this.name)(f,m.x,m.y,this.radius*h)},spacing:function(f){return e.getArrowWidth(f.pstyle("width").pfValue,f.pstyle("arrow-scale").value)*this.radius}}),u("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(f){return 1},gap:function(f){return 1}}),u("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),u("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(f){return f.pstyle("width").pfValue*f.pstyle("arrow-scale").value}}),u("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(f){return .95*f.pstyle("width").pfValue*f.pstyle("arrow-scale").value}})};var ul={};ul.projectIntoViewport=function(t,e){var r=this.cy,a=this.findContainerClientCoords(),i=a[0],s=a[1],o=a[4],u=r.pan(),d=r.zoom(),f=((t-i)/o-u.x)/d,h=((e-s)/o-u.y)/d;return[f,h]};ul.findContainerClientCoords=function(){if(this.containerBB)return this.containerBB;var t=this.container,e=t.getBoundingClientRect(),r=this.cy.window().getComputedStyle(t),a=function(T){return parseFloat(r.getPropertyValue(T))},i={left:a("padding-left"),right:a("padding-right"),top:a("padding-top"),bottom:a("padding-bottom")},s={left:a("border-left-width"),right:a("border-right-width"),top:a("border-top-width"),bottom:a("border-bottom-width")},o=t.clientWidth,u=t.clientHeight,d=i.left+i.right,f=i.top+i.bottom,h=s.left+s.right,p=e.width/(o+h),m=o-d,y=u-f,x=e.left+i.left+s.left,E=e.top+i.top+s.top;return this.containerBB=[x,E,m,y,p]};ul.invalidateContainerClientCoordsCache=function(){this.containerBB=null};ul.findNearestElement=function(t,e,r,a){return this.findNearestElements(t,e,r,a)[0]};ul.findNearestElements=function(t,e,r,a){var i=this,s=this,o=s.getCachedZSortedEles(),u=[],d=s.cy.zoom(),f=s.cy.hasCompoundNodes(),h=(a?24:8)/d,p=(a?8:2)/d,m=(a?8:2)/d,y=1/0,x,E;r&&(o=o.interactive);function w(j,k){if(j.isNode()){if(E)return;E=j,u.push(j)}if(j.isEdge()&&(k==null||k<y))if(x){if(x.pstyle("z-compound-depth").value===j.pstyle("z-compound-depth").value&&x.pstyle("z-compound-depth").value===j.pstyle("z-compound-depth").value){for(var B=0;B<u.length;B++)if(u[B].isEdge()){u[B]=j,x=j,y=k??y;break}}}else u.push(j),x=j,y=k??y}function T(j){var k=j.outerWidth()+2*p,B=j.outerHeight()+2*p,P=k/2,U=B/2,R=j.position(),V=j.pstyle("corner-radius").value==="auto"?"auto":j.pstyle("corner-radius").pfValue,_=j._private.rscratch;if(R.x-P<=t&&t<=R.x+P&&R.y-U<=e&&e<=R.y+U){var H=s.nodeShapes[i.getNodeShape(j)];if(H.checkPoint(t,e,0,k,B,R.x,R.y,V,_))return w(j,0),!0}}function C(j){var k=j._private,B=k.rscratch,P=j.pstyle("width").pfValue,U=j.pstyle("arrow-scale").value,R=P/2+h,V=R*R,_=R*2,F=k.source,K=k.target,H;if(B.edgeType==="segments"||B.edgeType==="straight"||B.edgeType==="haystack"){for(var z=B.allpts,I=0;I+3<z.length;I+=2)if(zO(t,e,z[I],z[I+1],z[I+2],z[I+3],_)&&V>(H=VO(t,e,z[I],z[I+1],z[I+2],z[I+3])))return w(j,H),!0}else if(B.edgeType==="bezier"||B.edgeType==="multibezier"||B.edgeType==="self"||B.edgeType==="compound"){for(var z=B.allpts,I=0;I+5<B.allpts.length;I+=4)if(_O(t,e,z[I],z[I+1],z[I+2],z[I+3],z[I+4],z[I+5],_)&&V>(H=IO(t,e,z[I],z[I+1],z[I+2],z[I+3],z[I+4],z[I+5])))return w(j,H),!0}for(var F=F||k.source,K=K||k.target,J=i.getArrowWidth(P,U),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}],I=0;I<L.length;I++){var Q=L[I],X=s.arrowShapes[j.pstyle(Q.name+"-arrow-shape").value],W=j.pstyle("width").pfValue;if(X.roughCollide(t,e,J,Q.angle,{x:Q.x,y:Q.y},W,h)&&X.collide(t,e,J,Q.angle,{x:Q.x,y:Q.y},W,h))return w(j),!0}f&&u.length>0&&(T(F),T(K))}function N(j,k,B){return ga(j,k,B)}function A(j,k){var B=j._private,P=m,U;k?U=k+"-":U="",j.boundingBox();var R=B.labelBounds[k||"main"],V=j.pstyle(U+"label").value,_=j.pstyle("text-events").strValue==="yes";if(!(!_||!V)){var H=N(B.rscratch,"labelX",k),z=N(B.rscratch,"labelY",k),I=N(B.rscratch,"labelAngle",k),F=j.pstyle(U+"text-margin-x").pfValue,K=j.pstyle(U+"text-margin-y").pfValue,J=R.x1-P-F,L=R.x2+P-F,Q=R.y1-P-K,X=R.y2+P-K;if(I){var W=Math.cos(I),te=Math.sin(I),Y=function(se,Ne){return se=se-H,Ne=Ne-z,{x:se*W-Ne*te+H,y:se*te+Ne*W+z}},ne=Y(J,Q),he=Y(J,X),oe=Y(L,Q),ae=Y(L,X),re=[ne.x+F,ne.y+K,oe.x+F,oe.y+K,ae.x+F,ae.y+K,he.x+F,he.y+K];if(ma(t,e,re))return w(j),!0}else if(Ki(R,t,e))return w(j),!0}}for(var D=o.length-1;D>=0;D--){var M=o[D];M.isNode()?T(M)||A(M):C(M)||A(M)||A(M,"source")||A(M,"target")}return u};ul.getAllInBox=function(t,e,r,a){var i=this.getCachedZSortedEles().interactive,s=this.cy.zoom(),o=2/s,u=[],d=Math.min(t,r),f=Math.max(t,r),h=Math.min(e,a),p=Math.max(e,a);t=d,r=f,e=h,a=p;var m=na({x1:t,y1:e,x2:r,y2:a}),y=[{x:m.x1,y:m.y1},{x:m.x2,y:m.y1},{x:m.x2,y:m.y2},{x:m.x1,y:m.y2}],x=[[y[0],y[1]],[y[1],y[2]],[y[2],y[3]],[y[3],y[0]]];function E(se,Ne,Ae){return ga(se,Ne,Ae)}function w(se,Ne){var Ae=se._private,Ze=o,Qe="";se.boundingBox();var Se=Ae.labelBounds.main;if(!Se)return null;var Oe=E(Ae.rscratch,"labelX",Ne),ke=E(Ae.rscratch,"labelY",Ne),Pe=E(Ae.rscratch,"labelAngle",Ne),Ge=se.pstyle(Qe+"text-margin-x").pfValue,Je=se.pstyle(Qe+"text-margin-y").pfValue,Be=Se.x1-Ze-Ge,nt=Se.x2+Ze-Ge,ye=Se.y1-Ze-Je,$e=Se.y2+Ze-Je;if(Pe){var et=Math.cos(Pe),xe=Math.sin(Pe),ze=function(we,$){return we=we-Oe,$=$-ke,{x:we*et-$*xe+Oe,y:we*xe+$*et+ke}};return[ze(Be,ye),ze(nt,ye),ze(nt,$e),ze(Be,$e)]}else return[{x:Be,y:ye},{x:nt,y:ye},{x:nt,y:$e},{x:Be,y:$e}]}function T(se,Ne,Ae,Ze){function Qe(Se,Oe,ke){return(ke.y-Se.y)*(Oe.x-Se.x)>(Oe.y-Se.y)*(ke.x-Se.x)}return Qe(se,Ae,Ze)!==Qe(Ne,Ae,Ze)&&Qe(se,Ne,Ae)!==Qe(se,Ne,Ze)}for(var C=0;C<i.length;C++){var N=i[C];if(N.isNode()){var A=N,D=A.pstyle("text-events").strValue==="yes",M=A.pstyle("box-selection").strValue,j=A.pstyle("box-select-labels").strValue==="yes";if(M==="none")continue;var k=(M==="overlap"||j)&&D,B=A.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:k});if(M==="contain"){var P=!1;if(j&&D){var U=w(A);U&&u0(U,y)&&(u.push(A),P=!0)}!P&&pC(m,B)&&u.push(A)}else if(M==="overlap"&&Km(m,B)){var R=A.boundingBox({includeNodes:!0,includeEdges:!0,includeLabels:!1,includeMainLabels:!1,includeSourceLabels:!1,includeTargetLabels:!1}),V=[{x:R.x1,y:R.y1},{x:R.x2,y:R.y1},{x:R.x2,y:R.y2},{x:R.x1,y:R.y2}];if(u0(V,y))u.push(A);else{var _=w(A);_&&u0(_,y)&&u.push(A)}}}else{var H=N,z=H._private,I=z.rscratch,F=H.pstyle("box-selection").strValue;if(F==="none")continue;if(F==="contain"){if(I.startX!=null&&I.startY!=null&&!Ki(m,I.startX,I.startY)||I.endX!=null&&I.endY!=null&&!Ki(m,I.endX,I.endY))continue;if(I.edgeType==="bezier"||I.edgeType==="multibezier"||I.edgeType==="self"||I.edgeType==="compound"||I.edgeType==="segments"||I.edgeType==="haystack"){for(var K=z.rstyle.bezierPts||z.rstyle.linePts||z.rstyle.haystackPts,J=!0,L=0;L<K.length;L++)if(!dw(m,K[L])){J=!1;break}J&&u.push(H)}else I.edgeType==="straight"&&u.push(H)}else if(F==="overlap"){var Q=!1;if(I.startX!=null&&I.startY!=null&&I.endX!=null&&I.endY!=null&&(Ki(m,I.startX,I.startY)||Ki(m,I.endX,I.endY)))u.push(H),Q=!0;else if(!Q&&I.edgeType==="haystack"){for(var X=z.rstyle.haystackPts,W=0;W<X.length;W++)if(dw(m,X[W])){u.push(H),Q=!0;break}}if(!Q){var te=z.rstyle.bezierPts||z.rstyle.linePts||z.rstyle.haystackPts;if((!te||te.length<2)&&I.edgeType==="straight"&&I.startX!=null&&I.startY!=null&&I.endX!=null&&I.endY!=null&&(te=[{x:I.startX,y:I.startY},{x:I.endX,y:I.endY}]),!te||te.length<2)continue;for(var Y=0;Y<te.length-1;Y++){for(var ne=te[Y],he=te[Y+1],oe=0;oe<x.length;oe++){var ae=mr(x[oe],2),re=ae[0],le=ae[1];if(T(ne,he,re,le)){u.push(H),Q=!0;break}}if(Q)break}}}}}return u};var Qf={};Qf.calculateArrowAngles=function(t){var e=t._private.rscratch,r=e.edgeType==="haystack",a=e.edgeType==="bezier",i=e.edgeType==="multibezier",s=e.edgeType==="segments",o=e.edgeType==="compound",u=e.edgeType==="self",d,f,h,p,m,y,T,C;if(r?(h=e.haystackPts[0],p=e.haystackPts[1],m=e.haystackPts[2],y=e.haystackPts[3]):(h=e.arrowStartX,p=e.arrowStartY,m=e.arrowEndX,y=e.arrowEndY),T=e.midX,C=e.midY,s)d=h-e.segpts[0],f=p-e.segpts[1];else if(i||o||u||a){var x=e.allpts,E=Or(x[0],x[2],x[4],.1),w=Or(x[1],x[3],x[5],.1);d=h-E,f=p-w}else d=h-T,f=p-C;e.srcArrowAngle=rf(d,f);var T=e.midX,C=e.midY;if(r&&(T=(h+m)/2,C=(p+y)/2),d=m-h,f=y-p,s){var x=e.allpts;if(x.length/2%2===0){var N=x.length/2,A=N-2;d=x[N]-x[A],f=x[N+1]-x[A+1]}else if(e.isRound)d=e.midVector[1],f=-e.midVector[0];else{var N=x.length/2-1,A=N-2;d=x[N]-x[A],f=x[N+1]-x[A+1]}}else if(i||o||u){var x=e.allpts,D=e.ctrlpts,M,j,k,B;if(D.length/2%2===0){var P=x.length/2-1,U=P+2,R=U+2;M=Or(x[P],x[U],x[R],0),j=Or(x[P+1],x[U+1],x[R+1],0),k=Or(x[P],x[U],x[R],1e-4),B=Or(x[P+1],x[U+1],x[R+1],1e-4)}else{var U=x.length/2-1,P=U-2,R=U+2;M=Or(x[P],x[U],x[R],.4999),j=Or(x[P+1],x[U+1],x[R+1],.4999),k=Or(x[P],x[U],x[R],.5),B=Or(x[P+1],x[U+1],x[R+1],.5)}d=k-M,f=B-j}if(e.midtgtArrowAngle=rf(d,f),e.midDispX=d,e.midDispY=f,d*=-1,f*=-1,s){var x=e.allpts;if(x.length/2%2!==0){if(!e.isRound){var N=x.length/2-1,V=N+2;d=-(x[V]-x[N]),f=-(x[V+1]-x[N+1])}}}if(e.midsrcArrowAngle=rf(d,f),s)d=m-e.segpts[e.segpts.length-2],f=y-e.segpts[e.segpts.length-1];else if(i||o||u||a){var x=e.allpts,_=x.length,E=Or(x[_-6],x[_-4],x[_-2],.9),w=Or(x[_-5],x[_-3],x[_-1],.9);d=m-E,f=y-w}else d=m-T,f=y-C;e.tgtArrowAngle=rf(d,f)};Qf.getArrowWidth=Qf.getArrowHeight=function(t,e){var r=this.arrowWidthCache=this.arrowWidthCache||{},a=r[t+", "+e];return a||(a=Math.max(Math.pow(t*13.37,.9),29)*e,r[t+", "+e]=a,a)};var lm,om,mn={},Ga={},$S,YS,_s,Af,Hn,Os,Ls,pn,Zl,df,uN,cN,um,cm,KS,XS=function(e,r,a){a.x=r.x-e.x,a.y=r.y-e.y,a.len=Math.sqrt(a.x*a.x+a.y*a.y),a.nx=a.x/a.len,a.ny=a.y/a.len,a.ang=Math.atan2(a.ny,a.nx)},nL=function(e,r){r.x=e.x*-1,r.y=e.y*-1,r.nx=e.nx*-1,r.ny=e.ny*-1,r.ang=e.ang>0?-(Math.PI-e.ang):Math.PI+e.ang},iL=function(e,r,a,i,s){if(e!==KS?XS(r,e,mn):nL(Ga,mn),XS(r,a,Ga),$S=mn.nx*Ga.ny-mn.ny*Ga.nx,YS=mn.nx*Ga.nx-mn.ny*-Ga.ny,Hn=Math.asin(Math.max(-1,Math.min(1,$S))),Math.abs(Hn)<1e-6){lm=r.x,om=r.y,Ls=Zl=0;return}_s=1,Af=!1,YS<0?Hn<0?Hn=Math.PI+Hn:(Hn=Math.PI-Hn,_s=-1,Af=!0):Hn>0&&(_s=-1,Af=!0),r.radius!==void 0?Zl=r.radius:Zl=i,Os=Hn/2,df=Math.min(mn.len/2,Ga.len/2),s?(pn=Math.abs(Math.cos(Os)*Zl/Math.sin(Os)),pn>df?(pn=df,Ls=Math.abs(pn*Math.sin(Os)/Math.cos(Os))):Ls=Zl):(pn=Math.min(df,Zl),Ls=Math.abs(pn*Math.sin(Os)/Math.cos(Os))),um=r.x+Ga.nx*pn,cm=r.y+Ga.ny*pn,lm=um-Ga.ny*Ls*_s,om=cm+Ga.nx*Ls*_s,uN=r.x+mn.nx*pn,cN=r.y+mn.ny*pn,KS=r};function dN(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 ly(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}:(iL(t,e,r,a,i),{cx:lm,cy:om,radius:Ls,startX:uN,startY:cN,stopX:um,stopY:cm,startAngle:mn.ang+Math.PI/2*_s,endAngle:Ga.ang-Math.PI/2*_s,counterClockwise:Af})}var lc=.01,sL=Math.sqrt(2*lc),Wr={};Wr.findMidptPtsEtc=function(t,e){var r=e.posPts,a=e.intersectionPts,i=e.vectorNormInverse,s,o=t.pstyle("source-endpoint"),u=t.pstyle("target-endpoint"),d=o.units!=null&&u.units!=null,f=function(D,M,j,k){var B=k-M,P=j-D,U=Math.sqrt(P*P+B*B);return{x:-B/U,y:P/U}},h=t.pstyle("edge-distances").value;switch(h){case"node-position":s=r;break;case"intersection":s=a;break;case"endpoints":{if(d){var p=this.manualEndptToPx(t.source()[0],o),m=mr(p,2),y=m[0],x=m[1],E=this.manualEndptToPx(t.target()[0],u),w=mr(E,2),T=w[0],C=w[1],N={x1:y,y1:x,x2:T,y2:C};i=f(y,x,T,C),s=N}else At("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).")),s=a;break}}return{midptPts:s,vectorNormInverse:i}};Wr.findHaystackPoints=function(t){for(var e=0;e<t.length;e++){var r=t[e],a=r._private,i=a.rscratch;if(!i.haystack){var s=Math.random()*2*Math.PI;i.source={x:Math.cos(s),y:Math.sin(s)},s=Math.random()*2*Math.PI,i.target={x:Math.cos(s),y:Math.sin(s)}}var o=a.source,u=a.target,d=o.position(),f=u.position(),h=o.width(),p=u.width(),m=o.height(),y=u.height(),x=r.pstyle("haystack-radius").value,E=x/2;i.haystackPts=i.allpts=[i.source.x*h*E+d.x,i.source.y*m*E+d.y,i.target.x*p*E+f.x,i.target.y*y*E+f.y],i.midX=(i.allpts[0]+i.allpts[2])/2,i.midY=(i.allpts[1]+i.allpts[3])/2,i.edgeType="haystack",i.haystack=!0,this.storeEdgeProjections(r),this.calculateArrowAngles(r),this.recalculateEdgeLabelProjections(r),this.calculateLabelAngles(r)}};Wr.findSegmentsPoints=function(t,e){var r=t._private.rscratch,a=t.pstyle("segment-weights"),i=t.pstyle("segment-distances"),s=t.pstyle("segment-radii"),o=t.pstyle("radius-type"),u=Math.min(a.pfValue.length,i.pfValue.length),d=s.pfValue[s.pfValue.length-1],f=o.pfValue[o.pfValue.length-1];r.edgeType="segments",r.segpts=[],r.radii=[],r.isArcRadius=[];for(var h=0;h<u;h++){var p=a.pfValue[h],m=i.pfValue[h],y=1-p,x=p,E=this.findMidptPtsEtc(t,e),w=E.midptPts,T=E.vectorNormInverse,C={x:w.x1*y+w.x2*x,y:w.y1*y+w.y2*x};r.segpts.push(C.x+T.x*m,C.y+T.y*m),r.radii.push(s.pfValue[h]!==void 0?s.pfValue[h]:d),r.isArcRadius.push((o.pfValue[h]!==void 0?o.pfValue[h]:f)==="arc-radius")}};Wr.findLoopPoints=function(t,e,r,a){var i=t._private.rscratch,s=e.dirCounts,o=e.srcPos,u=t.pstyle("control-point-distances"),d=u?u.pfValue[0]:void 0,f=t.pstyle("loop-direction").pfValue,h=t.pstyle("loop-sweep").pfValue,p=t.pstyle("control-point-step-size").pfValue;i.edgeType="self";var m=r,y=p;a&&(m=0,y=d);var x=f-Math.PI/2,E=x-h/2,w=x+h/2,T=f+"_"+h;m=s[T]===void 0?s[T]=0:++s[T],i.ctrlpts=[o.x+Math.cos(E)*1.4*y*(m/3+1),o.y+Math.sin(E)*1.4*y*(m/3+1),o.x+Math.cos(w)*1.4*y*(m/3+1),o.y+Math.sin(w)*1.4*y*(m/3+1)]};Wr.findCompoundLoopPoints=function(t,e,r,a){var i=t._private.rscratch;i.edgeType="compound";var s=e.srcPos,o=e.tgtPos,u=e.srcW,d=e.srcH,f=e.tgtW,h=e.tgtH,p=t.pstyle("control-point-step-size").pfValue,m=t.pstyle("control-point-distances"),y=m?m.pfValue[0]:void 0,x=r,E=p;a&&(x=0,E=y);var w=50,T={x:s.x-u/2,y:s.y-d/2},C={x:o.x-f/2,y:o.y-h/2},N={x:Math.min(T.x,C.x),y:Math.min(T.y,C.y)},A=.5,D=Math.max(A,Math.log(u*lc)),M=Math.max(A,Math.log(f*lc));i.ctrlpts=[N.x,N.y-(1+Math.pow(w,1.12)/100)*E*(x/3+1)*D,N.x-(1+Math.pow(w,1.12)/100)*E*(x/3+1)*M,N.y]};Wr.findStraightEdgePoints=function(t){t._private.rscratch.edgeType="straight"};Wr.findBezierPoints=function(t,e,r,a,i){var s=t._private.rscratch,o=t.pstyle("control-point-step-size").pfValue,u=t.pstyle("control-point-distances"),d=t.pstyle("control-point-weights"),f=u&&d?Math.min(u.value.length,d.value.length):1,h=u?u.pfValue[0]:void 0,p=d.value[0],m=a;s.edgeType=m?"multibezier":"bezier",s.ctrlpts=[];for(var y=0;y<f;y++){var x=(.5-e.eles.length/2+r)*o*(i?-1:1),E=void 0,w=Ym(x);m&&(h=u?u.pfValue[y]:o,p=d.value[y]),a?E=h:E=h!==void 0?w*h:void 0;var T=E!==void 0?E:x,C=1-p,N=p,A=this.findMidptPtsEtc(t,e),D=A.midptPts,M=A.vectorNormInverse,j={x:D.x1*C+D.x2*N,y:D.y1*C+D.y2*N};s.ctrlpts.push(j.x+M.x*T,j.y+M.y*T)}};Wr.findTaxiPoints=function(t,e){var r=t._private.rscratch;r.edgeType="segments";var a="vertical",i="horizontal",s="leftward",o="rightward",u="downward",d="upward",f="auto",h=e.posPts,p=e.srcW,m=e.srcH,y=e.tgtW,x=e.tgtH,E=t.pstyle("edge-distances").value,w=E!=="node-position",T=t.pstyle("taxi-direction").value,C=T,N=t.pstyle("taxi-turn"),A=N.units==="%",D=N.pfValue,M=D<0,j=t.pstyle("taxi-turn-min-distance").pfValue,k=w?(p+y)/2:0,B=w?(m+x)/2:0,P=h.x2-h.x1,U=h.y2-h.y1,R=function($,ce){return $>0?Math.max($-ce,0):Math.min($+ce,0)},V=R(P,k),_=R(U,B),H=!1;C===f?T=Math.abs(V)>Math.abs(_)?i:a:C===d||C===u?(T=a,H=!0):(C===s||C===o)&&(T=i,H=!0);var z=T===a,I=z?_:V,F=z?U:P,K=Ym(F),J=!1;!(H&&(A||M))&&(C===u&&F<0||C===d&&F>0||C===s&&F>0||C===o&&F<0)&&(K*=-1,I=K*Math.abs(I),J=!0);var L;if(A){var Q=D<0?1+D:D;L=Q*I}else{var X=D<0?I:0;L=X+D*K}var W=function($){return Math.abs($)<j||Math.abs($)>=Math.abs(I)},te=W(L),Y=W(Math.abs(I)-Math.abs(L)),ne=te||Y;if(ne&&!J)if(z){var he=Math.abs(F)<=m/2,oe=Math.abs(P)<=y/2;if(he){var ae=(h.x1+h.x2)/2,re=h.y1,le=h.y2;r.segpts=[ae,re,ae,le]}else if(oe){var se=(h.y1+h.y2)/2,Ne=h.x1,Ae=h.x2;r.segpts=[Ne,se,Ae,se]}else r.segpts=[h.x1,h.y2]}else{var Ze=Math.abs(F)<=p/2,Qe=Math.abs(U)<=x/2;if(Ze){var Se=(h.y1+h.y2)/2,Oe=h.x1,ke=h.x2;r.segpts=[Oe,Se,ke,Se]}else if(Qe){var Pe=(h.x1+h.x2)/2,Ge=h.y1,Je=h.y2;r.segpts=[Pe,Ge,Pe,Je]}else r.segpts=[h.x2,h.y1]}else if(z){var Be=h.y1+L+(w?m/2*K:0),nt=h.x1,ye=h.x2;r.segpts=[nt,Be,ye,Be]}else{var $e=h.x1+L+(w?p/2*K:0),et=h.y1,xe=h.y2;r.segpts=[$e,et,$e,xe]}if(r.isRound){var ze=t.pstyle("taxi-radius").value,Re=t.pstyle("radius-type").value[0]==="arc-radius";r.radii=new Array(r.segpts.length/2).fill(ze),r.isArcRadius=new Array(r.segpts.length/2).fill(Re)}};Wr.tryToCorrectInvalidPoints=function(t,e){var r=t._private.rscratch;if(r.edgeType==="bezier"){var a=e.srcPos,i=e.tgtPos,s=e.srcW,o=e.srcH,u=e.tgtW,d=e.tgtH,f=e.srcShape,h=e.tgtShape,p=e.srcCornerRadius,m=e.tgtCornerRadius,y=e.srcRs,x=e.tgtRs,E=!De(r.startX)||!De(r.startY),w=!De(r.arrowStartX)||!De(r.arrowStartY),T=!De(r.endX)||!De(r.endY),C=!De(r.arrowEndX)||!De(r.arrowEndY),N=3,A=this.getArrowWidth(t.pstyle("width").pfValue,t.pstyle("arrow-scale").value)*this.arrowShapeWidth,D=N*A,M=Js({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.startX,y:r.startY}),j=M<D,k=Js({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.endX,y:r.endY}),B=k<D,P=!1;if(E||w||j){P=!0;var U={x:r.ctrlpts[0]-a.x,y:r.ctrlpts[1]-a.y},R=Math.sqrt(U.x*U.x+U.y*U.y),V={x:U.x/R,y:U.y/R},_=Math.max(s,o),H={x:r.ctrlpts[0]+V.x*2*_,y:r.ctrlpts[1]+V.y*2*_},z=f.intersectLine(a.x,a.y,s,o,H.x,H.y,0,p,y);j?(r.ctrlpts[0]=r.ctrlpts[0]+V.x*(D-M),r.ctrlpts[1]=r.ctrlpts[1]+V.y*(D-M)):(r.ctrlpts[0]=z[0]+V.x*D,r.ctrlpts[1]=z[1]+V.y*D)}if(T||C||B){P=!0;var I={x:r.ctrlpts[0]-i.x,y:r.ctrlpts[1]-i.y},F=Math.sqrt(I.x*I.x+I.y*I.y),K={x:I.x/F,y:I.y/F},J=Math.max(s,o),L={x:r.ctrlpts[0]+K.x*2*J,y:r.ctrlpts[1]+K.y*2*J},Q=h.intersectLine(i.x,i.y,u,d,L.x,L.y,0,m,x);B?(r.ctrlpts[0]=r.ctrlpts[0]+K.x*(D-k),r.ctrlpts[1]=r.ctrlpts[1]+K.y*(D-k)):(r.ctrlpts[0]=Q[0]+K.x*D,r.ctrlpts[1]=Q[1]+K.y*D)}P&&this.findEndpoints(t)}};Wr.storeAllpts=function(t){var e=t._private.rscratch;if(e.edgeType==="multibezier"||e.edgeType==="bezier"||e.edgeType==="self"||e.edgeType==="compound"){e.allpts=[],e.allpts.push(e.startX,e.startY);for(var r=0;r+1<e.ctrlpts.length;r+=2)e.allpts.push(e.ctrlpts[r],e.ctrlpts[r+1]),r+3<e.ctrlpts.length&&e.allpts.push((e.ctrlpts[r]+e.ctrlpts[r+2])/2,(e.ctrlpts[r+1]+e.ctrlpts[r+3])/2);e.allpts.push(e.endX,e.endY);var a,i;e.ctrlpts.length/2%2===0?(a=e.allpts.length/2-1,e.midX=e.allpts[a],e.midY=e.allpts[a+1]):(a=e.allpts.length/2-3,i=.5,e.midX=Or(e.allpts[a],e.allpts[a+2],e.allpts[a+4],i),e.midY=Or(e.allpts[a+1],e.allpts[a+3],e.allpts[a+5],i))}else if(e.edgeType==="straight")e.allpts=[e.startX,e.startY,e.endX,e.endY],e.midX=(e.startX+e.endX+e.arrowStartX+e.arrowEndX)/4,e.midY=(e.startY+e.endY+e.arrowStartY+e.arrowEndY)/4;else if(e.edgeType==="segments"){if(e.allpts=[],e.allpts.push(e.startX,e.startY),e.allpts.push.apply(e.allpts,e.segpts),e.allpts.push(e.endX,e.endY),e.isRound){e.roundCorners=[];for(var s=2;s+3<e.allpts.length;s+=2){var o=e.radii[s/2-1],u=e.isArcRadius[s/2-1];e.roundCorners.push(ly({x:e.allpts[s-2],y:e.allpts[s-1]},{x:e.allpts[s],y:e.allpts[s+1],radius:o},{x:e.allpts[s+2],y:e.allpts[s+3]},o,u))}}if(e.segpts.length%4===0){var d=e.segpts.length/2,f=d-2;e.midX=(e.segpts[f]+e.segpts[d])/2,e.midY=(e.segpts[f+1]+e.segpts[d+1])/2}else{var h=e.segpts.length/2-1;if(!e.isRound)e.midX=e.segpts[h],e.midY=e.segpts[h+1];else{var p={x:e.segpts[h],y:e.segpts[h+1]},m=e.roundCorners[h/2];if(m.radius===0){var y={x:e.segpts[h+2],y:e.segpts[h+3]};e.midX=p.x,e.midY=p.y,e.midVector=[p.y-y.y,y.x-p.x]}else{var x=[p.x-m.cx,p.y-m.cy],E=m.radius/Math.sqrt(Math.pow(x[0],2)+Math.pow(x[1],2));x=x.map(function(w){return w*E}),e.midX=m.cx+x[0],e.midY=m.cy+x[1],e.midVector=x}}}}};Wr.checkForInvalidEdgeWarning=function(t){var e=t[0]._private.rscratch;e.nodesOverlap||De(e.startX)&&De(e.startY)&&De(e.endX)&&De(e.endY)?e.loggedErr=!1:e.loggedErr||(e.loggedErr=!0,At("Edge `"+t.id()+"` has invalid endpoints and so it is impossible to draw. Adjust your edge style (e.g. control points) accordingly or use an alternative edge type. This is expected behaviour when the source node and the target node overlap."))};Wr.findEdgeControlPoints=function(t){var e=this;if(!(!t||t.length===0)){for(var r=this,a=r.cy,i=a.hasCompoundNodes(),s=new Zn,o=function(B,P){return[].concat(Pf(B),[P?1:0]).join("-")},u=[],d=[],f=0;f<t.length;f++){var h=t[f],p=h._private,m=h.pstyle("curve-style").value;if(!(h.removed()||!h.takesUpSpace())){if(m==="haystack"){d.push(h);continue}var y=m==="unbundled-bezier"||Yi(m,"segments")||m==="straight"||m==="straight-triangle"||Yi(m,"taxi"),x=m==="unbundled-bezier"||m==="bezier",E=p.source,w=p.target,T=E.poolIndex(),C=w.poolIndex(),N=[T,C].sort(),A=o(N,y),D=s.get(A);D==null&&(D={eles:[]},u.push({pairId:N,edgeIsUnbundled:y}),s.set(A,D)),D.eles.push(h),y&&(D.hasUnbundled=!0),x&&(D.hasBezier=!0)}}for(var M=function(){var B=u[j],P=B.pairId,U=B.edgeIsUnbundled,R=o(P,U),V=s.get(R),_;if(!V.hasUnbundled){var H=V.eles[0].parallelEdges().filter(function(Re){return Re.isBundledBezier()});Qm(V.eles),H.forEach(function(Re){return V.eles.push(Re)}),V.eles.sort(function(Re,we){return Re.poolIndex()-we.poolIndex()})}var z=V.eles[0],I=z.source(),F=z.target();if(I.poolIndex()>F.poolIndex()){var K=I;I=F,F=K}var J=V.srcPos=I.position(),L=V.tgtPos=F.position(),Q=V.srcW=I.outerWidth(),X=V.srcH=I.outerHeight(),W=V.tgtW=F.outerWidth(),te=V.tgtH=F.outerHeight(),Y=V.srcShape=r.nodeShapes[e.getNodeShape(I)],ne=V.tgtShape=r.nodeShapes[e.getNodeShape(F)],he=V.srcCornerRadius=I.pstyle("corner-radius").value==="auto"?"auto":I.pstyle("corner-radius").pfValue,oe=V.tgtCornerRadius=F.pstyle("corner-radius").value==="auto"?"auto":F.pstyle("corner-radius").pfValue,ae=V.tgtRs=F._private.rscratch,re=V.srcRs=I._private.rscratch;V.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var le=0;le<V.eles.length;le++){var se=V.eles[le],Ne=se[0]._private.rscratch,Ae=se.pstyle("curve-style").value,Ze=Ae==="unbundled-bezier"||Yi(Ae,"segments")||Yi(Ae,"taxi"),Qe=!I.same(se.source());if(!V.calculatedIntersection&&I!==F&&(V.hasBezier||V.hasUnbundled)){V.calculatedIntersection=!0;var Se=Y.intersectLine(J.x,J.y,Q,X,L.x,L.y,0,he,re),Oe=V.srcIntn=Se,ke=ne.intersectLine(L.x,L.y,W,te,J.x,J.y,0,oe,ae),Pe=V.tgtIntn=ke,Ge=V.intersectionPts={x1:Se[0],x2:ke[0],y1:Se[1],y2:ke[1]},Je=V.posPts={x1:J.x,x2:L.x,y1:J.y,y2:L.y},Be=ke[1]-Se[1],nt=ke[0]-Se[0],ye=Math.sqrt(nt*nt+Be*Be);De(ye)&&ye>=sL||(ye=Math.sqrt(Math.max(nt*nt,lc)+Math.max(Be*Be,lc)));var $e=V.vector={x:nt,y:Be},et=V.vectorNorm={x:$e.x/ye,y:$e.y/ye},xe={x:-et.y,y:et.x};V.nodesOverlap=!De(ye)||ne.checkPoint(Se[0],Se[1],0,W,te,L.x,L.y,oe,ae)||Y.checkPoint(ke[0],ke[1],0,Q,X,J.x,J.y,he,re),V.vectorNormInverse=xe,_={nodesOverlap:V.nodesOverlap,dirCounts:V.dirCounts,calculatedIntersection:!0,hasBezier:V.hasBezier,hasUnbundled:V.hasUnbundled,eles:V.eles,srcPos:L,srcRs:ae,tgtPos:J,tgtRs:re,srcW:W,srcH:te,tgtW:Q,tgtH:X,srcIntn:Pe,tgtIntn:Oe,srcShape:ne,tgtShape:Y,posPts:{x1:Je.x2,y1:Je.y2,x2:Je.x1,y2:Je.y1},intersectionPts:{x1:Ge.x2,y1:Ge.y2,x2:Ge.x1,y2:Ge.y1},vector:{x:-$e.x,y:-$e.y},vectorNorm:{x:-et.x,y:-et.y},vectorNormInverse:{x:-xe.x,y:-xe.y}}}var ze=Qe?_:V;Ne.nodesOverlap=ze.nodesOverlap,Ne.srcIntn=ze.srcIntn,Ne.tgtIntn=ze.tgtIntn,Ne.isRound=Ae.startsWith("round"),i&&(I.isParent()||I.isChild()||F.isParent()||F.isChild())&&(I.parents().anySame(F)||F.parents().anySame(I)||I.same(F)&&I.isParent())?e.findCompoundLoopPoints(se,ze,le,Ze):I===F?e.findLoopPoints(se,ze,le,Ze):Ae.endsWith("segments")?e.findSegmentsPoints(se,ze):Ae.endsWith("taxi")?e.findTaxiPoints(se,ze):Ae==="straight"||!Ze&&V.eles.length%2===1&&le===Math.floor(V.eles.length/2)?e.findStraightEdgePoints(se):e.findBezierPoints(se,ze,le,Ze,Qe),e.findEndpoints(se),e.tryToCorrectInvalidPoints(se,ze),e.checkForInvalidEdgeWarning(se),e.storeAllpts(se),e.storeEdgeProjections(se),e.calculateArrowAngles(se),e.recalculateEdgeLabelProjections(se),e.calculateLabelAngles(se)}},j=0;j<u.length;j++)M();this.findHaystackPoints(d)}};function fN(t){var e=[];if(t!=null){for(var r=0;r<t.length;r+=2){var a=t[r],i=t[r+1];e.push({x:a,y:i})}return e}}Wr.getSegmentPoints=function(t){var e=t[0]._private.rscratch;this.recalculateRenderedStyle(t);var r=e.edgeType;if(r==="segments")return fN(e.segpts)};Wr.getControlPoints=function(t){var e=t[0]._private.rscratch;this.recalculateRenderedStyle(t);var r=e.edgeType;if(r==="bezier"||r==="multibezier"||r==="self"||r==="compound")return fN(e.ctrlpts)};Wr.getEdgeMidpoint=function(t){var e=t[0]._private.rscratch;return this.recalculateRenderedStyle(t),{x:e.midX,y:e.midY}};var Oc={};Oc.manualEndptToPx=function(t,e){var r=this,a=t.position(),i=t.outerWidth(),s=t.outerHeight(),o=t._private.rscratch;if(e.value.length===2){var u=[e.pfValue[0],e.pfValue[1]];return e.units[0]==="%"&&(u[0]=u[0]*i),e.units[1]==="%"&&(u[1]=u[1]*s),u[0]+=a.x,u[1]+=a.y,u}else{var d=e.pfValue[0];d=-Math.PI/2+d;var f=2*Math.max(i,s),h=[a.x+Math.cos(d)*f,a.y+Math.sin(d)*f];return r.nodeShapes[this.getNodeShape(t)].intersectLine(a.x,a.y,i,s,h[0],h[1],0,t.pstyle("corner-radius").value==="auto"?"auto":t.pstyle("corner-radius").pfValue,o)}};Oc.findEndpoints=function(t){var e,r,a,i,s=this,o,u=t.source()[0],d=t.target()[0],f=u.position(),h=d.position(),p=t.pstyle("target-arrow-shape").value,m=t.pstyle("source-arrow-shape").value,y=t.pstyle("target-distance-from-node").pfValue,x=t.pstyle("source-distance-from-node").pfValue,E=u._private.rscratch,w=d._private.rscratch,T=t.pstyle("curve-style").value,C=t._private.rscratch,N=C.edgeType,A=Yi(T,"taxi"),D=N==="self"||N==="compound",M=N==="bezier"||N==="multibezier"||D,j=N!=="bezier",k=N==="straight"||N==="segments",B=N==="segments",P=M||j||k,U=D||A,R=t.pstyle("source-endpoint"),V=U?"outside-to-node":R.value,_=u.pstyle("corner-radius").value==="auto"?"auto":u.pstyle("corner-radius").pfValue,H=t.pstyle("target-endpoint"),z=U?"outside-to-node":H.value,I=d.pstyle("corner-radius").value==="auto"?"auto":d.pstyle("corner-radius").pfValue;C.srcManEndpt=R,C.tgtManEndpt=H;var F,K,J,L,Q=(e=(H==null||(r=H.pfValue)===null||r===void 0?void 0:r.length)===2?H.pfValue:null)!==null&&e!==void 0?e:[0,0],X=(a=(R==null||(i=R.pfValue)===null||i===void 0?void 0:i.length)===2?R.pfValue:null)!==null&&a!==void 0?a:[0,0];if(M){var W=[C.ctrlpts[0],C.ctrlpts[1]],te=j?[C.ctrlpts[C.ctrlpts.length-2],C.ctrlpts[C.ctrlpts.length-1]]:W;F=te,K=W}else if(k){var Y=B?C.segpts.slice(0,2):[h.x+Q[0],h.y+Q[1]],ne=B?C.segpts.slice(C.segpts.length-2):[f.x+X[0],f.y+X[1]];F=ne,K=Y}if(z==="inside-to-node")o=[h.x,h.y];else if(H.units)o=this.manualEndptToPx(d,H);else if(z==="outside-to-line")o=C.tgtIntn;else if(z==="outside-to-node"||z==="outside-to-node-or-label"?J=F:(z==="outside-to-line"||z==="outside-to-line-or-label")&&(J=[f.x,f.y]),o=s.nodeShapes[this.getNodeShape(d)].intersectLine(h.x,h.y,d.outerWidth(),d.outerHeight(),J[0],J[1],0,I,w),z==="outside-to-node-or-label"||z==="outside-to-line-or-label"){var he=d._private.rscratch,oe=he.labelWidth,ae=he.labelHeight,re=he.labelX,le=he.labelY,se=oe/2,Ne=ae/2,Ae=d.pstyle("text-valign").value;Ae==="top"?le-=Ne:Ae==="bottom"&&(le+=Ne);var Ze=d.pstyle("text-halign").value;Ze==="left"?re-=se:Ze==="right"&&(re+=se);var Qe=rc(J[0],J[1],[re-se,le-Ne,re+se,le-Ne,re+se,le+Ne,re-se,le+Ne],h.x,h.y);if(Qe.length>0){var Se=f,Oe=Bs(Se,ro(o)),ke=Bs(Se,ro(Qe)),Pe=Oe;if(ke<Oe&&(o=Qe,Pe=ke),Qe.length>2){var Ge=Bs(Se,{x:Qe[2],y:Qe[3]});Ge<Pe&&(o=[Qe[2],Qe[3]])}}}var Je=af(o,F,s.arrowShapes[p].spacing(t)+y),Be=af(o,F,s.arrowShapes[p].gap(t)+y);if(C.endX=Be[0],C.endY=Be[1],C.arrowEndX=Je[0],C.arrowEndY=Je[1],V==="inside-to-node")o=[f.x,f.y];else if(R.units)o=this.manualEndptToPx(u,R);else if(V==="outside-to-line")o=C.srcIntn;else if(V==="outside-to-node"||V==="outside-to-node-or-label"?L=K:(V==="outside-to-line"||V==="outside-to-line-or-label")&&(L=[h.x,h.y]),o=s.nodeShapes[this.getNodeShape(u)].intersectLine(f.x,f.y,u.outerWidth(),u.outerHeight(),L[0],L[1],0,_,E),V==="outside-to-node-or-label"||V==="outside-to-line-or-label"){var nt=u._private.rscratch,ye=nt.labelWidth,$e=nt.labelHeight,et=nt.labelX,xe=nt.labelY,ze=ye/2,Re=$e/2,we=u.pstyle("text-valign").value;we==="top"?xe-=Re:we==="bottom"&&(xe+=Re);var $=u.pstyle("text-halign").value;$==="left"?et-=ze:$==="right"&&(et+=ze);var ce=rc(L[0],L[1],[et-ze,xe-Re,et+ze,xe-Re,et+ze,xe+Re,et-ze,xe+Re],f.x,f.y);if(ce.length>0){var ge=h,pe=Bs(ge,ro(o)),Ee=Bs(ge,ro(ce)),Ue=pe;if(Ee<pe&&(o=[ce[0],ce[1]],Ue=Ee),ce.length>2){var je=Bs(ge,{x:ce[2],y:ce[3]});je<Ue&&(o=[ce[2],ce[3]])}}}var He=af(o,K,s.arrowShapes[m].spacing(t)+x),_e=af(o,K,s.arrowShapes[m].gap(t)+x);C.startX=_e[0],C.startY=_e[1],C.arrowStartX=He[0],C.arrowStartY=He[1],P&&(!De(C.startX)||!De(C.startY)||!De(C.endX)||!De(C.endY)?C.badLine=!0:C.badLine=!1)};Oc.getSourceEndpoint=function(t){var e=t[0]._private.rscratch;switch(this.recalculateRenderedStyle(t),e.edgeType){case"haystack":return{x:e.haystackPts[0],y:e.haystackPts[1]};default:return{x:e.arrowStartX,y:e.arrowStartY}}};Oc.getTargetEndpoint=function(t){var e=t[0]._private.rscratch;switch(this.recalculateRenderedStyle(t),e.edgeType){case"haystack":return{x:e.haystackPts[2],y:e.haystackPts[3]};default:return{x:e.arrowEndX,y:e.arrowEndY}}};var oy={};function lL(t,e,r){for(var a=function(f,h,p,m){return Or(f,h,p,m)},i=e._private,s=i.rstyle.bezierPts,o=0;o<t.bezierProjPcts.length;o++){var u=t.bezierProjPcts[o];s.push({x:a(r[0],r[2],r[4],u),y:a(r[1],r[3],r[5],u)})}}oy.storeEdgeProjections=function(t){var e=t._private,r=e.rscratch,a=r.edgeType;if(e.rstyle.bezierPts=null,e.rstyle.linePts=null,e.rstyle.haystackPts=null,a==="multibezier"||a==="bezier"||a==="self"||a==="compound"){e.rstyle.bezierPts=[];for(var i=0;i+5<r.allpts.length;i+=4)lL(this,t,r.allpts.slice(i,i+6))}else if(a==="segments")for(var s=e.rstyle.linePts=[],i=0;i+1<r.allpts.length;i+=2)s.push({x:r.allpts[i],y:r.allpts[i+1]});else if(a==="haystack"){var o=r.haystackPts;e.rstyle.haystackPts=[{x:o[0],y:o[1]},{x:o[2],y:o[3]}]}e.rstyle.arrowWidth=this.getArrowWidth(t.pstyle("width").pfValue,t.pstyle("arrow-scale").value)*this.arrowShapeWidth};oy.recalculateEdgeProjections=function(t){this.findEdgeControlPoints(t)};var Cn={};Cn.recalculateNodeLabelProjection=function(t){var e=t.pstyle("label").strValue;if(!rs(e)){var r,a,i=t._private,s=t.width(),o=t.height(),u=t.padding(),d=t.position(),f=t.pstyle("text-halign").strValue,h=t.pstyle("text-valign").strValue,p=i.rscratch,m=i.rstyle;switch(f){case"left":r=d.x-s/2-u;break;case"right":r=d.x+s/2+u;break;default:r=d.x}switch(h){case"top":a=d.y-o/2-u;break;case"bottom":a=d.y+o/2+u;break;default:a=d.y}p.labelX=r,p.labelY=a,m.labelX=r,m.labelY=a,this.calculateLabelAngles(t),this.applyLabelDimensions(t)}};var hN=function(e,r){var a=Math.atan(r/e);return e===0&&a<0&&(a=a*-1),a},vN=function(e,r){var a=r.x-e.x,i=r.y-e.y;return hN(a,i)},oL=function(e,r,a,i){var s=tc(0,i-.001,1),o=tc(0,i+.001,1),u=lo(e,r,a,s),d=lo(e,r,a,o);return vN(u,d)};Cn.recalculateEdgeLabelProjections=function(t){var e,r=t._private,a=r.rscratch,i=this,s={mid:t.pstyle("label").strValue,source:t.pstyle("source-label").strValue,target:t.pstyle("target-label").strValue};if(s.mid||s.source||s.target){e={x:a.midX,y:a.midY};var o=function(p,m,y){Qn(r.rscratch,p,m,y),Qn(r.rstyle,p,m,y)};o("labelX",null,e.x),o("labelY",null,e.y);var u=hN(a.midDispX,a.midDispY);o("labelAutoAngle",null,u);var d=function(){if(d.cache)return d.cache;for(var p=[],m=0;m+5<a.allpts.length;m+=4){var y={x:a.allpts[m],y:a.allpts[m+1]},x={x:a.allpts[m+2],y:a.allpts[m+3]},E={x:a.allpts[m+4],y:a.allpts[m+5]};p.push({p0:y,p1:x,p2:E,startDist:0,length:0,segments:[]})}var w=r.rstyle.bezierPts,T=i.bezierProjPcts.length;function C(j,k,B,P,U){var R=Js(k,B),V=j.segments[j.segments.length-1],_={p0:k,p1:B,t0:P,t1:U,startDist:V?V.startDist+V.length:0,length:R};j.segments.push(_),j.length+=R}for(var N=0;N<p.length;N++){var A=p[N],D=p[N-1];D&&(A.startDist=D.startDist+D.length),C(A,A.p0,w[N*T],0,i.bezierProjPcts[0]);for(var M=0;M<T-1;M++)C(A,w[N*T+M],w[N*T+M+1],i.bezierProjPcts[M],i.bezierProjPcts[M+1]);C(A,w[N*T+T-1],A.p2,i.bezierProjPcts[T-1],1)}return d.cache=p},f=function(p){var m,y=p==="source";if(s[p]){var x=t.pstyle(p+"-text-offset").pfValue;switch(a.edgeType){case"self":case"compound":case"bezier":case"multibezier":{for(var E=d(),w,T=0,C=0,N=0;N<E.length;N++){for(var A=E[y?N:E.length-1-N],D=0;D<A.segments.length;D++){var M=A.segments[y?D:A.segments.length-1-D],j=N===E.length-1&&D===A.segments.length-1;if(T=C,C+=M.length,C>=x||j){w={cp:A,segment:M};break}}if(w)break}var k=w.cp,B=w.segment,P=(x-T)/B.length,U=B.t1-B.t0,R=y?B.t0+U*P:B.t1-U*P;R=tc(0,R,1),e=lo(k.p0,k.p1,k.p2,R),m=oL(k.p0,k.p1,k.p2,R);break}case"straight":case"segments":case"haystack":{for(var V=0,_,H,z,I,F=a.allpts.length,K=0;K+3<F&&(y?(z={x:a.allpts[K],y:a.allpts[K+1]},I={x:a.allpts[K+2],y:a.allpts[K+3]}):(z={x:a.allpts[F-2-K],y:a.allpts[F-1-K]},I={x:a.allpts[F-4-K],y:a.allpts[F-3-K]}),_=Js(z,I),H=V,V+=_,!(V>=x));K+=2);var J=x-H,L=J/_;L=tc(0,L,1),e=kO(z,I,L),m=vN(z,I);break}}o("labelX",p,e.x),o("labelY",p,e.y),o("labelAutoAngle",p,m)}};f("source"),f("target"),this.applyLabelDimensions(t)}};Cn.applyLabelDimensions=function(t){this.applyPrefixedLabelDimensions(t),t.isEdge()&&(this.applyPrefixedLabelDimensions(t,"source"),this.applyPrefixedLabelDimensions(t,"target"))};Cn.applyPrefixedLabelDimensions=function(t,e){var r=t._private,a=this.getLabelText(t,e),i=Ws(a,t._private.labelDimsKey);if(ga(r.rscratch,"prefixedLabelDimsKey",e)!==i){Qn(r.rscratch,"prefixedLabelDimsKey",e,i);var s=this.calculateLabelDimensions(t,a),o=t.pstyle("line-height").pfValue,u=t.pstyle("text-wrap").strValue,d=ga(r.rscratch,"labelWrapCachedLines",e)||[],f=u!=="wrap"?1:Math.max(d.length,1),h=s.height/f,p=h*o,m=s.width,y=s.height+(f-1)*(o-1)*h;Qn(r.rstyle,"labelWidth",e,m),Qn(r.rscratch,"labelWidth",e,m),Qn(r.rstyle,"labelHeight",e,y),Qn(r.rscratch,"labelHeight",e,y),Qn(r.rscratch,"labelLineHeight",e,p)}};Cn.getLabelText=function(t,e){var r=t._private,a=e?e+"-":"",i=t.pstyle(a+"label").strValue,s=t.pstyle("text-transform").value,o=function(X,W){return W?(Qn(r.rscratch,X,e,W),W):ga(r.rscratch,X,e)};if(!i)return"";s=="none"||(s=="uppercase"?i=i.toUpperCase():s=="lowercase"&&(i=i.toLowerCase()));var u=t.pstyle("text-wrap").value;if(u==="wrap"){var d=o("labelKey");if(d!=null&&o("labelWrapKey")===d)return o("labelWrapCachedText");for(var f="​",h=i.split(`
93
+ `),p=t.pstyle("text-max-width").pfValue,m=t.pstyle("text-overflow-wrap").value,y=m==="anywhere",x=[],E=/[\s\u200b]+|$/g,w=0;w<h.length;w++){var T=h[w],C=this.calculateLabelDimensions(t,T),N=C.width;if(y){var A=T.split("").join(f);T=A}if(N>p){var D=T.matchAll(E),M="",j=0,k=xa(D),B;try{for(k.s();!(B=k.n()).done;){var P=B.value,U=P[0],R=T.substring(j,P.index);j=P.index+U.length;var V=M.length===0?R:M+R+U,_=this.calculateLabelDimensions(t,V),H=_.width;H<=p?M+=R+U:(M&&x.push(M),M=R+U)}}catch(Q){k.e(Q)}finally{k.f()}M.match(/^[\s\u200b]+$/)||x.push(M)}else x.push(T)}o("labelWrapCachedLines",x),i=o("labelWrapCachedText",x.join(`
94
+ `)),o("labelWrapKey",d)}else if(u==="ellipsis"){var z=t.pstyle("text-max-width").pfValue,I="",F="…",K=!1;if(this.calculateLabelDimensions(t,i).width<z)return i;for(var J=0;J<i.length;J++){var L=this.calculateLabelDimensions(t,I+i[J]+F).width;if(L>z)break;I+=i[J],J===i.length-1&&(K=!0)}return K||(I+=F),I}return i};Cn.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};Cn.calculateLabelDimensions=function(t,e){var r=this,a=r.cy.window(),i=a.document,s=0,o=t.pstyle("font-style").strValue,u=t.pstyle("font-size").pfValue,d=t.pstyle("font-family").strValue,f=t.pstyle("font-weight").strValue,h=this.labelCalcCanvas,p=this.labelCalcCanvasContext;if(!h){h=this.labelCalcCanvas=i.createElement("canvas"),p=this.labelCalcCanvasContext=h.getContext("2d");var m=h.style;m.position="absolute",m.left="-9999px",m.top="-9999px",m.zIndex="-1",m.visibility="hidden",m.pointerEvents="none"}p.font="".concat(o," ").concat(f," ").concat(u,"px ").concat(d);for(var y=0,x=0,E=e.split(`
95
+ `),w=0;w<E.length;w++){var T=E[w],C=p.measureText(T),N=Math.ceil(C.width),A=u;y=Math.max(N,y),x+=A}return y+=s,x+=s,{width:y,height:x}};Cn.calculateLabelAngle=function(t,e){var r=t._private,a=r.rscratch,i=t.isEdge(),s=e?e+"-":"",o=t.pstyle(s+"text-rotation"),u=o.strValue;return u==="none"?0:i&&u==="autorotate"?a.labelAutoAngle:u==="autorotate"?0:o.pfValue};Cn.calculateLabelAngles=function(t){var e=this,r=t.isEdge(),a=t._private,i=a.rscratch;i.labelAngle=e.calculateLabelAngle(t),r&&(i.sourceLabelAngle=e.calculateLabelAngle(t,"source"),i.targetLabelAngle=e.calculateLabelAngle(t,"target"))};var pN={},ZS=28,WS=!1;pN.getNodeShape=function(t){var e=this,r=t.pstyle("shape").value;if(r==="cutrectangle"&&(t.width()<ZS||t.height()<ZS))return WS||(At("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),WS=!0),"rectangle";if(t.isParent())return r==="rectangle"||r==="roundrectangle"||r==="round-rectangle"||r==="cutrectangle"||r==="cut-rectangle"||r==="barrel"?r:"rectangle";if(r==="polygon"){var a=t.pstyle("shape-polygon-points").value;return e.nodeShapes.makePolygon(a).name}return r};var bh={};bh.registerCalculationListeners=function(){var t=this.cy,e=t.collection(),r=this,a=function(o){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e.merge(o),u)for(var d=0;d<o.length;d++){var f=o[d],h=f._private,p=h.rstyle;p.clean=!1,p.cleanConnected=!1}};r.binder(t).on("bounds.* dirty.*",function(o){var u=o.target;a(u)}).on("style.* background.*",function(o){var u=o.target;a(u,!1)});var i=function(o){if(o){var u=r.onUpdateEleCalcsFns;e.cleanStyle();for(var d=0;d<e.length;d++){var f=e[d],h=f._private.rstyle;f.isNode()&&!h.cleanConnected&&(a(f.connectedEdges()),h.cleanConnected=!0)}if(u)for(var p=0;p<u.length;p++){var m=u[p];m(o,e)}r.recalculateRenderedStyle(e),e=t.collection()}};r.flushRenderedStyleQueue=function(){i(!0)},r.beforeRender(i,r.beforeRenderPriorities.eleCalcs)};bh.onUpdateEleCalcs=function(t){var e=this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[];e.push(t)};bh.recalculateRenderedStyle=function(t,e){var r=function(A){return A._private.rstyle.cleanConnected};if(t.length!==0){var a=[],i=[];if(!this.destroyed){e===void 0&&(e=!0);for(var s=0;s<t.length;s++){var o=t[s],u=o._private,d=u.rstyle;o.isEdge()&&(!r(o.source())||!r(o.target()))&&(d.clean=!1),o.isEdge()&&o.isBundledBezier()&&o.parallelEdges().some(function(N){return!N._private.rstyle.clean&&N.isBundledBezier()})&&(d.clean=!1),!(e&&d.clean||o.removed())&&o.pstyle("display").value!=="none"&&(u.group==="nodes"?i.push(o):a.push(o),d.clean=!0)}for(var f=0;f<i.length;f++){var h=i[f],p=h._private,m=p.rstyle,y=h.position();this.recalculateNodeLabelProjection(h),m.nodeX=y.x,m.nodeY=y.y,m.nodeW=h.pstyle("width").pfValue,m.nodeH=h.pstyle("height").pfValue}this.recalculateEdgeProjections(a);for(var x=0;x<a.length;x++){var E=a[x],w=E._private,T=w.rstyle,C=w.rscratch;T.srcX=C.arrowStartX,T.srcY=C.arrowStartY,T.tgtX=C.arrowEndX,T.tgtY=C.arrowEndY,T.midX=C.midX,T.midY=C.midY,T.labelAngle=C.labelAngle,T.sourceLabelAngle=C.sourceLabelAngle,T.targetLabelAngle=C.targetLabelAngle}}}};var wh={};wh.updateCachedGrabbedEles=function(){var t=this.cachedZSortedEles;if(t){t.drag=[],t.nondrag=[];for(var e=[],r=0;r<t.length;r++){var a=t[r],i=a._private.rscratch;a.grabbed()&&!a.isParent()?e.push(a):i.inDragLayer?t.drag.push(a):t.nondrag.push(a)}for(var r=0;r<e.length;r++){var a=e[r];t.drag.push(a)}}};wh.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null};wh.getCachedZSortedEles=function(t){if(t||!this.cachedZSortedEles){var e=this.cy.mutableElements().toArray();e.sort(XC),e.interactive=e.filter(function(r){return r.interactive()}),this.cachedZSortedEles=e,this.updateCachedGrabbedEles()}else e=this.cachedZSortedEles;return e};var gN={};[ul,Qf,Wr,Oc,oy,Cn,pN,bh,wh].forEach(function(t){tt(gN,t)});var mN={};mN.getCachedImage=function(t,e,r){var a=this,i=a.imageCache=a.imageCache||{},s=i[t];if(s)return s.image.complete||s.image.addEventListener("load",r),s.image;s=i[t]=i[t]||{};var o=s.image=new Image;o.addEventListener("load",r),o.addEventListener("error",function(){o.error=!0});var u="data:",d=t.substring(0,u.length).toLowerCase()===u;return d||(e=e==="null"?null:e,o.crossOrigin=e),o.src=t,o};var _o={};_o.registerBinding=function(t,e,r,a){var i=Array.prototype.slice.apply(arguments,[1]);if(Array.isArray(t)){for(var s=[],o=0;o<t.length;o++){var u=t[o];if(u!==void 0){var d=this.binder(u);s.push(d.on.apply(d,i))}}return s}var d=this.binder(t);return d.on.apply(d,i)};_o.binder=function(t){var e=this,r=e.cy.window(),a=t===r||t===r.document||t===r.document.body||bD(t);if(e.supportsPassiveEvents==null){var i=!1;try{var s=Object.defineProperty({},"passive",{get:function(){return i=!0,!0}});r.addEventListener("test",null,s)}catch{}e.supportsPassiveEvents=i}var o=function(d,f,h){var p=Array.prototype.slice.call(arguments);return a&&e.supportsPassiveEvents&&(p[2]={capture:h??!1,passive:!1,once:!1}),e.bindings.push({target:t,args:p}),(t.addEventListener||t.on).apply(t,p),this};return{on:o,addEventListener:o,addListener:o,bind:o}};_o.nodeIsDraggable=function(t){return t&&t.isNode()&&!t.locked()&&t.grabbable()};_o.nodeIsGrabbable=function(t){return this.nodeIsDraggable(t)&&t.interactive()};_o.load=function(){var t=this,e=t.cy.window(),r=function($){return $.selected()},a=function($){var ce=$.getRootNode();if(ce&&ce.nodeType===11&&ce.host!==void 0)return ce},i=function($,ce,ge,pe){$==null&&($=t.cy);for(var Ee=0;Ee<ce.length;Ee++){var Ue=ce[Ee];$.emit({originalEvent:ge,type:Ue,position:pe})}},s=function($){return $.shiftKey||$.metaKey||$.ctrlKey},o=function($,ce){var ge=!0;if(t.cy.hasCompoundNodes()&&$&&$.pannable())for(var pe=0;ce&&pe<ce.length;pe++){var $=ce[pe];if($.isNode()&&$.isParent()&&!$.pannable()){ge=!1;break}}else ge=!0;return ge},u=function($){$[0]._private.grabbed=!0},d=function($){$[0]._private.grabbed=!1},f=function($){$[0]._private.rscratch.inDragLayer=!0},h=function($){$[0]._private.rscratch.inDragLayer=!1},p=function($){$[0]._private.rscratch.isGrabTarget=!0},m=function($){$[0]._private.rscratch.isGrabTarget=!1},y=function($,ce){var ge=ce.addToList,pe=ge.has($);!pe&&$.grabbable()&&!$.locked()&&(ge.merge($),u($))},x=function($,ce){if($.cy().hasCompoundNodes()&&!(ce.inDragLayer==null&&ce.addToList==null)){var ge=$.descendants();ce.inDragLayer&&(ge.forEach(f),ge.connectedEdges().forEach(f)),ce.addToList&&y(ge,ce)}},E=function($,ce){ce=ce||{};var ge=$.cy().hasCompoundNodes();ce.inDragLayer&&($.forEach(f),$.neighborhood().stdFilter(function(pe){return!ge||pe.isEdge()}).forEach(f)),ce.addToList&&$.forEach(function(pe){y(pe,ce)}),x($,ce),C($,{inDragLayer:ce.inDragLayer}),t.updateCachedGrabbedEles()},w=E,T=function($){$&&(t.getCachedZSortedEles().forEach(function(ce){d(ce),h(ce),m(ce)}),t.updateCachedGrabbedEles())},C=function($,ce){if(!(ce.inDragLayer==null&&ce.addToList==null)&&$.cy().hasCompoundNodes()){var ge=$.ancestors().orphans();if(!ge.same($)){var pe=ge.descendants().spawnSelf().merge(ge).unmerge($).unmerge($.descendants()),Ee=pe.connectedEdges();ce.inDragLayer&&(Ee.forEach(f),pe.forEach(f)),ce.addToList&&pe.forEach(function(Ue){y(Ue,ce)})}}},N=function(){document.activeElement!=null&&document.activeElement.blur!=null&&document.activeElement.blur()},A=typeof MutationObserver<"u",D=typeof ResizeObserver<"u";A?(t.removeObserver=new MutationObserver(function(we){for(var $=0;$<we.length;$++){var ce=we[$],ge=ce.removedNodes;if(ge)for(var pe=0;pe<ge.length;pe++){var Ee=ge[pe];if(Ee===t.container){t.destroy();break}}}}),t.container.parentNode&&t.removeObserver.observe(t.container.parentNode,{childList:!0})):t.registerBinding(t.container,"DOMNodeRemoved",function(we){t.destroy()});var M=Ac(function(){t.cy.resize()},100);A&&(t.styleObserver=new MutationObserver(M),t.styleObserver.observe(t.container,{attributes:!0})),t.registerBinding(e,"resize",M),D&&(t.resizeObserver=new ResizeObserver(M),t.resizeObserver.observe(t.container));var j=function($,ce){for(;$!=null;)ce($),$=$.parentNode},k=function(){t.invalidateContainerClientCoordsCache()};j(t.container,function(we){t.registerBinding(we,"transitionend",k),t.registerBinding(we,"animationend",k),t.registerBinding(we,"scroll",k)}),t.registerBinding(t.container,"contextmenu",function(we){we.preventDefault()});var B=function(){return t.selection[4]!==0},P=function($){for(var ce=t.findContainerClientCoords(),ge=ce[0],pe=ce[1],Ee=ce[2],Ue=ce[3],je=$.touches?$.touches:[$],He=!1,_e=0;_e<je.length;_e++){var Ke=je[_e];if(ge<=Ke.clientX&&Ke.clientX<=ge+Ee&&pe<=Ke.clientY&&Ke.clientY<=pe+Ue){He=!0;break}}if(!He)return!1;for(var it=t.container,st=$.target,Ve=st.parentNode,dt=!1;Ve;){if(Ve===it){dt=!0;break}Ve=Ve.parentNode}return!!dt};t.registerBinding(t.container,"mousedown",function($){if(P($)&&!(t.hoverData.which===1&&$.which!==1)){$.preventDefault(),N(),t.hoverData.capture=!0,t.hoverData.which=$.which;var ce=t.cy,ge=[$.clientX,$.clientY],pe=t.projectIntoViewport(ge[0],ge[1]),Ee=t.selection,Ue=t.findNearestElements(pe[0],pe[1],!0,!1),je=Ue[0],He=t.dragData.possibleDragElements;t.hoverData.mdownPos=pe,t.hoverData.mdownGPos=ge;var _e=function(ut){return{originalEvent:$,type:ut,position:{x:pe[0],y:pe[1]}}},Ke=function(){t.hoverData.tapholdCancelled=!1,clearTimeout(t.hoverData.tapholdTimeout),t.hoverData.tapholdTimeout=setTimeout(function(){if(!t.hoverData.tapholdCancelled){var ut=t.hoverData.down;ut?ut.emit(_e("taphold")):ce.emit(_e("taphold"))}},t.tapholdDuration)};if($.which==3){t.hoverData.cxtStarted=!0;var it={originalEvent:$,type:"cxttapstart",position:{x:pe[0],y:pe[1]}};je?(je.activate(),je.emit(it),t.hoverData.down=je):ce.emit(it),t.hoverData.downTime=new Date().getTime(),t.hoverData.cxtDragged=!1}else if($.which==1){je&&je.activate();{if(je!=null&&t.nodeIsGrabbable(je)){var st=function(ut){ut.emit(_e("grab"))};if(p(je),!je.selected())He=t.dragData.possibleDragElements=ce.collection(),w(je,{addToList:He}),je.emit(_e("grabon")).emit(_e("grab"));else{He=t.dragData.possibleDragElements=ce.collection();var Ve=ce.$(function(dt){return dt.isNode()&&dt.selected()&&t.nodeIsGrabbable(dt)});E(Ve,{addToList:He}),je.emit(_e("grabon")),Ve.forEach(st)}t.redrawHint("eles",!0),t.redrawHint("drag",!0)}t.hoverData.down=je,t.hoverData.downs=Ue,t.hoverData.downTime=new Date().getTime()}i(je,["mousedown","tapstart","vmousedown"],$,{x:pe[0],y:pe[1]}),je==null?(Ee[4]=1,t.data.bgActivePosistion={x:pe[0],y:pe[1]},t.redrawHint("select",!0),t.redraw()):je.pannable()&&(Ee[4]=1),Ke()}Ee[0]=Ee[2]=pe[0],Ee[1]=Ee[3]=pe[1]}},!1);var U=a(t.container);t.registerBinding([e,U],"mousemove",function($){var ce=t.hoverData.capture;if(!(!ce&&!P($))){var ge=!1,pe=t.cy,Ee=pe.zoom(),Ue=[$.clientX,$.clientY],je=t.projectIntoViewport(Ue[0],Ue[1]),He=t.hoverData.mdownPos,_e=t.hoverData.mdownGPos,Ke=t.selection,it=null;!t.hoverData.draggingEles&&!t.hoverData.dragging&&!t.hoverData.selecting&&(it=t.findNearestElement(je[0],je[1],!0,!1));var st=t.hoverData.last,Ve=t.hoverData.down,dt=[je[0]-Ke[2],je[1]-Ke[3]],ut=t.dragData.possibleDragElements,Yt;if(_e){var Ot=Ue[0]-_e[0],Lr=Ot*Ot,Kt=Ue[1]-_e[1],sr=Kt*Kt,Jt=Lr+sr;t.hoverData.isOverThresholdDrag=Yt=Jt>=t.desktopTapThreshold2}var lr=s($);Yt&&(t.hoverData.tapholdCancelled=!0);var Ra=function(){var Ar=t.hoverData.dragDelta=t.hoverData.dragDelta||[];Ar.length===0?(Ar.push(dt[0]),Ar.push(dt[1])):(Ar[0]+=dt[0],Ar[1]+=dt[1])};ge=!0,i(it,["mousemove","vmousemove","tapdrag"],$,{x:je[0],y:je[1]});var Xt=function(Ar){return{originalEvent:$,type:Ar,position:{x:je[0],y:je[1]}}},Ba=function(){t.data.bgActivePosistion=void 0,t.hoverData.selecting||pe.emit(Xt("boxstart")),Ke[4]=1,t.hoverData.selecting=!0,t.redrawHint("select",!0),t.redraw()};if(t.hoverData.which===3){if(Yt){var Cr=Xt("cxtdrag");Ve?Ve.emit(Cr):pe.emit(Cr),t.hoverData.cxtDragged=!0,(!t.hoverData.cxtOver||it!==t.hoverData.cxtOver)&&(t.hoverData.cxtOver&&t.hoverData.cxtOver.emit(Xt("cxtdragout")),t.hoverData.cxtOver=it,it&&it.emit(Xt("cxtdragover")))}}else if(t.hoverData.dragging){if(ge=!0,pe.panningEnabled()&&pe.userPanningEnabled()){var Ht;if(t.hoverData.justStartedPan){var xr=t.hoverData.mdownPos;Ht={x:(je[0]-xr[0])*Ee,y:(je[1]-xr[1])*Ee},t.hoverData.justStartedPan=!1}else Ht={x:dt[0]*Ee,y:dt[1]*Ee};pe.panBy(Ht),pe.emit(Xt("dragpan")),t.hoverData.dragged=!0}je=t.projectIntoViewport($.clientX,$.clientY)}else if(Ke[4]==1&&(Ve==null||Ve.pannable())){if(Yt){if(!t.hoverData.dragging&&pe.boxSelectionEnabled()&&(lr||!pe.panningEnabled()||!pe.userPanningEnabled()))Ba();else if(!t.hoverData.selecting&&pe.panningEnabled()&&pe.userPanningEnabled()){var sa=o(Ve,t.hoverData.downs);sa&&(t.hoverData.dragging=!0,t.hoverData.justStartedPan=!0,Ke[4]=0,t.data.bgActivePosistion=ro(He),t.redrawHint("select",!0),t.redraw())}Ve&&Ve.pannable()&&Ve.active()&&Ve.unactivate()}}else{if(Ve&&Ve.pannable()&&Ve.active()&&Ve.unactivate(),(!Ve||!Ve.grabbed())&&it!=st&&(st&&i(st,["mouseout","tapdragout"],$,{x:je[0],y:je[1]}),it&&i(it,["mouseover","tapdragover"],$,{x:je[0],y:je[1]}),t.hoverData.last=it),Ve)if(Yt){if(pe.boxSelectionEnabled()&&lr)Ve&&Ve.grabbed()&&(T(ut),Ve.emit(Xt("freeon")),ut.emit(Xt("free")),t.dragData.didDrag&&(Ve.emit(Xt("dragfreeon")),ut.emit(Xt("dragfree")))),Ba();else if(Ve&&Ve.grabbed()&&t.nodeIsDraggable(Ve)){var Nr=!t.dragData.didDrag;Nr&&t.redrawHint("eles",!0),t.dragData.didDrag=!0,t.hoverData.draggingEles||E(ut,{inDragLayer:!0});var jr={x:0,y:0};if(De(dt[0])&&De(dt[1])&&(jr.x+=dt[0],jr.y+=dt[1],Nr)){var Gr=t.hoverData.dragDelta;Gr&&De(Gr[0])&&De(Gr[1])&&(jr.x+=Gr[0],jr.y+=Gr[1])}t.hoverData.draggingEles=!0,ut.silentShift(jr).emit(Xt("position")).emit(Xt("drag")),t.redrawHint("drag",!0),t.redraw()}}else Ra();ge=!0}if(Ke[2]=je[0],Ke[3]=je[1],ge)return $.stopPropagation&&$.stopPropagation(),$.preventDefault&&$.preventDefault(),!1}},!1);var R,V,_;t.registerBinding(e,"mouseup",function($){if(!(t.hoverData.which===1&&$.which!==1&&t.hoverData.capture)){var ce=t.hoverData.capture;if(ce){t.hoverData.capture=!1;var ge=t.cy,pe=t.projectIntoViewport($.clientX,$.clientY),Ee=t.selection,Ue=t.findNearestElement(pe[0],pe[1],!0,!1),je=t.dragData.possibleDragElements,He=t.hoverData.down,_e=s($);t.data.bgActivePosistion&&(t.redrawHint("select",!0),t.redraw()),t.hoverData.tapholdCancelled=!0,t.data.bgActivePosistion=void 0,He&&He.unactivate();var Ke=function(Ot){return{originalEvent:$,type:Ot,position:{x:pe[0],y:pe[1]}}};if(t.hoverData.which===3){var it=Ke("cxttapend");if(He?He.emit(it):ge.emit(it),!t.hoverData.cxtDragged){var st=Ke("cxttap");He?He.emit(st):ge.emit(st)}t.hoverData.cxtDragged=!1,t.hoverData.which=null}else if(t.hoverData.which===1){if(i(Ue,["mouseup","tapend","vmouseup"],$,{x:pe[0],y:pe[1]}),!t.dragData.didDrag&&!t.hoverData.dragged&&!t.hoverData.selecting&&!t.hoverData.isOverThresholdDrag&&(i(He,["click","tap","vclick"],$,{x:pe[0],y:pe[1]}),V=!1,$.timeStamp-_<=ge.multiClickDebounceTime()?(R&&clearTimeout(R),V=!0,_=null,i(He,["dblclick","dbltap","vdblclick"],$,{x:pe[0],y:pe[1]})):(R=setTimeout(function(){V||i(He,["oneclick","onetap","voneclick"],$,{x:pe[0],y:pe[1]})},ge.multiClickDebounceTime()),_=$.timeStamp)),He==null&&!t.dragData.didDrag&&!t.hoverData.selecting&&!t.hoverData.dragged&&!s($)&&(ge.$(r).unselect(["tapunselect"]),je.length>0&&t.redrawHint("eles",!0),t.dragData.possibleDragElements=je=ge.collection()),Ue==He&&!t.dragData.didDrag&&!t.hoverData.selecting&&Ue!=null&&Ue._private.selectable&&(t.hoverData.dragging||(ge.selectionType()==="additive"||_e?Ue.selected()?Ue.unselect(["tapunselect"]):Ue.select(["tapselect"]):_e||(ge.$(r).unmerge(Ue).unselect(["tapunselect"]),Ue.select(["tapselect"]))),t.redrawHint("eles",!0)),t.hoverData.selecting){var Ve=ge.collection(t.getAllInBox(Ee[0],Ee[1],Ee[2],Ee[3]));t.redrawHint("select",!0),Ve.length>0&&t.redrawHint("eles",!0),ge.emit(Ke("boxend"));var dt=function(Ot){return Ot.selectable()&&!Ot.selected()};ge.selectionType()==="additive"||_e||ge.$(r).unmerge(Ve).unselect(),Ve.emit(Ke("box")).stdFilter(dt).select().emit(Ke("boxselect")),t.redraw()}if(t.hoverData.dragging&&(t.hoverData.dragging=!1,t.redrawHint("select",!0),t.redrawHint("eles",!0),t.redraw()),!Ee[4]){t.redrawHint("drag",!0),t.redrawHint("eles",!0);var ut=He&&He.grabbed();T(je),ut&&(He.emit(Ke("freeon")),je.emit(Ke("free")),t.dragData.didDrag&&(He.emit(Ke("dragfreeon")),je.emit(Ke("dragfree"))))}}Ee[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 H=[],z=4,I,F=1e5,K=function($,ce){for(var ge=0;ge<$.length;ge++)if($[ge]%ce!==0)return!1;return!0},J=function($){for(var ce=Math.abs($[0]),ge=1;ge<$.length;ge++)if(Math.abs($[ge])!==ce)return!1;return!0},L=function($){var ce=!1,ge=$.deltaY;if(ge==null&&($.wheelDeltaY!=null?ge=$.wheelDeltaY/4:$.wheelDelta!=null&&(ge=$.wheelDelta/4)),ge!==0){if(I==null)if(H.length>=z){var pe=H;if(I=K(pe,5),!I){var Ee=Math.abs(pe[0]);I=J(pe)&&Ee>5}if(I)for(var Ue=0;Ue<pe.length;Ue++)F=Math.min(Math.abs(pe[Ue]),F)}else H.push(ge),ce=!0;else I&&(F=Math.min(Math.abs(ge),F));if(!t.scrollingPage){var je=t.cy,He=je.zoom(),_e=je.pan(),Ke=t.projectIntoViewport($.clientX,$.clientY),it=[Ke[0]*He+_e.x,Ke[1]*He+_e.y];if(t.hoverData.draggingEles||t.hoverData.dragging||t.hoverData.cxtStarted||B()){$.preventDefault();return}if(je.panningEnabled()&&je.userPanningEnabled()&&je.zoomingEnabled()&&je.userZoomingEnabled()){$.preventDefault(),t.data.wheelZooming=!0,clearTimeout(t.data.wheelTimeout),t.data.wheelTimeout=setTimeout(function(){t.data.wheelZooming=!1,t.redrawHint("eles",!0),t.redraw()},150);var st;ce&&Math.abs(ge)>5&&(ge=Ym(ge)*5),st=ge/-250,I&&(st/=F,st*=3),st=st*t.wheelSensitivity;var Ve=$.deltaMode===1;Ve&&(st*=33);var dt=je.zoom()*Math.pow(10,st);$.type==="gesturechange"&&(dt=t.gestureStartZoom*$.scale),je.zoom({level:dt,renderedPosition:{x:it[0],y:it[1]}}),je.emit({type:$.type==="gesturechange"?"pinchzoom":"scrollzoom",originalEvent:$,position:{x:Ke[0],y:Ke[1]}})}}}};t.registerBinding(t.container,"wheel",L,!0),t.registerBinding(e,"scroll",function($){t.scrollingPage=!0,clearTimeout(t.scrollingPageTimeout),t.scrollingPageTimeout=setTimeout(function(){t.scrollingPage=!1},250)},!0),t.registerBinding(t.container,"gesturestart",function($){t.gestureStartZoom=t.cy.zoom(),t.hasTouchStarted||$.preventDefault()},!0),t.registerBinding(t.container,"gesturechange",function(we){t.hasTouchStarted||L(we)},!0),t.registerBinding(t.container,"mouseout",function($){var ce=t.projectIntoViewport($.clientX,$.clientY);t.cy.emit({originalEvent:$,type:"mouseout",position:{x:ce[0],y:ce[1]}})},!1),t.registerBinding(t.container,"mouseover",function($){var ce=t.projectIntoViewport($.clientX,$.clientY);t.cy.emit({originalEvent:$,type:"mouseover",position:{x:ce[0],y:ce[1]}})},!1);var Q,X,W,te,Y,ne,he,oe,ae,re,le,se,Ne,Ae=function($,ce,ge,pe){return Math.sqrt((ge-$)*(ge-$)+(pe-ce)*(pe-ce))},Ze=function($,ce,ge,pe){return(ge-$)*(ge-$)+(pe-ce)*(pe-ce)},Qe;t.registerBinding(t.container,"touchstart",Qe=function($){if(t.hasTouchStarted=!0,!!P($)){N(),t.touchData.capture=!0,t.data.bgActivePosistion=void 0;var ce=t.cy,ge=t.touchData.now,pe=t.touchData.earlier;if($.touches[0]){var Ee=t.projectIntoViewport($.touches[0].clientX,$.touches[0].clientY);ge[0]=Ee[0],ge[1]=Ee[1]}if($.touches[1]){var Ee=t.projectIntoViewport($.touches[1].clientX,$.touches[1].clientY);ge[2]=Ee[0],ge[3]=Ee[1]}if($.touches[2]){var Ee=t.projectIntoViewport($.touches[2].clientX,$.touches[2].clientY);ge[4]=Ee[0],ge[5]=Ee[1]}var Ue=function(lr){return{originalEvent:$,type:lr,position:{x:ge[0],y:ge[1]}}};if($.touches[1]){t.touchData.singleTouchMoved=!0,T(t.dragData.touchDragEles);var je=t.findContainerClientCoords();ae=je[0],re=je[1],le=je[2],se=je[3],Q=$.touches[0].clientX-ae,X=$.touches[0].clientY-re,W=$.touches[1].clientX-ae,te=$.touches[1].clientY-re,Ne=0<=Q&&Q<=le&&0<=W&&W<=le&&0<=X&&X<=se&&0<=te&&te<=se;var He=ce.pan(),_e=ce.zoom();Y=Ae(Q,X,W,te),ne=Ze(Q,X,W,te),he=[(Q+W)/2,(X+te)/2],oe=[(he[0]-He.x)/_e,(he[1]-He.y)/_e];var Ke=200,it=Ke*Ke;if(ne<it&&!$.touches[2]){var st=t.findNearestElement(ge[0],ge[1],!0,!0),Ve=t.findNearestElement(ge[2],ge[3],!0,!0);st&&st.isNode()?(st.activate().emit(Ue("cxttapstart")),t.touchData.start=st):Ve&&Ve.isNode()?(Ve.activate().emit(Ue("cxttapstart")),t.touchData.start=Ve):ce.emit(Ue("cxttapstart")),t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxt=!0,t.touchData.cxtDragged=!1,t.data.bgActivePosistion=void 0,t.redraw();return}}if($.touches[2])ce.boxSelectionEnabled()&&$.preventDefault();else if(!$.touches[1]){if($.touches[0]){var dt=t.findNearestElements(ge[0],ge[1],!0,!0),ut=dt[0];if(ut!=null&&(ut.activate(),t.touchData.start=ut,t.touchData.starts=dt,t.nodeIsGrabbable(ut))){var Yt=t.dragData.touchDragEles=ce.collection(),Ot=null;t.redrawHint("eles",!0),t.redrawHint("drag",!0),ut.selected()?(Ot=ce.$(function(Jt){return Jt.selected()&&t.nodeIsGrabbable(Jt)}),E(Ot,{addToList:Yt})):w(ut,{addToList:Yt}),p(ut),ut.emit(Ue("grabon")),Ot?Ot.forEach(function(Jt){Jt.emit(Ue("grab"))}):ut.emit(Ue("grab"))}i(ut,["touchstart","tapstart","vmousedown"],$,{x:ge[0],y:ge[1]}),ut==null&&(t.data.bgActivePosistion={x:Ee[0],y:Ee[1]},t.redrawHint("select",!0),t.redraw()),t.touchData.singleTouchMoved=!1,t.touchData.singleTouchStartTime=+new Date,clearTimeout(t.touchData.tapholdTimeout),t.touchData.tapholdTimeout=setTimeout(function(){t.touchData.singleTouchMoved===!1&&!t.pinching&&!t.touchData.selecting&&i(t.touchData.start,["taphold"],$,{x:ge[0],y:ge[1]})},t.tapholdDuration)}}if($.touches.length>=1){for(var Lr=t.touchData.startPosition=[null,null,null,null,null,null],Kt=0;Kt<ge.length;Kt++)Lr[Kt]=pe[Kt]=ge[Kt];var sr=$.touches[0];t.touchData.startGPosition=[sr.clientX,sr.clientY]}}},!1);var Se;t.registerBinding(e,"touchmove",Se=function($){var ce=t.touchData.capture;if(!(!ce&&!P($))){var ge=t.selection,pe=t.cy,Ee=t.touchData.now,Ue=t.touchData.earlier,je=pe.zoom();if($.touches[0]){var He=t.projectIntoViewport($.touches[0].clientX,$.touches[0].clientY);Ee[0]=He[0],Ee[1]=He[1]}if($.touches[1]){var He=t.projectIntoViewport($.touches[1].clientX,$.touches[1].clientY);Ee[2]=He[0],Ee[3]=He[1]}if($.touches[2]){var He=t.projectIntoViewport($.touches[2].clientX,$.touches[2].clientY);Ee[4]=He[0],Ee[5]=He[1]}var _e=function(_c){return{originalEvent:$,type:_c,position:{x:Ee[0],y:Ee[1]}}},Ke=t.touchData.startGPosition,it;if(ce&&$.touches[0]&&Ke){for(var st=[],Ve=0;Ve<Ee.length;Ve++)st[Ve]=Ee[Ve]-Ue[Ve];var dt=$.touches[0].clientX-Ke[0],ut=dt*dt,Yt=$.touches[0].clientY-Ke[1],Ot=Yt*Yt,Lr=ut+Ot;it=Lr>=t.touchTapThreshold2}if(ce&&t.touchData.cxt){$.preventDefault();var Kt=$.touches[0].clientX-ae,sr=$.touches[0].clientY-re,Jt=$.touches[1].clientX-ae,lr=$.touches[1].clientY-re,Ra=Ze(Kt,sr,Jt,lr),Xt=Ra/ne,Ba=150,Cr=Ba*Ba,Ht=1.5,xr=Ht*Ht;if(Xt>=xr||Ra>=Cr){t.touchData.cxt=!1,t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var sa=_e("cxttapend");t.touchData.start?(t.touchData.start.unactivate().emit(sa),t.touchData.start=null):pe.emit(sa)}}if(ce&&t.touchData.cxt){var sa=_e("cxtdrag");t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.touchData.start?t.touchData.start.emit(sa):pe.emit(sa),t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxtDragged=!0;var Nr=t.findNearestElement(Ee[0],Ee[1],!0,!0);(!t.touchData.cxtOver||Nr!==t.touchData.cxtOver)&&(t.touchData.cxtOver&&t.touchData.cxtOver.emit(_e("cxtdragout")),t.touchData.cxtOver=Nr,Nr&&Nr.emit(_e("cxtdragover")))}else if(ce&&$.touches[2]&&pe.boxSelectionEnabled())$.preventDefault(),t.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,t.touchData.selecting||pe.emit(_e("boxstart")),t.touchData.selecting=!0,t.touchData.didSelect=!0,ge[4]=1,!ge||ge.length===0||ge[0]===void 0?(ge[0]=(Ee[0]+Ee[2]+Ee[4])/3,ge[1]=(Ee[1]+Ee[3]+Ee[5])/3,ge[2]=(Ee[0]+Ee[2]+Ee[4])/3+1,ge[3]=(Ee[1]+Ee[3]+Ee[5])/3+1):(ge[2]=(Ee[0]+Ee[2]+Ee[4])/3,ge[3]=(Ee[1]+Ee[3]+Ee[5])/3),t.redrawHint("select",!0),t.redraw();else if(ce&&$.touches[1]&&!t.touchData.didSelect&&pe.zoomingEnabled()&&pe.panningEnabled()&&pe.userZoomingEnabled()&&pe.userPanningEnabled()){$.preventDefault(),t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var jr=t.dragData.touchDragEles;if(jr){t.redrawHint("drag",!0);for(var Gr=0;Gr<jr.length;Gr++){var ni=jr[Gr]._private;ni.grabbed=!1,ni.rscratch.inDragLayer=!1}}var Ar=t.touchData.start,Kt=$.touches[0].clientX-ae,sr=$.touches[0].clientY-re,Jt=$.touches[1].clientX-ae,lr=$.touches[1].clientY-re,dl=Ae(Kt,sr,Jt,lr),ii=dl/Y;if(Ne){var si=Kt-Q,ps=sr-X,li=Jt-W,dr=lr-te,Lc=(si+li)/2,Pc=(ps+dr)/2,wa=pe.zoom(),cn=wa*ii,fl=pe.pan(),qo=oe[0]*wa+fl.x,Io=oe[1]*wa+fl.y,Sh={x:-cn/wa*(qo-fl.x-Lc)+qo,y:-cn/wa*(Io-fl.y-Pc)+Io};if(Ar&&Ar.active()){var jr=t.dragData.touchDragEles;T(jr),t.redrawHint("drag",!0),t.redrawHint("eles",!0),Ar.unactivate().emit(_e("freeon")),jr.emit(_e("free")),t.dragData.didDrag&&(Ar.emit(_e("dragfreeon")),jr.emit(_e("dragfree")))}pe.viewport({zoom:cn,pan:Sh,cancelOnFailedZoom:!0}),pe.emit(_e("pinchzoom")),Y=dl,Q=Kt,X=sr,W=Jt,te=lr,t.pinching=!0}if($.touches[0]){var He=t.projectIntoViewport($.touches[0].clientX,$.touches[0].clientY);Ee[0]=He[0],Ee[1]=He[1]}if($.touches[1]){var He=t.projectIntoViewport($.touches[1].clientX,$.touches[1].clientY);Ee[2]=He[0],Ee[3]=He[1]}if($.touches[2]){var He=t.projectIntoViewport($.touches[2].clientX,$.touches[2].clientY);Ee[4]=He[0],Ee[5]=He[1]}}else if($.touches[0]&&!t.touchData.didSelect){var Qr=t.touchData.start,oi=t.touchData.last,Nr;if(!t.hoverData.draggingEles&&!t.swipePanning&&(Nr=t.findNearestElement(Ee[0],Ee[1],!0,!0)),ce&&Qr!=null&&$.preventDefault(),ce&&Qr!=null&&t.nodeIsDraggable(Qr))if(it){var jr=t.dragData.touchDragEles,La=!t.dragData.didDrag;La&&E(jr,{inDragLayer:!0}),t.dragData.didDrag=!0;var Mr={x:0,y:0};if(De(st[0])&&De(st[1])&&(Mr.x+=st[0],Mr.y+=st[1],La)){t.redrawHint("eles",!0);var la=t.touchData.dragDelta;la&&De(la[0])&&De(la[1])&&(Mr.x+=la[0],Mr.y+=la[1])}t.hoverData.draggingEles=!0,jr.silentShift(Mr).emit(_e("position")).emit(_e("drag")),t.redrawHint("drag",!0),t.touchData.startPosition[0]==Ue[0]&&t.touchData.startPosition[1]==Ue[1]&&t.redrawHint("eles",!0),t.redraw()}else{var la=t.touchData.dragDelta=t.touchData.dragDelta||[];la.length===0?(la.push(st[0]),la.push(st[1])):(la[0]+=st[0],la[1]+=st[1])}if(i(Qr||Nr,["touchmove","tapdrag","vmousemove"],$,{x:Ee[0],y:Ee[1]}),(!Qr||!Qr.grabbed())&&Nr!=oi&&(oi&&oi.emit(_e("tapdragout")),Nr&&Nr.emit(_e("tapdragover"))),t.touchData.last=Nr,ce)for(var Gr=0;Gr<Ee.length;Gr++)Ee[Gr]&&t.touchData.startPosition[Gr]&&it&&(t.touchData.singleTouchMoved=!0);if(ce&&(Qr==null||Qr.pannable())&&pe.panningEnabled()&&pe.userPanningEnabled()){var Eh=o(Qr,t.touchData.starts);Eh&&($.preventDefault(),t.data.bgActivePosistion||(t.data.bgActivePosistion=ro(t.touchData.startPosition)),t.swipePanning?(pe.panBy({x:st[0]*je,y:st[1]*je}),pe.emit(_e("dragpan"))):it&&(t.swipePanning=!0,pe.panBy({x:dt*je,y:Yt*je}),pe.emit(_e("dragpan")),Qr&&(Qr.unactivate(),t.redrawHint("select",!0),t.touchData.start=null)));var He=t.projectIntoViewport($.touches[0].clientX,$.touches[0].clientY);Ee[0]=He[0],Ee[1]=He[1]}}for(var Ve=0;Ve<Ee.length;Ve++)Ue[Ve]=Ee[Ve];ce&&$.touches.length>0&&!t.hoverData.draggingEles&&!t.swipePanning&&t.data.bgActivePosistion!=null&&(t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.redraw())}},!1);var Oe;t.registerBinding(e,"touchcancel",Oe=function($){var ce=t.touchData.start;t.touchData.capture=!1,ce&&ce.unactivate()});var ke,Pe,Ge,Je;if(t.registerBinding(e,"touchend",ke=function($){var ce=t.touchData.start,ge=t.touchData.capture;if(ge)$.touches.length===0&&(t.touchData.capture=!1),$.preventDefault();else return;var pe=t.selection;t.swipePanning=!1,t.hoverData.draggingEles=!1;var Ee=t.cy,Ue=Ee.zoom(),je=t.touchData.now,He=t.touchData.earlier;if($.touches[0]){var _e=t.projectIntoViewport($.touches[0].clientX,$.touches[0].clientY);je[0]=_e[0],je[1]=_e[1]}if($.touches[1]){var _e=t.projectIntoViewport($.touches[1].clientX,$.touches[1].clientY);je[2]=_e[0],je[3]=_e[1]}if($.touches[2]){var _e=t.projectIntoViewport($.touches[2].clientX,$.touches[2].clientY);je[4]=_e[0],je[5]=_e[1]}var Ke=function(Cr){return{originalEvent:$,type:Cr,position:{x:je[0],y:je[1]}}};ce&&ce.unactivate();var it;if(t.touchData.cxt){if(it=Ke("cxttapend"),ce?ce.emit(it):Ee.emit(it),!t.touchData.cxtDragged){var st=Ke("cxttap");ce?ce.emit(st):Ee.emit(st)}t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxt=!1,t.touchData.start=null,t.redraw();return}if(!$.touches[2]&&Ee.boxSelectionEnabled()&&t.touchData.selecting){t.touchData.selecting=!1;var Ve=Ee.collection(t.getAllInBox(pe[0],pe[1],pe[2],pe[3]));pe[0]=void 0,pe[1]=void 0,pe[2]=void 0,pe[3]=void 0,pe[4]=0,t.redrawHint("select",!0),Ee.emit(Ke("boxend"));var dt=function(Cr){return Cr.selectable()&&!Cr.selected()};Ve.emit(Ke("box")).stdFilter(dt).select().emit(Ke("boxselect")),Ve.nonempty()&&t.redrawHint("eles",!0),t.redraw()}if(ce!=null&&ce.unactivate(),$.touches[2])t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);else if(!$.touches[1]){if(!$.touches[0]){if(!$.touches[0]){t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var ut=t.dragData.touchDragEles;if(ce!=null){var Yt=ce._private.grabbed;T(ut),t.redrawHint("drag",!0),t.redrawHint("eles",!0),Yt&&(ce.emit(Ke("freeon")),ut.emit(Ke("free")),t.dragData.didDrag&&(ce.emit(Ke("dragfreeon")),ut.emit(Ke("dragfree")))),i(ce,["touchend","tapend","vmouseup","tapdragout"],$,{x:je[0],y:je[1]}),ce.unactivate(),t.touchData.start=null}else{var Ot=t.findNearestElement(je[0],je[1],!0,!0);i(Ot,["touchend","tapend","vmouseup","tapdragout"],$,{x:je[0],y:je[1]})}var Lr=t.touchData.startPosition[0]-je[0],Kt=Lr*Lr,sr=t.touchData.startPosition[1]-je[1],Jt=sr*sr,lr=Kt+Jt,Ra=lr*Ue*Ue;t.touchData.singleTouchMoved||(ce||Ee.$(":selected").unselect(["tapunselect"]),i(ce,["tap","vclick"],$,{x:je[0],y:je[1]}),Pe=!1,$.timeStamp-Je<=Ee.multiClickDebounceTime()?(Ge&&clearTimeout(Ge),Pe=!0,Je=null,i(ce,["dbltap","vdblclick"],$,{x:je[0],y:je[1]})):(Ge=setTimeout(function(){Pe||i(ce,["onetap","voneclick"],$,{x:je[0],y:je[1]})},Ee.multiClickDebounceTime()),Je=$.timeStamp)),ce!=null&&!t.dragData.didDrag&&ce._private.selectable&&Ra<t.touchTapThreshold2&&!t.pinching&&(Ee.selectionType()==="single"?(Ee.$(r).unmerge(ce).unselect(["tapunselect"]),ce.select(["tapselect"])):ce.selected()?ce.unselect(["tapunselect"]):ce.select(["tapselect"]),t.redrawHint("eles",!0)),t.touchData.singleTouchMoved=!0}}}for(var Xt=0;Xt<je.length;Xt++)He[Xt]=je[Xt];t.dragData.didDrag=!1,$.touches.length===0&&(t.touchData.dragDelta=[],t.touchData.startPosition=[null,null,null,null,null,null],t.touchData.startGPosition=null,t.touchData.didSelect=!1),$.touches.length<2&&($.touches.length===1&&(t.touchData.startGPosition=[$.touches[0].clientX,$.touches[0].clientY]),t.pinching=!1,t.redrawHint("eles",!0),t.redraw())},!1),typeof TouchEvent>"u"){var Be=[],nt=function($){return{clientX:$.clientX,clientY:$.clientY,force:1,identifier:$.pointerId,pageX:$.pageX,pageY:$.pageY,radiusX:$.width/2,radiusY:$.height/2,screenX:$.screenX,screenY:$.screenY,target:$.target}},ye=function($){return{event:$,touch:nt($)}},$e=function($){Be.push(ye($))},et=function($){for(var ce=0;ce<Be.length;ce++){var ge=Be[ce];if(ge.event.pointerId===$.pointerId){Be.splice(ce,1);return}}},xe=function($){var ce=Be.filter(function(ge){return ge.event.pointerId===$.pointerId})[0];ce.event=$,ce.touch=nt($)},ze=function($){$.touches=Be.map(function(ce){return ce.touch})},Re=function($){return $.pointerType==="mouse"||$.pointerType===4};t.registerBinding(t.container,"pointerdown",function(we){Re(we)||(we.preventDefault(),$e(we),ze(we),Qe(we))}),t.registerBinding(t.container,"pointerup",function(we){Re(we)||(et(we),ze(we),ke(we))}),t.registerBinding(t.container,"pointercancel",function(we){Re(we)||(et(we),ze(we),Oe(we))}),t.registerBinding(t.container,"pointermove",function(we){Re(we)||(we.preventDefault(),xe(we),ze(we),Se(we))})}};var ri={};ri.generatePolygon=function(t,e){return this.nodeShapes[t]={renderer:this,name:t,points:e,draw:function(a,i,s,o,u,d){this.renderer.nodeShapeImpl("polygon",a,i,s,o,u,this.points)},intersectLine:function(a,i,s,o,u,d,f,h){return rc(u,d,this.points,a,i,s/2,o/2,f)},checkPoint:function(a,i,s,o,u,d,f,h){return ti(a,i,this.points,d,f,o,u,[0,-1],s)},hasMiterBounds:t!=="rectangle",miterBounds:function(a,i,s,o,u,d){return PO(this.points,a,i,s,o,u)}}};ri.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,r,a,i,s,o){this.renderer.nodeShapeImpl(this.name,e,r,a,i,s)},intersectLine:function(e,r,a,i,s,o,u,d){return HO(s,o,e,r,a/2+u,i/2+u)},checkPoint:function(e,r,a,i,s,o,u,d){return qs(e,r,i,s,o,u,a)}}};ri.generateRoundPolygon=function(t,e){return this.nodeShapes[t]={renderer:this,name:t,points:e,getOrCreateCorners:function(a,i,s,o,u,d,f){if(d[f]!==void 0&&d[f+"-cx"]===a&&d[f+"-cy"]===i)return d[f];d[f]=new Array(e.length/2),d[f+"-cx"]=a,d[f+"-cy"]=i;var h=s/2,p=o/2;u=u==="auto"?yC(s,o):u;for(var m=new Array(e.length/2),y=0;y<e.length/2;y++)m[y]={x:a+h*e[y*2],y:i+p*e[y*2+1]};var x,E,w,T,C=m.length;for(E=m[C-1],x=0;x<C;x++)w=m[x%C],T=m[(x+1)%C],d[f][x]=ly(E,w,T,u),E=w,w=T;return d[f]},draw:function(a,i,s,o,u,d,f){this.renderer.nodeShapeImpl("round-polygon",a,i,s,o,u,this.points,this.getOrCreateCorners(i,s,o,u,d,f,"drawCorners"))},intersectLine:function(a,i,s,o,u,d,f,h,p){return QO(u,d,this.points,a,i,s,o,f,this.getOrCreateCorners(a,i,s,o,h,p,"corners"))},checkPoint:function(a,i,s,o,u,d,f,h,p){return FO(a,i,this.points,d,f,o,u,this.getOrCreateCorners(d,f,o,u,h,p,"corners"))}}};ri.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:ta(4,0),draw:function(e,r,a,i,s,o){this.renderer.nodeShapeImpl(this.name,e,r,a,i,s,this.points,o)},intersectLine:function(e,r,a,i,s,o,u,d){return gC(s,o,e,r,a,i,u,d)},checkPoint:function(e,r,a,i,s,o,u,d){var f=i/2,h=s/2;d=d==="auto"?ns(i,s):d,d=Math.min(f,h,d);var p=d*2;return!!(ti(e,r,this.points,o,u,i,s-p,[0,-1],a)||ti(e,r,this.points,o,u,i-p,s,[0,-1],a)||qs(e,r,p,p,o-f+d,u-h+d,a)||qs(e,r,p,p,o+f-d,u-h+d,a)||qs(e,r,p,p,o+f-d,u+h-d,a)||qs(e,r,p,p,o-f+d,u+h-d,a))}}};ri.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:Xm(),points:ta(4,0),draw:function(e,r,a,i,s,o){this.renderer.nodeShapeImpl(this.name,e,r,a,i,s,null,o)},generateCutTrianglePts:function(e,r,a,i,s){var o=s==="auto"?this.cornerLength:s,u=r/2,d=e/2,f=a-d,h=a+d,p=i-u,m=i+u;return{topLeft:[f,p+o,f+o,p,f+o,p+o],topRight:[h-o,p,h,p+o,h-o,p+o],bottomRight:[h,m-o,h-o,m,h-o,m-o],bottomLeft:[f+o,m,f,m-o,f+o,m-o]}},intersectLine:function(e,r,a,i,s,o,u,d){var f=this.generateCutTrianglePts(a+2*u,i+2*u,e,r,d),h=[].concat.apply([],[f.topLeft.splice(0,4),f.topRight.splice(0,4),f.bottomRight.splice(0,4),f.bottomLeft.splice(0,4)]);return rc(s,o,h,e,r)},checkPoint:function(e,r,a,i,s,o,u,d){var f=d==="auto"?this.cornerLength:d;if(ti(e,r,this.points,o,u,i,s-2*f,[0,-1],a)||ti(e,r,this.points,o,u,i-2*f,s,[0,-1],a))return!0;var h=this.generateCutTrianglePts(i,s,o,u);return ma(e,r,h.topLeft)||ma(e,r,h.topRight)||ma(e,r,h.bottomRight)||ma(e,r,h.bottomLeft)}}};ri.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:ta(4,0),draw:function(e,r,a,i,s,o){this.renderer.nodeShapeImpl(this.name,e,r,a,i,s)},intersectLine:function(e,r,a,i,s,o,u,d){var f=.15,h=.5,p=.85,m=this.generateBarrelBezierPts(a+2*u,i+2*u,e,r),y=function(w){var T=lo({x:w[0],y:w[1]},{x:w[2],y:w[3]},{x:w[4],y:w[5]},f),C=lo({x:w[0],y:w[1]},{x:w[2],y:w[3]},{x:w[4],y:w[5]},h),N=lo({x:w[0],y:w[1]},{x:w[2],y:w[3]},{x:w[4],y:w[5]},p);return[w[0],w[1],T.x,T.y,C.x,C.y,N.x,N.y,w[4],w[5]]},x=[].concat(y(m.topLeft),y(m.topRight),y(m.bottomRight),y(m.bottomLeft));return rc(s,o,x,e,r)},generateBarrelBezierPts:function(e,r,a,i){var s=r/2,o=e/2,u=a-o,d=a+o,f=i-s,h=i+s,p=Wg(e,r),m=p.heightOffset,y=p.widthOffset,x=p.ctrlPtOffsetPct*e,E={topLeft:[u,f+m,u+x,f,u+y,f],topRight:[d-y,f,d-x,f,d,f+m],bottomRight:[d,h-m,d-x,h,d-y,h],bottomLeft:[u+y,h,u+x,h,u,h-m]};return E.topLeft.isTop=!0,E.topRight.isTop=!0,E.bottomLeft.isBottom=!0,E.bottomRight.isBottom=!0,E},checkPoint:function(e,r,a,i,s,o,u,d){var f=Wg(i,s),h=f.heightOffset,p=f.widthOffset;if(ti(e,r,this.points,o,u,i,s-2*h,[0,-1],a)||ti(e,r,this.points,o,u,i-2*p,s,[0,-1],a))return!0;for(var m=this.generateBarrelBezierPts(i,s,o,u),y=function(k,B,P){var U=P[4],R=P[2],V=P[0],_=P[5],H=P[1],z=Math.min(U,V),I=Math.max(U,V),F=Math.min(_,H),K=Math.max(_,H);if(z<=k&&k<=I&&F<=B&&B<=K){var J=$O(U,R,V),L=UO(J[0],J[1],J[2],k),Q=L.filter(function(X){return 0<=X&&X<=1});if(Q.length>0)return Q[0]}return null},x=Object.keys(m),E=0;E<x.length;E++){var w=x[E],T=m[w],C=y(e,r,T);if(C!=null){var N=T[5],A=T[3],D=T[1],M=Or(N,A,D,C);if(T.isTop&&M<=r||T.isBottom&&r<=M)return!0}}return!1}}};ri.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:ta(4,0),draw:function(e,r,a,i,s,o){this.renderer.nodeShapeImpl(this.name,e,r,a,i,s,this.points,o)},intersectLine:function(e,r,a,i,s,o,u,d){var f=e-(a/2+u),h=r-(i/2+u),p=h,m=e+(a/2+u),y=Xi(s,o,e,r,f,h,m,p,!1);return y.length>0?y:gC(s,o,e,r,a,i,u,d)},checkPoint:function(e,r,a,i,s,o,u,d){d=d==="auto"?ns(i,s):d;var f=2*d;if(ti(e,r,this.points,o,u,i,s-f,[0,-1],a)||ti(e,r,this.points,o,u,i-f,s,[0,-1],a))return!0;var h=i/2+2*a,p=s/2+2*a,m=[o-h,u-p,o-h,u,o+h,u,o+h,u-p];return!!(ma(e,r,m)||qs(e,r,f,f,o+i/2-d,u+s/2-d,a)||qs(e,r,f,f,o-i/2+d,u+s/2-d,a))}}};ri.registerNodeShapes=function(){var t=this.nodeShapes={},e=this;this.generateEllipse(),this.generatePolygon("triangle",ta(3,0)),this.generateRoundPolygon("round-triangle",ta(3,0)),this.generatePolygon("rectangle",ta(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",ta(5,0)),this.generateRoundPolygon("round-pentagon",ta(5,0)),this.generatePolygon("hexagon",ta(6,0)),this.generateRoundPolygon("round-hexagon",ta(6,0)),this.generatePolygon("heptagon",ta(7,0)),this.generateRoundPolygon("round-heptagon",ta(7,0)),this.generatePolygon("octagon",ta(8,0)),this.generateRoundPolygon("round-octagon",ta(8,0));var a=new Array(20);{var i=Zg(5,0),s=Zg(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var u=0;u<s.length/2;u++)s[u*2]*=o,s[u*2+1]*=o;for(var u=0;u<20/4;u++)a[u*4]=i[u*2],a[u*4+1]=i[u*2+1],a[u*4+2]=s[u*2],a[u*4+3]=s[u*2+1]}a=mC(a),this.generatePolygon("star",a),this.generatePolygon("vee",[-1,-1,0,-.333,1,-1,0,1]),this.generatePolygon("rhomboid",[-1,-1,.333,-1,1,1,-.333,1]),this.generatePolygon("right-rhomboid",[-.333,-1,1,-1,.333,1,-1,1]),this.nodeShapes.concavehexagon=this.generatePolygon("concave-hexagon",[-1,-.95,-.75,0,-1,.95,1,.95,.75,0,1,-.95]);{var d=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",d),this.generateRoundPolygon("round-tag",d)}t.makePolygon=function(f){var h=f.join("$"),p="polygon-"+h,m;return(m=this[p])?m:e.generatePolygon(p,f)}};var Rc={};Rc.timeToRender=function(){return this.redrawTotalTime/this.redrawCount};Rc.redraw=function(t){t=t||fC();var e=this;e.averageRedrawTime===void 0&&(e.averageRedrawTime=0),e.lastRedrawTime===void 0&&(e.lastRedrawTime=0),e.lastDrawTime===void 0&&(e.lastDrawTime=0),e.requestedFrame=!0,e.renderOptions=t};Rc.beforeRender=function(t,e){if(!this.destroyed){e==null&&$t("Priority is not optional for beforeRender");var r=this.beforeRenderCallbacks;r.push({fn:t,priority:e}),r.sort(function(a,i){return i.priority-a.priority})}};var JS=function(e,r,a){for(var i=e.beforeRenderCallbacks,s=0;s<i.length;s++)i[s].fn(r,a)};Rc.startRenderLoop=function(){var t=this,e=t.cy;if(!t.renderLoopStarted){t.renderLoopStarted=!0;var r=function(i){if(!t.destroyed){if(!e.batching())if(t.requestedFrame&&!t.skipFrame){JS(t,!0,i);var s=ei();t.render(t.renderOptions);var o=t.lastDrawTime=ei();t.averageRedrawTime===void 0&&(t.averageRedrawTime=o-s),t.redrawCount===void 0&&(t.redrawCount=0),t.redrawCount++,t.redrawTotalTime===void 0&&(t.redrawTotalTime=0);var u=o-s;t.redrawTotalTime+=u,t.lastRedrawTime=u,t.averageRedrawTime=t.averageRedrawTime/2+u/2,t.requestedFrame=!1}else JS(t,!1,i);t.skipFrame=!1,_f(r)}};_f(r)}};var uL=function(e){this.init(e)},yN=uL,Uo=yN.prototype;Uo.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"];Uo.init=function(t){var e=this;e.options=t,e.cy=t.cy;var r=e.container=t.cy.container(),a=e.cy.window();if(a){var i=a.document,s=i.head,o="__________cytoscape_stylesheet",u="__________cytoscape_container",d=i.getElementById(o)!=null;if(r.className.indexOf(u)<0&&(r.className=(r.className||"")+" "+u),!d){var f=i.createElement("style");f.id=o,f.textContent="."+u+" { position: relative; }",s.insertBefore(f,s.children[0])}var h=a.getComputedStyle(r),p=h.getPropertyValue("position");p==="static"&&At("A Cytoscape container has style position:static and so can not use UI extensions properly")}e.selection=[void 0,void 0,void 0,void 0,0],e.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],e.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},e.dragData={possibleDragElements:[]},e.touchData={start:null,capture:!1,startPosition:[null,null,null,null,null,null],singleTouchStartTime:null,singleTouchMoved:!0,now:[null,null,null,null,null,null],earlier:[null,null,null,null,null,null]},e.redraws=0,e.showFps=t.showFps,e.debug=t.debug,e.webgl=t.webgl,e.hideEdgesOnViewport=t.hideEdgesOnViewport,e.textureOnViewport=t.textureOnViewport,e.wheelSensitivity=t.wheelSensitivity,e.motionBlurEnabled=t.motionBlur,e.forcedPixelRatio=De(t.pixelRatio)?t.pixelRatio:null,e.motionBlur=t.motionBlur,e.motionBlurOpacity=t.motionBlurOpacity,e.motionBlurTransparency=1-e.motionBlurOpacity,e.motionBlurPxRatio=1,e.mbPxRBlurry=1,e.minMbLowQualFrames=4,e.fullQualityMb=!1,e.clearedForMotionBlur=[],e.desktopTapThreshold=t.desktopTapThreshold,e.desktopTapThreshold2=t.desktopTapThreshold*t.desktopTapThreshold,e.touchTapThreshold=t.touchTapThreshold,e.touchTapThreshold2=t.touchTapThreshold*t.touchTapThreshold,e.tapholdDuration=500,e.bindings=[],e.beforeRenderCallbacks=[],e.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},e.registerNodeShapes(),e.registerArrowShapes(),e.registerCalculationListeners()};Uo.notify=function(t,e){var r=this,a=r.cy;if(!this.destroyed){if(t==="init"){r.load();return}if(t==="destroy"){r.destroy();return}(t==="add"||t==="remove"||t==="move"&&a.hasCompoundNodes()||t==="load"||t==="zorder"||t==="mount")&&r.invalidateCachedZSortedEles(),t==="viewport"&&r.redrawHint("select",!0),t==="gc"&&r.redrawHint("gc",!0),(t==="load"||t==="resize"||t==="mount")&&(r.invalidateContainerClientCoordsCache(),r.matchCanvasSize(r.container)),r.redrawHint("eles",!0),r.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()}};Uo.destroy=function(){var t=this;t.destroyed=!0,t.cy.stopAnimationLoop();for(var e=0;e<t.bindings.length;e++){var r=t.bindings[e],a=r,i=a.target;(i.off||i.removeEventListener).apply(i,a.args)}if(t.bindings=[],t.beforeRenderCallbacks=[],t.onUpdateEleCalcsFns=[],t.removeObserver&&t.removeObserver.disconnect(),t.styleObserver&&t.styleObserver.disconnect(),t.resizeObserver&&t.resizeObserver.disconnect(),t.labelCalcDiv)try{document.body.removeChild(t.labelCalcDiv)}catch{}};Uo.isHeadless=function(){return!1};[sy,gN,mN,_o,ri,Rc].forEach(function(t){tt(Uo,t)});var fg=1e3/60,xN={setupDequeueing:function(e){return function(){var a=this,i=this.renderer;if(!a.dequeueingSetup){a.dequeueingSetup=!0;var s=Ac(function(){i.redrawHint("eles",!0),i.redrawHint("drag",!0),i.redraw()},e.deqRedrawThreshold),o=function(f,h){var p=ei(),m=i.averageRedrawTime,y=i.lastRedrawTime,x=[],E=i.cy.extent(),w=i.getPixelRatio();for(f||i.flushRenderedStyleQueue();;){var T=ei(),C=T-p,N=T-h;if(y<fg){var A=fg-(f?m:0);if(N>=e.deqFastCost*A)break}else if(f){if(C>=e.deqCost*y||C>=e.deqAvgCost*m)break}else if(N>=e.deqNoDrawCost*fg)break;var D=e.deq(a,w,E);if(D.length>0)for(var M=0;M<D.length;M++)x.push(D[M]);else break}x.length>0&&(e.onDeqd(a,x),!f&&e.shouldRedraw(a,x,w,E)&&s())},u=e.priority||Gm;i.beforeRender(o,u(a))}}}},cL=(function(){function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Uf;cs(this,t),this.idsByKey=new Zn,this.keyForId=new Zn,this.cachesByLvl=new Zn,this.lvls=[],this.getKey=e,this.doesEleInvalidateKey=r}return ds(t,[{key:"getIdsFor",value:function(r){r==null&&$t("Can not get id list for null key");var a=this.idsByKey,i=this.idsByKey.get(r);return i||(i=new Bo,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),s=this.getKey(r);this.deleteIdForKey(i,a),this.addIdForKey(s,a),this.keyForId.set(a,s)}},{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),s=this.getKey(r);return i!==s}},{key:"isInvalid",value:function(r){return this.keyHasChangedFor(r)||this.doesEleInvalidateKey(r)}},{key:"getCachesAt",value:function(r){var a=this.cachesByLvl,i=this.lvls,s=a.get(r);return s||(s=new Zn,a.set(r,s),i.push(r)),s}},{key:"getCache",value:function(r,a){return this.getCachesAt(a).get(r)}},{key:"get",value:function(r,a){var i=this.getKey(r),s=this.getCache(i,a);return s!=null&&this.updateKeyMappingFor(r),s}},{key:"getForCachedKey",value:function(r,a){var i=this.keyForId.get(r.id()),s=this.getCache(i,a);return s}},{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 s=this.getKey(r);this.setCache(s,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 s=this.doesEleInvalidateKey(r);return s&&this.invalidateKey(i),s||this.getNumberOfIdsForKey(i)===0}}])})(),eE=25,ff=50,Mf=-4,dm=3,bN=7.99,dL=8,fL=1024,hL=1024,vL=1024,pL=.2,gL=.8,mL=10,yL=.15,xL=.1,bL=.9,wL=.9,SL=100,EL=1,no={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},TL=Fr({getKey:null,doesEleInvalidateKey:Uf,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:uC,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),Vu=function(e,r){var a=this;a.renderer=e,a.onDequeues=[];var i=TL(r);tt(a,i),a.lookup=new cL(i.getKey,i.doesEleInvalidateKey),a.setupDequeueing()},Tr=Vu.prototype;Tr.reasons=no;Tr.getTextureQueue=function(t){var e=this;return e.eleImgCaches=e.eleImgCaches||{},e.eleImgCaches[t]=e.eleImgCaches[t]||[]};Tr.getRetiredTextureQueue=function(t){var e=this,r=e.eleImgCaches.retired=e.eleImgCaches.retired||{},a=r[t]=r[t]||[];return a};Tr.getElementQueue=function(){var t=this,e=t.eleCacheQueue=t.eleCacheQueue||new Mc(function(r,a){return a.reqs-r.reqs});return e};Tr.getElementKeyToQueue=function(){var t=this,e=t.eleKeyToCacheQueue=t.eleKeyToCacheQueue||{};return e};Tr.getElement=function(t,e,r,a,i){var s=this,o=this.renderer,u=o.cy.zoom(),d=this.lookup;if(!e||e.w===0||e.h===0||isNaN(e.w)||isNaN(e.h)||!t.visible()||t.removed()||!s.allowEdgeTxrCaching&&t.isEdge()||!s.allowParentTxrCaching&&t.isParent())return null;if(a==null&&(a=Math.ceil($m(u*r))),a<Mf)a=Mf;else if(u>=bN||a>dm)return null;var f=Math.pow(2,a),h=e.h*f,p=e.w*f,m=o.eleTextBiggerThanMin(t,f);if(!this.isVisible(t,m))return null;var y=d.get(t,a);if(y&&y.invalidated&&(y.invalidated=!1,y.texture.invalidatedWidth-=y.width),y)return y;var x;if(h<=eE?x=eE:h<=ff?x=ff:x=Math.ceil(h/ff)*ff,h>vL||p>hL)return null;var E=s.getTextureQueue(x),w=E[E.length-2],T=function(){return s.recycleTexture(x,p)||s.addTexture(x,p)};w||(w=E[E.length-1]),w||(w=T()),w.width-w.usedWidth<p&&(w=T());for(var C=function(z){return z&&z.scaledLabelShown===m},N=i&&i===no.dequeue,A=i&&i===no.highQuality,D=i&&i===no.downscale,M,j=a+1;j<=dm;j++){var k=d.get(t,j);if(k){M=k;break}}var B=M&&M.level===a+1?M:null,P=function(){w.context.drawImage(B.texture.canvas,B.x,0,B.width,B.height,w.usedWidth,0,p,h)};if(w.context.setTransform(1,0,0,1,0,0),w.context.clearRect(w.usedWidth,0,p,x),C(B))P();else if(C(M))if(A){for(var U=M.level;U>a;U--)B=s.getElement(t,e,r,U,no.downscale);P()}else return s.queueElement(t,M.level-1),M;else{var R;if(!N&&!A&&!D)for(var V=a-1;V>=Mf;V--){var _=d.get(t,V);if(_){R=_;break}}if(C(R))return s.queueElement(t,a),R;w.context.translate(w.usedWidth,0),w.context.scale(f,f),this.drawElement(w.context,t,e,m,!1),w.context.scale(1/f,1/f),w.context.translate(-w.usedWidth,0)}return y={x:w.usedWidth,texture:w,level:a,scale:f,width:p,height:h,scaledLabelShown:m},w.usedWidth+=Math.ceil(p+dL),w.eleCaches.push(y),d.set(t,a,y),s.checkTextureFullness(w),y};Tr.invalidateElements=function(t){for(var e=0;e<t.length;e++)this.invalidateElement(t[e])};Tr.invalidateElement=function(t){var e=this,r=e.lookup,a=[],i=r.isInvalid(t);if(i){for(var s=Mf;s<=dm;s++){var o=r.getForCachedKey(t,s);o&&a.push(o)}var u=r.invalidate(t);if(u)for(var d=0;d<a.length;d++){var f=a[d],h=f.texture;h.invalidatedWidth+=f.width,f.invalidated=!0,e.checkTextureUtility(h)}e.removeFromQueue(t)}};Tr.checkTextureUtility=function(t){t.invalidatedWidth>=pL*t.width&&this.retireTexture(t)};Tr.checkTextureFullness=function(t){var e=this,r=e.getTextureQueue(t.height);t.usedWidth/t.width>gL&&t.fullnessChecks>=mL?as(r,t):t.fullnessChecks++};Tr.retireTexture=function(t){var e=this,r=t.height,a=e.getTextureQueue(r),i=this.lookup;as(a,t),t.retired=!0;for(var s=t.eleCaches,o=0;o<s.length;o++){var u=s[o];i.deleteCache(u.key,u.level)}Qm(s);var d=e.getRetiredTextureQueue(r);d.push(t)};Tr.addTexture=function(t,e){var r=this,a=r.getTextureQueue(t),i={};return a.push(i),i.eleCaches=[],i.height=t,i.width=Math.max(fL,e),i.usedWidth=0,i.invalidatedWidth=0,i.fullnessChecks=0,i.canvas=r.renderer.makeOffscreenCanvas(i.width,i.height),i.context=i.canvas.getContext("2d"),i};Tr.recycleTexture=function(t,e){for(var r=this,a=r.getTextureQueue(t),i=r.getRetiredTextureQueue(t),s=0;s<i.length;s++){var o=i[s];if(o.width>=e)return o.retired=!1,o.usedWidth=0,o.invalidatedWidth=0,o.fullnessChecks=0,Qm(o.eleCaches),o.context.setTransform(1,0,0,1,0,0),o.context.clearRect(0,0,o.width,o.height),as(i,o),a.push(o),o}};Tr.queueElement=function(t,e){var r=this,a=r.getElementQueue(),i=r.getElementKeyToQueue(),s=this.getKey(t),o=i[s];if(o)o.level=Math.max(o.level,e),o.eles.merge(t),o.reqs++,a.updateItem(o);else{var u={eles:t.spawn().merge(t),level:e,reqs:1,key:s};a.push(u),i[s]=u}};Tr.dequeue=function(t){for(var e=this,r=e.getElementQueue(),a=e.getElementKeyToQueue(),i=[],s=e.lookup,o=0;o<EL&&r.size()>0;o++){var u=r.pop(),d=u.key,f=u.eles[0],h=s.hasCache(f,u.level);if(a[d]=null,h)continue;i.push(u);var p=e.getBoundingBox(f);e.getElement(f,p,t,u.level,no.dequeue)}return i};Tr.removeFromQueue=function(t){var e=this,r=e.getElementQueue(),a=e.getElementKeyToQueue(),i=this.getKey(t),s=a[i];s!=null&&(s.eles.length===1?(s.reqs=Hm,r.updateItem(s),r.pop(),a[i]=null):s.eles.unmerge(t))};Tr.onDequeue=function(t){this.onDequeues.push(t)};Tr.offDequeue=function(t){as(this.onDequeues,t)};Tr.setupDequeueing=xN.setupDequeueing({deqRedrawThreshold:SL,deqCost:yL,deqAvgCost:xL,deqNoDrawCost:bL,deqFastCost:wL,deq:function(e,r,a){return e.dequeue(r,a)},onDeqd:function(e,r){for(var a=0;a<e.onDequeues.length;a++){var i=e.onDequeues[a];i(r)}},shouldRedraw:function(e,r,a,i){for(var s=0;s<r.length;s++)for(var o=r[s].eles,u=0;u<o.length;u++){var d=o[u].boundingBox();if(Km(d,i))return!0}return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var CL=1,Gu=-4,$f=2,NL=3.99,jL=50,AL=50,ML=.15,kL=.1,DL=.9,OL=.9,RL=1,tE=250,BL=4e3*4e3,rE=32767,LL=!0,wN=function(e){var r=this,a=r.renderer=e,i=a.cy;r.layersByLevel={},r.firstGet=!0,r.lastInvalidationTime=ei()-2*tE,r.skipping=!1,r.eleTxrDeqs=i.collection(),r.scheduleElementRefinement=Ac(function(){r.refineElementTextures(r.eleTxrDeqs),r.eleTxrDeqs.unmerge(r.eleTxrDeqs)},AL),a.beforeRender(function(o,u){u-r.lastInvalidationTime<=tE?r.skipping=!0:r.skipping=!1},a.beforeRenderPriorities.lyrTxrSkip);var s=function(u,d){return d.reqs-u.reqs};r.layersQueue=new Mc(s),r.setupDequeueing()},Hr=wN.prototype,aE=0,PL=Math.pow(2,53)-1;Hr.makeLayer=function(t,e){var r=Math.pow(2,e),a=Math.ceil(t.w*r),i=Math.ceil(t.h*r),s=this.renderer.makeOffscreenCanvas(a,i),o={id:aE=++aE%PL,bb:t,level:e,width:a,height:i,canvas:s,context:s.getContext("2d"),eles:[],elesQueue:[],reqs:0},u=o.context,d=-o.bb.x1,f=-o.bb.y1;return u.scale(r,r),u.translate(d,f),o};Hr.getLayers=function(t,e,r){var a=this,i=a.renderer,s=i.cy,o=s.zoom(),u=a.firstGet;if(a.firstGet=!1,r==null){if(r=Math.ceil($m(o*e)),r<Gu)r=Gu;else if(o>=NL||r>$f)return null}a.validateLayersElesOrdering(r,t);var d=a.layersByLevel,f=Math.pow(2,r),h=d[r]=d[r]||[],p,m=a.levelIsComplete(r,t),y,x=function(){var P=function(H){if(a.validateLayersElesOrdering(H,t),a.levelIsComplete(H,t))return y=d[H],!0},U=function(H){if(!y)for(var z=r+H;Gu<=z&&z<=$f&&!P(z);z+=H);};U(1),U(-1);for(var R=h.length-1;R>=0;R--){var V=h[R];V.invalid&&as(h,V)}};if(!m)x();else return h;var E=function(){if(!p){p=na();for(var P=0;P<t.length;P++)RO(p,t[P].boundingBox())}return p},w=function(P){P=P||{};var U=P.after;E();var R=Math.ceil(p.w*f),V=Math.ceil(p.h*f);if(R>rE||V>rE)return null;var _=R*V;if(_>BL)return null;var H=a.makeLayer(p,r);if(U!=null){var z=h.indexOf(U)+1;h.splice(z,0,H)}else(P.insert===void 0||P.insert)&&h.unshift(H);return H};if(a.skipping&&!u)return null;for(var T=null,C=t.length/CL,N=!u,A=0;A<t.length;A++){var D=t[A],M=D._private.rscratch,j=M.imgLayerCaches=M.imgLayerCaches||{},k=j[r];if(k){T=k;continue}if((!T||T.eles.length>=C||!pC(T.bb,D.boundingBox()))&&(T=w({insert:!0,after:T}),!T))return null;y||N?a.queueLayer(T,D):a.drawEleInLayer(T,D,r,e),T.eles.push(D),j[r]=T}return y||(N?null:h)};Hr.getEleLevelForLayerLevel=function(t,e){return t};Hr.drawEleInLayer=function(t,e,r,a){var i=this,s=this.renderer,o=t.context,u=e.boundingBox();u.w===0||u.h===0||!e.visible()||(r=i.getEleLevelForLayerLevel(r,a),s.setImgSmoothing(o,!1),s.drawCachedElement(o,e,null,null,r,LL),s.setImgSmoothing(o,!0))};Hr.levelIsComplete=function(t,e){var r=this,a=r.layersByLevel[t];if(!a||a.length===0)return!1;for(var i=0,s=0;s<a.length;s++){var o=a[s];if(o.reqs>0||o.invalid)return!1;i+=o.eles.length}return i===e.length};Hr.validateLayersElesOrdering=function(t,e){var r=this.layersByLevel[t];if(r)for(var a=0;a<r.length;a++){for(var i=r[a],s=-1,o=0;o<e.length;o++)if(i.eles[0]===e[o]){s=o;break}if(s<0){this.invalidateLayer(i);continue}for(var u=s,o=0;o<i.eles.length;o++)if(i.eles[o]!==e[u+o]){this.invalidateLayer(i);break}}};Hr.updateElementsInLayers=function(t,e){for(var r=this,a=Tc(t[0]),i=0;i<t.length;i++)for(var s=a?null:t[i],o=a?t[i]:t[i].ele,u=o._private.rscratch,d=u.imgLayerCaches=u.imgLayerCaches||{},f=Gu;f<=$f;f++){var h=d[f];h&&(s&&r.getEleLevelForLayerLevel(h.level)!==s.level||e(h,o,s))}};Hr.haveLayers=function(){for(var t=this,e=!1,r=Gu;r<=$f;r++){var a=t.layersByLevel[r];if(a&&a.length>0){e=!0;break}}return e};Hr.invalidateElements=function(t){var e=this;t.length!==0&&(e.lastInvalidationTime=ei(),!(t.length===0||!e.haveLayers())&&e.updateElementsInLayers(t,function(a,i,s){e.invalidateLayer(a)}))};Hr.invalidateLayer=function(t){if(this.lastInvalidationTime=ei(),!t.invalid){var e=t.level,r=t.eles,a=this.layersByLevel[e];as(a,t),t.elesQueue=[],t.invalid=!0,t.replacement&&(t.replacement.invalid=!0);for(var i=0;i<r.length;i++){var s=r[i]._private.rscratch.imgLayerCaches;s&&(s[e]=null)}}};Hr.refineElementTextures=function(t){var e=this;e.updateElementsInLayers(t,function(a,i,s){var o=a.replacement;if(o||(o=a.replacement=e.makeLayer(a.bb,a.level),o.replaces=a,o.eles=a.eles),!o.reqs)for(var u=0;u<o.eles.length;u++)e.queueLayer(o,o.eles[u])})};Hr.enqueueElementRefinement=function(t){this.eleTxrDeqs.merge(t),this.scheduleElementRefinement()};Hr.queueLayer=function(t,e){var r=this,a=r.layersQueue,i=t.elesQueue,s=i.hasId=i.hasId||{};if(!t.replacement){if(e){if(s[e.id()])return;i.push(e),s[e.id()]=!0}t.reqs?(t.reqs++,a.updateItem(t)):(t.reqs=1,a.push(t))}};Hr.dequeue=function(t){for(var e=this,r=e.layersQueue,a=[],i=0;i<RL&&r.size()!==0;){var s=r.peek();if(s.replacement){r.pop();continue}if(s.replaces&&s!==s.replaces.replacement){r.pop();continue}if(s.invalid){r.pop();continue}var o=s.elesQueue.shift();o&&(e.drawEleInLayer(s,o,s.level,t),i++),a.length===0&&a.push(!0),s.elesQueue.length===0&&(r.pop(),s.reqs=0,s.replaces&&e.applyLayerReplacement(s),e.requestRedraw())}return a};Hr.applyLayerReplacement=function(t){var e=this,r=e.layersByLevel[t.level],a=t.replaces,i=r.indexOf(a);if(!(i<0||a.invalid)){r[i]=t;for(var s=0;s<t.eles.length;s++){var o=t.eles[s]._private,u=o.imgLayerCaches=o.imgLayerCaches||{};u&&(u[t.level]=t)}e.requestRedraw()}};Hr.requestRedraw=Ac(function(){var t=this.renderer;t.redrawHint("eles",!0),t.redrawHint("drag",!0),t.redraw()},100);Hr.setupDequeueing=xN.setupDequeueing({deqRedrawThreshold:jL,deqCost:ML,deqAvgCost:kL,deqNoDrawCost:DL,deqFastCost:OL,deq:function(e,r){return e.dequeue(r)},onDeqd:Gm,shouldRedraw:uC,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var SN={},nE;function zL(t,e){for(var r=0;r<e.length;r++){var a=e[r];t.lineTo(a.x,a.y)}}function _L(t,e,r){for(var a,i=0;i<e.length;i++){var s=e[i];i===0&&(a=s),t.lineTo(s.x,s.y)}t.quadraticCurveTo(r.x,r.y,a.x,a.y)}function iE(t,e,r){t.beginPath&&t.beginPath();for(var a=e,i=0;i<a.length;i++){var s=a[i];t.lineTo(s.x,s.y)}var o=r,u=r[0];t.moveTo(u.x,u.y);for(var i=1;i<o.length;i++){var s=o[i];t.lineTo(s.x,s.y)}t.closePath&&t.closePath()}function UL(t,e,r,a,i){t.beginPath&&t.beginPath(),t.arc(r,a,i,0,Math.PI*2,!1);var s=e,o=s[0];t.moveTo(o.x,o.y);for(var u=0;u<s.length;u++){var d=s[u];t.lineTo(d.x,d.y)}t.closePath&&t.closePath()}function qL(t,e,r,a){t.arc(e,r,a,0,Math.PI*2,!1)}SN.arrowShapeImpl=function(t){return(nE||(nE={polygon:zL,"triangle-backcurve":_L,"triangle-tee":iE,"circle-triangle":UL,"triangle-cross":iE,circle:qL}))[t]};var Nn={};Nn.drawElement=function(t,e,r,a,i,s){var o=this;e.isNode()?o.drawNode(t,e,r,a,i,s):o.drawEdge(t,e,r,a,i,s)};Nn.drawElementOverlay=function(t,e){var r=this;e.isNode()?r.drawNodeOverlay(t,e):r.drawEdgeOverlay(t,e)};Nn.drawElementUnderlay=function(t,e){var r=this;e.isNode()?r.drawNodeUnderlay(t,e):r.drawEdgeUnderlay(t,e)};Nn.drawCachedElementPortion=function(t,e,r,a,i,s,o,u){var d=this,f=r.getBoundingBox(e);if(!(f.w===0||f.h===0)){var h=r.getElement(e,f,a,i,s);if(h!=null){var p=u(d,e);if(p===0)return;var m=o(d,e),y=f.x1,x=f.y1,E=f.w,w=f.h,T,C,N,A,D;if(m!==0){var M=r.getRotationPoint(e);N=M.x,A=M.y,t.translate(N,A),t.rotate(m),D=d.getImgSmoothing(t),D||d.setImgSmoothing(t,!0);var j=r.getRotationOffset(e);T=j.x,C=j.y}else T=y,C=x;var k;p!==1&&(k=t.globalAlpha,t.globalAlpha=k*p),t.drawImage(h.texture.canvas,h.x,0,h.width,h.height,T,C,E,w),p!==1&&(t.globalAlpha=k),m!==0&&(t.rotate(-m),t.translate(-N,-A),D||d.setImgSmoothing(t,!1))}else r.drawElement(t,e)}};var IL=function(){return 0},VL=function(e,r){return e.getTextAngle(r,null)},FL=function(e,r){return e.getTextAngle(r,"source")},HL=function(e,r){return e.getTextAngle(r,"target")},GL=function(e,r){return r.effectiveOpacity()},hg=function(e,r){return r.pstyle("text-opacity").pfValue*r.effectiveOpacity()};Nn.drawCachedElement=function(t,e,r,a,i,s){var o=this,u=o.data,d=u.eleTxrCache,f=u.lblTxrCache,h=u.slbTxrCache,p=u.tlbTxrCache,m=e.boundingBox(),y=s===!0?d.reasons.highQuality:null;if(!(m.w===0||m.h===0||!e.visible())&&(!a||Km(m,a))){var x=e.isEdge(),E=e.element()._private.rscratch.badLine;o.drawElementUnderlay(t,e),o.drawCachedElementPortion(t,e,d,r,i,y,IL,GL),(!x||!E)&&o.drawCachedElementPortion(t,e,f,r,i,y,VL,hg),x&&!E&&(o.drawCachedElementPortion(t,e,h,r,i,y,FL,hg),o.drawCachedElementPortion(t,e,p,r,i,y,HL,hg)),o.drawElementOverlay(t,e)}};Nn.drawElements=function(t,e){for(var r=this,a=0;a<e.length;a++){var i=e[a];r.drawElement(t,i)}};Nn.drawCachedElements=function(t,e,r,a){for(var i=this,s=0;s<e.length;s++){var o=e[s];i.drawCachedElement(t,o,r,a)}};Nn.drawCachedNodes=function(t,e,r,a){for(var i=this,s=0;s<e.length;s++){var o=e[s];o.isNode()&&i.drawCachedElement(t,o,r,a)}};Nn.drawLayeredElements=function(t,e,r,a){var i=this,s=i.data.lyrTxrCache.getLayers(e,r);if(s)for(var o=0;o<s.length;o++){var u=s[o],d=u.bb;d.w===0||d.h===0||t.drawImage(u.canvas,d.x1,d.y1,d.w,d.h)}else i.drawCachedElements(t,e,r,a)};var ai={};ai.drawEdge=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,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,u=e._private.rscratch;if(!(s&&!e.visible())&&!(u.badLine||u.allpts==null||isNaN(u.allpts[0]))){var d;r&&(d=r,t.translate(-d.x1,-d.y1));var f=s?e.pstyle("opacity").value:1,h=s?e.pstyle("line-opacity").value:1,p=e.pstyle("curve-style").value,m=e.pstyle("line-style").value,y=e.pstyle("width").pfValue,x=e.pstyle("line-cap").value,E=e.pstyle("line-outline-width").value,w=e.pstyle("line-outline-color").value,T=f*h,C=f*h,N=function(){var H=arguments.length>0&&arguments[0]!==void 0?arguments[0]:T;p==="straight-triangle"?(o.eleStrokeStyle(t,e,H),o.drawEdgeTrianglePath(e,t,u.allpts)):(t.lineWidth=y,t.lineCap=x,o.eleStrokeStyle(t,e,H),o.drawEdgePath(e,t,u.allpts,m),t.lineCap="butt")},A=function(){var H=arguments.length>0&&arguments[0]!==void 0?arguments[0]:T;if(t.lineWidth=y+E,t.lineCap=x,E>0)o.colorStrokeStyle(t,w[0],w[1],w[2],H);else{t.lineCap="butt";return}p==="straight-triangle"?o.drawEdgeTrianglePath(e,t,u.allpts):(o.drawEdgePath(e,t,u.allpts,m),t.lineCap="butt")},D=function(){i&&o.drawEdgeOverlay(t,e)},M=function(){i&&o.drawEdgeUnderlay(t,e)},j=function(){var H=arguments.length>0&&arguments[0]!==void 0?arguments[0]:C;o.drawArrowheads(t,e,H)},k=function(){o.drawElementText(t,e,null,a)};t.lineJoin="round";var B=e.pstyle("ghost").value==="yes";if(B){var P=e.pstyle("ghost-offset-x").pfValue,U=e.pstyle("ghost-offset-y").pfValue,R=e.pstyle("ghost-opacity").value,V=T*R;t.translate(P,U),N(V),j(V),t.translate(-P,-U)}else A();M(),N(),j(),D(),k(),r&&t.translate(d.x1,d.y1)}};var EN=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 s=this,o=s.usePaths(),u=a._private.rscratch,d=a.pstyle("".concat(e,"-padding")).pfValue,f=2*d,h=a.pstyle("".concat(e,"-color")).value;r.lineWidth=f,u.edgeType==="self"&&!o?r.lineCap="butt":r.lineCap="round",s.colorStrokeStyle(r,h[0],h[1],h[2],i),s.drawEdgePath(a,r,u.allpts,"solid")}}}};ai.drawEdgeOverlay=EN("overlay");ai.drawEdgeUnderlay=EN("underlay");ai.drawEdgePath=function(t,e,r,a){var i=t._private.rscratch,s=e,o,u=!1,d=this.usePaths(),f=t.pstyle("line-dash-pattern").pfValue,h=t.pstyle("line-dash-offset").pfValue;if(d){var p=r.join("$"),m=i.pathCacheKey&&i.pathCacheKey===p;m?(o=e=i.pathCache,u=!0):(o=e=new Path2D,i.pathCacheKey=p,i.pathCache=o)}if(s.setLineDash)switch(a){case"dotted":s.setLineDash([1,1]);break;case"dashed":s.setLineDash(f),s.lineDashOffset=h;break;case"solid":s.setLineDash([]);break}if(!u&&!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+3<r.length;y+=4)e.quadraticCurveTo(r[y],r[y+1],r[y+2],r[y+3]);break;case"straight":case"haystack":for(var x=2;x+1<r.length;x+=2)e.lineTo(r[x],r[x+1]);break;case"segments":if(i.isRound){var E=xa(i.roundCorners),w;try{for(E.s();!(w=E.n()).done;){var T=w.value;dN(e,T)}}catch(N){E.e(N)}finally{E.f()}e.lineTo(r[r.length-2],r[r.length-1])}else for(var C=2;C+1<r.length;C+=2)e.lineTo(r[C],r[C+1]);break}e=s,d?e.stroke(o):e.stroke(),e.setLineDash&&e.setLineDash([])};ai.drawEdgeTrianglePath=function(t,e,r){e.fillStyle=e.strokeStyle;for(var a=t.pstyle("width").pfValue,i=0;i+1<r.length;i+=2){var s=[r[i+2]-r[i],r[i+3]-r[i+1]],o=Math.sqrt(s[0]*s[0]+s[1]*s[1]),u=[s[1]/o,-s[0]/o],d=[u[0]*a/2,u[1]*a/2];e.beginPath(),e.moveTo(r[i]-d[0],r[i+1]-d[1]),e.lineTo(r[i]+d[0],r[i+1]+d[1]),e.lineTo(r[i+2],r[i+3]),e.closePath(),e.fill()}};ai.drawArrowheads=function(t,e,r){var a=e._private.rscratch,i=a.edgeType==="haystack";i||this.drawArrowhead(t,e,"source",a.arrowStartX,a.arrowStartY,a.srcArrowAngle,r),this.drawArrowhead(t,e,"mid-target",a.midX,a.midY,a.midtgtArrowAngle,r),this.drawArrowhead(t,e,"mid-source",a.midX,a.midY,a.midsrcArrowAngle,r),i||this.drawArrowhead(t,e,"target",a.arrowEndX,a.arrowEndY,a.tgtArrowAngle,r)};ai.drawArrowhead=function(t,e,r,a,i,s,o){if(!(isNaN(a)||a==null||isNaN(i)||i==null||isNaN(s)||s==null)){var u=this,d=e.pstyle(r+"-arrow-shape").value;if(d!=="none"){var f=e.pstyle(r+"-arrow-fill").value==="hollow"?"both":"filled",h=e.pstyle(r+"-arrow-fill").value,p=e.pstyle("width").pfValue,m=e.pstyle(r+"-arrow-width"),y=m.value==="match-line"?p:m.pfValue;m.units==="%"&&(y*=p);var x=e.pstyle("opacity").value;o===void 0&&(o=x);var E=t.globalCompositeOperation;(o!==1||h==="hollow")&&(t.globalCompositeOperation="destination-out",u.colorFillStyle(t,255,255,255,1),u.colorStrokeStyle(t,255,255,255,1),u.drawArrowShape(e,t,f,p,d,y,a,i,s),t.globalCompositeOperation=E);var w=e.pstyle(r+"-arrow-color").value;u.colorFillStyle(t,w[0],w[1],w[2],o),u.colorStrokeStyle(t,w[0],w[1],w[2],o),u.drawArrowShape(e,t,h,p,d,y,a,i,s)}}};ai.drawArrowShape=function(t,e,r,a,i,s,o,u,d){var f=this,h=this.usePaths()&&i!=="triangle-cross",p=!1,m,y=e,x={x:o,y:u},E=t.pstyle("arrow-scale").value,w=this.getArrowWidth(a,E),T=f.arrowShapes[i];if(h){var C=f.arrowPathCache=f.arrowPathCache||[],N=Ws(i),A=C[N];A!=null?(m=e=A,p=!0):(m=e=new Path2D,C[N]=m)}p||(e.beginPath&&e.beginPath(),h?T.draw(e,1,0,{x:0,y:0},1):T.draw(e,w,d,x,a),e.closePath&&e.closePath()),e=y,h&&(e.translate(o,u),e.rotate(d),e.scale(w,w)),(r==="filled"||r==="both")&&(h?e.fill(m):e.fill()),(r==="hollow"||r==="both")&&(e.lineWidth=s/(h?w:1),e.lineJoin="miter",h?e.stroke(m):e.stroke()),h&&(e.scale(1/w,1/w),e.rotate(-d),e.translate(-o,-u))};var uy={};uy.safeDrawImage=function(t,e,r,a,i,s,o,u,d,f){if(!(i<=0||s<=0||d<=0||f<=0))try{t.drawImage(e,r,a,i,s,o,u,d,f)}catch(h){At(h)}};uy.drawInscribedImage=function(t,e,r,a,i){var s=this,o=r.position(),u=o.x,d=o.y,f=r.cy().style(),h=f.getIndexedStyle.bind(f),p=h(r,"background-fit","value",a),m=h(r,"background-repeat","value",a),y=r.width(),x=r.height(),E=r.padding()*2,w=y+(h(r,"background-width-relative-to","value",a)==="inner"?0:E),T=x+(h(r,"background-height-relative-to","value",a)==="inner"?0:E),C=r._private.rscratch,N=h(r,"background-clip","value",a),A=N==="node",D=h(r,"background-image-opacity","value",a)*i,M=h(r,"background-image-smoothing","value",a),j=r.pstyle("corner-radius").value;j!=="auto"&&(j=r.pstyle("corner-radius").pfValue);var k=e.width||e.cachedW,B=e.height||e.cachedH;(k==null||B==null)&&(document.body.appendChild(e),k=e.cachedW=e.width||e.offsetWidth,B=e.cachedH=e.height||e.offsetHeight,document.body.removeChild(e));var P=k,U=B;if(h(r,"background-width","value",a)!=="auto"&&(h(r,"background-width","units",a)==="%"?P=h(r,"background-width","pfValue",a)*w:P=h(r,"background-width","pfValue",a)),h(r,"background-height","value",a)!=="auto"&&(h(r,"background-height","units",a)==="%"?U=h(r,"background-height","pfValue",a)*T:U=h(r,"background-height","pfValue",a)),!(P===0||U===0)){if(p==="contain"){var R=Math.min(w/P,T/U);P*=R,U*=R}else if(p==="cover"){var R=Math.max(w/P,T/U);P*=R,U*=R}var V=u-w/2,_=h(r,"background-position-x","units",a),H=h(r,"background-position-x","pfValue",a);_==="%"?V+=(w-P)*H:V+=H;var z=h(r,"background-offset-x","units",a),I=h(r,"background-offset-x","pfValue",a);z==="%"?V+=(w-P)*I:V+=I;var F=d-T/2,K=h(r,"background-position-y","units",a),J=h(r,"background-position-y","pfValue",a);K==="%"?F+=(T-U)*J:F+=J;var L=h(r,"background-offset-y","units",a),Q=h(r,"background-offset-y","pfValue",a);L==="%"?F+=(T-U)*Q:F+=Q,C.pathCache&&(V-=u,F-=d,u=0,d=0);var X=t.globalAlpha;t.globalAlpha=D;var W=s.getImgSmoothing(t),te=!1;if(M==="no"&&W?(s.setImgSmoothing(t,!1),te=!0):M==="yes"&&!W&&(s.setImgSmoothing(t,!0),te=!0),m==="no-repeat")A&&(t.save(),C.pathCache?t.clip(C.pathCache):(s.nodeShapes[s.getNodeShape(r)].draw(t,u,d,w,T,j,C),t.clip())),s.safeDrawImage(t,e,0,0,k,B,V,F,P,U),A&&t.restore();else{var Y=t.createPattern(e,m);t.fillStyle=Y,s.nodeShapes[s.getNodeShape(r)].draw(t,u,d,w,T,j,C),t.translate(V,F),t.fill(),t.translate(-V,-F)}t.globalAlpha=X,te&&s.setImgSmoothing(t,W)}};var cl={};cl.eleTextBiggerThanMin=function(t,e){if(!e){var r=t.cy().zoom(),a=this.getPixelRatio(),i=Math.ceil($m(r*a));e=Math.pow(2,i)}var s=t.pstyle("font-size").pfValue*e,o=t.pstyle("min-zoomed-font-size").pfValue;return!(s<o)};cl.drawElementText=function(t,e,r,a,i){var s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this;if(a==null){if(s&&!o.eleTextBiggerThanMin(e))return}else if(a===!1)return;if(e.isNode()){var u=e.pstyle("label");if(!u||!u.value)return;var d=o.getLabelJustification(e);t.textAlign=d,t.textBaseline="bottom"}else{var f=e.element()._private.rscratch.badLine,h=e.pstyle("label"),p=e.pstyle("source-label"),m=e.pstyle("target-label");if(f||(!h||!h.value)&&(!p||!p.value)&&(!m||!m.value))return;t.textAlign="center",t.textBaseline="bottom"}var y=!r,x;r&&(x=r,t.translate(-x.x1,-x.y1)),i==null?(o.drawText(t,e,null,y,s),e.isEdge()&&(o.drawText(t,e,"source",y,s),o.drawText(t,e,"target",y,s))):o.drawText(t,e,i,y,s),r&&t.translate(x.x1,x.y1)};cl.getFontCache=function(t){var e;this.fontCaches=this.fontCaches||[];for(var r=0;r<this.fontCaches.length;r++)if(e=this.fontCaches[r],e.context===t)return e;return e={context:t},this.fontCaches.push(e),e};cl.setupTextStyle=function(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=e.pstyle("font-style").strValue,i=e.pstyle("font-size").pfValue+"px",s=e.pstyle("font-family").strValue,o=e.pstyle("font-weight").strValue,u=r?e.effectiveOpacity()*e.pstyle("text-opacity").value:1,d=e.pstyle("text-outline-opacity").value*u,f=e.pstyle("color").value,h=e.pstyle("text-outline-color").value;t.font=a+" "+o+" "+i+" "+s,t.lineJoin="round",this.colorFillStyle(t,f[0],f[1],f[2],u),this.colorStrokeStyle(t,h[0],h[1],h[2],d)};function QL(t,e,r,a,i){var s=Math.min(a,i),o=s/2,u=e+a/2,d=r+i/2;t.beginPath(),t.arc(u,d,o,0,Math.PI*2),t.closePath()}function sE(t,e,r,a,i){var s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,o=Math.min(s,a/2,i/2);t.beginPath(),t.moveTo(e+o,r),t.lineTo(e+a-o,r),t.quadraticCurveTo(e+a,r,e+a,r+o),t.lineTo(e+a,r+i-o),t.quadraticCurveTo(e+a,r+i,e+a-o,r+i),t.lineTo(e+o,r+i),t.quadraticCurveTo(e,r+i,e,r+i-o),t.lineTo(e,r+o),t.quadraticCurveTo(e,r,e+o,r),t.closePath()}cl.getTextAngle=function(t,e){var r,a=t._private,i=a.rscratch,s=e?e+"-":"",o=t.pstyle(s+"text-rotation");if(o.strValue==="autorotate"){var u=ga(i,"labelAngle",e);r=t.isEdge()?u:0}else o.strValue==="none"?r=0:r=o.pfValue;return r};cl.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,s=e._private,o=s.rscratch,u=i?e.effectiveOpacity():1;if(!(i&&(u===0||e.pstyle("text-opacity").value===0))){r==="main"&&(r=null);var d=ga(o,"labelX",r),f=ga(o,"labelY",r),h,p,m=this.getLabelText(e,r);if(m!=null&&m!==""&&!isNaN(d)&&!isNaN(f)){this.setupTextStyle(t,e,i);var y=r?r+"-":"",x=ga(o,"labelWidth",r),E=ga(o,"labelHeight",r),w=e.pstyle(y+"text-margin-x").pfValue,T=e.pstyle(y+"text-margin-y").pfValue,C=e.isEdge(),N=e.pstyle("text-halign").value,A=e.pstyle("text-valign").value;C&&(N="center",A="center"),d+=w,f+=T;var D;switch(a?D=this.getTextAngle(e,r):D=0,D!==0&&(h=d,p=f,t.translate(h,p),t.rotate(D),d=0,f=0),A){case"top":break;case"center":f+=E/2;break;case"bottom":f+=E;break}var M=e.pstyle("text-background-opacity").value,j=e.pstyle("text-border-opacity").value,k=e.pstyle("text-border-width").pfValue,B=e.pstyle("text-background-padding").pfValue,P=e.pstyle("text-background-shape").strValue,U=P==="round-rectangle"||P==="roundrectangle",R=P==="circle",V=2;if(M>0||k>0&&j>0){var _=t.fillStyle,H=t.strokeStyle,z=t.lineWidth,I=e.pstyle("text-background-color").value,F=e.pstyle("text-border-color").value,K=e.pstyle("text-border-style").value,J=M>0,L=k>0&&j>0,Q=d-B;switch(N){case"left":Q-=x;break;case"center":Q-=x/2;break}var X=f-E-B,W=x+2*B,te=E+2*B;if(J&&(t.fillStyle="rgba(".concat(I[0],",").concat(I[1],",").concat(I[2],",").concat(M*u,")")),L&&(t.strokeStyle="rgba(".concat(F[0],",").concat(F[1],",").concat(F[2],",").concat(j*u,")"),t.lineWidth=k,t.setLineDash))switch(K){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"double":t.lineWidth=k/4,t.setLineDash([]);break;case"solid":default:t.setLineDash([]);break}if(U?(t.beginPath(),sE(t,Q,X,W,te,V)):R?(t.beginPath(),QL(t,Q,X,W,te)):(t.beginPath(),t.rect(Q,X,W,te)),J&&t.fill(),L&&t.stroke(),L&&K==="double"){var Y=k/2;t.beginPath(),U?sE(t,Q+Y,X+Y,W-2*Y,te-2*Y,V):t.rect(Q+Y,X+Y,W-2*Y,te-2*Y),t.stroke()}t.fillStyle=_,t.strokeStyle=H,t.lineWidth=z,t.setLineDash&&t.setLineDash([])}var ne=2*e.pstyle("text-outline-width").pfValue;if(ne>0&&(t.lineWidth=ne),e.pstyle("text-wrap").value==="wrap"){var he=ga(o,"labelWrapCachedLines",r),oe=ga(o,"labelLineHeight",r),ae=x/2,re=this.getLabelJustification(e);switch(re==="auto"||(N==="left"?re==="left"?d+=-x:re==="center"&&(d+=-ae):N==="center"?re==="left"?d+=-ae:re==="right"&&(d+=ae):N==="right"&&(re==="center"?d+=ae:re==="right"&&(d+=x))),A){case"top":f-=(he.length-1)*oe;break;case"center":case"bottom":f-=(he.length-1)*oe;break}for(var le=0;le<he.length;le++)ne>0&&t.strokeText(he[le],d,f),t.fillText(he[le],d,f),f+=oe}else ne>0&&t.strokeText(m,d,f),t.fillText(m,d,f);D!==0&&(t.rotate(-D),t.translate(-h,-p))}}};var hs={};hs.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,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,u,d,f=e._private,h=f.rscratch,p=e.position();if(!(!De(p.x)||!De(p.y))&&!(s&&!e.visible())){var m=s?e.effectiveOpacity():1,y=o.usePaths(),x,E=!1,w=e.padding();u=e.width()+2*w,d=e.height()+2*w;var T;r&&(T=r,t.translate(-T.x1,-T.y1));for(var C=e.pstyle("background-image"),N=C.value,A=new Array(N.length),D=new Array(N.length),M=0,j=0;j<N.length;j++){var k=N[j],B=A[j]=k!=null&&k!=="none";if(B){var P=e.cy().style().getIndexedStyle(e,"background-image-crossorigin","value",j);M++,D[j]=o.getCachedImage(k,P,function(){f.backgroundTimestamp=Date.now(),e.emitAndNotify("background")})}}var U=e.pstyle("background-blacken").value,R=e.pstyle("border-width").pfValue,V=e.pstyle("background-opacity").value*m,_=e.pstyle("border-color").value,H=e.pstyle("border-style").value,z=e.pstyle("border-join").value,I=e.pstyle("border-cap").value,F=e.pstyle("border-position").value,K=e.pstyle("border-dash-pattern").pfValue,J=e.pstyle("border-dash-offset").pfValue,L=e.pstyle("border-opacity").value*m,Q=e.pstyle("outline-width").pfValue,X=e.pstyle("outline-color").value,W=e.pstyle("outline-style").value,te=e.pstyle("outline-opacity").value*m,Y=e.pstyle("outline-offset").value,ne=e.pstyle("corner-radius").value;ne!=="auto"&&(ne=e.pstyle("corner-radius").pfValue);var he=function(){var Re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:V;o.eleFillStyle(t,e,Re)},oe=function(){var Re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:L;o.colorStrokeStyle(t,_[0],_[1],_[2],Re)},ae=function(){var Re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:te;o.colorStrokeStyle(t,X[0],X[1],X[2],Re)},re=function(Re,we,$,ce){var ge=o.nodePathCache=o.nodePathCache||[],pe=oC($==="polygon"?$+","+ce.join(","):$,""+we,""+Re,""+ne),Ee=ge[pe],Ue,je=!1;return Ee!=null?(Ue=Ee,je=!0,h.pathCache=Ue):(Ue=new Path2D,ge[pe]=h.pathCache=Ue),{path:Ue,cacheHit:je}},le=e.pstyle("shape").strValue,se=e.pstyle("shape-polygon-points").pfValue;if(y){t.translate(p.x,p.y);var Ne=re(u,d,le,se);x=Ne.path,E=Ne.cacheHit}var Ae=function(){if(!E){var Re=p;y&&(Re={x:0,y:0}),o.nodeShapes[o.getNodeShape(e)].draw(x||t,Re.x,Re.y,u,d,ne,h)}y?t.fill(x):t.fill()},Ze=function(){for(var Re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:m,we=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,$=f.backgrounding,ce=0,ge=0;ge<D.length;ge++){var pe=e.cy().style().getIndexedStyle(e,"background-image-containment","value",ge);if(we&&pe==="over"||!we&&pe==="inside"){ce++;continue}A[ge]&&D[ge].complete&&!D[ge].error&&(ce++,o.drawInscribedImage(t,D[ge],e,ge,Re))}f.backgrounding=ce!==M,$!==f.backgrounding&&e.updateStyle(!1)},Qe=function(){var Re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,we=arguments.length>1&&arguments[1]!==void 0?arguments[1]:m;o.hasPie(e)&&(o.drawPie(t,e,we),Re&&(y||o.nodeShapes[o.getNodeShape(e)].draw(t,p.x,p.y,u,d,ne,h)))},Se=function(){var Re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,we=arguments.length>1&&arguments[1]!==void 0?arguments[1]:m;o.hasStripe(e)&&(t.save(),y?t.clip(h.pathCache):(o.nodeShapes[o.getNodeShape(e)].draw(t,p.x,p.y,u,d,ne,h),t.clip()),o.drawStripe(t,e,we),t.restore(),Re&&(y||o.nodeShapes[o.getNodeShape(e)].draw(t,p.x,p.y,u,d,ne,h)))},Oe=function(){var Re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:m,we=(U>0?U:-U)*Re,$=U>0?0:255;U!==0&&(o.colorFillStyle(t,$,$,$,we),y?t.fill(x):t.fill())},ke=function(){if(R>0){if(t.lineWidth=R,t.lineCap=I,t.lineJoin=z,t.setLineDash)switch(H){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash(K),t.lineDashOffset=J;break;case"solid":case"double":t.setLineDash([]);break}if(F!=="center"){if(t.save(),t.lineWidth*=2,F==="inside")y?t.clip(x):t.clip();else{var Re=new Path2D;Re.rect(-u/2-R,-d/2-R,u+2*R,d+2*R),Re.addPath(x),t.clip(Re,"evenodd")}y?t.stroke(x):t.stroke(),t.restore()}else y?t.stroke(x):t.stroke();if(H==="double"){t.lineWidth=R/3;var we=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",y?t.stroke(x):t.stroke(),t.globalCompositeOperation=we}t.setLineDash&&t.setLineDash([])}},Pe=function(){if(Q>0){if(t.lineWidth=Q,t.lineCap="butt",t.setLineDash)switch(W){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"solid":case"double":t.setLineDash([]);break}var Re=p;y&&(Re={x:0,y:0});var we=o.getNodeShape(e),$=R;F==="inside"&&($=0),F==="outside"&&($*=2);var ce=(u+$+(Q+Y))/u,ge=(d+$+(Q+Y))/d,pe=u*ce,Ee=d*ge,Ue=o.nodeShapes[we].points,je;if(y){var He=re(pe,Ee,we,Ue);je=He.path}if(we==="ellipse")o.drawEllipsePath(je||t,Re.x,Re.y,pe,Ee);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(we)){var _e=0,Ke=0,it=0;we==="round-diamond"?_e=($+Y+Q)*1.4:we==="round-heptagon"?(_e=($+Y+Q)*1.075,it=-($/2+Y+Q)/35):we==="round-hexagon"?_e=($+Y+Q)*1.12:we==="round-pentagon"?(_e=($+Y+Q)*1.13,it=-($/2+Y+Q)/15):we==="round-tag"?(_e=($+Y+Q)*1.12,Ke=($/2+Q+Y)*.07):we==="round-triangle"&&(_e=($+Y+Q)*(Math.PI/2),it=-($+Y/2+Q)/Math.PI),_e!==0&&(ce=(u+_e)/u,pe=u*ce,["round-hexagon","round-tag"].includes(we)||(ge=(d+_e)/d,Ee=d*ge)),ne=ne==="auto"?yC(pe,Ee):ne;for(var st=pe/2,Ve=Ee/2,dt=ne+($+Q+Y)/2,ut=new Array(Ue.length/2),Yt=new Array(Ue.length/2),Ot=0;Ot<Ue.length/2;Ot++)ut[Ot]={x:Re.x+Ke+st*Ue[Ot*2],y:Re.y+it+Ve*Ue[Ot*2+1]};var Lr,Kt,sr,Jt,lr=ut.length;for(Kt=ut[lr-1],Lr=0;Lr<lr;Lr++)sr=ut[Lr%lr],Jt=ut[(Lr+1)%lr],Yt[Lr]=ly(Kt,sr,Jt,dt),Kt=sr,sr=Jt;o.drawRoundPolygonPath(je||t,Re.x+Ke,Re.y+it,u*ce,d*ge,Ue,Yt)}else if(["roundrectangle","round-rectangle"].includes(we))ne=ne==="auto"?ns(pe,Ee):ne,o.drawRoundRectanglePath(je||t,Re.x,Re.y,pe,Ee,ne+($+Q+Y)/2);else if(["cutrectangle","cut-rectangle"].includes(we))ne=ne==="auto"?Xm():ne,o.drawCutRectanglePath(je||t,Re.x,Re.y,pe,Ee,null,ne+($+Q+Y)/4);else if(["bottomroundrectangle","bottom-round-rectangle"].includes(we))ne=ne==="auto"?ns(pe,Ee):ne,o.drawBottomRoundRectanglePath(je||t,Re.x,Re.y,pe,Ee,ne+($+Q+Y)/2);else if(we==="barrel")o.drawBarrelPath(je||t,Re.x,Re.y,pe,Ee);else if(we.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(we)){var Ra=($+Q+Y)/u;Ue=qf(If(Ue,Ra)),o.drawPolygonPath(je||t,Re.x,Re.y,u,d,Ue)}else{var Xt=($+Q+Y)/u;Ue=qf(If(Ue,-Xt)),o.drawPolygonPath(je||t,Re.x,Re.y,u,d,Ue)}if(y?t.stroke(je):t.stroke(),W==="double"){t.lineWidth=$/3;var Ba=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",y?t.stroke(je):t.stroke(),t.globalCompositeOperation=Ba}t.setLineDash&&t.setLineDash([])}},Ge=function(){i&&o.drawNodeOverlay(t,e,p,u,d)},Je=function(){i&&o.drawNodeUnderlay(t,e,p,u,d)},Be=function(){o.drawElementText(t,e,null,a)},nt=e.pstyle("ghost").value==="yes";if(nt){var ye=e.pstyle("ghost-offset-x").pfValue,$e=e.pstyle("ghost-offset-y").pfValue,et=e.pstyle("ghost-opacity").value,xe=et*m;t.translate(ye,$e),ae(),Pe(),he(et*V),Ae(),Ze(xe,!0),oe(et*L),ke(),Qe(U!==0||R!==0),Se(U!==0||R!==0),Ze(xe,!1),Oe(xe),t.translate(-ye,-$e)}y&&t.translate(-p.x,-p.y),Je(),y&&t.translate(p.x,p.y),ae(),Pe(),he(),Ae(),Ze(m,!0),oe(),ke(),Qe(U!==0||R!==0),Se(U!==0||R!==0),Ze(m,!1),Oe(),y&&t.translate(-p.x,-p.y),Be(),Ge(),r&&t.translate(T.x1,T.y1)}};var TN=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(r,a,i,s,o){var u=this;if(a.visible()){var d=a.pstyle("".concat(e,"-padding")).pfValue,f=a.pstyle("".concat(e,"-opacity")).value,h=a.pstyle("".concat(e,"-color")).value,p=a.pstyle("".concat(e,"-shape")).value,m=a.pstyle("".concat(e,"-corner-radius")).value;if(f>0){if(i=i||a.position(),s==null||o==null){var y=a.padding();s=a.width()+2*y,o=a.height()+2*y}u.colorFillStyle(r,h[0],h[1],h[2],f),u.nodeShapes[p].draw(r,i.x,i.y,s+d*2,o+d*2,m),r.fill()}}}};hs.drawNodeOverlay=TN("overlay");hs.drawNodeUnderlay=TN("underlay");hs.hasPie=function(t){return t=t[0],t._private.hasPie};hs.hasStripe=function(t){return t=t[0],t._private.hasStripe};hs.drawPie=function(t,e,r,a){e=e[0],a=a||e.position();var i=e.cy().style(),s=e.pstyle("pie-size"),o=e.pstyle("pie-hole"),u=e.pstyle("pie-start-angle").pfValue,d=a.x,f=a.y,h=e.width(),p=e.height(),m=Math.min(h,p)/2,y,x=0,E=this.usePaths();if(E&&(d=0,f=0),s.units==="%"?m=m*s.pfValue:s.pfValue!==void 0&&(m=s.pfValue/2),o.units==="%"?y=m*o.pfValue:o.pfValue!==void 0&&(y=o.pfValue/2),!(y>=m))for(var w=1;w<=i.pieBackgroundN;w++){var T=e.pstyle("pie-"+w+"-background-size").value,C=e.pstyle("pie-"+w+"-background-color").value,N=e.pstyle("pie-"+w+"-background-opacity").value*r,A=T/100;A+x>1&&(A=1-x);var D=1.5*Math.PI+2*Math.PI*x;D+=u;var M=2*Math.PI*A,j=D+M;T===0||x>=1||x+A>1||(y===0?(t.beginPath(),t.moveTo(d,f),t.arc(d,f,m,D,j),t.closePath()):(t.beginPath(),t.arc(d,f,m,D,j),t.arc(d,f,y,j,D,!0),t.closePath()),this.colorFillStyle(t,C[0],C[1],C[2],N),t.fill(),x+=A)}};hs.drawStripe=function(t,e,r,a){e=e[0],a=a||e.position();var i=e.cy().style(),s=a.x,o=a.y,u=e.width(),d=e.height(),f=0,h=this.usePaths();t.save();var p=e.pstyle("stripe-direction").value,m=e.pstyle("stripe-size");switch(p){case"vertical":break;case"righward":t.rotate(-Math.PI/2);break}var y=u,x=d;m.units==="%"?(y=y*m.pfValue,x=x*m.pfValue):m.pfValue!==void 0&&(y=m.pfValue,x=m.pfValue),h&&(s=0,o=0),o-=y/2,s-=x/2;for(var E=1;E<=i.stripeBackgroundN;E++){var w=e.pstyle("stripe-"+E+"-background-size").value,T=e.pstyle("stripe-"+E+"-background-color").value,C=e.pstyle("stripe-"+E+"-background-opacity").value*r,N=w/100;N+f>1&&(N=1-f),!(w===0||f>=1||f+N>1)&&(t.beginPath(),t.rect(s,o+x*f,y,x*N),t.closePath(),this.colorFillStyle(t,T[0],T[1],T[2],C),t.fill(),f+=N)}t.restore()};var ia={},$L=100;ia.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};ia.paintCache=function(t){for(var e=this.paintCaches=this.paintCaches||[],r=!0,a,i=0;i<e.length;i++)if(a=e[i],a.context===t){r=!1;break}return r&&(a={context:t},e.push(a)),a};ia.createGradientStyleFor=function(t,e,r,a,i){var s,o=this.usePaths(),u=r.pstyle(e+"-gradient-stop-colors").value,d=r.pstyle(e+"-gradient-stop-positions").pfValue;if(a==="radial-gradient")if(r.isEdge()){var f=r.sourceEndpoint(),h=r.targetEndpoint(),p=r.midpoint(),m=Js(f,p),y=Js(h,p);s=t.createRadialGradient(p.x,p.y,0,p.x,p.y,Math.max(m,y))}else{var x=o?{x:0,y:0}:r.position(),E=r.paddedWidth(),w=r.paddedHeight();s=t.createRadialGradient(x.x,x.y,0,x.x,x.y,Math.max(E,w))}else if(r.isEdge()){var T=r.sourceEndpoint(),C=r.targetEndpoint();s=t.createLinearGradient(T.x,T.y,C.x,C.y)}else{var N=o?{x:0,y:0}:r.position(),A=r.paddedWidth(),D=r.paddedHeight(),M=A/2,j=D/2,k=r.pstyle("background-gradient-direction").value;switch(k){case"to-bottom":s=t.createLinearGradient(N.x,N.y-j,N.x,N.y+j);break;case"to-top":s=t.createLinearGradient(N.x,N.y+j,N.x,N.y-j);break;case"to-left":s=t.createLinearGradient(N.x+M,N.y,N.x-M,N.y);break;case"to-right":s=t.createLinearGradient(N.x-M,N.y,N.x+M,N.y);break;case"to-bottom-right":case"to-right-bottom":s=t.createLinearGradient(N.x-M,N.y-j,N.x+M,N.y+j);break;case"to-top-right":case"to-right-top":s=t.createLinearGradient(N.x-M,N.y+j,N.x+M,N.y-j);break;case"to-bottom-left":case"to-left-bottom":s=t.createLinearGradient(N.x+M,N.y-j,N.x-M,N.y+j);break;case"to-top-left":case"to-left-top":s=t.createLinearGradient(N.x+M,N.y+j,N.x-M,N.y-j);break}}if(!s)return null;for(var B=d.length===u.length,P=u.length,U=0;U<P;U++)s.addColorStop(B?d[U]:U/(P-1),"rgba("+u[U][0]+","+u[U][1]+","+u[U][2]+","+i+")");return s};ia.gradientFillStyle=function(t,e,r,a){var i=this.createGradientStyleFor(t,"background",e,r,a);if(!i)return null;t.fillStyle=i};ia.colorFillStyle=function(t,e,r,a,i){t.fillStyle="rgba("+e+","+r+","+a+","+i+")"};ia.eleFillStyle=function(t,e,r){var a=e.pstyle("background-fill").value;if(a==="linear-gradient"||a==="radial-gradient")this.gradientFillStyle(t,e,a,r);else{var i=e.pstyle("background-color").value;this.colorFillStyle(t,i[0],i[1],i[2],r)}};ia.gradientStrokeStyle=function(t,e,r,a){var i=this.createGradientStyleFor(t,"line",e,r,a);if(!i)return null;t.strokeStyle=i};ia.colorStrokeStyle=function(t,e,r,a,i){t.strokeStyle="rgba("+e+","+r+","+a+","+i+")"};ia.eleStrokeStyle=function(t,e,r){var a=e.pstyle("line-fill").value;if(a==="linear-gradient"||a==="radial-gradient")this.gradientStrokeStyle(t,e,a,r);else{var i=e.pstyle("line-color").value;this.colorStrokeStyle(t,i[0],i[1],i[2],r)}};ia.matchCanvasSize=function(t){var e=this,r=e.data,a=e.findContainerClientCoords(),i=a[2],s=a[3],o=e.getPixelRatio(),u=e.motionBlurPxRatio;(t===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE]||t===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG])&&(o=u);var d=i*o,f=s*o,h;if(!(d===e.canvasWidth&&f===e.canvasHeight)){e.fontCaches=null;var p=r.canvasContainer;p.style.width=i+"px",p.style.height=s+"px";for(var m=0;m<e.CANVAS_LAYERS;m++)h=r.canvases[m],h.width=d,h.height=f,h.style.width=i+"px",h.style.height=s+"px";for(var m=0;m<e.BUFFER_COUNT;m++)h=r.bufferCanvases[m],h.width=d,h.height=f,h.style.width=i+"px",h.style.height=s+"px";e.textureMult=1,o<=1&&(h=r.bufferCanvases[e.TEXTURE_BUFFER],e.textureMult=2,h.width=d*e.textureMult,h.height=f*e.textureMult),e.canvasWidth=d,e.canvasHeight=f,e.pixelRatio=o}};ia.renderTo=function(t,e,r,a){this.render({forcedContext:t,forcedZoom:e,forcedPan:r,drawAllLayers:!0,forcedPxRatio:a})};ia.clearCanvas=function(){var t=this,e=t.data;function r(a){a.clearRect(0,0,t.canvasWidth,t.canvasHeight)}r(e.contexts[t.NODE]),r(e.contexts[t.DRAG])};ia.render=function(t){var e=this;t=t||fC();var r=e.cy,a=t.forcedContext,i=t.drawAllLayers,s=t.drawOnlyNodeLayer,o=t.forcedZoom,u=t.forcedPan,d=t.forcedPxRatio===void 0?this.getPixelRatio():t.forcedPxRatio,f=e.data,h=f.canvasNeedsRedraw,p=e.textureOnViewport&&!a&&(e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming),m=t.motionBlur!==void 0?t.motionBlur:e.motionBlur,y=e.motionBlurPxRatio,x=r.hasCompoundNodes(),E=e.hoverData.draggingEles,w=!!(e.hoverData.selecting||e.touchData.selecting);m=m&&!a&&e.motionBlurEnabled&&!w;var T=m;a||(e.prevPxRatio!==d&&(e.invalidateContainerClientCoordsCache(),e.matchCanvasSize(e.container),e.redrawHint("eles",!0),e.redrawHint("drag",!0)),e.prevPxRatio=d),!a&&e.motionBlurTimeout&&clearTimeout(e.motionBlurTimeout),m&&(e.mbFrames==null&&(e.mbFrames=0),e.mbFrames++,e.mbFrames<3&&(T=!1),e.mbFrames>e.minMbLowQualFrames&&(e.motionBlurPxRatio=e.mbPxRBlurry)),e.clearingMotionBlur&&(e.motionBlurPxRatio=1),e.textureDrawLastFrame&&!p&&(h[e.NODE]=!0,h[e.SELECT_BOX]=!0);var C=r.style(),N=r.zoom(),A=o!==void 0?o:N,D=r.pan(),M={x:D.x,y:D.y},j={zoom:N,pan:{x:D.x,y:D.y}},k=e.prevViewport,B=k===void 0||j.zoom!==k.zoom||j.pan.x!==k.pan.x||j.pan.y!==k.pan.y;!B&&!(E&&!x)&&(e.motionBlurPxRatio=1),u&&(M=u),A*=d,M.x*=d,M.y*=d;var P=e.getCachedZSortedEles();function U(oe,ae,re,le,se){var Ne=oe.globalCompositeOperation;oe.globalCompositeOperation="destination-out",e.colorFillStyle(oe,255,255,255,e.motionBlurTransparency),oe.fillRect(ae,re,le,se),oe.globalCompositeOperation=Ne}function R(oe,ae){var re,le,se,Ne;!e.clearingMotionBlur&&(oe===f.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]||oe===f.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG])?(re={x:D.x*y,y:D.y*y},le=N*y,se=e.canvasWidth*y,Ne=e.canvasHeight*y):(re=M,le=A,se=e.canvasWidth,Ne=e.canvasHeight),oe.setTransform(1,0,0,1,0,0),ae==="motionBlur"?U(oe,0,0,se,Ne):!a&&(ae===void 0||ae)&&oe.clearRect(0,0,se,Ne),i||(oe.translate(re.x,re.y),oe.scale(le,le)),u&&oe.translate(u.x,u.y),o&&oe.scale(o,o)}if(p||(e.textureDrawLastFrame=!1),p){if(e.textureDrawLastFrame=!0,!e.textureCache){e.textureCache={},e.textureCache.bb=r.mutableElements().boundingBox(),e.textureCache.texture=e.data.bufferCanvases[e.TEXTURE_BUFFER];var V=e.data.bufferContexts[e.TEXTURE_BUFFER];V.setTransform(1,0,0,1,0,0),V.clearRect(0,0,e.canvasWidth*e.textureMult,e.canvasHeight*e.textureMult),e.render({forcedContext:V,drawOnlyNodeLayer:!0,forcedPxRatio:d*e.textureMult});var j=e.textureCache.viewport={zoom:r.zoom(),pan:r.pan(),width:e.canvasWidth,height:e.canvasHeight};j.mpan={x:(0-j.pan.x)/j.zoom,y:(0-j.pan.y)/j.zoom}}h[e.DRAG]=!1,h[e.NODE]=!1;var _=f.contexts[e.NODE],H=e.textureCache.texture,j=e.textureCache.viewport;_.setTransform(1,0,0,1,0,0),m?U(_,0,0,j.width,j.height):_.clearRect(0,0,j.width,j.height);var z=C.core("outside-texture-bg-color").value,I=C.core("outside-texture-bg-opacity").value;e.colorFillStyle(_,z[0],z[1],z[2],I),_.fillRect(0,0,j.width,j.height);var N=r.zoom();R(_,!1),_.clearRect(j.mpan.x,j.mpan.y,j.width/j.zoom/d,j.height/j.zoom/d),_.drawImage(H,j.mpan.x,j.mpan.y,j.width/j.zoom/d,j.height/j.zoom/d)}else e.textureOnViewport&&!a&&(e.textureCache=null);var F=r.extent(),K=e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming||e.hoverData.draggingEles||e.cy.animated(),J=e.hideEdgesOnViewport&&K,L=[];if(L[e.NODE]=!h[e.NODE]&&m&&!e.clearedForMotionBlur[e.NODE]||e.clearingMotionBlur,L[e.NODE]&&(e.clearedForMotionBlur[e.NODE]=!0),L[e.DRAG]=!h[e.DRAG]&&m&&!e.clearedForMotionBlur[e.DRAG]||e.clearingMotionBlur,L[e.DRAG]&&(e.clearedForMotionBlur[e.DRAG]=!0),h[e.NODE]||i||s||L[e.NODE]){var Q=m&&!L[e.NODE]&&y!==1,_=a||(Q?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]:f.contexts[e.NODE]),X=m&&!Q?"motionBlur":void 0;R(_,X),J?e.drawCachedNodes(_,P.nondrag,d,F):e.drawLayeredElements(_,P.nondrag,d,F),e.debug&&e.drawDebugPoints(_,P.nondrag),!i&&!m&&(h[e.NODE]=!1)}if(!s&&(h[e.DRAG]||i||L[e.DRAG])){var Q=m&&!L[e.DRAG]&&y!==1,_=a||(Q?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG]:f.contexts[e.DRAG]);R(_,m&&!Q?"motionBlur":void 0),J?e.drawCachedNodes(_,P.drag,d,F):e.drawCachedElements(_,P.drag,d,F),e.debug&&e.drawDebugPoints(_,P.drag),!i&&!m&&(h[e.DRAG]=!1)}if(this.drawSelectionRectangle(t,R),m&&y!==1){var W=f.contexts[e.NODE],te=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE],Y=f.contexts[e.DRAG],ne=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG],he=function(ae,re,le){ae.setTransform(1,0,0,1,0,0),le||!T?ae.clearRect(0,0,e.canvasWidth,e.canvasHeight):U(ae,0,0,e.canvasWidth,e.canvasHeight);var se=y;ae.drawImage(re,0,0,e.canvasWidth*se,e.canvasHeight*se,0,0,e.canvasWidth,e.canvasHeight)};(h[e.NODE]||L[e.NODE])&&(he(W,te,L[e.NODE]),h[e.NODE]=!1),(h[e.DRAG]||L[e.DRAG])&&(he(Y,ne,L[e.DRAG]),h[e.DRAG]=!1)}e.prevViewport=j,e.clearingMotionBlur&&(e.clearingMotionBlur=!1,e.motionBlurCleared=!0,e.motionBlur=!0),m&&(e.motionBlurTimeout=setTimeout(function(){e.motionBlurTimeout=null,e.clearedForMotionBlur[e.NODE]=!1,e.clearedForMotionBlur[e.DRAG]=!1,e.motionBlur=!1,e.clearingMotionBlur=!p,e.mbFrames=0,h[e.NODE]=!0,h[e.DRAG]=!0,e.redraw()},$L)),a||r.emit("render")};var Pu;ia.drawSelectionRectangle=function(t,e){var r=this,a=r.cy,i=r.data,s=a.style(),o=t.drawOnlyNodeLayer,u=t.drawAllLayers,d=i.canvasNeedsRedraw,f=t.forcedContext;if(r.showFps||!o&&d[r.SELECT_BOX]&&!u){var h=f||i.contexts[r.SELECT_BOX];if(e(h),r.selection[4]==1&&(r.hoverData.selecting||r.touchData.selecting)){var p=r.cy.zoom(),m=s.core("selection-box-border-width").value/p;h.lineWidth=m,h.fillStyle="rgba("+s.core("selection-box-color").value[0]+","+s.core("selection-box-color").value[1]+","+s.core("selection-box-color").value[2]+","+s.core("selection-box-opacity").value+")",h.fillRect(r.selection[0],r.selection[1],r.selection[2]-r.selection[0],r.selection[3]-r.selection[1]),m>0&&(h.strokeStyle="rgba("+s.core("selection-box-border-color").value[0]+","+s.core("selection-box-border-color").value[1]+","+s.core("selection-box-border-color").value[2]+","+s.core("selection-box-opacity").value+")",h.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 p=r.cy.zoom(),y=i.bgActivePosistion;h.fillStyle="rgba("+s.core("active-bg-color").value[0]+","+s.core("active-bg-color").value[1]+","+s.core("active-bg-color").value[2]+","+s.core("active-bg-opacity").value+")",h.beginPath(),h.arc(y.x,y.y,s.core("active-bg-size").pfValue/p,0,2*Math.PI),h.fill()}var x=r.lastRedrawTime;if(r.showFps&&x){x=Math.round(x);var E=Math.round(1e3/x),w="1 frame = "+x+" ms = "+E+" fps";if(h.setTransform(1,0,0,1,0,0),h.fillStyle="rgba(255, 0, 0, 0.75)",h.strokeStyle="rgba(255, 0, 0, 0.75)",h.font="30px Arial",!Pu){var T=h.measureText(w);Pu=T.actualBoundingBoxAscent}h.fillText(w,0,Pu);var C=60;h.strokeRect(0,Pu+10,250,20),h.fillRect(0,Pu+10,250*Math.min(E/C,1),20)}u||(d[r.SELECT_BOX]=!1)}};function lE(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 YL(t,e,r){var a=lE(t,t.VERTEX_SHADER,e),i=lE(t,t.FRAGMENT_SHADER,r),s=t.createProgram();if(t.attachShader(s,a),t.attachShader(s,i),t.linkProgram(s),!t.getProgramParameter(s,t.LINK_STATUS))throw new Error("Could not initialize shaders");return s}function KL(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 cy(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 XL(t){var e=t.pixelRatio,r=t.cy.zoom();return r*e}function ZL(t,e,r,a,i){var s=a*r+e.x,o=i*r+e.y;return o=Math.round(t.canvasHeight-o),[s,o]}function WL(t){return 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 JL(t,e){if(t.length!==e.length)return!1;for(var r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}function Rs(t,e,r){var a=t[0]/255,i=t[1]/255,s=t[2]/255,o=e,u=r||new Array(4);return u[0]=a*o,u[1]=i*o,u[2]=s*o,u[3]=o,u}function Wl(t,e){var r=e||new Array(4);return r[0]=(t>>0&255)/255,r[1]=(t>>8&255)/255,r[2]=(t>>16&255)/255,r[3]=(t>>24&255)/255,r}function eP(t){return t[0]+(t[1]<<8)+(t[2]<<16)+(t[3]<<24)}function tP(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 CN(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 NN(t,e,r){switch(e){case t.FLOAT:return new Float32Array(r);case t.INT:return new Int32Array(r)}}function rP(t,e,r,a,i,s){switch(e){case t.FLOAT:return new Float32Array(r.buffer,s*a,i);case t.INT:return new Int32Array(r.buffer,s*a,i)}}function aP(t,e,r,a){var i=CN(t,e),s=mr(i,2),o=s[0],u=s[1],d=NN(t,u,a),f=t.createBuffer();return t.bindBuffer(t.ARRAY_BUFFER,f),t.bufferData(t.ARRAY_BUFFER,d,t.STATIC_DRAW),u===t.FLOAT?t.vertexAttribPointer(r,o,u,!1,0,0):u===t.INT&&t.vertexAttribIPointer(r,o,u,0,0),t.enableVertexAttribArray(r),t.bindBuffer(t.ARRAY_BUFFER,null),f}function gn(t,e,r,a){var i=CN(t,r),s=mr(i,3),o=s[0],u=s[1],d=s[2],f=NN(t,u,e*o),h=o*d,p=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,p),t.bufferData(t.ARRAY_BUFFER,e*h,t.DYNAMIC_DRAW),t.enableVertexAttribArray(a),u===t.FLOAT?t.vertexAttribPointer(a,o,u,!1,h,0):u===t.INT&&t.vertexAttribIPointer(a,o,u,h,0),t.vertexAttribDivisor(a,1),t.bindBuffer(t.ARRAY_BUFFER,null);for(var m=new Array(e),y=0;y<e;y++)m[y]=rP(t,u,f,h,o,y);return p.dataArray=f,p.stride=h,p.size=o,p.getView=function(x){return m[x]},p.setPoint=function(x,E,w){var T=m[x];T[0]=E,T[1]=w},p.bufferSubData=function(x){t.bindBuffer(t.ARRAY_BUFFER,p),x?t.bufferSubData(t.ARRAY_BUFFER,0,f,0,x*o):t.bufferSubData(t.ARRAY_BUFFER,0,f)},p}function nP(t,e,r){for(var a=9,i=new Float32Array(e*a),s=new Array(e),o=0;o<e;o++){var u=o*a*4;s[o]=new Float32Array(i.buffer,u,a)}var d=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,d),t.bufferData(t.ARRAY_BUFFER,i.byteLength,t.DYNAMIC_DRAW);for(var f=0;f<3;f++){var h=r+f;t.enableVertexAttribArray(h),t.vertexAttribPointer(h,3,t.FLOAT,!1,36,f*12),t.vertexAttribDivisor(h,1)}return t.bindBuffer(t.ARRAY_BUFFER,null),d.getMatrixView=function(p){return s[p]},d.setData=function(p,m){s[m].set(p,0)},d.bufferSubData=function(){t.bindBuffer(t.ARRAY_BUFFER,d),t.bufferSubData(t.ARRAY_BUFFER,0,i)},d}function iP(t){var e=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,e);var r=t.createTexture();return t.bindTexture(t.TEXTURE_2D,r),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),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.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0),t.bindFramebuffer(t.FRAMEBUFFER,null),e.setFramebufferAttachmentSizes=function(a,i){t.bindTexture(t.TEXTURE_2D,r),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,a,i,0,t.RGBA,t.UNSIGNED_BYTE,null)},e}var oE=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});function vg(){var t=new oE(9);return oE!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function uE(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function sP(t,e,r){var a=e[0],i=e[1],s=e[2],o=e[3],u=e[4],d=e[5],f=e[6],h=e[7],p=e[8],m=r[0],y=r[1],x=r[2],E=r[3],w=r[4],T=r[5],C=r[6],N=r[7],A=r[8];return t[0]=m*a+y*o+x*f,t[1]=m*i+y*u+x*h,t[2]=m*s+y*d+x*p,t[3]=E*a+w*o+T*f,t[4]=E*i+w*u+T*h,t[5]=E*s+w*d+T*p,t[6]=C*a+N*o+A*f,t[7]=C*i+N*u+A*h,t[8]=C*s+N*d+A*p,t}function kf(t,e,r){var a=e[0],i=e[1],s=e[2],o=e[3],u=e[4],d=e[5],f=e[6],h=e[7],p=e[8],m=r[0],y=r[1];return t[0]=a,t[1]=i,t[2]=s,t[3]=o,t[4]=u,t[5]=d,t[6]=m*a+y*o+f,t[7]=m*i+y*u+h,t[8]=m*s+y*d+p,t}function cE(t,e,r){var a=e[0],i=e[1],s=e[2],o=e[3],u=e[4],d=e[5],f=e[6],h=e[7],p=e[8],m=Math.sin(r),y=Math.cos(r);return t[0]=y*a+m*o,t[1]=y*i+m*u,t[2]=y*s+m*d,t[3]=y*o-m*a,t[4]=y*u-m*i,t[5]=y*d-m*s,t[6]=f,t[7]=h,t[8]=p,t}function fm(t,e,r){var a=r[0],i=r[1];return t[0]=a*e[0],t[1]=a*e[1],t[2]=a*e[2],t[3]=i*e[3],t[4]=i*e[4],t[5]=i*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function lP(t,e,r){return t[0]=2/e,t[1]=0,t[2]=0,t[3]=0,t[4]=-2/r,t[5]=0,t[6]=-1,t[7]=1,t[8]=1,t}var oP=(function(){function t(e,r,a,i){cs(this,t),this.debugID=Math.floor(Math.random()*1e4),this.r=e,this.texSize=r,this.texRows=a,this.texHeight=Math.floor(r/a),this.enableWrapping=!0,this.locked=!1,this.texture=null,this.needsBuffer=!0,this.freePointer={x:0,row:0},this.keyToLocation=new Map,this.canvas=i(e,r,r),this.scratch=i(e,r,this.texHeight,"scratch")}return ds(t,[{key:"lock",value:function(){this.locked=!0}},{key:"getKeys",value:function(){return new Set(this.keyToLocation.keys())}},{key:"getScale",value:function(r){var a=r.w,i=r.h,s=this.texHeight,o=this.texSize,u=s/i,d=a*u,f=i*u;return d>o&&(u=o/a,d=a*u,f=i*u),{scale:u,texW:d,texH:f}}},{key:"draw",value:function(r,a,i){var s=this;if(this.locked)throw new Error("can't draw, atlas is locked");var o=this.texSize,u=this.texRows,d=this.texHeight,f=this.getScale(a),h=f.scale,p=f.texW,m=f.texH,y=function(N,A){if(i&&A){var D=A.context,M=N.x,j=N.row,k=M,B=d*j;D.save(),D.translate(k,B),D.scale(h,h),i(D,a),D.restore()}},x=[null,null],E=function(){y(s.freePointer,s.canvas),x[0]={x:s.freePointer.x,y:s.freePointer.row*d,w:p,h:m},x[1]={x:s.freePointer.x+p,y:s.freePointer.row*d,w:0,h:m},s.freePointer.x+=p,s.freePointer.x==o&&(s.freePointer.x=0,s.freePointer.row++)},w=function(){var N=s.scratch,A=s.canvas;N.clear(),y({x:0,row:0},N);var D=o-s.freePointer.x,M=p-D,j=d;{var k=s.freePointer.x,B=s.freePointer.row*d,P=D;A.context.drawImage(N,0,0,P,j,k,B,P,j),x[0]={x:k,y:B,w:P,h:m}}{var U=D,R=(s.freePointer.row+1)*d,V=M;A&&A.context.drawImage(N,U,0,V,j,0,R,V,j),x[1]={x:0,y:R,w:V,h:m}}s.freePointer.x=M,s.freePointer.row++},T=function(){s.freePointer.x=0,s.freePointer.row++};if(this.freePointer.x+p<=o)E();else{if(this.freePointer.row>=u-1)return!1;this.freePointer.x===o?(T(),E()):this.enableWrapping?w():(T(),E())}return this.keyToLocation.set(r,x),this.needsBuffer=!0,x}},{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,s=this.getScale(r),o=s.texW;return this.freePointer.x+o>a?this.freePointer.row<i-1:!0}},{key:"bufferIfNeeded",value:function(r){this.texture||(this.texture=tP(r,this.debugID)),this.needsBuffer&&(this.texture.buffer(this.canvas),this.needsBuffer=!1,this.locked&&(this.canvas=null,this.scratch=null))}},{key:"dispose",value:function(){this.texture&&(this.texture.deleteTexture(),this.texture=null),this.canvas=null,this.scratch=null,this.locked=!0}}])})(),uP=(function(){function t(e,r,a,i){cs(this,t),this.r=e,this.texSize=r,this.texRows=a,this.createTextureCanvas=i,this.atlases=[],this.styleKeyToAtlas=new Map,this.markedKeys=new Set}return ds(t,[{key:"getKeys",value:function(){return new Set(this.styleKeyToAtlas.keys())}},{key:"_createAtlas",value:function(){var r=this.r,a=this.texSize,i=this.texRows,s=this.createTextureCanvas;return new oP(r,a,i,s)}},{key:"_getScratchCanvas",value:function(){if(!this.scratch){var r=this.r,a=this.texSize,i=this.texRows,s=this.createTextureCanvas,o=Math.floor(a/i);this.scratch=s(r,a,o,"scratch")}return this.scratch}},{key:"draw",value:function(r,a,i){var s=this.styleKeyToAtlas.get(r);return s||(s=this.atlases[this.atlases.length-1],(!s||!s.canFit(a))&&(s&&s.lock(),s=this._createAtlas(),this.atlases.push(s)),s.draw(r,a,i),this.styleKeyToAtlas.set(r,s)),s}},{key:"getAtlas",value:function(r){return this.styleKeyToAtlas.get(r)}},{key:"hasAtlas",value:function(r){return this.styleKeyToAtlas.has(r)}},{key:"markKeyForGC",value:function(r){this.markedKeys.add(r)}},{key:"gc",value:function(){var r=this,a=this.markedKeys;if(a.size===0){console.log("nothing to garbage collect");return}var i=[],s=new Map,o=null,u=xa(this.atlases),d;try{var f=function(){var p=d.value,m=p.getKeys(),y=cP(a,m);if(y.size===0)return i.push(p),m.forEach(function(D){return s.set(D,p)}),1;o||(o=r._createAtlas(),i.push(o));var x=xa(m),E;try{for(x.s();!(E=x.n()).done;){var w=E.value;if(!y.has(w)){var T=p.getOffsets(w),C=mr(T,2),N=C[0],A=C[1];o.canFit({w:N.w+A.w,h:N.h})||(o.lock(),o=r._createAtlas(),i.push(o)),p.canvas&&(r._copyTextureToNewAtlas(w,p,o),s.set(w,o))}}}catch(D){x.e(D)}finally{x.f()}p.dispose()};for(u.s();!(d=u.n()).done;)f()}catch(h){u.e(h)}finally{u.f()}this.atlases=i,this.styleKeyToAtlas=s,this.markedKeys=new Set}},{key:"_copyTextureToNewAtlas",value:function(r,a,i){var s=a.getOffsets(r),o=mr(s,2),u=o[0],d=o[1];if(d.w===0)i.draw(r,u,function(m){m.drawImage(a.canvas,u.x,u.y,u.w,u.h,0,0,u.w,u.h)});else{var f=this._getScratchCanvas();f.clear(),f.context.drawImage(a.canvas,u.x,u.y,u.w,u.h,0,0,u.w,u.h),f.context.drawImage(a.canvas,d.x,d.y,d.w,d.h,u.w,0,d.w,d.h);var h=u.w+d.w,p=u.h;i.draw(r,{w:h,h:p},function(m){m.drawImage(f,0,0,h,p,0,0,h,p)})}}},{key:"getCounts",value:function(){return{keyCount:this.styleKeyToAtlas.size,atlasCount:new Set(this.styleKeyToAtlas.values()).size}}}])})();function cP(t,e){return t.intersection?t.intersection(e):new Set(Pf(t).filter(function(r){return e.has(r)}))}var dP=(function(){function t(e,r){cs(this,t),this.r=e,this.globalOptions=r,this.atlasSize=r.webglTexSize,this.maxAtlasesPerBatch=r.webglTexPerBatch,this.renderTypes=new Map,this.collections=new Map,this.typeAndIdToKey=new Map}return ds(t,[{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"addAtlasCollection",value:function(r,a){var i=this.globalOptions,s=i.webglTexSize,o=i.createTextureCanvas,u=a.texRows,d=this._cacheScratchCanvas(o),f=new uP(this.r,s,u,d);this.collections.set(r,f)}},{key:"addRenderType",value:function(r,a){var i=a.collection;if(!this.collections.has(i))throw new Error("invalid atlas collection name '".concat(i,"'"));var s=this.collections.get(i),o=tt({type:r,atlasCollection:s},a);this.renderTypes.set(r,o)}},{key:"getRenderTypeOpts",value:function(r){return this.renderTypes.get(r)}},{key:"getAtlasCollection",value:function(r){return this.collections.get(r)}},{key:"_cacheScratchCanvas",value:function(r){var a=-1,i=-1,s=null;return function(o,u,d,f){return f?((!s||u!=a||d!=i)&&(a=u,i=d,s=r(o,u,d)),s):r(o,u,d)}}},{key:"_key",value:function(r,a){return"".concat(r,"-").concat(a)}},{key:"invalidate",value:function(r){var a=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=i.forceRedraw,o=s===void 0?!1:s,u=i.filterEle,d=u===void 0?function(){return!0}:u,f=i.filterType,h=f===void 0?function(){return!0}:f,p=!1,m=!1,y=xa(r),x;try{for(y.s();!(x=y.n()).done;){var E=x.value;if(d(E)){var w=xa(this.renderTypes.values()),T;try{var C=function(){var A=T.value,D=A.type;if(h(D)){var M=a.collections.get(A.collection),j=A.getKey(E),k=Array.isArray(j)?j:[j];if(o)k.forEach(function(R){return M.markKeyForGC(R)}),m=!0;else{var B=A.getID?A.getID(E):E.id(),P=a._key(D,B),U=a.typeAndIdToKey.get(P);U!==void 0&&!JL(k,U)&&(p=!0,a.typeAndIdToKey.delete(P),U.forEach(function(R){return M.markKeyForGC(R)}))}}};for(w.s();!(T=w.n()).done;)C()}catch(N){w.e(N)}finally{w.f()}}}}catch(N){y.e(N)}finally{y.f()}return m&&(this.gc(),p=!1),p}},{key:"gc",value:function(){var r=xa(this.collections.values()),a;try{for(r.s();!(a=r.n()).done;){var i=a.value;i.gc()}}catch(s){r.e(s)}finally{r.f()}}},{key:"getOrCreateAtlas",value:function(r,a,i,s){var o=this.renderTypes.get(a),u=this.collections.get(o.collection),d=!1,f=u.draw(s,i,function(m){o.drawClipped?(m.save(),m.beginPath(),m.rect(0,0,i.w,i.h),m.clip(),o.drawElement(m,r,i,!0,!0),m.restore()):o.drawElement(m,r,i,!0,!0),d=!0});if(d){var h=o.getID?o.getID(r):r.id(),p=this._key(a,h);this.typeAndIdToKey.has(p)?this.typeAndIdToKey.get(p).push(s):this.typeAndIdToKey.set(p,[s])}return f}},{key:"getAtlasInfo",value:function(r,a){var i=this,s=this.renderTypes.get(a),o=s.getKey(r),u=Array.isArray(o)?o:[o];return u.map(function(d){var f=s.getBoundingBox(r,d),h=i.getOrCreateAtlas(r,a,f,d),p=h.getOffsets(d),m=mr(p,2),y=m[0],x=m[1];return{atlas:h,tex:y,tex1:y,tex2:x,bb:f}})}},{key:"getDebugInfo",value:function(){var r=[],a=xa(this.collections),i;try{for(a.s();!(i=a.n()).done;){var s=mr(i.value,2),o=s[0],u=s[1],d=u.getCounts(),f=d.keyCount,h=d.atlasCount;r.push({type:o,keyCount:f,atlasCount:h})}}catch(p){a.e(p)}finally{a.f()}return r}}])})(),fP=(function(){function t(e){cs(this,t),this.globalOptions=e,this.atlasSize=e.webglTexSize,this.maxAtlasesPerBatch=e.webglTexPerBatch,this.batchAtlases=[]}return ds(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}}])})(),hP=`
96
+ float circleSD(vec2 p, float r) {
97
+ return distance(vec2(0), p) - r; // signed distance
98
+ }
99
+ `,vP=`
100
+ float rectangleSD(vec2 p, vec2 b) {
101
+ vec2 d = abs(p)-b;
102
+ return distance(vec2(0),max(d,0.0)) + min(max(d.x,d.y),0.0);
103
+ }
104
+ `,pP=`
105
+ float roundRectangleSD(vec2 p, vec2 b, vec4 cr) {
106
+ cr.xy = (p.x > 0.0) ? cr.xy : cr.zw;
107
+ cr.x = (p.y > 0.0) ? cr.x : cr.y;
108
+ vec2 q = abs(p) - b + cr.x;
109
+ return min(max(q.x, q.y), 0.0) + distance(vec2(0), max(q, 0.0)) - cr.x;
110
+ }
111
+ `,gP=`
112
+ float ellipseSD(vec2 p, vec2 ab) {
113
+ p = abs( p ); // symmetry
114
+
115
+ // find root with Newton solver
116
+ vec2 q = ab*(p-ab);
117
+ float w = (q.x<q.y)? 1.570796327 : 0.0;
118
+ for( int i=0; i<5; i++ ) {
119
+ vec2 cs = vec2(cos(w),sin(w));
120
+ vec2 u = ab*vec2( cs.x,cs.y);
121
+ vec2 v = ab*vec2(-cs.y,cs.x);
122
+ w = w + dot(p-u,v)/(dot(p-u,u)+dot(v,v));
123
+ }
124
+
125
+ // compute final point and distance
126
+ float d = length(p-ab*vec2(cos(w),sin(w)));
127
+
128
+ // return signed distance
129
+ return (dot(p/ab,p/ab)>1.0) ? d : -d;
130
+ }
131
+ `,Qu={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},Yf={IGNORE:1,USE_BB:2},pg=0,dE=1,fE=2,gg=3,Jl=4,hf=5,zu=6,_u=7,mP=(function(){function t(e,r,a){cs(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=KL,this.atlasManager=new dP(e,a),this.batchManager=new fP(a),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(Qu.SCREEN),this.pickingProgram=this._createShaderProgram(Qu.PICKING),this.vao=this._createVAO()}return ds(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,s=this.atlasManager;return i?s.invalidate(r,{filterType:function(u){return u===i},forceRedraw:!0}):s.invalidate(r)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"_createShaderProgram",value:function(r){var a=this.gl,i=`#version 300 es
132
+ precision highp float;
133
+
134
+ uniform mat3 uPanZoomMatrix;
135
+ uniform int uAtlasSize;
136
+
137
+ // instanced
138
+ in vec2 aPosition; // a vertex from the unit square
139
+
140
+ in mat3 aTransform; // used to transform verticies, eg into a bounding box
141
+ in int aVertType; // the type of thing we are rendering
142
+
143
+ // the z-index that is output when using picking mode
144
+ in vec4 aIndex;
145
+
146
+ // For textures
147
+ in int aAtlasId; // which shader unit/atlas to use
148
+ in vec4 aTex; // x/y/w/h of texture in atlas
149
+
150
+ // for edges
151
+ in vec4 aPointAPointB;
152
+ in vec4 aPointCPointD;
153
+ in vec2 aLineWidth; // also used for node border width
154
+
155
+ // simple shapes
156
+ in vec4 aCornerRadius; // for round-rectangle [top-right, bottom-right, top-left, bottom-left]
157
+ in vec4 aColor; // also used for edges
158
+ in vec4 aBorderColor; // aLineWidth is used for border width
159
+
160
+ // output values passed to the fragment shader
161
+ out vec2 vTexCoord;
162
+ out vec4 vColor;
163
+ out vec2 vPosition;
164
+ // flat values are not interpolated
165
+ flat out int vAtlasId;
166
+ flat out int vVertType;
167
+ flat out vec2 vTopRight;
168
+ flat out vec2 vBotLeft;
169
+ flat out vec4 vCornerRadius;
170
+ flat out vec4 vBorderColor;
171
+ flat out vec2 vBorderWidth;
172
+ flat out vec4 vIndex;
173
+
174
+ void main(void) {
175
+ int vid = gl_VertexID;
176
+ vec2 position = aPosition; // TODO make this a vec3, simplifies some code below
177
+
178
+ if(aVertType == `.concat(pg,`) {
179
+ float texX = aTex.x; // texture coordinates
180
+ float texY = aTex.y;
181
+ float texW = aTex.z;
182
+ float texH = aTex.w;
183
+
184
+ if(vid == 1 || vid == 2 || vid == 4) {
185
+ texX += texW;
186
+ }
187
+ if(vid == 2 || vid == 4 || vid == 5) {
188
+ texY += texH;
189
+ }
190
+
191
+ float d = float(uAtlasSize);
192
+ vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1
193
+
194
+ gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
195
+ }
196
+ else if(aVertType == `).concat(Jl," || aVertType == ").concat(_u,`
197
+ || aVertType == `).concat(hf," || aVertType == ").concat(zu,`) { // simple shapes
198
+
199
+ // the bounding box is needed by the fragment shader
200
+ vBotLeft = (aTransform * vec3(0, 0, 1)).xy; // flat
201
+ vTopRight = (aTransform * vec3(1, 1, 1)).xy; // flat
202
+ vPosition = (aTransform * vec3(position, 1)).xy; // will be interpolated
203
+
204
+ // calculations are done in the fragment shader, just pass these along
205
+ vColor = aColor;
206
+ vCornerRadius = aCornerRadius;
207
+ vBorderColor = aBorderColor;
208
+ vBorderWidth = aLineWidth;
209
+
210
+ gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
211
+ }
212
+ else if(aVertType == `).concat(dE,`) {
213
+ vec2 source = aPointAPointB.xy;
214
+ vec2 target = aPointAPointB.zw;
215
+
216
+ // adjust the geometry so that the line is centered on the edge
217
+ position.y = position.y - 0.5;
218
+
219
+ // stretch the unit square into a long skinny rectangle
220
+ vec2 xBasis = target - source;
221
+ vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));
222
+ vec2 point = source + xBasis * position.x + yBasis * aLineWidth[0] * position.y;
223
+
224
+ gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);
225
+ vColor = aColor;
226
+ }
227
+ else if(aVertType == `).concat(fE,`) {
228
+ vec2 pointA = aPointAPointB.xy;
229
+ vec2 pointB = aPointAPointB.zw;
230
+ vec2 pointC = aPointCPointD.xy;
231
+ vec2 pointD = aPointCPointD.zw;
232
+
233
+ // adjust the geometry so that the line is centered on the edge
234
+ position.y = position.y - 0.5;
235
+
236
+ vec2 p0, p1, p2, pos;
237
+ if(position.x == 0.0) { // The left side of the unit square
238
+ p0 = pointA;
239
+ p1 = pointB;
240
+ p2 = pointC;
241
+ pos = position;
242
+ } else { // The right side of the unit square, use same approach but flip the geometry upside down
243
+ p0 = pointD;
244
+ p1 = pointC;
245
+ p2 = pointB;
246
+ pos = vec2(0.0, -position.y);
247
+ }
248
+
249
+ vec2 p01 = p1 - p0;
250
+ vec2 p12 = p2 - p1;
251
+ vec2 p21 = p1 - p2;
252
+
253
+ // Find the normal vector.
254
+ vec2 tangent = normalize(normalize(p12) + normalize(p01));
255
+ vec2 normal = vec2(-tangent.y, tangent.x);
256
+
257
+ // Find the vector perpendicular to p0 -> p1.
258
+ vec2 p01Norm = normalize(vec2(-p01.y, p01.x));
259
+
260
+ // Determine the bend direction.
261
+ float sigma = sign(dot(p01 + p21, normal));
262
+ float width = aLineWidth[0];
263
+
264
+ if(sign(pos.y) == -sigma) {
265
+ // This is an intersecting vertex. Adjust the position so that there's no overlap.
266
+ vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);
267
+ gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
268
+ } else {
269
+ // This is a non-intersecting vertex. Treat it like a mitre join.
270
+ vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);
271
+ gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
272
+ }
273
+
274
+ vColor = aColor;
275
+ }
276
+ else if(aVertType == `).concat(gg,` && vid < 3) {
277
+ // massage the first triangle into an edge arrow
278
+ if(vid == 0)
279
+ position = vec2(-0.15, -0.3);
280
+ if(vid == 1)
281
+ position = vec2( 0.0, 0.0);
282
+ if(vid == 2)
283
+ position = vec2( 0.15, -0.3);
284
+
285
+ gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
286
+ vColor = aColor;
287
+ }
288
+ else {
289
+ gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space
290
+ }
291
+
292
+ vAtlasId = aAtlasId;
293
+ vVertType = aVertType;
294
+ vIndex = aIndex;
295
+ }
296
+ `),s=this.batchManager.getIndexArray(),o=`#version 300 es
297
+ precision highp float;
298
+
299
+ // declare texture unit for each texture atlas in the batch
300
+ `.concat(s.map(function(f){return"uniform sampler2D uTexture".concat(f,";")}).join(`
301
+ `),`
302
+
303
+ uniform vec4 uBGColor;
304
+ uniform float uZoom;
305
+
306
+ in vec2 vTexCoord;
307
+ in vec4 vColor;
308
+ in vec2 vPosition; // model coordinates
309
+
310
+ flat in int vAtlasId;
311
+ flat in vec4 vIndex;
312
+ flat in int vVertType;
313
+ flat in vec2 vTopRight;
314
+ flat in vec2 vBotLeft;
315
+ flat in vec4 vCornerRadius;
316
+ flat in vec4 vBorderColor;
317
+ flat in vec2 vBorderWidth;
318
+
319
+ out vec4 outColor;
320
+
321
+ `).concat(hP,`
322
+ `).concat(vP,`
323
+ `).concat(pP,`
324
+ `).concat(gP,`
325
+
326
+ vec4 blend(vec4 top, vec4 bot) { // blend colors with premultiplied alpha
327
+ return vec4(
328
+ top.rgb + (bot.rgb * (1.0 - top.a)),
329
+ top.a + (bot.a * (1.0 - top.a))
330
+ );
331
+ }
332
+
333
+ vec4 distInterp(vec4 cA, vec4 cB, float d) { // interpolate color using Signed Distance
334
+ // scale to the zoom level so that borders don't look blurry when zoomed in
335
+ // note 1.5 is an aribitrary value chosen because it looks good
336
+ return mix(cA, cB, 1.0 - smoothstep(0.0, 1.5 / uZoom, abs(d)));
337
+ }
338
+
339
+ void main(void) {
340
+ if(vVertType == `).concat(pg,`) {
341
+ // look up the texel from the texture unit
342
+ `).concat(s.map(function(f){return"if(vAtlasId == ".concat(f,") outColor = texture(uTexture").concat(f,", vTexCoord);")}).join(`
343
+ else `),`
344
+ }
345
+ else if(vVertType == `).concat(gg,`) {
346
+ // mimics how canvas renderer uses context.globalCompositeOperation = 'destination-out';
347
+ outColor = blend(vColor, uBGColor);
348
+ outColor.a = 1.0; // make opaque, masks out line under arrow
349
+ }
350
+ else if(vVertType == `).concat(Jl,` && vBorderWidth == vec2(0.0)) { // simple rectangle with no border
351
+ outColor = vColor; // unit square is already transformed to the rectangle, nothing else needs to be done
352
+ }
353
+ else if(vVertType == `).concat(Jl," || vVertType == ").concat(_u,`
354
+ || vVertType == `).concat(hf," || vVertType == ").concat(zu,`) { // use SDF
355
+
356
+ float outerBorder = vBorderWidth[0];
357
+ float innerBorder = vBorderWidth[1];
358
+ float borderPadding = outerBorder * 2.0;
359
+ float w = vTopRight.x - vBotLeft.x - borderPadding;
360
+ float h = vTopRight.y - vBotLeft.y - borderPadding;
361
+ vec2 b = vec2(w/2.0, h/2.0); // half width, half height
362
+ vec2 p = vPosition - vec2(vTopRight.x - b[0] - outerBorder, vTopRight.y - b[1] - outerBorder); // translate to center
363
+
364
+ float d; // signed distance
365
+ if(vVertType == `).concat(Jl,`) {
366
+ d = rectangleSD(p, b);
367
+ } else if(vVertType == `).concat(_u,` && w == h) {
368
+ d = circleSD(p, b.x); // faster than ellipse
369
+ } else if(vVertType == `).concat(_u,`) {
370
+ d = ellipseSD(p, b);
371
+ } else {
372
+ d = roundRectangleSD(p, b, vCornerRadius.wzyx);
373
+ }
374
+
375
+ // use the distance to interpolate a color to smooth the edges of the shape, doesn't need multisampling
376
+ // we must smooth colors inwards, because we can't change pixels outside the shape's bounding box
377
+ if(d > 0.0) {
378
+ if(d > outerBorder) {
379
+ discard;
380
+ } else {
381
+ outColor = distInterp(vBorderColor, vec4(0), d - outerBorder);
382
+ }
383
+ } else {
384
+ if(d > innerBorder) {
385
+ vec4 outerColor = outerBorder == 0.0 ? vec4(0) : vBorderColor;
386
+ vec4 innerBorderColor = blend(vBorderColor, vColor);
387
+ outColor = distInterp(innerBorderColor, outerColor, d);
388
+ }
389
+ else {
390
+ vec4 outerColor;
391
+ if(innerBorder == 0.0 && outerBorder == 0.0) {
392
+ outerColor = vec4(0);
393
+ } else if(innerBorder == 0.0) {
394
+ outerColor = vBorderColor;
395
+ } else {
396
+ outerColor = blend(vBorderColor, vColor);
397
+ }
398
+ outColor = distInterp(vColor, outerColor, d - innerBorder);
399
+ }
400
+ }
401
+ }
402
+ else {
403
+ outColor = vColor;
404
+ }
405
+
406
+ `).concat(r.picking?`if(outColor.a == 0.0) discard;
407
+ else outColor = vIndex;`:"",`
408
+ }
409
+ `),u=YL(a,i,o);u.aPosition=a.getAttribLocation(u,"aPosition"),u.aIndex=a.getAttribLocation(u,"aIndex"),u.aVertType=a.getAttribLocation(u,"aVertType"),u.aTransform=a.getAttribLocation(u,"aTransform"),u.aAtlasId=a.getAttribLocation(u,"aAtlasId"),u.aTex=a.getAttribLocation(u,"aTex"),u.aPointAPointB=a.getAttribLocation(u,"aPointAPointB"),u.aPointCPointD=a.getAttribLocation(u,"aPointCPointD"),u.aLineWidth=a.getAttribLocation(u,"aLineWidth"),u.aColor=a.getAttribLocation(u,"aColor"),u.aCornerRadius=a.getAttribLocation(u,"aCornerRadius"),u.aBorderColor=a.getAttribLocation(u,"aBorderColor"),u.uPanZoomMatrix=a.getUniformLocation(u,"uPanZoomMatrix"),u.uAtlasSize=a.getUniformLocation(u,"uAtlasSize"),u.uBGColor=a.getUniformLocation(u,"uBGColor"),u.uZoom=a.getUniformLocation(u,"uZoom"),u.uTextures=[];for(var d=0;d<this.batchManager.getMaxAtlasesPerBatch();d++)u.uTextures.push(a.getUniformLocation(u,"uTexture".concat(d)));return u}},{key:"_createVAO",value:function(){var r=[0,0,1,0,1,1,0,0,1,1,0,1];this.vertexCount=r.length/2;var a=this.maxInstances,i=this.gl,s=this.program,o=i.createVertexArray();return i.bindVertexArray(o),aP(i,"vec2",s.aPosition,r),this.transformBuffer=nP(i,a,s.aTransform),this.indexBuffer=gn(i,a,"vec4",s.aIndex),this.vertTypeBuffer=gn(i,a,"int",s.aVertType),this.atlasIdBuffer=gn(i,a,"int",s.aAtlasId),this.texBuffer=gn(i,a,"vec4",s.aTex),this.pointAPointBBuffer=gn(i,a,"vec4",s.aPointAPointB),this.pointCPointDBuffer=gn(i,a,"vec4",s.aPointCPointD),this.lineWidthBuffer=gn(i,a,"vec2",s.aLineWidth),this.colorBuffer=gn(i,a,"vec4",s.aColor),this.cornerRadiusBuffer=gn(i,a,"vec4",s.aCornerRadius),this.borderColorBuffer=gn(i,a,"vec4",s.aBorderColor),i.bindVertexArray(null),o}},{key:"buffers",get:function(){var r=this;return this._buffers||(this._buffers=Object.keys(this).filter(function(a){return Yi(a,"Buffer")}).map(function(a){return r[a]})),this._buffers}},{key:"startFrame",value:function(r){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Qu.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 s=this.atlasManager,o=this.batchManager,u=s.getRenderTypeOpts(i);if(this._isVisible(r,u)&&!(r.isEdge()&&!this._isValidEdge(r))){if(this.renderTarget.picking&&u.getTexPickingMode){var d=u.getTexPickingMode(r);if(d===Yf.IGNORE)return;if(d==Yf.USE_BB){this.drawPickingRectangle(r,a,i);return}}var f=s.getAtlasInfo(r,i),h=xa(f),p;try{for(h.s();!(p=h.n()).done;){var m=p.value,y=m.atlas,x=m.tex1,E=m.tex2;o.canAddToCurrentBatch(y)||this.endBatch();for(var w=o.getAtlasIndexForBatch(y),T=0,C=[[x,!0],[E,!1]];T<C.length;T++){var N=mr(C[T],2),A=N[0],D=N[1];if(A.w!=0){var M=this.instanceCount;this.vertTypeBuffer.getView(M)[0]=pg;var j=this.indexBuffer.getView(M);Wl(a,j);var k=this.atlasIdBuffer.getView(M);k[0]=w;var B=this.texBuffer.getView(M);B[0]=A.x,B[1]=A.y,B[2]=A.w,B[3]=A.h;var P=this.transformBuffer.getMatrixView(M);this.setTransformMatrix(r,P,u,m,D),this.instanceCount++,D||this.wrappedCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}catch(U){h.e(U)}finally{h.f()}}}},{key:"setTransformMatrix",value:function(r,a,i,s){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,u=0;if(i.shapeProps&&i.shapeProps.padding&&(u=r.pstyle(i.shapeProps.padding).pfValue),s){var d=s.bb,f=s.tex1,h=s.tex2,p=f.w/(f.w+h.w);o||(p=1-p);var m=this._getAdjustedBB(d,u,o,p);this._applyTransformMatrix(a,m,i,r)}else{var y=i.getBoundingBox(r),x=this._getAdjustedBB(y,u,!0,1);this._applyTransformMatrix(a,x,i,r)}}},{key:"_applyTransformMatrix",value:function(r,a,i,s){var o,u;uE(r);var d=i.getRotation?i.getRotation(s):0;if(d!==0){var f=i.getRotationPoint(s),h=f.x,p=f.y;kf(r,r,[h,p]),cE(r,r,d);var m=i.getRotationOffset(s);o=m.x+(a.xOffset||0),u=m.y+(a.yOffset||0)}else o=a.x1,u=a.y1;kf(r,r,[o,u]),fm(r,r,[a.w,a.h])}},{key:"_getAdjustedBB",value:function(r,a,i,s){var o=r.x1,u=r.y1,d=r.w,f=r.h,h=r.yOffset;a&&(o-=a,u-=a,d+=2*a,f+=2*a);var p=0,m=d*s;return i&&s<1?d=m:!i&&s<1&&(p=d-m,o+=p,d=m),{x1:o,y1:u,w:d,h:f,xOffset:p,yOffset:h}}},{key:"drawPickingRectangle",value:function(r,a,i){var s=this.atlasManager.getRenderTypeOpts(i),o=this.instanceCount;this.vertTypeBuffer.getView(o)[0]=Jl;var u=this.indexBuffer.getView(o);Wl(a,u);var d=this.colorBuffer.getView(o);Rs([0,0,0],1,d);var f=this.transformBuffer.getMatrixView(o);this.setTransformMatrix(r,f,s),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:"drawNode",value:function(r,a,i){var s=this.simpleShapeOptions.get(i);if(this._isVisible(r,s)){var o=s.shapeProps,u=this._getVertTypeForShape(r,o.shape);if(u===void 0||s.isSimple&&!s.isSimple(r)){this.drawTexture(r,a,i);return}var d=this.instanceCount;if(this.vertTypeBuffer.getView(d)[0]=u,u===hf||u===zu){var f=s.getBoundingBox(r),h=this._getCornerRadius(r,o.radius,f),p=this.cornerRadiusBuffer.getView(d);p[0]=h,p[1]=h,p[2]=h,p[3]=h,u===zu&&(p[0]=0,p[2]=0)}var m=this.indexBuffer.getView(d);Wl(a,m);var y=r.pstyle(o.color).value,x=r.pstyle(o.opacity).value,E=this.colorBuffer.getView(d);Rs(y,x,E);var w=this.lineWidthBuffer.getView(d);if(w[0]=0,w[1]=0,o.border){var T=r.pstyle("border-width").value;if(T>0){var C=r.pstyle("border-color").value,N=r.pstyle("border-opacity").value,A=this.borderColorBuffer.getView(d);Rs(C,N,A);var D=r.pstyle("border-position").value;if(D==="inside")w[0]=0,w[1]=-T;else if(D==="outside")w[0]=T,w[1]=0;else{var M=T/2;w[0]=M,w[1]=-M}}}var j=this.transformBuffer.getMatrixView(d);this.setTransformMatrix(r,j,s),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 Jl;case"ellipse":return _u;case"roundrectangle":case"round-rectangle":return hf;case"bottom-round-rectangle":return zu;default:return}}},{key:"_getCornerRadius",value:function(r,a,i){var s=i.w,o=i.h;if(r.pstyle(a).value==="auto")return ns(s,o);var u=r.pstyle(a).pfValue,d=s/2,f=o/2;return Math.min(u,f,d)}},{key:"drawEdgeArrow",value:function(r,a,i){if(r.visible()){var s=r._private.rscratch,o,u,d;if(i==="source"?(o=s.arrowStartX,u=s.arrowStartY,d=s.srcArrowAngle):(o=s.arrowEndX,u=s.arrowEndY,d=s.tgtArrowAngle),!(isNaN(o)||o==null||isNaN(u)||u==null||isNaN(d)||d==null)){var f=r.pstyle(i+"-arrow-shape").value;if(f!=="none"){var h=r.pstyle(i+"-arrow-color").value,p=r.pstyle("opacity").value,m=r.pstyle("line-opacity").value,y=p*m,x=r.pstyle("width").pfValue,E=r.pstyle("arrow-scale").value,w=this.r.getArrowWidth(x,E),T=this.instanceCount,C=this.transformBuffer.getMatrixView(T);uE(C),kf(C,C,[o,u]),fm(C,C,[w,w]),cE(C,C,d),this.vertTypeBuffer.getView(T)[0]=gg;var N=this.indexBuffer.getView(T);Wl(a,N);var A=this.colorBuffer.getView(T);Rs(h,y,A),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 s=r.pstyle("opacity").value,o=r.pstyle("line-opacity").value,u=r.pstyle("width").pfValue,d=r.pstyle("line-color").value,f=s*o;if(i.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),i.length==4){var h=this.instanceCount;this.vertTypeBuffer.getView(h)[0]=dE;var p=this.indexBuffer.getView(h);Wl(a,p);var m=this.colorBuffer.getView(h);Rs(d,f,m);var y=this.lineWidthBuffer.getView(h);y[0]=u;var x=this.pointAPointBBuffer.getView(h);x[0]=i[0],x[1]=i[1],x[2]=i[2],x[3]=i[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var E=0;E<i.length-2;E+=2){var w=this.instanceCount;this.vertTypeBuffer.getView(w)[0]=fE;var T=this.indexBuffer.getView(w);Wl(a,T);var C=this.colorBuffer.getView(w);Rs(d,f,C);var N=this.lineWidthBuffer.getView(w);N[0]=u;var A=i[E-2],D=i[E-1],M=i[E],j=i[E+1],k=i[E+2],B=i[E+3],P=i[E+4],U=i[E+5];E==0&&(A=2*M-k+.001,D=2*j-B+.001),E==i.length-4&&(P=2*k-M+.001,U=2*B-j+.001);var R=this.pointAPointBBuffer.getView(w);R[0]=A,R[1]=D,R[2]=M,R[3]=j;var V=this.pointCPointDBuffer.getView(w);V[0]=k,V[1]=B,V[2]=P,V[3]=U,this.instanceCount++,this.instanceCount>=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 s=this._getNumSegments(r);return this._getCurveSegmentPoints(i,s)}}},{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),s=0;s<=a;s++)if(s==0)i[0]=r[0],i[1]=r[1];else if(s==a)i[s*2]=r[r.length-2],i[s*2+1]=r[r.length-1];else{var o=s/a;this._setCurvePoint(r,o,i,s*2)}return i}},{key:"_setCurvePoint",value:function(r,a,i,s){if(r.length<=2)i[s]=r[0],i[s+1]=r[1];else{for(var o=Array(r.length-2),u=0;u<o.length;u+=2){var d=(1-a)*r[u]+a*r[u+2],f=(1-a)*r[u+1]+a*r[u+3];o[u]=d,o[u+1]=f}return this._setCurvePoint(o,a,i,s)}}},{key:"endBatch",value:function(){var r=this.gl,a=this.vao,i=this.vertexCount,s=this.instanceCount;if(s!==0){var o=this.renderTarget.picking?this.pickingProgram:this.program;r.useProgram(o),r.bindVertexArray(a);var u=xa(this.buffers),d;try{for(u.s();!(d=u.n()).done;){var f=d.value;f.bufferSubData(s)}}catch(x){u.e(x)}finally{u.f()}for(var h=this.batchManager.getAtlases(),p=0;p<h.length;p++)h[p].bufferIfNeeded(r);for(var m=0;m<h.length;m++)r.activeTexture(r.TEXTURE0+m),r.bindTexture(r.TEXTURE_2D,h[m].texture),r.uniform1i(o.uTextures[m],m);r.uniform1f(o.uZoom,XL(this.r)),r.uniformMatrix3fv(o.uPanZoomMatrix,!1,this.panZoomMatrix),r.uniform1i(o.uAtlasSize,this.batchManager.getAtlasSize());var y=Rs(this.bgColor,1);r.uniform4fv(o.uBGColor,y),r.drawArraysInstanced(r.TRIANGLES,0,i,s),r.bindVertexArray(null),r.bindTexture(r.TEXTURE_2D,null),this.debug&&this.batchDebugInfo.push({count:s,atlasCount:h.length}),this.startBatch()}}},{key:"getDebugInfo",value:function(){var r=this.atlasManager.getDebugInfo(),a=r.reduce(function(o,u){return o+u.atlasCount},0),i=this.batchDebugInfo,s=i.reduce(function(o,u){return o+u.count},0);return{atlasInfo:r,totalAtlases:a,wrappedCount:this.wrappedCount,simpleCount:this.simpleCount,batchCount:i.length,batchInfo:i,totalInstances:s}}}])})(),jN={};jN.initWebgl=function(t,e){var r=this,a=r.data.contexts[r.WEBGL];t.bgColor=yP(r),t.webglTexSize=Math.min(t.webglTexSize,a.getParameter(a.MAX_TEXTURE_SIZE)),t.webglTexRows=Math.min(t.webglTexRows,54),t.webglTexRowsNodes=Math.min(t.webglTexRowsNodes,54),t.webglBatchSize=Math.min(t.webglBatchSize,16384),t.webglTexPerBatch=Math.min(t.webglTexPerBatch,a.getParameter(a.MAX_TEXTURE_IMAGE_UNITS)),r.webglDebug=t.webglDebug,r.webglDebugShowAtlases=t.webglDebugShowAtlases,r.pickingFrameBuffer=iP(a),r.pickingFrameBuffer.needsDraw=!0,r.drawing=new mP(r,a,t);var i=function(p){return function(m){return r.getTextAngle(m,p)}},s=function(p){return function(m){var y=m.pstyle(p);return y&&y.value}},o=function(p){return function(m){return m.pstyle("".concat(p,"-opacity")).value>0}},u=function(p){var m=p.pstyle("text-events").strValue==="yes";return m?Yf.USE_BB:Yf.IGNORE},d=function(p){var m=p.position(),y=m.x,x=m.y,E=p.outerWidth(),w=p.outerHeight();return{w:E,h:w,x1:y-E/2,y1:x-w/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:d,isSimple:WL,shapeProps:{shape:"shape",color:"background-color",opacity:"background-opacity",radius:"corner-radius",border:!0}}),r.drawing.addSimpleShapeRenderType("node-overlay",{getBoundingBox:d,isVisible:o("overlay"),shapeProps:{shape:"overlay-shape",color:"overlay-color",opacity:"overlay-opacity",padding:"overlay-padding",radius:"overlay-corner-radius"}}),r.drawing.addSimpleShapeRenderType("node-underlay",{getBoundingBox:d,isVisible:o("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:u,getKey:mg(e.getLabelKey,null),getBoundingBox:yg(e.getLabelBox,null),drawClipped:!0,drawElement:e.drawLabel,getRotation:i(null),getRotationPoint:e.getLabelRotationPoint,getRotationOffset:e.getLabelRotationOffset,isVisible:s("label")}),r.drawing.addTextureAtlasRenderType("edge-source-label",{collection:"label",getTexPickingMode:u,getKey:mg(e.getSourceLabelKey,"source"),getBoundingBox:yg(e.getSourceLabelBox,"source"),drawClipped:!0,drawElement:e.drawSourceLabel,getRotation:i("source"),getRotationPoint:e.getSourceLabelRotationPoint,getRotationOffset:e.getSourceLabelRotationOffset,isVisible:s("source-label")}),r.drawing.addTextureAtlasRenderType("edge-target-label",{collection:"label",getTexPickingMode:u,getKey:mg(e.getTargetLabelKey,"target"),getBoundingBox:yg(e.getTargetLabelBox,"target"),drawClipped:!0,drawElement:e.drawTargetLabel,getRotation:i("target"),getRotationPoint:e.getTargetLabelRotationPoint,getRotationOffset:e.getTargetLabelRotationOffset,isVisible:s("target-label")});var f=Ac(function(){console.log("garbage collect flag set"),r.data.gc=!0},1e4);r.onUpdateEleCalcs(function(h,p){var m=!1;p&&p.length>0&&(m|=r.drawing.invalidate(p)),m&&f()}),xP(r)};function yP(t){var e=t.cy.container(),r=e&&e.style&&e.style.backgroundColor||"white";return tC(r)}function AN(t,e){var r=t._private.rscratch;return ga(r,"labelWrapCachedLines",e)||[]}var mg=function(e,r){return function(a){var i=e(a),s=AN(a,r);return s.length>1?s.map(function(o,u){return"".concat(i,"_").concat(u)}):i}},yg=function(e,r){return function(a,i){var s=e(a);if(typeof i=="string"){var o=i.indexOf("_");if(o>0){var u=Number(i.substring(o+1)),d=AN(a,r),f=s.h/d.length,h=f*u,p=s.y1+h;return{x1:s.x1,w:s.w,y1:p,h:f,yOffset:h}}}return s}};function xP(t){{var e=t.render;t.render=function(s){s=s||{};var o=t.cy;t.webgl&&(o.zoom()>bN?(bP(t),e.call(t,s)):(wP(t),kN(t,s,Qu.SCREEN)))}}{var r=t.matchCanvasSize;t.matchCanvasSize=function(s){r.call(t,s),t.pickingFrameBuffer.setFramebufferAttachmentSizes(t.canvasWidth,t.canvasHeight),t.pickingFrameBuffer.needsDraw=!0}}t.findNearestElements=function(s,o,u,d){return jP(t,s,o)};{var a=t.invalidateCachedZSortedEles;t.invalidateCachedZSortedEles=function(){a.call(t),t.pickingFrameBuffer.needsDraw=!0}}{var i=t.notify;t.notify=function(s,o){i.call(t,s,o),s==="viewport"||s==="bounds"?t.pickingFrameBuffer.needsDraw=!0:s==="background"&&t.drawing.invalidate(o,{type:"node-body"})}}}function bP(t){var e=t.data.contexts[t.WEBGL];e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)}function wP(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 SP(t){var e=t.canvasWidth,r=t.canvasHeight,a=cy(t),i=a.pan,s=a.zoom,o=vg();kf(o,o,[i.x,i.y]),fm(o,o,[s,s]);var u=vg();lP(u,e,r);var d=vg();return sP(d,u,o),d}function MN(t,e){var r=t.canvasWidth,a=t.canvasHeight,i=cy(t),s=i.pan,o=i.zoom;e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,r,a),e.translate(s.x,s.y),e.scale(o,o)}function EP(t,e){t.drawSelectionRectangle(e,function(r){return MN(t,r)})}function TP(t){var e=t.data.contexts[t.NODE];e.save(),MN(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 CP(t){var e=function(i,s,o){for(var u=i.atlasManager.getAtlasCollection(s),d=t.data.contexts[t.NODE],f=u.atlases,h=0;h<f.length;h++){var p=f[h],m=p.canvas;if(m){var y=m.width,x=m.height,E=y*h,w=m.height*o,T=.4;d.save(),d.scale(T,T),d.drawImage(m,E,w),d.strokeStyle="black",d.rect(E,w,y,x),d.stroke(),d.restore()}}},r=0;e(t.drawing,"node",r++),e(t.drawing,"label",r++)}function NP(t,e,r,a,i){var s,o,u,d,f=cy(t),h=f.pan,p=f.zoom;{var m=ZL(t,h,p,e,r),y=mr(m,2),x=y[0],E=y[1],w=6;s=x-w/2,o=E-w/2,u=w,d=w}if(u===0||d===0)return[];var T=t.data.contexts[t.WEBGL];T.bindFramebuffer(T.FRAMEBUFFER,t.pickingFrameBuffer),t.pickingFrameBuffer.needsDraw&&(T.viewport(0,0,T.canvas.width,T.canvas.height),kN(t,null,Qu.PICKING),t.pickingFrameBuffer.needsDraw=!1);var C=u*d,N=new Uint8Array(C*4);T.readPixels(s,o,u,d,T.RGBA,T.UNSIGNED_BYTE,N),T.bindFramebuffer(T.FRAMEBUFFER,null);for(var A=new Set,D=0;D<C;D++){var M=N.slice(D*4,D*4+4),j=eP(M)-1;j>=0&&A.add(j)}return A}function jP(t,e,r){var a=NP(t,e,r),i=t.getCachedZSortedEles(),s,o,u=xa(a),d;try{for(u.s();!(d=u.n()).done;){var f=d.value,h=i[f];if(!s&&h.isNode()&&(s=h),!o&&h.isEdge()&&(o=h),s&&o)break}}catch(p){u.e(p)}finally{u.f()}return[s,o].filter(Boolean)}function xg(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 kN(t,e,r){var a;t.webglDebug&&(a=performance.now());var i=t.drawing,s=0;if(r.screen&&t.data.canvasNeedsRedraw[t.SELECT_BOX]&&EP(t,e),t.data.canvasNeedsRedraw[t.NODE]||r.picking){var o=t.data.contexts[t.WEBGL];r.screen?(o.clearColor(0,0,0,0),o.enable(o.BLEND),o.blendFunc(o.ONE,o.ONE_MINUS_SRC_ALPHA)):o.disable(o.BLEND),o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT),o.viewport(0,0,o.canvas.width,o.canvas.height);var u=SP(t),d=t.getCachedZSortedEles();if(s=d.length,i.startFrame(u,r),r.screen){for(var f=0;f<d.nondrag.length;f++)xg(t,f,d.nondrag[f]);for(var h=0;h<d.drag.length;h++)xg(t,h,d.drag[h])}else if(r.picking)for(var p=0;p<d.length;p++)xg(t,p,d[p]);i.endFrame(),r.screen&&t.webglDebugShowAtlases&&(TP(t),CP(t)),t.data.canvasNeedsRedraw[t.NODE]=!1,t.data.canvasNeedsRedraw[t.DRAG]=!1}if(t.webglDebug){var m=performance.now(),y=!1,x=Math.ceil(m-a),E=i.getDebugInfo(),w=["".concat(s," elements"),"".concat(E.totalInstances," instances"),"".concat(E.batchCount," batches"),"".concat(E.totalAtlases," atlases"),"".concat(E.wrappedCount," wrapped textures"),"".concat(E.simpleCount," simple shapes")].join(", ");if(y)console.log("WebGL (".concat(r.name,") - time ").concat(x,"ms, ").concat(w));else{console.log("WebGL (".concat(r.name,") - frame time ").concat(x,"ms")),console.log("Totals:"),console.log(" ".concat(w)),console.log("Texture Atlases Used:");var T=E.atlasInfo,C=xa(T),N;try{for(C.s();!(N=C.n()).done;){var A=N.value;console.log(" ".concat(A.type,": ").concat(A.keyCount," keys, ").concat(A.atlasCount," atlases"))}}catch(D){C.e(D)}finally{C.f()}console.log("")}}t.data.gc&&(console.log("Garbage Collect!"),t.data.gc=!1,i.gc())}var vs={};vs.drawPolygonPath=function(t,e,r,a,i,s){var o=a/2,u=i/2;t.beginPath&&t.beginPath(),t.moveTo(e+o*s[0],r+u*s[1]);for(var d=1;d<s.length/2;d++)t.lineTo(e+o*s[d*2],r+u*s[d*2+1]);t.closePath()};vs.drawRoundPolygonPath=function(t,e,r,a,i,s,o){o.forEach(function(u){return dN(t,u)}),t.closePath()};vs.drawRoundRectanglePath=function(t,e,r,a,i,s){var o=a/2,u=i/2,d=s==="auto"?ns(a,i):Math.min(s,u,o);t.beginPath&&t.beginPath(),t.moveTo(e,r-u),t.arcTo(e+o,r-u,e+o,r,d),t.arcTo(e+o,r+u,e,r+u,d),t.arcTo(e-o,r+u,e-o,r,d),t.arcTo(e-o,r-u,e,r-u,d),t.lineTo(e,r-u),t.closePath()};vs.drawBottomRoundRectanglePath=function(t,e,r,a,i,s){var o=a/2,u=i/2,d=s==="auto"?ns(a,i):s;t.beginPath&&t.beginPath(),t.moveTo(e,r-u),t.lineTo(e+o,r-u),t.lineTo(e+o,r),t.arcTo(e+o,r+u,e,r+u,d),t.arcTo(e-o,r+u,e-o,r,d),t.lineTo(e-o,r-u),t.lineTo(e,r-u),t.closePath()};vs.drawCutRectanglePath=function(t,e,r,a,i,s,o){var u=a/2,d=i/2,f=o==="auto"?Xm():o;t.beginPath&&t.beginPath(),t.moveTo(e-u+f,r-d),t.lineTo(e+u-f,r-d),t.lineTo(e+u,r-d+f),t.lineTo(e+u,r+d-f),t.lineTo(e+u-f,r+d),t.lineTo(e-u+f,r+d),t.lineTo(e-u,r+d-f),t.lineTo(e-u,r-d+f),t.closePath()};vs.drawBarrelPath=function(t,e,r,a,i){var s=a/2,o=i/2,u=e-s,d=e+s,f=r-o,h=r+o,p=Wg(a,i),m=p.widthOffset,y=p.heightOffset,x=p.ctrlPtOffsetPct*m;t.beginPath&&t.beginPath(),t.moveTo(u,f+y),t.lineTo(u,h-y),t.quadraticCurveTo(u+x,h,u+m,h),t.lineTo(d-m,h),t.quadraticCurveTo(d-x,h,d,h-y),t.lineTo(d,f+y),t.quadraticCurveTo(d-x,f,d-m,f),t.lineTo(u+m,f),t.quadraticCurveTo(u+x,f,u,f+y),t.closePath()};var hE=Math.sin(0),vE=Math.cos(0),hm={},vm={},DN=Math.PI/40;for(var eo=0*Math.PI;eo<2*Math.PI;eo+=DN)hm[eo]=Math.sin(eo),vm[eo]=Math.cos(eo);vs.drawEllipsePath=function(t,e,r,a,i){if(t.beginPath&&t.beginPath(),t.ellipse)t.ellipse(e,r,a/2,i/2,0,0,2*Math.PI);else for(var s,o,u=a/2,d=i/2,f=0*Math.PI;f<2*Math.PI;f+=DN)s=e-u*hm[f]*hE+u*vm[f]*vE,o=r+d*vm[f]*hE+d*hm[f]*vE,f===0?t.moveTo(s,o):t.lineTo(s,o);t.closePath()};var Bc={};Bc.createBuffer=function(t,e){var r=document.createElement("canvas");return r.width=t,r.height=e,[r,r.getContext("2d")]};Bc.bufferCanvasImage=function(t){var e=this.cy,r=e.mutableElements(),a=r.boundingBox(),i=this.findContainerClientCoords(),s=t.full?Math.ceil(a.w):i[2],o=t.full?Math.ceil(a.h):i[3],u=De(t.maxWidth)||De(t.maxHeight),d=this.getPixelRatio(),f=1;if(t.scale!==void 0)s*=t.scale,o*=t.scale,f=t.scale;else if(u){var h=1/0,p=1/0;De(t.maxWidth)&&(h=f*t.maxWidth/s),De(t.maxHeight)&&(p=f*t.maxHeight/o),f=Math.min(h,p),s*=f,o*=f}u||(s*=d,o*=d,f*=d);var m=document.createElement("canvas");m.width=s,m.height=o,m.style.width=s+"px",m.style.height=o+"px";var y=m.getContext("2d");if(s>0&&o>0){y.clearRect(0,0,s,o),y.globalCompositeOperation="source-over";var x=this.getCachedZSortedEles();if(t.full)y.translate(-a.x1*f,-a.y1*f),y.scale(f,f),this.drawElements(y,x),y.scale(1/f,1/f),y.translate(a.x1*f,a.y1*f);else{var E=e.pan(),w={x:E.x*f,y:E.y*f};f*=e.zoom(),y.translate(w.x,w.y),y.scale(f,f),this.drawElements(y,x),y.scale(1/f,1/f),y.translate(-w.x,-w.y)}t.bg&&(y.globalCompositeOperation="destination-over",y.fillStyle=t.bg,y.rect(0,0,s,o),y.fill())}return m};function AP(t,e){for(var r=atob(t),a=new ArrayBuffer(r.length),i=new Uint8Array(a),s=0;s<r.length;s++)i[s]=r.charCodeAt(s);return new Blob([a],{type:e})}function pE(t){var e=t.indexOf(",");return t.substr(e+1)}function ON(t,e,r){var a=function(){return e.toDataURL(r,t.quality)};switch(t.output){case"blob-promise":return new Lo(function(i,s){try{e.toBlob(function(o){o!=null?i(o):s(new Error("`canvas.toBlob()` sent a null value in its callback"))},r,t.quality)}catch(o){s(o)}});case"blob":return AP(pE(a()),r);case"base64":return pE(a());case"base64uri":default:return a()}}Bc.png=function(t){return ON(t,this.bufferCanvasImage(t),"image/png")};Bc.jpg=function(t){return ON(t,this.bufferCanvasImage(t),"image/jpeg")};var RN={};RN.nodeShapeImpl=function(t,e,r,a,i,s,o,u){switch(t){case"ellipse":return this.drawEllipsePath(e,r,a,i,s);case"polygon":return this.drawPolygonPath(e,r,a,i,s,o);case"round-polygon":return this.drawRoundPolygonPath(e,r,a,i,s,o,u);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(e,r,a,i,s,u);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(e,r,a,i,s,o,u);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(e,r,a,i,s,u);case"barrel":return this.drawBarrelPath(e,r,a,i,s)}};var MP=BN,ft=BN.prototype;ft.CANVAS_LAYERS=3;ft.SELECT_BOX=0;ft.DRAG=1;ft.NODE=2;ft.WEBGL=3;ft.CANVAS_TYPES=["2d","2d","2d","webgl2"];ft.BUFFER_COUNT=3;ft.TEXTURE_BUFFER=0;ft.MOTIONBLUR_BUFFER_NODE=1;ft.MOTIONBLUR_BUFFER_DRAG=2;function BN(t){var e=this,r=e.cy.window(),a=r.document;t.webgl&&(ft.CANVAS_LAYERS=e.CANVAS_LAYERS=4,console.log("webgl rendering enabled")),e.data={canvases:new Array(ft.CANVAS_LAYERS),contexts:new Array(ft.CANVAS_LAYERS),canvasNeedsRedraw:new Array(ft.CANVAS_LAYERS),bufferCanvases:new Array(ft.BUFFER_COUNT),bufferContexts:new Array(ft.CANVAS_LAYERS)};var i="-webkit-tap-highlight-color",s="rgba(0,0,0,0)";e.data.canvasContainer=a.createElement("div");var o=e.data.canvasContainer.style;e.data.canvasContainer.style[i]=s,o.position="relative",o.zIndex="0",o.overflow="hidden";var u=t.cy.container();u.appendChild(e.data.canvasContainer),u.style[i]=s;var d={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};ED()&&(d["-ms-touch-action"]="none",d["touch-action"]="none");for(var f=0;f<ft.CANVAS_LAYERS;f++){var h=e.data.canvases[f]=a.createElement("canvas"),p=ft.CANVAS_TYPES[f];e.data.contexts[f]=h.getContext(p),e.data.contexts[f]||$t("Could not create canvas of type "+p),Object.keys(d).forEach(function(oe){h.style[oe]=d[oe]}),h.style.position="absolute",h.setAttribute("data-id","layer"+f),h.style.zIndex=String(ft.CANVAS_LAYERS-f),e.data.canvasContainer.appendChild(h),e.data.canvasNeedsRedraw[f]=!1}e.data.topCanvas=e.data.canvases[0],e.data.canvases[ft.NODE].setAttribute("data-id","layer"+ft.NODE+"-node"),e.data.canvases[ft.SELECT_BOX].setAttribute("data-id","layer"+ft.SELECT_BOX+"-selectbox"),e.data.canvases[ft.DRAG].setAttribute("data-id","layer"+ft.DRAG+"-drag"),e.data.canvases[ft.WEBGL]&&e.data.canvases[ft.WEBGL].setAttribute("data-id","layer"+ft.WEBGL+"-webgl");for(var f=0;f<ft.BUFFER_COUNT;f++)e.data.bufferCanvases[f]=a.createElement("canvas"),e.data.bufferContexts[f]=e.data.bufferCanvases[f].getContext("2d"),e.data.bufferCanvases[f].style.position="absolute",e.data.bufferCanvases[f].setAttribute("data-id","buffer"+f),e.data.bufferCanvases[f].style.zIndex=String(-f-1),e.data.bufferCanvases[f].style.visibility="hidden";e.pathsEnabled=!0;var m=na(),y=function(ae){return{x:(ae.x1+ae.x2)/2,y:(ae.y1+ae.y2)/2}},x=function(ae){return{x:-ae.w/2,y:-ae.h/2}},E=function(ae){var re=ae[0]._private,le=re.oldBackgroundTimestamp===re.backgroundTimestamp;return!le},w=function(ae){return ae[0]._private.nodeKey},T=function(ae){return ae[0]._private.labelStyleKey},C=function(ae){return ae[0]._private.sourceLabelStyleKey},N=function(ae){return ae[0]._private.targetLabelStyleKey},A=function(ae,re,le,se,Ne){return e.drawElement(ae,re,le,!1,!1,Ne)},D=function(ae,re,le,se,Ne){return e.drawElementText(ae,re,le,se,"main",Ne)},M=function(ae,re,le,se,Ne){return e.drawElementText(ae,re,le,se,"source",Ne)},j=function(ae,re,le,se,Ne){return e.drawElementText(ae,re,le,se,"target",Ne)},k=function(ae){return ae.boundingBox(),ae[0]._private.bodyBounds},B=function(ae){return ae.boundingBox(),ae[0]._private.labelBounds.main||m},P=function(ae){return ae.boundingBox(),ae[0]._private.labelBounds.source||m},U=function(ae){return ae.boundingBox(),ae[0]._private.labelBounds.target||m},R=function(ae,re){return re},V=function(ae){return y(k(ae))},_=function(ae,re,le){var se=ae?ae+"-":"";return{x:re.x+le.pstyle(se+"text-margin-x").pfValue,y:re.y+le.pstyle(se+"text-margin-y").pfValue}},H=function(ae,re,le){var se=ae[0]._private.rscratch;return{x:se[re],y:se[le]}},z=function(ae){return _("",H(ae,"labelX","labelY"),ae)},I=function(ae){return _("source",H(ae,"sourceLabelX","sourceLabelY"),ae)},F=function(ae){return _("target",H(ae,"targetLabelX","targetLabelY"),ae)},K=function(ae){return x(k(ae))},J=function(ae){return x(P(ae))},L=function(ae){return x(U(ae))},Q=function(ae){var re=B(ae),le=x(B(ae));if(ae.isNode()){switch(ae.pstyle("text-halign").value){case"left":le.x=-re.w-(re.leftPad||0);break;case"right":le.x=-(re.rightPad||0);break}switch(ae.pstyle("text-valign").value){case"top":le.y=-re.h-(re.topPad||0);break;case"bottom":le.y=-(re.botPad||0);break}}return le},X=e.data.eleTxrCache=new Vu(e,{getKey:w,doesEleInvalidateKey:E,drawElement:A,getBoundingBox:k,getRotationPoint:V,getRotationOffset:K,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),W=e.data.lblTxrCache=new Vu(e,{getKey:T,drawElement:D,getBoundingBox:B,getRotationPoint:z,getRotationOffset:Q,isVisible:R}),te=e.data.slbTxrCache=new Vu(e,{getKey:C,drawElement:M,getBoundingBox:P,getRotationPoint:I,getRotationOffset:J,isVisible:R}),Y=e.data.tlbTxrCache=new Vu(e,{getKey:N,drawElement:j,getBoundingBox:U,getRotationPoint:F,getRotationOffset:L,isVisible:R}),ne=e.data.lyrTxrCache=new wN(e);e.onUpdateEleCalcs(function(ae,re){X.invalidateElements(re),W.invalidateElements(re),te.invalidateElements(re),Y.invalidateElements(re),ne.invalidateElements(re);for(var le=0;le<re.length;le++){var se=re[le]._private;se.oldBackgroundTimestamp=se.backgroundTimestamp}});var he=function(ae){for(var re=0;re<ae.length;re++)ne.enqueueElementRefinement(ae[re].ele)};X.onDequeue(he),W.onDequeue(he),te.onDequeue(he),Y.onDequeue(he),t.webgl&&e.initWebgl(t,{getStyleKey:w,getLabelKey:T,getSourceLabelKey:C,getTargetLabelKey:N,drawElement:A,drawLabel:D,drawSourceLabel:M,drawTargetLabel:j,getElementBox:k,getLabelBox:B,getSourceLabelBox:P,getTargetLabelBox:U,getElementRotationPoint:V,getElementRotationOffset:K,getLabelRotationPoint:z,getSourceLabelRotationPoint:I,getTargetLabelRotationPoint:F,getLabelRotationOffset:Q,getSourceLabelRotationOffset:J,getTargetLabelRotationOffset:L})}ft.redrawHint=function(t,e){var r=this;switch(t){case"eles":r.data.canvasNeedsRedraw[ft.NODE]=e;break;case"drag":r.data.canvasNeedsRedraw[ft.DRAG]=e;break;case"select":r.data.canvasNeedsRedraw[ft.SELECT_BOX]=e;break;case"gc":r.data.gc=!0;break}};var kP=typeof Path2D<"u";ft.path2dEnabled=function(t){if(t===void 0)return this.pathsEnabled;this.pathsEnabled=!!t};ft.usePaths=function(){return kP&&this.pathsEnabled};ft.setImgSmoothing=function(t,e){t.imageSmoothingEnabled!=null?t.imageSmoothingEnabled=e:(t.webkitImageSmoothingEnabled=e,t.mozImageSmoothingEnabled=e,t.msImageSmoothingEnabled=e)};ft.getImgSmoothing=function(t){return t.imageSmoothingEnabled!=null?t.imageSmoothingEnabled:t.webkitImageSmoothingEnabled||t.mozImageSmoothingEnabled||t.msImageSmoothingEnabled};ft.makeOffscreenCanvas=function(t,e){var r;if((typeof OffscreenCanvas>"u"?"undefined":Er(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};[SN,Nn,ai,uy,cl,hs,ia,jN,vs,Bc,RN].forEach(function(t){tt(ft,t)});var DP=[{name:"null",impl:oN},{name:"base",impl:yN},{name:"canvas",impl:MP}],OP=[{type:"layout",extensions:aL},{type:"renderer",extensions:DP}],LN={},PN={};function zN(t,e,r){var a=r,i=function(k){At("Can not register `"+e+"` for `"+t+"` since `"+k+"` already exists in the prototype and can not be overridden")};if(t==="core"){if(sc.prototype[e])return i(e);sc.prototype[e]=r}else if(t==="collection"){if(Ir.prototype[e])return i(e);Ir.prototype[e]=r}else if(t==="layout"){for(var s=function(k){this.options=k,r.call(this,k),wt(this._private)||(this._private={}),this._private.cy=k.cy,this._private.listeners=[],this.createEmitter()},o=s.prototype=Object.create(r.prototype),u=[],d=0;d<u.length;d++){var f=u[d];o[f]=o[f]||function(){return this}}o.start&&!o.run?o.run=function(){return this.start(),this}:!o.start&&o.run&&(o.start=function(){return this.run(),this});var h=r.prototype.stop;o.stop=function(){var j=this.options;if(j&&j.animate){var k=this.animations;if(k)for(var B=0;B<k.length;B++)k[B].stop()}return h?h.call(this):this.emit("layoutstop"),this},o.destroy||(o.destroy=function(){return this}),o.cy=function(){return this._private.cy};var p=function(k){return k._private.cy},m={addEventFields:function(k,B){B.layout=k,B.cy=p(k),B.target=k},bubble:function(){return!0},parent:function(k){return p(k)}};tt(o,{createEmitter:function(){return this._private.emitter=new vh(m,this),this},emitter:function(){return this._private.emitter},on:function(k,B){return this.emitter().on(k,B),this},one:function(k,B){return this.emitter().one(k,B),this},once:function(k,B){return this.emitter().one(k,B),this},removeListener:function(k,B){return this.emitter().removeListener(k,B),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(k,B){return this.emitter().emit(k,B),this}}),jt.eventAliasesOn(o),a=s}else if(t==="renderer"&&e!=="null"&&e!=="base"){var y=_N("renderer","base"),x=y.prototype,E=r,w=r.prototype,T=function(){y.apply(this,arguments),E.apply(this,arguments)},C=T.prototype;for(var N in x){var A=x[N],D=w[N]!=null;if(D)return i(N);C[N]=A}for(var M in w)C[M]=w[M];x.clientFunctions.forEach(function(j){C[j]=C[j]||function(){$t("Renderer does not implement `renderer."+j+"()` on its prototype")}}),a=T}else if(t==="__proto__"||t==="constructor"||t==="prototype")return $t(t+" is an illegal type to be registered, possibly lead to prototype pollutions");return rC({map:LN,keys:[t,e],value:a})}function _N(t,e){return aC({map:LN,keys:[t,e]})}function RP(t,e,r,a,i){return rC({map:PN,keys:[t,e,r,a],value:i})}function BP(t,e,r,a){return aC({map:PN,keys:[t,e,r,a]})}var pm=function(){if(arguments.length===2)return _N.apply(null,arguments);if(arguments.length===3)return zN.apply(null,arguments);if(arguments.length===4)return BP.apply(null,arguments);if(arguments.length===5)return RP.apply(null,arguments);$t("Invalid extension access syntax")};sc.prototype.extension=pm;OP.forEach(function(t){t.extensions.forEach(function(e){zN(t.type,e.name,e.impl)})});var Kf=function(){if(!(this instanceof Kf))return new Kf;this.length=0},rl=Kf.prototype;rl.instanceString=function(){return"stylesheet"};rl.selector=function(t){var e=this.length++;return this[e]={selector:t,properties:[]},this};rl.css=function(t,e){var r=this.length-1;if(Xe(t))this[r].properties.push({name:t,value:e});else if(wt(t))for(var a=t,i=Object.keys(a),s=0;s<i.length;s++){var o=i[s],u=a[o];if(u!=null){var d=Rr.properties[o]||Rr.properties[nh(o)];if(d!=null){var f=d.name,h=u;this[r].properties.push({name:f,value:h})}}}return this};rl.style=rl.css;rl.generateStyle=function(t){var e=new Rr(t);return this.appendToStyle(e)};rl.appendToStyle=function(t){for(var e=0;e<this.length;e++){var r=this[e],a=r.selector,i=r.properties;t.selector(a);for(var s=0;s<i.length;s++){var o=i[s];t.css(o.name,o.value)}}return t};var LP="3.33.1",al=function(e){if(e===void 0&&(e={}),wt(e))return new sc(e);if(Xe(e))return pm.apply(pm,arguments)};al.use=function(t){var e=Array.prototype.slice.call(arguments,1);return e.unshift(al),t.apply(null,e),this};al.warnings=function(t){return cC(t)};al.version=LP;al.stylesheet=al.Stylesheet=Kf;const PP={projectId:"",collection:"",readonly:!0},zP=["title","name","label","displayName","summary","description","text","subject"];function _P(t){const e={};if(!t)return e;for(const r of t.nodeSchemas??[])(r.titleField||r.subtitleField)&&(e[r.aType]={titleField:r.titleField,subtitleField:r.subtitleField});for(const r of t.edgeSchemas??[])(r.titleField||r.subtitleField)&&(e[r.axbType]={titleField:r.titleField,subtitleField:r.subtitleField});return e}function UP(t,e,r){const a=i=>i.length>24?i.slice(0,22)+"…":i;if(r){const i=t[r];if(typeof i=="string"&&i.length>0)return a(i);if(typeof i=="number"||typeof i=="boolean")return a(String(i))}for(const i of zP){const s=t[i];if(typeof s=="string"&&s.length>0)return a(s)}for(const i of Object.values(t))if(typeof i=="string"&&i.length>0&&i.length<=80)return a(i);return e.slice(0,8)}function fo(t,e,r,a){var i;return UP(t,e,(i=a[r])==null?void 0:i.titleField)}function qP(t,e,r,a,i){const s=[],o=[],u=new Set,d=new Set;u.add(t.aUid),s.push({data:{id:t.aUid,label:fo(t.data,t.aUid,t.aType,i),nodeType:t.aType,isFocus:!0}});for(const f of e){if(!u.has(f.bUid)){u.add(f.bUid);const p=a[f.bUid];s.push({data:{id:f.bUid,label:p?fo(p.data,f.bUid,f.bType,i):f.bUid.slice(0,8),nodeType:f.bType}})}const h=`${f.aUid}:${f.axbType}:${f.bUid}`;d.has(h)||(d.add(h),o.push({data:{id:h,source:f.aUid,target:f.bUid,label:f.axbType,edgeType:f.axbType}}))}for(const f of r){if(!u.has(f.aUid)){u.add(f.aUid);const p=a[f.aUid];s.push({data:{id:f.aUid,label:p?fo(p.data,f.aUid,f.aType,i):f.aUid.slice(0,8),nodeType:f.aType}})}const h=`${f.aUid}:${f.axbType}:${f.bUid}`;d.has(h)||(d.add(h),o.push({data:{id:h,source:f.aUid,target:f.bUid,label:f.axbType,edgeType:f.axbType}}))}return[...s,...o]}function IP(t,e,r,a){const i=[],s=[],o=new Set,u=new Set;if(!o.has(t)){o.add(t);const d=r[t];i.push({data:{id:t,label:d?fo(d.data,t,d.aType,a):t.slice(0,8),nodeType:(d==null?void 0:d.aType)??"",isFocus:!0}})}for(const d of e){if(!o.has(d.aUid)){o.add(d.aUid);const h=r[d.aUid];i.push({data:{id:d.aUid,label:h?fo(h.data,d.aUid,d.aType,a):d.aUid.slice(0,8),nodeType:d.aType}})}if(!o.has(d.bUid)){o.add(d.bUid);const h=r[d.bUid];i.push({data:{id:d.bUid,label:h?fo(h.data,d.bUid,d.bType,a):d.bUid.slice(0,8),nodeType:d.bType}})}const f=`${d.aUid}:${d.axbType}:${d.bUid}`;u.has(f)||(u.add(f),s.push({data:{id:f,source:d.aUid,target:d.bUid,label:d.axbType,edgeType:d.axbType}}))}return[...i,...s]}const VP=[{selector:"node",style:{"background-color":"data(color)",label:"data(label)",color:"#e2e8f0","text-valign":"bottom","text-halign":"center","font-size":"11px","font-family":"ui-monospace, SFMono-Regular, Menlo, monospace","text-margin-y":6,"text-outline-color":"#020617","text-outline-width":2,width:28,height:28,"border-width":2,"border-color":"#334155"}},{selector:"node[?isFocus]",style:{width:42,height:42,"border-width":3,"border-color":"#818cf8","font-size":"13px","font-weight":"bold"}},{selector:"edge",style:{width:1.5,"line-color":"#475569","target-arrow-color":"#475569","target-arrow-shape":"triangle","curve-style":"bezier",label:"data(label)",color:"#94a3b8","font-size":"9px","font-family":"ui-monospace, SFMono-Regular, Menlo, monospace","text-rotation":"autorotate","text-background-color":"#0f172a","text-background-opacity":.85,"text-background-padding":"2px","text-background-shape":"round-rectangle"}},{selector:"node:active",style:{"overlay-color":"#818cf8","overlay-padding":4,"overlay-opacity":.2}},{selector:"node:selected",style:{"border-color":"#818cf8","border-width":3}}];function FP(t,e){switch(t){case"concentric":return{name:"concentric",concentric:r=>r.id()===e?10:1,levelWidth:()=>1,minNodeSpacing:50,animate:!0,animationDuration:300};case"breadthfirst":return{name:"breadthfirst",roots:`#${CSS.escape(e)}`,directed:!0,spacingFactor:1.25,animate:!0,animationDuration:300};case"cose":default:return{name:"cose",animate:!0,animationDuration:300,nodeRepulsion:()=>8e3,idealEdgeLength:()=>80,gravity:.25}}}function UN({node:t,focusUid:e,edges:r,schema:a,viewRegistry:i,config:s,onClose:o,onNodeClick:u}){const d=q.useRef(null),f=q.useRef(null),[h,p]=q.useState("breadthfirst"),[m,y]=q.useState(null),x=s??PP,{scopePath:E}=ba(),w=(t==null?void 0:t.aUid)??e??"",T=Ro(),C=!!r,N=r??[],A=C?[]:(T==null?void 0:T.edgeResults.out.edges)??[],D=C?[]:(T==null?void 0:T.edgeResults.in.edges)??[],M=q.useMemo(()=>{const F=new Set;if(C){for(const K of N)F.add(K.aUid),F.add(K.bUid);F.add(w)}else{for(const K of A)F.add(K.bUid);for(const K of D)F.add(K.aUid)}return t&&F.delete(t.aUid),[...F]},[C,N,A,D,t,w]),{data:j}=xt.getNodesBatch.useQuery({uids:M,...Zt(E)},{enabled:M.length>0}),k=q.useMemo(()=>{const F=(j==null?void 0:j.nodes)??{};return t&&(F[t.aUid]=t),F},[j,t]),B=C?N:[...A,...D],P=q.useMemo(()=>{const F={};for(const K of B){const J=`${K.aUid}:${K.axbType}:${K.bUid}`;F[J]||(F[J]={edgeType:K.axbType,data:K.data,aType:K.aType,bType:K.bType})}return F},[B]),U=q.useMemo(()=>_P(a),[a]),R=q.useMemo(()=>C?IP(w,N,k,U):qP(t,A,D,k,U),[C,w,N,t,A,D,k,U]),V=R.filter(F=>!F.data.source).length,_=R.filter(F=>F.data.source).length;for(const F of R)!F.data.source&&F.data.nodeType&&(F.data.color=B2(F.data.nodeType));q.useEffect(()=>{const F=K=>{K.key==="Escape"&&o()};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[o]),q.useEffect(()=>{if(!d.current)return;f.current&&(f.current.destroy(),f.current=null);const F=al({container:d.current,elements:R,style:VP,layout:FP(h,w),minZoom:.2,maxZoom:4,wheelSensitivity:.3});return F.on("tap","node",K=>{const J=K.target,L=J.id(),Q=J.data("nodeType");L!==w&&u(L,Q)}),F.on("mouseover","node",K=>{const J=K.target,L=K.originalEvent;y({kind:"node",uid:J.id(),nodeType:J.data("nodeType"),x:L.clientX,y:L.clientY})}),F.on("mouseover","edge",K=>{const J=K.target,L=K.originalEvent;y({kind:"edge",edgeId:J.id(),edgeType:J.data("edgeType"),x:L.clientX,y:L.clientY})}),F.on("mouseout","node, edge",()=>{y(null)}),F.on("viewport",()=>y(null)),f.current=F,()=>{F.destroy(),f.current=null}},[h,w,R.length]);const H=q.useCallback(()=>{var F;(F=f.current)==null||F.fit(void 0,40)},[]),z=[...new Set(R.filter(F=>!F.data.source).map(F=>F.data.nodeType))],I=q.useMemo(()=>{var te,Y,ne,he,oe,ae,re,le,se;if(!m)return null;if(m.kind==="node"){const{uid:Ne,nodeType:Ae}=m,Ze=t&&Ne===t.aUid?t.data:((te=k[Ne])==null?void 0:te.data)??null;if(!Ze)return{title:`${Ae} ${Ne}`,tagName:null,data:null};const Qe=((Y=i==null?void 0:i.nodes[Ae])==null?void 0:Y.views)??[],Se=(he=(ne=x.viewDefaults)==null?void 0:ne.nodes)==null?void 0:he[Ae],Oe=nn(Se,Qe),ke=Oe!=="json"?((oe=Qe.find(Pe=>Pe.viewName===Oe))==null?void 0:oe.tagName)??null:null;return{title:`${Ae} ${Ne}`,tagName:ke,data:Ze}}const{edgeId:F,edgeType:K}=m,J=P[F];if(!J)return null;const L=((ae=i==null?void 0:i.edges[K])==null?void 0:ae.views)??[],Q=(le=(re=x.viewDefaults)==null?void 0:re.edges)==null?void 0:le[K],X=nn(Q,L),W=X!=="json"?((se=L.find(Ne=>Ne.viewName===X))==null?void 0:se.tagName)??null:null;return{title:`${J.aType} —[${K}]→ ${J.bType}`,tagName:W,data:J.data}},[m,t,k,i,x,P]);return $u.createPortal(g.jsxs("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50",onClick:o,children:[g.jsxs("div",{className:"bg-slate-900 border border-slate-700 rounded-xl shadow-2xl flex flex-col overflow-hidden",style:{width:"90vw",height:"85vh"},onClick:F=>F.stopPropagation(),children:[g.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 border-b border-slate-700/60 bg-slate-900/80 shrink-0",children:[g.jsx("span",{className:"text-sm font-medium text-slate-200",children:"Graph"}),g.jsxs("span",{className:"text-xs text-slate-500",children:[V," nodes, ",_," edges"]}),g.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[g.jsxs("select",{value:h,onChange:F=>p(F.target.value),className:"bg-slate-800 border border-slate-700 rounded-lg px-2.5 py-1 text-xs text-slate-300 focus:outline-none focus:border-slate-500",children:[g.jsx("option",{value:"breadthfirst",children:"Tree"}),g.jsx("option",{value:"concentric",children:"Concentric"}),g.jsx("option",{value:"cose",children:"Force-directed"})]}),g.jsx("button",{onClick:H,className:"px-2.5 py-1 bg-slate-800 border border-slate-700 text-slate-300 rounded-lg text-xs hover:bg-slate-700 transition-colors",title:"Fit to viewport",children:"Fit"}),g.jsx("button",{onClick:o,className:"px-2 py-1 text-slate-400 hover:text-slate-200 transition-colors text-lg leading-none",title:"Close",children:"×"})]})]}),g.jsx("div",{ref:d,className:"flex-1 bg-slate-950"}),g.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 border-t border-slate-700/60 bg-slate-900/80 shrink-0 overflow-x-auto",children:[z.map(F=>g.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-slate-400 whitespace-nowrap",children:[g.jsx("span",{className:"inline-block w-2.5 h-2.5 rounded-full shrink-0",style:{backgroundColor:B2(F)}}),F]},F)),g.jsx("span",{className:"text-xs text-slate-600 ml-auto whitespace-nowrap",children:"Click a node to drill in"})]})]}),m&&I&&I.data&&g.jsx(HP,{x:m.x,y:m.y,title:I.title,tagName:I.tagName,data:I.data})]}),document.body)}function HP({x:t,y:e,title:r,tagName:a,data:i}){const s=q.useRef(null),[o,u]=q.useState({left:t+12,top:e+12}),[d,f]=q.useState(!1);return q.useEffect(()=>{const h=s.current;if(!h)return;const p=h.getBoundingClientRect(),m=12;let y=t+m,x=e+m;y+p.width>window.innerWidth-m&&(y=t-p.width-m),x+p.height>window.innerHeight-m&&(x=e-p.height-m),u({left:y,top:x})},[t,e]),g.jsxs("div",{ref:s,className:"fixed z-[60] max-w-sm rounded-lg border border-slate-600 bg-slate-900 shadow-2xl overflow-hidden pointer-events-none",style:{left:o.left,top:o.top},onClick:h=>h.stopPropagation(),children:[g.jsx("div",{className:"px-3 py-1.5 border-b border-slate-700/60 text-xs text-slate-400 font-mono truncate",children:r}),g.jsx("div",{className:"p-2 max-h-64 overflow-auto",children:a&&!d?g.jsx(Jn,{tagName:a,data:i,onError:()=>f(!0)}):g.jsx("div",{className:"text-xs font-mono",children:g.jsx(Oa,{data:i,defaultExpanded:!0,depth:0})})})]})}function vf(t,e,r){if(!e)return t.edgeTypes;const a=t.edgeTypes.filter(i=>r==="forward"?i.aType===e:i.bType===e);return a.length>0?a:t.edgeTypes}function pf(t){return[...new Set(t.map(e=>e.axbType))]}function gE(t,e,r){const a=[];let i=e;for(const s of r){const o=t.edgeTypes.filter(d=>d.axbType===s.axbType);let u;if(i&&o.length>0)if(s.direction==="forward"){const d=o.find(f=>f.aType===i);u=d==null?void 0:d.bType}else{const d=o.find(f=>f.bType===i);u=d==null?void 0:d.aType}else o.length===1&&(u=s.direction==="forward"?o[0].bType:o[0].aType);a.push({sourceType:i,targetType:u}),i=u}return a}function GP(t,e){var a;const r=(a=t.edgeSchemas)==null?void 0:a.find(i=>i.axbType===e&&!i.isNodeEntry);return(r==null?void 0:r.fields)??[]}function QP({schema:t}){const[e,r]=q.useState(""),[a,i]=q.useState("");return g.jsxs("div",{className:"p-6 max-w-6xl mx-auto",children:[g.jsxs("div",{className:"mb-6",children:[g.jsx("h1",{className:"text-xl font-bold mb-1",children:"Graph Traversal"}),g.jsx("p",{className:"text-sm text-slate-400",children:"Build multi-hop traversals to explore graph relationships"})]}),g.jsxs("div",{className:"bg-slate-900 rounded-xl border border-slate-800 p-5",children:[g.jsxs("div",{className:"mb-5 flex gap-4 items-end",children:[g.jsxs("div",{className:"flex-1 max-w-sm",children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-1.5",children:"Start Node UID"}),g.jsx("input",{type:"text",value:e,onChange:s=>r(s.target.value),placeholder:"paste a node UID",className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm font-mono text-slate-200 placeholder:text-slate-600 focus:outline-none focus:border-indigo-500 transition-colors"})]}),g.jsxs("div",{children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-1.5",children:"Node Type"}),g.jsxs("select",{value:a,onChange:s=>i(s.target.value),className:"bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm text-slate-200 focus:outline-none focus:border-indigo-500 transition-colors",children:[g.jsx("option",{value:"",children:"Any type"}),t.nodeTypes.map(s=>g.jsx("option",{value:s.type,children:s.type},s.type))]})]})]}),g.jsx(qN,{schema:t,startUid:e,startNodeType:a||void 0})]})]})}function qN({schema:t,startUid:e,startNodeType:r,viewRegistry:a,config:i}){const{scopePath:s,scopedPath:o}=ba(),u=q.useMemo(()=>{var R,V;if(r){const _=vf(t,r,"forward");return pf(_)[0]||((R=t.edgeTypes[0])==null?void 0:R.axbType)||""}return((V=t.edgeTypes[0])==null?void 0:V.axbType)||""},[t,r]),[d,f]=q.useState([{axbType:u,direction:"forward",limit:10}]),[h,p]=q.useState(100),[m,y]=q.useState(5),[x,E]=q.useState(null),[w,T]=q.useState(null),[C,N]=q.useState(new Set),A=xt.traverse.useMutation({onSuccess:R=>E(R),onError:R=>T(R.message)}),D=A.isPending,M=q.useMemo(()=>gE(t,r,d),[t,r,d]),j=()=>{var H;const R=(H=M[M.length-1])==null?void 0:H.targetType,V=vf(t,R,"forward"),_=pf(V);f([...d,{axbType:_[0]||"",direction:"forward",limit:10}])},k=R=>{d.length<=1||(f(d.filter((V,_)=>_!==R)),N(V=>{const _=new Set;for(const H of V)H<R?_.add(H):H>R&&_.add(H-1);return _}))},B=(R,V)=>{f(_=>{var z;const H=[..._];if(H[R]={...H[R],...V},"direction"in V){const F=(z=gE(t,r,H)[R])==null?void 0:z.sourceType,K=pf(vf(t,F,H[R].direction));K.length>0&&!K.includes(H[R].axbType)&&(H[R]={...H[R],axbType:K[0]})}return H})},P=R=>{N(V=>{const _=new Set(V);return _.has(R)?_.delete(R):_.add(R),_})},U=()=>{e.trim()&&(T(null),E(null),A.mutate({startUid:e.trim(),hops:d,maxReads:h,concurrency:m,...Zt(s)}))};return g.jsxs(g.Fragment,{children:[r&&g.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[g.jsx("span",{className:"text-xs text-slate-500",children:"Starting from"}),g.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-mono font-medium ${nr(r)}`,children:r}),g.jsx("span",{className:"text-xs text-slate-400 font-mono",children:e})]}),g.jsxs("div",{className:"mb-5",children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-2",children:"Hops"}),g.jsx("div",{className:"space-y-2",children:d.map((R,V)=>{const _=M[V],H=_==null?void 0:_.sourceType,z=_==null?void 0:_.targetType,I=vf(t,H,R.direction),F=pf(I),K=C.has(V),J=GP(t,R.axbType);return g.jsxs("div",{className:"bg-slate-800/50 rounded-lg",children:[g.jsxs("div",{className:"flex items-center gap-2 p-3",children:[g.jsxs("span",{className:"text-xs text-slate-500 w-6 shrink-0",children:["#",V+1]}),H?g.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-mono shrink-0 ${nr(H)}`,children:H}):g.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono bg-slate-700 text-slate-500 shrink-0",children:"?"}),g.jsxs("select",{value:R.direction,onChange:L=>B(V,{direction:L.target.value}),className:"bg-slate-800 border border-slate-700 rounded-lg px-2 py-1.5 text-xs text-slate-200 focus:outline-none focus:border-indigo-500",children:[g.jsx("option",{value:"forward",children:"Forward"}),g.jsx("option",{value:"reverse",children:"Reverse"})]}),g.jsx("select",{value:R.axbType,onChange:L=>B(V,{axbType:L.target.value}),className:"bg-slate-800 border border-slate-700 rounded-lg px-2 py-1.5 text-xs text-slate-200 focus:outline-none focus:border-indigo-500 flex-1 max-w-xs",children:F.map(L=>g.jsx("option",{value:L,children:L},L))}),g.jsx("span",{className:"text-slate-600 text-xs",children:"→"}),z?g.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-mono shrink-0 ${nr(z)}`,children:z}):g.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono bg-slate-700 text-slate-500 shrink-0",children:"?"}),g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("span",{className:"text-xs text-slate-500",children:"limit:"}),g.jsx("input",{type:"number",value:R.limit,onChange:L=>B(V,{limit:parseInt(L.target.value)||10}),className:"w-14 bg-slate-800 border border-slate-700 rounded-lg px-2 py-1.5 text-xs text-slate-200 focus:outline-none focus:border-indigo-500",min:1,max:200})]}),g.jsx("button",{onClick:()=>P(V),className:`p-1 transition-colors ${K?"text-indigo-400":"text-slate-600 hover:text-slate-400"}`,title:"Advanced options",children:g.jsxs("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.066 2.573c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.573 1.066c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.066-2.573c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}),d.length>1&&g.jsx("button",{onClick:()=>k(V),className:"text-slate-600 hover:text-red-400 transition-colors p-1",title:"Remove hop",children:g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),K&&g.jsx($P,{hop:R,index:V,fields:J,updateHop:B})]},V)})}),g.jsxs("button",{onClick:j,className:"mt-2 text-xs text-indigo-400 hover:text-indigo-300 transition-colors flex items-center gap-1",children:[g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),"Add Hop"]})]}),g.jsxs("div",{className:"mb-5 flex gap-5 items-end",children:[g.jsxs("div",{children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-1.5",children:"Read Budget"}),g.jsx("input",{type:"number",value:h,onChange:R=>p(parseInt(R.target.value)||100),className:"w-24 bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm text-slate-200 focus:outline-none focus:border-indigo-500",min:1,max:1e3})]}),g.jsxs("div",{children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-1.5",children:"Concurrency"}),g.jsx("input",{type:"number",value:m,onChange:R=>y(parseInt(R.target.value)||5),className:"w-20 bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm text-slate-200 focus:outline-none focus:border-indigo-500",min:1,max:20})]})]}),g.jsxs("div",{className:"mb-5 bg-slate-950 rounded-lg p-3",children:[g.jsx("p",{className:"text-xs text-slate-500 mb-1",children:"Query Preview"}),g.jsxs("div",{className:"flex items-center gap-1.5 text-sm font-mono flex-wrap",children:[g.jsx("span",{className:"text-indigo-400",children:e||"?"}),r&&g.jsxs("span",{className:"text-slate-500 text-xs",children:["(",r,")"]}),d.map((R,V)=>{var H;const _=(H=M[V])==null?void 0:H.targetType;return g.jsxs("span",{className:"flex items-center gap-1.5",children:[g.jsx("span",{className:"text-slate-600",children:R.direction==="forward"?"→":"←"}),g.jsx("span",{className:"text-emerald-400",children:R.axbType||"?"}),_&&g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"text-slate-600",children:"→"}),g.jsx("span",{className:"text-cyan-400 text-xs",children:_})]})]},V)})]})]}),g.jsx("button",{onClick:U,disabled:D||!e.trim(),className:"px-5 py-2 bg-indigo-600 text-white rounded-lg text-sm font-medium hover:bg-indigo-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:D?g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"w-3.5 h-3.5 border-2 border-white border-t-transparent rounded-full animate-spin"}),"Running..."]}):g.jsxs(g.Fragment,{children:[g.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),"Run Traversal"]})}),w&&g.jsx("div",{className:"bg-red-500/10 border border-red-500/30 rounded-lg p-3 mt-4 text-sm text-red-400",children:w}),x&&g.jsx("div",{className:"mt-5",children:g.jsx(XP,{result:x,startUid:e,schema:t,viewRegistry:a,config:i})})]})}function $P({hop:t,index:e,fields:r,updateHop:a}){var u,d;const i=()=>{var h;const f=t.where??[];a(e,{where:[...f,{field:((h=r[0])==null?void 0:h.name)||"",op:"==",value:""}]})},s=(f,h)=>{const p=[...t.where??[]];p[f]={...p[f],...h},a(e,{where:p})},o=f=>{const h=(t.where??[]).filter((p,m)=>m!==f);a(e,{where:h.length>0?h:void 0})};return g.jsxs("div",{className:"border-t border-slate-700/50 px-3 pb-3 pt-2 space-y-3",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"text-[10px] text-slate-500 w-16 shrink-0",children:"Order By"}),r.length>0?g.jsxs("select",{value:((u=t.orderBy)==null?void 0:u.field)||"",onChange:f=>{var h;return a(e,{orderBy:f.target.value?{field:f.target.value,direction:((h=t.orderBy)==null?void 0:h.direction)??"asc"}:void 0})},className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-[11px] text-slate-200 focus:outline-none focus:border-indigo-500",children:[g.jsx("option",{value:"",children:"None"}),r.map(f=>g.jsx("option",{value:f.name,children:f.name},f.name))]}):g.jsx("input",{type:"text",value:((d=t.orderBy)==null?void 0:d.field)||"",onChange:f=>{var h;return a(e,{orderBy:f.target.value?{field:f.target.value,direction:((h=t.orderBy)==null?void 0:h.direction)??"asc"}:void 0})},placeholder:"field name",className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-[11px] text-slate-200 placeholder:text-slate-600 focus:outline-none focus:border-indigo-500 w-32"}),t.orderBy&&g.jsxs("select",{value:t.orderBy.direction,onChange:f=>a(e,{orderBy:{...t.orderBy,direction:f.target.value}}),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-[11px] text-slate-200 focus:outline-none focus:border-indigo-500",children:[g.jsx("option",{value:"asc",children:"asc"}),g.jsx("option",{value:"desc",children:"desc"})]})]}),g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[g.jsx("span",{className:"text-[10px] text-slate-500 w-16 shrink-0",children:"Where"}),g.jsx("button",{onClick:i,className:"text-[10px] text-indigo-400 hover:text-indigo-300 transition-colors",children:"+ Add filter"})]}),(t.where??[]).map((f,h)=>g.jsxs("div",{className:"flex items-center gap-1.5 ml-[4.5rem] mb-1",children:[r.length>0?g.jsx("select",{value:f.field,onChange:p=>s(h,{field:p.target.value}),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-[11px] text-slate-200 focus:outline-none focus:border-indigo-500",children:r.map(p=>g.jsx("option",{value:p.name,children:p.name},p.name))}):g.jsx("input",{type:"text",value:f.field,onChange:p=>s(h,{field:p.target.value}),placeholder:"field",className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-[11px] text-slate-200 placeholder:text-slate-600 focus:outline-none focus:border-indigo-500 w-24"}),g.jsxs("select",{value:f.op,onChange:p=>s(h,{op:p.target.value}),className:"bg-slate-800 border border-slate-700 rounded px-1.5 py-1 text-[11px] text-slate-200 focus:outline-none focus:border-indigo-500 w-14",children:[g.jsx("option",{value:"==",children:"=="}),g.jsx("option",{value:"!=",children:"!="}),g.jsx("option",{value:"<",children:"<"}),g.jsx("option",{value:"<=",children:"<="}),g.jsx("option",{value:">",children:">"}),g.jsx("option",{value:">=",children:">="})]}),g.jsx("input",{type:"text",value:String(f.value),onChange:p=>{const m=Number(p.target.value),y=p.target.value==="true"?!0:p.target.value==="false"?!1:!isNaN(m)&&p.target.value!==""?m:p.target.value;s(h,{value:y})},placeholder:"value",className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-[11px] text-slate-200 placeholder:text-slate-600 focus:outline-none focus:border-indigo-500 w-28"}),g.jsx("button",{onClick:()=>o(h),className:"text-slate-600 hover:text-red-400 transition-colors p-0.5",children:g.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},h))]})]})}function IN(t,e,r){const a=[],i=t[e].direction;let s=i==="forward"?r.aUid:r.bUid;for(let u=e-1;u>=0;u--){const d=t[u],f=d.edges.find(h=>d.direction==="forward"?h.bUid===s:h.aUid===s);if(!f)break;a.unshift({edge:f,direction:d.direction}),s=d.direction==="forward"?f.aUid:f.bUid}const o=a.map(({edge:u,direction:d})=>({uid:d==="forward"?u.bUid:u.aUid,nodeType:d==="forward"?u.bType:u.aType,edgeType:u.axbType,direction:d==="forward"?"out":"in"}));return o.push({uid:i==="forward"?r.bUid:r.aUid,nodeType:i==="forward"?r.bType:r.aType,edgeType:r.axbType,direction:i==="forward"?"out":"in"}),o}const YP=20;function KP(t){return{uid:t,nodeType:"",edgeType:"",direction:"out"}}function XP({result:t,startUid:e,schema:r,viewRegistry:a,config:i}){const s=$T(),o=on(),{scopedPath:u}=ba(),[d,f]=q.useState(!1),h=q.useMemo(()=>t.hops.flatMap(m=>m.edges),[t.hops]),p=m=>{const E=t.hops[m].edges.slice(0,YP).map(w=>IN(t.hops,m,w));if(s)for(const w of E)s.createLane([KP(e),...w]);else o(u(`/node/${encodeURIComponent(e)}`),{state:{initialPaths:E}})};return g.jsxs("div",{className:"bg-slate-900 rounded-xl border border-slate-800 p-5",children:[g.jsxs("div",{className:"flex items-center gap-6 mb-5",children:[g.jsxs("div",{children:[g.jsx("div",{className:"text-lg font-bold",children:t.nodes.length}),g.jsx("div",{className:"text-[10px] text-slate-500",children:"Result Nodes"})]}),g.jsxs("div",{children:[g.jsx("div",{className:"text-lg font-bold",children:t.hops.length}),g.jsx("div",{className:"text-[10px] text-slate-500",children:"Hops"})]}),g.jsxs("div",{children:[g.jsx("div",{className:"text-lg font-bold",children:t.totalReads}),g.jsx("div",{className:"text-[10px] text-slate-500",children:"Firestore Reads"})]}),t.truncated&&g.jsx("div",{className:"px-2 py-1 bg-amber-500/10 text-amber-400 rounded text-xs",children:"Truncated (budget exceeded)"}),g.jsx("button",{onClick:()=>f(!0),className:"ml-auto px-3 py-1.5 bg-slate-800 text-slate-300 rounded-lg text-xs hover:bg-slate-700 transition-colors",children:"Graph"})]}),g.jsx("div",{className:"space-y-4",children:t.hops.map((m,y)=>g.jsxs("div",{className:"border-l-2 border-indigo-500/30 pl-4",children:[g.jsxs("h3",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[g.jsxs("span",{className:"text-slate-500",children:["Hop ",y+1,":"]}),g.jsx("span",{className:"text-indigo-400 font-mono",children:m.axbType}),g.jsxs("span",{className:"text-slate-600 text-xs",children:["(",m.direction,", ",m.edges.length," edges from ",m.sourceCount," sources)"]}),m.truncated&&g.jsx("span",{className:"text-amber-400 text-[10px]",children:"truncated"}),m.edges.length>0&&g.jsx("button",{onClick:()=>p(y),className:"text-[10px] text-indigo-400 hover:text-indigo-300 transition-colors ml-auto",children:"show paths"})]}),g.jsxs("div",{className:"space-y-1.5",children:[m.edges.slice(0,20).map((x,E)=>{var w,T;return g.jsx(ZP,{edge:x,direction:m.direction,allHops:t.hops,hopIndex:y,edgeViews:((w=a==null?void 0:a.edges[x.axbType])==null?void 0:w.views)??[],nodeViews:((T=a==null?void 0:a.nodes[m.direction==="forward"?x.bType:x.aType])==null?void 0:T.views)??[],config:i},E)}),m.edges.length>20&&g.jsxs("p",{className:"text-xs text-slate-500 pl-2",children:["... and ",m.edges.length-20," more"]}),m.edges.length===0&&g.jsx("p",{className:"text-xs text-slate-500",children:"No edges found"})]})]},y))}),d&&h.length>0&&g.jsx(UN,{focusUid:e,edges:h,schema:r,viewRegistry:a,config:i,onClose:()=>f(!1),onNodeClick:(m,y)=>{f(!1),s?s.drillIn({uid:m,nodeType:y,edgeType:"",direction:"out"}):o(u(`/node/${encodeURIComponent(m)}`))}})]})}function ZP({edge:t,direction:e,allHops:r,hopIndex:a,edgeViews:i=[],nodeViews:s=[],config:o}){const{scopePath:u,scopedPath:d}=ba(),f=$T(),h=xt.useUtils(),[p,m]=q.useState(!1),[y,x]=q.useState(!1),[E,w]=q.useState(void 0),[T,C]=q.useState(!1),{aType:N,aUid:A,bType:D,bUid:M,data:j}=t,k=j&&Object.keys(j).length>0,B=e==="forward"?M:A,P=e==="forward"?D:N,U=e==="forward"?A:M,R=e==="forward"?N:D,V=E!==void 0,_=()=>{var X,W;const Q=(W=(X=o==null?void 0:o.viewDefaults)==null?void 0:X.edges)==null?void 0:W[t.axbType];if(Q&&i.length>0){const te=nn(Q,i,"inline");if(te!=="json"){const Y=i.find(ne=>ne.viewName===te);if(Y)return Y.tagName}}return"json"},[H,z]=q.useState(_),I=()=>{var X,W;const Q=(W=(X=o==null?void 0:o.viewDefaults)==null?void 0:X.nodes)==null?void 0:W[P];if(Q&&s.length>0){const te=nn(Q,s,"inline");if(te!=="json"){const Y=s.find(ne=>ne.viewName===te);if(Y)return Y.tagName}}return"json"},[F,K]=q.useState(I),J=()=>{if(!f)return;const Q=IN(r,a,t);f.drillPath(Q)},L=async()=>{var Q,X;C(!0);try{const te=(await h.getNodesBatch.fetch({uids:[B],...Zt(u)})).nodes[B]??null;if(w(te),x(!0),te){const Y=(X=(Q=o==null?void 0:o.viewDefaults)==null?void 0:Q.nodes)==null?void 0:X[P];if(Y&&s.length>0){const ne=nn(Y,s,"inline");if(ne!=="json"){const he=s.find(oe=>oe.viewName===ne);he&&K(he.tagName)}}}}catch{}finally{C(!1)}};return g.jsxs("div",{className:"bg-slate-800/50 rounded-lg",children:[g.jsxs("div",{className:"px-3 pt-2 pb-1 flex items-center gap-2 text-xs text-slate-500",children:[g.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-mono ${nr(R)}`,children:R}),g.jsx("span",{className:"font-mono text-slate-400",children:U}),g.jsx("span",{className:"text-slate-600",children:e==="forward"?"→":"←"}),g.jsx("span",{className:"text-slate-600 font-mono text-[10px]",children:t.axbType})]}),g.jsxs("div",{className:"px-3 pb-2 flex items-center gap-3",children:[g.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-mono ${nr(P)}`,children:P}),f?g.jsx("button",{onClick:J,className:"text-sm font-mono text-indigo-400 hover:text-indigo-300 transition-colors",title:"Dive into this node",children:B}):g.jsx(Qt,{to:d(`/node/${encodeURIComponent(B)}`),className:"text-sm font-mono text-indigo-400 hover:text-indigo-300 transition-colors",children:B}),g.jsx(Qt,{to:d(`/node/${encodeURIComponent(B)}`),className:"text-[10px] text-slate-500 hover:text-slate-300 transition-colors",title:"Navigate to this node's page",children:"go to"}),k&&g.jsx("button",{onClick:()=>m(!p),className:"text-[10px] text-slate-500 hover:text-slate-300 transition-colors",children:p?"hide edge":"show edge"}),!V&&!T&&g.jsx("button",{onClick:L,className:"text-[10px] text-slate-500 hover:text-slate-300 transition-colors",children:"resolve"}),T&&g.jsx("span",{className:"w-2.5 h-2.5 border border-slate-400 border-t-transparent rounded-full animate-spin"}),V&&g.jsx("button",{onClick:()=>x(!y),className:"text-[10px] text-slate-500 hover:text-slate-300 transition-colors",children:y?"hide node":"show node"})]}),p&&k&&g.jsxs("div",{className:"px-3 pb-2",children:[i.length>0&&g.jsx("div",{className:"mb-2",children:g.jsx(Ao,{views:i,activeView:H,onSwitch:z})}),H==="json"?g.jsx("div",{className:"font-mono text-[11px] leading-relaxed bg-slate-950 rounded p-2 overflow-auto max-h-40",children:g.jsx(Oa,{data:j,defaultExpanded:!0})}):g.jsx(Jn,{tagName:H,data:j,onError:()=>z("json")})]}),y&&V&&g.jsx("div",{className:"px-3 pb-2",children:E===null?g.jsx("p",{className:"text-[11px] text-slate-500 italic",children:"Node not found"}):g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[g.jsx("span",{className:"text-[10px] text-slate-500 uppercase tracking-wider font-semibold",children:"Node Data"}),s.length>0&&g.jsx(Ao,{views:s,activeView:F,onSwitch:K})]}),F==="json"?g.jsx("div",{className:"font-mono text-[11px] leading-relaxed bg-slate-950 rounded p-2 overflow-auto max-h-40",children:g.jsx(Oa,{data:E.data,defaultExpanded:!0})}):g.jsx(Jn,{tagName:F,data:E.data,onError:()=>K("json")})]})})]})}function oc({fields:t,values:e,onChange:r,errors:a}){return g.jsx("div",{className:"space-y-4",children:t.map(i=>g.jsx(VN,{field:i,value:e[i.name],error:a==null?void 0:a[i.name],onChange:s=>r({...e,[i.name]:s})},i.name))})}function VN({field:t,value:e,error:r,onChange:a}){const i=`${t.name}${t.required?"":" (optional)"}`;return t.type==="string"?g.jsxs("div",{children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:i}),g.jsx("input",{type:"text",value:e??"",onChange:s=>a(s.target.value),placeholder:t.pattern?`Pattern: ${t.pattern}`:void 0,minLength:t.minLength,maxLength:t.maxLength,className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm font-mono text-slate-200 placeholder:text-slate-600 focus:outline-none focus:border-indigo-500 transition-colors"}),t.minLength!==void 0&&g.jsxs("p",{className:"text-[10px] text-slate-600 mt-0.5",children:["Min length: ",t.minLength]}),r&&g.jsx("p",{className:"text-xs text-red-400 mt-1",children:r})]}):t.type==="number"?g.jsxs("div",{children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:i}),g.jsx("input",{type:"number",value:e!=null?String(e):"",onChange:s=>{const o=s.target.value;if(o==="")return a(void 0);a(t.isInt?parseInt(o,10):parseFloat(o))},min:t.min,max:t.max,step:t.isInt?1:"any",className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm font-mono text-slate-200 placeholder:text-slate-600 focus:outline-none focus:border-indigo-500 transition-colors"}),r&&g.jsx("p",{className:"text-xs text-red-400 mt-1",children:r})]}):t.type==="boolean"?g.jsxs("div",{children:[g.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[g.jsx("input",{type:"checkbox",checked:!!e,onChange:s=>a(s.target.checked),className:"w-4 h-4 bg-slate-800 border-slate-700 rounded text-indigo-600 focus:ring-indigo-500"}),g.jsx("span",{className:"text-xs text-slate-400",children:i})]}),r&&g.jsx("p",{className:"text-xs text-red-400 mt-1",children:r})]}):t.type==="enum"&&t.enumValues?g.jsxs("div",{children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:i}),g.jsxs("select",{value:e??"",onChange:s=>a(s.target.value||void 0),className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm text-slate-200 focus:outline-none focus:border-indigo-500 transition-colors",children:[g.jsx("option",{value:"",children:"Select..."}),t.enumValues.map(s=>g.jsx("option",{value:s,children:s},s))]}),r&&g.jsx("p",{className:"text-xs text-red-400 mt-1",children:r})]}):t.type==="array"&&t.itemMeta?g.jsx(WP,{field:t,value:e,onChange:a,error:r}):t.type==="object"&&t.fields?g.jsxs("div",{children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:i}),g.jsx("div",{className:"pl-4 border-l-2 border-slate-700",children:g.jsx(oc,{fields:t.fields,values:e??{},onChange:s=>a(s)})}),r&&g.jsx("p",{className:"text-xs text-red-400 mt-1",children:r})]}):g.jsxs("div",{children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:i}),g.jsx("textarea",{value:e!==void 0?JSON.stringify(e,null,2):"",onChange:s=>{try{a(JSON.parse(s.target.value))}catch{}},rows:3,className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm font-mono text-slate-200 placeholder:text-slate-600 focus:outline-none focus:border-indigo-500 transition-colors",placeholder:"JSON value"}),r&&g.jsx("p",{className:"text-xs text-red-400 mt-1",children:r})]})}function WP({field:t,value:e,onChange:r,error:a}){const i=Array.isArray(e)?e:[],[s,o]=q.useState(!1),u=()=>{var m,y,x;const p=((m=t.itemMeta)==null?void 0:m.type)==="object"?{}:((y=t.itemMeta)==null?void 0:y.type)==="string"?"":((x=t.itemMeta)==null?void 0:x.type)==="number"?0:null;r([...i,p])},d=p=>{r(i.filter((m,y)=>y!==p))},f=(p,m)=>{r(i.map((y,x)=>x===p?m:y))},h=`${t.name}${t.required?"":" (optional)"}`;return g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[g.jsx("label",{className:"text-xs text-slate-400",children:h}),g.jsxs("button",{type:"button",onClick:()=>o(!s),className:"text-[10px] text-slate-600 hover:text-slate-400",children:["[",i.length," items] ",s?"+":"-"]})]}),!s&&g.jsxs("div",{className:"pl-4 border-l-2 border-slate-700 space-y-2",children:[i.map((p,m)=>g.jsxs("div",{className:"flex items-start gap-2",children:[g.jsx("span",{className:"text-[10px] text-slate-600 mt-2 w-4 shrink-0",children:m}),g.jsx("div",{className:"flex-1",children:t.itemMeta&&g.jsx(VN,{field:{...t.itemMeta,name:`${t.name}[${m}]`},value:p,onChange:y=>f(m,y)})}),g.jsx("button",{type:"button",onClick:()=>d(m),className:"text-slate-600 hover:text-red-400 transition-colors mt-2",children:g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},m)),g.jsxs("button",{type:"button",onClick:u,className:"text-xs text-indigo-400 hover:text-indigo-300 transition-colors flex items-center gap-1",children:[g.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),"Add item"]})]}),a&&g.jsx("p",{className:"text-xs text-red-400 mt-1",children:a})]})}function FN({schema:t,existingNode:e,defaultType:r,onSaved:a,onCancel:i}){var M;const{scopePath:s}=ba(),o=!!e,u=t.nodeSchemas??[],[d,f]=q.useState((e==null?void 0:e.aType)??r??((M=u[0])==null?void 0:M.aType)??""),[h,p]=q.useState((e==null?void 0:e.aUid)??""),[m,y]=q.useState((e==null?void 0:e.data)??{}),[x,E]=q.useState(null),w=xt.createNode.useMutation({onSuccess:j=>a(j.uid),onError:j=>E(j.message)}),T=xt.updateNode.useMutation({onSuccess:()=>a(e.aUid),onError:j=>E(j.message)}),C=w.isPending||T.isPending,N=q.useMemo(()=>u.find(j=>j.aType===d),[u,d]),A=j=>{f(j),o||y({})},D=()=>{E(null),o?T.mutate({uid:e.aUid,data:m,...Zt(s)}):w.mutate({aType:d,uid:h||void 0,data:m,...Zt(s)})};return g.jsxs("div",{className:"bg-slate-900 rounded-xl border border-slate-800 p-5",children:[g.jsx("h2",{className:"text-sm font-semibold mb-4",children:o?`Edit Node: ${e.aUid}`:"Create Node"}),!o&&g.jsxs("div",{className:"mb-4",children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:"Node Type"}),g.jsx("select",{value:d,onChange:j=>A(j.target.value),className:"w-full max-w-xs bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm text-slate-200 focus:outline-none focus:border-indigo-500 transition-colors",children:u.map(j=>g.jsxs("option",{value:j.aType,children:[j.aType,j.description?` — ${j.description}`:""]},j.aType))})]}),!o&&g.jsxs("div",{className:"mb-4",children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:"UID (optional, auto-generated if empty)"}),g.jsx("input",{type:"text",value:h,onChange:j=>p(j.target.value),placeholder:"Leave empty to auto-generate",className:"w-full max-w-sm bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm font-mono text-slate-200 placeholder:text-slate-600 focus:outline-none focus:border-indigo-500 transition-colors"})]}),N&&N.fields.length>0?g.jsxs("div",{className:"mb-5",children:[g.jsx("label",{className:"block text-xs text-slate-500 mb-2 uppercase tracking-wider font-semibold",children:"Data Fields"}),g.jsx(oc,{fields:N.fields,values:m,onChange:y})]}):g.jsxs("div",{className:"mb-5",children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:"Data (JSON)"}),g.jsx("textarea",{value:JSON.stringify(m,null,2),onChange:j=>{try{y(JSON.parse(j.target.value))}catch{}},rows:6,className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm font-mono text-slate-200 placeholder:text-slate-600 focus:outline-none focus:border-indigo-500 transition-colors"})]}),x&&g.jsx("div",{className:"bg-red-500/10 border border-red-500/30 rounded-lg p-3 mb-4 text-sm text-red-400",children:x}),g.jsxs("div",{className:"flex gap-3",children:[g.jsxs("button",{onClick:D,disabled:C||!d,className:"px-5 py-2 bg-indigo-600 text-white rounded-lg text-sm font-medium hover:bg-indigo-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:[C&&g.jsx("div",{className:"w-3.5 h-3.5 border-2 border-white border-t-transparent rounded-full animate-spin"}),o?"Save Changes":"Create Node"]}),g.jsx("button",{onClick:i,disabled:C,className:"px-4 py-2 text-sm text-slate-400 hover:text-slate-200 transition-colors disabled:opacity-50",children:"Cancel"})]})]})}const JP=[10,25,50,100],ez=[{value:"aUid",label:"UID"},{value:"createdAt",label:"Created"},{value:"updatedAt",label:"Updated"}],tz=["==","!=","<","<=",">",">="];function rz(t){if(t==="true")return!0;if(t==="false")return!1;const e=Number(t);return!isNaN(e)&&t!==""?e:t}function HN({type:t,schema:e,viewRegistry:r,config:a,onPick:i,compact:s=!1}){var oe,ae,re,le;const{scopePath:o,scopedPath:u}=ba(),d=s?10:25,[f,h]=q.useState(d),[p,m]=q.useState("aUid"),[y,x]=q.useState("asc"),[E,w]=q.useState([]),[T,C]=q.useState(!1),[N,A]=q.useState(1),[D,M]=q.useState([]),[j,k]=q.useState(void 0),B=E.filter(se=>se.field&&se.value!==""),P={type:t,limit:f,sortBy:p,sortDir:y,startAfter:j,...B.length>0?{where:B}:{},...Zt(o)},{data:U,isLoading:R,error:V,refetch:_}=xt.getNodes.useQuery(P,{placeholderData:se=>se}),H=(U==null?void 0:U.nodes)??[],z=(U==null?void 0:U.hasMore)??!1,I=(U==null?void 0:U.nextCursor)??null,F=(V==null?void 0:V.message)??null;q.useEffect(()=>{A(1),M([]),k(void 0)},[t,f,p,y,E,o]),q.useEffect(()=>{w([]),m("aUid"),x("asc"),C(!1)},[t]);const K=()=>{I&&(M(se=>[...se,I]),A(se=>se+1),k(I))},J=()=>{if(N<=1)return;const se=[...D];se.pop();const Ne=se.length>0?se[se.length-1]:void 0;M(se),A(Ae=>Ae-1),k(Ne)},L=()=>{A(1),M([]),k(void 0),_()},Q=(oe=e.nodeSchemas)==null?void 0:oe.find(se=>se.aType===t&&se.isNodeEntry),X=(Q==null?void 0:Q.fields)??[],W=X.map(se=>se.name),te=[...ez,...X.filter(se=>se.type==="string"||se.type==="number"||se.type==="boolean"||se.type==="enum").map(se=>({value:se.name,label:`data.${se.name}`}))],Y=((ae=r==null?void 0:r.nodes[t])==null?void 0:ae.views)??[],ne=(le=(re=a==null?void 0:a.viewDefaults)==null?void 0:re.nodes)==null?void 0:le[t],he=s?[10,25,50]:JP;return g.jsxs("div",{children:[g.jsxs("div",{className:`bg-slate-900 rounded-xl border border-slate-800 ${s?"p-2":"p-3"} mb-4 space-y-3`,children:[g.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("label",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold",children:"Show"}),g.jsx("select",{value:f,onChange:se=>h(Number(se.target.value)),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-xs text-slate-200 focus:outline-none focus:border-indigo-500",children:he.map(se=>g.jsx("option",{value:se,children:se},se))})]}),g.jsx("div",{className:"w-px h-5 bg-slate-700"}),g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("label",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold",children:"Sort"}),g.jsx("select",{value:p,onChange:se=>m(se.target.value),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-xs text-slate-200 focus:outline-none focus:border-indigo-500",children:te.map(se=>g.jsx("option",{value:se.value,children:se.label},se.value))}),g.jsx("button",{onClick:()=>x(se=>se==="asc"?"desc":"asc"),className:"px-2 py-1 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 hover:bg-slate-700 transition-colors",title:y==="asc"?"Ascending":"Descending",children:y==="asc"?"↑ Asc":"↓ Desc"})]}),g.jsx("div",{className:"w-px h-5 bg-slate-700"}),g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("button",{onClick:J,disabled:N<=1||R,className:"px-2 py-1 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 hover:bg-slate-700 transition-colors disabled:opacity-30 disabled:cursor-not-allowed",children:"Prev"}),g.jsxs("span",{className:"text-xs text-slate-400 px-1",children:["Page ",N]}),g.jsx("button",{onClick:K,disabled:!z||R,className:"px-2 py-1 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 hover:bg-slate-700 transition-colors disabled:opacity-30 disabled:cursor-not-allowed",children:"Next"})]}),g.jsx("div",{className:"w-px h-5 bg-slate-700"}),g.jsxs("button",{onClick:()=>C(!T),className:`px-2 py-1 rounded text-xs flex items-center gap-1.5 transition-colors ${T||E.length>0?"bg-indigo-600/20 text-indigo-400 border border-indigo-500/30":"bg-slate-800 border border-slate-700 text-slate-300 hover:bg-slate-700"}`,children:[g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z"})}),"Filters",E.length>0&&g.jsx("span",{className:"bg-indigo-500 text-white text-[10px] w-4 h-4 rounded-full inline-flex items-center justify-center font-bold",children:E.length})]}),g.jsx("button",{onClick:L,disabled:R,className:"ml-auto px-2 py-1 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 hover:bg-slate-700 transition-colors disabled:opacity-50",title:"Refresh",children:g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})})]}),E.length>0&&!T&&g.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[g.jsx("span",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold",children:"Active"}),E.map((se,Ne)=>g.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 bg-indigo-600/20 text-indigo-300 rounded text-xs",children:[g.jsx("span",{className:"text-slate-400",children:"data."}),se.field," ",se.op," ",g.jsx("span",{className:"text-indigo-200",children:String(se.value)}),g.jsx("button",{onClick:()=>w(Ae=>Ae.filter((Ze,Qe)=>Qe!==Ne)),className:"ml-0.5 text-indigo-400 hover:text-indigo-200",children:"×"})]},Ne)),g.jsx("button",{onClick:()=>w([]),className:"text-[10px] text-slate-500 hover:text-slate-300 transition-colors",children:"Clear all"})]}),T&&g.jsx(az,{filters:E,onFiltersChange:w,fieldMetas:X,fieldNames:W})]}),F&&g.jsx("div",{className:"bg-red-500/10 border border-red-500/30 rounded-lg p-3 mb-4 text-sm text-red-400",children:F}),R?g.jsxs("div",{className:`flex items-center gap-2 text-slate-400 ${s?"py-6":"py-12"} justify-center`,children:[g.jsx("div",{className:"w-4 h-4 border-2 border-indigo-500 border-t-transparent rounded-full animate-spin"}),g.jsx("span",{className:"text-sm",children:"Loading nodes..."})]}):H.length===0?g.jsx("div",{className:`text-center ${s?"py-6":"py-12"} text-slate-500`,children:g.jsxs("p",{children:["No nodes found",E.length>0?" matching filters":` of type "${t}"`]})}):g.jsxs(g.Fragment,{children:[g.jsx("div",{className:`bg-slate-900 rounded-xl border border-slate-800 overflow-x-auto ${s?"max-h-64 overflow-y-auto":""}`,children:g.jsxs("table",{className:"w-full min-w-[480px]",children:[g.jsx("thead",{children:g.jsxs("tr",{className:"border-b border-slate-800",children:[g.jsx("th",{className:"text-left text-[10px] uppercase tracking-wider text-slate-500 font-semibold px-4 py-3",children:"UID"}),g.jsx("th",{className:"text-left text-[10px] uppercase tracking-wider text-slate-500 font-semibold px-4 py-3",children:"Data"}),!s&&g.jsx("th",{className:"text-left text-[10px] uppercase tracking-wider text-slate-500 font-semibold px-4 py-3 w-44",children:"Created"})]})}),g.jsx("tbody",{children:H.map(se=>g.jsxs("tr",{className:`border-b border-slate-800/50 transition-colors ${i?"hover:bg-indigo-600/10 cursor-pointer":"hover:bg-slate-800/30"}`,onClick:i?()=>i(se.aUid):void 0,children:[g.jsx("td",{className:"px-4 py-3",children:i?g.jsx("span",{className:"text-sm font-mono text-indigo-400",children:se.aUid}):g.jsx(Qt,{to:u(`/node/${encodeURIComponent(se.aUid)}`),className:"text-sm font-mono text-indigo-400 hover:text-indigo-300 transition-colors",children:se.aUid})}),g.jsx("td",{className:"px-4 py-3",children:g.jsx(iz,{node:se,views:Y,resolverConfig:ne})}),!s&&g.jsx("td",{className:"px-4 py-3 text-xs text-slate-500",children:so(se.createdAt)})]},se.aUid))})]})}),!s&&g.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[g.jsxs("span",{className:"text-xs text-slate-500",children:[H.length," result",H.length!==1?"s":""," on this page"]}),g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("button",{onClick:J,disabled:N<=1||R,className:"px-3 py-1.5 bg-slate-800 text-slate-300 rounded-lg text-xs hover:bg-slate-700 transition-colors disabled:opacity-30 disabled:cursor-not-allowed",children:"Previous"}),g.jsxs("span",{className:"text-xs text-slate-400 px-2",children:["Page ",N]}),g.jsx("button",{onClick:K,disabled:!z||R,className:"px-3 py-1.5 bg-slate-800 text-slate-300 rounded-lg text-xs hover:bg-slate-700 transition-colors disabled:opacity-30 disabled:cursor-not-allowed",children:"Next"})]})]})]})]})}function az({filters:t,onFiltersChange:e,fieldMetas:r,fieldNames:a}){const i=()=>{var p;const d=a[0]??"",f=r.find(m=>m.name===d);let h="";(f==null?void 0:f.type)==="boolean"?h=!0:(f==null?void 0:f.type)==="enum"&&((p=f.enumValues)!=null&&p.length)&&(h=f.enumValues[0]),e([...t,{field:d,op:"==",value:h}])},s=d=>{e(t.filter((f,h)=>h!==d))},o=(d,f)=>{const h=[...t];h[d]={...h[d],...f},e(h)},u=d=>r.find(f=>f.name===d);return g.jsxs("div",{className:"border-t border-slate-700/50 pt-3 space-y-2",children:[g.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[g.jsx("span",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold",children:"Where"}),g.jsx("span",{className:"text-[10px] text-slate-600",children:t.length===0?'No filters — click "Add filter" to start':`${t.length} active filter${t.length>1?"s":""}`}),t.length>0&&g.jsx("button",{onClick:()=>e([]),className:"text-[10px] text-red-400/60 hover:text-red-400 transition-colors ml-auto",children:"Clear all"})]}),t.map((d,f)=>g.jsx(nz,{index:f,clause:d,fieldNames:a,fieldMeta:u(d.field),allFieldMetas:r,totalFilters:t.length,onUpdate:h=>o(f,h),onRemove:()=>s(f)},f)),g.jsxs("button",{onClick:i,className:"flex items-center gap-1.5 text-[11px] text-indigo-400 hover:text-indigo-300 transition-colors py-1",children:[g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),"Add filter"]})]})}function nz({index:t,clause:e,fieldNames:r,fieldMeta:a,allFieldMetas:i,totalFilters:s,onUpdate:o,onRemove:u}){var w;const[d,f]=q.useState(String(e.value)),h=q.useRef(null);q.useEffect(()=>{f(String(e.value))},[e.value]);const p=()=>{const T=rz(d.trim());T!==e.value&&o({value:T})},m=T=>{var A;const C=i.find(D=>D.name===T);let N="";(C==null?void 0:C.type)==="boolean"?N=!0:(C==null?void 0:C.type)==="enum"&&((A=C.enumValues)!=null&&A.length)&&(N=C.enumValues[0]),o({field:T,value:N}),f(String(N))},y=(a==null?void 0:a.type)==="enum"&&((w=a.enumValues)==null?void 0:w.length),x=(a==null?void 0:a.type)==="boolean",E=y||x;return g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("span",{className:"text-[10px] text-slate-600 w-8 shrink-0 text-right",children:t===0?"":"AND"}),r.length>0?g.jsx("select",{value:e.field,onChange:T=>m(T.target.value),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-[11px] text-slate-200 focus:outline-none focus:border-indigo-500",children:r.map(T=>g.jsx("option",{value:T,children:T},T))}):g.jsx("input",{type:"text",value:e.field,onChange:T=>o({field:T.target.value}),onBlur:p,placeholder:"field",className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-[11px] text-slate-200 placeholder:text-slate-600 focus:outline-none focus:border-indigo-500 w-28"}),g.jsx("select",{value:e.op,onChange:T=>o({op:T.target.value}),className:"bg-slate-800 border border-slate-700 rounded px-1.5 py-1 text-[11px] text-slate-200 focus:outline-none focus:border-indigo-500 w-14",children:tz.map(T=>g.jsx("option",{value:T,children:T},T))}),y?g.jsx("select",{value:String(e.value),onChange:T=>o({value:T.target.value}),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-[11px] text-slate-200 focus:outline-none focus:border-indigo-500",children:a.enumValues.map(T=>g.jsx("option",{value:T,children:T},T))}):x?g.jsxs("select",{value:String(e.value),onChange:T=>o({value:T.target.value==="true"}),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-[11px] text-slate-200 focus:outline-none focus:border-indigo-500",children:[g.jsx("option",{value:"true",children:"true"}),g.jsx("option",{value:"false",children:"false"})]}):g.jsx("input",{ref:h,type:"text",value:d,onChange:T=>f(T.target.value),onBlur:p,onKeyDown:T=>{var C;T.key==="Enter"&&(p(),(C=h.current)==null||C.blur())},placeholder:"value (Enter to apply)",className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-[11px] text-slate-200 placeholder:text-slate-600 focus:outline-none focus:border-indigo-500 w-36"}),a&&g.jsx("span",{className:"text-[9px] text-slate-600 shrink-0",children:a.type}),!E&&d!==String(e.value)&&d.trim()!==""&&g.jsx("span",{className:"text-[9px] text-amber-500 shrink-0",title:"Press Enter to apply",children:"pending"}),g.jsx("button",{onClick:u,className:"text-slate-600 hover:text-red-400 transition-colors p-0.5 shrink-0",title:"Remove filter",children:g.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})}function iz({node:t,views:e,resolverConfig:r}){const[a,i]=q.useState(!1);if(!a&&e.length>0){const s=nn(r,e,"listing");if(s!=="json"){const o=e.find(u=>u.viewName===s);if(o)return g.jsx("div",{children:g.jsx(Jn,{tagName:o.tagName,data:t.data,onError:()=>i(!0)})})}}return g.jsx("span",{className:"text-xs text-slate-400 font-mono",children:PT(t.data,100)})}function mE({schema:t,viewRegistry:e,config:r,defaultUid:a,defaultType:i,direction:s="out",onSaved:o,onCancel:u}){var Ne,Ae,Ze,Qe;const{scopePath:d}=ba(),f=t.edgeSchemas??[],h=t.nodeSchemas??[],p=q.useMemo(()=>i?s==="out"?f.filter(Se=>Se.aType===i):f.filter(Se=>Se.bType===i):f,[f,i,s]),[m,y]=q.useState(()=>{const Se=p[0];return Se?`${Se.aType}:${Se.axbType}:${Se.bType}`:""}),[x,E]=q.useState(""),[w,T]=q.useState("create"),[C,N]=q.useState({}),[A,D]=q.useState({}),[M,j]=q.useState(""),[k,B]=q.useState(null),[P,U]=q.useState(""),R=q.useMemo(()=>f.find(Se=>`${Se.aType}:${Se.axbType}:${Se.bType}`===m),[f,m]),V=s==="out"?R==null?void 0:R.bType:R==null?void 0:R.aType,_=q.useMemo(()=>h.find(Se=>Se.aType===V&&Se.isNodeEntry),[h,V]),H=xt.checkNode.useQuery({uid:P,...Zt(d)},{enabled:!!P&&(w==="existing"||w==="manual")}),z=a&&P?s==="out"?a:P:"",I=a&&P?s==="out"?P:a:"",F=(R==null?void 0:R.axbType)??"",K=xt.checkEdge.useQuery({aUid:z,axbType:F,bUid:I,...Zt(d)},{enabled:!!z&&!!I&&!!F&&(w==="existing"||w==="manual")}),J=Se=>{E(Se),U(Se)},L=q.useRef(null),Q=()=>{const Se=x.trim();Se&&Se!==P&&U(Se)};q.useEffect(()=>{U("")},[w,m]);const X=xt.createEdge.useMutation({onSuccess:()=>o(),onError:Se=>B(Se.message)}),W=xt.createEdgeWithNode.useMutation({onSuccess:()=>o(),onError:Se=>B(Se.message)}),te=X.isPending||W.isPending,Y=Se=>{y(Se),N({}),D({}),E(""),j(""),U("")},ne=()=>{if(!R||!a)return;B(null);const Se=R.aType,Oe=R.axbType,ke=R.bType,Pe=s==="out"?"b":"a";if(w==="create")W.mutate({aType:Se,axbType:Oe,bType:ke,newNodeSide:Pe,existingUid:a,newNodeUid:M||void 0,edgeData:C,nodeData:A,...Zt(d)});else{if(!x)return;X.mutate({aType:Se,aUid:s==="out"?a:x,axbType:Oe,bType:ke,bUid:s==="out"?x:a,data:C,...Zt(d)})}},he=P&&((Ne=H.data)==null?void 0:Ne.exists)===!0,oe=P&&((Ae=H.data)==null?void 0:Ae.exists)===!1,ae=P&&H.isLoading,re=P&&((Ze=K.data)==null?void 0:Ze.exists)===!0,le=!R||te?!1:w==="create"?!0:!(!x||oe),se=V??"target";return g.jsxs("div",{className:"bg-slate-900 rounded-xl border border-slate-800 p-5",children:[g.jsxs("h2",{className:"text-sm font-semibold mb-4",children:["Create ",s==="out"?"Outgoing":"Incoming"," Edge"]}),p.length>1&&g.jsxs("div",{className:"mb-4",children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:"Edge Type"}),g.jsx("select",{value:m,onChange:Se=>Y(Se.target.value),className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm text-slate-200 focus:outline-none focus:border-indigo-500 transition-colors",children:p.map(Se=>{const Oe=`${Se.aType}:${Se.axbType}:${Se.bType}`;return g.jsxs("option",{value:Oe,children:[Se.aType," —[",Se.axbType,"]→ ",Se.bType,Se.description?` — ${Se.description}`:""]},Oe)})})]}),R&&g.jsxs("div",{className:"mb-4 flex items-center gap-2 text-xs font-mono text-slate-400",children:[g.jsx("span",{className:`px-1.5 py-0.5 rounded ${nr(R.aType)}`,children:R.aType}),g.jsxs("span",{className:"text-slate-600",children:["—[",R.axbType,"]→"]}),g.jsx("span",{className:`px-1.5 py-0.5 rounded ${nr(R.bType)}`,children:R.bType})]}),g.jsxs("div",{className:"mb-4",children:[g.jsxs("label",{className:"block text-xs text-slate-400 mb-3",children:[s==="out"?"Target":"Source"," Node (",se,")"]}),g.jsx("div",{className:"flex gap-4 border-b border-slate-700/50 mb-3 pt-1",children:["create","existing","manual"].map(Se=>g.jsxs("button",{onClick:()=>T(Se),className:`pb-2 text-xs transition-colors relative ${w===Se?"text-slate-200":"text-slate-500 hover:text-slate-300"}`,children:[Se==="create"?"Create new":Se==="existing"?"Select existing":"Enter UID",w===Se&&g.jsx("span",{className:"absolute bottom-0 left-0 right-0 h-px bg-indigo-500"})]},Se))}),w==="create"&&V&&g.jsxs("div",{children:[g.jsxs("div",{className:"mb-3",children:[g.jsx("label",{className:"block text-[11px] text-slate-500 mb-1",children:"UID (optional, auto-generated if empty)"}),g.jsx("input",{type:"text",value:M,onChange:Se=>j(Se.target.value),placeholder:"Leave empty to auto-generate",className:"w-full max-w-sm bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm font-mono text-slate-200 placeholder:text-slate-600 focus:outline-none focus:border-indigo-500 transition-colors"}),M&&g.jsx("p",{className:"mt-1.5 text-xs text-amber-400",children:"Custom UIDs can cause Firestore hotspots. Recommended to leave empty for auto-generated IDs."})]}),_&&_.fields.length>0?g.jsxs("div",{children:[g.jsxs("label",{className:"block text-[11px] text-slate-500 mb-2 uppercase tracking-wider font-semibold",children:[V," Data"]}),g.jsx(oc,{fields:_.fields,values:A,onChange:D})]}):g.jsxs("div",{children:[g.jsx("label",{className:"block text-[11px] text-slate-500 mb-1",children:"Data (JSON)"}),g.jsx("textarea",{value:JSON.stringify(A,null,2),onChange:Se=>{try{D(JSON.parse(Se.target.value))}catch{}},rows:4,className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm font-mono text-slate-200 placeholder:text-slate-600 focus:outline-none focus:border-indigo-500 transition-colors"})]})]}),w==="existing"&&V&&g.jsxs("div",{children:[x&&g.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[g.jsx("span",{className:"text-[11px] text-slate-500",children:"Selected:"}),g.jsx("span",{className:"font-mono text-sm text-indigo-400",children:x}),g.jsx(yE,{checking:!!ae,valid:!!he,invalid:!!oe}),g.jsx("button",{onClick:()=>{E(""),U("")},className:"text-[11px] text-slate-500 hover:text-slate-300 transition-colors",children:"clear"})]}),x&&re&&g.jsx(xE,{}),!x&&g.jsx(HN,{type:V,schema:t,viewRegistry:e,config:r,onPick:J,compact:!0})]}),w==="manual"&&g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("input",{ref:L,type:"text",value:x,onChange:Se=>E(Se.target.value),onBlur:Q,onKeyDown:Se=>{var Oe;Se.key==="Enter"&&(Q(),(Oe=L.current)==null||Oe.blur())},placeholder:`e.g., ${se}1 (Enter to validate)`,className:"flex-1 max-w-sm bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm font-mono text-slate-200 placeholder:text-slate-600 focus:outline-none focus:border-indigo-500 transition-colors"}),g.jsx(yE,{checking:!!ae,valid:!!he,invalid:!!oe})]}),oe&&g.jsxs("p",{className:"mt-1.5 text-xs text-red-400",children:['No node found with UID "',P,'"']}),he&&((Qe=H.data)==null?void 0:Qe.node)&&H.data.node.aType!==V&&g.jsxs("p",{className:"mt-1.5 text-xs text-amber-400",children:['Node exists but is type "',H.data.node.aType,'" (expected "',V,'")']}),re&&g.jsx(xE,{})]})]}),R&&R.fields.length>0&&g.jsxs("div",{className:"mb-5",children:[g.jsx("label",{className:"block text-xs text-slate-500 mb-2 uppercase tracking-wider font-semibold",children:"Edge Data"}),g.jsx(oc,{fields:R.fields,values:C,onChange:N})]}),k&&g.jsx("div",{className:"bg-red-500/10 border border-red-500/30 rounded-lg p-3 mb-4 text-sm text-red-400",children:k}),g.jsxs("div",{className:"flex gap-3",children:[g.jsxs("button",{onClick:ne,disabled:!le,className:"px-5 py-2 bg-indigo-600 text-white rounded-lg text-sm font-medium hover:bg-indigo-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:[te&&g.jsx("div",{className:"w-3.5 h-3.5 border-2 border-white border-t-transparent rounded-full animate-spin"}),w==="create"?`Create ${se} + Edge`:re?"Update Edge":"Create Edge"]}),g.jsx("button",{onClick:u,disabled:te,className:"px-4 py-2 text-sm text-slate-400 hover:text-slate-200 transition-colors disabled:opacity-50",children:"Cancel"})]})]})}function yE({checking:t,valid:e,invalid:r}){return t?g.jsx("div",{className:"w-3.5 h-3.5 border-2 border-slate-500 border-t-transparent rounded-full animate-spin shrink-0"}):e?g.jsx("svg",{className:"w-4 h-4 text-emerald-400 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}):r?g.jsx("svg",{className:"w-4 h-4 text-red-400 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}):null}function xE(){return g.jsxs("div",{className:"flex items-center gap-1.5 mt-1.5 mb-2 text-xs text-amber-400",children:[g.jsx("svg",{className:"w-3.5 h-3.5 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Edge already exists — submitting will update it"]})}function bE({title:t,message:e,confirmLabel:r="Delete",onConfirm:a,onCancel:i,loading:s,requireConfirmText:o}){const[u,d]=q.useState(""),f=!o||u===o;return $u.createPortal(g.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50",onClick:i,children:g.jsxs("div",{className:"bg-slate-900 border border-slate-700 rounded-xl p-6 max-w-sm w-full mx-4 shadow-2xl",onClick:h=>h.stopPropagation(),children:[g.jsx("h3",{className:"text-lg font-semibold mb-2",children:t}),g.jsx("p",{className:"text-sm text-slate-400 mb-4",children:e}),o&&g.jsxs("div",{className:"mb-4",children:[g.jsxs("p",{className:"text-xs text-slate-500 mb-2",children:["Type ",g.jsx("span",{className:"font-mono text-slate-300",children:o})," to confirm:"]}),g.jsx("input",{type:"text",value:u,onChange:h=>d(h.target.value),className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm text-slate-200 font-mono focus:outline-none focus:border-red-500/50 placeholder:text-slate-600",placeholder:o,autoFocus:!0,onKeyDown:h=>{h.key==="Enter"&&f&&!s&&a()}})]}),g.jsxs("div",{className:"flex justify-end gap-3",children:[g.jsx("button",{onClick:i,disabled:s,className:"px-4 py-2 text-sm text-slate-400 hover:text-slate-200 transition-colors disabled:opacity-50",children:"Cancel"}),g.jsxs("button",{onClick:a,disabled:s||!f,className:"px-4 py-2 bg-red-600 text-white rounded-lg text-sm font-medium hover:bg-red-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:[s&&g.jsx("div",{className:"w-3.5 h-3.5 border-2 border-white border-t-transparent rounded-full animate-spin"}),r]})]})]})}),document.body)}function sz(t){if(t.length===0||t[0].frames.length===0)return null;function e(r,a){const i=new Map;for(const s of r){if(a>=s.frames.length)continue;const o=s.frames[a].uid;i.has(o)||i.set(o,[]),i.get(o).push(s)}return Array.from(i.values()).map(s=>({frame:s[0].frames[a],depth:a,laneIds:s.map(o=>o.id),children:e(s,a+1)}))}return{frame:t[0].frames[0],depth:0,laneIds:t.map(r=>r.id),children:e(t,1)}}function lz({peek:t,onPeek:e,schema:r}){const a=on(),{lanes:i,activeLaneId:s,activeIndex:o,previewLaneId:u,popTo:d,closeLane:f,switchLane:h}=ah(),{scopedPath:p}=ba(),m=q.useMemo(()=>{const j={};for(const k of r.edgeTypes)k.inverseLabel&&(j[k.axbType]=k.inverseLabel);return j},[r.edgeTypes]),y=q.useMemo(()=>u?i.map(j=>j.id===u?{...j,frames:j.frames.slice(0,-1)}:j):i,[i,u]),x=q.useMemo(()=>sz(y),[y]);if(!(y.length>1||y.length===1&&y[0].frames.length>1)||!x)return null;const w=y.length>1,T=(t==null?void 0:t.laneId)??s,C=(t==null?void 0:t.frameIndex)??o;function N(j){return j.laneIds.includes(s)?s:j.laneIds[0]}function A(j){return g.jsx("span",{className:"text-slate-600 font-mono mx-0.5 shrink-0",children:j.direction==="out"?g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"text-indigo-500/60",children:j.edgeType}),g.jsx("span",{className:"ml-0.5",children:"→"})]}):m[j.edgeType]?g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"text-amber-500/60 cursor-help",title:`Inverse of: ${j.edgeType}`,children:m[j.edgeType]}),g.jsx("span",{className:"ml-0.5",children:"→"})]}):g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"mr-0.5",children:"←"}),g.jsx("span",{className:"text-indigo-500/60",children:j.edgeType})]})})}function D(j){const k=N(j),B=j.laneIds.includes(s)&&j.depth===o,P=j.laneIds.includes(T)&&j.depth===C;return g.jsxs("button",{onClick:()=>{B?a(p(`/node/${encodeURIComponent(j.frame.uid)}`)):(h(k),d(k,j.depth))},onMouseEnter:()=>e(k,j.depth),className:`flex items-center gap-1 px-1.5 py-0.5 rounded transition-colors shrink-0 ${P?"bg-slate-800 text-slate-200":"text-slate-400 hover:text-slate-200 hover:bg-slate-800/60"}`,children:[j.frame.nodeType&&g.jsx("span",{className:`px-1 py-px rounded text-[9px] font-mono ${nr(j.frame.nodeType)}`,children:j.frame.nodeType}),g.jsx("span",{className:"font-mono truncate max-w-[120px]",children:j.frame.uid})]})}function M(j,k){const B=[j];let P=j;for(;P.children.length===1;)P=P.children[0],B.push(P);return g.jsxs(g.Fragment,{children:[B.map((U,R)=>g.jsxs(q.Fragment,{children:[(R>0||!k)&&A(U.frame),D(U)]},U.depth)),P.children.length>1&&g.jsx("div",{className:"flex flex-col border-l border-slate-700/50 ml-1.5 my-0.5",children:P.children.map((U,R)=>{const V=U.laneIds.includes(s);return g.jsxs("div",{className:`flex items-center transition-opacity ${!V&&w?"opacity-50 hover:opacity-80":""}`,children:[g.jsx("span",{className:"w-2 h-px bg-slate-700/50 shrink-0"}),M(U,!1)]},R)})}),P.children.length===0&&w&&g.jsx("button",{onClick:U=>{U.stopPropagation(),f(P.laneIds[0])},className:"ml-1 text-slate-600 hover:text-slate-400 transition-colors shrink-0 text-sm leading-none",title:"Close this lane",children:"×"})]})}return g.jsx("nav",{className:"flex items-center px-4 py-2 bg-slate-900/80 border-b border-slate-800 overflow-x-auto overflow-y-auto max-h-32 text-xs",children:M(x,!0)})}function wE(t,e){const r=Math.min(t.length,e.length);for(let a=0;a<r;a++)if(t[a].uid!==e[a].uid)return a;return r}function oz({schema:t,viewRegistry:e,config:r,onDataChanged:a}){var te;const{lanes:i,activeLaneId:s,activeLane:o,activeIndex:u,previewLaneId:d,previewFrame:f,clearPreview:h,extendLane:p,extendPath:m,forkAndDrill:y,createLane:x,switchLane:E,popTo:w}=ah(),T=Ro(),[C,N]=q.useState(null),A=q.useRef(null),D=q.useRef(new Set),[,M]=q.useState(0),j=q.useRef(new Map);q.useEffect(()=>{N(null)},[s]);const k=q.useRef(i);k.current=i;const B=q.useRef(s);B.current=s;const P=q.useRef(f);P.current=f;const U=q.useRef(h);U.current=h,q.useEffect(()=>{if(T)return T.registerCallbacks({peek:Y=>{for(const ne of k.current){const he=ne.frames.findIndex(oe=>oe.uid===Y.uid);if(he>=0){U.current(),N({laneId:ne.id,frameIndex:he});return}}N(null),P.current(Y)},clearPeek:()=>{N(null),U.current()}}),()=>{T.registerCallbacks(null)}},[T]);const R=(C==null?void 0:C.laneId)??s,V=(C==null?void 0:C.frameIndex)??u,_=q.useMemo(()=>i.find(Y=>Y.id===R)??i[0],[i,R]),H=(te=_==null?void 0:_.frames[V])==null?void 0:te.uid,z=q.useMemo(()=>{const Y=new Set,ne=[];for(const he of i)for(const oe of he.frames)Y.has(oe.uid)||(Y.add(oe.uid),ne.push(oe.uid));return ne},[i]);q.useEffect(()=>{if(!H)return;const Y=j.current.get(H);Y&&(Y.scrollTop=0)},[H]),q.useEffect(()=>{const Y=ne=>{ne.key==="Escape"&&(C?N(null):u>0&&w(s,u-1))};return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[C,u,s,w]);const I=q.useMemo(()=>{var ne;if(!d)return;const Y=i.find(he=>he.id===d);return(ne=Y==null?void 0:Y.frames[Y.frames.length-1])==null?void 0:ne.uid},[d,i]);q.useEffect(()=>{const Y=new Set(z);for(const ne of Y)if(!D.current.has(ne)){ne!==I&&(A.current=ne,requestAnimationFrame(()=>{requestAnimationFrame(()=>{A.current=null,M(he=>he+1)})}));break}D.current=Y},[z,I]);const F=q.useCallback(Y=>{var he;if(A.current===Y)return"drill-frame drill-frame--entering";if(Y===H)return"drill-frame drill-frame--active";if(I&&Y===I)return"drill-frame drill-frame--behind";const ne=(he=_==null?void 0:_.frames[V+1])==null?void 0:he.uid;return Y===ne?"drill-frame drill-frame--behind":"drill-frame drill-frame--hidden"},[H,I,_,V]),K=q.useMemo(()=>{const Y=new Map;for(const ne of i)for(let he=0;he<ne.frames.length;he++){const oe=ne.frames[he].uid;Y.has(oe)||Y.set(oe,{laneId:ne.id,index:he,isDrilled:he>0})}if(_)for(let ne=0;ne<_.frames.length;ne++){const he=_.frames[ne].uid;Y.set(he,{laneId:_.id,index:ne,isDrilled:ne>0})}return Y},[i,_]),J=q.useCallback(Y=>{if(!_)return;const ne=_.frames.findIndex(he=>he.uid===Y.uid);if(ne>=0){N({laneId:_.id,frameIndex:ne});return}V<_.frames.length-1?y(R,V,Y):(R!==s&&E(R),p(R,Y)),N(null)},[_,R,V,s,p,y,E]),L=q.useCallback(Y=>{if(Y.length===0||!_)return;const ne=[..._.frames.slice(0,V+1),...Y];for(const ae of i)if(wE(ae.frames,ne)>=ne.length){E(ae.id),ae.frames.length>ne.length&&w(ae.id,ne.length-1),N(null);return}let he=null,oe=0;for(const ae of i){const re=wE(ae.frames,ne);re===ae.frames.length&&re>oe&&(he=ae,oe=re)}if(he){const ae=ne.slice(oe);m(he.id,ae)}else x(ne);N(null)},[_,R,V,i,s,m,x,E,w]),Q=q.useCallback((Y,ne)=>{w(Y,ne),N(null)},[w]),X=q.useMemo(()=>({drillIn:J,drillPath:L,popTo:Q}),[J,L,Q]),W=q.useCallback((Y,ne)=>{N({laneId:Y,frameIndex:ne})},[]);return g.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[g.jsx(lz,{peek:C,onPeek:W,schema:t}),g.jsx(Um.Provider,{value:X,children:g.jsx("div",{className:"drill-perspective flex-1",children:z.map(Y=>{const ne=K.get(Y);return g.jsx("div",{ref:he=>{he?j.current.set(Y,he):j.current.delete(Y)},className:F(Y),children:g.jsx(dz,{uid:Y,schema:t,viewRegistry:e,config:r,onDataChanged:a,isDrilled:ne.isDrilled,drillIndex:ne.index,laneId:ne.laneId})},Y)})})})]})}function GN({nodeType:t,data:e,viewRegistry:r,config:a}){var f;const i=((f=r==null?void 0:r.nodes[t])==null?void 0:f.views)??[],[s,o]=q.useState("json"),[u,d]=q.useState(!1);return q.useEffect(()=>{var p,m;if(u)return;const h=(m=(p=a.viewDefaults)==null?void 0:p.nodes)==null?void 0:m[t];if(h&&i.length>0){const y=nn(h,i,"detail");if(y!=="json"){const x=i.find(E=>E.viewName===y);x&&o(x.tagName)}}d(!0)},[u,i,a,t]),g.jsxs("section",{className:"bg-slate-900 rounded-xl border border-slate-800 p-5",children:[g.jsxs("div",{className:"flex items-center justify-between mb-3",children:[g.jsx("h2",{className:"text-sm font-semibold",children:"Data"}),g.jsx(Ao,{views:i,activeView:s,onSwitch:o})]}),s==="json"?g.jsx("div",{className:"font-mono text-xs leading-relaxed bg-slate-950 rounded-lg p-4 overflow-auto max-h-96",children:g.jsx(Oa,{data:e,defaultExpanded:!0})}):g.jsx(Jn,{tagName:s,data:e,onError:()=>o("json")})]})}const uz=[10,25,50,100];function io(t,e){return e?`${e} (${t})`:t}function cz({schema:t,viewRegistry:e,config:r,onDataChanged:a,uidParam:i}){var f;const{uid:s}=Sm(),o=il(),u=i??s;if(!u)return null;const d=(f=o.state)==null?void 0:f.initialPaths;return g.jsx(iD,{rootUid:u,initialPaths:d,children:g.jsx(oz,{schema:t,viewRegistry:e,config:r,onDataChanged:a})})}function dz({uid:t,schema:e,viewRegistry:r,config:a,onDataChanged:i,isDrilled:s=!1,drillIndex:o=0,laneId:u}){var $e,et;const d=on(),{drillIn:f,popTo:h,setRootType:p}=ah(),{scopePath:m,scopeUrlPrefix:y,scopedPath:x,enterSubgraph:E}=ba(),w=Ro(),T=xt.useUtils(),[C,N]=q.useState(!1),[A,D]=q.useState(!1),[M,j]=q.useState(null),[k,B]=q.useState(""),[P,U]=q.useState(!1),[R,V]=q.useState(!1),[_,H]=q.useState(null),[z,I]=q.useState(null),[F,K]=q.useState(null),J=!e.readonly,{addRecent:L}=rh(),{data:Q,isLoading:X,error:W,refetch:te}=xt.getNodeDetail.useQuery({uid:t,...Zt(m)},{enabled:!!t}),Y=(Q==null?void 0:Q.node)??null,ne=((($e=Q==null?void 0:Q.outEdges)==null?void 0:$e.length)??0)+(((et=Q==null?void 0:Q.inEdges)==null?void 0:et.length)??0),he=(W==null?void 0:W.message)??F??null,[oe,ae]=q.useState(0),re=()=>ae(xe=>xe+1),le=()=>{T.getNodeDetail.invalidate({uid:t,...Zt(m)}),T.getEdges.invalidate()};q.useEffect(()=>{N(!1),U(!1),V(!1),K(null)},[t]),q.useEffect(()=>{Y&&o===0&&p(Y.aType)},[Y,o,p]),q.useEffect(()=>{Y&&o===0&&L({type:"node",label:Y.aUid,sublabel:Y.aType,url:x(`/node/${encodeURIComponent(Y.aUid)}`)})},[Y==null?void 0:Y.aUid]),q.useEffect(()=>{if(!(!w||!Y||o!==0))return w.setFocused({uid:Y.aUid,nodeType:Y.aType}),()=>{w.setFocused(null)}},[Y==null?void 0:Y.aUid,Y==null?void 0:Y.aType,o,w]);const se=xt.deleteNode.useMutation({onSuccess:()=>{le(),i==null||i(),s&&u?h(u,o-1):d(y)},onError:xe=>K(xe.message),onSettled:()=>{j(null),B("")}}),Ne=xt.deleteNodeCascade.useMutation({onSuccess:xe=>{le(),K(xe.errors.length>0?`Cascade partially failed: ${xe.errors.map(ze=>ze.message).join(", ")}`:null),i==null||i(),xe.success&&(s&&u?h(u,o-1):d(y))},onError:xe=>K(xe.message),onSettled:()=>{j(null),B("")}}),Ae=xt.deleteEdge.useMutation({onSuccess:()=>{H(null),le(),re(),i==null||i()},onError:xe=>K(xe.message)}),Ze=xt.bulkDeleteEdges.useMutation({onSuccess:xe=>{I(null),le(),re(),i==null||i(),xe.errors.length>0&&K(`Bulk delete partially failed: deleted ${xe.deleted}, ${xe.errors.length} batch(es) failed`)},onError:xe=>{K(xe.message),I(null)}}),Qe=xt.deleteEdgesBatch.useMutation({onSuccess:()=>{I(null),le(),re(),i==null||i()},onError:xe=>{K(xe.message),I(null)}}),Se=()=>{t&&se.mutate({uid:t,...Zt(m)})},Oe=()=>{t&&Ne.mutate({uid:t,...Zt(m)})},ke=()=>{_&&Ae.mutate({aUid:_.aUid,axbType:_.axbType,bUid:_.bUid,...Zt(m)})},Pe=()=>{if(!z)return;const xe=z;if(xe.mode==="visible")Qe.mutate({edges:xe.edges,...Zt(m)});else if(xe.mode==="filtered"){const ze={axbType:xe.axbType,...xe.direction==="out"?{aUid:xe.uid}:{bUid:xe.uid},...Zt(m)};xe.where.length>0&&(ze.where=xe.where),Ze.mutate(ze)}else Ze.mutate(xe.direction==="out"?{aUid:xe.uid,axbType:xe.axbType,...Zt(m)}:{bUid:xe.uid,axbType:xe.axbType,...Zt(m)})},Ge=q.useMemo(()=>{if(!Y)return[];const xe=[],ze=new Set;for(const Re of e.edgeTypes)Re.aType===Y.aType&&Re.targetGraph&&!ze.has(Re.targetGraph)&&(ze.add(Re.targetGraph),xe.push({name:Re.targetGraph,edgeType:Re.axbType,targetType:Re.bType}));return xe},[e.edgeTypes,Y]),Je=q.useMemo(()=>(e.collections??[]).filter(xe=>xe.parentNodeType===(Y==null?void 0:Y.aType)),[e.collections,Y==null?void 0:Y.aType]);if(X)return g.jsx("div",{className:"flex items-center justify-center py-20",children:g.jsx("div",{className:"w-5 h-5 border-2 border-indigo-500 border-t-transparent rounded-full animate-spin"})});if(he)return g.jsx("div",{className:"p-6",children:g.jsx("div",{className:"bg-red-500/10 border border-red-500/30 rounded-lg p-4 text-sm text-red-400",children:he})});if(!Y)return g.jsx("div",{className:"p-6",children:g.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-8 text-center",children:[g.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Node Not Found"}),g.jsxs("p",{className:"text-sm text-slate-400",children:["No node with UID ",g.jsx("code",{className:"text-indigo-400 font-mono",children:t})," was found."]})]})});if(C)return g.jsx("div",{className:"p-6 max-w-6xl mx-auto",children:g.jsx(FN,{schema:e,existingNode:Y,onSaved:()=>{N(!1),te(),i==null||i()},onCancel:()=>N(!1)})});const Be=e.edgeTypes.filter(xe=>xe.aType===Y.aType).map(xe=>xe.axbType),nt=e.edgeTypes.filter(xe=>xe.bType===Y.aType).map(xe=>xe.axbType),ye={};for(const xe of e.edgeTypes)xe.inverseLabel&&(ye[xe.axbType]=xe.inverseLabel);return g.jsxs("div",{className:"p-6 max-w-6xl mx-auto",children:[g.jsxs("div",{className:"mb-6",children:[g.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[g.jsx(Qt,{to:x(`/browse/${encodeURIComponent(Y.aType)}`),className:`px-2 py-0.5 rounded text-xs font-mono hover:opacity-80 transition-opacity ${nr(Y.aType)}`,children:Y.aType}),g.jsx("h1",{className:"text-xl font-bold font-mono",children:Y.aUid}),g.jsxs("div",{className:"ml-auto flex gap-2",children:[g.jsx("button",{onClick:()=>D(!0),className:"px-3 py-1.5 bg-slate-800 text-slate-300 rounded-lg text-xs hover:bg-slate-700 transition-colors",children:"Graph"}),J&&g.jsxs(g.Fragment,{children:[g.jsx("button",{onClick:()=>N(!0),className:"px-3 py-1.5 bg-slate-800 text-slate-300 rounded-lg text-xs hover:bg-slate-700 transition-colors",children:"Edit"}),g.jsx("button",{onClick:()=>j("choose"),className:"px-3 py-1.5 bg-red-600/20 text-red-400 rounded-lg text-xs hover:bg-red-600/30 transition-colors",children:"Delete"})]})]})]}),g.jsxs("div",{className:"flex gap-4 text-xs text-slate-500 mt-2",children:[g.jsxs("span",{children:["Created: ",so(Y.createdAt)]}),g.jsxs("span",{children:["Updated: ",so(Y.updatedAt)]})]}),(Ge.length>0||Je.length>0)&&g.jsxs("div",{className:"flex flex-wrap gap-2 mt-3",children:[Ge.map(xe=>g.jsxs("button",{onClick:()=>E(Y.aUid,xe.name),className:"flex items-center gap-1.5 px-3 py-1.5 bg-indigo-950/50 border border-indigo-500/30 rounded-lg text-xs text-indigo-300 hover:bg-indigo-900/50 hover:border-indigo-400/50 transition-colors",children:[g.jsx("svg",{className:"w-3 h-3 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4"})}),xe.name]},xe.name)),Je.map(xe=>{const ze={};xe.pathParams.length>0&&(ze[xe.pathParams[0]]=Y.aUid);const Re=an(xe.path,ze);return g.jsxs(Qt,{to:aa(Re),className:"flex items-center gap-1.5 px-3 py-1.5 bg-amber-950/30 border border-amber-500/20 rounded-lg text-xs text-amber-300 hover:bg-amber-900/40 hover:border-amber-400/40 transition-colors",children:[g.jsx("svg",{className:"w-3 h-3 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),xe.name]},xe.name)})]})]}),g.jsx("div",{className:"mb-6",children:g.jsx(GN,{nodeType:Y.aType,data:Y.data,viewRegistry:r,config:a},t)}),g.jsxs("section",{className:"bg-slate-900 rounded-xl border border-slate-800 p-5 mb-6",children:[g.jsxs("div",{className:"flex items-center justify-between mb-3",children:[g.jsx("h2",{className:"text-sm font-semibold",children:"Outgoing Edges"}),J&&!P&&g.jsxs("button",{onClick:()=>U(!0),className:"px-3 py-1 bg-indigo-600/20 text-indigo-400 rounded-lg text-xs hover:bg-indigo-600/30 transition-colors flex items-center gap-1",children:[g.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),"Add Edge"]})]}),P&&g.jsx("div",{className:"mb-4",children:g.jsx(mE,{schema:e,viewRegistry:r,config:a,defaultUid:Y.aUid,defaultType:Y.aType,direction:"out",onSaved:()=>{U(!1),re(),i==null||i()},onCancel:()=>U(!1)})}),!P&&g.jsx(SE,{uid:Y.aUid,direction:"out",axbTypes:Be,canWrite:J,onDeleteEdge:xe=>H({aUid:xe.aUid,axbType:xe.axbType,bUid:xe.bUid}),onBulkDelete:xe=>I(xe),nodeUid:Y.aUid,reloadKey:oe,viewRegistry:r,config:a,schema:e,publishToNearby:o===0})]}),g.jsxs("section",{className:"bg-slate-900 rounded-xl border border-slate-800 p-5 mb-6",children:[g.jsxs("div",{className:"flex items-center justify-between mb-3",children:[g.jsx("h2",{className:"text-sm font-semibold",children:"Incoming Edges"}),J&&!R&&nt.length>0&&g.jsxs("button",{onClick:()=>V(!0),className:"px-3 py-1 bg-indigo-600/20 text-indigo-400 rounded-lg text-xs hover:bg-indigo-600/30 transition-colors flex items-center gap-1",children:[g.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),"Add Edge"]})]}),R&&g.jsx("div",{className:"mb-4",children:g.jsx(mE,{schema:e,viewRegistry:r,config:a,defaultUid:Y.aUid,defaultType:Y.aType,direction:"in",onSaved:()=>{V(!1),re(),i==null||i()},onCancel:()=>V(!1)})}),!R&&g.jsx(SE,{uid:Y.aUid,direction:"in",axbTypes:nt,inverseLabelMap:ye,canWrite:J,onDeleteEdge:xe=>H({aUid:xe.aUid,axbType:xe.axbType,bUid:xe.bUid,inverseLabel:ye[xe.axbType]}),onBulkDelete:xe=>I(xe),nodeUid:Y.aUid,reloadKey:oe,viewRegistry:r,config:a,schema:e,publishToNearby:o===0})]}),e.edgeTypes.length>0&&g.jsxs("section",{className:"bg-slate-900 rounded-xl border border-slate-800 p-5",children:[g.jsxs("h2",{className:"text-sm font-semibold mb-4 flex items-center gap-2",children:[g.jsx("svg",{className:"w-4 h-4 text-indigo-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),"Traverse from this node"]}),g.jsx(qN,{schema:e,startUid:Y.aUid,startNodeType:Y.aType,viewRegistry:r,config:a})]}),M==="choose"&&$u.createPortal(g.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50",onClick:()=>j(null),children:g.jsxs("div",{className:"bg-slate-900 border border-slate-700 rounded-xl p-6 max-w-md w-full mx-4 shadow-2xl",onClick:xe=>xe.stopPropagation(),children:[g.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Delete Node"}),g.jsxs("p",{className:"text-sm text-slate-400 mb-2",children:["How do you want to delete ",g.jsxs("span",{className:"font-mono text-slate-300",children:['"',Y.aUid,'"']})," (",Y.aType,")?"]}),ne>0&&g.jsxs("p",{className:"text-xs text-amber-400/80 mb-4",children:["This node has ",ne,"+ connected edge",ne!==1?"s":"","."]}),g.jsxs("div",{className:"flex flex-col gap-2 mt-4",children:[g.jsxs("button",{onClick:()=>{B(""),j("confirm-cascade")},className:"w-full px-4 py-2.5 bg-red-600 text-white rounded-lg text-sm font-medium hover:bg-red-500 transition-colors flex items-center justify-center gap-2",children:["Delete node + ",g.jsx("span",{className:"font-bold uppercase",children:"ALL"})," edges"]}),g.jsx("button",{onClick:()=>{B(""),j("confirm-node-only")},className:"w-full px-4 py-2 bg-slate-800 text-slate-300 rounded-lg text-sm hover:bg-slate-700 transition-colors flex items-center justify-center gap-2",children:"Delete node only"}),g.jsx("button",{onClick:()=>j(null),className:"w-full px-4 py-2 text-sm text-slate-500 hover:text-slate-300 transition-colors",children:"Cancel"})]})]})}),document.body),(M==="confirm-cascade"||M==="confirm-node-only")&&$u.createPortal(g.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50",onClick:()=>{j(null),B("")},children:g.jsxs("div",{className:"bg-slate-900 border border-slate-700 rounded-xl p-6 max-w-md w-full mx-4 shadow-2xl",onClick:xe=>xe.stopPropagation(),children:[g.jsx("h3",{className:"text-lg font-semibold mb-2",children:M==="confirm-cascade"?g.jsxs(g.Fragment,{children:["Confirm: Delete node + ",g.jsx("span",{className:"text-red-400 uppercase",children:"ALL"})," edges"]}):"Confirm: Delete node only"}),g.jsx("p",{className:"text-sm text-slate-400 mb-4",children:M==="confirm-cascade"?g.jsxs(g.Fragment,{children:["This will permanently delete the node and ",g.jsx("span",{className:"text-red-400 font-semibold uppercase",children:"ALL"})," connected edges."]}):"This will delete only the node record. Connected edges will remain."}),g.jsxs("div",{className:"mb-4",children:[g.jsxs("p",{className:"text-xs text-slate-500 mb-2",children:["Type ",g.jsx("span",{className:"font-mono text-slate-300",children:Y.aUid})," to confirm:"]}),g.jsx("input",{type:"text",value:k,onChange:xe=>B(xe.target.value),className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm text-slate-200 font-mono focus:outline-none focus:border-red-500/50 placeholder:text-slate-600",placeholder:Y.aUid,autoFocus:!0,onKeyDown:xe=>{xe.key==="Enter"&&k===Y.aUid&&(M==="confirm-cascade"?Oe():Se())}})]}),g.jsxs("div",{className:"flex justify-end gap-3",children:[g.jsx("button",{onClick:()=>{j("choose"),B("")},disabled:se.isPending||Ne.isPending,className:"px-4 py-2 text-sm text-slate-400 hover:text-slate-200 transition-colors disabled:opacity-50",children:"Back"}),g.jsxs("button",{onClick:M==="confirm-cascade"?Oe:Se,disabled:k!==Y.aUid||se.isPending||Ne.isPending,className:"px-4 py-2 bg-red-600 text-white rounded-lg text-sm font-medium hover:bg-red-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:[(se.isPending||Ne.isPending)&&g.jsx("div",{className:"w-3.5 h-3.5 border-2 border-white border-t-transparent rounded-full animate-spin"}),M==="confirm-cascade"?"Delete":"Delete node only"]})]})]})}),document.body),_&&g.jsx(bE,{title:"Delete Edge",message:`Delete edge ${_.aUid} —[${io(_.axbType,_.inverseLabel)}]→ ${_.bUid}?`,requireConfirmText:_.axbType,onConfirm:ke,onCancel:()=>H(null),loading:Ae.isPending}),z&&g.jsx(bE,{title:z.mode==="visible"?`Delete ${z.edges.length} Edge${z.edges.length!==1?"s":""}`:z.mode==="filtered"?"Delete Filtered Edges":g.jsxs(g.Fragment,{children:["Delete ",g.jsx("span",{className:"text-red-400 uppercase font-bold",children:"ALL"})," Edges"]}),message:z.mode==="visible"?`Delete the ${z.edges.length} "${io(z.axbType,z.inverseLabel)}" edge${z.edges.length!==1?"s":""} currently visible on this page?`:z.mode==="filtered"?`Delete all "${io(z.axbType,z.inverseLabel)}" edges ${z.direction==="out"?"from":"to"} this node that match the current filters? This may include edges on other pages.`:g.jsxs(g.Fragment,{children:["Delete ",g.jsx("span",{className:"text-red-400 font-semibold uppercase",children:"ALL"}),' "',io(z.axbType,z.inverseLabel),'" edges ',z.direction==="out"?"from":"to"," this node? This cannot be undone."]}),confirmLabel:z.mode==="visible"?`Delete ${z.edges.length}`:"Delete All",requireConfirmText:z.axbType,onConfirm:Pe,onCancel:()=>I(null),loading:Ze.isPending||Qe.isPending}),A&&Y&&g.jsx(UN,{node:Y,schema:e,viewRegistry:r,config:a,onClose:()=>D(!1),onNodeClick:(xe,ze)=>{D(!1),f({uid:xe,nodeType:ze,edgeType:"",direction:"out"})}})]})}function SE({uid:t,direction:e,axbTypes:r,inverseLabelMap:a={},canWrite:i,onDeleteEdge:s,onBulkDelete:o,nodeUid:u,reloadKey:d,viewRegistry:f,config:h,schema:p,publishToNearby:m=!1}){const{scopePath:y}=ba(),[x,E]=q.useState(25),[w,T]=q.useState(""),[C,N]=q.useState(""),[A,D]=q.useState("asc"),[M,j]=q.useState(""),[k,B]=q.useState("=="),[P,U]=q.useState(""),[R,V]=q.useState([]),[_,H]=q.useState(!1),[z,I]=q.useState(1),[F,K]=q.useState([]),[J,L]=q.useState(void 0),[Q,X]=q.useState(!1),[W,te]=q.useState(!1),[Y,ne]=q.useState({}),he=["axbType","aType","aUid","bType","bUid","createdAt","updatedAt"],oe=q.useMemo(()=>{const ye=p.edgeSchemas??[],$e=w?ye.filter(xe=>xe.axbType===w):ye.filter(xe=>r.includes(xe.axbType)),et=new Set;for(const xe of $e)for(const ze of xe.fields)et.add(ze.name);return[...et].sort()},[p.edgeSchemas,w,r]),ae={...e==="out"?{aUid:t}:{bUid:t},...w?{axbType:w}:{},limit:x,startAfter:J,...C?{sortBy:C,sortDir:A}:{},...R.length>0?{where:R}:{},...Zt(y)},{data:re,isLoading:le,error:se,refetch:Ne}=xt.getEdges.useQuery(ae,{placeholderData:ye=>ye}),Ae=(re==null?void 0:re.edges)??[],Ze=(re==null?void 0:re.hasMore)??!1,Qe=(re==null?void 0:re.nextCursor)??null,Se=(se==null?void 0:se.message)??null,Oe=Ro();q.useEffect(()=>{!m||!Oe||Oe.setEdgeResults(e,{edges:Ae,hasMore:Ze,loading:le})},[m,Oe,e,Ae,Ze,le]);const ke=W&&Ae.length>0?[...new Set(Ae.map(ye=>e==="out"?ye.bUid:ye.aUid))].filter(ye=>!(ye in Y)):[],{data:Pe,isFetching:Ge}=xt.getNodesBatch.useQuery({uids:ke,...Zt(y)},{enabled:ke.length>0});q.useEffect(()=>{if(!Pe)return;const ye={};for(const[$e,et]of Object.entries(Pe.nodes))ye[$e]=et;ne($e=>({...$e,...ye}))},[Pe]),q.useEffect(()=>{I(1),K([]),L(void 0),ne({})},[t,e,x,w,C,A,R,d,y]);const Je=()=>{Qe&&(K(ye=>[...ye,Qe]),I(ye=>ye+1),L(Qe))},Be=()=>{if(z<=1)return;const ye=[...F];ye.pop();const $e=ye.length>0?ye[ye.length-1]:void 0;K(ye),I(et=>et-1),L($e)},nt={};for(const ye of Ae){const $e=ye.axbType;nt[$e]||(nt[$e]=[]),nt[$e].push(ye)}return g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-3",children:[g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("label",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold",children:"Show"}),g.jsx("select",{value:x,onChange:ye=>E(Number(ye.target.value)),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-xs text-slate-200 focus:outline-none focus:border-indigo-500",children:uz.map(ye=>g.jsx("option",{value:ye,children:ye},ye))})]}),r.length>0&&g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"w-px h-4 bg-slate-700"}),g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("label",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold",children:"Type"}),g.jsxs("select",{value:w,onChange:ye=>T(ye.target.value),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-xs text-slate-200 focus:outline-none focus:border-indigo-500",children:[g.jsx("option",{value:"",children:"All"}),r.map(ye=>g.jsx("option",{value:ye,children:ye},ye))]})]})]}),g.jsx("div",{className:"w-px h-4 bg-slate-700"}),g.jsxs("button",{onClick:()=>H(ye=>!ye),className:`px-2 py-1 border rounded text-xs transition-colors flex items-center gap-1 ${_||C||R.length>0?"bg-indigo-600/20 border-indigo-500/40 text-indigo-300":"bg-slate-800 border-slate-700 text-slate-400 hover:bg-slate-700"}`,children:[g.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z"})}),R.length>0?`Filter (${R.length})`:C?"Sort":"Sort / Filter"]}),g.jsx("div",{className:"w-px h-4 bg-slate-700"}),g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("button",{onClick:Be,disabled:z<=1||le,className:"px-2 py-1 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 hover:bg-slate-700 transition-colors disabled:opacity-30 disabled:cursor-not-allowed",children:"Prev"}),g.jsxs("span",{className:"text-xs text-slate-400 px-1",children:["Page ",z]}),g.jsx("button",{onClick:Je,disabled:!Ze||le,className:"px-2 py-1 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 hover:bg-slate-700 transition-colors disabled:opacity-30 disabled:cursor-not-allowed",children:"Next"})]}),g.jsx("button",{onClick:()=>{I(1),K([]),L(void 0),Ne()},disabled:le,className:"px-2 py-1 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 hover:bg-slate-700 transition-colors disabled:opacity-50",title:"Refresh",children:g.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})}),g.jsx("div",{className:"w-px h-4 bg-slate-700"}),g.jsx("button",{onClick:()=>X(ye=>!ye),className:`px-2 py-1 border rounded text-xs transition-colors ${Q?"bg-indigo-600/30 border-indigo-500/50 text-indigo-300":"bg-slate-800 border-slate-700 text-slate-400 hover:bg-slate-700"}`,title:Q?"Collapse all edge details":"Expand all edge details",children:Q?"Collapse all":"Expand all"}),g.jsx("button",{onClick:()=>te(ye=>!ye),className:`px-2 py-1 border rounded text-xs transition-colors ${W?"bg-indigo-600/30 border-indigo-500/50 text-indigo-300":"bg-slate-800 border-slate-700 text-slate-400 hover:bg-slate-700"}`,title:W?"Stop resolving target nodes":"Resolve all target nodes inline",children:Ge?g.jsxs("span",{className:"flex items-center gap-1",children:[g.jsx("span",{className:"w-2.5 h-2.5 border border-indigo-400 border-t-transparent rounded-full animate-spin"}),"Resolving..."]}):W?"Resolved":"Resolve all"})]}),_&&g.jsxs("div",{className:"bg-slate-800/50 border border-slate-700 rounded-lg p-3 mb-3 space-y-3",children:[g.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[g.jsx("label",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold w-10",children:"Sort"}),g.jsxs("select",{value:C,onChange:ye=>N(ye.target.value),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-xs text-slate-200 focus:outline-none focus:border-indigo-500",children:[g.jsx("option",{value:"",children:"Default (axbType)"}),he.map(ye=>g.jsx("option",{value:ye,children:ye},ye)),oe.length>0&&g.jsx("optgroup",{label:"Data fields",children:oe.map(ye=>g.jsx("option",{value:ye,children:ye},ye))})]}),g.jsxs("select",{value:A,onChange:ye=>D(ye.target.value),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-xs text-slate-200 focus:outline-none focus:border-indigo-500",children:[g.jsx("option",{value:"asc",children:"asc"}),g.jsx("option",{value:"desc",children:"desc"})]})]}),R.length>0&&g.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[R.map((ye,$e)=>g.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 bg-indigo-600/20 border border-indigo-500/30 rounded text-[11px] text-indigo-300",children:[g.jsx("span",{className:"font-mono",children:ye.field}),g.jsx("span",{className:"text-indigo-400",children:ye.op}),g.jsx("span",{className:"font-mono",children:String(ye.value)}),g.jsx("button",{onClick:()=>V(et=>et.filter((xe,ze)=>ze!==$e)),className:"ml-0.5 text-indigo-400 hover:text-red-400 transition-colors",children:"×"})]},$e)),g.jsx("button",{onClick:()=>V([]),className:"text-[10px] text-slate-500 hover:text-red-400 transition-colors",children:"Clear all"})]}),g.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[g.jsx("label",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold w-10",children:"Where"}),g.jsxs("select",{value:M,onChange:ye=>j(ye.target.value),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-xs text-slate-200 focus:outline-none focus:border-indigo-500",children:[g.jsx("option",{value:"",children:"Field..."}),he.map(ye=>g.jsx("option",{value:ye,children:ye},ye)),oe.length>0&&g.jsx("optgroup",{label:"Data fields",children:oe.map(ye=>g.jsx("option",{value:ye,children:ye},ye))})]}),g.jsx("select",{value:k,onChange:ye=>B(ye.target.value),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-xs text-slate-200 focus:outline-none focus:border-indigo-500",children:["==","!=","<","<=",">",">="].map(ye=>g.jsx("option",{value:ye,children:ye},ye))}),g.jsx("input",{type:"text",value:P,onChange:ye=>U(ye.target.value),placeholder:"value",className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-xs text-slate-200 focus:outline-none focus:border-indigo-500 w-28",onKeyDown:ye=>{if(ye.key==="Enter"&&M&&P){let $e=P;P==="true"?$e=!0:P==="false"?$e=!1:!isNaN(Number(P))&&P.trim()!==""&&($e=Number(P)),V(et=>[...et,{field:M,op:k,value:$e}]),U("")}}}),g.jsx("button",{onClick:()=>{if(!M||!P)return;let ye=P;P==="true"?ye=!0:P==="false"?ye=!1:!isNaN(Number(P))&&P.trim()!==""&&(ye=Number(P)),V($e=>[...$e,{field:M,op:k,value:ye}]),U("")},disabled:!M||!P,className:"px-2 py-1 bg-indigo-600/30 text-indigo-300 rounded text-xs hover:bg-indigo-600/40 transition-colors disabled:opacity-30 disabled:cursor-not-allowed",children:"Add"})]})]}),Se&&g.jsx("div",{className:"bg-red-500/10 border border-red-500/30 rounded-lg p-2 mb-3 text-xs text-red-400",children:Se}),le?g.jsxs("div",{className:"flex items-center gap-2 text-slate-400 py-6 justify-center",children:[g.jsx("div",{className:"w-3.5 h-3.5 border-2 border-indigo-500 border-t-transparent rounded-full animate-spin"}),g.jsx("span",{className:"text-xs",children:"Loading edges..."})]}):Ae.length===0?g.jsxs("p",{className:"text-sm text-slate-500",children:["No ",e==="out"?"outgoing":"incoming"," edges",w?` of type "${w}"`:""]}):g.jsx("div",{className:"space-y-4",children:Object.entries(nt).map(([ye,$e])=>g.jsx(fz,{axbType:ye,edges:$e,direction:e,inverseLabel:e==="in"?a[ye]:void 0,canWrite:i,onDeleteEdge:s,onBulkDelete:o&&u?et=>{const xe=e==="in"?a[ye]:void 0;o(et==="visible"?{mode:"visible",axbType:ye,inverseLabel:xe,edges:$e.map(ze=>({aUid:ze.aUid,axbType:ze.axbType,bUid:ze.bUid}))}:et==="filtered"?{mode:"filtered",axbType:ye,inverseLabel:xe,direction:e,uid:u,where:R}:{mode:"all",axbType:ye,inverseLabel:xe,direction:e,uid:u})}:void 0,hasActiveFilters:R.length>0,expandAll:Q,resolveAll:W,resolvedNodes:Y,viewRegistry:f,config:h},ye))}),Ae.length>0&&(Ze||z>1)&&g.jsxs("div",{className:"mt-3 flex items-center justify-between",children:[g.jsxs("span",{className:"text-[10px] text-slate-500",children:[Ae.length," edge",Ae.length!==1?"s":""," on this page"]}),g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("button",{onClick:Be,disabled:z<=1||le,className:"px-2 py-1 bg-slate-800 text-slate-300 rounded text-xs hover:bg-slate-700 transition-colors disabled:opacity-30 disabled:cursor-not-allowed",children:"Previous"}),g.jsxs("span",{className:"text-[10px] text-slate-400 px-1",children:["Page ",z]}),g.jsx("button",{onClick:Je,disabled:!Ze||le,className:"px-2 py-1 bg-slate-800 text-slate-300 rounded text-xs hover:bg-slate-700 transition-colors disabled:opacity-30 disabled:cursor-not-allowed",children:"Next"})]})]})]})}function fz({axbType:t,edges:e,direction:r,inverseLabel:a,canWrite:i,onDeleteEdge:s,onBulkDelete:o,hasActiveFilters:u=!1,expandAll:d,resolveAll:f,resolvedNodes:h,viewRegistry:p,config:m}){var J;const{scopePath:y}=ba(),[x,E]=q.useState(!1),[w,T]=q.useState(""),[C,N]=q.useState(""),[A,D]=q.useState(!1),[M,j]=q.useState(!1),[k,B]=q.useState({}),P=d||A,U=f||M,[R,V]=q.useState(!0),_=((J=p==null?void 0:p.edges[t])==null?void 0:J.views)??[],H=q.useMemo(()=>{var Q;const L=new Map;if(!p)return[];for(const X of e){const W=r==="out"?X.bType:X.aType;for(const te of((Q=p.nodes[W])==null?void 0:Q.views)??[])L.has(te.viewName)||L.set(te.viewName,te)}return[...L.values()]},[p,e,r]),z={...h,...k},I=M&&!f&&e.length>0?[...new Set(e.map(L=>r==="out"?L.bUid:L.aUid))].filter(L=>!(L in z)):[],{data:F,isFetching:K}=xt.getNodesBatch.useQuery({uids:I,...Zt(y)},{enabled:I.length>0});return q.useEffect(()=>{if(!F)return;const L={};for(const[Q,X]of Object.entries(F.nodes))L[Q]=X;B(Q=>({...Q,...L}))},[F]),g.jsxs("div",{children:[g.jsxs("div",{className:"text-xs font-mono mb-2 flex items-center gap-2",children:[r==="out"?g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"text-slate-500",children:"—"}),g.jsx("span",{className:"text-indigo-400",children:t}),g.jsx("span",{className:"text-slate-500",children:"→"})]}):a?g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"text-slate-500",children:"—"}),g.jsx("span",{className:"text-amber-400 cursor-help",title:`Inverse of: ${t}`,children:a}),g.jsx("span",{className:"text-slate-500",children:"→"})]}):g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"text-slate-500",children:"←"}),g.jsx("span",{className:"text-indigo-400",children:t}),g.jsx("span",{className:"text-slate-500",children:"—"})]}),g.jsxs("span",{className:"text-slate-600 text-[10px]",children:["(",e.length,")"]}),g.jsxs("div",{className:"ml-auto flex items-center gap-1.5",children:[g.jsx("button",{onClick:()=>D(L=>!L),className:`p-1 border rounded transition-colors ${P?"bg-indigo-600/30 border-indigo-500/50 text-indigo-300":"bg-slate-800 border-slate-700 text-slate-500 hover:text-slate-300 hover:bg-slate-700"}`,title:P?"Collapse edges":"Expand edges",children:g.jsx("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:P?g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 14h6v6M20 10h-6V4M14 10l7-7M3 21l7-7"}):g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7"})})}),g.jsx("button",{onClick:()=>{U?V(L=>!L):(j(!0),V(!0))},className:`p-1 border rounded transition-colors ${U?R?"bg-indigo-600/30 border-indigo-500/50 text-indigo-300":"bg-slate-800 border-indigo-500/50 text-slate-500 hover:text-slate-300":"bg-slate-800 border-slate-700 text-slate-500 hover:text-slate-300 hover:bg-slate-700"}`,title:U?R?"Hide node data":"Show node data":"Resolve target nodes","aria-label":U?R?"Hide node data":"Show node data":"Resolve target nodes",children:K?g.jsx("span",{className:"w-3 h-3 border-[1.5px] border-indigo-400 border-t-transparent rounded-full animate-spin block"}):U&&R?g.jsx("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M3 3l18 18"})}):g.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]})}),_.length>0&&g.jsxs("span",{className:"relative inline-flex items-center",children:[g.jsx("svg",{className:"w-3 h-3 text-slate-500 absolute left-1.5 pointer-events-none",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 5l7 7-7 7M5 12h14"})}),g.jsxs("select",{value:w,onChange:L=>T(L.target.value),className:"bg-slate-800 border border-slate-700 rounded pl-6 pr-1.5 py-0.5 text-[10px] text-slate-300 focus:outline-none focus:border-indigo-500 appearance-none",style:{direction:"rtl"},title:"Edge data view",children:[g.jsx("option",{value:"",dir:"ltr",children:"default"}),g.jsx("option",{value:"json",dir:"ltr",children:"JSON"}),_.map(L=>g.jsx("option",{value:L.viewName,dir:"ltr",children:L.viewName},L.viewName))]})]}),H.length>0&&g.jsxs("span",{className:"relative inline-flex items-center",children:[g.jsx("svg",{className:"w-3 h-3 text-slate-500 absolute left-1.5 pointer-events-none",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:g.jsx("circle",{cx:"12",cy:"12",r:"8"})}),g.jsxs("select",{value:C,onChange:L=>N(L.target.value),className:"bg-slate-800 border border-slate-700 rounded pl-6 pr-1.5 py-0.5 text-[10px] text-slate-300 focus:outline-none focus:border-indigo-500 appearance-none",style:{direction:"rtl"},title:"Node data view",children:[g.jsx("option",{value:"",dir:"ltr",children:"default"}),g.jsx("option",{value:"json",dir:"ltr",children:"JSON"}),H.map(L=>g.jsx("option",{value:L.viewName,dir:"ltr",children:L.viewName},L.viewName))]})]}),i&&o&&g.jsxs("div",{className:"relative",children:[g.jsx("button",{onClick:()=>E(L=>!L),className:`p-1 border rounded transition-colors ${x?"bg-red-600/20 border-red-500/50 text-red-400":"bg-slate-800 border-slate-700 text-slate-600 hover:text-red-400 hover:border-red-500/50"}`,title:`Bulk delete ${io(t,a)} edges`,children:g.jsx("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})}),x&&g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"fixed inset-0 z-30",onClick:()=>E(!1)}),g.jsxs("div",{className:"absolute right-0 top-full mt-1 z-40 bg-slate-800 border border-slate-700 rounded-lg shadow-xl py-1 min-w-[200px]",children:[g.jsxs("button",{onClick:()=>{E(!1),o("visible")},className:"w-full text-left px-3 py-2 text-xs text-slate-300 hover:bg-slate-700 transition-colors",children:["Delete visible (",e.length,")"]}),u&&g.jsx("button",{onClick:()=>{E(!1),o("filtered")},className:"w-full text-left px-3 py-2 text-xs text-slate-300 hover:bg-slate-700 transition-colors",children:"Delete all matching filters"}),g.jsxs("button",{onClick:()=>{E(!1),o("all")},className:"w-full text-left px-3 py-2 text-xs text-red-400 hover:bg-slate-700 transition-colors",children:["Delete ",g.jsx("span",{className:"font-bold uppercase",children:"ALL"})," ",io(t,a)," edges"]})]})]})]})]})]}),g.jsx("div",{className:"space-y-1",children:e.map((L,Q)=>{var te,Y;const X=r==="out"?L.bUid:L.aUid,W=r==="out"?L.bType:L.aType;return g.jsx(hz,{edge:L,targetUid:X,targetType:W,direction:r,canWrite:i,onDelete:()=>s(L),expandAllActive:P,resolvedNode:z[X],resolveAllActive:U,edgeViews:((te=p==null?void 0:p.edges[L.axbType])==null?void 0:te.views)??[],nodeViews:((Y=p==null?void 0:p.nodes[W])==null?void 0:Y.views)??[],config:m,groupEdgeView:w,groupNodeView:C,groupNodeVisible:R},Q)})})]})}function hz({edge:t,targetUid:e,targetType:r,direction:a,canWrite:i,onDelete:s,expandAllActive:o,resolvedNode:u,resolveAllActive:d,edgeViews:f=[],nodeViews:h=[],config:p,groupEdgeView:m="",groupNodeView:y="",groupNodeVisible:x=!0}){const{drillIn:E}=ah(),{scopePath:w,scopedPath:T}=ba(),C=xt.useUtils(),[N,A]=q.useState(!1),D=N||!!o,[M,j]=q.useState(!1),k=()=>{var oe,ae;const he=(ae=(oe=p.viewDefaults)==null?void 0:oe.edges)==null?void 0:ae[t.axbType];if(he&&f.length>0){const re=nn(he,f,"inline");if(re!=="json"){const le=f.find(se=>se.viewName===re);if(le)return le.tagName}}return"json"},[B,P]=q.useState(k),U=()=>{var oe,ae;const he=(ae=(oe=p.viewDefaults)==null?void 0:oe.nodes)==null?void 0:ae[r];if(he&&h.length>0){const re=nn(he,h,"inline");if(re!=="json"){const le=h.find(se=>se.viewName===re);if(le)return le.tagName}}return"json"},[R,V]=q.useState(U),_=(he,oe,ae)=>{if(!he)return ae;if(he==="json")return"json";const re=oe.find(le=>le.viewName===he);return re?re.tagName:ae},H=_(m,f,B),z=P,I=_(y,h,R),F=V,[K,J]=q.useState(void 0),[L,Q]=q.useState(!1),X=Object.keys(t.data).length>0,W=K!==void 0?K:u,te=W!==void 0;q.useEffect(()=>{var he,oe;if(d&&u!==void 0&&(j(!0),u)){const ae=(oe=(he=p.viewDefaults)==null?void 0:he.nodes)==null?void 0:oe[r];if(ae&&h.length>0){const re=nn(ae,h,"inline");if(re!=="json"){const le=h.find(se=>se.viewName===re);le&&F(le.tagName)}}}},[d,u]);const Y=async()=>{var he,oe;Q(!0);try{const re=(await C.getNodesBatch.fetch({uids:[e],...Zt(w)})).nodes[e]??null;if(J(re),j(!0),re){const le=(oe=(he=p.viewDefaults)==null?void 0:he.nodes)==null?void 0:oe[r];if(le&&h.length>0){const se=nn(le,h,"inline");if(se!=="json"){const Ne=h.find(Ae=>Ae.viewName===se);Ne&&F(Ne.tagName)}}}}catch{}finally{Q(!1)}},ne=()=>{E({uid:e,nodeType:r,edgeType:t.axbType,direction:a})};return g.jsxs("div",{className:"bg-slate-800/50 rounded-lg",children:[g.jsxs("div",{className:"flex items-center gap-3 px-3 py-2",children:[g.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-mono ${nr(r)}`,children:r}),g.jsx("button",{onClick:ne,className:"text-sm font-mono text-indigo-400 hover:text-indigo-300 transition-colors",title:"Dive into this node",children:e}),g.jsx(Qt,{to:T(`/node/${encodeURIComponent(e)}`),className:"text-[10px] text-slate-500 hover:text-slate-300 transition-colors",title:"Navigate to this node's page",children:"go to"}),g.jsx("button",{onClick:()=>A(!N),className:"text-[10px] text-slate-500 hover:text-slate-300 transition-colors",children:D?"hide edge":"show edge"}),!te&&!L&&g.jsx("button",{onClick:Y,className:"text-[10px] text-slate-500 hover:text-slate-300 transition-colors",children:"resolve"}),L&&g.jsx("span",{className:"w-2.5 h-2.5 border border-slate-400 border-t-transparent rounded-full animate-spin"}),te&&g.jsx("button",{onClick:()=>j(!M),className:"text-[10px] text-slate-500 hover:text-slate-300 transition-colors",children:M?"hide node":"show node"}),i&&g.jsx("button",{onClick:s,className:"ml-auto text-[10px] text-slate-600 hover:text-red-400 transition-colors",children:"delete"})]}),D&&g.jsxs("div",{className:"px-3 pb-2 space-y-2",children:[g.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 text-[11px] font-mono bg-slate-950 rounded p-2",children:[g.jsx("span",{className:"text-slate-500",children:"aType"}),g.jsx("span",{className:"text-slate-300",children:t.aType}),g.jsx("span",{className:"text-slate-500",children:"aUid"}),g.jsx("span",{className:"text-slate-300",children:t.aUid}),g.jsx("span",{className:"text-slate-500",children:"axbType"}),g.jsx("span",{className:"text-slate-300",children:t.axbType}),g.jsx("span",{className:"text-slate-500",children:"bType"}),g.jsx("span",{className:"text-slate-300",children:t.bType}),g.jsx("span",{className:"text-slate-500",children:"bUid"}),g.jsx("span",{className:"text-slate-300",children:t.bUid}),g.jsx("span",{className:"text-slate-500",children:"createdAt"}),g.jsx("span",{className:"text-slate-300",children:so(t.createdAt)}),g.jsx("span",{className:"text-slate-500",children:"updatedAt"}),g.jsx("span",{className:"text-slate-300",children:so(t.updatedAt)})]}),X&&g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[g.jsx("span",{className:"text-[10px] text-slate-500 uppercase tracking-wider font-semibold",children:"Data"}),f.length>0&&g.jsx(Ao,{views:f,activeView:H,onSwitch:z})]}),H==="json"?g.jsx("div",{className:"font-mono text-[11px] leading-relaxed bg-slate-950 rounded p-2 overflow-auto max-h-40",children:g.jsx(Oa,{data:t.data,defaultExpanded:!0})}):g.jsx(Jn,{tagName:H,data:t.data,onError:()=>z("json")})]})]}),M&&te&&x&&g.jsx("div",{className:"px-3 pb-2",children:W===null?g.jsx("p",{className:"text-[11px] text-slate-500 italic",children:"Node not found"}):g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[g.jsx("span",{className:"text-[10px] text-slate-500 uppercase tracking-wider font-semibold",children:"Node Data"}),g.jsx("span",{className:"text-[10px] text-slate-600",children:so(W.updatedAt)}),h.length>0&&g.jsx(Ao,{views:h,activeView:I,onSwitch:F})]}),I==="json"?g.jsx("div",{className:"font-mono text-[11px] leading-relaxed bg-slate-950 rounded p-2 overflow-auto max-h-40",children:g.jsx(Oa,{data:W.data,defaultExpanded:!0})}):g.jsx(Jn,{tagName:I,data:W.data,onError:()=>F("json")})]})})]})}function vz(t){const e=t.data;switch(t.kind){case"node-detail":{const r=e.node;return r?`${r.type}:${r.uid}`:"Node Not Found"}case"nodes-list":return`${(Array.isArray(e.nodes)?e.nodes:[]).length} Nodes`;case"edges-list":return`${(Array.isArray(e.edges)?e.edges:[]).length} Edges`;case"traverse":return`Traversal (${(Array.isArray(e.hops)?e.hops:[]).length} hops)`;case"search":return"Search Results";case"schema":return"Schema";default:return"Query Result"}}function pz({artifact:t,viewRegistry:e,config:r,onNavigate:a}){switch(t.kind){case"node-detail":return g.jsx(gz,{data:t.data,viewRegistry:e,config:r,onNavigate:a});case"nodes-list":return g.jsx(mz,{data:t.data,onNavigate:a});case"edges-list":return g.jsx(yz,{data:t.data,onNavigate:a});case"traverse":return g.jsx(xz,{data:t.data,onNavigate:a});case"search":return g.jsx(bz,{data:t.data,onNavigate:a});case"schema":return g.jsx(wz,{data:t.data});default:return g.jsx(Oa,{data:t.data??{},defaultExpanded:!0})}}function gz({data:t,viewRegistry:e,config:r,onNavigate:a}){const i=t.node;return i?g.jsxs("div",{className:"space-y-4",children:[g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-mono ${nr(i.type)}`,children:i.type}),g.jsx("h1",{className:"text-xl font-bold font-mono",children:i.uid}),g.jsx("button",{onClick:()=>a(i.uid),className:"ml-auto px-3 py-1.5 bg-indigo-600/20 text-indigo-400 rounded-lg text-xs hover:bg-indigo-600/30 transition-colors",children:"View full details"})]}),g.jsx(GN,{nodeType:i.type,data:i.data??{},viewRegistry:e,config:r})]}):g.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-8 text-center",children:[g.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Node Not Found"}),g.jsx("p",{className:"text-sm text-slate-400",children:"The queried node was not found."})]})}function mz({data:t,onNavigate:e}){const r=t.nodes??[],a=t.hasMore;return g.jsxs("div",{className:"space-y-2",children:[r.map((i,s)=>g.jsxs("div",{className:"bg-slate-900 rounded-lg border border-slate-800 px-4 py-3",children:[g.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[g.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-mono ${nr(i.type)}`,children:i.type}),g.jsx("button",{onClick:()=>e(i.uid),className:"font-mono text-xs text-indigo-400 hover:text-indigo-300 transition-colors",children:i.uid})]}),i.data&&Object.keys(i.data).length>0&&g.jsx("div",{className:"mt-1",children:g.jsx(Oa,{data:i.data,defaultExpanded:!1})})]},s)),a&&g.jsx("p",{className:"text-[10px] text-slate-500 text-center py-1",children:"Results truncated — use a higher limit to see more"})]})}function yz({data:t,onNavigate:e}){const r=t.edges??[],a=t.hasMore;return g.jsxs("div",{className:"space-y-1",children:[g.jsx(QN,{edges:r,onNavigate:e}),a&&g.jsx("p",{className:"text-[10px] text-slate-500 text-center py-1",children:"Results truncated — use a higher limit to see more"})]})}function xz({data:t,onNavigate:e}){const r=t.hops??[],a=t.totalReads;return g.jsxs("div",{className:"space-y-4",children:[r.map((i,s)=>g.jsxs(gm,{title:`Hop ${i.depth}: ${i.relation} (${i.direction})`,badge:`${i.edgeCount} edges`,children:[g.jsx(QN,{edges:i.edges,onNavigate:e}),i.truncated&&g.jsx("p",{className:"text-[10px] text-amber-500 mt-1",children:"Truncated — increase limit to see more"})]},s)),a!=null&&g.jsxs("p",{className:"text-[10px] text-slate-500 text-right",children:[a," total reads"]})]})}function bz({data:t,onNavigate:e}){const r=t.results??[];return r.length===0?g.jsx("p",{className:"text-slate-400 text-sm",children:"No results found"}):g.jsx("div",{className:"space-y-2",children:r.map((a,i)=>g.jsxs("div",{className:"bg-slate-900 rounded-lg border border-slate-800 px-4 py-3",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-mono ${nr(a.type)}`,children:a.type}),g.jsx("button",{onClick:()=>e(a.uid),className:"font-mono text-xs text-indigo-400 hover:text-indigo-300 transition-colors",children:a.uid}),a.matchType&&g.jsx("span",{className:"text-[9px] text-slate-500 ml-auto",children:a.matchType})]}),a.data&&Object.keys(a.data).length>0&&g.jsx("div",{className:"mt-1",children:g.jsx(Oa,{data:a.data,defaultExpanded:!1})})]},i))})}function wz({data:t}){const e=t.nodeTypes??[],r=t.edgeTypes??[];return g.jsxs("div",{className:"space-y-4",children:[g.jsx(gm,{title:`Node Types (${e.length})`,children:g.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.map(a=>g.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-mono ${nr(a)}`,children:a},a))})}),g.jsx(gm,{title:`Edge Types (${r.length})`,children:g.jsx("div",{className:"space-y-1",children:r.map((a,i)=>g.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-mono",children:[g.jsx("span",{className:`px-1 py-0.5 rounded text-[10px] ${nr(a.from)}`,children:a.from}),g.jsx("span",{className:"text-slate-500",children:"--["}),g.jsx("span",{className:"text-indigo-400",children:a.relation}),g.jsx("span",{className:"text-slate-500",children:"]-->"}),g.jsx("span",{className:`px-1 py-0.5 rounded text-[10px] ${nr(a.to)}`,children:a.to}),a.inverseLabel&&g.jsxs("span",{className:"text-[10px] text-slate-600 ml-1",children:["(",a.inverseLabel,")"]})]},i))})})]})}function gm({title:t,badge:e,trailing:r,children:a}){return g.jsxs("section",{className:"bg-slate-900 rounded-xl border border-slate-800 p-4",children:[g.jsxs("div",{className:"flex items-center justify-between mb-3",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("h3",{className:"text-sm font-semibold text-slate-200",children:t}),e&&g.jsx("span",{className:"text-[10px] text-slate-500",children:e})]}),r]}),a]})}function QN({edges:t,onNavigate:e}){const[r,a]=q.useState(new Set);return g.jsx("div",{className:"space-y-0.5",children:t.map((i,s)=>g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-1.5 py-1.5 text-xs",children:[g.jsx("span",{className:`px-1 py-0.5 rounded text-[10px] font-mono ${nr(i.fromType)}`,children:i.fromType}),g.jsx("button",{onClick:()=>e(i.fromUid),className:"font-mono text-indigo-400 hover:text-indigo-300 transition-colors truncate max-w-[100px]",title:i.fromUid,children:i.fromUid}),g.jsx("span",{className:"text-slate-500 shrink-0",children:"--["}),g.jsx("span",{className:"text-indigo-400 shrink-0",children:i.relation}),g.jsx("span",{className:"text-slate-500 shrink-0",children:"]-->"}),g.jsx("span",{className:`px-1 py-0.5 rounded text-[10px] font-mono ${nr(i.toType)}`,children:i.toType}),g.jsx("button",{onClick:()=>e(i.toUid),className:"font-mono text-indigo-400 hover:text-indigo-300 transition-colors truncate max-w-[100px]",title:i.toUid,children:i.toUid}),i.data&&Object.keys(i.data).length>0&&g.jsx("button",{onClick:()=>{a(o=>{const u=new Set(o);return u.has(s)?u.delete(s):u.add(s),u})},className:"text-[10px] text-slate-500 hover:text-slate-300 ml-auto shrink-0",children:r.has(s)?"hide":"data"})]}),r.has(s)&&i.data&&g.jsx("div",{className:"ml-4 mb-1",children:g.jsx(Oa,{data:i.data,defaultExpanded:!0})})]},s))})}function Sz({schema:t,viewRegistry:e,config:r}){const{messages:a,status:i,isStreaming:s,sendMessage:o,clearHistory:u,chatEnabled:d}=Kk(),{mode:f,expand:h,collapse:p}=Jk(),{activeArtifact:m,showArtifact:y,dismissArtifact:x}=Zk(),E=Ro(),w=on(),[T,C]=q.useState(""),N=q.useRef(null),A=q.useRef(null),D=q.useRef(null),M=q.useRef(null),j=q.useRef(typeof window<"u"&&("ontouchstart"in window||navigator.maxTouchPoints>0)),k=m!==null;q.useEffect(()=>{var I;(I=N.current)==null||I.scrollIntoView({behavior:"smooth"})},[a]),q.useEffect(()=>{const I=A.current;I&&(I.style.height="auto",I.style.height=Math.min(I.scrollHeight,120)+"px")},[T]),q.useEffect(()=>{f==="expanded"&&setTimeout(()=>{var I;return(I=A.current)==null?void 0:I.focus()},100)},[f]),q.useEffect(()=>{if(!d)return;const I=F=>{const K=F.target.tagName,J=F.target===A.current;if((F.metaKey||F.ctrlKey)&&F.key==="k"){F.preventDefault(),f==="collapsed"?h():p();return}F.key==="Escape"&&f==="expanded"&&(J||K!=="INPUT"&&K!=="TEXTAREA"&&K!=="SELECT")&&(k?x():p())};return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[d,f,h,p,k,x]);const B=q.useCallback(()=>{j.current||f!=="collapsed"||(D.current=window.setTimeout(()=>{h()},200))},[f,h]),P=q.useCallback(()=>{D.current!==null&&(clearTimeout(D.current),D.current=null)},[]),U=q.useCallback(()=>{s||j.current||(M.current=window.setTimeout(()=>{p()},300))},[s,p]),R=q.useCallback(()=>{M.current!==null&&(clearTimeout(M.current),M.current=null)},[]),V=q.useCallback(()=>{const I=T.trim();if(!I||s||i!=="connected")return;const F=eD(E,t);o(I,F),C("")},[T,s,i,E,t,o]),_=I=>{I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),V())},H=q.useCallback(I=>{y(I)},[y]),z=q.useCallback(I=>{x(),p(),w(`/node/${encodeURIComponent(I)}`)},[x,p,w]);return d?f==="collapsed"?g.jsx("div",{className:"fixed bottom-0 left-0 right-0 z-50 flex justify-center pointer-events-none",style:{height:40},children:g.jsx("div",{className:"pointer-events-auto cursor-pointer flex items-end pb-3",style:{width:160},onMouseEnter:B,onMouseLeave:P,onClick:()=>{P(),h()},children:g.jsx("div",{className:"chat-breathe-line w-full h-[2px] bg-emerald-400 rounded-full",style:{animation:"chat-breathe 3s ease-in-out infinite"}})})}):g.jsxs("div",{className:"fixed inset-0 z-50 flex",style:{animation:"chat-overlay-in 0.2s ease-out"},onMouseEnter:R,onMouseLeave:U,children:[g.jsx("div",{className:"absolute inset-0 bg-slate-950/90 backdrop-blur-md",onClick:()=>{k?x():p()}}),g.jsxs("div",{className:"relative flex w-full h-full",children:[g.jsxs("div",{className:`flex flex-col h-full transition-all duration-300 ease-out ${k?"w-[420px] shrink-0 border-r border-slate-800":"w-full max-w-[700px] mx-auto"}`,children:[g.jsxs("div",{className:"shrink-0 border-b border-slate-800 px-5 py-3 flex items-center justify-between",children:[g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx("span",{className:`w-2 h-2 rounded-full ${i==="connected"?"bg-emerald-500":i==="checking"?"bg-amber-500 animate-pulse":"bg-slate-600"}`}),g.jsx("span",{className:"text-xs text-slate-400 font-medium",children:i==="connected"?"Connected":i==="checking"?"Checking...":"Offline"})]}),g.jsxs("div",{className:"flex items-center gap-2",children:[a.length>0&&g.jsx("button",{onClick:u,className:"text-[11px] text-slate-600 hover:text-slate-400 transition-colors px-2 py-1",children:"Clear"}),g.jsx("button",{onClick:p,className:"p-1.5 text-slate-500 hover:text-slate-200 transition-colors",title:"Close (Esc)",children:g.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:g.jsx("path",{d:"M1 1l12 12M13 1L1 13"})})})]})]}),g.jsxs("div",{className:"flex-1 overflow-auto px-5 py-6 space-y-4",children:[a.length===0&&g.jsx("div",{className:"text-center text-slate-600 text-sm mt-12",children:i==="connected"?g.jsx("p",{children:"Ask a question about your graph data."}):g.jsx("p",{children:"Waiting for chat service to connect..."})}),a.map(I=>g.jsx(Ez,{message:I,activeArtifactId:(m==null?void 0:m.id)??null,onArtifactClick:H},I.id)),g.jsx("div",{ref:N})]}),g.jsx("div",{className:"px-5 py-1 shrink-0",children:g.jsx("span",{className:"text-[10px] text-slate-600",children:E!=null&&E.focused?`Context: ${E.focused.nodeType}:${E.focused.uid.slice(0,16)}${E.focused.uid.length>16?"...":""}`:"Context: schema only"})}),g.jsx("div",{className:"px-5 pb-5 shrink-0",children:g.jsxs("div",{className:"flex gap-3 items-end",children:[g.jsx("textarea",{ref:A,value:T,onChange:I=>C(I.target.value),onKeyDown:_,placeholder:i==="connected"?"Ask about your graph...":"Agent offline",disabled:i!=="connected"||s,rows:1,className:"flex-1 bg-slate-800/60 border border-slate-700 rounded-xl px-4 py-3 text-sm text-slate-200 placeholder:text-slate-500 focus:outline-none focus:border-emerald-500/50 focus:ring-1 focus:ring-emerald-500/20 transition-all resize-none disabled:opacity-50 disabled:cursor-not-allowed"}),g.jsx("button",{onClick:V,disabled:!T.trim()||i!=="connected"||s,className:"px-4 py-3 bg-emerald-600 text-white rounded-xl text-sm font-medium hover:bg-emerald-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed shrink-0",children:s?g.jsx("span",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin inline-block"}):g.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:g.jsx("path",{d:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"})})})]})})]}),k&&g.jsxs("div",{className:"flex-1 flex flex-col h-full overflow-hidden animate-[slide-in-right_0.2s_ease-out]",children:[g.jsxs("div",{className:"shrink-0 border-b border-slate-800 px-5 py-3 flex items-center justify-between",children:[g.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[g.jsx("span",{className:"text-sm font-semibold text-slate-200 shrink-0",children:vz(m)}),g.jsx("span",{className:"text-[10px] text-slate-500 font-mono truncate",children:m.command.replace(/^npx\s+firegraph\s+/,"")})]}),g.jsx("button",{onClick:x,className:"p-1.5 text-slate-400 hover:text-slate-200 transition-colors shrink-0 ml-3",title:"Close artifact",children:g.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:g.jsx("path",{d:"M1 1l12 12M13 1L1 13"})})})]}),g.jsx("div",{className:"flex-1 overflow-auto p-5",children:g.jsx(pz,{artifact:m,viewRegistry:e,config:r,onNavigate:z},m.id)})]})]})]}):null}function Ez({message:t,activeArtifactId:e,onArtifactClick:r}){var a;return t.role==="user"?g.jsx("div",{className:"flex justify-end",children:g.jsx("div",{className:"bg-indigo-600/20 border border-indigo-500/20 rounded-xl px-4 py-3 max-w-[80%]",children:g.jsx("p",{className:"text-sm text-slate-200 whitespace-pre-wrap break-words",children:t.content})})}):t.role==="error"?g.jsx("div",{className:"flex justify-start",children:g.jsx("div",{className:"bg-red-500/10 border border-red-500/20 rounded-xl px-4 py-3 max-w-[80%]",children:g.jsx("p",{className:"text-sm text-red-400 whitespace-pre-wrap break-words",children:t.content})})}):g.jsxs("div",{className:"flex flex-col gap-2 items-start",children:[(t.content||t.streaming)&&g.jsx("div",{className:"bg-slate-800/40 border border-slate-700/40 rounded-xl px-4 py-3 max-w-[85%]",children:g.jsxs("pre",{className:"text-sm text-slate-300 whitespace-pre-wrap break-words font-sans leading-relaxed",children:[t.content,t.streaming&&!t.activeToolCall&&g.jsx("span",{className:"inline-block w-1.5 h-4 bg-emerald-400 animate-pulse ml-0.5 align-text-bottom rounded-sm"})]})}),t.activeToolCall&&g.jsx("div",{className:"bg-slate-800/40 border border-amber-500/20 rounded-xl px-4 py-3 max-w-[85%]",children:g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"w-3 h-3 border-2 border-amber-400 border-t-transparent rounded-full animate-spin shrink-0"}),g.jsx("span",{className:"text-xs text-amber-400 font-mono truncate",children:t.activeToolCall.replace(/^npx\s+firegraph\s+/,"")})]})}),(a=t.artifacts)==null?void 0:a.map(i=>{const{icon:s,label:o,detail:u}=tD(i),d=e===i.id;return g.jsx("button",{onClick:()=>r(i),className:`w-full max-w-[85%] text-left bg-slate-800/60 border rounded-xl px-4 py-3
410
+ transition-all hover:bg-slate-700/60 hover:border-indigo-500/50 group
411
+ ${d?"border-indigo-500/60 ring-1 ring-indigo-500/30":"border-slate-700/50"}`,children:g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"text-indigo-400 text-sm shrink-0",children:s}),g.jsx("span",{className:"text-sm font-medium text-slate-200 truncate",children:o}),g.jsx("span",{className:"text-xs text-slate-500 ml-auto shrink-0",children:u})]})},i.id)})]})}function Tz({schema:t,config:e,viewRegistry:r,warnings:a=[],children:i}){const s=r??{nodes:{},edges:{},collections:{},hasViews:!1};return g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"flex h-screen overflow-hidden",children:[g.jsx(Ik,{schema:t,config:e,viewRegistry:r}),g.jsxs("main",{className:"flex-1 overflow-auto relative",children:[g.jsx(Vk,{}),g.jsx(Fk,{warnings:a}),i]})]}),g.jsx(Sz,{schema:t,viewRegistry:s,config:e})]})}function Cz({schema:t,config:e}){const r=e.collection,i=(t.collections??[]).filter(o=>!o.path.includes("/")),s=!!r||i.length>0;return g.jsxs("div",{className:"p-6 max-w-4xl mx-auto",children:[g.jsxs("div",{className:"mb-6",children:[g.jsx("h1",{className:"text-xl font-bold text-slate-300",children:"Firegraph"}),g.jsx("p",{className:"text-sm text-slate-400 mt-1",children:e.projectId})]}),!s&&g.jsx("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-8 text-center",children:g.jsx("p",{className:"text-sm text-slate-400",children:"No graph collection or collections configured."})}),g.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[r&&g.jsxs(Qt,{to:`/${ya(r)}`,className:"block px-5 py-4 bg-slate-900 border border-slate-800 rounded-xl hover:border-indigo-500/40 transition-colors group",children:[g.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[g.jsx("svg",{className:"w-4 h-4 text-indigo-400 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4"})}),g.jsx("span",{className:"text-sm font-semibold text-slate-200 group-hover:text-indigo-300 transition-colors",children:r})]}),g.jsxs("p",{className:"text-xs text-slate-500",children:["Graph · ",t.nodeTypes.length," node type",t.nodeTypes.length!==1?"s":"",", ",t.edgeTypes.length," edge type",t.edgeTypes.length!==1?"s":""]})]}),i.map(o=>g.jsxs(Qt,{to:`/${ya(o.path)}`,className:"block px-5 py-4 bg-slate-900 border border-slate-800 rounded-xl hover:border-amber-500/30 transition-colors group",children:[g.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[g.jsx("svg",{className:"w-4 h-4 text-amber-400/70 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),g.jsx("span",{className:"text-sm font-semibold text-slate-200 group-hover:text-amber-300 transition-colors",children:o.name})]}),o.description&&g.jsx("p",{className:"text-xs text-slate-500",children:o.description})]},o.name))]})]})}function EE({schema:t,viewRegistry:e,config:r,onDataChanged:a,typeParam:i}){const{scopedPath:s,scopeNamesPath:o}=ba(),u=on(),[d,f]=q.useState(!1),h=i??"",p=!t.readonly,m=q.useMemo(()=>{const y=t.nodeSchemas??[];return t.nodeTypes.filter(x=>{const E=y.find(w=>w.aType===x.type&&w.isNodeEntry);return zT(o,E==null?void 0:E.allowedIn)})},[t.nodeTypes,t.nodeSchemas,o]);return h?g.jsxs("div",{className:"p-6 max-w-6xl mx-auto",children:[g.jsxs("div",{className:"mb-4",children:[g.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[g.jsx("h1",{className:"text-xl font-bold",children:h}),g.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-mono ${nr(h)}`,children:"node"}),p&&!d&&g.jsxs("button",{onClick:()=>f(!0),className:"ml-auto px-3 py-1.5 bg-indigo-600 text-white rounded-lg text-xs font-medium hover:bg-indigo-500 transition-colors flex items-center gap-1.5",children:[g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),"Create ",h]})]}),g.jsxs("p",{className:"text-sm text-slate-400",children:["Browse all ",g.jsx("strong",{children:h})," nodes"]})]}),d&&g.jsx("div",{className:"mb-6",children:g.jsx(FN,{schema:t,defaultType:h,onSaved:y=>{f(!1),a==null||a(),u(s(`/node/${encodeURIComponent(y)}`))},onCancel:()=>f(!1)})}),g.jsx(HN,{type:h,schema:t,viewRegistry:e,config:r})]}):g.jsxs("div",{className:"p-6 max-w-6xl mx-auto",children:[g.jsxs("div",{className:"mb-4",children:[g.jsx("h1",{className:"text-xl font-bold text-slate-300",children:"Graph"}),g.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"Select a node type from the sidebar to browse."})]}),m.length>0&&g.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3",children:m.map(y=>g.jsx("button",{onClick:()=>u(s(`/browse/${encodeURIComponent(y.type)}`)),className:"block w-full text-left px-4 py-3 bg-slate-900 border border-slate-800 rounded-xl hover:border-indigo-500/40 transition-colors",children:g.jsx("span",{className:`inline-block px-2 py-0.5 rounded text-xs font-mono mb-1 ${nr(y.type)}`,children:y.type})},y.type))})]})}function Nz({viewRegistry:t,schema:e}){if(!t||!t.hasViews)return g.jsxs("div",{className:"p-6 max-w-6xl mx-auto",children:[g.jsx("h1",{className:"text-xl font-bold mb-2",children:"Views"}),g.jsxs("p",{className:"text-sm text-slate-400",children:["No views configured. Use ",g.jsx("code",{className:"text-slate-300",children:"--views <path>"})," to load a views file."]})]});const r=Object.entries(t.nodes).filter(([,s])=>s.views.length>0),a=Object.entries(t.edges).filter(([,s])=>s.views.length>0),i=Object.entries(t.collections??{}).filter(([,s])=>s.views.length>0);return g.jsxs("div",{className:"p-6 max-w-6xl mx-auto",children:[g.jsxs("div",{className:"mb-6",children:[g.jsx("h1",{className:"text-xl font-bold mb-1",children:"View Gallery"}),g.jsx("p",{className:"text-sm text-slate-400",children:"Preview all registered views with sample data"})]}),r.length>0&&g.jsxs("section",{className:"mb-8",children:[g.jsx("h2",{className:"text-sm font-semibold mb-4 uppercase tracking-wider text-slate-500",children:"Node Views"}),g.jsx("div",{className:"space-y-6",children:r.map(([s,o])=>g.jsx(bg,{entityType:s,meta:o,kind:"node"},s))})]}),a.length>0&&g.jsxs("section",{className:"mb-8",children:[g.jsx("h2",{className:"text-sm font-semibold mb-4 uppercase tracking-wider text-slate-500",children:"Edge Views"}),g.jsx("div",{className:"space-y-6",children:a.map(([s,o])=>g.jsx(bg,{entityType:s,meta:o,kind:"edge"},s))})]}),i.length>0&&g.jsxs("section",{children:[g.jsx("h2",{className:"text-sm font-semibold mb-4 uppercase tracking-wider text-slate-500",children:"Collection Views"}),g.jsx("div",{className:"space-y-6",children:i.map(([s,o])=>g.jsx(bg,{entityType:s,meta:o,kind:"collection"},s))})]})]})}function bg({entityType:t,meta:e,kind:r}){const a=e.sampleData??{},[i,s]=q.useState(JSON.stringify(a,null,2)),[o,u]=q.useState(a),[d,f]=q.useState(null),[h,p]=q.useState(!1),m=y=>{s(y);try{const x=JSON.parse(y);u(x),f(null)}catch{f("Invalid JSON")}};return g.jsxs("div",{className:"bg-slate-900 rounded-xl border border-slate-800 p-5",children:[g.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[g.jsx("span",{className:"px-2 py-0.5 rounded text-xs font-mono bg-indigo-500/15 text-indigo-400",children:r}),g.jsx("h3",{className:"text-sm font-semibold",children:t}),g.jsxs("span",{className:"text-slate-500 text-xs",children:["(",e.views.length," view",e.views.length!==1?"s":"",")"]}),g.jsx("button",{onClick:()=>p(!h),className:"ml-auto text-xs text-slate-400 hover:text-slate-200 transition-colors",children:h?"Hide data editor":"Edit sample data"})]}),h&&g.jsxs("div",{className:"mb-4",children:[g.jsx("label",{className:"block text-xs text-slate-500 mb-1",children:"Sample Data (JSON)"}),g.jsx("textarea",{value:i,onChange:y=>m(y.target.value),rows:6,className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs font-mono text-slate-200 focus:outline-none focus:border-indigo-500 resize-y"}),d&&g.jsx("p",{className:"text-xs text-red-400 mt-1",children:d})]}),g.jsx("div",{className:`grid gap-4 ${e.views.length===1?"grid-cols-1":"grid-cols-1 md:grid-cols-2"}`,children:e.views.map(y=>g.jsxs("div",{className:"bg-slate-950 rounded-lg p-4",children:[g.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[g.jsx("span",{className:"text-xs font-semibold text-slate-300",children:y.viewName}),y.description&&g.jsx("span",{className:"text-[10px] text-slate-500",children:y.description}),g.jsxs("span",{className:"ml-auto text-[10px] text-slate-600 font-mono",children:["<",y.tagName,">"]})]}),g.jsx(Jn,{tagName:y.tagName,data:o})]},y.tagName))})]})}function $N({collectionDef:t,params:e,docId:r}){const a=aa(an(t.path,e)),i=t.path.split("/").filter(Boolean);return g.jsxs("nav",{className:"flex items-center gap-0.5 text-xs flex-wrap",children:[g.jsx("svg",{className:"w-3.5 h-3.5 text-amber-500/70 shrink-0 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),i.map((s,o)=>{const u=o===i.length-1,d=s.match(/^\{(.+)\}$/),f=o>0?g.jsx("span",{className:"text-slate-700 mx-0.5",children:"/"}):null;if(d){const h=d[1],p=e[h],m=i.slice(0,o).map(y=>{const x=y.match(/^\{(.+)\}$/);return x?e[x[1]]??y:y}).join("/");return g.jsxs("span",{className:"flex items-center",children:[f,p?g.jsx(Qt,{to:aa(m,`node/${encodeURIComponent(p)}`),className:"text-indigo-400 hover:text-indigo-300 font-mono transition-colors",title:`${h}: ${p}`,children:p.length>16?`${p.slice(0,14)}…`:p}):g.jsx("span",{className:"text-slate-600 font-mono",children:`{${h}}`})]},o)}return u&&r?g.jsxs("span",{className:"flex items-center",children:[f,g.jsx(Qt,{to:a,className:"text-amber-400 hover:text-amber-300 font-medium transition-colors",children:s})]},o):g.jsxs("span",{className:"flex items-center",children:[f,g.jsx("span",{className:"text-slate-500",children:s})]},o)}),r&&g.jsxs("span",{className:"flex items-center",children:[g.jsx("span",{className:"text-slate-700 mx-0.5",children:"/"}),g.jsx("span",{className:"text-slate-300 font-mono",title:r,children:r.length>16?`${r.slice(0,14)}…`:r})]})]})}function YN({collectionDef:t,params:e,existingDoc:r,onSaved:a,onCancel:i}){const s=!!r,[o,u]=q.useState((r==null?void 0:r.data)??{}),[d,f]=q.useState(r?JSON.stringify(r.data,null,2):"{}"),[h,p]=q.useState(null),[m,y]=q.useState(null),x=xt.createCollectionDoc.useMutation({onSuccess:N=>a(N.id),onError:N=>y(N.message)}),E=xt.updateCollectionDoc.useMutation({onSuccess:()=>a(r.id),onError:N=>y(N.message)}),w=x.isPending||E.isPending,T=t.hasSchema&&t.fields.length>0,C=()=>{y(null);let N;if(T)N=o;else try{N=JSON.parse(d),p(null)}catch{p("Invalid JSON");return}s?E.mutate({collectionName:t.name,params:e,docId:r.id,data:N}):x.mutate({collectionName:t.name,params:e,data:N})};return g.jsxs("div",{className:"bg-slate-900 rounded-xl border border-slate-800 p-5",children:[g.jsx("h2",{className:"text-sm font-semibold mb-1",children:s?`Edit Document: ${r.id}`:`New Document in ${t.name}`}),t.description&&g.jsx("p",{className:"text-xs text-slate-500 mb-4",children:t.description}),g.jsx("div",{className:"mb-5",children:T?g.jsx(oc,{fields:t.fields,values:o,onChange:u}):g.jsxs("div",{children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:"Data (JSON)"}),g.jsx("textarea",{value:d,onChange:N=>{f(N.target.value),p(null)},rows:10,className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs font-mono text-slate-200 focus:outline-none focus:border-indigo-500 transition-colors resize-y",spellCheck:!1}),h&&g.jsx("p",{className:"mt-1 text-xs text-red-400",children:h})]})}),m&&g.jsx("div",{className:"mb-4 px-3 py-2 bg-red-500/10 border border-red-500/30 rounded-lg text-xs text-red-400",children:m}),g.jsxs("div",{className:"flex gap-2",children:[g.jsx("button",{onClick:C,disabled:w,className:"px-4 py-2 bg-indigo-600 hover:bg-indigo-500 disabled:opacity-50 text-white rounded-lg text-xs font-medium transition-colors",children:w?"Saving...":s?"Save Changes":"Create Document"}),g.jsx("button",{onClick:i,disabled:w,className:"px-4 py-2 bg-slate-800 hover:bg-slate-700 disabled:opacity-50 text-slate-300 rounded-lg text-xs font-medium transition-colors",children:"Cancel"})]})]})}const jz=["==","!=","<","<=",">",">="];function Az(t){if(t==="true")return!0;if(t==="false")return!1;const e=Number(t);return!isNaN(e)&&t!==""?e:t}function Mz({collectionDef:t,params:e,readonly:r}){const a=on(),[i,s]=q.useState(!1),[o,u]=q.useState(void 0),[d,f]=q.useState([]),[h,p]=q.useState(!1),{addRecent:m}=rh(),y=JSON.stringify(e);q.useEffect(()=>{u(void 0)},[t.name,y]),q.useEffect(()=>{f([]),p(!1)},[t.name]),q.useEffect(()=>{u(void 0)},[d]);const x=t.pathParams.filter(k=>!e[k]),[E,w]=q.useState(Object.fromEntries(t.pathParams.map(k=>[k,e[k]??""])));q.useEffect(()=>{w(Object.fromEntries(t.pathParams.map(k=>[k,e[k]??""])))},[t.name]);const T=x.length===0||x.every(k=>{var B;return(B=E[k])==null?void 0:B.trim()}),C={...e,...E},N=d.filter(k=>k.field&&k.value!==""),{data:A,isLoading:D,error:M,refetch:j}=xt.getCollectionDocs.useQuery({collectionName:t.name,params:C,cursor:o,limit:50,...N.length>0?{where:N}:{}},{enabled:T});if(q.useEffect(()=>{T&&m({type:"collection",label:t.name,sublabel:an(t.path,C),url:aa(an(t.path,C))})},[t.name,y]),x.length>0){const k=B=>{if(B.preventDefault(),!x.every(U=>{var R;return(R=E[U])==null?void 0:R.trim()}))return;const P={...e};for(const U of x)P[U]=E[U];a(aa(an(t.path,P)))};return g.jsxs("div",{className:"p-6 max-w-lg",children:[g.jsxs("div",{className:"mb-4",children:[g.jsx("h2",{className:"text-sm font-semibold text-slate-200",children:t.name}),t.description&&g.jsx("p",{className:"text-xs text-slate-500 mt-1",children:t.description}),g.jsx("p",{className:"text-xs text-slate-500 mt-1 font-mono",children:t.path})]}),g.jsxs("form",{onSubmit:k,className:"space-y-3",children:[x.map(B=>g.jsxs("div",{children:[g.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:B}),g.jsx("input",{type:"text",value:E[B]??"",onChange:P=>w(U=>({...U,[B]:P.target.value})),placeholder:`Enter ${B}...`,className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-xs text-slate-200 placeholder:text-slate-500 focus:outline-none focus:border-indigo-500 transition-colors"})]},B)),g.jsx("button",{type:"submit",disabled:!x.every(B=>{var P;return(P=E[B])==null?void 0:P.trim()}),className:"px-4 py-2 bg-indigo-600 hover:bg-indigo-500 disabled:opacity-50 text-white rounded-lg text-xs font-medium transition-colors",children:"Browse"})]})]})}return g.jsxs("div",{className:"p-6 max-w-6xl mx-auto",children:[g.jsxs("div",{className:"mb-4",children:[g.jsx("div",{className:"mb-1.5",children:g.jsx($N,{collectionDef:t,params:C})}),g.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[g.jsx("h1",{className:"text-xl font-bold",children:t.name}),g.jsx("span",{className:"px-2 py-0.5 rounded text-xs font-mono bg-amber-500/15 text-amber-400",children:"collection"}),!r&&!i&&g.jsxs("button",{onClick:()=>s(!0),className:"ml-auto flex items-center gap-1.5 px-3 py-1.5 bg-indigo-600 hover:bg-indigo-500 text-white rounded-lg text-xs font-medium transition-colors",children:[g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),"New Document"]})]}),t.description&&g.jsx("p",{className:"text-sm text-slate-400",children:t.description})]}),i&&g.jsx("div",{className:"mb-6",children:g.jsx(YN,{collectionDef:t,params:C,onSaved:k=>{s(!1),j(),a(aa(an(t.path,C),`doc/${encodeURIComponent(k)}`))},onCancel:()=>s(!1)})}),g.jsxs("section",{className:"bg-slate-900 rounded-xl border border-slate-800",children:[g.jsxs("div",{className:"px-5 py-3 border-b border-slate-800",children:[g.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[g.jsxs("button",{onClick:()=>p(!h),className:`px-2 py-1 rounded text-xs flex items-center gap-1.5 transition-colors ${h||d.length>0?"bg-indigo-600/20 text-indigo-400 border border-indigo-500/30":"bg-slate-800 border border-slate-700 text-slate-300 hover:bg-slate-700"}`,children:[g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z"})}),"Filters",N.length>0&&g.jsx("span",{className:"bg-indigo-500 text-white text-[10px] w-4 h-4 rounded-full inline-flex items-center justify-center font-bold",children:N.length})]}),N.length>0&&!h&&g.jsxs(g.Fragment,{children:[d.map((k,B)=>!k.field||k.value===""?null:g.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 bg-indigo-600/20 text-indigo-300 rounded text-xs",children:[k.field," ",k.op," ",g.jsx("span",{className:"text-indigo-200",children:String(k.value)}),g.jsx("button",{onClick:()=>f(P=>P.filter((U,R)=>R!==B)),className:"ml-0.5 text-indigo-400 hover:text-indigo-200",children:"×"})]},B)),g.jsx("button",{onClick:()=>f([]),className:"text-[10px] text-slate-500 hover:text-slate-300 transition-colors",children:"Clear all"})]})]}),h&&g.jsx("div",{className:"mt-2",children:g.jsx(kz,{filters:d,onFiltersChange:f,fieldMetas:t.fields})})]}),g.jsxs("div",{className:"overflow-auto",children:[D&&g.jsx("div",{className:"flex items-center justify-center py-12",children:g.jsx("div",{className:"w-6 h-6 border-2 border-indigo-500 border-t-transparent rounded-full animate-spin"})}),M&&g.jsx("div",{className:"px-5 py-4 text-sm text-red-400",children:M.message}),A&&A.documents.length===0&&g.jsxs("div",{className:"px-5 py-8 text-center text-xs text-slate-500",children:["No documents found",N.length>0&&g.jsx("span",{className:"block mt-1",children:"(try adjusting or clearing filters)"}),t.typeField&&N.length===0&&g.jsxs("span",{className:"block mt-1",children:["(filtered by ",t.typeField," = ",String(t.typeValue),")"]})]}),A&&A.documents.length>0&&g.jsxs("table",{className:"w-full min-w-[480px] text-xs",children:[g.jsx("thead",{className:"sticky top-0 bg-slate-900 border-b border-slate-800",children:g.jsxs("tr",{children:[g.jsx("th",{className:"px-5 py-2 text-left text-[10px] uppercase tracking-wider text-slate-500 font-semibold w-48",children:"ID"}),t.fields.slice(0,3).map(k=>g.jsx("th",{className:"px-4 py-2 text-left text-[10px] uppercase tracking-wider text-slate-500 font-semibold",children:k.name},k.name)),t.fields.length===0&&g.jsx("th",{className:"px-4 py-2 text-left text-[10px] uppercase tracking-wider text-slate-500 font-semibold",children:"Data"})]})}),g.jsx("tbody",{className:"divide-y divide-slate-800/50",children:A.documents.map(k=>g.jsxs("tr",{className:"hover:bg-slate-800/30 transition-colors cursor-pointer",children:[g.jsx("td",{className:"px-5 py-2.5",children:g.jsx(Qt,{to:aa(an(t.path,C),`doc/${encodeURIComponent(k.id)}`),className:"text-indigo-400 hover:text-indigo-300 font-mono transition-colors",children:k.id.length>16?`${k.id.slice(0,14)}…`:k.id})}),t.fields.slice(0,3).map(B=>g.jsx("td",{className:"px-4 py-2.5 text-slate-400 truncate max-w-xs",children:k.data[B.name]!==void 0?String(k.data[B.name]):g.jsx("span",{className:"text-slate-600",children:"—"})},B.name)),t.fields.length===0&&g.jsx("td",{className:"px-4 py-2.5 text-slate-600 font-mono text-[10px] truncate max-w-xs",children:PT(k.data,60)})]},k.id))})]})]}),(A==null?void 0:A.hasMore)&&g.jsx("div",{className:"px-5 py-3 border-t border-slate-800",children:g.jsx("button",{onClick:()=>u(A.nextCursor??void 0),className:"text-xs text-indigo-400 hover:text-indigo-300 transition-colors",children:"Load more →"})})]})]})}function kz({filters:t,onFiltersChange:e,fieldMetas:r}){const a=r.map(d=>d.name),i=t.filter(d=>d.field&&d.value!=="").length,s=()=>{var p;const d=a[0]??"",f=r.find(m=>m.name===d);let h="";(f==null?void 0:f.type)==="boolean"?h=!0:(f==null?void 0:f.type)==="enum"&&((p=f.enumValues)!=null&&p.length)&&(h=f.enumValues[0]),e([...t,{field:d,op:"==",value:h}])},o=(d,f)=>{const h=[...t];h[d]={...h[d],...f},e(h)},u=d=>{e(t.filter((f,h)=>h!==d))};return g.jsxs("div",{className:"border-t border-slate-700/50 pt-2 space-y-1.5",children:[g.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[g.jsx("span",{className:"text-[10px] uppercase tracking-wider text-slate-500 font-semibold",children:"Where"}),g.jsx("span",{className:"text-[10px] text-slate-600",children:t.length===0?'No filters — click "Add filter" to start':i>0?`${i} active filter${i>1?"s":""}${t.length>i?` (${t.length-i} incomplete)`:""}`:`${t.length} filter${t.length>1?"s":""} (none active yet)`}),t.length>0&&g.jsx("button",{onClick:()=>e([]),className:"text-[10px] text-red-400/60 hover:text-red-400 transition-colors ml-auto",children:"Clear all"})]}),t.map((d,f)=>g.jsx(Dz,{index:f,clause:d,fieldMetas:r,fieldNames:a,onUpdate:h=>o(f,h),onRemove:()=>u(f)},f)),g.jsxs("button",{onClick:s,className:"flex items-center gap-1.5 text-[11px] text-indigo-400 hover:text-indigo-300 transition-colors py-1",children:[g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),"Add filter"]})]})}function Dz({index:t,clause:e,fieldMetas:r,fieldNames:a,onUpdate:i,onRemove:s}){var E;const o=r.find(w=>w.name===e.field),[u,d]=q.useState(String(e.value)),f=q.useRef(null);q.useEffect(()=>{d(String(e.value))},[e.value]);const h=()=>{const w=Az(u.trim());w!==e.value&&i({value:w})},p=w=>{var N;const T=r.find(A=>A.name===w);let C="";(T==null?void 0:T.type)==="boolean"?C=!0:(T==null?void 0:T.type)==="enum"&&((N=T.enumValues)!=null&&N.length)&&(C=T.enumValues[0]),i({field:w,value:C}),d(String(C))},m=(o==null?void 0:o.type)==="enum"&&((E=o.enumValues)==null?void 0:E.length),y=(o==null?void 0:o.type)==="boolean",x=m||y;return g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("span",{className:"text-[10px] text-slate-600 w-8 shrink-0 text-right",children:t===0?"":"AND"}),a.length>0?g.jsx("select",{value:e.field,onChange:w=>p(w.target.value),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-[11px] text-slate-200 focus:outline-none focus:border-indigo-500",children:a.map(w=>g.jsx("option",{value:w,children:w},w))}):g.jsx("input",{type:"text",value:e.field,onChange:w=>i({field:w.target.value}),placeholder:"field",className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-[11px] text-slate-200 placeholder:text-slate-600 focus:outline-none focus:border-indigo-500 w-28"}),g.jsx("select",{value:e.op,onChange:w=>i({op:w.target.value}),className:"bg-slate-800 border border-slate-700 rounded px-1.5 py-1 text-[11px] text-slate-200 focus:outline-none focus:border-indigo-500 w-14",children:jz.map(w=>g.jsx("option",{value:w,children:w},w))}),m?g.jsx("select",{value:String(e.value),onChange:w=>i({value:w.target.value}),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-[11px] text-slate-200 focus:outline-none focus:border-indigo-500",children:o.enumValues.map(w=>g.jsx("option",{value:w,children:w},w))}):y?g.jsxs("select",{value:String(e.value),onChange:w=>i({value:w.target.value==="true"}),className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-[11px] text-slate-200 focus:outline-none focus:border-indigo-500",children:[g.jsx("option",{value:"true",children:"true"}),g.jsx("option",{value:"false",children:"false"})]}):g.jsx("input",{ref:f,type:"text",value:u,onChange:w=>d(w.target.value),onBlur:h,onKeyDown:w=>{var T;w.key==="Enter"&&(h(),(T=f.current)==null||T.blur())},placeholder:"value (Enter to apply)",className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-[11px] text-slate-200 placeholder:text-slate-600 focus:outline-none focus:border-indigo-500 w-36"}),o&&g.jsx("span",{className:"text-[9px] text-slate-600 shrink-0",children:o.type}),!x&&u!==String(e.value)&&u.trim()!==""&&g.jsx("span",{className:"text-[9px] text-amber-500 shrink-0",title:"Press Enter to apply",children:"pending"}),g.jsx("button",{onClick:s,className:"text-slate-600 hover:text-red-400 transition-colors p-0.5 shrink-0",title:"Remove filter",children:g.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})}function Oz({collectionDef:t,docId:e,params:r,readonly:a,viewRegistry:i}){var N,A;const s=on(),[o,u]=q.useState(!1),[d,f]=q.useState(!1),[h,p]=q.useState("json"),{addRecent:m}=rh();q.useEffect(()=>{p("json")},[e,t.name]);const y=((A=(N=i==null?void 0:i.collections)==null?void 0:N[t.name])==null?void 0:A.views)??[],{data:x,isLoading:E,error:w,refetch:T}=xt.getCollectionDoc.useQuery({collectionName:t.name,params:r,docId:e});q.useEffect(()=>{x&&m({type:"collection-doc",label:e,sublabel:t.name,url:aa(an(t.path,r),`doc/${encodeURIComponent(e)}`)})},[e,t.name]);const C=xt.deleteCollectionDoc.useMutation({onSuccess:()=>{s(aa(an(t.path,r)))},onError:D=>alert(`Delete failed: ${D.message}`)});return E?g.jsx("div",{className:"flex items-center justify-center py-12",children:g.jsx("div",{className:"w-6 h-6 border-2 border-indigo-500 border-t-transparent rounded-full animate-spin"})}):w?g.jsx("div",{className:"px-6 py-4 text-sm text-red-400",children:w.message}):x?g.jsxs("div",{className:"p-6 max-w-6xl mx-auto",children:[g.jsxs("div",{className:"mb-6",children:[g.jsx("div",{className:"mb-3",children:g.jsx($N,{collectionDef:t,params:r,docId:e})}),g.jsxs("div",{className:"flex items-start justify-between gap-4",children:[g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[g.jsx("span",{className:"px-2 py-0.5 rounded text-xs font-mono bg-amber-500/20 text-amber-400 shrink-0",children:t.name}),g.jsx("h1",{className:"text-xl font-bold font-mono text-slate-200",children:e})]}),g.jsx("p",{className:"text-xs text-slate-500 font-mono",children:an(t.path,r)})]}),!a&&!o&&g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsxs("button",{onClick:()=>u(!0),className:"flex items-center gap-1.5 px-3 py-1.5 bg-slate-800 hover:bg-slate-700 text-slate-300 rounded-lg text-xs font-medium transition-colors",children:[g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})}),"Edit"]}),d?g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("span",{className:"text-xs text-slate-400",children:"Confirm?"}),g.jsx("button",{onClick:()=>C.mutate({collectionName:t.name,params:r,docId:e}),disabled:C.isPending,className:"px-2 py-1 bg-red-600 hover:bg-red-500 disabled:opacity-50 text-white rounded text-xs transition-colors",children:C.isPending?"...":"Yes, delete"}),g.jsx("button",{onClick:()=>f(!1),className:"px-2 py-1 bg-slate-800 hover:bg-slate-700 text-slate-400 rounded text-xs transition-colors",children:"Cancel"})]}):g.jsxs("button",{onClick:()=>f(!0),className:"flex items-center gap-1.5 px-3 py-1.5 bg-red-600/20 hover:bg-red-600/30 text-red-400 rounded-lg text-xs font-medium transition-colors",children:[g.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),"Delete"]})]})]})]}),o?g.jsx("div",{className:"mb-6",children:g.jsx(YN,{collectionDef:t,params:r,existingDoc:{id:x.id,data:x.data},onSaved:()=>{u(!1),T()},onCancel:()=>u(!1)})}):g.jsxs("section",{className:"bg-slate-900 rounded-xl border border-slate-800 p-5",children:[g.jsxs("div",{className:"flex items-center justify-between mb-4",children:[g.jsx("h2",{className:"text-sm font-semibold text-slate-200",children:"Data"}),y.length>0&&g.jsx(Ao,{views:y,activeView:h,onSwitch:p})]}),h!=="json"?g.jsx(Jn,{tagName:h,data:x.data,onError:()=>p("json")}):g.jsx(g.Fragment,{children:t.fields.length>0?g.jsxs("div",{children:[t.fields.map(D=>g.jsxs("div",{className:"flex gap-3 py-2 border-b border-slate-800/50",children:[g.jsx("span",{className:"text-xs text-slate-500 w-36 shrink-0 font-mono",children:D.name}),g.jsx("span",{className:"text-xs text-slate-300 break-all",children:x.data[D.name]!==void 0?typeof x.data[D.name]=="object"?g.jsx("code",{className:"text-[10px] font-mono text-slate-400",children:JSON.stringify(x.data[D.name])}):String(x.data[D.name]):g.jsx("span",{className:"text-slate-600",children:"—"})})]},D.name)),Object.entries(x.data).filter(([D])=>!t.fields.some(M=>M.name===D)).map(([D,M])=>g.jsxs("div",{className:"flex gap-3 py-2 border-b border-slate-800/50",children:[g.jsx("span",{className:"text-xs text-slate-600 w-36 shrink-0 font-mono",children:D}),g.jsx("span",{className:"text-xs text-slate-500 break-all",children:typeof M=="object"?g.jsx("code",{className:"text-[10px] font-mono",children:JSON.stringify(M)}):String(M)})]},D))]}):g.jsx(Oa,{data:x.data})})]})]}):null}function Rz(){const{data:t,error:e,isLoading:r}=xt.getSchema.useQuery(),{data:a,error:i,isLoading:s}=xt.getConfig.useQuery(),{data:o,error:u,isLoading:d}=xt.getViews.useQuery(),{data:f}=xt.getWarnings.useQuery(),h=r||s||d,p=e||i||u,m=q.useRef(0),y=q.useCallback(()=>{if(o!=null&&o.hasViews&&!document.querySelector('script[src="/api/views/bundle"]')){const E=document.createElement("script");E.type="module",E.src="/api/views/bundle",document.head.appendChild(E)}},[o]);if(o&&!h&&y(),q.useEffect(()=>{if(!(t!=null&&t.dynamicMode)||!(o!=null&&o.hasViews))return;const E=document.querySelector("script[data-dynamic-views]");E&&E.remove(),m.current++;const w=document.createElement("script");return w.type="module",w.src=`/api/views/dynamic-bundle?v=${m.current}`,w.setAttribute("data-dynamic-views","true"),document.head.appendChild(w),()=>{w.remove()}},[t,o]),h)return g.jsx("div",{className:"flex items-center justify-center h-screen",children:g.jsxs("div",{className:"text-center",children:[g.jsx("div",{className:"w-8 h-8 border-2 border-indigo-500 border-t-transparent rounded-full animate-spin mx-auto mb-4"}),g.jsx("p",{className:"text-slate-400",children:"Connecting to Firestore..."})]})});if(p)return g.jsx("div",{className:"flex items-center justify-center h-screen",children:g.jsxs("div",{className:"bg-slate-900 border border-red-500/30 rounded-xl p-8 max-w-lg",children:[g.jsx("h2",{className:"text-red-400 text-lg font-semibold mb-2",children:"Connection Error"}),g.jsx("p",{className:"text-slate-300 text-sm mb-4",children:p.message}),g.jsxs("p",{className:"text-slate-500 text-xs mb-4",children:["Make sure you have ADC configured (run ",g.jsx("code",{className:"text-slate-300",children:"gcloud auth application-default login"}),") and the server is running with the correct --project, --collection, and --registry flags."]}),g.jsx("button",{onClick:()=>window.location.reload(),className:"px-4 py-2 bg-indigo-600 text-white rounded-lg text-sm hover:bg-indigo-500 transition-colors",children:"Retry"})]})});const x=o??{nodes:{},edges:{},collections:{},hasViews:!1};return g.jsx(Ck,{children:g.jsx(Yk,{chatEnabled:(a==null?void 0:a.chatEnabled)??!1,children:g.jsx(Xk,{children:g.jsx(Wk,{children:g.jsx(Dk,{children:g.jsx(Tz,{schema:t,config:a,viewRegistry:x,warnings:(f==null?void 0:f.warnings)??[],children:g.jsxs(iA,{children:[g.jsx(Sg,{path:"/",element:g.jsx(Cz,{schema:t,config:a})}),g.jsx(Sg,{path:"/:encodedPath/*",element:g.jsx(Ok,{graphCollection:a==null?void 0:a.collection,collections:t==null?void 0:t.collections,children:g.jsx(Bz,{schema:t,viewRegistry:x,config:a})})})]})})})})})})})}function Bz({schema:t,viewRegistry:e,config:r}){const{"*":a=""}=Sm(),{pathType:i,collectionMatch:s}=FT(),o=a?`/${a}`:"";if(i==="graph"){const u=o.match(/^\/browse\/(.+)$/),d=o.match(/^\/node\/(.+)$/);return u?g.jsx(EE,{schema:t,viewRegistry:e,config:r,typeParam:decodeURIComponent(u[1])}):d?g.jsx(cz,{schema:t,viewRegistry:e,config:r,uidParam:decodeURIComponent(d[1])}):o==="/traverse"?g.jsx(QP,{schema:t}):o==="/views"?g.jsx(Nz,{viewRegistry:e,schema:t}):g.jsx(EE,{schema:t,viewRegistry:e,config:r,typeParam:""})}if(i==="collection"&&s){const u=o.match(/^\/doc\/(.+)$/);return u?g.jsx(Oz,{collectionDef:s.collection,docId:decodeURIComponent(u[1]),params:s.params,readonly:r.readonly,viewRegistry:e}):g.jsx(Mz,{collectionDef:s.collection,params:s.params,readonly:r.readonly})}return g.jsx("div",{className:"p-6 max-w-4xl mx-auto",children:g.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-8 text-center",children:[g.jsx("h2",{className:"text-lg font-semibold mb-2 text-slate-300",children:"Unknown Path"}),g.jsx("p",{className:"text-sm text-slate-400",children:"This Firestore path doesn't match any configured graph or collection."})]})})}function Lz(){const[t]=q.useState(()=>new IA({defaultOptions:{queries:{staleTime:3e4,refetchOnWindowFocus:!1}}})),[e]=q.useState(()=>xt.createClient({links:[_M({url:"/api/trpc"})]}));return g.jsx(xt.Provider,{client:e,queryClient:t,children:g.jsx(VA,{client:t,children:g.jsx(fA,{children:g.jsx(Rz,{})})})})}h4.createRoot(document.getElementById("root")).render(g.jsx(zE.StrictMode,{children:g.jsx(Lz,{})}));