wicked-crew 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,420 @@
1
+ var KC=Object.defineProperty;var QC=(t,e,r)=>e in t?KC(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var r0=(t,e,r)=>QC(t,typeof e!="symbol"?e+"":e,r);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(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"&&n(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 n(i){if(i.ep)return;i.ep=!0;const s=r(i);fetch(i.href,s)}})();function Uc(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var qf={exports:{}},Oo={},Yf={exports:{}},_t={};/**
2
+ * @license React
3
+ * react.production.min.js
4
+ *
5
+ * Copyright (c) Facebook, Inc. and its 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 n0;function ZC(){if(n0)return _t;n0=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),o=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),u=Symbol.for("react.memo"),c=Symbol.for("react.lazy"),h=Symbol.iterator;function g(F){return F===null||typeof F!="object"?null:(F=h&&F[h]||F["@@iterator"],typeof F=="function"?F:null)}var p={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,w={};function v(F,G,$){this.props=F,this.context=G,this.refs=w,this.updater=$||p}v.prototype.isReactComponent={},v.prototype.setState=function(F,G){if(typeof F!="object"&&typeof F!="function"&&F!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,F,G,"setState")},v.prototype.forceUpdate=function(F){this.updater.enqueueForceUpdate(this,F,"forceUpdate")};function m(){}m.prototype=v.prototype;function y(F,G,$){this.props=F,this.context=G,this.refs=w,this.updater=$||p}var b=y.prototype=new m;b.constructor=y,x(b,v.prototype),b.isPureReactComponent=!0;var _=Array.isArray,R=Object.prototype.hasOwnProperty,E={current:null},T={key:!0,ref:!0,__self:!0,__source:!0};function k(F,G,$){var ee,re={},ne=null,Y=null;if(G!=null)for(ee in G.ref!==void 0&&(Y=G.ref),G.key!==void 0&&(ne=""+G.key),G)R.call(G,ee)&&!T.hasOwnProperty(ee)&&(re[ee]=G[ee]);var q=arguments.length-2;if(q===1)re.children=$;else if(1<q){for(var K=Array(q),X=0;X<q;X++)K[X]=arguments[X+2];re.children=K}if(F&&F.defaultProps)for(ee in q=F.defaultProps,q)re[ee]===void 0&&(re[ee]=q[ee]);return{$$typeof:t,type:F,key:ne,ref:Y,props:re,_owner:E.current}}function N(F,G){return{$$typeof:t,type:F.type,key:G,ref:F.ref,props:F.props,_owner:F._owner}}function M(F){return typeof F=="object"&&F!==null&&F.$$typeof===t}function B(F){var G={"=":"=0",":":"=2"};return"$"+F.replace(/[=:]/g,function($){return G[$]})}var A=/\/+/g;function j(F,G){return typeof F=="object"&&F!==null&&F.key!=null?B(""+F.key):G.toString(36)}function D(F,G,$,ee,re){var ne=typeof F;(ne==="undefined"||ne==="boolean")&&(F=null);var Y=!1;if(F===null)Y=!0;else switch(ne){case"string":case"number":Y=!0;break;case"object":switch(F.$$typeof){case t:case e:Y=!0}}if(Y)return Y=F,re=re(Y),F=ee===""?"."+j(Y,0):ee,_(re)?($="",F!=null&&($=F.replace(A,"$&/")+"/"),D(re,G,$,"",function(X){return X})):re!=null&&(M(re)&&(re=N(re,$+(!re.key||Y&&Y.key===re.key?"":(""+re.key).replace(A,"$&/")+"/")+F)),G.push(re)),1;if(Y=0,ee=ee===""?".":ee+":",_(F))for(var q=0;q<F.length;q++){ne=F[q];var K=ee+j(ne,q);Y+=D(ne,G,$,K,re)}else if(K=g(F),typeof K=="function")for(F=K.call(F),q=0;!(ne=F.next()).done;)ne=ne.value,K=ee+j(ne,q++),Y+=D(ne,G,$,K,re);else if(ne==="object")throw G=String(F),Error("Objects are not valid as a React child (found: "+(G==="[object Object]"?"object with keys {"+Object.keys(F).join(", ")+"}":G)+"). If you meant to render a collection of children, use an array instead.");return Y}function I(F,G,$){if(F==null)return F;var ee=[],re=0;return D(F,ee,"","",function(ne){return G.call($,ne,re++)}),ee}function U(F){if(F._status===-1){var G=F._result;G=G(),G.then(function($){(F._status===0||F._status===-1)&&(F._status=1,F._result=$)},function($){(F._status===0||F._status===-1)&&(F._status=2,F._result=$)}),F._status===-1&&(F._status=0,F._result=G)}if(F._status===1)return F._result.default;throw F._result}var W={current:null},H={transition:null},z={ReactCurrentDispatcher:W,ReactCurrentBatchConfig:H,ReactCurrentOwner:E};function P(){throw Error("act(...) is not supported in production builds of React.")}return _t.Children={map:I,forEach:function(F,G,$){I(F,function(){G.apply(this,arguments)},$)},count:function(F){var G=0;return I(F,function(){G++}),G},toArray:function(F){return I(F,function(G){return G})||[]},only:function(F){if(!M(F))throw Error("React.Children.only expected to receive a single React element child.");return F}},_t.Component=v,_t.Fragment=r,_t.Profiler=i,_t.PureComponent=y,_t.StrictMode=n,_t.Suspense=l,_t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=z,_t.act=P,_t.cloneElement=function(F,G,$){if(F==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+F+".");var ee=x({},F.props),re=F.key,ne=F.ref,Y=F._owner;if(G!=null){if(G.ref!==void 0&&(ne=G.ref,Y=E.current),G.key!==void 0&&(re=""+G.key),F.type&&F.type.defaultProps)var q=F.type.defaultProps;for(K in G)R.call(G,K)&&!T.hasOwnProperty(K)&&(ee[K]=G[K]===void 0&&q!==void 0?q[K]:G[K])}var K=arguments.length-2;if(K===1)ee.children=$;else if(1<K){q=Array(K);for(var X=0;X<K;X++)q[X]=arguments[X+2];ee.children=q}return{$$typeof:t,type:F.type,key:re,ref:ne,props:ee,_owner:Y}},_t.createContext=function(F){return F={$$typeof:o,_currentValue:F,_currentValue2:F,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},F.Provider={$$typeof:s,_context:F},F.Consumer=F},_t.createElement=k,_t.createFactory=function(F){var G=k.bind(null,F);return G.type=F,G},_t.createRef=function(){return{current:null}},_t.forwardRef=function(F){return{$$typeof:a,render:F}},_t.isValidElement=M,_t.lazy=function(F){return{$$typeof:c,_payload:{_status:-1,_result:F},_init:U}},_t.memo=function(F,G){return{$$typeof:u,type:F,compare:G===void 0?null:G}},_t.startTransition=function(F){var G=H.transition;H.transition={};try{F()}finally{H.transition=G}},_t.unstable_act=P,_t.useCallback=function(F,G){return W.current.useCallback(F,G)},_t.useContext=function(F){return W.current.useContext(F)},_t.useDebugValue=function(){},_t.useDeferredValue=function(F){return W.current.useDeferredValue(F)},_t.useEffect=function(F,G){return W.current.useEffect(F,G)},_t.useId=function(){return W.current.useId()},_t.useImperativeHandle=function(F,G,$){return W.current.useImperativeHandle(F,G,$)},_t.useInsertionEffect=function(F,G){return W.current.useInsertionEffect(F,G)},_t.useLayoutEffect=function(F,G){return W.current.useLayoutEffect(F,G)},_t.useMemo=function(F,G){return W.current.useMemo(F,G)},_t.useReducer=function(F,G,$){return W.current.useReducer(F,G,$)},_t.useRef=function(F){return W.current.useRef(F)},_t.useState=function(F){return W.current.useState(F)},_t.useSyncExternalStore=function(F,G,$){return W.current.useSyncExternalStore(F,G,$)},_t.useTransition=function(){return W.current.useTransition()},_t.version="18.3.1",_t}var i0;function jv(){return i0||(i0=1,Yf.exports=ZC()),Yf.exports}/**
10
+ * @license React
11
+ * react-jsx-runtime.production.min.js
12
+ *
13
+ * Copyright (c) Facebook, Inc. and its 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 a0;function JC(){if(a0)return Oo;a0=1;var t=jv(),e=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(a,l,u){var c,h={},g=null,p=null;u!==void 0&&(g=""+u),l.key!==void 0&&(g=""+l.key),l.ref!==void 0&&(p=l.ref);for(c in l)n.call(l,c)&&!s.hasOwnProperty(c)&&(h[c]=l[c]);if(a&&a.defaultProps)for(c in l=a.defaultProps,l)h[c]===void 0&&(h[c]=l[c]);return{$$typeof:e,type:a,key:g,ref:p,props:h,_owner:i.current}}return Oo.Fragment=r,Oo.jsx=o,Oo.jsxs=o,Oo}var s0;function eE(){return s0||(s0=1,qf.exports=JC()),qf.exports}var C=eE(),ae=jv();const Bu=Uc(ae);var Fu={},Xf={exports:{}},nn={},Kf={exports:{}},Qf={};/**
18
+ * @license React
19
+ * scheduler.production.min.js
20
+ *
21
+ * Copyright (c) Facebook, Inc. and its 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 o0;function tE(){return o0||(o0=1,(function(t){function e(H,z){var P=H.length;H.push(z);e:for(;0<P;){var F=P-1>>>1,G=H[F];if(0<i(G,z))H[F]=z,H[P]=G,P=F;else break e}}function r(H){return H.length===0?null:H[0]}function n(H){if(H.length===0)return null;var z=H[0],P=H.pop();if(P!==z){H[0]=P;e:for(var F=0,G=H.length,$=G>>>1;F<$;){var ee=2*(F+1)-1,re=H[ee],ne=ee+1,Y=H[ne];if(0>i(re,P))ne<G&&0>i(Y,re)?(H[F]=Y,H[ne]=P,F=ne):(H[F]=re,H[ee]=P,F=ee);else if(ne<G&&0>i(Y,P))H[F]=Y,H[ne]=P,F=ne;else break e}}return z}function i(H,z){var P=H.sortIndex-z.sortIndex;return P!==0?P:H.id-z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var l=[],u=[],c=1,h=null,g=3,p=!1,x=!1,w=!1,v=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function b(H){for(var z=r(u);z!==null;){if(z.callback===null)n(u);else if(z.startTime<=H)n(u),z.sortIndex=z.expirationTime,e(l,z);else break;z=r(u)}}function _(H){if(w=!1,b(H),!x)if(r(l)!==null)x=!0,U(R);else{var z=r(u);z!==null&&W(_,z.startTime-H)}}function R(H,z){x=!1,w&&(w=!1,m(k),k=-1),p=!0;var P=g;try{for(b(z),h=r(l);h!==null&&(!(h.expirationTime>z)||H&&!B());){var F=h.callback;if(typeof F=="function"){h.callback=null,g=h.priorityLevel;var G=F(h.expirationTime<=z);z=t.unstable_now(),typeof G=="function"?h.callback=G:h===r(l)&&n(l),b(z)}else n(l);h=r(l)}if(h!==null)var $=!0;else{var ee=r(u);ee!==null&&W(_,ee.startTime-z),$=!1}return $}finally{h=null,g=P,p=!1}}var E=!1,T=null,k=-1,N=5,M=-1;function B(){return!(t.unstable_now()-M<N)}function A(){if(T!==null){var H=t.unstable_now();M=H;var z=!0;try{z=T(!0,H)}finally{z?j():(E=!1,T=null)}}else E=!1}var j;if(typeof y=="function")j=function(){y(A)};else if(typeof MessageChannel<"u"){var D=new MessageChannel,I=D.port2;D.port1.onmessage=A,j=function(){I.postMessage(null)}}else j=function(){v(A,0)};function U(H){T=H,E||(E=!0,j())}function W(H,z){k=v(function(){H(t.unstable_now())},z)}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(H){H.callback=null},t.unstable_continueExecution=function(){x||p||(x=!0,U(R))},t.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):N=0<H?Math.floor(1e3/H):5},t.unstable_getCurrentPriorityLevel=function(){return g},t.unstable_getFirstCallbackNode=function(){return r(l)},t.unstable_next=function(H){switch(g){case 1:case 2:case 3:var z=3;break;default:z=g}var P=g;g=z;try{return H()}finally{g=P}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(H,z){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var P=g;g=H;try{return z()}finally{g=P}},t.unstable_scheduleCallback=function(H,z,P){var F=t.unstable_now();switch(typeof P=="object"&&P!==null?(P=P.delay,P=typeof P=="number"&&0<P?F+P:F):P=F,H){case 1:var G=-1;break;case 2:G=250;break;case 5:G=1073741823;break;case 4:G=1e4;break;default:G=5e3}return G=P+G,H={id:c++,callback:z,priorityLevel:H,startTime:P,expirationTime:G,sortIndex:-1},P>F?(H.sortIndex=P,e(u,H),r(l)===null&&H===r(u)&&(w?(m(k),k=-1):w=!0,W(_,P-F))):(H.sortIndex=G,e(l,H),x||p||(x=!0,U(R))),H},t.unstable_shouldYield=B,t.unstable_wrapCallback=function(H){var z=g;return function(){var P=g;g=z;try{return H.apply(this,arguments)}finally{g=P}}}})(Qf)),Qf}var l0;function rE(){return l0||(l0=1,Kf.exports=tE()),Kf.exports}/**
26
+ * @license React
27
+ * react-dom.production.min.js
28
+ *
29
+ * Copyright (c) Facebook, Inc. and its 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 u0;function nE(){if(u0)return nn;u0=1;var t=jv(),e=rE();function r(f){for(var d="https://reactjs.org/docs/error-decoder.html?invariant="+f,S=1;S<arguments.length;S++)d+="&args[]="+encodeURIComponent(arguments[S]);return"Minified React error #"+f+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var n=new Set,i={};function s(f,d){o(f,d),o(f+"Capture",d)}function o(f,d){for(i[f]=d,f=0;f<d.length;f++)n.add(d[f])}var a=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),l=Object.prototype.hasOwnProperty,u=/^[: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]*$/,c={},h={};function g(f){return l.call(h,f)?!0:l.call(c,f)?!1:u.test(f)?h[f]=!0:(c[f]=!0,!1)}function p(f,d,S,L){if(S!==null&&S.type===0)return!1;switch(typeof d){case"function":case"symbol":return!0;case"boolean":return L?!1:S!==null?!S.acceptsBooleans:(f=f.toLowerCase().slice(0,5),f!=="data-"&&f!=="aria-");default:return!1}}function x(f,d,S,L){if(d===null||typeof d>"u"||p(f,d,S,L))return!0;if(L)return!1;if(S!==null)switch(S.type){case 3:return!d;case 4:return d===!1;case 5:return isNaN(d);case 6:return isNaN(d)||1>d}return!1}function w(f,d,S,L,O,V,Q){this.acceptsBooleans=d===2||d===3||d===4,this.attributeName=L,this.attributeNamespace=O,this.mustUseProperty=S,this.propertyName=f,this.type=d,this.sanitizeURL=V,this.removeEmptyString=Q}var v={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(f){v[f]=new w(f,0,!1,f,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(f){var d=f[0];v[d]=new w(d,1,!1,f[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(f){v[f]=new w(f,2,!1,f.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(f){v[f]=new w(f,2,!1,f,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(f){v[f]=new w(f,3,!1,f.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(f){v[f]=new w(f,3,!0,f,null,!1,!1)}),["capture","download"].forEach(function(f){v[f]=new w(f,4,!1,f,null,!1,!1)}),["cols","rows","size","span"].forEach(function(f){v[f]=new w(f,6,!1,f,null,!1,!1)}),["rowSpan","start"].forEach(function(f){v[f]=new w(f,5,!1,f.toLowerCase(),null,!1,!1)});var m=/[\-:]([a-z])/g;function y(f){return f[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(f){var d=f.replace(m,y);v[d]=new w(d,1,!1,f,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(f){var d=f.replace(m,y);v[d]=new w(d,1,!1,f,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(f){var d=f.replace(m,y);v[d]=new w(d,1,!1,f,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(f){v[f]=new w(f,1,!1,f.toLowerCase(),null,!1,!1)}),v.xlinkHref=new w("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(f){v[f]=new w(f,1,!1,f.toLowerCase(),null,!0,!0)});function b(f,d,S,L){var O=v.hasOwnProperty(d)?v[d]:null;(O!==null?O.type!==0:L||!(2<d.length)||d[0]!=="o"&&d[0]!=="O"||d[1]!=="n"&&d[1]!=="N")&&(x(d,S,O,L)&&(S=null),L||O===null?g(d)&&(S===null?f.removeAttribute(d):f.setAttribute(d,""+S)):O.mustUseProperty?f[O.propertyName]=S===null?O.type===3?!1:"":S:(d=O.attributeName,L=O.attributeNamespace,S===null?f.removeAttribute(d):(O=O.type,S=O===3||O===4&&S===!0?"":""+S,L?f.setAttributeNS(L,d,S):f.setAttribute(d,S))))}var _=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,R=Symbol.for("react.element"),E=Symbol.for("react.portal"),T=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),N=Symbol.for("react.profiler"),M=Symbol.for("react.provider"),B=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),j=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),I=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),W=Symbol.for("react.offscreen"),H=Symbol.iterator;function z(f){return f===null||typeof f!="object"?null:(f=H&&f[H]||f["@@iterator"],typeof f=="function"?f:null)}var P=Object.assign,F;function G(f){if(F===void 0)try{throw Error()}catch(S){var d=S.stack.trim().match(/\n( *(at )?)/);F=d&&d[1]||""}return`
34
+ `+F+f}var $=!1;function ee(f,d){if(!f||$)return"";$=!0;var S=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(d)if(d=function(){throw Error()},Object.defineProperty(d.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(d,[])}catch(we){var L=we}Reflect.construct(f,[],d)}else{try{d.call()}catch(we){L=we}f.call(d.prototype)}else{try{throw Error()}catch(we){L=we}f()}}catch(we){if(we&&L&&typeof we.stack=="string"){for(var O=we.stack.split(`
35
+ `),V=L.stack.split(`
36
+ `),Q=O.length-1,le=V.length-1;1<=Q&&0<=le&&O[Q]!==V[le];)le--;for(;1<=Q&&0<=le;Q--,le--)if(O[Q]!==V[le]){if(Q!==1||le!==1)do if(Q--,le--,0>le||O[Q]!==V[le]){var fe=`
37
+ `+O[Q].replace(" at new "," at ");return f.displayName&&fe.includes("<anonymous>")&&(fe=fe.replace("<anonymous>",f.displayName)),fe}while(1<=Q&&0<=le);break}}}finally{$=!1,Error.prepareStackTrace=S}return(f=f?f.displayName||f.name:"")?G(f):""}function re(f){switch(f.tag){case 5:return G(f.type);case 16:return G("Lazy");case 13:return G("Suspense");case 19:return G("SuspenseList");case 0:case 2:case 15:return f=ee(f.type,!1),f;case 11:return f=ee(f.type.render,!1),f;case 1:return f=ee(f.type,!0),f;default:return""}}function ne(f){if(f==null)return null;if(typeof f=="function")return f.displayName||f.name||null;if(typeof f=="string")return f;switch(f){case T:return"Fragment";case E:return"Portal";case N:return"Profiler";case k:return"StrictMode";case j:return"Suspense";case D:return"SuspenseList"}if(typeof f=="object")switch(f.$$typeof){case B:return(f.displayName||"Context")+".Consumer";case M:return(f._context.displayName||"Context")+".Provider";case A:var d=f.render;return f=f.displayName,f||(f=d.displayName||d.name||"",f=f!==""?"ForwardRef("+f+")":"ForwardRef"),f;case I:return d=f.displayName||null,d!==null?d:ne(f.type)||"Memo";case U:d=f._payload,f=f._init;try{return ne(f(d))}catch{}}return null}function Y(f){var d=f.type;switch(f.tag){case 24:return"Cache";case 9:return(d.displayName||"Context")+".Consumer";case 10:return(d._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return f=d.render,f=f.displayName||f.name||"",d.displayName||(f!==""?"ForwardRef("+f+")":"ForwardRef");case 7:return"Fragment";case 5:return d;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ne(d);case 8:return d===k?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof d=="function")return d.displayName||d.name||null;if(typeof d=="string")return d}return null}function q(f){switch(typeof f){case"boolean":case"number":case"string":case"undefined":return f;case"object":return f;default:return""}}function K(f){var d=f.type;return(f=f.nodeName)&&f.toLowerCase()==="input"&&(d==="checkbox"||d==="radio")}function X(f){var d=K(f)?"checked":"value",S=Object.getOwnPropertyDescriptor(f.constructor.prototype,d),L=""+f[d];if(!f.hasOwnProperty(d)&&typeof S<"u"&&typeof S.get=="function"&&typeof S.set=="function"){var O=S.get,V=S.set;return Object.defineProperty(f,d,{configurable:!0,get:function(){return O.call(this)},set:function(Q){L=""+Q,V.call(this,Q)}}),Object.defineProperty(f,d,{enumerable:S.enumerable}),{getValue:function(){return L},setValue:function(Q){L=""+Q},stopTracking:function(){f._valueTracker=null,delete f[d]}}}}function J(f){f._valueTracker||(f._valueTracker=X(f))}function ie(f){if(!f)return!1;var d=f._valueTracker;if(!d)return!0;var S=d.getValue(),L="";return f&&(L=K(f)?f.checked?"true":"false":f.value),f=L,f!==S?(d.setValue(f),!0):!1}function ce(f){if(f=f||(typeof document<"u"?document:void 0),typeof f>"u")return null;try{return f.activeElement||f.body}catch{return f.body}}function de(f,d){var S=d.checked;return P({},d,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:S??f._wrapperState.initialChecked})}function Le(f,d){var S=d.defaultValue==null?"":d.defaultValue,L=d.checked!=null?d.checked:d.defaultChecked;S=q(d.value!=null?d.value:S),f._wrapperState={initialChecked:L,initialValue:S,controlled:d.type==="checkbox"||d.type==="radio"?d.checked!=null:d.value!=null}}function je(f,d){d=d.checked,d!=null&&b(f,"checked",d,!1)}function _e(f,d){je(f,d);var S=q(d.value),L=d.type;if(S!=null)L==="number"?(S===0&&f.value===""||f.value!=S)&&(f.value=""+S):f.value!==""+S&&(f.value=""+S);else if(L==="submit"||L==="reset"){f.removeAttribute("value");return}d.hasOwnProperty("value")?Ne(f,d.type,S):d.hasOwnProperty("defaultValue")&&Ne(f,d.type,q(d.defaultValue)),d.checked==null&&d.defaultChecked!=null&&(f.defaultChecked=!!d.defaultChecked)}function ke(f,d,S){if(d.hasOwnProperty("value")||d.hasOwnProperty("defaultValue")){var L=d.type;if(!(L!=="submit"&&L!=="reset"||d.value!==void 0&&d.value!==null))return;d=""+f._wrapperState.initialValue,S||d===f.value||(f.value=d),f.defaultValue=d}S=f.name,S!==""&&(f.name=""),f.defaultChecked=!!f._wrapperState.initialChecked,S!==""&&(f.name=S)}function Ne(f,d,S){(d!=="number"||ce(f.ownerDocument)!==f)&&(S==null?f.defaultValue=""+f._wrapperState.initialValue:f.defaultValue!==""+S&&(f.defaultValue=""+S))}var Ee=Array.isArray;function Me(f,d,S,L){if(f=f.options,d){d={};for(var O=0;O<S.length;O++)d["$"+S[O]]=!0;for(S=0;S<f.length;S++)O=d.hasOwnProperty("$"+f[S].value),f[S].selected!==O&&(f[S].selected=O),O&&L&&(f[S].defaultSelected=!0)}else{for(S=""+q(S),d=null,O=0;O<f.length;O++){if(f[O].value===S){f[O].selected=!0,L&&(f[O].defaultSelected=!0);return}d!==null||f[O].disabled||(d=f[O])}d!==null&&(d.selected=!0)}}function Pe(f,d){if(d.dangerouslySetInnerHTML!=null)throw Error(r(91));return P({},d,{value:void 0,defaultValue:void 0,children:""+f._wrapperState.initialValue})}function De(f,d){var S=d.value;if(S==null){if(S=d.children,d=d.defaultValue,S!=null){if(d!=null)throw Error(r(92));if(Ee(S)){if(1<S.length)throw Error(r(93));S=S[0]}d=S}d==null&&(d=""),S=d}f._wrapperState={initialValue:q(S)}}function Ue(f,d){var S=q(d.value),L=q(d.defaultValue);S!=null&&(S=""+S,S!==f.value&&(f.value=S),d.defaultValue==null&&f.defaultValue!==S&&(f.defaultValue=S)),L!=null&&(f.defaultValue=""+L)}function Ye(f){var d=f.textContent;d===f._wrapperState.initialValue&&d!==""&&d!==null&&(f.value=d)}function ge(f){switch(f){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Ce(f,d){return f==null||f==="http://www.w3.org/1999/xhtml"?ge(d):f==="http://www.w3.org/2000/svg"&&d==="foreignObject"?"http://www.w3.org/1999/xhtml":f}var Ae,Be=(function(f){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(d,S,L,O){MSApp.execUnsafeLocalFunction(function(){return f(d,S,L,O)})}:f})(function(f,d){if(f.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in f)f.innerHTML=d;else{for(Ae=Ae||document.createElement("div"),Ae.innerHTML="<svg>"+d.valueOf().toString()+"</svg>",d=Ae.firstChild;f.firstChild;)f.removeChild(f.firstChild);for(;d.firstChild;)f.appendChild(d.firstChild)}});function me(f,d){if(d){var S=f.firstChild;if(S&&S===f.lastChild&&S.nodeType===3){S.nodeValue=d;return}}f.textContent=d}var Z={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},te=["Webkit","ms","Moz","O"];Object.keys(Z).forEach(function(f){te.forEach(function(d){d=d+f.charAt(0).toUpperCase()+f.substring(1),Z[d]=Z[f]})});function oe(f,d,S){return d==null||typeof d=="boolean"||d===""?"":S||typeof d!="number"||d===0||Z.hasOwnProperty(f)&&Z[f]?(""+d).trim():d+"px"}function ue(f,d){f=f.style;for(var S in d)if(d.hasOwnProperty(S)){var L=S.indexOf("--")===0,O=oe(S,d[S],L);S==="float"&&(S="cssFloat"),L?f.setProperty(S,O):f[S]=O}}var se=P({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function he(f,d){if(d){if(se[f]&&(d.children!=null||d.dangerouslySetInnerHTML!=null))throw Error(r(137,f));if(d.dangerouslySetInnerHTML!=null){if(d.children!=null)throw Error(r(60));if(typeof d.dangerouslySetInnerHTML!="object"||!("__html"in d.dangerouslySetInnerHTML))throw Error(r(61))}if(d.style!=null&&typeof d.style!="object")throw Error(r(62))}}function pe(f,d){if(f.indexOf("-")===-1)return typeof d.is=="string";switch(f){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 be=null;function Se(f){return f=f.target||f.srcElement||window,f.correspondingUseElement&&(f=f.correspondingUseElement),f.nodeType===3?f.parentNode:f}var Te=null,Re=null,ze=null;function Fe(f){if(f=wo(f)){if(typeof Te!="function")throw Error(r(280));var d=f.stateNode;d&&(d=Zl(d),Te(f.stateNode,f.type,d))}}function Ge(f){Re?ze?ze.push(f):ze=[f]:Re=f}function it(){if(Re){var f=Re,d=ze;if(ze=Re=null,Fe(f),d)for(f=0;f<d.length;f++)Fe(d[f])}}function Ze(f,d){return f(d)}function qe(){}var pt=!1;function Qe(f,d,S){if(pt)return f(d,S);pt=!0;try{return Ze(f,d,S)}finally{pt=!1,(Re!==null||ze!==null)&&(qe(),it())}}function Ke(f,d){var S=f.stateNode;if(S===null)return null;var L=Zl(S);if(L===null)return null;S=L[d];e:switch(d){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(L=!L.disabled)||(f=f.type,L=!(f==="button"||f==="input"||f==="select"||f==="textarea")),f=!L;break e;default:f=!1}if(f)return null;if(S&&typeof S!="function")throw Error(r(231,d,typeof S));return S}var xt=!1;if(a)try{var st={};Object.defineProperty(st,"passive",{get:function(){xt=!0}}),window.addEventListener("test",st,st),window.removeEventListener("test",st,st)}catch{xt=!1}function vt(f,d,S,L,O,V,Q,le,fe){var we=Array.prototype.slice.call(arguments,3);try{d.apply(S,we)}catch(Oe){this.onError(Oe)}}var yt=!1,Rt=null,It=!1,kt=null,Tr={onError:function(f){yt=!0,Rt=f}};function Pr(f,d,S,L,O,V,Q,le,fe){yt=!1,Rt=null,vt.apply(Tr,arguments)}function ur(f,d,S,L,O,V,Q,le,fe){if(Pr.apply(this,arguments),yt){if(yt){var we=Rt;yt=!1,Rt=null}else throw Error(r(198));It||(It=!0,kt=we)}}function At(f){var d=f,S=f;if(f.alternate)for(;d.return;)d=d.return;else{f=d;do d=f,(d.flags&4098)!==0&&(S=d.return),f=d.return;while(f)}return d.tag===3?S:null}function Kt(f){if(f.tag===13){var d=f.memoizedState;if(d===null&&(f=f.alternate,f!==null&&(d=f.memoizedState)),d!==null)return d.dehydrated}return null}function Vr(f){if(At(f)!==f)throw Error(r(188))}function ir(f){var d=f.alternate;if(!d){if(d=At(f),d===null)throw Error(r(188));return d!==f?null:f}for(var S=f,L=d;;){var O=S.return;if(O===null)break;var V=O.alternate;if(V===null){if(L=O.return,L!==null){S=L;continue}break}if(O.child===V.child){for(V=O.child;V;){if(V===S)return Vr(O),f;if(V===L)return Vr(O),d;V=V.sibling}throw Error(r(188))}if(S.return!==L.return)S=O,L=V;else{for(var Q=!1,le=O.child;le;){if(le===S){Q=!0,S=O,L=V;break}if(le===L){Q=!0,L=O,S=V;break}le=le.sibling}if(!Q){for(le=V.child;le;){if(le===S){Q=!0,S=V,L=O;break}if(le===L){Q=!0,L=V,S=O;break}le=le.sibling}if(!Q)throw Error(r(189))}}if(S.alternate!==L)throw Error(r(190))}if(S.tag!==3)throw Error(r(188));return S.stateNode.current===S?f:d}function Un(f){return f=ir(f),f!==null?Nn(f):null}function Nn(f){if(f.tag===5||f.tag===6)return f;for(f=f.child;f!==null;){var d=Nn(f);if(d!==null)return d;f=f.sibling}return null}var Dn=e.unstable_scheduleCallback,ca=e.unstable_cancelCallback,ha=e.unstable_shouldYield,$a=e.unstable_requestPaint,zt=e.unstable_now,eo=e.unstable_getCurrentPriorityLevel,un=e.unstable_ImmediatePriority,ii=e.unstable_UserBlockingPriority,xn=e.unstable_NormalPriority,bi=e.unstable_LowPriority,wi=e.unstable_IdlePriority,Qt=null,rt=null;function Et(f){if(rt&&typeof rt.onCommitFiberRoot=="function")try{rt.onCommitFiberRoot(Qt,f,void 0,(f.current.flags&128)===128)}catch{}}var er=Math.clz32?Math.clz32:fh,cr=Math.log,cn=Math.LN2;function fh(f){return f>>>=0,f===0?32:31-(cr(f)/cn|0)|0}var to=64,Ga=4194304;function ro(f){switch(f&-f){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: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 f&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return f&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return f}}function Ol(f,d){var S=f.pendingLanes;if(S===0)return 0;var L=0,O=f.suspendedLanes,V=f.pingedLanes,Q=S&268435455;if(Q!==0){var le=Q&~O;le!==0?L=ro(le):(V&=Q,V!==0&&(L=ro(V)))}else Q=S&~O,Q!==0?L=ro(Q):V!==0&&(L=ro(V));if(L===0)return 0;if(d!==0&&d!==L&&(d&O)===0&&(O=L&-L,V=d&-d,O>=V||O===16&&(V&4194240)!==0))return d;if((L&4)!==0&&(L|=S&16),d=f.entangledLanes,d!==0)for(f=f.entanglements,d&=L;0<d;)S=31-er(d),O=1<<S,L|=f[S],d&=~O;return L}function v2(f,d){switch(f){case 1:case 2:case 4:return d+250;case 8:case 16:case 32:case 64: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 d+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function g2(f,d){for(var S=f.suspendedLanes,L=f.pingedLanes,O=f.expirationTimes,V=f.pendingLanes;0<V;){var Q=31-er(V),le=1<<Q,fe=O[Q];fe===-1?((le&S)===0||(le&L)!==0)&&(O[Q]=v2(le,d)):fe<=d&&(f.expiredLanes|=le),V&=~le}}function dh(f){return f=f.pendingLanes&-1073741825,f!==0?f:f&1073741824?1073741824:0}function Mg(){var f=to;return to<<=1,(to&4194240)===0&&(to=64),f}function ph(f){for(var d=[],S=0;31>S;S++)d.push(f);return d}function no(f,d,S){f.pendingLanes|=d,d!==536870912&&(f.suspendedLanes=0,f.pingedLanes=0),f=f.eventTimes,d=31-er(d),f[d]=S}function m2(f,d){var S=f.pendingLanes&~d;f.pendingLanes=d,f.suspendedLanes=0,f.pingedLanes=0,f.expiredLanes&=d,f.mutableReadLanes&=d,f.entangledLanes&=d,d=f.entanglements;var L=f.eventTimes;for(f=f.expirationTimes;0<S;){var O=31-er(S),V=1<<O;d[O]=0,L[O]=-1,f[O]=-1,S&=~V}}function vh(f,d){var S=f.entangledLanes|=d;for(f=f.entanglements;S;){var L=31-er(S),O=1<<L;O&d|f[L]&d&&(f[L]|=d),S&=~O}}var Ft=0;function Pg(f){return f&=-f,1<f?4<f?(f&268435455)!==0?16:536870912:4:1}var Ig,gh,Og,Bg,Fg,mh=!1,Bl=[],_i=null,Si=null,Ci=null,io=new Map,ao=new Map,Ei=[],y2="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 submit".split(" ");function jg(f,d){switch(f){case"focusin":case"focusout":_i=null;break;case"dragenter":case"dragleave":Si=null;break;case"mouseover":case"mouseout":Ci=null;break;case"pointerover":case"pointerout":io.delete(d.pointerId);break;case"gotpointercapture":case"lostpointercapture":ao.delete(d.pointerId)}}function so(f,d,S,L,O,V){return f===null||f.nativeEvent!==V?(f={blockedOn:d,domEventName:S,eventSystemFlags:L,nativeEvent:V,targetContainers:[O]},d!==null&&(d=wo(d),d!==null&&gh(d)),f):(f.eventSystemFlags|=L,d=f.targetContainers,O!==null&&d.indexOf(O)===-1&&d.push(O),f)}function x2(f,d,S,L,O){switch(d){case"focusin":return _i=so(_i,f,d,S,L,O),!0;case"dragenter":return Si=so(Si,f,d,S,L,O),!0;case"mouseover":return Ci=so(Ci,f,d,S,L,O),!0;case"pointerover":var V=O.pointerId;return io.set(V,so(io.get(V)||null,f,d,S,L,O)),!0;case"gotpointercapture":return V=O.pointerId,ao.set(V,so(ao.get(V)||null,f,d,S,L,O)),!0}return!1}function zg(f){var d=fa(f.target);if(d!==null){var S=At(d);if(S!==null){if(d=S.tag,d===13){if(d=Kt(S),d!==null){f.blockedOn=d,Fg(f.priority,function(){Og(S)});return}}else if(d===3&&S.stateNode.current.memoizedState.isDehydrated){f.blockedOn=S.tag===3?S.stateNode.containerInfo:null;return}}}f.blockedOn=null}function Fl(f){if(f.blockedOn!==null)return!1;for(var d=f.targetContainers;0<d.length;){var S=xh(f.domEventName,f.eventSystemFlags,d[0],f.nativeEvent);if(S===null){S=f.nativeEvent;var L=new S.constructor(S.type,S);be=L,S.target.dispatchEvent(L),be=null}else return d=wo(S),d!==null&&gh(d),f.blockedOn=S,!1;d.shift()}return!0}function Hg(f,d,S){Fl(f)&&S.delete(d)}function b2(){mh=!1,_i!==null&&Fl(_i)&&(_i=null),Si!==null&&Fl(Si)&&(Si=null),Ci!==null&&Fl(Ci)&&(Ci=null),io.forEach(Hg),ao.forEach(Hg)}function oo(f,d){f.blockedOn===d&&(f.blockedOn=null,mh||(mh=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,b2)))}function lo(f){function d(O){return oo(O,f)}if(0<Bl.length){oo(Bl[0],f);for(var S=1;S<Bl.length;S++){var L=Bl[S];L.blockedOn===f&&(L.blockedOn=null)}}for(_i!==null&&oo(_i,f),Si!==null&&oo(Si,f),Ci!==null&&oo(Ci,f),io.forEach(d),ao.forEach(d),S=0;S<Ei.length;S++)L=Ei[S],L.blockedOn===f&&(L.blockedOn=null);for(;0<Ei.length&&(S=Ei[0],S.blockedOn===null);)zg(S),S.blockedOn===null&&Ei.shift()}var qa=_.ReactCurrentBatchConfig,jl=!0;function w2(f,d,S,L){var O=Ft,V=qa.transition;qa.transition=null;try{Ft=1,yh(f,d,S,L)}finally{Ft=O,qa.transition=V}}function _2(f,d,S,L){var O=Ft,V=qa.transition;qa.transition=null;try{Ft=4,yh(f,d,S,L)}finally{Ft=O,qa.transition=V}}function yh(f,d,S,L){if(jl){var O=xh(f,d,S,L);if(O===null)Oh(f,d,L,zl,S),jg(f,L);else if(x2(O,f,d,S,L))L.stopPropagation();else if(jg(f,L),d&4&&-1<y2.indexOf(f)){for(;O!==null;){var V=wo(O);if(V!==null&&Ig(V),V=xh(f,d,S,L),V===null&&Oh(f,d,L,zl,S),V===O)break;O=V}O!==null&&L.stopPropagation()}else Oh(f,d,L,null,S)}}var zl=null;function xh(f,d,S,L){if(zl=null,f=Se(L),f=fa(f),f!==null)if(d=At(f),d===null)f=null;else if(S=d.tag,S===13){if(f=Kt(d),f!==null)return f;f=null}else if(S===3){if(d.stateNode.current.memoizedState.isDehydrated)return d.tag===3?d.stateNode.containerInfo:null;f=null}else d!==f&&(f=null);return zl=f,null}function Ug(f){switch(f){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"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 1;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"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(eo()){case un:return 1;case ii:return 4;case xn:case bi:return 16;case wi:return 536870912;default:return 16}default:return 16}}var ki=null,bh=null,Hl=null;function Wg(){if(Hl)return Hl;var f,d=bh,S=d.length,L,O="value"in ki?ki.value:ki.textContent,V=O.length;for(f=0;f<S&&d[f]===O[f];f++);var Q=S-f;for(L=1;L<=Q&&d[S-L]===O[V-L];L++);return Hl=O.slice(f,1<L?1-L:void 0)}function Ul(f){var d=f.keyCode;return"charCode"in f?(f=f.charCode,f===0&&d===13&&(f=13)):f=d,f===10&&(f=13),32<=f||f===13?f:0}function Wl(){return!0}function Vg(){return!1}function hn(f){function d(S,L,O,V,Q){this._reactName=S,this._targetInst=O,this.type=L,this.nativeEvent=V,this.target=Q,this.currentTarget=null;for(var le in f)f.hasOwnProperty(le)&&(S=f[le],this[le]=S?S(V):V[le]);return this.isDefaultPrevented=(V.defaultPrevented!=null?V.defaultPrevented:V.returnValue===!1)?Wl:Vg,this.isPropagationStopped=Vg,this}return P(d.prototype,{preventDefault:function(){this.defaultPrevented=!0;var S=this.nativeEvent;S&&(S.preventDefault?S.preventDefault():typeof S.returnValue!="unknown"&&(S.returnValue=!1),this.isDefaultPrevented=Wl)},stopPropagation:function(){var S=this.nativeEvent;S&&(S.stopPropagation?S.stopPropagation():typeof S.cancelBubble!="unknown"&&(S.cancelBubble=!0),this.isPropagationStopped=Wl)},persist:function(){},isPersistent:Wl}),d}var Ya={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(f){return f.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},wh=hn(Ya),uo=P({},Ya,{view:0,detail:0}),S2=hn(uo),_h,Sh,co,Vl=P({},uo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Eh,button:0,buttons:0,relatedTarget:function(f){return f.relatedTarget===void 0?f.fromElement===f.srcElement?f.toElement:f.fromElement:f.relatedTarget},movementX:function(f){return"movementX"in f?f.movementX:(f!==co&&(co&&f.type==="mousemove"?(_h=f.screenX-co.screenX,Sh=f.screenY-co.screenY):Sh=_h=0,co=f),_h)},movementY:function(f){return"movementY"in f?f.movementY:Sh}}),$g=hn(Vl),C2=P({},Vl,{dataTransfer:0}),E2=hn(C2),k2=P({},uo,{relatedTarget:0}),Ch=hn(k2),T2=P({},Ya,{animationName:0,elapsedTime:0,pseudoElement:0}),R2=hn(T2),L2=P({},Ya,{clipboardData:function(f){return"clipboardData"in f?f.clipboardData:window.clipboardData}}),N2=hn(L2),D2=P({},Ya,{data:0}),Gg=hn(D2),A2={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},M2={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"},P2={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function I2(f){var d=this.nativeEvent;return d.getModifierState?d.getModifierState(f):(f=P2[f])?!!d[f]:!1}function Eh(){return I2}var O2=P({},uo,{key:function(f){if(f.key){var d=A2[f.key]||f.key;if(d!=="Unidentified")return d}return f.type==="keypress"?(f=Ul(f),f===13?"Enter":String.fromCharCode(f)):f.type==="keydown"||f.type==="keyup"?M2[f.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Eh,charCode:function(f){return f.type==="keypress"?Ul(f):0},keyCode:function(f){return f.type==="keydown"||f.type==="keyup"?f.keyCode:0},which:function(f){return f.type==="keypress"?Ul(f):f.type==="keydown"||f.type==="keyup"?f.keyCode:0}}),B2=hn(O2),F2=P({},Vl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),qg=hn(F2),j2=P({},uo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Eh}),z2=hn(j2),H2=P({},Ya,{propertyName:0,elapsedTime:0,pseudoElement:0}),U2=hn(H2),W2=P({},Vl,{deltaX:function(f){return"deltaX"in f?f.deltaX:"wheelDeltaX"in f?-f.wheelDeltaX:0},deltaY:function(f){return"deltaY"in f?f.deltaY:"wheelDeltaY"in f?-f.wheelDeltaY:"wheelDelta"in f?-f.wheelDelta:0},deltaZ:0,deltaMode:0}),V2=hn(W2),$2=[9,13,27,32],kh=a&&"CompositionEvent"in window,ho=null;a&&"documentMode"in document&&(ho=document.documentMode);var G2=a&&"TextEvent"in window&&!ho,Yg=a&&(!kh||ho&&8<ho&&11>=ho),Xg=" ",Kg=!1;function Qg(f,d){switch(f){case"keyup":return $2.indexOf(d.keyCode)!==-1;case"keydown":return d.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Zg(f){return f=f.detail,typeof f=="object"&&"data"in f?f.data:null}var Xa=!1;function q2(f,d){switch(f){case"compositionend":return Zg(d);case"keypress":return d.which!==32?null:(Kg=!0,Xg);case"textInput":return f=d.data,f===Xg&&Kg?null:f;default:return null}}function Y2(f,d){if(Xa)return f==="compositionend"||!kh&&Qg(f,d)?(f=Wg(),Hl=bh=ki=null,Xa=!1,f):null;switch(f){case"paste":return null;case"keypress":if(!(d.ctrlKey||d.altKey||d.metaKey)||d.ctrlKey&&d.altKey){if(d.char&&1<d.char.length)return d.char;if(d.which)return String.fromCharCode(d.which)}return null;case"compositionend":return Yg&&d.locale!=="ko"?null:d.data;default:return null}}var X2={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 Jg(f){var d=f&&f.nodeName&&f.nodeName.toLowerCase();return d==="input"?!!X2[f.type]:d==="textarea"}function em(f,d,S,L){Ge(L),d=Xl(d,"onChange"),0<d.length&&(S=new wh("onChange","change",null,S,L),f.push({event:S,listeners:d}))}var fo=null,po=null;function K2(f){ym(f,0)}function $l(f){var d=es(f);if(ie(d))return f}function Q2(f,d){if(f==="change")return d}var tm=!1;if(a){var Th;if(a){var Rh="oninput"in document;if(!Rh){var rm=document.createElement("div");rm.setAttribute("oninput","return;"),Rh=typeof rm.oninput=="function"}Th=Rh}else Th=!1;tm=Th&&(!document.documentMode||9<document.documentMode)}function nm(){fo&&(fo.detachEvent("onpropertychange",im),po=fo=null)}function im(f){if(f.propertyName==="value"&&$l(po)){var d=[];em(d,po,f,Se(f)),Qe(K2,d)}}function Z2(f,d,S){f==="focusin"?(nm(),fo=d,po=S,fo.attachEvent("onpropertychange",im)):f==="focusout"&&nm()}function J2(f){if(f==="selectionchange"||f==="keyup"||f==="keydown")return $l(po)}function eC(f,d){if(f==="click")return $l(d)}function tC(f,d){if(f==="input"||f==="change")return $l(d)}function rC(f,d){return f===d&&(f!==0||1/f===1/d)||f!==f&&d!==d}var An=typeof Object.is=="function"?Object.is:rC;function vo(f,d){if(An(f,d))return!0;if(typeof f!="object"||f===null||typeof d!="object"||d===null)return!1;var S=Object.keys(f),L=Object.keys(d);if(S.length!==L.length)return!1;for(L=0;L<S.length;L++){var O=S[L];if(!l.call(d,O)||!An(f[O],d[O]))return!1}return!0}function am(f){for(;f&&f.firstChild;)f=f.firstChild;return f}function sm(f,d){var S=am(f);f=0;for(var L;S;){if(S.nodeType===3){if(L=f+S.textContent.length,f<=d&&L>=d)return{node:S,offset:d-f};f=L}e:{for(;S;){if(S.nextSibling){S=S.nextSibling;break e}S=S.parentNode}S=void 0}S=am(S)}}function om(f,d){return f&&d?f===d?!0:f&&f.nodeType===3?!1:d&&d.nodeType===3?om(f,d.parentNode):"contains"in f?f.contains(d):f.compareDocumentPosition?!!(f.compareDocumentPosition(d)&16):!1:!1}function lm(){for(var f=window,d=ce();d instanceof f.HTMLIFrameElement;){try{var S=typeof d.contentWindow.location.href=="string"}catch{S=!1}if(S)f=d.contentWindow;else break;d=ce(f.document)}return d}function Lh(f){var d=f&&f.nodeName&&f.nodeName.toLowerCase();return d&&(d==="input"&&(f.type==="text"||f.type==="search"||f.type==="tel"||f.type==="url"||f.type==="password")||d==="textarea"||f.contentEditable==="true")}function nC(f){var d=lm(),S=f.focusedElem,L=f.selectionRange;if(d!==S&&S&&S.ownerDocument&&om(S.ownerDocument.documentElement,S)){if(L!==null&&Lh(S)){if(d=L.start,f=L.end,f===void 0&&(f=d),"selectionStart"in S)S.selectionStart=d,S.selectionEnd=Math.min(f,S.value.length);else if(f=(d=S.ownerDocument||document)&&d.defaultView||window,f.getSelection){f=f.getSelection();var O=S.textContent.length,V=Math.min(L.start,O);L=L.end===void 0?V:Math.min(L.end,O),!f.extend&&V>L&&(O=L,L=V,V=O),O=sm(S,V);var Q=sm(S,L);O&&Q&&(f.rangeCount!==1||f.anchorNode!==O.node||f.anchorOffset!==O.offset||f.focusNode!==Q.node||f.focusOffset!==Q.offset)&&(d=d.createRange(),d.setStart(O.node,O.offset),f.removeAllRanges(),V>L?(f.addRange(d),f.extend(Q.node,Q.offset)):(d.setEnd(Q.node,Q.offset),f.addRange(d)))}}for(d=[],f=S;f=f.parentNode;)f.nodeType===1&&d.push({element:f,left:f.scrollLeft,top:f.scrollTop});for(typeof S.focus=="function"&&S.focus(),S=0;S<d.length;S++)f=d[S],f.element.scrollLeft=f.left,f.element.scrollTop=f.top}}var iC=a&&"documentMode"in document&&11>=document.documentMode,Ka=null,Nh=null,go=null,Dh=!1;function um(f,d,S){var L=S.window===S?S.document:S.nodeType===9?S:S.ownerDocument;Dh||Ka==null||Ka!==ce(L)||(L=Ka,"selectionStart"in L&&Lh(L)?L={start:L.selectionStart,end:L.selectionEnd}:(L=(L.ownerDocument&&L.ownerDocument.defaultView||window).getSelection(),L={anchorNode:L.anchorNode,anchorOffset:L.anchorOffset,focusNode:L.focusNode,focusOffset:L.focusOffset}),go&&vo(go,L)||(go=L,L=Xl(Nh,"onSelect"),0<L.length&&(d=new wh("onSelect","select",null,d,S),f.push({event:d,listeners:L}),d.target=Ka)))}function Gl(f,d){var S={};return S[f.toLowerCase()]=d.toLowerCase(),S["Webkit"+f]="webkit"+d,S["Moz"+f]="moz"+d,S}var Qa={animationend:Gl("Animation","AnimationEnd"),animationiteration:Gl("Animation","AnimationIteration"),animationstart:Gl("Animation","AnimationStart"),transitionend:Gl("Transition","TransitionEnd")},Ah={},cm={};a&&(cm=document.createElement("div").style,"AnimationEvent"in window||(delete Qa.animationend.animation,delete Qa.animationiteration.animation,delete Qa.animationstart.animation),"TransitionEvent"in window||delete Qa.transitionend.transition);function ql(f){if(Ah[f])return Ah[f];if(!Qa[f])return f;var d=Qa[f],S;for(S in d)if(d.hasOwnProperty(S)&&S in cm)return Ah[f]=d[S];return f}var hm=ql("animationend"),fm=ql("animationiteration"),dm=ql("animationstart"),pm=ql("transitionend"),vm=new Map,gm="abort auxClick 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(" ");function Ti(f,d){vm.set(f,d),s(d,[f])}for(var Mh=0;Mh<gm.length;Mh++){var Ph=gm[Mh],aC=Ph.toLowerCase(),sC=Ph[0].toUpperCase()+Ph.slice(1);Ti(aC,"on"+sC)}Ti(hm,"onAnimationEnd"),Ti(fm,"onAnimationIteration"),Ti(dm,"onAnimationStart"),Ti("dblclick","onDoubleClick"),Ti("focusin","onFocus"),Ti("focusout","onBlur"),Ti(pm,"onTransitionEnd"),o("onMouseEnter",["mouseout","mouseover"]),o("onMouseLeave",["mouseout","mouseover"]),o("onPointerEnter",["pointerout","pointerover"]),o("onPointerLeave",["pointerout","pointerover"]),s("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),s("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),s("onBeforeInput",["compositionend","keypress","textInput","paste"]),s("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),s("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),s("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var mo="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(" "),oC=new Set("cancel close invalid load scroll toggle".split(" ").concat(mo));function mm(f,d,S){var L=f.type||"unknown-event";f.currentTarget=S,ur(L,d,void 0,f),f.currentTarget=null}function ym(f,d){d=(d&4)!==0;for(var S=0;S<f.length;S++){var L=f[S],O=L.event;L=L.listeners;e:{var V=void 0;if(d)for(var Q=L.length-1;0<=Q;Q--){var le=L[Q],fe=le.instance,we=le.currentTarget;if(le=le.listener,fe!==V&&O.isPropagationStopped())break e;mm(O,le,we),V=fe}else for(Q=0;Q<L.length;Q++){if(le=L[Q],fe=le.instance,we=le.currentTarget,le=le.listener,fe!==V&&O.isPropagationStopped())break e;mm(O,le,we),V=fe}}}if(It)throw f=kt,It=!1,kt=null,f}function qt(f,d){var S=d[Uh];S===void 0&&(S=d[Uh]=new Set);var L=f+"__bubble";S.has(L)||(xm(d,f,2,!1),S.add(L))}function Ih(f,d,S){var L=0;d&&(L|=4),xm(S,f,L,d)}var Yl="_reactListening"+Math.random().toString(36).slice(2);function yo(f){if(!f[Yl]){f[Yl]=!0,n.forEach(function(S){S!=="selectionchange"&&(oC.has(S)||Ih(S,!1,f),Ih(S,!0,f))});var d=f.nodeType===9?f:f.ownerDocument;d===null||d[Yl]||(d[Yl]=!0,Ih("selectionchange",!1,d))}}function xm(f,d,S,L){switch(Ug(d)){case 1:var O=w2;break;case 4:O=_2;break;default:O=yh}S=O.bind(null,d,S,f),O=void 0,!xt||d!=="touchstart"&&d!=="touchmove"&&d!=="wheel"||(O=!0),L?O!==void 0?f.addEventListener(d,S,{capture:!0,passive:O}):f.addEventListener(d,S,!0):O!==void 0?f.addEventListener(d,S,{passive:O}):f.addEventListener(d,S,!1)}function Oh(f,d,S,L,O){var V=L;if((d&1)===0&&(d&2)===0&&L!==null)e:for(;;){if(L===null)return;var Q=L.tag;if(Q===3||Q===4){var le=L.stateNode.containerInfo;if(le===O||le.nodeType===8&&le.parentNode===O)break;if(Q===4)for(Q=L.return;Q!==null;){var fe=Q.tag;if((fe===3||fe===4)&&(fe=Q.stateNode.containerInfo,fe===O||fe.nodeType===8&&fe.parentNode===O))return;Q=Q.return}for(;le!==null;){if(Q=fa(le),Q===null)return;if(fe=Q.tag,fe===5||fe===6){L=V=Q;continue e}le=le.parentNode}}L=L.return}Qe(function(){var we=V,Oe=Se(S),He=[];e:{var Ie=vm.get(f);if(Ie!==void 0){var Je=wh,nt=f;switch(f){case"keypress":if(Ul(S)===0)break e;case"keydown":case"keyup":Je=B2;break;case"focusin":nt="focus",Je=Ch;break;case"focusout":nt="blur",Je=Ch;break;case"beforeblur":case"afterblur":Je=Ch;break;case"click":if(S.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Je=$g;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Je=E2;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Je=z2;break;case hm:case fm:case dm:Je=R2;break;case pm:Je=U2;break;case"scroll":Je=S2;break;case"wheel":Je=V2;break;case"copy":case"cut":case"paste":Je=N2;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Je=qg}var at=(d&4)!==0,or=!at&&f==="scroll",ye=at?Ie!==null?Ie+"Capture":null:Ie;at=[];for(var ve=we,xe;ve!==null;){xe=ve;var $e=xe.stateNode;if(xe.tag===5&&$e!==null&&(xe=$e,ye!==null&&($e=Ke(ve,ye),$e!=null&&at.push(xo(ve,$e,xe)))),or)break;ve=ve.return}0<at.length&&(Ie=new Je(Ie,nt,null,S,Oe),He.push({event:Ie,listeners:at}))}}if((d&7)===0){e:{if(Ie=f==="mouseover"||f==="pointerover",Je=f==="mouseout"||f==="pointerout",Ie&&S!==be&&(nt=S.relatedTarget||S.fromElement)&&(fa(nt)||nt[ai]))break e;if((Je||Ie)&&(Ie=Oe.window===Oe?Oe:(Ie=Oe.ownerDocument)?Ie.defaultView||Ie.parentWindow:window,Je?(nt=S.relatedTarget||S.toElement,Je=we,nt=nt?fa(nt):null,nt!==null&&(or=At(nt),nt!==or||nt.tag!==5&&nt.tag!==6)&&(nt=null)):(Je=null,nt=we),Je!==nt)){if(at=$g,$e="onMouseLeave",ye="onMouseEnter",ve="mouse",(f==="pointerout"||f==="pointerover")&&(at=qg,$e="onPointerLeave",ye="onPointerEnter",ve="pointer"),or=Je==null?Ie:es(Je),xe=nt==null?Ie:es(nt),Ie=new at($e,ve+"leave",Je,S,Oe),Ie.target=or,Ie.relatedTarget=xe,$e=null,fa(Oe)===we&&(at=new at(ye,ve+"enter",nt,S,Oe),at.target=xe,at.relatedTarget=or,$e=at),or=$e,Je&&nt)t:{for(at=Je,ye=nt,ve=0,xe=at;xe;xe=Za(xe))ve++;for(xe=0,$e=ye;$e;$e=Za($e))xe++;for(;0<ve-xe;)at=Za(at),ve--;for(;0<xe-ve;)ye=Za(ye),xe--;for(;ve--;){if(at===ye||ye!==null&&at===ye.alternate)break t;at=Za(at),ye=Za(ye)}at=null}else at=null;Je!==null&&bm(He,Ie,Je,at,!1),nt!==null&&or!==null&&bm(He,or,nt,at,!0)}}e:{if(Ie=we?es(we):window,Je=Ie.nodeName&&Ie.nodeName.toLowerCase(),Je==="select"||Je==="input"&&Ie.type==="file")var ot=Q2;else if(Jg(Ie))if(tm)ot=tC;else{ot=J2;var ct=Z2}else(Je=Ie.nodeName)&&Je.toLowerCase()==="input"&&(Ie.type==="checkbox"||Ie.type==="radio")&&(ot=eC);if(ot&&(ot=ot(f,we))){em(He,ot,S,Oe);break e}ct&&ct(f,Ie,we),f==="focusout"&&(ct=Ie._wrapperState)&&ct.controlled&&Ie.type==="number"&&Ne(Ie,"number",Ie.value)}switch(ct=we?es(we):window,f){case"focusin":(Jg(ct)||ct.contentEditable==="true")&&(Ka=ct,Nh=we,go=null);break;case"focusout":go=Nh=Ka=null;break;case"mousedown":Dh=!0;break;case"contextmenu":case"mouseup":case"dragend":Dh=!1,um(He,S,Oe);break;case"selectionchange":if(iC)break;case"keydown":case"keyup":um(He,S,Oe)}var ht;if(kh)e:{switch(f){case"compositionstart":var gt="onCompositionStart";break e;case"compositionend":gt="onCompositionEnd";break e;case"compositionupdate":gt="onCompositionUpdate";break e}gt=void 0}else Xa?Qg(f,S)&&(gt="onCompositionEnd"):f==="keydown"&&S.keyCode===229&&(gt="onCompositionStart");gt&&(Yg&&S.locale!=="ko"&&(Xa||gt!=="onCompositionStart"?gt==="onCompositionEnd"&&Xa&&(ht=Wg()):(ki=Oe,bh="value"in ki?ki.value:ki.textContent,Xa=!0)),ct=Xl(we,gt),0<ct.length&&(gt=new Gg(gt,f,null,S,Oe),He.push({event:gt,listeners:ct}),ht?gt.data=ht:(ht=Zg(S),ht!==null&&(gt.data=ht)))),(ht=G2?q2(f,S):Y2(f,S))&&(we=Xl(we,"onBeforeInput"),0<we.length&&(Oe=new Gg("onBeforeInput","beforeinput",null,S,Oe),He.push({event:Oe,listeners:we}),Oe.data=ht))}ym(He,d)})}function xo(f,d,S){return{instance:f,listener:d,currentTarget:S}}function Xl(f,d){for(var S=d+"Capture",L=[];f!==null;){var O=f,V=O.stateNode;O.tag===5&&V!==null&&(O=V,V=Ke(f,S),V!=null&&L.unshift(xo(f,V,O)),V=Ke(f,d),V!=null&&L.push(xo(f,V,O))),f=f.return}return L}function Za(f){if(f===null)return null;do f=f.return;while(f&&f.tag!==5);return f||null}function bm(f,d,S,L,O){for(var V=d._reactName,Q=[];S!==null&&S!==L;){var le=S,fe=le.alternate,we=le.stateNode;if(fe!==null&&fe===L)break;le.tag===5&&we!==null&&(le=we,O?(fe=Ke(S,V),fe!=null&&Q.unshift(xo(S,fe,le))):O||(fe=Ke(S,V),fe!=null&&Q.push(xo(S,fe,le)))),S=S.return}Q.length!==0&&f.push({event:d,listeners:Q})}var lC=/\r\n?/g,uC=/\u0000|\uFFFD/g;function wm(f){return(typeof f=="string"?f:""+f).replace(lC,`
38
+ `).replace(uC,"")}function Kl(f,d,S){if(d=wm(d),wm(f)!==d&&S)throw Error(r(425))}function Ql(){}var Bh=null,Fh=null;function jh(f,d){return f==="textarea"||f==="noscript"||typeof d.children=="string"||typeof d.children=="number"||typeof d.dangerouslySetInnerHTML=="object"&&d.dangerouslySetInnerHTML!==null&&d.dangerouslySetInnerHTML.__html!=null}var zh=typeof setTimeout=="function"?setTimeout:void 0,cC=typeof clearTimeout=="function"?clearTimeout:void 0,_m=typeof Promise=="function"?Promise:void 0,hC=typeof queueMicrotask=="function"?queueMicrotask:typeof _m<"u"?function(f){return _m.resolve(null).then(f).catch(fC)}:zh;function fC(f){setTimeout(function(){throw f})}function Hh(f,d){var S=d,L=0;do{var O=S.nextSibling;if(f.removeChild(S),O&&O.nodeType===8)if(S=O.data,S==="/$"){if(L===0){f.removeChild(O),lo(d);return}L--}else S!=="$"&&S!=="$?"&&S!=="$!"||L++;S=O}while(S);lo(d)}function Ri(f){for(;f!=null;f=f.nextSibling){var d=f.nodeType;if(d===1||d===3)break;if(d===8){if(d=f.data,d==="$"||d==="$!"||d==="$?")break;if(d==="/$")return null}}return f}function Sm(f){f=f.previousSibling;for(var d=0;f;){if(f.nodeType===8){var S=f.data;if(S==="$"||S==="$!"||S==="$?"){if(d===0)return f;d--}else S==="/$"&&d++}f=f.previousSibling}return null}var Ja=Math.random().toString(36).slice(2),Wn="__reactFiber$"+Ja,bo="__reactProps$"+Ja,ai="__reactContainer$"+Ja,Uh="__reactEvents$"+Ja,dC="__reactListeners$"+Ja,pC="__reactHandles$"+Ja;function fa(f){var d=f[Wn];if(d)return d;for(var S=f.parentNode;S;){if(d=S[ai]||S[Wn]){if(S=d.alternate,d.child!==null||S!==null&&S.child!==null)for(f=Sm(f);f!==null;){if(S=f[Wn])return S;f=Sm(f)}return d}f=S,S=f.parentNode}return null}function wo(f){return f=f[Wn]||f[ai],!f||f.tag!==5&&f.tag!==6&&f.tag!==13&&f.tag!==3?null:f}function es(f){if(f.tag===5||f.tag===6)return f.stateNode;throw Error(r(33))}function Zl(f){return f[bo]||null}var Wh=[],ts=-1;function Li(f){return{current:f}}function Yt(f){0>ts||(f.current=Wh[ts],Wh[ts]=null,ts--)}function Vt(f,d){ts++,Wh[ts]=f.current,f.current=d}var Ni={},Ir=Li(Ni),Zr=Li(!1),da=Ni;function rs(f,d){var S=f.type.contextTypes;if(!S)return Ni;var L=f.stateNode;if(L&&L.__reactInternalMemoizedUnmaskedChildContext===d)return L.__reactInternalMemoizedMaskedChildContext;var O={},V;for(V in S)O[V]=d[V];return L&&(f=f.stateNode,f.__reactInternalMemoizedUnmaskedChildContext=d,f.__reactInternalMemoizedMaskedChildContext=O),O}function Jr(f){return f=f.childContextTypes,f!=null}function Jl(){Yt(Zr),Yt(Ir)}function Cm(f,d,S){if(Ir.current!==Ni)throw Error(r(168));Vt(Ir,d),Vt(Zr,S)}function Em(f,d,S){var L=f.stateNode;if(d=d.childContextTypes,typeof L.getChildContext!="function")return S;L=L.getChildContext();for(var O in L)if(!(O in d))throw Error(r(108,Y(f)||"Unknown",O));return P({},S,L)}function eu(f){return f=(f=f.stateNode)&&f.__reactInternalMemoizedMergedChildContext||Ni,da=Ir.current,Vt(Ir,f),Vt(Zr,Zr.current),!0}function km(f,d,S){var L=f.stateNode;if(!L)throw Error(r(169));S?(f=Em(f,d,da),L.__reactInternalMemoizedMergedChildContext=f,Yt(Zr),Yt(Ir),Vt(Ir,f)):Yt(Zr),Vt(Zr,S)}var si=null,tu=!1,Vh=!1;function Tm(f){si===null?si=[f]:si.push(f)}function vC(f){tu=!0,Tm(f)}function Di(){if(!Vh&&si!==null){Vh=!0;var f=0,d=Ft;try{var S=si;for(Ft=1;f<S.length;f++){var L=S[f];do L=L(!0);while(L!==null)}si=null,tu=!1}catch(O){throw si!==null&&(si=si.slice(f+1)),Dn(un,Di),O}finally{Ft=d,Vh=!1}}return null}var ns=[],is=0,ru=null,nu=0,bn=[],wn=0,pa=null,oi=1,li="";function va(f,d){ns[is++]=nu,ns[is++]=ru,ru=f,nu=d}function Rm(f,d,S){bn[wn++]=oi,bn[wn++]=li,bn[wn++]=pa,pa=f;var L=oi;f=li;var O=32-er(L)-1;L&=~(1<<O),S+=1;var V=32-er(d)+O;if(30<V){var Q=O-O%5;V=(L&(1<<Q)-1).toString(32),L>>=Q,O-=Q,oi=1<<32-er(d)+O|S<<O|L,li=V+f}else oi=1<<V|S<<O|L,li=f}function $h(f){f.return!==null&&(va(f,1),Rm(f,1,0))}function Gh(f){for(;f===ru;)ru=ns[--is],ns[is]=null,nu=ns[--is],ns[is]=null;for(;f===pa;)pa=bn[--wn],bn[wn]=null,li=bn[--wn],bn[wn]=null,oi=bn[--wn],bn[wn]=null}var fn=null,dn=null,Zt=!1,Mn=null;function Lm(f,d){var S=En(5,null,null,0);S.elementType="DELETED",S.stateNode=d,S.return=f,d=f.deletions,d===null?(f.deletions=[S],f.flags|=16):d.push(S)}function Nm(f,d){switch(f.tag){case 5:var S=f.type;return d=d.nodeType!==1||S.toLowerCase()!==d.nodeName.toLowerCase()?null:d,d!==null?(f.stateNode=d,fn=f,dn=Ri(d.firstChild),!0):!1;case 6:return d=f.pendingProps===""||d.nodeType!==3?null:d,d!==null?(f.stateNode=d,fn=f,dn=null,!0):!1;case 13:return d=d.nodeType!==8?null:d,d!==null?(S=pa!==null?{id:oi,overflow:li}:null,f.memoizedState={dehydrated:d,treeContext:S,retryLane:1073741824},S=En(18,null,null,0),S.stateNode=d,S.return=f,f.child=S,fn=f,dn=null,!0):!1;default:return!1}}function qh(f){return(f.mode&1)!==0&&(f.flags&128)===0}function Yh(f){if(Zt){var d=dn;if(d){var S=d;if(!Nm(f,d)){if(qh(f))throw Error(r(418));d=Ri(S.nextSibling);var L=fn;d&&Nm(f,d)?Lm(L,S):(f.flags=f.flags&-4097|2,Zt=!1,fn=f)}}else{if(qh(f))throw Error(r(418));f.flags=f.flags&-4097|2,Zt=!1,fn=f}}}function Dm(f){for(f=f.return;f!==null&&f.tag!==5&&f.tag!==3&&f.tag!==13;)f=f.return;fn=f}function iu(f){if(f!==fn)return!1;if(!Zt)return Dm(f),Zt=!0,!1;var d;if((d=f.tag!==3)&&!(d=f.tag!==5)&&(d=f.type,d=d!=="head"&&d!=="body"&&!jh(f.type,f.memoizedProps)),d&&(d=dn)){if(qh(f))throw Am(),Error(r(418));for(;d;)Lm(f,d),d=Ri(d.nextSibling)}if(Dm(f),f.tag===13){if(f=f.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(r(317));e:{for(f=f.nextSibling,d=0;f;){if(f.nodeType===8){var S=f.data;if(S==="/$"){if(d===0){dn=Ri(f.nextSibling);break e}d--}else S!=="$"&&S!=="$!"&&S!=="$?"||d++}f=f.nextSibling}dn=null}}else dn=fn?Ri(f.stateNode.nextSibling):null;return!0}function Am(){for(var f=dn;f;)f=Ri(f.nextSibling)}function as(){dn=fn=null,Zt=!1}function Xh(f){Mn===null?Mn=[f]:Mn.push(f)}var gC=_.ReactCurrentBatchConfig;function _o(f,d,S){if(f=S.ref,f!==null&&typeof f!="function"&&typeof f!="object"){if(S._owner){if(S=S._owner,S){if(S.tag!==1)throw Error(r(309));var L=S.stateNode}if(!L)throw Error(r(147,f));var O=L,V=""+f;return d!==null&&d.ref!==null&&typeof d.ref=="function"&&d.ref._stringRef===V?d.ref:(d=function(Q){var le=O.refs;Q===null?delete le[V]:le[V]=Q},d._stringRef=V,d)}if(typeof f!="string")throw Error(r(284));if(!S._owner)throw Error(r(290,f))}return f}function au(f,d){throw f=Object.prototype.toString.call(d),Error(r(31,f==="[object Object]"?"object with keys {"+Object.keys(d).join(", ")+"}":f))}function Mm(f){var d=f._init;return d(f._payload)}function Pm(f){function d(ye,ve){if(f){var xe=ye.deletions;xe===null?(ye.deletions=[ve],ye.flags|=16):xe.push(ve)}}function S(ye,ve){if(!f)return null;for(;ve!==null;)d(ye,ve),ve=ve.sibling;return null}function L(ye,ve){for(ye=new Map;ve!==null;)ve.key!==null?ye.set(ve.key,ve):ye.set(ve.index,ve),ve=ve.sibling;return ye}function O(ye,ve){return ye=ji(ye,ve),ye.index=0,ye.sibling=null,ye}function V(ye,ve,xe){return ye.index=xe,f?(xe=ye.alternate,xe!==null?(xe=xe.index,xe<ve?(ye.flags|=2,ve):xe):(ye.flags|=2,ve)):(ye.flags|=1048576,ve)}function Q(ye){return f&&ye.alternate===null&&(ye.flags|=2),ye}function le(ye,ve,xe,$e){return ve===null||ve.tag!==6?(ve=Hf(xe,ye.mode,$e),ve.return=ye,ve):(ve=O(ve,xe),ve.return=ye,ve)}function fe(ye,ve,xe,$e){var ot=xe.type;return ot===T?Oe(ye,ve,xe.props.children,$e,xe.key):ve!==null&&(ve.elementType===ot||typeof ot=="object"&&ot!==null&&ot.$$typeof===U&&Mm(ot)===ve.type)?($e=O(ve,xe.props),$e.ref=_o(ye,ve,xe),$e.return=ye,$e):($e=Lu(xe.type,xe.key,xe.props,null,ye.mode,$e),$e.ref=_o(ye,ve,xe),$e.return=ye,$e)}function we(ye,ve,xe,$e){return ve===null||ve.tag!==4||ve.stateNode.containerInfo!==xe.containerInfo||ve.stateNode.implementation!==xe.implementation?(ve=Uf(xe,ye.mode,$e),ve.return=ye,ve):(ve=O(ve,xe.children||[]),ve.return=ye,ve)}function Oe(ye,ve,xe,$e,ot){return ve===null||ve.tag!==7?(ve=Sa(xe,ye.mode,$e,ot),ve.return=ye,ve):(ve=O(ve,xe),ve.return=ye,ve)}function He(ye,ve,xe){if(typeof ve=="string"&&ve!==""||typeof ve=="number")return ve=Hf(""+ve,ye.mode,xe),ve.return=ye,ve;if(typeof ve=="object"&&ve!==null){switch(ve.$$typeof){case R:return xe=Lu(ve.type,ve.key,ve.props,null,ye.mode,xe),xe.ref=_o(ye,null,ve),xe.return=ye,xe;case E:return ve=Uf(ve,ye.mode,xe),ve.return=ye,ve;case U:var $e=ve._init;return He(ye,$e(ve._payload),xe)}if(Ee(ve)||z(ve))return ve=Sa(ve,ye.mode,xe,null),ve.return=ye,ve;au(ye,ve)}return null}function Ie(ye,ve,xe,$e){var ot=ve!==null?ve.key:null;if(typeof xe=="string"&&xe!==""||typeof xe=="number")return ot!==null?null:le(ye,ve,""+xe,$e);if(typeof xe=="object"&&xe!==null){switch(xe.$$typeof){case R:return xe.key===ot?fe(ye,ve,xe,$e):null;case E:return xe.key===ot?we(ye,ve,xe,$e):null;case U:return ot=xe._init,Ie(ye,ve,ot(xe._payload),$e)}if(Ee(xe)||z(xe))return ot!==null?null:Oe(ye,ve,xe,$e,null);au(ye,xe)}return null}function Je(ye,ve,xe,$e,ot){if(typeof $e=="string"&&$e!==""||typeof $e=="number")return ye=ye.get(xe)||null,le(ve,ye,""+$e,ot);if(typeof $e=="object"&&$e!==null){switch($e.$$typeof){case R:return ye=ye.get($e.key===null?xe:$e.key)||null,fe(ve,ye,$e,ot);case E:return ye=ye.get($e.key===null?xe:$e.key)||null,we(ve,ye,$e,ot);case U:var ct=$e._init;return Je(ye,ve,xe,ct($e._payload),ot)}if(Ee($e)||z($e))return ye=ye.get(xe)||null,Oe(ve,ye,$e,ot,null);au(ve,$e)}return null}function nt(ye,ve,xe,$e){for(var ot=null,ct=null,ht=ve,gt=ve=0,Sr=null;ht!==null&&gt<xe.length;gt++){ht.index>gt?(Sr=ht,ht=null):Sr=ht.sibling;var Mt=Ie(ye,ht,xe[gt],$e);if(Mt===null){ht===null&&(ht=Sr);break}f&&ht&&Mt.alternate===null&&d(ye,ht),ve=V(Mt,ve,gt),ct===null?ot=Mt:ct.sibling=Mt,ct=Mt,ht=Sr}if(gt===xe.length)return S(ye,ht),Zt&&va(ye,gt),ot;if(ht===null){for(;gt<xe.length;gt++)ht=He(ye,xe[gt],$e),ht!==null&&(ve=V(ht,ve,gt),ct===null?ot=ht:ct.sibling=ht,ct=ht);return Zt&&va(ye,gt),ot}for(ht=L(ye,ht);gt<xe.length;gt++)Sr=Je(ht,ye,gt,xe[gt],$e),Sr!==null&&(f&&Sr.alternate!==null&&ht.delete(Sr.key===null?gt:Sr.key),ve=V(Sr,ve,gt),ct===null?ot=Sr:ct.sibling=Sr,ct=Sr);return f&&ht.forEach(function(zi){return d(ye,zi)}),Zt&&va(ye,gt),ot}function at(ye,ve,xe,$e){var ot=z(xe);if(typeof ot!="function")throw Error(r(150));if(xe=ot.call(xe),xe==null)throw Error(r(151));for(var ct=ot=null,ht=ve,gt=ve=0,Sr=null,Mt=xe.next();ht!==null&&!Mt.done;gt++,Mt=xe.next()){ht.index>gt?(Sr=ht,ht=null):Sr=ht.sibling;var zi=Ie(ye,ht,Mt.value,$e);if(zi===null){ht===null&&(ht=Sr);break}f&&ht&&zi.alternate===null&&d(ye,ht),ve=V(zi,ve,gt),ct===null?ot=zi:ct.sibling=zi,ct=zi,ht=Sr}if(Mt.done)return S(ye,ht),Zt&&va(ye,gt),ot;if(ht===null){for(;!Mt.done;gt++,Mt=xe.next())Mt=He(ye,Mt.value,$e),Mt!==null&&(ve=V(Mt,ve,gt),ct===null?ot=Mt:ct.sibling=Mt,ct=Mt);return Zt&&va(ye,gt),ot}for(ht=L(ye,ht);!Mt.done;gt++,Mt=xe.next())Mt=Je(ht,ye,gt,Mt.value,$e),Mt!==null&&(f&&Mt.alternate!==null&&ht.delete(Mt.key===null?gt:Mt.key),ve=V(Mt,ve,gt),ct===null?ot=Mt:ct.sibling=Mt,ct=Mt);return f&&ht.forEach(function(XC){return d(ye,XC)}),Zt&&va(ye,gt),ot}function or(ye,ve,xe,$e){if(typeof xe=="object"&&xe!==null&&xe.type===T&&xe.key===null&&(xe=xe.props.children),typeof xe=="object"&&xe!==null){switch(xe.$$typeof){case R:e:{for(var ot=xe.key,ct=ve;ct!==null;){if(ct.key===ot){if(ot=xe.type,ot===T){if(ct.tag===7){S(ye,ct.sibling),ve=O(ct,xe.props.children),ve.return=ye,ye=ve;break e}}else if(ct.elementType===ot||typeof ot=="object"&&ot!==null&&ot.$$typeof===U&&Mm(ot)===ct.type){S(ye,ct.sibling),ve=O(ct,xe.props),ve.ref=_o(ye,ct,xe),ve.return=ye,ye=ve;break e}S(ye,ct);break}else d(ye,ct);ct=ct.sibling}xe.type===T?(ve=Sa(xe.props.children,ye.mode,$e,xe.key),ve.return=ye,ye=ve):($e=Lu(xe.type,xe.key,xe.props,null,ye.mode,$e),$e.ref=_o(ye,ve,xe),$e.return=ye,ye=$e)}return Q(ye);case E:e:{for(ct=xe.key;ve!==null;){if(ve.key===ct)if(ve.tag===4&&ve.stateNode.containerInfo===xe.containerInfo&&ve.stateNode.implementation===xe.implementation){S(ye,ve.sibling),ve=O(ve,xe.children||[]),ve.return=ye,ye=ve;break e}else{S(ye,ve);break}else d(ye,ve);ve=ve.sibling}ve=Uf(xe,ye.mode,$e),ve.return=ye,ye=ve}return Q(ye);case U:return ct=xe._init,or(ye,ve,ct(xe._payload),$e)}if(Ee(xe))return nt(ye,ve,xe,$e);if(z(xe))return at(ye,ve,xe,$e);au(ye,xe)}return typeof xe=="string"&&xe!==""||typeof xe=="number"?(xe=""+xe,ve!==null&&ve.tag===6?(S(ye,ve.sibling),ve=O(ve,xe),ve.return=ye,ye=ve):(S(ye,ve),ve=Hf(xe,ye.mode,$e),ve.return=ye,ye=ve),Q(ye)):S(ye,ve)}return or}var ss=Pm(!0),Im=Pm(!1),su=Li(null),ou=null,os=null,Kh=null;function Qh(){Kh=os=ou=null}function Zh(f){var d=su.current;Yt(su),f._currentValue=d}function Jh(f,d,S){for(;f!==null;){var L=f.alternate;if((f.childLanes&d)!==d?(f.childLanes|=d,L!==null&&(L.childLanes|=d)):L!==null&&(L.childLanes&d)!==d&&(L.childLanes|=d),f===S)break;f=f.return}}function ls(f,d){ou=f,Kh=os=null,f=f.dependencies,f!==null&&f.firstContext!==null&&((f.lanes&d)!==0&&(en=!0),f.firstContext=null)}function _n(f){var d=f._currentValue;if(Kh!==f)if(f={context:f,memoizedValue:d,next:null},os===null){if(ou===null)throw Error(r(308));os=f,ou.dependencies={lanes:0,firstContext:f}}else os=os.next=f;return d}var ga=null;function ef(f){ga===null?ga=[f]:ga.push(f)}function Om(f,d,S,L){var O=d.interleaved;return O===null?(S.next=S,ef(d)):(S.next=O.next,O.next=S),d.interleaved=S,ui(f,L)}function ui(f,d){f.lanes|=d;var S=f.alternate;for(S!==null&&(S.lanes|=d),S=f,f=f.return;f!==null;)f.childLanes|=d,S=f.alternate,S!==null&&(S.childLanes|=d),S=f,f=f.return;return S.tag===3?S.stateNode:null}var Ai=!1;function tf(f){f.updateQueue={baseState:f.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Bm(f,d){f=f.updateQueue,d.updateQueue===f&&(d.updateQueue={baseState:f.baseState,firstBaseUpdate:f.firstBaseUpdate,lastBaseUpdate:f.lastBaseUpdate,shared:f.shared,effects:f.effects})}function ci(f,d){return{eventTime:f,lane:d,tag:0,payload:null,callback:null,next:null}}function Mi(f,d,S){var L=f.updateQueue;if(L===null)return null;if(L=L.shared,(Lt&2)!==0){var O=L.pending;return O===null?d.next=d:(d.next=O.next,O.next=d),L.pending=d,ui(f,S)}return O=L.interleaved,O===null?(d.next=d,ef(L)):(d.next=O.next,O.next=d),L.interleaved=d,ui(f,S)}function lu(f,d,S){if(d=d.updateQueue,d!==null&&(d=d.shared,(S&4194240)!==0)){var L=d.lanes;L&=f.pendingLanes,S|=L,d.lanes=S,vh(f,S)}}function Fm(f,d){var S=f.updateQueue,L=f.alternate;if(L!==null&&(L=L.updateQueue,S===L)){var O=null,V=null;if(S=S.firstBaseUpdate,S!==null){do{var Q={eventTime:S.eventTime,lane:S.lane,tag:S.tag,payload:S.payload,callback:S.callback,next:null};V===null?O=V=Q:V=V.next=Q,S=S.next}while(S!==null);V===null?O=V=d:V=V.next=d}else O=V=d;S={baseState:L.baseState,firstBaseUpdate:O,lastBaseUpdate:V,shared:L.shared,effects:L.effects},f.updateQueue=S;return}f=S.lastBaseUpdate,f===null?S.firstBaseUpdate=d:f.next=d,S.lastBaseUpdate=d}function uu(f,d,S,L){var O=f.updateQueue;Ai=!1;var V=O.firstBaseUpdate,Q=O.lastBaseUpdate,le=O.shared.pending;if(le!==null){O.shared.pending=null;var fe=le,we=fe.next;fe.next=null,Q===null?V=we:Q.next=we,Q=fe;var Oe=f.alternate;Oe!==null&&(Oe=Oe.updateQueue,le=Oe.lastBaseUpdate,le!==Q&&(le===null?Oe.firstBaseUpdate=we:le.next=we,Oe.lastBaseUpdate=fe))}if(V!==null){var He=O.baseState;Q=0,Oe=we=fe=null,le=V;do{var Ie=le.lane,Je=le.eventTime;if((L&Ie)===Ie){Oe!==null&&(Oe=Oe.next={eventTime:Je,lane:0,tag:le.tag,payload:le.payload,callback:le.callback,next:null});e:{var nt=f,at=le;switch(Ie=d,Je=S,at.tag){case 1:if(nt=at.payload,typeof nt=="function"){He=nt.call(Je,He,Ie);break e}He=nt;break e;case 3:nt.flags=nt.flags&-65537|128;case 0:if(nt=at.payload,Ie=typeof nt=="function"?nt.call(Je,He,Ie):nt,Ie==null)break e;He=P({},He,Ie);break e;case 2:Ai=!0}}le.callback!==null&&le.lane!==0&&(f.flags|=64,Ie=O.effects,Ie===null?O.effects=[le]:Ie.push(le))}else Je={eventTime:Je,lane:Ie,tag:le.tag,payload:le.payload,callback:le.callback,next:null},Oe===null?(we=Oe=Je,fe=He):Oe=Oe.next=Je,Q|=Ie;if(le=le.next,le===null){if(le=O.shared.pending,le===null)break;Ie=le,le=Ie.next,Ie.next=null,O.lastBaseUpdate=Ie,O.shared.pending=null}}while(!0);if(Oe===null&&(fe=He),O.baseState=fe,O.firstBaseUpdate=we,O.lastBaseUpdate=Oe,d=O.shared.interleaved,d!==null){O=d;do Q|=O.lane,O=O.next;while(O!==d)}else V===null&&(O.shared.lanes=0);xa|=Q,f.lanes=Q,f.memoizedState=He}}function jm(f,d,S){if(f=d.effects,d.effects=null,f!==null)for(d=0;d<f.length;d++){var L=f[d],O=L.callback;if(O!==null){if(L.callback=null,L=S,typeof O!="function")throw Error(r(191,O));O.call(L)}}}var So={},Vn=Li(So),Co=Li(So),Eo=Li(So);function ma(f){if(f===So)throw Error(r(174));return f}function rf(f,d){switch(Vt(Eo,d),Vt(Co,f),Vt(Vn,So),f=d.nodeType,f){case 9:case 11:d=(d=d.documentElement)?d.namespaceURI:Ce(null,"");break;default:f=f===8?d.parentNode:d,d=f.namespaceURI||null,f=f.tagName,d=Ce(d,f)}Yt(Vn),Vt(Vn,d)}function us(){Yt(Vn),Yt(Co),Yt(Eo)}function zm(f){ma(Eo.current);var d=ma(Vn.current),S=Ce(d,f.type);d!==S&&(Vt(Co,f),Vt(Vn,S))}function nf(f){Co.current===f&&(Yt(Vn),Yt(Co))}var tr=Li(0);function cu(f){for(var d=f;d!==null;){if(d.tag===13){var S=d.memoizedState;if(S!==null&&(S=S.dehydrated,S===null||S.data==="$?"||S.data==="$!"))return d}else if(d.tag===19&&d.memoizedProps.revealOrder!==void 0){if((d.flags&128)!==0)return d}else if(d.child!==null){d.child.return=d,d=d.child;continue}if(d===f)break;for(;d.sibling===null;){if(d.return===null||d.return===f)return null;d=d.return}d.sibling.return=d.return,d=d.sibling}return null}var af=[];function sf(){for(var f=0;f<af.length;f++)af[f]._workInProgressVersionPrimary=null;af.length=0}var hu=_.ReactCurrentDispatcher,of=_.ReactCurrentBatchConfig,ya=0,rr=null,vr=null,wr=null,fu=!1,ko=!1,To=0,mC=0;function Or(){throw Error(r(321))}function lf(f,d){if(d===null)return!1;for(var S=0;S<d.length&&S<f.length;S++)if(!An(f[S],d[S]))return!1;return!0}function uf(f,d,S,L,O,V){if(ya=V,rr=d,d.memoizedState=null,d.updateQueue=null,d.lanes=0,hu.current=f===null||f.memoizedState===null?wC:_C,f=S(L,O),ko){V=0;do{if(ko=!1,To=0,25<=V)throw Error(r(301));V+=1,wr=vr=null,d.updateQueue=null,hu.current=SC,f=S(L,O)}while(ko)}if(hu.current=vu,d=vr!==null&&vr.next!==null,ya=0,wr=vr=rr=null,fu=!1,d)throw Error(r(300));return f}function cf(){var f=To!==0;return To=0,f}function $n(){var f={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return wr===null?rr.memoizedState=wr=f:wr=wr.next=f,wr}function Sn(){if(vr===null){var f=rr.alternate;f=f!==null?f.memoizedState:null}else f=vr.next;var d=wr===null?rr.memoizedState:wr.next;if(d!==null)wr=d,vr=f;else{if(f===null)throw Error(r(310));vr=f,f={memoizedState:vr.memoizedState,baseState:vr.baseState,baseQueue:vr.baseQueue,queue:vr.queue,next:null},wr===null?rr.memoizedState=wr=f:wr=wr.next=f}return wr}function Ro(f,d){return typeof d=="function"?d(f):d}function hf(f){var d=Sn(),S=d.queue;if(S===null)throw Error(r(311));S.lastRenderedReducer=f;var L=vr,O=L.baseQueue,V=S.pending;if(V!==null){if(O!==null){var Q=O.next;O.next=V.next,V.next=Q}L.baseQueue=O=V,S.pending=null}if(O!==null){V=O.next,L=L.baseState;var le=Q=null,fe=null,we=V;do{var Oe=we.lane;if((ya&Oe)===Oe)fe!==null&&(fe=fe.next={lane:0,action:we.action,hasEagerState:we.hasEagerState,eagerState:we.eagerState,next:null}),L=we.hasEagerState?we.eagerState:f(L,we.action);else{var He={lane:Oe,action:we.action,hasEagerState:we.hasEagerState,eagerState:we.eagerState,next:null};fe===null?(le=fe=He,Q=L):fe=fe.next=He,rr.lanes|=Oe,xa|=Oe}we=we.next}while(we!==null&&we!==V);fe===null?Q=L:fe.next=le,An(L,d.memoizedState)||(en=!0),d.memoizedState=L,d.baseState=Q,d.baseQueue=fe,S.lastRenderedState=L}if(f=S.interleaved,f!==null){O=f;do V=O.lane,rr.lanes|=V,xa|=V,O=O.next;while(O!==f)}else O===null&&(S.lanes=0);return[d.memoizedState,S.dispatch]}function ff(f){var d=Sn(),S=d.queue;if(S===null)throw Error(r(311));S.lastRenderedReducer=f;var L=S.dispatch,O=S.pending,V=d.memoizedState;if(O!==null){S.pending=null;var Q=O=O.next;do V=f(V,Q.action),Q=Q.next;while(Q!==O);An(V,d.memoizedState)||(en=!0),d.memoizedState=V,d.baseQueue===null&&(d.baseState=V),S.lastRenderedState=V}return[V,L]}function Hm(){}function Um(f,d){var S=rr,L=Sn(),O=d(),V=!An(L.memoizedState,O);if(V&&(L.memoizedState=O,en=!0),L=L.queue,df($m.bind(null,S,L,f),[f]),L.getSnapshot!==d||V||wr!==null&&wr.memoizedState.tag&1){if(S.flags|=2048,Lo(9,Vm.bind(null,S,L,O,d),void 0,null),_r===null)throw Error(r(349));(ya&30)!==0||Wm(S,d,O)}return O}function Wm(f,d,S){f.flags|=16384,f={getSnapshot:d,value:S},d=rr.updateQueue,d===null?(d={lastEffect:null,stores:null},rr.updateQueue=d,d.stores=[f]):(S=d.stores,S===null?d.stores=[f]:S.push(f))}function Vm(f,d,S,L){d.value=S,d.getSnapshot=L,Gm(d)&&qm(f)}function $m(f,d,S){return S(function(){Gm(d)&&qm(f)})}function Gm(f){var d=f.getSnapshot;f=f.value;try{var S=d();return!An(f,S)}catch{return!0}}function qm(f){var d=ui(f,1);d!==null&&Bn(d,f,1,-1)}function Ym(f){var d=$n();return typeof f=="function"&&(f=f()),d.memoizedState=d.baseState=f,f={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ro,lastRenderedState:f},d.queue=f,f=f.dispatch=bC.bind(null,rr,f),[d.memoizedState,f]}function Lo(f,d,S,L){return f={tag:f,create:d,destroy:S,deps:L,next:null},d=rr.updateQueue,d===null?(d={lastEffect:null,stores:null},rr.updateQueue=d,d.lastEffect=f.next=f):(S=d.lastEffect,S===null?d.lastEffect=f.next=f:(L=S.next,S.next=f,f.next=L,d.lastEffect=f)),f}function Xm(){return Sn().memoizedState}function du(f,d,S,L){var O=$n();rr.flags|=f,O.memoizedState=Lo(1|d,S,void 0,L===void 0?null:L)}function pu(f,d,S,L){var O=Sn();L=L===void 0?null:L;var V=void 0;if(vr!==null){var Q=vr.memoizedState;if(V=Q.destroy,L!==null&&lf(L,Q.deps)){O.memoizedState=Lo(d,S,V,L);return}}rr.flags|=f,O.memoizedState=Lo(1|d,S,V,L)}function Km(f,d){return du(8390656,8,f,d)}function df(f,d){return pu(2048,8,f,d)}function Qm(f,d){return pu(4,2,f,d)}function Zm(f,d){return pu(4,4,f,d)}function Jm(f,d){if(typeof d=="function")return f=f(),d(f),function(){d(null)};if(d!=null)return f=f(),d.current=f,function(){d.current=null}}function ey(f,d,S){return S=S!=null?S.concat([f]):null,pu(4,4,Jm.bind(null,d,f),S)}function pf(){}function ty(f,d){var S=Sn();d=d===void 0?null:d;var L=S.memoizedState;return L!==null&&d!==null&&lf(d,L[1])?L[0]:(S.memoizedState=[f,d],f)}function ry(f,d){var S=Sn();d=d===void 0?null:d;var L=S.memoizedState;return L!==null&&d!==null&&lf(d,L[1])?L[0]:(f=f(),S.memoizedState=[f,d],f)}function ny(f,d,S){return(ya&21)===0?(f.baseState&&(f.baseState=!1,en=!0),f.memoizedState=S):(An(S,d)||(S=Mg(),rr.lanes|=S,xa|=S,f.baseState=!0),d)}function yC(f,d){var S=Ft;Ft=S!==0&&4>S?S:4,f(!0);var L=of.transition;of.transition={};try{f(!1),d()}finally{Ft=S,of.transition=L}}function iy(){return Sn().memoizedState}function xC(f,d,S){var L=Bi(f);if(S={lane:L,action:S,hasEagerState:!1,eagerState:null,next:null},ay(f))sy(d,S);else if(S=Om(f,d,S,L),S!==null){var O=Gr();Bn(S,f,L,O),oy(S,d,L)}}function bC(f,d,S){var L=Bi(f),O={lane:L,action:S,hasEagerState:!1,eagerState:null,next:null};if(ay(f))sy(d,O);else{var V=f.alternate;if(f.lanes===0&&(V===null||V.lanes===0)&&(V=d.lastRenderedReducer,V!==null))try{var Q=d.lastRenderedState,le=V(Q,S);if(O.hasEagerState=!0,O.eagerState=le,An(le,Q)){var fe=d.interleaved;fe===null?(O.next=O,ef(d)):(O.next=fe.next,fe.next=O),d.interleaved=O;return}}catch{}finally{}S=Om(f,d,O,L),S!==null&&(O=Gr(),Bn(S,f,L,O),oy(S,d,L))}}function ay(f){var d=f.alternate;return f===rr||d!==null&&d===rr}function sy(f,d){ko=fu=!0;var S=f.pending;S===null?d.next=d:(d.next=S.next,S.next=d),f.pending=d}function oy(f,d,S){if((S&4194240)!==0){var L=d.lanes;L&=f.pendingLanes,S|=L,d.lanes=S,vh(f,S)}}var vu={readContext:_n,useCallback:Or,useContext:Or,useEffect:Or,useImperativeHandle:Or,useInsertionEffect:Or,useLayoutEffect:Or,useMemo:Or,useReducer:Or,useRef:Or,useState:Or,useDebugValue:Or,useDeferredValue:Or,useTransition:Or,useMutableSource:Or,useSyncExternalStore:Or,useId:Or,unstable_isNewReconciler:!1},wC={readContext:_n,useCallback:function(f,d){return $n().memoizedState=[f,d===void 0?null:d],f},useContext:_n,useEffect:Km,useImperativeHandle:function(f,d,S){return S=S!=null?S.concat([f]):null,du(4194308,4,Jm.bind(null,d,f),S)},useLayoutEffect:function(f,d){return du(4194308,4,f,d)},useInsertionEffect:function(f,d){return du(4,2,f,d)},useMemo:function(f,d){var S=$n();return d=d===void 0?null:d,f=f(),S.memoizedState=[f,d],f},useReducer:function(f,d,S){var L=$n();return d=S!==void 0?S(d):d,L.memoizedState=L.baseState=d,f={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:f,lastRenderedState:d},L.queue=f,f=f.dispatch=xC.bind(null,rr,f),[L.memoizedState,f]},useRef:function(f){var d=$n();return f={current:f},d.memoizedState=f},useState:Ym,useDebugValue:pf,useDeferredValue:function(f){return $n().memoizedState=f},useTransition:function(){var f=Ym(!1),d=f[0];return f=yC.bind(null,f[1]),$n().memoizedState=f,[d,f]},useMutableSource:function(){},useSyncExternalStore:function(f,d,S){var L=rr,O=$n();if(Zt){if(S===void 0)throw Error(r(407));S=S()}else{if(S=d(),_r===null)throw Error(r(349));(ya&30)!==0||Wm(L,d,S)}O.memoizedState=S;var V={value:S,getSnapshot:d};return O.queue=V,Km($m.bind(null,L,V,f),[f]),L.flags|=2048,Lo(9,Vm.bind(null,L,V,S,d),void 0,null),S},useId:function(){var f=$n(),d=_r.identifierPrefix;if(Zt){var S=li,L=oi;S=(L&~(1<<32-er(L)-1)).toString(32)+S,d=":"+d+"R"+S,S=To++,0<S&&(d+="H"+S.toString(32)),d+=":"}else S=mC++,d=":"+d+"r"+S.toString(32)+":";return f.memoizedState=d},unstable_isNewReconciler:!1},_C={readContext:_n,useCallback:ty,useContext:_n,useEffect:df,useImperativeHandle:ey,useInsertionEffect:Qm,useLayoutEffect:Zm,useMemo:ry,useReducer:hf,useRef:Xm,useState:function(){return hf(Ro)},useDebugValue:pf,useDeferredValue:function(f){var d=Sn();return ny(d,vr.memoizedState,f)},useTransition:function(){var f=hf(Ro)[0],d=Sn().memoizedState;return[f,d]},useMutableSource:Hm,useSyncExternalStore:Um,useId:iy,unstable_isNewReconciler:!1},SC={readContext:_n,useCallback:ty,useContext:_n,useEffect:df,useImperativeHandle:ey,useInsertionEffect:Qm,useLayoutEffect:Zm,useMemo:ry,useReducer:ff,useRef:Xm,useState:function(){return ff(Ro)},useDebugValue:pf,useDeferredValue:function(f){var d=Sn();return vr===null?d.memoizedState=f:ny(d,vr.memoizedState,f)},useTransition:function(){var f=ff(Ro)[0],d=Sn().memoizedState;return[f,d]},useMutableSource:Hm,useSyncExternalStore:Um,useId:iy,unstable_isNewReconciler:!1};function Pn(f,d){if(f&&f.defaultProps){d=P({},d),f=f.defaultProps;for(var S in f)d[S]===void 0&&(d[S]=f[S]);return d}return d}function vf(f,d,S,L){d=f.memoizedState,S=S(L,d),S=S==null?d:P({},d,S),f.memoizedState=S,f.lanes===0&&(f.updateQueue.baseState=S)}var gu={isMounted:function(f){return(f=f._reactInternals)?At(f)===f:!1},enqueueSetState:function(f,d,S){f=f._reactInternals;var L=Gr(),O=Bi(f),V=ci(L,O);V.payload=d,S!=null&&(V.callback=S),d=Mi(f,V,O),d!==null&&(Bn(d,f,O,L),lu(d,f,O))},enqueueReplaceState:function(f,d,S){f=f._reactInternals;var L=Gr(),O=Bi(f),V=ci(L,O);V.tag=1,V.payload=d,S!=null&&(V.callback=S),d=Mi(f,V,O),d!==null&&(Bn(d,f,O,L),lu(d,f,O))},enqueueForceUpdate:function(f,d){f=f._reactInternals;var S=Gr(),L=Bi(f),O=ci(S,L);O.tag=2,d!=null&&(O.callback=d),d=Mi(f,O,L),d!==null&&(Bn(d,f,L,S),lu(d,f,L))}};function ly(f,d,S,L,O,V,Q){return f=f.stateNode,typeof f.shouldComponentUpdate=="function"?f.shouldComponentUpdate(L,V,Q):d.prototype&&d.prototype.isPureReactComponent?!vo(S,L)||!vo(O,V):!0}function uy(f,d,S){var L=!1,O=Ni,V=d.contextType;return typeof V=="object"&&V!==null?V=_n(V):(O=Jr(d)?da:Ir.current,L=d.contextTypes,V=(L=L!=null)?rs(f,O):Ni),d=new d(S,V),f.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,d.updater=gu,f.stateNode=d,d._reactInternals=f,L&&(f=f.stateNode,f.__reactInternalMemoizedUnmaskedChildContext=O,f.__reactInternalMemoizedMaskedChildContext=V),d}function cy(f,d,S,L){f=d.state,typeof d.componentWillReceiveProps=="function"&&d.componentWillReceiveProps(S,L),typeof d.UNSAFE_componentWillReceiveProps=="function"&&d.UNSAFE_componentWillReceiveProps(S,L),d.state!==f&&gu.enqueueReplaceState(d,d.state,null)}function gf(f,d,S,L){var O=f.stateNode;O.props=S,O.state=f.memoizedState,O.refs={},tf(f);var V=d.contextType;typeof V=="object"&&V!==null?O.context=_n(V):(V=Jr(d)?da:Ir.current,O.context=rs(f,V)),O.state=f.memoizedState,V=d.getDerivedStateFromProps,typeof V=="function"&&(vf(f,d,V,S),O.state=f.memoizedState),typeof d.getDerivedStateFromProps=="function"||typeof O.getSnapshotBeforeUpdate=="function"||typeof O.UNSAFE_componentWillMount!="function"&&typeof O.componentWillMount!="function"||(d=O.state,typeof O.componentWillMount=="function"&&O.componentWillMount(),typeof O.UNSAFE_componentWillMount=="function"&&O.UNSAFE_componentWillMount(),d!==O.state&&gu.enqueueReplaceState(O,O.state,null),uu(f,S,O,L),O.state=f.memoizedState),typeof O.componentDidMount=="function"&&(f.flags|=4194308)}function cs(f,d){try{var S="",L=d;do S+=re(L),L=L.return;while(L);var O=S}catch(V){O=`
39
+ Error generating stack: `+V.message+`
40
+ `+V.stack}return{value:f,source:d,stack:O,digest:null}}function mf(f,d,S){return{value:f,source:null,stack:S??null,digest:d??null}}function yf(f,d){try{console.error(d.value)}catch(S){setTimeout(function(){throw S})}}var CC=typeof WeakMap=="function"?WeakMap:Map;function hy(f,d,S){S=ci(-1,S),S.tag=3,S.payload={element:null};var L=d.value;return S.callback=function(){Su||(Su=!0,Mf=L),yf(f,d)},S}function fy(f,d,S){S=ci(-1,S),S.tag=3;var L=f.type.getDerivedStateFromError;if(typeof L=="function"){var O=d.value;S.payload=function(){return L(O)},S.callback=function(){yf(f,d)}}var V=f.stateNode;return V!==null&&typeof V.componentDidCatch=="function"&&(S.callback=function(){yf(f,d),typeof L!="function"&&(Ii===null?Ii=new Set([this]):Ii.add(this));var Q=d.stack;this.componentDidCatch(d.value,{componentStack:Q!==null?Q:""})}),S}function dy(f,d,S){var L=f.pingCache;if(L===null){L=f.pingCache=new CC;var O=new Set;L.set(d,O)}else O=L.get(d),O===void 0&&(O=new Set,L.set(d,O));O.has(S)||(O.add(S),f=FC.bind(null,f,d,S),d.then(f,f))}function py(f){do{var d;if((d=f.tag===13)&&(d=f.memoizedState,d=d!==null?d.dehydrated!==null:!0),d)return f;f=f.return}while(f!==null);return null}function vy(f,d,S,L,O){return(f.mode&1)===0?(f===d?f.flags|=65536:(f.flags|=128,S.flags|=131072,S.flags&=-52805,S.tag===1&&(S.alternate===null?S.tag=17:(d=ci(-1,1),d.tag=2,Mi(S,d,1))),S.lanes|=1),f):(f.flags|=65536,f.lanes=O,f)}var EC=_.ReactCurrentOwner,en=!1;function $r(f,d,S,L){d.child=f===null?Im(d,null,S,L):ss(d,f.child,S,L)}function gy(f,d,S,L,O){S=S.render;var V=d.ref;return ls(d,O),L=uf(f,d,S,L,V,O),S=cf(),f!==null&&!en?(d.updateQueue=f.updateQueue,d.flags&=-2053,f.lanes&=~O,hi(f,d,O)):(Zt&&S&&$h(d),d.flags|=1,$r(f,d,L,O),d.child)}function my(f,d,S,L,O){if(f===null){var V=S.type;return typeof V=="function"&&!zf(V)&&V.defaultProps===void 0&&S.compare===null&&S.defaultProps===void 0?(d.tag=15,d.type=V,yy(f,d,V,L,O)):(f=Lu(S.type,null,L,d,d.mode,O),f.ref=d.ref,f.return=d,d.child=f)}if(V=f.child,(f.lanes&O)===0){var Q=V.memoizedProps;if(S=S.compare,S=S!==null?S:vo,S(Q,L)&&f.ref===d.ref)return hi(f,d,O)}return d.flags|=1,f=ji(V,L),f.ref=d.ref,f.return=d,d.child=f}function yy(f,d,S,L,O){if(f!==null){var V=f.memoizedProps;if(vo(V,L)&&f.ref===d.ref)if(en=!1,d.pendingProps=L=V,(f.lanes&O)!==0)(f.flags&131072)!==0&&(en=!0);else return d.lanes=f.lanes,hi(f,d,O)}return xf(f,d,S,L,O)}function xy(f,d,S){var L=d.pendingProps,O=L.children,V=f!==null?f.memoizedState:null;if(L.mode==="hidden")if((d.mode&1)===0)d.memoizedState={baseLanes:0,cachePool:null,transitions:null},Vt(fs,pn),pn|=S;else{if((S&1073741824)===0)return f=V!==null?V.baseLanes|S:S,d.lanes=d.childLanes=1073741824,d.memoizedState={baseLanes:f,cachePool:null,transitions:null},d.updateQueue=null,Vt(fs,pn),pn|=f,null;d.memoizedState={baseLanes:0,cachePool:null,transitions:null},L=V!==null?V.baseLanes:S,Vt(fs,pn),pn|=L}else V!==null?(L=V.baseLanes|S,d.memoizedState=null):L=S,Vt(fs,pn),pn|=L;return $r(f,d,O,S),d.child}function by(f,d){var S=d.ref;(f===null&&S!==null||f!==null&&f.ref!==S)&&(d.flags|=512,d.flags|=2097152)}function xf(f,d,S,L,O){var V=Jr(S)?da:Ir.current;return V=rs(d,V),ls(d,O),S=uf(f,d,S,L,V,O),L=cf(),f!==null&&!en?(d.updateQueue=f.updateQueue,d.flags&=-2053,f.lanes&=~O,hi(f,d,O)):(Zt&&L&&$h(d),d.flags|=1,$r(f,d,S,O),d.child)}function wy(f,d,S,L,O){if(Jr(S)){var V=!0;eu(d)}else V=!1;if(ls(d,O),d.stateNode===null)yu(f,d),uy(d,S,L),gf(d,S,L,O),L=!0;else if(f===null){var Q=d.stateNode,le=d.memoizedProps;Q.props=le;var fe=Q.context,we=S.contextType;typeof we=="object"&&we!==null?we=_n(we):(we=Jr(S)?da:Ir.current,we=rs(d,we));var Oe=S.getDerivedStateFromProps,He=typeof Oe=="function"||typeof Q.getSnapshotBeforeUpdate=="function";He||typeof Q.UNSAFE_componentWillReceiveProps!="function"&&typeof Q.componentWillReceiveProps!="function"||(le!==L||fe!==we)&&cy(d,Q,L,we),Ai=!1;var Ie=d.memoizedState;Q.state=Ie,uu(d,L,Q,O),fe=d.memoizedState,le!==L||Ie!==fe||Zr.current||Ai?(typeof Oe=="function"&&(vf(d,S,Oe,L),fe=d.memoizedState),(le=Ai||ly(d,S,le,L,Ie,fe,we))?(He||typeof Q.UNSAFE_componentWillMount!="function"&&typeof Q.componentWillMount!="function"||(typeof Q.componentWillMount=="function"&&Q.componentWillMount(),typeof Q.UNSAFE_componentWillMount=="function"&&Q.UNSAFE_componentWillMount()),typeof Q.componentDidMount=="function"&&(d.flags|=4194308)):(typeof Q.componentDidMount=="function"&&(d.flags|=4194308),d.memoizedProps=L,d.memoizedState=fe),Q.props=L,Q.state=fe,Q.context=we,L=le):(typeof Q.componentDidMount=="function"&&(d.flags|=4194308),L=!1)}else{Q=d.stateNode,Bm(f,d),le=d.memoizedProps,we=d.type===d.elementType?le:Pn(d.type,le),Q.props=we,He=d.pendingProps,Ie=Q.context,fe=S.contextType,typeof fe=="object"&&fe!==null?fe=_n(fe):(fe=Jr(S)?da:Ir.current,fe=rs(d,fe));var Je=S.getDerivedStateFromProps;(Oe=typeof Je=="function"||typeof Q.getSnapshotBeforeUpdate=="function")||typeof Q.UNSAFE_componentWillReceiveProps!="function"&&typeof Q.componentWillReceiveProps!="function"||(le!==He||Ie!==fe)&&cy(d,Q,L,fe),Ai=!1,Ie=d.memoizedState,Q.state=Ie,uu(d,L,Q,O);var nt=d.memoizedState;le!==He||Ie!==nt||Zr.current||Ai?(typeof Je=="function"&&(vf(d,S,Je,L),nt=d.memoizedState),(we=Ai||ly(d,S,we,L,Ie,nt,fe)||!1)?(Oe||typeof Q.UNSAFE_componentWillUpdate!="function"&&typeof Q.componentWillUpdate!="function"||(typeof Q.componentWillUpdate=="function"&&Q.componentWillUpdate(L,nt,fe),typeof Q.UNSAFE_componentWillUpdate=="function"&&Q.UNSAFE_componentWillUpdate(L,nt,fe)),typeof Q.componentDidUpdate=="function"&&(d.flags|=4),typeof Q.getSnapshotBeforeUpdate=="function"&&(d.flags|=1024)):(typeof Q.componentDidUpdate!="function"||le===f.memoizedProps&&Ie===f.memoizedState||(d.flags|=4),typeof Q.getSnapshotBeforeUpdate!="function"||le===f.memoizedProps&&Ie===f.memoizedState||(d.flags|=1024),d.memoizedProps=L,d.memoizedState=nt),Q.props=L,Q.state=nt,Q.context=fe,L=we):(typeof Q.componentDidUpdate!="function"||le===f.memoizedProps&&Ie===f.memoizedState||(d.flags|=4),typeof Q.getSnapshotBeforeUpdate!="function"||le===f.memoizedProps&&Ie===f.memoizedState||(d.flags|=1024),L=!1)}return bf(f,d,S,L,V,O)}function bf(f,d,S,L,O,V){by(f,d);var Q=(d.flags&128)!==0;if(!L&&!Q)return O&&km(d,S,!1),hi(f,d,V);L=d.stateNode,EC.current=d;var le=Q&&typeof S.getDerivedStateFromError!="function"?null:L.render();return d.flags|=1,f!==null&&Q?(d.child=ss(d,f.child,null,V),d.child=ss(d,null,le,V)):$r(f,d,le,V),d.memoizedState=L.state,O&&km(d,S,!0),d.child}function _y(f){var d=f.stateNode;d.pendingContext?Cm(f,d.pendingContext,d.pendingContext!==d.context):d.context&&Cm(f,d.context,!1),rf(f,d.containerInfo)}function Sy(f,d,S,L,O){return as(),Xh(O),d.flags|=256,$r(f,d,S,L),d.child}var wf={dehydrated:null,treeContext:null,retryLane:0};function _f(f){return{baseLanes:f,cachePool:null,transitions:null}}function Cy(f,d,S){var L=d.pendingProps,O=tr.current,V=!1,Q=(d.flags&128)!==0,le;if((le=Q)||(le=f!==null&&f.memoizedState===null?!1:(O&2)!==0),le?(V=!0,d.flags&=-129):(f===null||f.memoizedState!==null)&&(O|=1),Vt(tr,O&1),f===null)return Yh(d),f=d.memoizedState,f!==null&&(f=f.dehydrated,f!==null)?((d.mode&1)===0?d.lanes=1:f.data==="$!"?d.lanes=8:d.lanes=1073741824,null):(Q=L.children,f=L.fallback,V?(L=d.mode,V=d.child,Q={mode:"hidden",children:Q},(L&1)===0&&V!==null?(V.childLanes=0,V.pendingProps=Q):V=Nu(Q,L,0,null),f=Sa(f,L,S,null),V.return=d,f.return=d,V.sibling=f,d.child=V,d.child.memoizedState=_f(S),d.memoizedState=wf,f):Sf(d,Q));if(O=f.memoizedState,O!==null&&(le=O.dehydrated,le!==null))return kC(f,d,Q,L,le,O,S);if(V){V=L.fallback,Q=d.mode,O=f.child,le=O.sibling;var fe={mode:"hidden",children:L.children};return(Q&1)===0&&d.child!==O?(L=d.child,L.childLanes=0,L.pendingProps=fe,d.deletions=null):(L=ji(O,fe),L.subtreeFlags=O.subtreeFlags&14680064),le!==null?V=ji(le,V):(V=Sa(V,Q,S,null),V.flags|=2),V.return=d,L.return=d,L.sibling=V,d.child=L,L=V,V=d.child,Q=f.child.memoizedState,Q=Q===null?_f(S):{baseLanes:Q.baseLanes|S,cachePool:null,transitions:Q.transitions},V.memoizedState=Q,V.childLanes=f.childLanes&~S,d.memoizedState=wf,L}return V=f.child,f=V.sibling,L=ji(V,{mode:"visible",children:L.children}),(d.mode&1)===0&&(L.lanes=S),L.return=d,L.sibling=null,f!==null&&(S=d.deletions,S===null?(d.deletions=[f],d.flags|=16):S.push(f)),d.child=L,d.memoizedState=null,L}function Sf(f,d){return d=Nu({mode:"visible",children:d},f.mode,0,null),d.return=f,f.child=d}function mu(f,d,S,L){return L!==null&&Xh(L),ss(d,f.child,null,S),f=Sf(d,d.pendingProps.children),f.flags|=2,d.memoizedState=null,f}function kC(f,d,S,L,O,V,Q){if(S)return d.flags&256?(d.flags&=-257,L=mf(Error(r(422))),mu(f,d,Q,L)):d.memoizedState!==null?(d.child=f.child,d.flags|=128,null):(V=L.fallback,O=d.mode,L=Nu({mode:"visible",children:L.children},O,0,null),V=Sa(V,O,Q,null),V.flags|=2,L.return=d,V.return=d,L.sibling=V,d.child=L,(d.mode&1)!==0&&ss(d,f.child,null,Q),d.child.memoizedState=_f(Q),d.memoizedState=wf,V);if((d.mode&1)===0)return mu(f,d,Q,null);if(O.data==="$!"){if(L=O.nextSibling&&O.nextSibling.dataset,L)var le=L.dgst;return L=le,V=Error(r(419)),L=mf(V,L,void 0),mu(f,d,Q,L)}if(le=(Q&f.childLanes)!==0,en||le){if(L=_r,L!==null){switch(Q&-Q){case 4:O=2;break;case 16:O=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:O=32;break;case 536870912:O=268435456;break;default:O=0}O=(O&(L.suspendedLanes|Q))!==0?0:O,O!==0&&O!==V.retryLane&&(V.retryLane=O,ui(f,O),Bn(L,f,O,-1))}return jf(),L=mf(Error(r(421))),mu(f,d,Q,L)}return O.data==="$?"?(d.flags|=128,d.child=f.child,d=jC.bind(null,f),O._reactRetry=d,null):(f=V.treeContext,dn=Ri(O.nextSibling),fn=d,Zt=!0,Mn=null,f!==null&&(bn[wn++]=oi,bn[wn++]=li,bn[wn++]=pa,oi=f.id,li=f.overflow,pa=d),d=Sf(d,L.children),d.flags|=4096,d)}function Ey(f,d,S){f.lanes|=d;var L=f.alternate;L!==null&&(L.lanes|=d),Jh(f.return,d,S)}function Cf(f,d,S,L,O){var V=f.memoizedState;V===null?f.memoizedState={isBackwards:d,rendering:null,renderingStartTime:0,last:L,tail:S,tailMode:O}:(V.isBackwards=d,V.rendering=null,V.renderingStartTime=0,V.last=L,V.tail=S,V.tailMode=O)}function ky(f,d,S){var L=d.pendingProps,O=L.revealOrder,V=L.tail;if($r(f,d,L.children,S),L=tr.current,(L&2)!==0)L=L&1|2,d.flags|=128;else{if(f!==null&&(f.flags&128)!==0)e:for(f=d.child;f!==null;){if(f.tag===13)f.memoizedState!==null&&Ey(f,S,d);else if(f.tag===19)Ey(f,S,d);else if(f.child!==null){f.child.return=f,f=f.child;continue}if(f===d)break e;for(;f.sibling===null;){if(f.return===null||f.return===d)break e;f=f.return}f.sibling.return=f.return,f=f.sibling}L&=1}if(Vt(tr,L),(d.mode&1)===0)d.memoizedState=null;else switch(O){case"forwards":for(S=d.child,O=null;S!==null;)f=S.alternate,f!==null&&cu(f)===null&&(O=S),S=S.sibling;S=O,S===null?(O=d.child,d.child=null):(O=S.sibling,S.sibling=null),Cf(d,!1,O,S,V);break;case"backwards":for(S=null,O=d.child,d.child=null;O!==null;){if(f=O.alternate,f!==null&&cu(f)===null){d.child=O;break}f=O.sibling,O.sibling=S,S=O,O=f}Cf(d,!0,S,null,V);break;case"together":Cf(d,!1,null,null,void 0);break;default:d.memoizedState=null}return d.child}function yu(f,d){(d.mode&1)===0&&f!==null&&(f.alternate=null,d.alternate=null,d.flags|=2)}function hi(f,d,S){if(f!==null&&(d.dependencies=f.dependencies),xa|=d.lanes,(S&d.childLanes)===0)return null;if(f!==null&&d.child!==f.child)throw Error(r(153));if(d.child!==null){for(f=d.child,S=ji(f,f.pendingProps),d.child=S,S.return=d;f.sibling!==null;)f=f.sibling,S=S.sibling=ji(f,f.pendingProps),S.return=d;S.sibling=null}return d.child}function TC(f,d,S){switch(d.tag){case 3:_y(d),as();break;case 5:zm(d);break;case 1:Jr(d.type)&&eu(d);break;case 4:rf(d,d.stateNode.containerInfo);break;case 10:var L=d.type._context,O=d.memoizedProps.value;Vt(su,L._currentValue),L._currentValue=O;break;case 13:if(L=d.memoizedState,L!==null)return L.dehydrated!==null?(Vt(tr,tr.current&1),d.flags|=128,null):(S&d.child.childLanes)!==0?Cy(f,d,S):(Vt(tr,tr.current&1),f=hi(f,d,S),f!==null?f.sibling:null);Vt(tr,tr.current&1);break;case 19:if(L=(S&d.childLanes)!==0,(f.flags&128)!==0){if(L)return ky(f,d,S);d.flags|=128}if(O=d.memoizedState,O!==null&&(O.rendering=null,O.tail=null,O.lastEffect=null),Vt(tr,tr.current),L)break;return null;case 22:case 23:return d.lanes=0,xy(f,d,S)}return hi(f,d,S)}var Ty,Ef,Ry,Ly;Ty=function(f,d){for(var S=d.child;S!==null;){if(S.tag===5||S.tag===6)f.appendChild(S.stateNode);else if(S.tag!==4&&S.child!==null){S.child.return=S,S=S.child;continue}if(S===d)break;for(;S.sibling===null;){if(S.return===null||S.return===d)return;S=S.return}S.sibling.return=S.return,S=S.sibling}},Ef=function(){},Ry=function(f,d,S,L){var O=f.memoizedProps;if(O!==L){f=d.stateNode,ma(Vn.current);var V=null;switch(S){case"input":O=de(f,O),L=de(f,L),V=[];break;case"select":O=P({},O,{value:void 0}),L=P({},L,{value:void 0}),V=[];break;case"textarea":O=Pe(f,O),L=Pe(f,L),V=[];break;default:typeof O.onClick!="function"&&typeof L.onClick=="function"&&(f.onclick=Ql)}he(S,L);var Q;S=null;for(we in O)if(!L.hasOwnProperty(we)&&O.hasOwnProperty(we)&&O[we]!=null)if(we==="style"){var le=O[we];for(Q in le)le.hasOwnProperty(Q)&&(S||(S={}),S[Q]="")}else we!=="dangerouslySetInnerHTML"&&we!=="children"&&we!=="suppressContentEditableWarning"&&we!=="suppressHydrationWarning"&&we!=="autoFocus"&&(i.hasOwnProperty(we)?V||(V=[]):(V=V||[]).push(we,null));for(we in L){var fe=L[we];if(le=O!=null?O[we]:void 0,L.hasOwnProperty(we)&&fe!==le&&(fe!=null||le!=null))if(we==="style")if(le){for(Q in le)!le.hasOwnProperty(Q)||fe&&fe.hasOwnProperty(Q)||(S||(S={}),S[Q]="");for(Q in fe)fe.hasOwnProperty(Q)&&le[Q]!==fe[Q]&&(S||(S={}),S[Q]=fe[Q])}else S||(V||(V=[]),V.push(we,S)),S=fe;else we==="dangerouslySetInnerHTML"?(fe=fe?fe.__html:void 0,le=le?le.__html:void 0,fe!=null&&le!==fe&&(V=V||[]).push(we,fe)):we==="children"?typeof fe!="string"&&typeof fe!="number"||(V=V||[]).push(we,""+fe):we!=="suppressContentEditableWarning"&&we!=="suppressHydrationWarning"&&(i.hasOwnProperty(we)?(fe!=null&&we==="onScroll"&&qt("scroll",f),V||le===fe||(V=[])):(V=V||[]).push(we,fe))}S&&(V=V||[]).push("style",S);var we=V;(d.updateQueue=we)&&(d.flags|=4)}},Ly=function(f,d,S,L){S!==L&&(d.flags|=4)};function No(f,d){if(!Zt)switch(f.tailMode){case"hidden":d=f.tail;for(var S=null;d!==null;)d.alternate!==null&&(S=d),d=d.sibling;S===null?f.tail=null:S.sibling=null;break;case"collapsed":S=f.tail;for(var L=null;S!==null;)S.alternate!==null&&(L=S),S=S.sibling;L===null?d||f.tail===null?f.tail=null:f.tail.sibling=null:L.sibling=null}}function Br(f){var d=f.alternate!==null&&f.alternate.child===f.child,S=0,L=0;if(d)for(var O=f.child;O!==null;)S|=O.lanes|O.childLanes,L|=O.subtreeFlags&14680064,L|=O.flags&14680064,O.return=f,O=O.sibling;else for(O=f.child;O!==null;)S|=O.lanes|O.childLanes,L|=O.subtreeFlags,L|=O.flags,O.return=f,O=O.sibling;return f.subtreeFlags|=L,f.childLanes=S,d}function RC(f,d,S){var L=d.pendingProps;switch(Gh(d),d.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Br(d),null;case 1:return Jr(d.type)&&Jl(),Br(d),null;case 3:return L=d.stateNode,us(),Yt(Zr),Yt(Ir),sf(),L.pendingContext&&(L.context=L.pendingContext,L.pendingContext=null),(f===null||f.child===null)&&(iu(d)?d.flags|=4:f===null||f.memoizedState.isDehydrated&&(d.flags&256)===0||(d.flags|=1024,Mn!==null&&(Of(Mn),Mn=null))),Ef(f,d),Br(d),null;case 5:nf(d);var O=ma(Eo.current);if(S=d.type,f!==null&&d.stateNode!=null)Ry(f,d,S,L,O),f.ref!==d.ref&&(d.flags|=512,d.flags|=2097152);else{if(!L){if(d.stateNode===null)throw Error(r(166));return Br(d),null}if(f=ma(Vn.current),iu(d)){L=d.stateNode,S=d.type;var V=d.memoizedProps;switch(L[Wn]=d,L[bo]=V,f=(d.mode&1)!==0,S){case"dialog":qt("cancel",L),qt("close",L);break;case"iframe":case"object":case"embed":qt("load",L);break;case"video":case"audio":for(O=0;O<mo.length;O++)qt(mo[O],L);break;case"source":qt("error",L);break;case"img":case"image":case"link":qt("error",L),qt("load",L);break;case"details":qt("toggle",L);break;case"input":Le(L,V),qt("invalid",L);break;case"select":L._wrapperState={wasMultiple:!!V.multiple},qt("invalid",L);break;case"textarea":De(L,V),qt("invalid",L)}he(S,V),O=null;for(var Q in V)if(V.hasOwnProperty(Q)){var le=V[Q];Q==="children"?typeof le=="string"?L.textContent!==le&&(V.suppressHydrationWarning!==!0&&Kl(L.textContent,le,f),O=["children",le]):typeof le=="number"&&L.textContent!==""+le&&(V.suppressHydrationWarning!==!0&&Kl(L.textContent,le,f),O=["children",""+le]):i.hasOwnProperty(Q)&&le!=null&&Q==="onScroll"&&qt("scroll",L)}switch(S){case"input":J(L),ke(L,V,!0);break;case"textarea":J(L),Ye(L);break;case"select":case"option":break;default:typeof V.onClick=="function"&&(L.onclick=Ql)}L=O,d.updateQueue=L,L!==null&&(d.flags|=4)}else{Q=O.nodeType===9?O:O.ownerDocument,f==="http://www.w3.org/1999/xhtml"&&(f=ge(S)),f==="http://www.w3.org/1999/xhtml"?S==="script"?(f=Q.createElement("div"),f.innerHTML="<script><\/script>",f=f.removeChild(f.firstChild)):typeof L.is=="string"?f=Q.createElement(S,{is:L.is}):(f=Q.createElement(S),S==="select"&&(Q=f,L.multiple?Q.multiple=!0:L.size&&(Q.size=L.size))):f=Q.createElementNS(f,S),f[Wn]=d,f[bo]=L,Ty(f,d,!1,!1),d.stateNode=f;e:{switch(Q=pe(S,L),S){case"dialog":qt("cancel",f),qt("close",f),O=L;break;case"iframe":case"object":case"embed":qt("load",f),O=L;break;case"video":case"audio":for(O=0;O<mo.length;O++)qt(mo[O],f);O=L;break;case"source":qt("error",f),O=L;break;case"img":case"image":case"link":qt("error",f),qt("load",f),O=L;break;case"details":qt("toggle",f),O=L;break;case"input":Le(f,L),O=de(f,L),qt("invalid",f);break;case"option":O=L;break;case"select":f._wrapperState={wasMultiple:!!L.multiple},O=P({},L,{value:void 0}),qt("invalid",f);break;case"textarea":De(f,L),O=Pe(f,L),qt("invalid",f);break;default:O=L}he(S,O),le=O;for(V in le)if(le.hasOwnProperty(V)){var fe=le[V];V==="style"?ue(f,fe):V==="dangerouslySetInnerHTML"?(fe=fe?fe.__html:void 0,fe!=null&&Be(f,fe)):V==="children"?typeof fe=="string"?(S!=="textarea"||fe!=="")&&me(f,fe):typeof fe=="number"&&me(f,""+fe):V!=="suppressContentEditableWarning"&&V!=="suppressHydrationWarning"&&V!=="autoFocus"&&(i.hasOwnProperty(V)?fe!=null&&V==="onScroll"&&qt("scroll",f):fe!=null&&b(f,V,fe,Q))}switch(S){case"input":J(f),ke(f,L,!1);break;case"textarea":J(f),Ye(f);break;case"option":L.value!=null&&f.setAttribute("value",""+q(L.value));break;case"select":f.multiple=!!L.multiple,V=L.value,V!=null?Me(f,!!L.multiple,V,!1):L.defaultValue!=null&&Me(f,!!L.multiple,L.defaultValue,!0);break;default:typeof O.onClick=="function"&&(f.onclick=Ql)}switch(S){case"button":case"input":case"select":case"textarea":L=!!L.autoFocus;break e;case"img":L=!0;break e;default:L=!1}}L&&(d.flags|=4)}d.ref!==null&&(d.flags|=512,d.flags|=2097152)}return Br(d),null;case 6:if(f&&d.stateNode!=null)Ly(f,d,f.memoizedProps,L);else{if(typeof L!="string"&&d.stateNode===null)throw Error(r(166));if(S=ma(Eo.current),ma(Vn.current),iu(d)){if(L=d.stateNode,S=d.memoizedProps,L[Wn]=d,(V=L.nodeValue!==S)&&(f=fn,f!==null))switch(f.tag){case 3:Kl(L.nodeValue,S,(f.mode&1)!==0);break;case 5:f.memoizedProps.suppressHydrationWarning!==!0&&Kl(L.nodeValue,S,(f.mode&1)!==0)}V&&(d.flags|=4)}else L=(S.nodeType===9?S:S.ownerDocument).createTextNode(L),L[Wn]=d,d.stateNode=L}return Br(d),null;case 13:if(Yt(tr),L=d.memoizedState,f===null||f.memoizedState!==null&&f.memoizedState.dehydrated!==null){if(Zt&&dn!==null&&(d.mode&1)!==0&&(d.flags&128)===0)Am(),as(),d.flags|=98560,V=!1;else if(V=iu(d),L!==null&&L.dehydrated!==null){if(f===null){if(!V)throw Error(r(318));if(V=d.memoizedState,V=V!==null?V.dehydrated:null,!V)throw Error(r(317));V[Wn]=d}else as(),(d.flags&128)===0&&(d.memoizedState=null),d.flags|=4;Br(d),V=!1}else Mn!==null&&(Of(Mn),Mn=null),V=!0;if(!V)return d.flags&65536?d:null}return(d.flags&128)!==0?(d.lanes=S,d):(L=L!==null,L!==(f!==null&&f.memoizedState!==null)&&L&&(d.child.flags|=8192,(d.mode&1)!==0&&(f===null||(tr.current&1)!==0?gr===0&&(gr=3):jf())),d.updateQueue!==null&&(d.flags|=4),Br(d),null);case 4:return us(),Ef(f,d),f===null&&yo(d.stateNode.containerInfo),Br(d),null;case 10:return Zh(d.type._context),Br(d),null;case 17:return Jr(d.type)&&Jl(),Br(d),null;case 19:if(Yt(tr),V=d.memoizedState,V===null)return Br(d),null;if(L=(d.flags&128)!==0,Q=V.rendering,Q===null)if(L)No(V,!1);else{if(gr!==0||f!==null&&(f.flags&128)!==0)for(f=d.child;f!==null;){if(Q=cu(f),Q!==null){for(d.flags|=128,No(V,!1),L=Q.updateQueue,L!==null&&(d.updateQueue=L,d.flags|=4),d.subtreeFlags=0,L=S,S=d.child;S!==null;)V=S,f=L,V.flags&=14680066,Q=V.alternate,Q===null?(V.childLanes=0,V.lanes=f,V.child=null,V.subtreeFlags=0,V.memoizedProps=null,V.memoizedState=null,V.updateQueue=null,V.dependencies=null,V.stateNode=null):(V.childLanes=Q.childLanes,V.lanes=Q.lanes,V.child=Q.child,V.subtreeFlags=0,V.deletions=null,V.memoizedProps=Q.memoizedProps,V.memoizedState=Q.memoizedState,V.updateQueue=Q.updateQueue,V.type=Q.type,f=Q.dependencies,V.dependencies=f===null?null:{lanes:f.lanes,firstContext:f.firstContext}),S=S.sibling;return Vt(tr,tr.current&1|2),d.child}f=f.sibling}V.tail!==null&&zt()>ds&&(d.flags|=128,L=!0,No(V,!1),d.lanes=4194304)}else{if(!L)if(f=cu(Q),f!==null){if(d.flags|=128,L=!0,S=f.updateQueue,S!==null&&(d.updateQueue=S,d.flags|=4),No(V,!0),V.tail===null&&V.tailMode==="hidden"&&!Q.alternate&&!Zt)return Br(d),null}else 2*zt()-V.renderingStartTime>ds&&S!==1073741824&&(d.flags|=128,L=!0,No(V,!1),d.lanes=4194304);V.isBackwards?(Q.sibling=d.child,d.child=Q):(S=V.last,S!==null?S.sibling=Q:d.child=Q,V.last=Q)}return V.tail!==null?(d=V.tail,V.rendering=d,V.tail=d.sibling,V.renderingStartTime=zt(),d.sibling=null,S=tr.current,Vt(tr,L?S&1|2:S&1),d):(Br(d),null);case 22:case 23:return Ff(),L=d.memoizedState!==null,f!==null&&f.memoizedState!==null!==L&&(d.flags|=8192),L&&(d.mode&1)!==0?(pn&1073741824)!==0&&(Br(d),d.subtreeFlags&6&&(d.flags|=8192)):Br(d),null;case 24:return null;case 25:return null}throw Error(r(156,d.tag))}function LC(f,d){switch(Gh(d),d.tag){case 1:return Jr(d.type)&&Jl(),f=d.flags,f&65536?(d.flags=f&-65537|128,d):null;case 3:return us(),Yt(Zr),Yt(Ir),sf(),f=d.flags,(f&65536)!==0&&(f&128)===0?(d.flags=f&-65537|128,d):null;case 5:return nf(d),null;case 13:if(Yt(tr),f=d.memoizedState,f!==null&&f.dehydrated!==null){if(d.alternate===null)throw Error(r(340));as()}return f=d.flags,f&65536?(d.flags=f&-65537|128,d):null;case 19:return Yt(tr),null;case 4:return us(),null;case 10:return Zh(d.type._context),null;case 22:case 23:return Ff(),null;case 24:return null;default:return null}}var xu=!1,Fr=!1,NC=typeof WeakSet=="function"?WeakSet:Set,et=null;function hs(f,d){var S=f.ref;if(S!==null)if(typeof S=="function")try{S(null)}catch(L){ar(f,d,L)}else S.current=null}function kf(f,d,S){try{S()}catch(L){ar(f,d,L)}}var Ny=!1;function DC(f,d){if(Bh=jl,f=lm(),Lh(f)){if("selectionStart"in f)var S={start:f.selectionStart,end:f.selectionEnd};else e:{S=(S=f.ownerDocument)&&S.defaultView||window;var L=S.getSelection&&S.getSelection();if(L&&L.rangeCount!==0){S=L.anchorNode;var O=L.anchorOffset,V=L.focusNode;L=L.focusOffset;try{S.nodeType,V.nodeType}catch{S=null;break e}var Q=0,le=-1,fe=-1,we=0,Oe=0,He=f,Ie=null;t:for(;;){for(var Je;He!==S||O!==0&&He.nodeType!==3||(le=Q+O),He!==V||L!==0&&He.nodeType!==3||(fe=Q+L),He.nodeType===3&&(Q+=He.nodeValue.length),(Je=He.firstChild)!==null;)Ie=He,He=Je;for(;;){if(He===f)break t;if(Ie===S&&++we===O&&(le=Q),Ie===V&&++Oe===L&&(fe=Q),(Je=He.nextSibling)!==null)break;He=Ie,Ie=He.parentNode}He=Je}S=le===-1||fe===-1?null:{start:le,end:fe}}else S=null}S=S||{start:0,end:0}}else S=null;for(Fh={focusedElem:f,selectionRange:S},jl=!1,et=d;et!==null;)if(d=et,f=d.child,(d.subtreeFlags&1028)!==0&&f!==null)f.return=d,et=f;else for(;et!==null;){d=et;try{var nt=d.alternate;if((d.flags&1024)!==0)switch(d.tag){case 0:case 11:case 15:break;case 1:if(nt!==null){var at=nt.memoizedProps,or=nt.memoizedState,ye=d.stateNode,ve=ye.getSnapshotBeforeUpdate(d.elementType===d.type?at:Pn(d.type,at),or);ye.__reactInternalSnapshotBeforeUpdate=ve}break;case 3:var xe=d.stateNode.containerInfo;xe.nodeType===1?xe.textContent="":xe.nodeType===9&&xe.documentElement&&xe.removeChild(xe.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch($e){ar(d,d.return,$e)}if(f=d.sibling,f!==null){f.return=d.return,et=f;break}et=d.return}return nt=Ny,Ny=!1,nt}function Do(f,d,S){var L=d.updateQueue;if(L=L!==null?L.lastEffect:null,L!==null){var O=L=L.next;do{if((O.tag&f)===f){var V=O.destroy;O.destroy=void 0,V!==void 0&&kf(d,S,V)}O=O.next}while(O!==L)}}function bu(f,d){if(d=d.updateQueue,d=d!==null?d.lastEffect:null,d!==null){var S=d=d.next;do{if((S.tag&f)===f){var L=S.create;S.destroy=L()}S=S.next}while(S!==d)}}function Tf(f){var d=f.ref;if(d!==null){var S=f.stateNode;switch(f.tag){case 5:f=S;break;default:f=S}typeof d=="function"?d(f):d.current=f}}function Dy(f){var d=f.alternate;d!==null&&(f.alternate=null,Dy(d)),f.child=null,f.deletions=null,f.sibling=null,f.tag===5&&(d=f.stateNode,d!==null&&(delete d[Wn],delete d[bo],delete d[Uh],delete d[dC],delete d[pC])),f.stateNode=null,f.return=null,f.dependencies=null,f.memoizedProps=null,f.memoizedState=null,f.pendingProps=null,f.stateNode=null,f.updateQueue=null}function Ay(f){return f.tag===5||f.tag===3||f.tag===4}function My(f){e:for(;;){for(;f.sibling===null;){if(f.return===null||Ay(f.return))return null;f=f.return}for(f.sibling.return=f.return,f=f.sibling;f.tag!==5&&f.tag!==6&&f.tag!==18;){if(f.flags&2||f.child===null||f.tag===4)continue e;f.child.return=f,f=f.child}if(!(f.flags&2))return f.stateNode}}function Rf(f,d,S){var L=f.tag;if(L===5||L===6)f=f.stateNode,d?S.nodeType===8?S.parentNode.insertBefore(f,d):S.insertBefore(f,d):(S.nodeType===8?(d=S.parentNode,d.insertBefore(f,S)):(d=S,d.appendChild(f)),S=S._reactRootContainer,S!=null||d.onclick!==null||(d.onclick=Ql));else if(L!==4&&(f=f.child,f!==null))for(Rf(f,d,S),f=f.sibling;f!==null;)Rf(f,d,S),f=f.sibling}function Lf(f,d,S){var L=f.tag;if(L===5||L===6)f=f.stateNode,d?S.insertBefore(f,d):S.appendChild(f);else if(L!==4&&(f=f.child,f!==null))for(Lf(f,d,S),f=f.sibling;f!==null;)Lf(f,d,S),f=f.sibling}var Rr=null,In=!1;function Pi(f,d,S){for(S=S.child;S!==null;)Py(f,d,S),S=S.sibling}function Py(f,d,S){if(rt&&typeof rt.onCommitFiberUnmount=="function")try{rt.onCommitFiberUnmount(Qt,S)}catch{}switch(S.tag){case 5:Fr||hs(S,d);case 6:var L=Rr,O=In;Rr=null,Pi(f,d,S),Rr=L,In=O,Rr!==null&&(In?(f=Rr,S=S.stateNode,f.nodeType===8?f.parentNode.removeChild(S):f.removeChild(S)):Rr.removeChild(S.stateNode));break;case 18:Rr!==null&&(In?(f=Rr,S=S.stateNode,f.nodeType===8?Hh(f.parentNode,S):f.nodeType===1&&Hh(f,S),lo(f)):Hh(Rr,S.stateNode));break;case 4:L=Rr,O=In,Rr=S.stateNode.containerInfo,In=!0,Pi(f,d,S),Rr=L,In=O;break;case 0:case 11:case 14:case 15:if(!Fr&&(L=S.updateQueue,L!==null&&(L=L.lastEffect,L!==null))){O=L=L.next;do{var V=O,Q=V.destroy;V=V.tag,Q!==void 0&&((V&2)!==0||(V&4)!==0)&&kf(S,d,Q),O=O.next}while(O!==L)}Pi(f,d,S);break;case 1:if(!Fr&&(hs(S,d),L=S.stateNode,typeof L.componentWillUnmount=="function"))try{L.props=S.memoizedProps,L.state=S.memoizedState,L.componentWillUnmount()}catch(le){ar(S,d,le)}Pi(f,d,S);break;case 21:Pi(f,d,S);break;case 22:S.mode&1?(Fr=(L=Fr)||S.memoizedState!==null,Pi(f,d,S),Fr=L):Pi(f,d,S);break;default:Pi(f,d,S)}}function Iy(f){var d=f.updateQueue;if(d!==null){f.updateQueue=null;var S=f.stateNode;S===null&&(S=f.stateNode=new NC),d.forEach(function(L){var O=zC.bind(null,f,L);S.has(L)||(S.add(L),L.then(O,O))})}}function On(f,d){var S=d.deletions;if(S!==null)for(var L=0;L<S.length;L++){var O=S[L];try{var V=f,Q=d,le=Q;e:for(;le!==null;){switch(le.tag){case 5:Rr=le.stateNode,In=!1;break e;case 3:Rr=le.stateNode.containerInfo,In=!0;break e;case 4:Rr=le.stateNode.containerInfo,In=!0;break e}le=le.return}if(Rr===null)throw Error(r(160));Py(V,Q,O),Rr=null,In=!1;var fe=O.alternate;fe!==null&&(fe.return=null),O.return=null}catch(we){ar(O,d,we)}}if(d.subtreeFlags&12854)for(d=d.child;d!==null;)Oy(d,f),d=d.sibling}function Oy(f,d){var S=f.alternate,L=f.flags;switch(f.tag){case 0:case 11:case 14:case 15:if(On(d,f),Gn(f),L&4){try{Do(3,f,f.return),bu(3,f)}catch(at){ar(f,f.return,at)}try{Do(5,f,f.return)}catch(at){ar(f,f.return,at)}}break;case 1:On(d,f),Gn(f),L&512&&S!==null&&hs(S,S.return);break;case 5:if(On(d,f),Gn(f),L&512&&S!==null&&hs(S,S.return),f.flags&32){var O=f.stateNode;try{me(O,"")}catch(at){ar(f,f.return,at)}}if(L&4&&(O=f.stateNode,O!=null)){var V=f.memoizedProps,Q=S!==null?S.memoizedProps:V,le=f.type,fe=f.updateQueue;if(f.updateQueue=null,fe!==null)try{le==="input"&&V.type==="radio"&&V.name!=null&&je(O,V),pe(le,Q);var we=pe(le,V);for(Q=0;Q<fe.length;Q+=2){var Oe=fe[Q],He=fe[Q+1];Oe==="style"?ue(O,He):Oe==="dangerouslySetInnerHTML"?Be(O,He):Oe==="children"?me(O,He):b(O,Oe,He,we)}switch(le){case"input":_e(O,V);break;case"textarea":Ue(O,V);break;case"select":var Ie=O._wrapperState.wasMultiple;O._wrapperState.wasMultiple=!!V.multiple;var Je=V.value;Je!=null?Me(O,!!V.multiple,Je,!1):Ie!==!!V.multiple&&(V.defaultValue!=null?Me(O,!!V.multiple,V.defaultValue,!0):Me(O,!!V.multiple,V.multiple?[]:"",!1))}O[bo]=V}catch(at){ar(f,f.return,at)}}break;case 6:if(On(d,f),Gn(f),L&4){if(f.stateNode===null)throw Error(r(162));O=f.stateNode,V=f.memoizedProps;try{O.nodeValue=V}catch(at){ar(f,f.return,at)}}break;case 3:if(On(d,f),Gn(f),L&4&&S!==null&&S.memoizedState.isDehydrated)try{lo(d.containerInfo)}catch(at){ar(f,f.return,at)}break;case 4:On(d,f),Gn(f);break;case 13:On(d,f),Gn(f),O=f.child,O.flags&8192&&(V=O.memoizedState!==null,O.stateNode.isHidden=V,!V||O.alternate!==null&&O.alternate.memoizedState!==null||(Af=zt())),L&4&&Iy(f);break;case 22:if(Oe=S!==null&&S.memoizedState!==null,f.mode&1?(Fr=(we=Fr)||Oe,On(d,f),Fr=we):On(d,f),Gn(f),L&8192){if(we=f.memoizedState!==null,(f.stateNode.isHidden=we)&&!Oe&&(f.mode&1)!==0)for(et=f,Oe=f.child;Oe!==null;){for(He=et=Oe;et!==null;){switch(Ie=et,Je=Ie.child,Ie.tag){case 0:case 11:case 14:case 15:Do(4,Ie,Ie.return);break;case 1:hs(Ie,Ie.return);var nt=Ie.stateNode;if(typeof nt.componentWillUnmount=="function"){L=Ie,S=Ie.return;try{d=L,nt.props=d.memoizedProps,nt.state=d.memoizedState,nt.componentWillUnmount()}catch(at){ar(L,S,at)}}break;case 5:hs(Ie,Ie.return);break;case 22:if(Ie.memoizedState!==null){jy(He);continue}}Je!==null?(Je.return=Ie,et=Je):jy(He)}Oe=Oe.sibling}e:for(Oe=null,He=f;;){if(He.tag===5){if(Oe===null){Oe=He;try{O=He.stateNode,we?(V=O.style,typeof V.setProperty=="function"?V.setProperty("display","none","important"):V.display="none"):(le=He.stateNode,fe=He.memoizedProps.style,Q=fe!=null&&fe.hasOwnProperty("display")?fe.display:null,le.style.display=oe("display",Q))}catch(at){ar(f,f.return,at)}}}else if(He.tag===6){if(Oe===null)try{He.stateNode.nodeValue=we?"":He.memoizedProps}catch(at){ar(f,f.return,at)}}else if((He.tag!==22&&He.tag!==23||He.memoizedState===null||He===f)&&He.child!==null){He.child.return=He,He=He.child;continue}if(He===f)break e;for(;He.sibling===null;){if(He.return===null||He.return===f)break e;Oe===He&&(Oe=null),He=He.return}Oe===He&&(Oe=null),He.sibling.return=He.return,He=He.sibling}}break;case 19:On(d,f),Gn(f),L&4&&Iy(f);break;case 21:break;default:On(d,f),Gn(f)}}function Gn(f){var d=f.flags;if(d&2){try{e:{for(var S=f.return;S!==null;){if(Ay(S)){var L=S;break e}S=S.return}throw Error(r(160))}switch(L.tag){case 5:var O=L.stateNode;L.flags&32&&(me(O,""),L.flags&=-33);var V=My(f);Lf(f,V,O);break;case 3:case 4:var Q=L.stateNode.containerInfo,le=My(f);Rf(f,le,Q);break;default:throw Error(r(161))}}catch(fe){ar(f,f.return,fe)}f.flags&=-3}d&4096&&(f.flags&=-4097)}function AC(f,d,S){et=f,By(f)}function By(f,d,S){for(var L=(f.mode&1)!==0;et!==null;){var O=et,V=O.child;if(O.tag===22&&L){var Q=O.memoizedState!==null||xu;if(!Q){var le=O.alternate,fe=le!==null&&le.memoizedState!==null||Fr;le=xu;var we=Fr;if(xu=Q,(Fr=fe)&&!we)for(et=O;et!==null;)Q=et,fe=Q.child,Q.tag===22&&Q.memoizedState!==null?zy(O):fe!==null?(fe.return=Q,et=fe):zy(O);for(;V!==null;)et=V,By(V),V=V.sibling;et=O,xu=le,Fr=we}Fy(f)}else(O.subtreeFlags&8772)!==0&&V!==null?(V.return=O,et=V):Fy(f)}}function Fy(f){for(;et!==null;){var d=et;if((d.flags&8772)!==0){var S=d.alternate;try{if((d.flags&8772)!==0)switch(d.tag){case 0:case 11:case 15:Fr||bu(5,d);break;case 1:var L=d.stateNode;if(d.flags&4&&!Fr)if(S===null)L.componentDidMount();else{var O=d.elementType===d.type?S.memoizedProps:Pn(d.type,S.memoizedProps);L.componentDidUpdate(O,S.memoizedState,L.__reactInternalSnapshotBeforeUpdate)}var V=d.updateQueue;V!==null&&jm(d,V,L);break;case 3:var Q=d.updateQueue;if(Q!==null){if(S=null,d.child!==null)switch(d.child.tag){case 5:S=d.child.stateNode;break;case 1:S=d.child.stateNode}jm(d,Q,S)}break;case 5:var le=d.stateNode;if(S===null&&d.flags&4){S=le;var fe=d.memoizedProps;switch(d.type){case"button":case"input":case"select":case"textarea":fe.autoFocus&&S.focus();break;case"img":fe.src&&(S.src=fe.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(d.memoizedState===null){var we=d.alternate;if(we!==null){var Oe=we.memoizedState;if(Oe!==null){var He=Oe.dehydrated;He!==null&&lo(He)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}Fr||d.flags&512&&Tf(d)}catch(Ie){ar(d,d.return,Ie)}}if(d===f){et=null;break}if(S=d.sibling,S!==null){S.return=d.return,et=S;break}et=d.return}}function jy(f){for(;et!==null;){var d=et;if(d===f){et=null;break}var S=d.sibling;if(S!==null){S.return=d.return,et=S;break}et=d.return}}function zy(f){for(;et!==null;){var d=et;try{switch(d.tag){case 0:case 11:case 15:var S=d.return;try{bu(4,d)}catch(fe){ar(d,S,fe)}break;case 1:var L=d.stateNode;if(typeof L.componentDidMount=="function"){var O=d.return;try{L.componentDidMount()}catch(fe){ar(d,O,fe)}}var V=d.return;try{Tf(d)}catch(fe){ar(d,V,fe)}break;case 5:var Q=d.return;try{Tf(d)}catch(fe){ar(d,Q,fe)}}}catch(fe){ar(d,d.return,fe)}if(d===f){et=null;break}var le=d.sibling;if(le!==null){le.return=d.return,et=le;break}et=d.return}}var MC=Math.ceil,wu=_.ReactCurrentDispatcher,Nf=_.ReactCurrentOwner,Cn=_.ReactCurrentBatchConfig,Lt=0,_r=null,hr=null,Lr=0,pn=0,fs=Li(0),gr=0,Ao=null,xa=0,_u=0,Df=0,Mo=null,tn=null,Af=0,ds=1/0,fi=null,Su=!1,Mf=null,Ii=null,Cu=!1,Oi=null,Eu=0,Po=0,Pf=null,ku=-1,Tu=0;function Gr(){return(Lt&6)!==0?zt():ku!==-1?ku:ku=zt()}function Bi(f){return(f.mode&1)===0?1:(Lt&2)!==0&&Lr!==0?Lr&-Lr:gC.transition!==null?(Tu===0&&(Tu=Mg()),Tu):(f=Ft,f!==0||(f=window.event,f=f===void 0?16:Ug(f.type)),f)}function Bn(f,d,S,L){if(50<Po)throw Po=0,Pf=null,Error(r(185));no(f,S,L),((Lt&2)===0||f!==_r)&&(f===_r&&((Lt&2)===0&&(_u|=S),gr===4&&Fi(f,Lr)),rn(f,L),S===1&&Lt===0&&(d.mode&1)===0&&(ds=zt()+500,tu&&Di()))}function rn(f,d){var S=f.callbackNode;g2(f,d);var L=Ol(f,f===_r?Lr:0);if(L===0)S!==null&&ca(S),f.callbackNode=null,f.callbackPriority=0;else if(d=L&-L,f.callbackPriority!==d){if(S!=null&&ca(S),d===1)f.tag===0?vC(Uy.bind(null,f)):Tm(Uy.bind(null,f)),hC(function(){(Lt&6)===0&&Di()}),S=null;else{switch(Pg(L)){case 1:S=un;break;case 4:S=ii;break;case 16:S=xn;break;case 536870912:S=wi;break;default:S=xn}S=Ky(S,Hy.bind(null,f))}f.callbackPriority=d,f.callbackNode=S}}function Hy(f,d){if(ku=-1,Tu=0,(Lt&6)!==0)throw Error(r(327));var S=f.callbackNode;if(ps()&&f.callbackNode!==S)return null;var L=Ol(f,f===_r?Lr:0);if(L===0)return null;if((L&30)!==0||(L&f.expiredLanes)!==0||d)d=Ru(f,L);else{d=L;var O=Lt;Lt|=2;var V=Vy();(_r!==f||Lr!==d)&&(fi=null,ds=zt()+500,wa(f,d));do try{OC();break}catch(le){Wy(f,le)}while(!0);Qh(),wu.current=V,Lt=O,hr!==null?d=0:(_r=null,Lr=0,d=gr)}if(d!==0){if(d===2&&(O=dh(f),O!==0&&(L=O,d=If(f,O))),d===1)throw S=Ao,wa(f,0),Fi(f,L),rn(f,zt()),S;if(d===6)Fi(f,L);else{if(O=f.current.alternate,(L&30)===0&&!PC(O)&&(d=Ru(f,L),d===2&&(V=dh(f),V!==0&&(L=V,d=If(f,V))),d===1))throw S=Ao,wa(f,0),Fi(f,L),rn(f,zt()),S;switch(f.finishedWork=O,f.finishedLanes=L,d){case 0:case 1:throw Error(r(345));case 2:_a(f,tn,fi);break;case 3:if(Fi(f,L),(L&130023424)===L&&(d=Af+500-zt(),10<d)){if(Ol(f,0)!==0)break;if(O=f.suspendedLanes,(O&L)!==L){Gr(),f.pingedLanes|=f.suspendedLanes&O;break}f.timeoutHandle=zh(_a.bind(null,f,tn,fi),d);break}_a(f,tn,fi);break;case 4:if(Fi(f,L),(L&4194240)===L)break;for(d=f.eventTimes,O=-1;0<L;){var Q=31-er(L);V=1<<Q,Q=d[Q],Q>O&&(O=Q),L&=~V}if(L=O,L=zt()-L,L=(120>L?120:480>L?480:1080>L?1080:1920>L?1920:3e3>L?3e3:4320>L?4320:1960*MC(L/1960))-L,10<L){f.timeoutHandle=zh(_a.bind(null,f,tn,fi),L);break}_a(f,tn,fi);break;case 5:_a(f,tn,fi);break;default:throw Error(r(329))}}}return rn(f,zt()),f.callbackNode===S?Hy.bind(null,f):null}function If(f,d){var S=Mo;return f.current.memoizedState.isDehydrated&&(wa(f,d).flags|=256),f=Ru(f,d),f!==2&&(d=tn,tn=S,d!==null&&Of(d)),f}function Of(f){tn===null?tn=f:tn.push.apply(tn,f)}function PC(f){for(var d=f;;){if(d.flags&16384){var S=d.updateQueue;if(S!==null&&(S=S.stores,S!==null))for(var L=0;L<S.length;L++){var O=S[L],V=O.getSnapshot;O=O.value;try{if(!An(V(),O))return!1}catch{return!1}}}if(S=d.child,d.subtreeFlags&16384&&S!==null)S.return=d,d=S;else{if(d===f)break;for(;d.sibling===null;){if(d.return===null||d.return===f)return!0;d=d.return}d.sibling.return=d.return,d=d.sibling}}return!0}function Fi(f,d){for(d&=~Df,d&=~_u,f.suspendedLanes|=d,f.pingedLanes&=~d,f=f.expirationTimes;0<d;){var S=31-er(d),L=1<<S;f[S]=-1,d&=~L}}function Uy(f){if((Lt&6)!==0)throw Error(r(327));ps();var d=Ol(f,0);if((d&1)===0)return rn(f,zt()),null;var S=Ru(f,d);if(f.tag!==0&&S===2){var L=dh(f);L!==0&&(d=L,S=If(f,L))}if(S===1)throw S=Ao,wa(f,0),Fi(f,d),rn(f,zt()),S;if(S===6)throw Error(r(345));return f.finishedWork=f.current.alternate,f.finishedLanes=d,_a(f,tn,fi),rn(f,zt()),null}function Bf(f,d){var S=Lt;Lt|=1;try{return f(d)}finally{Lt=S,Lt===0&&(ds=zt()+500,tu&&Di())}}function ba(f){Oi!==null&&Oi.tag===0&&(Lt&6)===0&&ps();var d=Lt;Lt|=1;var S=Cn.transition,L=Ft;try{if(Cn.transition=null,Ft=1,f)return f()}finally{Ft=L,Cn.transition=S,Lt=d,(Lt&6)===0&&Di()}}function Ff(){pn=fs.current,Yt(fs)}function wa(f,d){f.finishedWork=null,f.finishedLanes=0;var S=f.timeoutHandle;if(S!==-1&&(f.timeoutHandle=-1,cC(S)),hr!==null)for(S=hr.return;S!==null;){var L=S;switch(Gh(L),L.tag){case 1:L=L.type.childContextTypes,L!=null&&Jl();break;case 3:us(),Yt(Zr),Yt(Ir),sf();break;case 5:nf(L);break;case 4:us();break;case 13:Yt(tr);break;case 19:Yt(tr);break;case 10:Zh(L.type._context);break;case 22:case 23:Ff()}S=S.return}if(_r=f,hr=f=ji(f.current,null),Lr=pn=d,gr=0,Ao=null,Df=_u=xa=0,tn=Mo=null,ga!==null){for(d=0;d<ga.length;d++)if(S=ga[d],L=S.interleaved,L!==null){S.interleaved=null;var O=L.next,V=S.pending;if(V!==null){var Q=V.next;V.next=O,L.next=Q}S.pending=L}ga=null}return f}function Wy(f,d){do{var S=hr;try{if(Qh(),hu.current=vu,fu){for(var L=rr.memoizedState;L!==null;){var O=L.queue;O!==null&&(O.pending=null),L=L.next}fu=!1}if(ya=0,wr=vr=rr=null,ko=!1,To=0,Nf.current=null,S===null||S.return===null){gr=1,Ao=d,hr=null;break}e:{var V=f,Q=S.return,le=S,fe=d;if(d=Lr,le.flags|=32768,fe!==null&&typeof fe=="object"&&typeof fe.then=="function"){var we=fe,Oe=le,He=Oe.tag;if((Oe.mode&1)===0&&(He===0||He===11||He===15)){var Ie=Oe.alternate;Ie?(Oe.updateQueue=Ie.updateQueue,Oe.memoizedState=Ie.memoizedState,Oe.lanes=Ie.lanes):(Oe.updateQueue=null,Oe.memoizedState=null)}var Je=py(Q);if(Je!==null){Je.flags&=-257,vy(Je,Q,le,V,d),Je.mode&1&&dy(V,we,d),d=Je,fe=we;var nt=d.updateQueue;if(nt===null){var at=new Set;at.add(fe),d.updateQueue=at}else nt.add(fe);break e}else{if((d&1)===0){dy(V,we,d),jf();break e}fe=Error(r(426))}}else if(Zt&&le.mode&1){var or=py(Q);if(or!==null){(or.flags&65536)===0&&(or.flags|=256),vy(or,Q,le,V,d),Xh(cs(fe,le));break e}}V=fe=cs(fe,le),gr!==4&&(gr=2),Mo===null?Mo=[V]:Mo.push(V),V=Q;do{switch(V.tag){case 3:V.flags|=65536,d&=-d,V.lanes|=d;var ye=hy(V,fe,d);Fm(V,ye);break e;case 1:le=fe;var ve=V.type,xe=V.stateNode;if((V.flags&128)===0&&(typeof ve.getDerivedStateFromError=="function"||xe!==null&&typeof xe.componentDidCatch=="function"&&(Ii===null||!Ii.has(xe)))){V.flags|=65536,d&=-d,V.lanes|=d;var $e=fy(V,le,d);Fm(V,$e);break e}}V=V.return}while(V!==null)}Gy(S)}catch(ot){d=ot,hr===S&&S!==null&&(hr=S=S.return);continue}break}while(!0)}function Vy(){var f=wu.current;return wu.current=vu,f===null?vu:f}function jf(){(gr===0||gr===3||gr===2)&&(gr=4),_r===null||(xa&268435455)===0&&(_u&268435455)===0||Fi(_r,Lr)}function Ru(f,d){var S=Lt;Lt|=2;var L=Vy();(_r!==f||Lr!==d)&&(fi=null,wa(f,d));do try{IC();break}catch(O){Wy(f,O)}while(!0);if(Qh(),Lt=S,wu.current=L,hr!==null)throw Error(r(261));return _r=null,Lr=0,gr}function IC(){for(;hr!==null;)$y(hr)}function OC(){for(;hr!==null&&!ha();)$y(hr)}function $y(f){var d=Xy(f.alternate,f,pn);f.memoizedProps=f.pendingProps,d===null?Gy(f):hr=d,Nf.current=null}function Gy(f){var d=f;do{var S=d.alternate;if(f=d.return,(d.flags&32768)===0){if(S=RC(S,d,pn),S!==null){hr=S;return}}else{if(S=LC(S,d),S!==null){S.flags&=32767,hr=S;return}if(f!==null)f.flags|=32768,f.subtreeFlags=0,f.deletions=null;else{gr=6,hr=null;return}}if(d=d.sibling,d!==null){hr=d;return}hr=d=f}while(d!==null);gr===0&&(gr=5)}function _a(f,d,S){var L=Ft,O=Cn.transition;try{Cn.transition=null,Ft=1,BC(f,d,S,L)}finally{Cn.transition=O,Ft=L}return null}function BC(f,d,S,L){do ps();while(Oi!==null);if((Lt&6)!==0)throw Error(r(327));S=f.finishedWork;var O=f.finishedLanes;if(S===null)return null;if(f.finishedWork=null,f.finishedLanes=0,S===f.current)throw Error(r(177));f.callbackNode=null,f.callbackPriority=0;var V=S.lanes|S.childLanes;if(m2(f,V),f===_r&&(hr=_r=null,Lr=0),(S.subtreeFlags&2064)===0&&(S.flags&2064)===0||Cu||(Cu=!0,Ky(xn,function(){return ps(),null})),V=(S.flags&15990)!==0,(S.subtreeFlags&15990)!==0||V){V=Cn.transition,Cn.transition=null;var Q=Ft;Ft=1;var le=Lt;Lt|=4,Nf.current=null,DC(f,S),Oy(S,f),nC(Fh),jl=!!Bh,Fh=Bh=null,f.current=S,AC(S),$a(),Lt=le,Ft=Q,Cn.transition=V}else f.current=S;if(Cu&&(Cu=!1,Oi=f,Eu=O),V=f.pendingLanes,V===0&&(Ii=null),Et(S.stateNode),rn(f,zt()),d!==null)for(L=f.onRecoverableError,S=0;S<d.length;S++)O=d[S],L(O.value,{componentStack:O.stack,digest:O.digest});if(Su)throw Su=!1,f=Mf,Mf=null,f;return(Eu&1)!==0&&f.tag!==0&&ps(),V=f.pendingLanes,(V&1)!==0?f===Pf?Po++:(Po=0,Pf=f):Po=0,Di(),null}function ps(){if(Oi!==null){var f=Pg(Eu),d=Cn.transition,S=Ft;try{if(Cn.transition=null,Ft=16>f?16:f,Oi===null)var L=!1;else{if(f=Oi,Oi=null,Eu=0,(Lt&6)!==0)throw Error(r(331));var O=Lt;for(Lt|=4,et=f.current;et!==null;){var V=et,Q=V.child;if((et.flags&16)!==0){var le=V.deletions;if(le!==null){for(var fe=0;fe<le.length;fe++){var we=le[fe];for(et=we;et!==null;){var Oe=et;switch(Oe.tag){case 0:case 11:case 15:Do(8,Oe,V)}var He=Oe.child;if(He!==null)He.return=Oe,et=He;else for(;et!==null;){Oe=et;var Ie=Oe.sibling,Je=Oe.return;if(Dy(Oe),Oe===we){et=null;break}if(Ie!==null){Ie.return=Je,et=Ie;break}et=Je}}}var nt=V.alternate;if(nt!==null){var at=nt.child;if(at!==null){nt.child=null;do{var or=at.sibling;at.sibling=null,at=or}while(at!==null)}}et=V}}if((V.subtreeFlags&2064)!==0&&Q!==null)Q.return=V,et=Q;else e:for(;et!==null;){if(V=et,(V.flags&2048)!==0)switch(V.tag){case 0:case 11:case 15:Do(9,V,V.return)}var ye=V.sibling;if(ye!==null){ye.return=V.return,et=ye;break e}et=V.return}}var ve=f.current;for(et=ve;et!==null;){Q=et;var xe=Q.child;if((Q.subtreeFlags&2064)!==0&&xe!==null)xe.return=Q,et=xe;else e:for(Q=ve;et!==null;){if(le=et,(le.flags&2048)!==0)try{switch(le.tag){case 0:case 11:case 15:bu(9,le)}}catch(ot){ar(le,le.return,ot)}if(le===Q){et=null;break e}var $e=le.sibling;if($e!==null){$e.return=le.return,et=$e;break e}et=le.return}}if(Lt=O,Di(),rt&&typeof rt.onPostCommitFiberRoot=="function")try{rt.onPostCommitFiberRoot(Qt,f)}catch{}L=!0}return L}finally{Ft=S,Cn.transition=d}}return!1}function qy(f,d,S){d=cs(S,d),d=hy(f,d,1),f=Mi(f,d,1),d=Gr(),f!==null&&(no(f,1,d),rn(f,d))}function ar(f,d,S){if(f.tag===3)qy(f,f,S);else for(;d!==null;){if(d.tag===3){qy(d,f,S);break}else if(d.tag===1){var L=d.stateNode;if(typeof d.type.getDerivedStateFromError=="function"||typeof L.componentDidCatch=="function"&&(Ii===null||!Ii.has(L))){f=cs(S,f),f=fy(d,f,1),d=Mi(d,f,1),f=Gr(),d!==null&&(no(d,1,f),rn(d,f));break}}d=d.return}}function FC(f,d,S){var L=f.pingCache;L!==null&&L.delete(d),d=Gr(),f.pingedLanes|=f.suspendedLanes&S,_r===f&&(Lr&S)===S&&(gr===4||gr===3&&(Lr&130023424)===Lr&&500>zt()-Af?wa(f,0):Df|=S),rn(f,d)}function Yy(f,d){d===0&&((f.mode&1)===0?d=1:(d=Ga,Ga<<=1,(Ga&130023424)===0&&(Ga=4194304)));var S=Gr();f=ui(f,d),f!==null&&(no(f,d,S),rn(f,S))}function jC(f){var d=f.memoizedState,S=0;d!==null&&(S=d.retryLane),Yy(f,S)}function zC(f,d){var S=0;switch(f.tag){case 13:var L=f.stateNode,O=f.memoizedState;O!==null&&(S=O.retryLane);break;case 19:L=f.stateNode;break;default:throw Error(r(314))}L!==null&&L.delete(d),Yy(f,S)}var Xy;Xy=function(f,d,S){if(f!==null)if(f.memoizedProps!==d.pendingProps||Zr.current)en=!0;else{if((f.lanes&S)===0&&(d.flags&128)===0)return en=!1,TC(f,d,S);en=(f.flags&131072)!==0}else en=!1,Zt&&(d.flags&1048576)!==0&&Rm(d,nu,d.index);switch(d.lanes=0,d.tag){case 2:var L=d.type;yu(f,d),f=d.pendingProps;var O=rs(d,Ir.current);ls(d,S),O=uf(null,d,L,f,O,S);var V=cf();return d.flags|=1,typeof O=="object"&&O!==null&&typeof O.render=="function"&&O.$$typeof===void 0?(d.tag=1,d.memoizedState=null,d.updateQueue=null,Jr(L)?(V=!0,eu(d)):V=!1,d.memoizedState=O.state!==null&&O.state!==void 0?O.state:null,tf(d),O.updater=gu,d.stateNode=O,O._reactInternals=d,gf(d,L,f,S),d=bf(null,d,L,!0,V,S)):(d.tag=0,Zt&&V&&$h(d),$r(null,d,O,S),d=d.child),d;case 16:L=d.elementType;e:{switch(yu(f,d),f=d.pendingProps,O=L._init,L=O(L._payload),d.type=L,O=d.tag=UC(L),f=Pn(L,f),O){case 0:d=xf(null,d,L,f,S);break e;case 1:d=wy(null,d,L,f,S);break e;case 11:d=gy(null,d,L,f,S);break e;case 14:d=my(null,d,L,Pn(L.type,f),S);break e}throw Error(r(306,L,""))}return d;case 0:return L=d.type,O=d.pendingProps,O=d.elementType===L?O:Pn(L,O),xf(f,d,L,O,S);case 1:return L=d.type,O=d.pendingProps,O=d.elementType===L?O:Pn(L,O),wy(f,d,L,O,S);case 3:e:{if(_y(d),f===null)throw Error(r(387));L=d.pendingProps,V=d.memoizedState,O=V.element,Bm(f,d),uu(d,L,null,S);var Q=d.memoizedState;if(L=Q.element,V.isDehydrated)if(V={element:L,isDehydrated:!1,cache:Q.cache,pendingSuspenseBoundaries:Q.pendingSuspenseBoundaries,transitions:Q.transitions},d.updateQueue.baseState=V,d.memoizedState=V,d.flags&256){O=cs(Error(r(423)),d),d=Sy(f,d,L,S,O);break e}else if(L!==O){O=cs(Error(r(424)),d),d=Sy(f,d,L,S,O);break e}else for(dn=Ri(d.stateNode.containerInfo.firstChild),fn=d,Zt=!0,Mn=null,S=Im(d,null,L,S),d.child=S;S;)S.flags=S.flags&-3|4096,S=S.sibling;else{if(as(),L===O){d=hi(f,d,S);break e}$r(f,d,L,S)}d=d.child}return d;case 5:return zm(d),f===null&&Yh(d),L=d.type,O=d.pendingProps,V=f!==null?f.memoizedProps:null,Q=O.children,jh(L,O)?Q=null:V!==null&&jh(L,V)&&(d.flags|=32),by(f,d),$r(f,d,Q,S),d.child;case 6:return f===null&&Yh(d),null;case 13:return Cy(f,d,S);case 4:return rf(d,d.stateNode.containerInfo),L=d.pendingProps,f===null?d.child=ss(d,null,L,S):$r(f,d,L,S),d.child;case 11:return L=d.type,O=d.pendingProps,O=d.elementType===L?O:Pn(L,O),gy(f,d,L,O,S);case 7:return $r(f,d,d.pendingProps,S),d.child;case 8:return $r(f,d,d.pendingProps.children,S),d.child;case 12:return $r(f,d,d.pendingProps.children,S),d.child;case 10:e:{if(L=d.type._context,O=d.pendingProps,V=d.memoizedProps,Q=O.value,Vt(su,L._currentValue),L._currentValue=Q,V!==null)if(An(V.value,Q)){if(V.children===O.children&&!Zr.current){d=hi(f,d,S);break e}}else for(V=d.child,V!==null&&(V.return=d);V!==null;){var le=V.dependencies;if(le!==null){Q=V.child;for(var fe=le.firstContext;fe!==null;){if(fe.context===L){if(V.tag===1){fe=ci(-1,S&-S),fe.tag=2;var we=V.updateQueue;if(we!==null){we=we.shared;var Oe=we.pending;Oe===null?fe.next=fe:(fe.next=Oe.next,Oe.next=fe),we.pending=fe}}V.lanes|=S,fe=V.alternate,fe!==null&&(fe.lanes|=S),Jh(V.return,S,d),le.lanes|=S;break}fe=fe.next}}else if(V.tag===10)Q=V.type===d.type?null:V.child;else if(V.tag===18){if(Q=V.return,Q===null)throw Error(r(341));Q.lanes|=S,le=Q.alternate,le!==null&&(le.lanes|=S),Jh(Q,S,d),Q=V.sibling}else Q=V.child;if(Q!==null)Q.return=V;else for(Q=V;Q!==null;){if(Q===d){Q=null;break}if(V=Q.sibling,V!==null){V.return=Q.return,Q=V;break}Q=Q.return}V=Q}$r(f,d,O.children,S),d=d.child}return d;case 9:return O=d.type,L=d.pendingProps.children,ls(d,S),O=_n(O),L=L(O),d.flags|=1,$r(f,d,L,S),d.child;case 14:return L=d.type,O=Pn(L,d.pendingProps),O=Pn(L.type,O),my(f,d,L,O,S);case 15:return yy(f,d,d.type,d.pendingProps,S);case 17:return L=d.type,O=d.pendingProps,O=d.elementType===L?O:Pn(L,O),yu(f,d),d.tag=1,Jr(L)?(f=!0,eu(d)):f=!1,ls(d,S),uy(d,L,O),gf(d,L,O,S),bf(null,d,L,!0,f,S);case 19:return ky(f,d,S);case 22:return xy(f,d,S)}throw Error(r(156,d.tag))};function Ky(f,d){return Dn(f,d)}function HC(f,d,S,L){this.tag=f,this.key=S,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=d,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=L,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function En(f,d,S,L){return new HC(f,d,S,L)}function zf(f){return f=f.prototype,!(!f||!f.isReactComponent)}function UC(f){if(typeof f=="function")return zf(f)?1:0;if(f!=null){if(f=f.$$typeof,f===A)return 11;if(f===I)return 14}return 2}function ji(f,d){var S=f.alternate;return S===null?(S=En(f.tag,d,f.key,f.mode),S.elementType=f.elementType,S.type=f.type,S.stateNode=f.stateNode,S.alternate=f,f.alternate=S):(S.pendingProps=d,S.type=f.type,S.flags=0,S.subtreeFlags=0,S.deletions=null),S.flags=f.flags&14680064,S.childLanes=f.childLanes,S.lanes=f.lanes,S.child=f.child,S.memoizedProps=f.memoizedProps,S.memoizedState=f.memoizedState,S.updateQueue=f.updateQueue,d=f.dependencies,S.dependencies=d===null?null:{lanes:d.lanes,firstContext:d.firstContext},S.sibling=f.sibling,S.index=f.index,S.ref=f.ref,S}function Lu(f,d,S,L,O,V){var Q=2;if(L=f,typeof f=="function")zf(f)&&(Q=1);else if(typeof f=="string")Q=5;else e:switch(f){case T:return Sa(S.children,O,V,d);case k:Q=8,O|=8;break;case N:return f=En(12,S,d,O|2),f.elementType=N,f.lanes=V,f;case j:return f=En(13,S,d,O),f.elementType=j,f.lanes=V,f;case D:return f=En(19,S,d,O),f.elementType=D,f.lanes=V,f;case W:return Nu(S,O,V,d);default:if(typeof f=="object"&&f!==null)switch(f.$$typeof){case M:Q=10;break e;case B:Q=9;break e;case A:Q=11;break e;case I:Q=14;break e;case U:Q=16,L=null;break e}throw Error(r(130,f==null?f:typeof f,""))}return d=En(Q,S,d,O),d.elementType=f,d.type=L,d.lanes=V,d}function Sa(f,d,S,L){return f=En(7,f,L,d),f.lanes=S,f}function Nu(f,d,S,L){return f=En(22,f,L,d),f.elementType=W,f.lanes=S,f.stateNode={isHidden:!1},f}function Hf(f,d,S){return f=En(6,f,null,d),f.lanes=S,f}function Uf(f,d,S){return d=En(4,f.children!==null?f.children:[],f.key,d),d.lanes=S,d.stateNode={containerInfo:f.containerInfo,pendingChildren:null,implementation:f.implementation},d}function WC(f,d,S,L,O){this.tag=d,this.containerInfo=f,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ph(0),this.expirationTimes=ph(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ph(0),this.identifierPrefix=L,this.onRecoverableError=O,this.mutableSourceEagerHydrationData=null}function Wf(f,d,S,L,O,V,Q,le,fe){return f=new WC(f,d,S,le,fe),d===1?(d=1,V===!0&&(d|=8)):d=0,V=En(3,null,null,d),f.current=V,V.stateNode=f,V.memoizedState={element:L,isDehydrated:S,cache:null,transitions:null,pendingSuspenseBoundaries:null},tf(V),f}function VC(f,d,S){var L=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:E,key:L==null?null:""+L,children:f,containerInfo:d,implementation:S}}function Qy(f){if(!f)return Ni;f=f._reactInternals;e:{if(At(f)!==f||f.tag!==1)throw Error(r(170));var d=f;do{switch(d.tag){case 3:d=d.stateNode.context;break e;case 1:if(Jr(d.type)){d=d.stateNode.__reactInternalMemoizedMergedChildContext;break e}}d=d.return}while(d!==null);throw Error(r(171))}if(f.tag===1){var S=f.type;if(Jr(S))return Em(f,S,d)}return d}function Zy(f,d,S,L,O,V,Q,le,fe){return f=Wf(S,L,!0,f,O,V,Q,le,fe),f.context=Qy(null),S=f.current,L=Gr(),O=Bi(S),V=ci(L,O),V.callback=d??null,Mi(S,V,O),f.current.lanes=O,no(f,O,L),rn(f,L),f}function Du(f,d,S,L){var O=d.current,V=Gr(),Q=Bi(O);return S=Qy(S),d.context===null?d.context=S:d.pendingContext=S,d=ci(V,Q),d.payload={element:f},L=L===void 0?null:L,L!==null&&(d.callback=L),f=Mi(O,d,Q),f!==null&&(Bn(f,O,Q,V),lu(f,O,Q)),Q}function Au(f){if(f=f.current,!f.child)return null;switch(f.child.tag){case 5:return f.child.stateNode;default:return f.child.stateNode}}function Jy(f,d){if(f=f.memoizedState,f!==null&&f.dehydrated!==null){var S=f.retryLane;f.retryLane=S!==0&&S<d?S:d}}function Vf(f,d){Jy(f,d),(f=f.alternate)&&Jy(f,d)}function $C(){return null}var e0=typeof reportError=="function"?reportError:function(f){console.error(f)};function $f(f){this._internalRoot=f}Mu.prototype.render=$f.prototype.render=function(f){var d=this._internalRoot;if(d===null)throw Error(r(409));Du(f,d,null,null)},Mu.prototype.unmount=$f.prototype.unmount=function(){var f=this._internalRoot;if(f!==null){this._internalRoot=null;var d=f.containerInfo;ba(function(){Du(null,f,null,null)}),d[ai]=null}};function Mu(f){this._internalRoot=f}Mu.prototype.unstable_scheduleHydration=function(f){if(f){var d=Bg();f={blockedOn:null,target:f,priority:d};for(var S=0;S<Ei.length&&d!==0&&d<Ei[S].priority;S++);Ei.splice(S,0,f),S===0&&zg(f)}};function Gf(f){return!(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)}function Pu(f){return!(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11&&(f.nodeType!==8||f.nodeValue!==" react-mount-point-unstable "))}function t0(){}function GC(f,d,S,L,O){if(O){if(typeof L=="function"){var V=L;L=function(){var we=Au(Q);V.call(we)}}var Q=Zy(d,L,f,0,null,!1,!1,"",t0);return f._reactRootContainer=Q,f[ai]=Q.current,yo(f.nodeType===8?f.parentNode:f),ba(),Q}for(;O=f.lastChild;)f.removeChild(O);if(typeof L=="function"){var le=L;L=function(){var we=Au(fe);le.call(we)}}var fe=Wf(f,0,!1,null,null,!1,!1,"",t0);return f._reactRootContainer=fe,f[ai]=fe.current,yo(f.nodeType===8?f.parentNode:f),ba(function(){Du(d,fe,S,L)}),fe}function Iu(f,d,S,L,O){var V=S._reactRootContainer;if(V){var Q=V;if(typeof O=="function"){var le=O;O=function(){var fe=Au(Q);le.call(fe)}}Du(d,Q,f,O)}else Q=GC(S,d,f,O,L);return Au(Q)}Ig=function(f){switch(f.tag){case 3:var d=f.stateNode;if(d.current.memoizedState.isDehydrated){var S=ro(d.pendingLanes);S!==0&&(vh(d,S|1),rn(d,zt()),(Lt&6)===0&&(ds=zt()+500,Di()))}break;case 13:ba(function(){var L=ui(f,1);if(L!==null){var O=Gr();Bn(L,f,1,O)}}),Vf(f,1)}},gh=function(f){if(f.tag===13){var d=ui(f,134217728);if(d!==null){var S=Gr();Bn(d,f,134217728,S)}Vf(f,134217728)}},Og=function(f){if(f.tag===13){var d=Bi(f),S=ui(f,d);if(S!==null){var L=Gr();Bn(S,f,d,L)}Vf(f,d)}},Bg=function(){return Ft},Fg=function(f,d){var S=Ft;try{return Ft=f,d()}finally{Ft=S}},Te=function(f,d,S){switch(d){case"input":if(_e(f,S),d=S.name,S.type==="radio"&&d!=null){for(S=f;S.parentNode;)S=S.parentNode;for(S=S.querySelectorAll("input[name="+JSON.stringify(""+d)+'][type="radio"]'),d=0;d<S.length;d++){var L=S[d];if(L!==f&&L.form===f.form){var O=Zl(L);if(!O)throw Error(r(90));ie(L),_e(L,O)}}}break;case"textarea":Ue(f,S);break;case"select":d=S.value,d!=null&&Me(f,!!S.multiple,d,!1)}},Ze=Bf,qe=ba;var qC={usingClientEntryPoint:!1,Events:[wo,es,Zl,Ge,it,Bf]},Io={findFiberByHostInstance:fa,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},YC={bundleType:Io.bundleType,version:Io.version,rendererPackageName:Io.rendererPackageName,rendererConfig:Io.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:_.ReactCurrentDispatcher,findHostInstanceByFiber:function(f){return f=Un(f),f===null?null:f.stateNode},findFiberByHostInstance:Io.findFiberByHostInstance||$C,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ou=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ou.isDisabled&&Ou.supportsFiber)try{Qt=Ou.inject(YC),rt=Ou}catch{}}return nn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=qC,nn.createPortal=function(f,d){var S=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Gf(d))throw Error(r(200));return VC(f,d,null,S)},nn.createRoot=function(f,d){if(!Gf(f))throw Error(r(299));var S=!1,L="",O=e0;return d!=null&&(d.unstable_strictMode===!0&&(S=!0),d.identifierPrefix!==void 0&&(L=d.identifierPrefix),d.onRecoverableError!==void 0&&(O=d.onRecoverableError)),d=Wf(f,1,!1,null,null,S,!1,L,O),f[ai]=d.current,yo(f.nodeType===8?f.parentNode:f),new $f(d)},nn.findDOMNode=function(f){if(f==null)return null;if(f.nodeType===1)return f;var d=f._reactInternals;if(d===void 0)throw typeof f.render=="function"?Error(r(188)):(f=Object.keys(f).join(","),Error(r(268,f)));return f=Un(d),f=f===null?null:f.stateNode,f},nn.flushSync=function(f){return ba(f)},nn.hydrate=function(f,d,S){if(!Pu(d))throw Error(r(200));return Iu(null,f,d,!0,S)},nn.hydrateRoot=function(f,d,S){if(!Gf(f))throw Error(r(405));var L=S!=null&&S.hydratedSources||null,O=!1,V="",Q=e0;if(S!=null&&(S.unstable_strictMode===!0&&(O=!0),S.identifierPrefix!==void 0&&(V=S.identifierPrefix),S.onRecoverableError!==void 0&&(Q=S.onRecoverableError)),d=Zy(d,null,f,1,S??null,O,!1,V,Q),f[ai]=d.current,yo(f),L)for(f=0;f<L.length;f++)S=L[f],O=S._getVersion,O=O(S._source),d.mutableSourceEagerHydrationData==null?d.mutableSourceEagerHydrationData=[S,O]:d.mutableSourceEagerHydrationData.push(S,O);return new Mu(d)},nn.render=function(f,d,S){if(!Pu(d))throw Error(r(200));return Iu(null,f,d,!1,S)},nn.unmountComponentAtNode=function(f){if(!Pu(f))throw Error(r(40));return f._reactRootContainer?(ba(function(){Iu(null,null,f,!1,function(){f._reactRootContainer=null,f[ai]=null})}),!0):!1},nn.unstable_batchedUpdates=Bf,nn.unstable_renderSubtreeIntoContainer=function(f,d,S,L){if(!Pu(S))throw Error(r(200));if(f==null||f._reactInternals===void 0)throw Error(r(38));return Iu(f,d,S,!1,L)},nn.version="18.3.1-next-f1338f8080-20240426",nn}var c0;function iE(){if(c0)return Xf.exports;c0=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(),Xf.exports=nE(),Xf.exports}var h0;function aE(){if(h0)return Fu;h0=1;var t=iE();return Fu.createRoot=t.createRoot,Fu.hydrateRoot=t.hydrateRoot,Fu}var sE=aE();const Zf={};function Zb(){const t=Zf==null?void 0:Zf.VITE_API_HOST;return typeof t=="string"&&t.length>0?t:void 0}function Jb(){const t=Zb();return t?`http://${t}/api/v1`:`${window.location.origin}/api/v1`}function ew(){const t=Zb();return t?`ws://${t}`:`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}`}const tw=t=>`${ew()}/ws/terminals/${encodeURIComponent(t)}`;async function St(t,e){const r=(e==null?void 0:e.body)!==void 0&&(e==null?void 0:e.body)!==null?{"Content-Type":"application/json",...e==null?void 0:e.headers}:{...e==null?void 0:e.headers},n=await fetch(`${Jb()}${t}`,{...e,headers:r});if(!n.ok){const i=await n.text();let s;try{const o=JSON.parse(i),a=o.error??o.message??i;s=typeof a=="string"?a:JSON.stringify(a)}catch{s=i}throw s||(s=n.statusText||String(n.status)),new Error(`API ${n.status}: ${s}`)}return n.json()}async function oE(t){var s;const e=await fetch(`${Jb()}/runs/${encodeURIComponent(t)}/evidence`);if(!e.ok){const o=await e.text();let a=o;try{const l=JSON.parse(o);typeof l.error=="string"&&(a=l.error)}catch{}throw new Error(`API ${e.status}: ${a||e.statusText||String(e.status)}`)}const r=((s=/filename="([^"]+)"/.exec(e.headers.get("Content-Disposition")??""))==null?void 0:s[1])??`${t.replace(/[^A-Za-z0-9._-]/g,"_").slice(0,128)}-evidence.json`,n=URL.createObjectURL(await e.blob()),i=document.createElement("a");i.href=n,i.download=r,document.body.appendChild(i),i.click(),i.remove(),setTimeout(()=>URL.revokeObjectURL(n),0)}const lt={listRuns:()=>St("/runs"),getRun:t=>St(`/runs/${encodeURIComponent(t)}`),launchRun:t=>St("/runs",{method:"POST",body:JSON.stringify(t)}),confirmGate:(t,e)=>St(`/runs/${encodeURIComponent(t)}/gate`,{method:"POST",body:JSON.stringify(e)}),cancelRun:t=>St(`/runs/${encodeURIComponent(t)}/cancel`,{method:"POST"}),resumeRun:t=>St(`/runs/${encodeURIComponent(t)}/resume`,{method:"POST"}),getUnitOutput:(t,e)=>St(`/runs/${encodeURIComponent(t)}/units/${encodeURIComponent(e)}/output`),getGate:t=>St(`/runs/${encodeURIComponent(t)}/gate`),getRoster:()=>St("/roster"),listRepos:()=>St("/repos"),registerRepo:(t,e)=>St("/repos",{method:"POST",body:JSON.stringify({name:t,rootPath:e})}),cloneAndRegisterRepo:(t,e,r)=>St("/repos",{method:"POST",body:JSON.stringify({name:t,gitUrl:e,...r?{rootPath:r}:{}})}),getOnboardRun:t=>St(`/repos/${encodeURIComponent(t)}/onboard`),rerunOnboarding:t=>St(`/repos/${encodeURIComponent(t)}/onboard`,{method:"POST"}),getHealth:()=>St("/health"),openTerminal:t=>St("/terminals",{method:"POST",body:JSON.stringify(t)}),resizeTerminal:(t,e,r)=>St(`/terminals/${encodeURIComponent(t)}/resize`,{method:"POST",body:JSON.stringify({cols:e,rows:r})}),closeTerminal:t=>St(`/terminals/${encodeURIComponent(t)}/close`,{method:"POST"}),injectMessage:(t,e,r)=>St(`/runs/${encodeURIComponent(t)}/inject`,{method:"POST",body:JSON.stringify({message:e,target:r})}),listWorkflows:()=>St("/workflows"),getWorkflow:t=>St(`/workflows/${encodeURIComponent(t)}`),createWorkflow:t=>St("/workflows",{method:"POST",body:JSON.stringify(t)}),saveScript:(t,e,r)=>St("/scripts",{method:"POST",body:JSON.stringify({name:t,content:e,lang:r})}),getDomainGraph:()=>St("/domain-graph"),getRepoGraph:t=>St(`/repos/${encodeURIComponent(t)}/graph`),getRepoGitHistory:t=>St(`/repos/${encodeURIComponent(t)}/git-history`),getRepoContributors:t=>St(`/repos/${encodeURIComponent(t)}/contributors`),getRepoDomainGraph:t=>St(`/repos/${encodeURIComponent(t)}/domain-graph`),listPolicies:()=>St("/governance/policies"),listConformanceRules:()=>St("/governance/rules"),getCoverageReport:()=>St("/governance/coverage"),listClaims:()=>St("/governance/claims"),upsertPolicy:t=>St("/governance/policies",{method:"POST",body:JSON.stringify(t)}),upsertConformanceRule:t=>St("/governance/rules",{method:"POST",body:JSON.stringify(t)}),recallRulesPreview:t=>{const e=new URLSearchParams;for(const[i,s]of Object.entries(t))s&&e.set(i,s);const r=e.toString(),n=r?`?${r}`:"";return St(`/governance/rules/preview${n}`)},getSettings:()=>St("/settings"),updateSettings:t=>St("/settings",{method:"PUT",body:JSON.stringify(t)})},f0=t=>{let e;const r=new Set,n=(u,c)=>{const h=typeof u=="function"?u(e):u;if(!Object.is(h,e)){const g=e;e=c??(typeof h!="object"||h===null)?h:Object.assign({},e,h),r.forEach(p=>p(e,g))}},i=()=>e,a={setState:n,getState:i,getInitialState:()=>l,subscribe:u=>(r.add(u),()=>r.delete(u))},l=e=t(n,i,a);return a},lE=(t=>t?f0(t):f0),uE=t=>t;function cE(t,e=uE){const r=Bu.useSyncExternalStore(t.subscribe,Bu.useCallback(()=>e(t.getState()),[t,e]),Bu.useCallback(()=>e(t.getInitialState()),[t,e]));return Bu.useDebugValue(r),r}const d0=t=>{const e=lE(t),r=n=>cE(e,n);return Object.assign(r,e),r},$s=(t=>t?d0(t):d0),Jn=$s(t=>({gates:{},setGate:e=>t(r=>({gates:{...r.gates,[e.runId]:e}})),clearGate:e=>t(r=>{if(!(e in r.gates))return r;const n={...r.gates};return delete n[e],{gates:n}}),ingest:e=>{const r=typeof e.session=="string"?e.session:void 0;r!==void 0&&t(n=>{switch(e.type){case"awaitingHuman":return typeof e.ord=="number"&&typeof e.prompt=="string"?{gates:{...n.gates,[r]:{runId:r,ord:e.ord,prompt:e.prompt,lifecycle:"open",receivedAt:Date.now()}}}:n;case"resumed":case"sessionCompleted":case"runCancelled":case"sessionFailed":{if(!(r in n.gates))return n;const i={...n.gates};return delete i[r],{gates:i}}default:return n}})},reconcile:e=>t(r=>{const n=new Set(e),i={};let s=!1;for(const[o,a]of Object.entries(r.gates))n.has(o)?i[o]=a:s=!0;return s?{gates:i}:r})})),p0=5e4,hE=new Set(["cliOutputDelta","heartbeat"]),Sc=$s(t=>({byRun:{},ingest:e=>{const r=typeof e.session=="string"?e.session:void 0;r!==void 0&&(hE.has(e.type)||t(n=>{const s=[...n.byRun[r]??[],e];return s.length>p0&&s.splice(0,s.length-p0),{byRun:{...n.byRun,[r]:s}}}))},clear:e=>t(r=>{if(!(e in r.byRun))return r;const n={...r.byRun};return delete n[e],{byRun:n}})})),zv=$s(t=>({entries:[],seq:0,record:e=>t(r=>{const n=r.seq+1;return{seq:n,entries:[...r.entries,{...e,seq:n,ts:Date.now()}]}})})),fE=[{value:"30d",label:"30d"},{value:"60d",label:"60d"},{value:"90d",label:"90d"}];function dE(t,e){const r=e==="30d"?30:e==="60d"?60:90;return t.slice(0,r)}function Hv(t="30d"){const[e,r]=ae.useState(t),n=ae.useCallback(i=>dE(i,e),[e]);return{range:e,setRange:r,filter:n}}const pE={fontFamily:"monospace"};function Uv({value:t,onChange:e}){return C.jsx("div",{role:"group","aria-label":"Time range",style:{display:"flex",gap:"4px"},children:fE.map(({value:r,label:n})=>C.jsx("button",{type:"button","aria-pressed":t===r,onClick:()=>e(r),style:{padding:"3px 8px",borderRadius:"5px",fontSize:"10px",fontWeight:600,...pE,cursor:"pointer",border:"1px solid",borderColor:t===r?"rgba(121,192,255,0.5)":"rgba(230,237,243,0.1)",background:t===r?"rgba(121,192,255,0.12)":"transparent",color:t===r?"#79c0ff":"rgba(230,237,243,0.4)",transition:"all 0.15s"},children:n},r))})}const ju=new Set(["planning","distributing","executing","awaiting_human"]),vE=new Set(["awaitingHuman","gateEscalated","stepFailed","sessionFailed","crashRecoveryRedrive","unitDone","workflowSelected","acpFallback"]),wt={fontFamily:"monospace"},Rs={background:"#1b222e",border:"1px solid rgba(230,237,243,0.08)",borderRadius:"12px"},Ta={fontSize:"10px",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.1em",color:"rgba(230,237,243,0.4)",fontFamily:"monospace",margin:0},gE={pending:"rgba(230,237,243,0.18)",distributed:"#79c0ff",done:"#3fb950",rejected:"#f85149"},mE={distributed:!0};function ll(t,e){return t.length>e?`${t.slice(0,e)}…`:t}function sv(t){const e=t.session.problem;return e.length>0?ll(e,32):t.session.id.slice(0,8)}function yE(t){return t<.01?"<$0.01":`$${t.toFixed(2)}`}function xE(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}const rw={awaitingHuman:{icon:"🔒",label:"Gate decision required",borderColor:"rgba(255,218,25,0.35)",textColor:"#ffda19",badgeColor:"rgba(255,218,25,0.12)"},gateEscalated:{icon:"⬆",label:"Gate escalated to human",borderColor:"rgba(121,192,255,0.3)",textColor:"#79c0ff",badgeColor:"rgba(121,192,255,0.08)"},stepFailed:{icon:"✕",label:"Step failed",borderColor:"rgba(248,81,73,0.3)",textColor:"#f85149",badgeColor:"rgba(248,81,73,0.08)"},sessionFailed:{icon:"✕",label:"Session failed",borderColor:"rgba(248,81,73,0.3)",textColor:"#f85149",badgeColor:"rgba(248,81,73,0.08)"},crashRecoveryRedrive:{icon:"↻",label:"Crash recovery redrive",borderColor:"rgba(248,81,73,0.2)",textColor:"rgba(248,81,73,0.8)",badgeColor:"rgba(248,81,73,0.06)"},unitDone:{icon:"✓",label:"Unit complete",borderColor:"rgba(63,185,80,0.2)",textColor:"#3fb950",badgeColor:"rgba(63,185,80,0.06)"},workflowSelected:{icon:"◈",label:"Workflow selected",borderColor:"rgba(167,139,250,0.25)",textColor:"#a78bfa",badgeColor:"rgba(167,139,250,0.06)"},acpFallback:{icon:"⚠",label:"ACP degraded — single-shot fallback",borderColor:"rgba(248,81,73,0.2)",textColor:"rgba(248,81,73,0.75)",badgeColor:"rgba(248,81,73,0.05)"}},nw={icon:"·",label:"Event",borderColor:"rgba(230,237,243,0.08)",textColor:"#e6edf3",badgeColor:"rgba(230,237,243,0.04)"};function bE({runId:t,ord:e,prompt:r,sessionLbl:n,onApprove:i,onReject:s}){const[o,a]=ae.useState(""),[l,u]=ae.useState(!1),[c,h]=ae.useState(!1),g=ae.useCallback(async x=>{u(!0);try{await x()}catch{}finally{u(!1)}},[]),p=rw.awaitingHuman??nw;return C.jsxs("div",{style:{background:"#161c26",border:`1px solid ${p.borderColor}`,borderRadius:"10px",padding:"14px 16px"},children:[C.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"4px"},children:[C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"7px"},children:[C.jsx("span",{style:{color:p.textColor,fontSize:"13px"},children:p.icon}),C.jsx("span",{style:{fontSize:"12px",fontWeight:600,color:p.textColor,...wt},children:p.label})]}),C.jsx("span",{style:{fontSize:"10px",color:"rgba(230,237,243,0.4)",...wt,flexShrink:0,marginLeft:"8px"},children:n})]}),C.jsxs("p",{style:{fontSize:"11px",color:"rgba(230,237,243,0.45)",...wt,margin:"0 0 8px"},children:[t.slice(0,8),typeof e=="number"?` · before unit #${e}`:""]}),r&&C.jsx("p",{style:{fontSize:"12px",color:"rgba(230,237,243,0.7)",...wt,margin:"0 0 10px",lineHeight:1.5,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:r}),c&&C.jsx("textarea",{style:{width:"100%",background:"#0f1419",border:"1px solid rgba(230,237,243,0.14)",borderRadius:"6px",color:"#e6edf3",fontSize:"12px",...wt,padding:"6px 8px",resize:"vertical",marginBottom:"10px",boxSizing:"border-box",outline:"none"},rows:2,placeholder:"Steer / amendment for the next unit…",value:o,onChange:x=>a(x.target.value),disabled:l}),C.jsxs("div",{style:{display:"flex",gap:"6px",flexWrap:"wrap"},children:[C.jsx("button",{type:"button",disabled:l,onClick:()=>void g(()=>i(t)),style:{background:"#3fb950",color:"#0d1117",border:"none",borderRadius:"6px",padding:"5px 12px",fontSize:"11px",fontWeight:700,...wt,cursor:l?"not-allowed":"pointer",opacity:l?.5:1},children:"Approve"}),C.jsx("button",{type:"button",disabled:l,onClick:()=>{c?o.trim()&&g(()=>i(t,o.trim())):h(!0)},style:{background:c&&o.trim()?"#ffda19":"rgba(255,218,25,0.12)",color:c&&o.trim()?"#0d1117":"#ffda19",border:"1px solid rgba(255,218,25,0.3)",borderRadius:"6px",padding:"5px 12px",fontSize:"11px",fontWeight:600,...wt,cursor:l?"not-allowed":"pointer",opacity:l?.5:1},children:c&&o.trim()?"Send steer":"Approve + steer"}),C.jsx("button",{type:"button",disabled:l,onClick:()=>void g(()=>s(t)),style:{background:"rgba(248,81,73,0.1)",color:"#f85149",border:"1px solid rgba(248,81,73,0.3)",borderRadius:"6px",padding:"5px 12px",fontSize:"11px",fontWeight:600,...wt,cursor:l?"not-allowed":"pointer",opacity:l?.5:1},children:"Reject"})]})]})}function wE({type:t,sessionId:e,sessionLbl:r,ord:n,detail:i}){const s=rw[t]??nw;return C.jsxs("div",{style:{background:s.badgeColor,border:`1px solid ${s.borderColor}`,borderRadius:"8px",padding:"8px 12px",display:"flex",alignItems:"flex-start",gap:"8px"},children:[C.jsx("span",{style:{color:s.textColor,fontSize:"12px",lineHeight:"18px",flexShrink:0},children:s.icon}),C.jsxs("div",{style:{flex:1,minWidth:0},children:[C.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:"8px"},children:[C.jsxs("span",{style:{fontSize:"11px",fontWeight:600,color:s.textColor,...wt},children:[s.label,typeof n=="number"?` · unit #${n}`:""]}),C.jsx("span",{style:{fontSize:"10px",color:"rgba(230,237,243,0.3)",...wt,flexShrink:0},children:e.slice(0,6)})]}),i&&C.jsx("p",{style:{fontSize:"11px",color:"rgba(230,237,243,0.55)",...wt,margin:"2px 0 0",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:i,children:ll(i,80)}),!i&&C.jsx("p",{style:{fontSize:"10px",color:"rgba(230,237,243,0.3)",...wt,margin:"2px 0 0"},children:r})]})]})}function _E({view:t,onSelect:e}){const{session:r,units:n}=t,i=sv(t),s=r.id,o=r.status==="awaiting_human";return C.jsxs("button",{type:"button",style:{display:"flex",alignItems:"flex-start",gap:"10px",padding:"10px 12px",background:"#1b222e",border:"1px solid rgba(230,237,243,0.07)",borderRadius:"10px",cursor:"pointer",transition:"border-color 0.15s",width:"100%",textAlign:"left"},onClick:()=>e(s),onMouseEnter:a=>{a.currentTarget.style.borderColor="rgba(230,237,243,0.18)"},onMouseLeave:a=>{a.currentTarget.style.borderColor="rgba(230,237,243,0.07)"},children:[C.jsx("span",{style:{width:"7px",height:"7px",borderRadius:"50%",background:o?"#ffda19":"#79c0ff",flexShrink:0,marginTop:"5px",boxShadow:o?"0 0 6px rgba(255,218,25,0.5)":"0 0 6px rgba(121,192,255,0.4)"}}),C.jsxs("div",{style:{flex:1,minWidth:0},children:[C.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"6px",gap:"8px"},children:[C.jsx("span",{style:{fontSize:"11px",fontWeight:600,color:"#e6edf3",...wt,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i}),C.jsxs("span",{style:{fontSize:"10px",color:"rgba(230,237,243,0.35)",...wt,flexShrink:0},children:[s.slice(0,6)," · Open chat →"]})]}),C.jsx("div",{style:{display:"flex",gap:"4px",flexWrap:"wrap"},children:n.length===0?C.jsx("span",{style:{fontSize:"10px",color:"rgba(230,237,243,0.3)",...wt},children:"planning…"}):n.map(a=>{const l=["completed","cancelled","failed"].includes(r.status),u=l&&a.status==="distributed"?"rgba(230,237,243,0.18)":gE[a.status]??"rgba(230,237,243,0.18)",c=mE[a.status]===!0&&!l;return C.jsx("span",{title:`unit #${a.ord} — ${a.stage??"?"} — ${a.status}`,style:{display:"inline-block",width:"8px",height:"8px",borderRadius:"50%",background:u,flexShrink:0,animation:c?"pulse 1.5s ease-in-out infinite":"none"}},a.ord)})})]})]})}function SE({activeRuns:t}){const[e,r]=ae.useState(""),[n,i]=ae.useState("__all__"),[s,o]=ae.useState(!1),[a,l]=ae.useState(!1),u=ae.useRef(null),c=ae.useRef(null);ae.useEffect(()=>()=>{c.current&&clearTimeout(c.current)},[]);const h=ae.useCallback(async()=>{var p;const g=e.trim();if(!(!g||t.length===0)){o(!0);try{if(n==="__all__"){const w=(await Promise.allSettled(t.map(v=>lt.injectMessage(v.session.id,g,"all")))).filter(v=>v.status==="rejected").length;if(w>0)throw new Error(`${w} inject(s) failed`)}else await lt.injectMessage(n,g,"all");r(""),l(!0),c.current=setTimeout(()=>l(!1),2500),(p=u.current)==null||p.focus()}finally{o(!1)}}},[e,n,t]);return C.jsxs("div",{children:[C.jsx("p",{style:{...Ta,marginBottom:"10px"},children:"Send to agents"}),C.jsx("div",{style:{...Rs,padding:"14px 16px"},children:t.length===0?C.jsx("p",{style:{fontSize:"11px",color:"rgba(230,237,243,0.3)",...wt},children:"No active sessions"}):C.jsxs(C.Fragment,{children:[C.jsx("div",{style:{display:"flex",gap:"8px",marginBottom:"8px",flexWrap:"wrap"},children:C.jsxs("select",{value:n,onChange:g=>i(g.target.value),disabled:s,style:{background:"#0f1419",border:"1px solid rgba(230,237,243,0.14)",borderRadius:"6px",color:"#e6edf3",fontSize:"11px",...wt,padding:"4px 8px",cursor:"pointer",outline:"none",flexShrink:0},children:[C.jsx("option",{value:"__all__",children:"All active agents"}),t.map(g=>C.jsxs("option",{value:g.session.id,children:[ll(g.session.problem||g.session.id,30)," (",g.session.id.slice(0,6),")"]},g.session.id))]})}),C.jsx("textarea",{ref:u,value:e,onChange:g=>r(g.target.value),onKeyDown:g=>{g.key==="Enter"&&(g.ctrlKey||g.metaKey)&&h()},disabled:s,placeholder:"Message to inject into the agent's context… (Ctrl+Enter to send)",rows:3,style:{width:"100%",background:"#0f1419",border:"1px solid rgba(230,237,243,0.14)",borderRadius:"6px",color:"#e6edf3",fontSize:"12px",...wt,padding:"8px 10px",resize:"vertical",outline:"none",boxSizing:"border-box",marginBottom:"8px"}}),C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[C.jsx("button",{type:"button",disabled:s||!e.trim(),onClick:()=>void h(),style:{background:e.trim()?"#79c0ff":"rgba(121,192,255,0.15)",color:e.trim()?"#0d1117":"rgba(121,192,255,0.45)",border:"none",borderRadius:"6px",padding:"6px 14px",fontSize:"11px",fontWeight:700,...wt,cursor:s||!e.trim()?"not-allowed":"pointer",transition:"all 0.15s"},children:s?"Sending…":"Send"}),a&&C.jsx("span",{style:{fontSize:"11px",color:"#3fb950",...wt},children:"✓ Injected"}),C.jsx("span",{style:{fontSize:"10px",color:"rgba(230,237,243,0.25)",...wt},children:"Ctrl+Enter"})]})]})})]})}function CE({runs:t,onSelectRun:e,onApproveGate:r,onRejectGate:n,navigate:i}){const s=Sc(k=>k.byRun),o=Jn(k=>k.gates),a=Jn(k=>k.clearGate),l=zv(k=>k.record),{range:u,setRange:c,filter:h}=Hv("30d"),g=ae.useMemo(()=>h(t),[t,h]),p=ae.useMemo(()=>g.filter(k=>ju.has(k.session.status)),[g]),x=ae.useMemo(()=>{let k=0,N=0,M=0,B=!1;for(const A of p){const j=s[A.session.id]??[];for(const D of j)D.type==="cliUsage"&&(typeof D.inputTokens=="number"&&(k+=D.inputTokens),typeof D.outputTokens=="number"&&(N+=D.outputTokens),typeof D.costUsd=="number"&&(M+=D.costUsd,B=!0))}return{totalTokens:k+N,totalCost:B?M:null}},[s,p]),w=ae.useMemo(()=>g.reduce((k,N)=>k+N.units.filter(M=>M.status==="distributed").length,0),[g]),v=ae.useCallback(async(k,N)=>{await lt.confirmGate(k,{approve:!0,...N?{amend:N}:{}}),l({runId:k,action:N?"approve-with-steer":"approve",...N?{amend:N}:{}}),a(k),r(k,N)},[a,l,r]),m=ae.useCallback(async k=>{await lt.confirmGate(k,{approve:!1}),l({runId:k,action:"reject"}),a(k),n(k)},[a,l,n]),y=ae.useMemo(()=>{const k=[];for(const N of p){const M=N.session.id,B=sv(N),j=(s[M]??[]).slice(-30);for(const D of j){if(D.type==="awaitingHuman"||!vE.has(D.type))continue;let I;if(D.type==="stepFailed"&&typeof D.detail=="string")I=D.detail;else if(D.type==="sessionFailed"&&typeof D.message=="string")I=D.message;else if(D.type==="workflowSelected"&&typeof D.workflowId=="string")I=`workflow: ${D.workflowId}`;else if(D.type==="acpFallback"){const U=typeof D.reason=="string"?D.reason:"";I=[typeof D.cliKey=="string"?D.cliKey:"",U].filter(Boolean).join(" — ")}else D.type==="crashRecoveryRedrive"&&typeof D.attempt=="number"&&(I=`attempt #${D.attempt}`);k.push({key:`${M}-${D.type}-${typeof D.ord=="number"?D.ord:0}-${k.length}`,sessionId:M,sessionLbl:B,type:D.type,...typeof D.ord=="number"?{ord:D.ord}:{},...I!==void 0?{detail:I}:{}})}}return k.reverse(),k},[s,p]),b=ae.useMemo(()=>Object.values(o).sort((k,N)=>N.receivedAt-k.receivedAt),[o]),_=ae.useMemo(()=>g.filter(k=>!k.session.workflow_id||k.session.workflow_id==="chat").slice().reverse(),[g]),R=ae.useMemo(()=>g.filter(k=>!!k.session.workflow_id&&k.session.workflow_id!=="chat"),[g]),E=ae.useMemo(()=>R.filter(k=>ju.has(k.session.status)),[R]),T=ae.useMemo(()=>g.filter(k=>k.session.status==="completed").slice(-5).reverse(),[g]);return C.jsxs("div",{style:{color:"#e6edf3",...wt},children:[C.jsx("style",{children:`
41
+ @keyframes pulse {
42
+ 0%, 100% { opacity: 1; }
43
+ 50% { opacity: 0.4; }
44
+ }
45
+ `}),C.jsxs("div",{style:{maxWidth:"1100px",margin:"0 auto",padding:"28px 32px"},children:[C.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"24px",gap:"16px",flexWrap:"wrap"},children:[C.jsxs("div",{children:[C.jsx("h1",{style:{fontSize:"20px",fontWeight:600,color:"#e6edf3",margin:0,...wt},children:"wicked-crew studio"}),C.jsx("p",{style:{fontSize:"11px",color:"rgba(230,237,243,0.38)",margin:"4px 0 0",...wt},children:"cross-session control"})]}),C.jsxs("div",{style:{display:"flex",gap:"20px",flexWrap:"wrap",alignItems:"center"},children:[C.jsx(Uv,{value:u,onChange:c}),C.jsx(zu,{label:"Active sessions",value:String(p.length),color:"#79c0ff"}),C.jsx(zu,{label:"Units in-flight",value:String(w),color:"#79c0ff"}),C.jsx(zu,{label:"Cost",value:x.totalCost!==null?yE(x.totalCost):"—",color:x.totalCost!==null?"#3fb950":"rgba(230,237,243,0.3)"}),C.jsx(zu,{label:"Tokens",value:x.totalTokens>0?xE(x.totalTokens):"—",color:x.totalTokens>0?"#e6edf3":"rgba(230,237,243,0.3)"})]})]}),b.length>0&&C.jsxs("div",{style:{marginBottom:"24px"},children:[C.jsx("p",{style:{...Ta,marginBottom:"10px"},children:"Gate inbox"}),C.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:b.map(k=>{const N=t.find(B=>B.session.id===k.runId),M=N?sv(N):k.runId.slice(0,8);return C.jsx(bE,{runId:k.runId,ord:k.ord,prompt:k.prompt,sessionLbl:M,onApprove:v,onReject:m},`gate-${k.runId}-${k.ord??"x"}`)})})]}),C.jsxs("div",{style:{display:"grid",gridTemplateColumns:"2fr 1fr 1.5fr",gap:"16px",marginBottom:"28px",alignItems:"start"},children:[C.jsxs("div",{style:{...Rs,padding:"16px 20px"},children:[C.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"12px"},children:[C.jsx("p",{style:Ta,children:"Runs"}),C.jsx("button",{type:"button",onClick:()=>i("/runs/new"),style:{background:"#ffda19",color:"#0d1117",border:"none",borderRadius:"6px",padding:"4px 12px",fontSize:"11px",fontWeight:700,...wt,cursor:"pointer",flexShrink:0},children:"Do Work"})]}),R.length===0?C.jsx("p",{style:{fontSize:"11px",color:"rgba(230,237,243,0.3)",...wt,fontStyle:"italic"},children:"No work sessions yet"}):C.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[...E,...R.filter(k=>!ju.has(k.session.status)).slice(-3).reverse()].slice(0,5).map(k=>C.jsx(_E,{view:k,onSelect:e},k.session.id))}),R.length>5&&C.jsx("button",{type:"button",onClick:()=>i("/work"),style:{fontSize:"11px",color:"#79c0ff",...wt,background:"none",border:"none",cursor:"pointer",padding:"8px 0 0",display:"block"},children:"view all →"})]}),C.jsxs("div",{style:{...Rs,padding:"16px 20px"},children:[C.jsx("p",{style:{...Ta,marginBottom:"12px"},children:"Campaigns"}),C.jsxs("div",{"data-testid":"campaign-dag-stub",style:{border:"1px dashed rgba(230,237,243,0.15)",borderRadius:"8px",padding:"12px",background:"#161c26"},children:[C.jsx("p",{style:{fontSize:"11px",fontWeight:600,color:"rgba(230,237,243,0.55)",...wt,margin:"0 0 4px"},children:"Campaign DAG"}),C.jsx("p",{style:{fontSize:"10px",color:"rgba(230,237,243,0.35)",...wt,margin:0,lineHeight:1.5},children:"Pending core's Campaign primitive + RunFinished events (§4.3)."})]})]}),C.jsxs("div",{style:{...Rs,padding:"16px 20px"},children:[C.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"12px"},children:[C.jsx("p",{style:Ta,children:"Chats"}),C.jsx("button",{type:"button",onClick:()=>i("/chat/new"),style:{background:"rgba(121,192,255,0.12)",color:"#79c0ff",border:"1px solid rgba(121,192,255,0.25)",borderRadius:"6px",padding:"4px 10px",fontSize:"11px",fontWeight:600,...wt,cursor:"pointer",flexShrink:0},children:"New Chat"})]}),_.length===0?C.jsx("p",{style:{fontSize:"11px",color:"rgba(230,237,243,0.3)",...wt,fontStyle:"italic"},children:"No chats yet"}):C.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:_.slice(0,4).map(k=>C.jsxs("button",{type:"button",onClick:()=>e(k.session.id),style:{display:"flex",alignItems:"center",gap:"8px",padding:"6px 8px",background:"transparent",border:"1px solid rgba(230,237,243,0.06)",borderRadius:"8px",cursor:"pointer",textAlign:"left",width:"100%"},onMouseEnter:N=>{N.currentTarget.style.background="rgba(230,237,243,0.03)"},onMouseLeave:N=>{N.currentTarget.style.background="transparent"},children:[C.jsx("span",{style:{width:"7px",height:"7px",borderRadius:"50%",flexShrink:0,background:ju.has(k.session.status)?"#79c0ff":k.session.status==="completed"?"#3fb950":"rgba(230,237,243,0.25)"}}),C.jsx("span",{style:{fontSize:"11px",color:"#e6edf3",...wt,flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ll(k.session.problem||k.session.id,28)})]},k.session.id))}),_.length>4&&C.jsx("button",{type:"button",onClick:()=>i("/chats"),style:{fontSize:"11px",color:"#79c0ff",...wt,background:"none",border:"none",cursor:"pointer",padding:"8px 0 0",display:"block"},children:"view all →"})]})]}),b.length===0&&p.length>0&&C.jsxs("div",{style:{marginBottom:"28px"},children:[C.jsx("p",{style:{...Ta,marginBottom:"10px"},children:"Agent activity"}),C.jsxs("div",{style:{...Rs,padding:"14px",maxHeight:"220px",overflowY:"auto",display:"flex",flexDirection:"column",gap:"8px"},children:[y.slice(0,5).map(k=>C.jsx(wE,{type:k.type,sessionId:k.sessionId,sessionLbl:k.sessionLbl,...k.ord!==void 0?{ord:k.ord}:{},...k.detail!==void 0?{detail:k.detail}:{}},k.key)),y.length===0&&C.jsx("p",{style:{fontSize:"12px",color:"rgba(230,237,243,0.28)",...wt,textAlign:"center",padding:"12px 0"},children:"Waiting for events…"})]})]}),T.length>0&&C.jsxs("div",{style:{marginBottom:"28px"},children:[C.jsx("p",{style:{...Ta,marginBottom:"10px"},children:"Sessions review"}),C.jsx("div",{style:{...Rs,padding:"4px 0",display:"flex",flexDirection:"column"},children:T.map((k,N)=>C.jsxs("button",{type:"button",onClick:()=>e(k.session.id),style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 16px",background:"transparent",border:"none",borderTop:N===0?"none":"1px solid rgba(230,237,243,0.05)",cursor:"pointer",textAlign:"left",width:"100%"},onMouseEnter:M=>{M.currentTarget.style.background="rgba(230,237,243,0.03)"},onMouseLeave:M=>{M.currentTarget.style.background="transparent"},children:[C.jsx("span",{style:{width:"7px",height:"7px",borderRadius:"50%",flexShrink:0,background:"#3fb950"}}),C.jsx("span",{style:{fontSize:"12px",color:"#e6edf3",...wt,flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ll(k.session.problem||k.session.id,60)}),C.jsx("span",{style:{fontSize:"10px",color:"rgba(230,237,243,0.3)",...wt,flexShrink:0},children:k.session.id.slice(0,8)}),C.jsx("span",{style:{fontSize:"10px",color:"rgba(121,192,255,0.5)",...wt,flexShrink:0},children:"→"})]},k.session.id))})]}),C.jsx(SE,{activeRuns:p})]})]})}function zu({label:t,value:e,color:r}){return C.jsxs("div",{style:{textAlign:"right"},children:[C.jsx("p",{style:{fontSize:"10px",color:"rgba(230,237,243,0.38)",...wt,margin:0},children:t}),C.jsx("p",{style:{fontSize:"16px",fontWeight:600,color:r,...wt,margin:"2px 0 0"},children:e})]})}const EE=t=>["completed","failed","cancelled"].includes(t);function kE({runs:t,onSelect:e,navigate:r}){const[n,i]=ae.useState(""),{range:s,setRange:o,filter:a}=Hv("30d"),l=ae.useMemo(()=>t.filter(p=>!p.session.workflow_id||p.session.workflow_id==="chat"),[t]),u=ae.useMemo(()=>a(l),[l,a]),c=ae.useMemo(()=>u.filter(p=>!EE(p.session.status)),[u]),h=ae.useMemo(()=>{if(u.length===0)return"—";const x=u.reduce((w,v)=>w+v.units.length,0)/u.length;return x%1===0?String(x):x.toFixed(1)},[u]),g=ae.useMemo(()=>n?u.filter(p=>p.session.problem.toLowerCase().includes(n.toLowerCase())):u,[u,n]);return C.jsxs("div",{className:"flex flex-col gap-6",style:{color:"#e6edf3"},children:[C.jsxs("div",{className:"px-8 pt-8 pb-4 flex items-center justify-between gap-4",children:[C.jsx("h1",{className:"text-2xl font-semibold font-mono",children:"Chats"}),C.jsxs("div",{className:"flex items-center gap-3",children:[C.jsx(Uv,{value:s,onChange:o}),C.jsx("input",{type:"text",placeholder:"Search chats…",value:n,onChange:p=>i(p.target.value),className:"rounded-xl px-4 py-2 text-sm font-mono outline-none",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.12)",color:"#e6edf3",width:"220px"}}),C.jsx("button",{type:"button",onClick:()=>r("/chat/new"),className:"rounded-lg px-4 py-2 text-sm font-semibold font-mono shrink-0",style:{background:"#ffda19",color:"#0d1117"},children:"New Chat"})]})]}),C.jsx("div",{className:"px-8 grid grid-cols-3 gap-4",children:[{label:"Total Chats",value:String(u.length),accent:void 0},{label:"Active",value:String(c.length),accent:"#79c0ff"},{label:"Avg Units",value:h,accent:"#a78bfa"}].map(p=>C.jsxs("div",{className:"rounded-2xl px-6 py-4",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.07)"},children:[C.jsx("p",{className:"text-xs font-mono uppercase tracking-widest",style:{color:"rgba(230,237,243,0.4)"},children:p.label}),C.jsx("p",{className:"text-3xl font-semibold mt-1",style:{color:p.accent??"#e6edf3"},children:p.value})]},p.label))}),C.jsx("div",{className:"px-8 pb-8 flex flex-col gap-2",children:g.length===0?C.jsxs("div",{className:"rounded-2xl p-10 text-center",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.07)"},children:[C.jsx("p",{className:"text-base font-mono font-semibold mb-3",children:"No chat sessions yet"}),C.jsx("p",{className:"text-sm font-mono",style:{color:"rgba(230,237,243,0.45)"},children:"Chat sessions let you explore your repos, ask questions, and get answers without kicking off a full build workflow."}),C.jsx("p",{className:"mt-5",children:C.jsx("button",{type:"button",onClick:()=>r("/chat/new"),className:"text-sm font-mono hover:underline",style:{color:"#79c0ff",background:"none",border:"none",cursor:"pointer"},children:"Click New Chat to start"})})]}):g.map(p=>C.jsxs("button",{type:"button",onClick:()=>e(p.session.id),className:"w-full text-left rounded-2xl px-5 py-4 transition-colors",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.07)"},children:[C.jsx("p",{className:"text-sm font-mono truncate",children:p.session.problem}),C.jsxs("p",{className:"text-xs mt-1 font-mono",style:{color:"rgba(230,237,243,0.35)"},children:[p.session.id.slice(0,8)," · ",p.session.status]})]},p.session.id))})]})}function Ds(t){return`${(t*100).toFixed(1)}%`}function TE({coverage:t,threshold:e}){const r=t>=e;return C.jsx("span",{className:"inline-flex items-center gap-1 rounded px-2 py-0.5 text-xs font-semibold font-mono",style:{background:r?"rgba(63,185,80,0.12)":"rgba(248,81,73,0.12)",color:r?"#3fb950":"#f85149",border:`1px solid ${r?"rgba(63,185,80,0.3)":"rgba(248,81,73,0.3)"}`},children:r?"GATE PASS":"GATE FAIL"})}function RE({report:t}){const e=[{label:"Total nodes",value:String(t.total)},{label:"Behavior-bearing",value:String(t.behavior_bearing)},{label:"Resolved",value:String(t.resolved)},{label:"Risk-flagged",value:String(t.risk_flagged)},{label:"Unaccounted",value:String(t.unaccounted)},{label:"Coverage",value:Ds(t.coverage)},{label:"Resolved rate",value:Ds(t.resolved_rate)},{label:"Mean confidence",value:Ds(t.mean_confidence)},{label:"Threshold",value:Ds(t.resolve_threshold)}];return C.jsx("div",{className:"grid grid-cols-3 gap-2 sm:grid-cols-5",children:e.map(({label:r,value:n})=>C.jsxs("div",{className:"rounded p-2 text-center",style:{border:"1px solid rgba(230,237,243,0.07)",background:"#1b222e"},children:[C.jsx("p",{className:"text-[11px]",style:{color:"rgba(230,237,243,0.4)"},children:r}),C.jsx("p",{className:"text-sm font-semibold",style:{color:"#e6edf3"},children:n})]},r))})}function LE({apps:t}){return t.length===0?C.jsx("p",{className:"text-xs",style:{color:"rgba(230,237,243,0.4)"},children:"No per-app data."}):C.jsxs("table",{className:"w-full text-[11px]",children:[C.jsx("thead",{children:C.jsxs("tr",{className:"border-b text-left",style:{borderColor:"rgba(230,237,243,0.08)",color:"rgba(230,237,243,0.4)"},children:[C.jsx("th",{className:"py-1 pr-3 font-medium",children:"App"}),C.jsx("th",{className:"py-1 pr-3 font-medium text-right",children:"Behavior-bearing"}),C.jsx("th",{className:"py-1 pr-3 font-medium text-right",children:"Resolved"}),C.jsx("th",{className:"py-1 pr-3 font-medium text-right",children:"Risk"}),C.jsx("th",{className:"py-1 pr-3 font-medium text-right",children:"Unaccounted"}),C.jsx("th",{className:"py-1 font-medium text-right",children:"Coverage"})]})}),C.jsx("tbody",{children:t.map(e=>C.jsxs("tr",{className:"border-b",style:{borderColor:"rgba(230,237,243,0.06)"},children:[C.jsx("td",{className:"py-1 pr-3 font-mono",style:{color:"rgba(230,237,243,0.7)"},children:e.app}),C.jsx("td",{className:"py-1 pr-3 text-right",style:{color:"rgba(230,237,243,0.6)"},children:e.behavior_bearing}),C.jsx("td",{className:"py-1 pr-3 text-right",style:{color:"#3fb950"},children:e.resolved}),C.jsx("td",{className:"py-1 pr-3 text-right",style:{color:"#ffda19"},children:e.risk_flagged}),C.jsx("td",{className:"py-1 pr-3 text-right",style:{color:"#f85149"},children:e.unaccounted}),C.jsx("td",{className:"py-1 text-right font-semibold",style:{color:"#e6edf3"},children:Ds(e.coverage)})]},e.app))})]})}function Hu({col:t,active:e,dir:r,onSort:n,children:i}){return C.jsxs("button",{type:"button",onClick:()=>n(t),className:"font-medium transition-colors",style:{color:e===t?"#79c0ff":"rgba(230,237,243,0.4)"},children:[i,e===t?r==="asc"?" ▲":" ▼":""]})}function NE({nodes:t}){const[e,r]=ae.useState(""),[n,i]=ae.useState("file"),[s,o]=ae.useState("asc"),[a,l]=ae.useState(""),[u,c]=ae.useState(""),h=ae.useMemo(()=>[...new Set(t.map(v=>v.kind??"").filter(Boolean))].sort(),[t]),g=ae.useMemo(()=>[...new Set(t.map(v=>v.app??"").filter(Boolean))].sort(),[t]),p=ae.useCallback(v=>{v===n?o(m=>m==="asc"?"desc":"asc"):(i(v),o("asc"))},[n]),x=ae.useMemo(()=>{let v=t;if(e){const m=e.toLowerCase();v=v.filter(y=>(y.name??"").toLowerCase().includes(m)||(y.file??"").toLowerCase().includes(m)||(y.symbol_id??"").toLowerCase().includes(m))}return a&&(v=v.filter(m=>m.kind===a)),u&&(v=v.filter(m=>m.app===u)),[...v].sort((m,y)=>{const b=n==="name"?m.name??m.symbol_id:m[n]??"",_=n==="name"?y.name??y.symbol_id:y[n]??"";return s==="asc"?b.localeCompare(_):_.localeCompare(b)})},[t,e,a,u,n,s]),w={background:"#161c26",border:"1px solid rgba(230,237,243,0.1)",color:"#e6edf3"};return t.length===0?C.jsx("p",{className:"text-xs",style:{color:"#3fb950"},children:"No unaccounted nodes — gate is satisfied."}):C.jsxs("div",{className:"flex flex-col gap-2",children:[C.jsxs("div",{className:"flex flex-wrap gap-2",children:[C.jsx("input",{type:"text","aria-label":"Search by name, file, or symbol id",placeholder:"Search name / file / id…",value:e,onChange:v=>r(v.target.value),className:"rounded px-2 py-1 text-[11px] w-48 focus:outline-none",style:w}),C.jsxs("select",{"aria-label":"Filter by kind",value:a,onChange:v=>l(v.target.value),className:"rounded px-2 py-1 text-[11px] focus:outline-none",style:w,children:[C.jsx("option",{value:"",children:"All kinds"}),h.map(v=>C.jsx("option",{value:v,children:v},v))]}),C.jsxs("select",{"aria-label":"Filter by app",value:u,onChange:v=>c(v.target.value),className:"rounded px-2 py-1 text-[11px] focus:outline-none",style:w,children:[C.jsx("option",{value:"",children:"All apps"}),g.map(v=>C.jsx("option",{value:v,children:v},v))]}),C.jsxs("span",{className:"ml-auto text-[11px]",style:{color:"rgba(230,237,243,0.4)"},children:[x.length," / ",t.length," hole",t.length!==1?"s":""]})]}),C.jsxs("table",{className:"w-full text-[11px]",children:[C.jsx("thead",{children:C.jsxs("tr",{className:"border-b",style:{borderColor:"rgba(230,237,243,0.08)"},children:[C.jsx("th",{className:"py-1 pr-3",children:C.jsx(Hu,{col:"name",active:n,dir:s,onSort:p,children:"Name"})}),C.jsx("th",{className:"py-1 pr-3",children:C.jsx(Hu,{col:"kind",active:n,dir:s,onSort:p,children:"Kind"})}),C.jsx("th",{className:"py-1 pr-3",children:C.jsx(Hu,{col:"app",active:n,dir:s,onSort:p,children:"App"})}),C.jsx("th",{className:"py-1",children:C.jsx(Hu,{col:"file",active:n,dir:s,onSort:p,children:"File"})})]})}),C.jsx("tbody",{children:x.map(v=>C.jsxs("tr",{className:"border-b",style:{borderColor:"rgba(230,237,243,0.06)"},children:[C.jsx("td",{className:"py-1 pr-3 font-mono",style:{color:"rgba(230,237,243,0.7)"},children:v.name??v.symbol_id}),C.jsx("td",{className:"py-1 pr-3",style:{color:"rgba(230,237,243,0.45)"},children:v.kind??"—"}),C.jsx("td",{className:"py-1 pr-3",style:{color:"rgba(230,237,243,0.45)"},children:v.app??"—"}),C.jsx("td",{className:"py-1",style:{color:"rgba(230,237,243,0.35)"},title:v.file,children:C.jsx("div",{className:"truncate max-w-xs",children:v.file??"—"})})]},v.symbol_id))})]})]})}function iw(){const[t,e]=ae.useState(null),[r,n]=ae.useState(!0),[i,s]=ae.useState(null),o=ae.useCallback(async()=>{n(!0),s(null);try{const{report:a}=await lt.getCoverageReport();e(a)}catch(a){s(a instanceof Error?a.message:String(a))}finally{n(!1)}},[]);return ae.useEffect(()=>{o()},[o]),C.jsxs("div",{className:"flex flex-col gap-4",children:[C.jsxs("div",{className:"flex items-center justify-between",children:[C.jsx("h2",{className:"text-sm font-semibold",style:{color:"#e6edf3"},children:"Coverage gate"}),C.jsx("button",{type:"button",onClick:()=>void o(),disabled:r,className:"rounded px-2 py-1 text-[11px] disabled:opacity-50",style:{border:"1px solid rgba(230,237,243,0.1)",color:"rgba(230,237,243,0.6)"},children:r?"Loading…":"Refresh"})]}),i&&C.jsx("p",{className:"rounded px-3 py-2 text-xs",style:{background:"rgba(248,81,73,0.08)",color:"#f85149"},children:i}),!r&&!i&&t===null&&C.jsxs("p",{className:"text-xs",style:{color:"rgba(230,237,243,0.4)"},children:["No coverage data — run"," ",C.jsx("code",{className:"font-mono",style:{color:"rgba(230,237,243,0.6)"},children:"wicked-core rules ingest"})," ","to populate."]}),t&&C.jsxs(C.Fragment,{children:[C.jsxs("div",{className:"flex items-center gap-3",children:[C.jsx("span",{className:"text-2xl font-bold",style:{color:"#e6edf3"},children:Ds(t.coverage)}),C.jsx(TE,{coverage:t.coverage,threshold:t.resolve_threshold})]}),C.jsx(RE,{report:t}),t.per_app.length>0&&C.jsxs("section",{className:"flex flex-col gap-1",children:[C.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wider font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Per-app"}),C.jsx(LE,{apps:t.per_app})]}),C.jsxs("section",{className:"flex flex-col gap-2",children:[C.jsxs("p",{className:"text-[11px] font-semibold uppercase tracking-wider font-mono",style:{color:"rgba(230,237,243,0.4)"},children:["Coverage holes (",t.unaccounted,")"]}),C.jsx(NE,{nodes:t.unaccounted_nodes})]})]})]})}function DE(t){if(!t)return null;const r={active:"#3fb950",proposed:"#ffda19",deprecated:"#f85149"}[t]??"rgba(230,237,243,0.5)";return C.jsx("span",{className:"inline-flex rounded px-1.5 py-0.5 text-[10px] font-semibold font-mono",style:{background:"rgba(230,237,243,0.06)",color:r},children:t})}function AE({id:t,req:e}){var i,s,o,a,l;const[r,n]=ae.useState(!1);return C.jsxs("div",{className:"rounded",style:{border:"1px solid rgba(230,237,243,0.07)"},children:[C.jsxs("button",{type:"button",onClick:()=>n(u=>!u),className:"w-full flex items-start gap-2 px-3 py-2 text-left transition-colors",style:{background:"transparent"},onMouseEnter:u=>{u.currentTarget.style.background="rgba(230,237,243,0.03)"},onMouseLeave:u=>{u.currentTarget.style.background="transparent"},children:[C.jsx("span",{className:"mt-0.5 shrink-0 text-[10px]",style:{color:"rgba(230,237,243,0.25)"},children:r?"▾":"▸"}),C.jsxs("div",{className:"flex-1 min-w-0",children:[C.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[C.jsx("span",{className:"font-mono text-[10px]",style:{color:"rgba(230,237,243,0.35)"},children:t}),C.jsx("span",{className:"text-[11px] font-medium truncate",style:{color:"#e6edf3"},children:e.title}),DE(e.status),e.disposition&&C.jsx("span",{className:"text-[10px] italic",style:{color:"rgba(230,237,243,0.4)"},children:e.disposition})]}),!r&&e.description&&C.jsx("p",{className:"text-[10px] truncate mt-0.5",style:{color:"rgba(230,237,243,0.4)"},children:e.description})]}),C.jsxs("span",{className:"shrink-0 text-[10px] font-mono",style:{color:"rgba(230,237,243,0.25)"},children:[((i=e.business_rules)==null?void 0:i.length)??0,"br · ",((s=e.validations)==null?void 0:s.length)??0,"val"]})]}),r&&C.jsxs("div",{className:"px-4 pb-3 flex flex-col gap-2 text-[10px]",style:{background:"#0f1419"},children:[e.description&&C.jsx("p",{style:{color:"rgba(230,237,243,0.55)"},children:e.description}),(((o=e.business_rules)==null?void 0:o.length)??0)>0&&C.jsxs("div",{children:[C.jsx("p",{className:"font-semibold uppercase tracking-wider mb-1 font-mono",style:{color:"rgba(230,237,243,0.35)"},children:"Business rules"}),C.jsx("ul",{className:"flex flex-col gap-0.5",children:(e.business_rules??[]).map(u=>C.jsxs("li",{className:"flex items-start gap-1.5",children:[C.jsx("span",{className:"font-mono shrink-0",style:{color:"rgba(230,237,243,0.25)"},children:u.id}),C.jsx("span",{style:{color:"rgba(230,237,243,0.65)"},children:u.statement}),C.jsxs("span",{className:"ml-auto shrink-0 font-mono",style:{color:"rgba(230,237,243,0.3)"},children:[(u.confidence*100).toFixed(0),"%"]})]},u.id))})]}),(((a=e.validations)==null?void 0:a.length)??0)>0&&C.jsxs("div",{children:[C.jsx("p",{className:"font-semibold uppercase tracking-wider mb-1 font-mono",style:{color:"rgba(230,237,243,0.35)"},children:"Validations"}),C.jsx("ul",{className:"flex flex-col gap-0.5",children:(e.validations??[]).map(u=>C.jsxs("li",{className:"flex items-start gap-1.5",children:[C.jsx("span",{className:"font-mono shrink-0",style:{color:"rgba(230,237,243,0.25)"},children:u.id}),C.jsx("span",{style:{color:"rgba(230,237,243,0.65)"},children:u.statement})]},u.id))})]}),(((l=e.error_paths)==null?void 0:l.length)??0)>0&&C.jsxs("div",{children:[C.jsx("p",{className:"font-semibold uppercase tracking-wider mb-1 font-mono",style:{color:"rgba(248,81,73,0.6)"},children:"Error paths"}),C.jsx("ul",{className:"flex flex-col gap-0.5",children:(e.error_paths??[]).map(u=>C.jsxs("li",{className:"flex items-start gap-1.5",children:[C.jsx("span",{className:"font-mono shrink-0",style:{color:"rgba(230,237,243,0.25)"},children:u.id}),C.jsx("span",{style:{color:"#f85149"},children:u.statement})]},u.id))})]})]})]})}function ME({name:t,domain:e}){const[r,n]=ae.useState(!0),i=Object.keys(e.requirements??{}),s=Object.keys(e.entities??{});return C.jsxs("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid rgba(230,237,243,0.08)"},children:[C.jsxs("button",{type:"button",onClick:()=>n(o=>!o),className:"w-full flex items-center gap-2 px-4 py-2.5 text-left transition-colors",style:{background:"#1b222e",borderBottom:"1px solid rgba(230,237,243,0.07)"},onMouseEnter:o=>{o.currentTarget.style.background="#1f2937"},onMouseLeave:o=>{o.currentTarget.style.background="#1b222e"},children:[C.jsx("span",{className:"text-[10px]",style:{color:"rgba(230,237,243,0.35)"},children:r?"▾":"▸"}),C.jsx("span",{className:"font-semibold text-[12px]",style:{color:"#e6edf3"},children:t}),C.jsxs("span",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.35)"},children:[i.length," req · ",s.length," entity"]}),e.cluster_id!==void 0&&C.jsxs("span",{className:"ml-auto text-[10px] font-mono",style:{color:"rgba(230,237,243,0.25)"},children:["cluster ",e.cluster_id]})]}),r&&C.jsxs("div",{className:"p-3 flex flex-col gap-2",style:{background:"#161c26"},children:[e.description&&C.jsx("p",{className:"text-[10px] italic",style:{color:"rgba(230,237,243,0.4)"},children:e.description}),i.length>0&&C.jsx("div",{className:"flex flex-col gap-1",children:i.map(o=>C.jsx(AE,{id:o,req:e.requirements[o]},o))}),s.length>0&&C.jsxs("div",{children:[C.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider mb-1 font-mono",style:{color:"rgba(230,237,243,0.35)"},children:"Entities"}),C.jsx("div",{className:"flex flex-wrap gap-1",children:s.map(o=>{var a;return C.jsx("span",{title:(a=e.entities[o])==null?void 0:a.description,className:"rounded px-2 py-0.5 text-[10px] font-mono",style:{background:"rgba(230,237,243,0.06)",color:"rgba(230,237,243,0.6)"},children:o},o)})})]})]})]})}function PE(){const[t,e]=ae.useState(null),[r,n]=ae.useState(!0),[i,s]=ae.useState(null),[o,a]=ae.useState(""),l=ae.useCallback(async()=>{n(!0),s(null);try{const{graph:h}=await lt.getDomainGraph();e(h)}catch(h){s(h instanceof Error?h.message:String(h))}finally{n(!1)}},[]);if(ae.useEffect(()=>{l()},[l]),r)return C.jsx("p",{className:"text-xs",style:{color:"rgba(230,237,243,0.4)"},children:"Loading domain model…"});if(i)return C.jsx("p",{className:"rounded px-2 py-1 text-xs",style:{background:"rgba(248,81,73,0.08)",color:"#f85149"},children:i});if(!t)return C.jsxs("div",{className:"flex flex-col gap-2",children:[C.jsx("p",{className:"text-sm",style:{color:"rgba(230,237,243,0.5)"},children:"No domain model found."}),C.jsxs("p",{className:"text-[10px]",style:{color:"rgba(230,237,243,0.4)"},children:["Run"," ",C.jsx("span",{className:"font-mono rounded px-1",style:{background:"rgba(230,237,243,0.06)",color:"rgba(230,237,243,0.6)"},children:"wicked-core domain-graph"})," ","to generate"," ",C.jsx("span",{className:"font-mono",style:{color:"rgba(230,237,243,0.5)"},children:".wicked-estate/requirements/requirements_graph.json"}),"."]})]});const u=o.toLowerCase(),c=Object.keys(t.domains??{}).filter(h=>{var p;if(!u)return!0;const g=t.domains[h];return h.toLowerCase().includes(u)||(p=g.description)!=null&&p.toLowerCase().includes(u)?!0:Object.entries(g.requirements??{}).some(([x,w])=>{var v,m;return x.toLowerCase().includes(u)||((v=w.title)==null?void 0:v.toLowerCase().includes(u))||((m=w.description)==null?void 0:m.toLowerCase().includes(u))})});return C.jsxs("div",{className:"flex flex-col gap-4",children:[C.jsxs("div",{className:"flex items-center gap-3",children:[C.jsx("h2",{className:"text-sm font-semibold",style:{color:"#e6edf3"},children:"Domain Model"}),C.jsxs("span",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.35)"},children:["schema ",t.metadata.schema_version," · ",Object.keys(t.domains).length," domains"]}),C.jsx("input",{"aria-label":"Search domains and requirements",type:"search",placeholder:"Search…",value:o,onChange:h=>a(h.target.value),className:"ml-auto rounded px-2 py-0.5 text-[11px] w-40 focus:outline-none",style:{background:"#161c26",border:"1px solid rgba(230,237,243,0.1)",color:"#e6edf3"}}),C.jsx("button",{type:"button",onClick:()=>void l(),className:"text-[10px] hover:underline",style:{color:"rgba(230,237,243,0.4)"},children:"Refresh"})]}),c.length===0?C.jsx("p",{className:"text-xs",style:{color:"rgba(230,237,243,0.4)"},children:"No domains match your search."}):C.jsx("div",{className:"flex flex-col gap-3",children:c.map(h=>C.jsx(ME,{name:h,domain:t.domains[h]},h))}),t.metadata.source&&C.jsxs("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.25)"},children:["Source: ",C.jsx("span",{children:t.metadata.source})]})]})}function IE({onSelect:t}){const e=Jn(n=>n.gates),r=Object.values(e);return r.length===0?C.jsx(C.Fragment,{}):C.jsx("div",{className:"fixed bottom-4 right-4 flex flex-col gap-2 z-50","data-testid":"gate-notification",children:r.map(n=>C.jsxs("button",{type:"button",onClick:()=>t(n.runId),"data-testid":"gate-toast","data-run-id":n.runId,className:"w-72 rounded-xl p-3 text-left transition-all",style:{background:"#1b222e",border:"1px solid rgba(255,218,25,0.35)",boxShadow:"0 8px 24px rgba(0,0,0,0.4)"},onMouseEnter:i=>{i.currentTarget.style.borderColor="rgba(255,218,25,0.55)"},onMouseLeave:i=>{i.currentTarget.style.borderColor="rgba(255,218,25,0.35)"},children:[C.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[C.jsx("span",{className:"w-1.5 h-1.5 rounded-full animate-pulse",style:{background:"#ffda19"}}),C.jsx("p",{className:"text-xs font-semibold",style:{color:"#ffda19"},children:"Run awaiting human"})]}),C.jsxs("p",{className:"text-[11px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:[n.runId.slice(0,8)," · before unit #",n.ord]}),n.prompt&&C.jsx("p",{className:"mt-1 text-xs line-clamp-2",style:{color:"rgba(230,237,243,0.6)"},children:n.prompt}),C.jsx("p",{className:"mt-1.5 text-[11px] font-mono",style:{color:"#79c0ff"},children:"Review →"})]},n.runId))})}const Wv=$s(t=>({status:"connecting",setStatus:e=>t({status:e})})),Jf=10;function ed(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Array.from({length:36},(t,e)=>[8,13,18,23].includes(e)?"-":Math.floor(Math.random()*16).toString(16)).join("")}const oc=$s(t=>({notifications:[],markRead:e=>t(r=>{const n=r.notifications.findIndex(o=>o.id===e);if(n===-1)return r;const i=r.notifications[n];if(!i||i.read)return r;const s=[...r.notifications];return s[n]={...i,read:!0},{notifications:s}}),markAllRead:()=>t(e=>e.notifications.every(r=>r.read)?e:{notifications:e.notifications.map(r=>({...r,read:!0}))}),ingest:e=>{const r=typeof e.session=="string"?e.session:void 0;r!==void 0&&t(n=>{switch(e.type){case"awaitingHuman":return{notifications:[{id:ed(),kind:"gate",runId:r,message:typeof e.prompt=="string"&&e.prompt?e.prompt:"Run is awaiting human review",ts:Date.now(),read:!1},...n.notifications].slice(0,Jf)};case"sessionFailed":return{notifications:[{id:ed(),kind:"run_failed",runId:r,message:typeof e.message=="string"&&e.message?e.message:"Run failed",ts:Date.now(),read:!1},...n.notifications].slice(0,Jf)};case"agentMessage":return{notifications:[{id:ed(),kind:"steer_requested",runId:r,message:typeof e.message=="string"&&e.message?e.message:"Agent is requesting direction",ts:Date.now(),read:!1},...n.notifications].slice(0,Jf)};default:return n}})}})),gn={muted:"rgba(230,237,243,0.55)",faint:"rgba(230,237,243,0.3)",hover:"rgba(0,0,0,0.2)",accent:"#ffda19",accentInk:"#0d1117",link:"#79c0ff",danger:"#f85149"};function OE(t){switch(t){case"gate":return"Awaiting review";case"run_failed":return"Run failed";case"steer_requested":return"Steer requested";default:return"Notification"}}function v0(t){switch(t){case"gate":return gn.accent;case"run_failed":return gn.danger;case"steer_requested":return gn.link;default:return gn.muted}}function BE(t){const e=Date.now()-t;return e<6e4?"just now":e<36e5?`${Math.floor(e/6e4)}m ago`:`${Math.floor(e/36e5)}h ago`}function FE(){return C.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:C.jsx("path",{d:"M12 22c1.1 0 2-.9 2-2h-4c0 1.1.9 2 2 2zm6-6V11c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z"})})}function jE({navigate:t,collapsed:e=!1}){const r=oc(c=>c.notifications),n=oc(c=>c.markRead),i=oc(c=>c.markAllRead),[s,o]=ae.useState(!1),a=ae.useRef(null),l=r.filter(c=>!c.read).length;ae.useEffect(()=>{if(!s)return;function c(h){a.current&&!a.current.contains(h.target)&&o(!1)}return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[s]);function u(c,h){n(c),o(!1),t(`/runs/${encodeURIComponent(h)}`)}return C.jsxs("div",{ref:a,style:{position:"relative"},children:[C.jsxs("button",{type:"button","aria-label":l>0?`${l} unread notification${l>1?"s":""}`:"Notifications","aria-expanded":s,"aria-haspopup":"true",title:"Notifications",onClick:()=>o(c=>!c),className:"relative flex items-center rounded transition-opacity hover:opacity-70",style:{gap:e?0:"6px",justifyContent:e?"center":"flex-start",width:e?"28px":"auto",height:"28px",color:l>0?gn.accent:gn.faint,background:"transparent",padding:e?0:"0 6px 0 4px"},children:[C.jsx(FE,{}),!e&&C.jsx("span",{style:{fontSize:"11px",fontFamily:"monospace",color:gn.faint},children:"Notifications"}),l>0&&C.jsx("span",{"aria-hidden":!0,className:"absolute -top-0.5 -right-0.5 flex items-center justify-center rounded-full text-[9px] font-bold",style:{minWidth:"14px",height:"14px",padding:"0 2px",background:gn.accent,color:gn.accentInk},children:l>9?"9+":l})]}),s&&C.jsxs("div",{role:"menu","aria-label":"Notifications",style:{position:"absolute",top:"calc(100% + 6px)",left:0,zIndex:200,background:"#1b222e",border:"1px solid rgba(230,237,243,0.12)",borderRadius:"10px",minWidth:"280px",maxWidth:"320px",boxShadow:"0 8px 32px rgba(0,0,0,0.5)",overflow:"hidden"},children:[C.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 14px 8px",borderBottom:"1px solid rgba(230,237,243,0.08)"},children:[C.jsx("span",{style:{fontSize:"10px",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.1em",color:"rgba(230,237,243,0.4)",fontFamily:"monospace"},children:"Notifications"}),l>0&&C.jsx("button",{type:"button",onClick:i,style:{background:"transparent",border:"none",cursor:"pointer",fontSize:"10px",fontFamily:"monospace",color:gn.link,padding:0},children:"Mark all read"})]}),r.length===0?C.jsx("p",{style:{padding:"16px 14px",fontSize:"11px",fontFamily:"monospace",color:gn.faint,margin:0},children:"No notifications"}):C.jsx("ul",{style:{listStyle:"none",margin:0,padding:0},children:r.map(c=>C.jsx("li",{children:C.jsxs("button",{type:"button",role:"menuitem",onClick:()=>u(c.id,c.runId),className:"focus-visible:outline focus-visible:outline-2 focus-visible:outline-[#79c0ff]",style:{width:"100%",textAlign:"left",background:c.read?"transparent":"rgba(255,218,25,0.04)",border:"none",borderBottom:"1px solid rgba(230,237,243,0.06)",padding:"10px 14px",cursor:"pointer",display:"block"},onMouseEnter:h=>{h.currentTarget.style.background=gn.hover},onMouseLeave:h=>{h.currentTarget.style.background=c.read?"transparent":"rgba(255,218,25,0.04)"},children:[C.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"3px"},children:[C.jsxs("span",{style:{fontSize:"10px",fontWeight:600,fontFamily:"monospace",color:v0(c.kind),display:"flex",alignItems:"center",gap:"4px"},children:[!c.read&&C.jsx("span",{style:{width:"5px",height:"5px",borderRadius:"50%",background:v0(c.kind),display:"inline-block",flexShrink:0}}),OE(c.kind)]}),C.jsx("span",{style:{fontSize:"9px",fontFamily:"monospace",color:"rgba(230,237,243,0.3)",whiteSpace:"nowrap",marginLeft:"8px"},children:BE(c.ts)})]}),C.jsx("p",{style:{fontSize:"11px",color:"rgba(230,237,243,0.65)",margin:"0 0 3px",overflow:"hidden",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},children:c.message}),C.jsxs("span",{style:{fontSize:"10px",fontFamily:"monospace",color:gn.link},children:[c.runId.slice(0,8)," → Review"]})]})},c.id))})]})]})}function zE(t){switch(t){case"completed":return"#3fb950";case"failed":return"#f85149";case"cancelled":return"rgba(230,237,243,0.25)";case"awaiting_human":return"#ffda19";default:return"#79c0ff"}}const g0=35;function $i({view:t,selectedRunId:e,onSelect:r}){const{session:n,units:i}=t,s=e===n.id,o=n.problem.length>g0?n.problem.slice(0,g0)+"…":n.problem,a=i.length,l=n.status==="awaiting_human"||n.status==="executing"||n.status==="distributing"||n.status==="planning";return C.jsxs("button",{type:"button","data-testid":"run-link","data-run-id":n.id,"data-status":n.status,onClick:()=>r(n.id),className:`w-full text-left px-3 py-2 rounded-md focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-white/20 ${s?"bg-black/35":"bg-transparent hover:bg-black/20 focus-visible:bg-black/20"}`,children:[C.jsxs("div",{className:"flex items-center gap-2",children:[C.jsx("span",{className:"flex-1 truncate text-xs leading-tight font-mono",style:{color:s?"#e6edf3":"rgba(230,237,243,0.7)"},title:n.problem,children:o}),C.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${l?"animate-pulse":""}`,style:{background:zE(n.status)}})]}),C.jsxs("p",{className:"text-[10px] mt-0.5 font-mono",style:{color:"rgba(230,237,243,0.3)"},children:[a," task",a===1?"":"s"," · ",n.id.slice(0,8)]})]})}const HE=[{label:"Coverage",path:"/coverage"},{label:"Domain",path:"/domain"},{label:"Workflows",path:"/workflows"},{label:"Policies",path:"/policies"},{label:"Rules",path:"/rules"},{label:"System",path:"/system"}];function UE({onNavigate:t,onClose:e}){const r=ae.useRef(null);return ae.useEffect(()=>{function n(i){r.current&&!r.current.contains(i.target)&&e()}return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[e]),C.jsx("div",{ref:r,className:"absolute bottom-full left-0 mb-1 w-44 rounded-lg py-1 z-50",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.1)",boxShadow:"0 8px 24px rgba(0,0,0,0.4)"},role:"menu",children:HE.map(n=>C.jsx("button",{type:"button",role:"menuitem",onClick:()=>{t(n.path),e()},className:"w-full text-left px-3 py-2 text-xs font-mono transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-white/20 hover:bg-white/[0.06] hover:text-[#e6edf3] focus-visible:bg-white/[0.06] focus-visible:text-[#e6edf3]",style:{color:"rgba(230,237,243,0.6)"},children:n.label},n.path))})}function WE({size:t=28,className:e=""}){return C.jsxs("svg",{width:t,height:t,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:[C.jsx("rect",{width:"32",height:"32",rx:"7",fill:"#ffda19"}),C.jsx("path",{d:"M6 10L10.5 24L16 13L21.5 24L26 10",stroke:"#0d1117",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round"})]})}const lr={bg:"#1c4053",border:"rgba(0,0,0,0.25)",ink:"#e6edf3",muted:"rgba(230,237,243,0.55)",faint:"rgba(230,237,243,0.3)",hover:"rgba(0,0,0,0.2)",active:"rgba(0,0,0,0.35)",accent:"#ffda19",link:"#79c0ff"},vs=4;function VE(){return C.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:C.jsx("path",{d:"M13 2 3 14h9l-1 8 10-12h-9l1-8z"})})}function $E(){return C.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:C.jsx("path",{d:"M20 2H4C2.9 2 2 2.9 2 4v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2z"})})}function GE(){return C.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:C.jsx("path",{d:"M19 11h-6V5a1 1 0 0 0-2 0v6H5a1 1 0 0 0 0 2h6v6a1 1 0 0 0 2 0v-6h6a1 1 0 0 0 0-2z"})})}function qE(){return C.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5","aria-hidden":!0,children:[C.jsx("circle",{cx:"10",cy:"10",r:"7"}),C.jsx("line",{x1:"15.5",y1:"15.5",x2:"21",y2:"21"})]})}function td({icon:t,label:e,testId:r,onClick:n,collapsed:i}){return C.jsxs("button",{type:"button","data-testid":r,onClick:n,"aria-label":e,title:e,className:`flex items-center gap-2 rounded text-sm font-semibold transition-opacity hover:opacity-70 ${i?"w-9 h-9 justify-center mx-auto":"w-full px-2 py-1.5"}`,style:{color:lr.accent,background:"transparent"},children:[t,!i&&C.jsx("span",{children:e})]})}function rd({label:t,asLink:e,onClick:r,withSearch:n,searchActive:i,onToggleSearch:s}){const o=C.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-widest font-mono select-none",style:{color:e?lr.link:lr.muted},children:[t,e&&C.jsx("span",{className:"ml-1 opacity-70",children:"›"})]});return C.jsxs("div",{className:"flex items-center px-3 pt-3 pb-1",children:[e&&r?C.jsx("button",{type:"button",onClick:r,className:"transition-opacity hover:opacity-80",style:{background:"transparent"},children:o}):o,n&&C.jsx("button",{type:"button",onClick:s,"aria-label":"Search",className:"ml-auto transition-opacity hover:opacity-100",style:{color:i?lr.accent:lr.faint},children:C.jsx(qE,{})})]})}function YE(){const t=Wv(c=>c.status),[e,r]=ae.useState(!1),[n,i]=ae.useState(null),[s,o]=ae.useState(!1),a=ae.useRef(null);ae.useEffect(()=>{e&&(i(null),o(!1),lt.getHealth().then(c=>i(c)).catch(()=>o(!0)))},[e]),ae.useEffect(()=>{if(!e)return;function c(h){a.current&&!a.current.contains(h.target)&&r(!1)}return document.addEventListener("click",c),()=>document.removeEventListener("click",c)},[e]);const l=t==="connected"?"#3fb950":t==="connecting"?"#ffda19":"#f85149",u=t==="connected"?"Connected":t==="connecting"?"Connecting":"Disconnected";return C.jsxs("div",{ref:a,style:{position:"relative"},children:[C.jsxs("button",{type:"button",onClick:()=>r(c=>!c),title:"Connection status",style:{display:"flex",alignItems:"center",gap:"5px",background:"rgba(0,0,0,0.25)",border:"1px solid rgba(230,237,243,0.1)",borderRadius:"20px",padding:"2px 8px 2px 6px",cursor:"pointer"},children:[C.jsx("span",{style:{width:"7px",height:"7px",borderRadius:"50%",background:l,flexShrink:0,boxShadow:t==="connected"?`0 0 5px ${l}`:"none"}}),C.jsx("span",{style:{fontSize:"10px",fontFamily:"monospace",color:l,whiteSpace:"nowrap"},children:u}),C.jsx("span",{style:{fontSize:"9px",color:"rgba(230,237,243,0.35)",marginLeft:"1px"},children:"▾"})]}),e&&C.jsxs("div",{style:{position:"absolute",top:"calc(100% + 6px)",left:0,zIndex:100,background:"#1b222e",border:"1px solid rgba(230,237,243,0.12)",borderRadius:"10px",padding:"12px 14px",minWidth:"220px",boxShadow:"0 8px 32px rgba(0,0,0,0.5)"},children:[C.jsx("p",{style:{fontSize:"10px",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.1em",color:"rgba(230,237,243,0.4)",marginBottom:"8px",fontFamily:"monospace"},children:"Health checks"}),C.jsx(Bo,{label:"WebSocket",ok:t==="connected",detail:u}),s?C.jsx(Bo,{label:"API server",ok:!1,detail:"unreachable"}):n?C.jsxs(C.Fragment,{children:[C.jsx(Bo,{label:"API server",ok:n.status==="ok",detail:n.status}),C.jsx(Bo,{label:"wicked-core",ok:!0,detail:n.version})]}):C.jsx(Bo,{label:"API server",ok:null,detail:"checking…"})]})]})}function Bo({label:t,ok:e,detail:r}){const n=e===null?"·":e?"✓":"✗",i=e===null?"rgba(230,237,243,0.3)":e?"#3fb950":"#f85149";return C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"5px"},children:[C.jsx("span",{style:{width:"12px",fontSize:"11px",color:i,fontFamily:"monospace",flexShrink:0},children:n}),C.jsx("span",{style:{fontSize:"11px",color:"#e6edf3",fontFamily:"monospace",flex:1},children:t}),C.jsx("span",{style:{fontSize:"10px",color:"rgba(230,237,243,0.45)",fontFamily:"monospace"},children:r})]})}function XE({runs:t,selectedRunId:e,onSelectRun:r,navigate:n}){const[i,s]=ae.useState(!1),[o,a]=ae.useState(!1),[l,u]=ae.useState(!1),[c,h]=ae.useState(!1),[g,p]=ae.useState(""),[x,w]=ae.useState([]),v=!i||o;ae.useEffect(()=>{let T=!1,k=!1;function N(){k||(k=!0,lt.listRepos().then(({repos:B})=>{if(T)return;const A=[...B].sort((j,D)=>D.registered_at-j.registered_at);w(A)}).catch(()=>{}).finally(()=>{k=!1}))}N();const M=setInterval(N,5e3);return()=>{T=!0,clearInterval(M)}},[]);const m=[],y=[];for(const T of t)!T.session.workflow_id||T.session.workflow_id==="chat"?m.push(T):y.push(T);const b=g.trim().toLowerCase(),_=b?x.filter(T=>T.name.toLowerCase().includes(b)):x,R=b?m.filter(T=>T.session.problem.toLowerCase().includes(b)):m,E=b?y.filter(T=>T.session.problem.toLowerCase().includes(b)):y;return C.jsxs("div",{className:`flex flex-col shrink-0 transition-all duration-200 ${v?"w-[280px]":"w-14"}`,style:{background:lr.bg,borderRight:`1px solid ${lr.border}`},onMouseEnter:()=>{i&&a(!0)},onMouseLeave:()=>a(!1),children:[C.jsxs("div",{className:"flex items-center gap-2 px-4 pt-5 pb-3 shrink-0",children:[C.jsx("button",{type:"button",onClick:()=>n("/"),className:"shrink-0","aria-label":"Home",children:C.jsx(WE,{size:26})}),v&&C.jsx("button",{type:"button",onClick:()=>n("/"),className:"flex-1 text-left text-sm font-semibold font-mono truncate transition-opacity hover:opacity-70",style:{color:lr.ink,background:"transparent"},children:"wicked-crew studio"}),C.jsx("button",{type:"button",onClick:()=>s(T=>!T),"aria-label":i?"Expand sidebar":"Collapse sidebar",className:`text-xs font-mono shrink-0 leading-none ${v?"ml-auto":""}`,style:{color:lr.faint},children:i?"»":"«"})]}),v&&C.jsx("div",{className:"px-4 pt-1 pb-3",children:C.jsx(YE,{})}),C.jsx("div",{className:v?"px-4 pb-2":"flex justify-center pb-2",children:C.jsx(jE,{navigate:n,collapsed:!v})}),C.jsxs("div",{className:`flex flex-col ${v?"px-5 pt-1 pb-1 gap-1":"px-2 items-center gap-2 mt-1"}`,children:[C.jsx(td,{icon:C.jsx(VE,{}),label:"Do Work",testId:"new-run",onClick:()=>n("/runs/new"),collapsed:!v}),C.jsx(td,{icon:C.jsx($E,{}),label:"New Chat",onClick:()=>n("/chat/new"),collapsed:!v}),C.jsx(td,{icon:C.jsx(GE,{}),label:"New Repository",onClick:()=>n("/repos/new"),collapsed:!v})]}),C.jsx("div",{className:"flex-1 overflow-y-auto flex flex-col min-h-0 mt-2",children:v?C.jsxs(C.Fragment,{children:[c&&C.jsx("div",{className:"px-4 pb-2",children:C.jsx("input",{type:"text",value:g,onChange:T=>p(T.target.value),placeholder:"Search…",autoFocus:!0,className:"w-full bg-transparent text-xs font-mono outline-none border-b",style:{color:lr.ink,borderColor:lr.faint,caretColor:lr.accent}})}),C.jsx(rd,{label:"Repositories",withSearch:!0,searchActive:c,onToggleSearch:()=>{h(T=>!T),c&&p("")}}),C.jsx(nd,{empty:"No repositories yet",viewAllPath:"/repos",navigate:n,children:_.slice(0,vs).map(T=>C.jsxs("button",{type:"button",onClick:()=>n(`/repo-detail/${encodeURIComponent(T.id)}`),title:T.root_path,className:"w-full text-left px-3 py-2 rounded-md transition-colors",style:{background:"transparent"},onMouseEnter:k=>{k.currentTarget.style.background=lr.hover},onMouseLeave:k=>{k.currentTarget.style.background="transparent"},children:[C.jsx("div",{className:"flex items-center gap-2",children:C.jsx("span",{className:"flex-1 truncate text-xs leading-tight font-mono",style:{color:"rgba(230,237,243,0.7)"},children:T.name})}),C.jsx("p",{className:"text-[10px] mt-0.5 font-mono truncate",style:{color:"rgba(230,237,243,0.3)"},children:T.root_path})]},T.id))}),_.length>vs&&C.jsx(id,{onClick:()=>n("/repos")}),C.jsx(rd,{label:"Chats"}),C.jsx(nd,{empty:"No chats yet",viewAllPath:"/chats",navigate:n,children:R.slice(0,vs).map(T=>C.jsx($i,{view:T,selectedRunId:e,onSelect:r},T.session.id))}),R.length>vs&&C.jsx(id,{onClick:()=>n("/chats")}),C.jsx(rd,{label:"Work"}),C.jsx(nd,{empty:"No work yet",viewAllPath:"/work",navigate:n,children:E.slice(0,vs).map(T=>C.jsx($i,{view:T,selectedRunId:e,onSelect:r},T.session.id))}),E.length>vs&&C.jsx(id,{onClick:()=>n("/work")})]}):C.jsx("div",{className:"px-2 flex flex-col gap-0.5 mt-1",children:t.map(T=>C.jsx("button",{type:"button",onClick:()=>r(T.session.id),"aria-label":T.session.problem,title:T.session.problem,className:"w-9 h-9 mx-auto flex items-center justify-center rounded-md transition-colors",style:{background:e===T.session.id?lr.active:"transparent"},onMouseEnter:k=>{e!==T.session.id&&(k.currentTarget.style.background=lr.hover)},onMouseLeave:k=>{e!==T.session.id&&(k.currentTarget.style.background="transparent")},children:C.jsx(KE,{status:T.session.status})},T.session.id))})}),C.jsx("div",{className:`px-2 pb-3 shrink-0 ${v?"":"flex flex-col items-center gap-1"}`,children:C.jsxs("div",{className:"relative",children:[C.jsxs("button",{type:"button",onClick:()=>u(T=>!T),onMouseDown:T=>T.stopPropagation(),"aria-label":"Settings",className:`rounded transition-colors ${v?"w-full flex items-center gap-2 px-2 py-1.5 text-xs":"w-9 h-9 flex items-center justify-center text-base"}`,style:{color:lr.faint},onMouseEnter:T=>{T.currentTarget.style.background=lr.hover,T.currentTarget.style.color=lr.ink},onMouseLeave:T=>{T.currentTarget.style.background="",T.currentTarget.style.color=lr.faint},children:[C.jsx("span",{children:"⚙"}),v&&C.jsxs(C.Fragment,{children:[C.jsx("span",{children:"Settings"}),C.jsx("span",{className:"ml-auto text-[10px] font-mono",style:{color:"rgba(230,237,243,0.25)"},children:"v0.2.1"})]})]}),l&&C.jsx(UE,{onNavigate:n,onClose:()=>u(!1)})]})})]})}function nd({children:t,empty:e,viewAllPath:r,navigate:n}){const i=Array.isArray(t)?t.filter(Boolean):t?[t]:[];return C.jsx("div",{className:"px-2 flex flex-col gap-0.5",children:i.length===0?C.jsx("button",{type:"button",onClick:()=>n(r),className:"px-2 py-1 text-left text-[11px] italic font-mono transition-opacity hover:opacity-70",style:{color:lr.faint},children:e}):i})}function id({onClick:t}){return C.jsx("button",{type:"button",onClick:t,className:"mx-4 mb-1 text-left text-[11px] font-mono transition-opacity hover:opacity-80",style:{color:lr.link},children:"view all"})}function KE({status:t}){const e=t==="completed"?"#3fb950":t==="failed"?"#f85149":t==="cancelled"?"rgba(230,237,243,0.25)":t==="awaiting_human"?"#ffda19":"#79c0ff",r=t==="awaiting_human"||t==="executing"||t==="distributing"||t==="planning";return C.jsx("span",{className:`w-2.5 h-2.5 rounded-full ${r?"animate-pulse":""}`,style:{background:e}})}const QE={deny:"#f85149",allow_with_conditions:"#ffda19",allow:"#3fb950"},ZE={high:"#f85149",medium:"#ffda19",low:"rgba(230,237,243,0.4)"},JE={id:"",kind:"output",applies_to:[],effect:"deny",trigger:{contains:""},obligations:[],criteria:"",severity:"high",rule:""};function ek({policy:t,onEdit:e}){return C.jsxs("tr",{className:"text-[11px]",style:{borderBottom:"1px solid rgba(230,237,243,0.06)"},children:[C.jsx("td",{className:"px-3 py-2 font-mono",style:{color:"rgba(230,237,243,0.7)"},children:t.id}),C.jsx("td",{className:"px-3 py-2",style:{color:"rgba(230,237,243,0.45)"},children:t.kind}),C.jsx("td",{className:"px-3 py-2",children:C.jsx("span",{className:"inline-flex rounded px-1.5 py-0.5 text-[10px] font-semibold font-mono",style:{background:"rgba(230,237,243,0.06)",color:QE[t.effect]??"rgba(230,237,243,0.5)"},children:t.effect})}),C.jsx("td",{className:"px-3 py-2 text-[11px] font-semibold",style:{color:ZE[t.severity]??"rgba(230,237,243,0.5)"},children:t.severity}),C.jsx("td",{className:"px-3 py-2 truncate max-w-xs",style:{color:"rgba(230,237,243,0.5)"},children:t.rule}),C.jsx("td",{className:"px-3 py-2",children:C.jsx("button",{type:"button",onClick:()=>e(t),className:"text-[10px] hover:underline",style:{color:"#79c0ff"},children:"Edit"})})]})}function tk(){const[t,e]=ae.useState([]),[r,n]=ae.useState(!0),[i,s]=ae.useState(null),[o,a]=ae.useState(""),[l,u]=ae.useState("idle"),[c,h]=ae.useState(null),[g,p]=ae.useState(null),x=ae.useCallback(async()=>{n(!0),s(null);try{const{policies:y}=await lt.listPolicies();e(y)}catch(y){s(y instanceof Error?y.message:String(y))}finally{n(!1)}},[]);ae.useEffect(()=>{x()},[x]);const w=y=>{a(JSON.stringify(y??JE,null,2)),p(null),u("idle"),h(null)},v=y=>{a(y);try{JSON.parse(y),p(null)}catch(b){p(b instanceof Error?b.message:String(b))}},m=async()=>{if(g)return;let y;try{y=JSON.parse(o)}catch(b){p(b instanceof Error?b.message:String(b));return}u("saving"),h(null);try{await lt.upsertPolicy(y),u("ok"),await x()}catch(b){u("error"),h(b instanceof Error?b.message:String(b))}};return C.jsxs("div",{className:"flex flex-col gap-4",children:[C.jsxs("div",{className:"flex items-center gap-3",children:[C.jsx("h2",{className:"text-sm font-semibold",style:{color:"#e6edf3"},children:"Policies"}),C.jsx("button",{type:"button",onClick:()=>void x(),className:"text-[10px] hover:underline",style:{color:"rgba(230,237,243,0.4)"},children:"Refresh"}),C.jsx("button",{type:"button",onClick:()=>w(),className:"ml-auto rounded px-2 py-1 text-[11px] font-semibold",style:{background:"#ffda19",color:"#0d1117"},children:"+ New policy"})]}),i&&C.jsx("p",{className:"rounded px-2 py-1 text-xs",style:{background:"rgba(248,81,73,0.08)",color:"#f85149"},children:i}),r?C.jsx("p",{className:"text-xs",style:{color:"rgba(230,237,243,0.4)"},children:"Loading policies…"}):C.jsx("div",{className:"overflow-x-auto rounded",style:{border:"1px solid rgba(230,237,243,0.08)"},children:C.jsxs("table",{className:"w-full text-[11px]",children:[C.jsx("thead",{children:C.jsxs("tr",{className:"text-[10px] uppercase tracking-wider",style:{borderBottom:"1px solid rgba(230,237,243,0.08)",background:"#0f1419",color:"rgba(230,237,243,0.4)"},children:[C.jsx("th",{className:"px-3 py-2 text-left",children:"ID"}),C.jsx("th",{className:"px-3 py-2 text-left",children:"Kind"}),C.jsx("th",{className:"px-3 py-2 text-left",children:"Effect"}),C.jsx("th",{className:"px-3 py-2 text-left",children:"Severity"}),C.jsx("th",{className:"px-3 py-2 text-left",children:"Rule"}),C.jsx("th",{className:"px-3 py-2"})]})}),C.jsx("tbody",{children:t.length===0?C.jsx("tr",{children:C.jsx("td",{colSpan:6,className:"px-3 py-4 text-center text-xs",style:{color:"rgba(230,237,243,0.35)"},children:"No policies registered."})}):t.map(y=>C.jsx(ek,{policy:y,onEdit:w},y.id))})]})}),o!==""&&C.jsxs("div",{className:"flex flex-col gap-2 rounded p-3",style:{border:"1px solid rgba(255,218,25,0.25)",background:"rgba(255,218,25,0.04)"},children:[C.jsxs("div",{className:"flex items-center gap-2",children:[C.jsx("span",{className:"text-[11px] font-semibold",style:{color:"#ffda19"},children:"Policy JSON"}),C.jsx("button",{type:"button",onClick:()=>{a(""),u("idle")},className:"ml-auto text-[10px] hover:underline",style:{color:"rgba(230,237,243,0.4)"},children:"Cancel"})]}),C.jsx("textarea",{"aria-label":"Policy JSON editor",value:o,onChange:y=>v(y.target.value),spellCheck:!1,className:"rounded p-2 font-mono text-[10px] focus:outline-none min-h-[200px] resize-y",style:{background:"#0d1117",color:"#e6edf3",border:"1px solid rgba(230,237,243,0.1)"}}),g&&C.jsx("p",{className:"text-[10px]",style:{color:"#f85149"},children:g}),C.jsxs("div",{className:"flex items-center gap-2",children:[C.jsx("button",{type:"button",onClick:()=>void m(),disabled:!!g||l==="saving",className:"rounded px-3 py-1 text-[11px] font-semibold disabled:opacity-50",style:{background:"#3fb950",color:"#0d1117"},children:l==="saving"?"Saving…":"Save policy"}),l==="ok"&&C.jsx("span",{className:"text-[10px]",style:{color:"#3fb950"},children:"Saved."}),l==="error"&&C.jsx("span",{className:"text-[10px]",style:{color:"#f85149"},children:c})]})]})]})}const rk=new Set(["completed","cancelled","failed"]);function nk(t){const e=t*1e3,r=Math.floor((Date.now()-e)/(1e3*60*60*24));return r<1?"registered today":r===1?"registered yesterday":r<30?`registered ${r} days ago`:`registered ${new Date(e).toLocaleDateString("en-US",{month:"short",year:"numeric"})}`}const Uu={background:"#0f1419",border:"1px solid rgba(230,237,243,0.14)",color:"#e6edf3",borderRadius:"6px",padding:"6px 10px",fontSize:"12px",fontFamily:"var(--wk-font-mono, monospace)",outline:"none",width:"100%"};function ad({label:t,value:e,hint:r}){return C.jsxs("div",{className:"rounded-2xl p-5 flex flex-col gap-1",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.07)"},children:[C.jsx("p",{className:"text-[10px] font-mono uppercase tracking-widest",style:{color:"rgba(230,237,243,0.4)"},children:t}),C.jsx("p",{className:"text-3xl font-mono font-bold",style:{color:"#e6edf3"},children:e}),r&&C.jsx("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.35)"},children:r})]})}function ik({onSelectRun:t,autoShowRegister:e,navigate:r}){const[n,i]=ae.useState([]),[s,o]=ae.useState([]),[a,l]=ae.useState(!0),[u,c]=ae.useState(null),[h,g]=ae.useState(""),[p,x]=ae.useState(0),[w,v]=ae.useState({}),[m,y]=ae.useState({}),[b,_]=ae.useState(e??!1),[R,E]=ae.useState("local"),[T,k]=ae.useState(""),[N,M]=ae.useState(""),[B,A]=ae.useState(""),[j,D]=ae.useState(""),[I,U]=ae.useState(null),[W,H]=ae.useState(!1),z=ae.useRef(!1);ae.useEffect(()=>{l(!0),Promise.all([lt.listRepos(),lt.listRuns()]).then(([{repos:Y},{runs:q}])=>{i(Y),o(q)}).catch(Y=>c(Y instanceof Error?Y.message:String(Y))).finally(()=>l(!1))},[]),ae.useEffect(()=>{if(n.length===0){x(0);return}let Y=!1;return Promise.all(n.map(q=>lt.getRepoGraph(q.id).then(({graph:K})=>K!=null).catch(()=>!1))).then(q=>{Y||x(q.filter(Boolean).length)}),()=>{Y=!0}},[n]);function P(Y){if(z.current)return;const q=Y.replace(/\.git$/,"").split(/[/\\:]/).filter(Boolean).pop()??"";q&&k(q)}async function F(Y){v(q=>({...q,[Y]:!0})),y(q=>({...q,[Y]:""}));try{const{runId:q}=await lt.rerunOnboarding(Y);t==null||t(q)}catch(q){y(K=>({...K,[Y]:q instanceof Error?q.message:String(q)}))}finally{v(q=>({...q,[Y]:!1}))}}async function G(){const Y=T.trim(),q=R==="remote",K=q?B.trim():N.trim();if(!(!Y||!K)){U(null),H(!0);try{const{repo:X}=q?await lt.cloneAndRegisterRepo(Y,K,j.trim()||void 0):await lt.registerRepo(Y,K);i(J=>[...J,X]),_(!1),k(""),M(""),A(""),D(""),E("local"),z.current=!1,r("/repo-detail/"+encodeURIComponent(X.id))}catch(X){U(X instanceof Error?X.message:String(X))}finally{H(!1)}}}const $=!!(T.trim()&&(R==="remote"?B.trim():N.trim())),ee=s.filter(Y=>!rk.has(Y.session.status)),re=h.trim()===""?n:n.filter(Y=>Y.name.toLowerCase().includes(h.trim().toLowerCase()));function ne(Y){return ee.filter(q=>q.session.repo_ref===Y).length}return C.jsxs("div",{className:"h-full overflow-y-auto",children:[C.jsxs("div",{className:"px-8 pt-8 pb-4",children:[C.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[C.jsx("h1",{className:"text-base font-bold font-mono flex-1",style:{color:"#e6edf3",letterSpacing:"-0.01em"},children:"Repositories"}),C.jsx("input",{style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.12)",color:"#e6edf3",borderRadius:"6px",padding:"6px 12px",fontSize:"12px",fontFamily:"var(--wk-font-mono, monospace)",outline:"none",width:"200px"},placeholder:"Search repos…",value:h,onChange:Y=>g(Y.target.value)}),C.jsx("button",{type:"button",onClick:()=>{b?(_(!1),r("/repos")):(_(!0),r("/repos/new"))},className:"shrink-0 rounded-lg px-4 py-1.5 text-xs font-semibold font-mono",style:{background:b?"rgba(230,237,243,0.1)":"#ffda19",color:b?"#e6edf3":"#0d1117"},children:b?"Cancel":"+ Add Repository"})]}),b&&C.jsxs("div",{className:"flex flex-col gap-3 rounded-2xl p-5 mb-5",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.08)"},children:[C.jsx("div",{role:"group","aria-label":"Repository source",className:"flex gap-1",children:["local","remote"].map(Y=>C.jsx("button",{type:"button","aria-pressed":R===Y,onClick:()=>E(Y),className:"rounded-md px-3 py-1 text-[11px] font-mono font-medium transition-colors",style:R===Y?{background:"rgba(230,237,243,0.12)",color:"#e6edf3"}:{color:"rgba(230,237,243,0.4)"},children:Y==="local"?"Local path":"Remote URL"},Y))}),C.jsx("input",{style:Uu,placeholder:"Repo name",value:T,onChange:Y=>{k(Y.target.value),z.current=!!Y.target.value.trim()}}),R==="local"?C.jsx("input",{style:Uu,placeholder:"Absolute path to git repo",value:N,onChange:Y=>{M(Y.target.value),P(Y.target.value)}}):C.jsxs(C.Fragment,{children:[C.jsx("input",{style:Uu,placeholder:"https://github.com/org/repo or git@github.com:org/repo",value:B,onChange:Y=>{A(Y.target.value),P(Y.target.value)}}),C.jsxs("div",{className:"flex flex-col gap-1",children:[C.jsx("label",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Clone to (optional)"}),C.jsx("input",{style:Uu,placeholder:`~/.wicked/repos/${T||"<name>"}`,value:j,onChange:Y=>D(Y.target.value)})]})]}),C.jsx("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:R==="remote"?`Clones to ${j.trim()||`~/.wicked/repos/${T||"<name>"}`}, then runs the onboarding workflow as a governed run.`:"Runs the onboarding workflow (index → annotate → domain) as a governed run."}),I&&C.jsx("p",{className:"text-[11px] font-mono",style:{color:"#f85149"},children:I}),C.jsx("button",{type:"button",onClick:()=>void G(),disabled:W||!$,className:"self-start rounded-lg px-4 py-1.5 text-[11px] font-semibold font-mono disabled:opacity-50",style:{background:"#ffda19",color:"#0d1117"},children:W?R==="remote"?"Cloning…":"Registering…":R==="remote"?"Clone & onboard":"Register & onboard"})]})]}),C.jsxs("div",{className:"px-8 pb-10",children:[!a&&!u&&C.jsxs("div",{className:"grid grid-cols-3 gap-4 mb-6",children:[C.jsx(ad,{label:"Total Repos",value:n.length,hint:"registered with wicked-crew"}),C.jsx(ad,{label:"Active Runs",value:ee.length,hint:ee.length===1?"1 run in progress":`${ee.length} runs in progress`}),C.jsx(ad,{label:"Tracked",value:p,hint:"onboarded and graph-indexed"})]}),a?C.jsx("p",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Loading repositories…"}):u?C.jsx("p",{className:"text-xs font-mono",style:{color:"#f85149"},children:u}):n.length===0?C.jsx("div",{className:"flex flex-col items-center justify-center py-24 text-center",children:C.jsxs("div",{className:"rounded-2xl p-10 flex flex-col items-center gap-4",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.07)",maxWidth:420},children:[C.jsx("p",{className:"text-2xl font-mono font-bold",style:{color:"rgba(230,237,243,0.15)"},children:"No repositories"}),C.jsx("p",{className:"text-sm font-mono",style:{color:"rgba(230,237,243,0.45)"},children:"Register a local git repo or clone a remote one. wicked-crew will index it, annotate the domain model, and keep the knowledge graph up to date."}),C.jsx("button",{type:"button",onClick:()=>_(!0),className:"rounded-lg px-5 py-2 text-xs font-semibold font-mono mt-2",style:{background:"#ffda19",color:"#0d1117"},children:"+ Add Repository"})]})}):re.length===0?C.jsxs("p",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.4)"},children:["No repos match “",h,"”."]}):C.jsx("div",{className:"grid grid-cols-2 gap-4",children:re.map(Y=>{const q=ne(Y.id),K=w[Y.id]??!1,X=m[Y.id];return C.jsxs("div",{className:"rounded-2xl p-5 flex flex-col gap-3 cursor-pointer transition-colors",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.08)"},onClick:()=>r("/repo-detail/"+encodeURIComponent(Y.id)),role:"button",tabIndex:0,onKeyDown:J=>{(J.key==="Enter"||J.key===" ")&&r("/repo-detail/"+encodeURIComponent(Y.id))},children:[C.jsxs("div",{className:"flex items-start justify-between gap-2",children:[C.jsxs("div",{className:"flex-1 min-w-0",children:[C.jsx("p",{className:"text-sm font-bold font-mono truncate",style:{color:"#e6edf3"},children:Y.name}),C.jsx("p",{className:"text-[11px] font-mono mt-0.5 truncate",style:{color:"rgba(230,237,243,0.4)"},title:Y.root_path,children:Y.root_path})]}),C.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[q>0&&C.jsxs("span",{className:"rounded-full px-2 py-0.5 text-[10px] font-mono font-semibold",style:{background:"rgba(63,185,80,0.15)",color:"#3fb950"},children:[q," active"]}),C.jsx("span",{className:"rounded-full px-2 py-0.5 text-[10px] font-mono",style:{background:"rgba(121,192,255,0.12)",color:"#79c0ff"},children:Y.default_branch})]})]}),C.jsx("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.3)"},children:nk(Y.registered_at)}),X&&C.jsx("p",{className:"text-[11px] font-mono",style:{color:"#f85149"},children:X}),C.jsxs("div",{className:"flex items-center justify-between mt-auto",onClick:J=>J.stopPropagation(),onKeyDown:J=>J.stopPropagation(),role:"presentation",children:[C.jsx("button",{type:"button",onClick:()=>r("/repo-detail/"+encodeURIComponent(Y.id)),className:"text-xs font-mono hover:underline",style:{color:"#79c0ff"},children:"View →"}),C.jsx("button",{type:"button",disabled:K,onClick:()=>void F(Y.id),className:"rounded-md px-3 py-1 text-[11px] font-mono disabled:opacity-50",style:{background:"rgba(230,237,243,0.07)",color:"rgba(230,237,243,0.6)",border:"1px solid rgba(230,237,243,0.08)"},children:K?"Starting…":"Onboard"})]})]},Y.id)})})]})]})}const ak=new Set(["completed","failed","cancelled"]);function sk({repoId:t,onSelectRun:e,navigate:r,onOpenGraph:n}){const[i,s]=ae.useState(null),[o,a]=ae.useState([]),[l,u]=ae.useState(null),[c,h]=ae.useState(null),[g,p]=ae.useState(null),[x,w]=ae.useState(!0),[v,m]=ae.useState(null),[y,b]=ae.useState(!1),[_,R]=ae.useState(!1),[E,T]=ae.useState(null);if(ae.useEffect(()=>{let I=!1;return w(!0),m(null),b(!1),h(null),p(null),Promise.all([lt.listRepos().then(({repos:U})=>U.find(W=>W.id===t)??null),lt.listRuns().then(({runs:U})=>U.filter(W=>W.session.repo_ref===t)).catch(()=>[]),lt.getRepoGraph(t).then(({graph:U})=>U).catch(()=>null)]).then(([U,W,H])=>{I||(s(U),a(W),u(H))}).catch(U=>{I||m(U instanceof Error?U.message:"Failed to load repo")}).finally(()=>{I||w(!1)}),lt.getRepoGitHistory(t).then(({commits:U})=>{I||h(U)}).catch(()=>{}),lt.getRepoContributors(t).then(({contributors:U})=>{I||p(U)}).catch(()=>{}),()=>{I=!0}},[t]),x)return C.jsx("div",{className:"p-8 font-mono text-sm",style:{color:"rgba(230,237,243,0.4)"},children:"Loading…"});if(v)return C.jsx("div",{className:"p-8 font-mono text-sm",style:{color:"#f85149"},children:v});if(!i)return C.jsx("div",{className:"p-8 font-mono text-sm",style:{color:"#f85149"},children:"Repo not found."});const k=o.filter(I=>!ak.has(I.session.status)),N=o.filter(I=>I.session.status==="completed"),M=o.filter(I=>I.session.status==="failed"||I.session.status==="cancelled"),B=l?[...l.nodes].filter(I=>I.file&&!I.file.startsWith("node_modules/")).sort((I,U)=>U.inDeg-I.inDeg).slice(0,5):[],A=y?o:o.slice(0,10),j=l==null?void 0:l.stats;async function D(){R(!0),T(null);try{const{runId:I}=await lt.rerunOnboarding(t);e(I)}catch(I){T(I instanceof Error?I.message:String(I))}finally{R(!1)}}return C.jsxs("div",{className:"flex flex-col gap-6 p-8",style:{color:"#e6edf3"},children:[C.jsxs("div",{className:"flex flex-col gap-3",children:[C.jsx("button",{type:"button",onClick:()=>r("/repos"),className:"text-xs font-mono self-start transition-opacity hover:opacity-70",style:{color:"rgba(230,237,243,0.4)"},children:"← Repositories"}),C.jsxs("div",{className:"flex items-start gap-4 flex-wrap",children:[C.jsxs("div",{className:"flex-1 min-w-0",children:[C.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[C.jsx("h1",{className:"text-2xl font-semibold font-mono",children:i.name}),C.jsx("button",{type:"button",onClick:()=>void D(),disabled:_,className:"px-3 py-1 rounded-lg text-xs font-semibold font-mono transition-opacity disabled:opacity-50",style:{background:"#ffda19",color:"#0d1117"},children:_?"Starting…":"↺ Run Onboarding"}),C.jsx("button",{type:"button",onClick:n,className:"px-3 py-1 rounded-lg text-xs font-semibold font-mono transition-opacity hover:opacity-80",style:{background:"rgba(121,192,255,0.12)",color:"#79c0ff",border:"1px solid rgba(121,192,255,0.2)"},children:"Open Graph →"})]}),E&&C.jsx("p",{className:"text-[11px] font-mono mt-1",style:{color:"#f85149"},children:E}),C.jsx("p",{className:"text-xs font-mono mt-1 break-all",style:{color:"rgba(230,237,243,0.4)"},children:i.root_path}),i.git_url&&(/^https?:\/\//i.test(i.git_url)?C.jsx("a",{href:i.git_url,target:"_blank",rel:"noopener noreferrer",className:"text-[11px] font-mono mt-0.5 block truncate hover:underline",style:{color:"#79c0ff"},title:i.git_url,children:i.git_url}):C.jsx("span",{className:"text-[11px] font-mono mt-0.5 block truncate",style:{color:"#79c0ff"},title:i.git_url,children:i.git_url}))]}),C.jsx("span",{className:"shrink-0 mt-1 rounded px-2 py-0.5 text-[11px] font-mono",style:{background:"rgba(121,192,255,0.12)",color:"#79c0ff",border:"1px solid rgba(121,192,255,0.2)"},children:i.default_branch})]})]}),C.jsx("div",{className:"grid grid-cols-4 gap-4",children:[{label:"Total Runs",value:o.length,accent:void 0},{label:"Active",value:k.length,accent:k.length>0?"#79c0ff":void 0},{label:"Completed",value:N.length,accent:N.length>0?"#3fb950":void 0},{label:"Failed",value:M.length,accent:M.length>0?"#f85149":void 0}].map(I=>C.jsxs("div",{className:"rounded-2xl px-6 py-4",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.07)"},children:[C.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest font-mono",style:{color:"rgba(230,237,243,0.4)"},children:I.label}),C.jsx("p",{className:"text-3xl font-semibold mt-1",style:{color:I.accent??"#e6edf3"},children:I.value})]},I.label))}),k.length>0&&C.jsx(gs,{title:"Active Now",children:C.jsx("div",{className:"flex flex-col gap-1",children:k.map(I=>C.jsx($i,{view:I,selectedRunId:null,onSelect:e},I.session.id))})}),C.jsxs("div",{className:"grid gap-6 grid-cols-1 md:grid-cols-2",children:[C.jsxs("div",{className:"flex flex-col gap-6",children:[o.length>0&&C.jsxs(gs,{title:"Work & Chats",children:[C.jsx("div",{className:"flex flex-col gap-1",children:A.map(I=>C.jsx($i,{view:I,selectedRunId:null,onSelect:e},I.session.id))}),o.length>10&&C.jsx("button",{type:"button",onClick:()=>b(I=>!I),className:"mt-3 text-xs font-mono hover:underline",style:{color:"rgba(230,237,243,0.4)"},children:y?"↑ show less":`↓ show all ${o.length} runs`})]}),C.jsx(gs,{title:"Code Hotspots",children:B.length===0?C.jsx("p",{className:"text-sm font-mono italic",style:{color:"rgba(230,237,243,0.35)"},children:"Graph not yet indexed — run onboarding to build it."}):C.jsxs("div",{className:"flex flex-col gap-2",children:[B.map((I,U)=>C.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 rounded-lg",style:{background:"#161c26",border:"1px solid rgba(230,237,243,0.05)"},children:[C.jsx("span",{className:"text-[10px] font-mono w-4 text-right shrink-0",style:{color:"rgba(230,237,243,0.3)"},children:U+1}),C.jsx("span",{className:"flex-1 text-xs font-mono truncate",style:{color:"rgba(230,237,243,0.75)"},title:I.file,children:I.file}),C.jsxs("span",{className:"shrink-0 text-[10px] font-mono px-2 py-0.5 rounded",style:{background:"rgba(121,192,255,0.12)",color:"#79c0ff"},children:[I.inDeg," edges"]}),C.jsx("button",{type:"button",onClick:n,className:"shrink-0 text-[10px] font-mono hover:underline",style:{color:"rgba(230,237,243,0.4)"},children:"→ Graph"})]},I.id)),C.jsx("button",{type:"button",onClick:n,className:"mt-2 self-start text-xs font-mono hover:underline",style:{color:"#79c0ff"},children:"Open full graph →"})]})})]}),C.jsxs("div",{className:"flex flex-col gap-6",children:[C.jsx(gs,{title:"Code Graph",children:j?C.jsxs("div",{className:"flex flex-col gap-3",children:[[{label:"Symbols",value:j.nodeCount},{label:"Edges",value:j.edgeCount},{label:"Files indexed",value:j.fileCount}].map(I=>C.jsxs("div",{className:"flex items-center justify-between",children:[C.jsx("span",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.5)"},children:I.label}),C.jsx("span",{className:"text-sm font-semibold font-mono",style:{color:"#e6edf3"},children:I.value.toLocaleString()})]},I.label)),C.jsx("button",{type:"button",onClick:n,className:"mt-2 self-start text-xs font-mono hover:underline",style:{color:"#79c0ff"},children:"Browse full graph →"})]}):C.jsx("p",{className:"text-sm font-mono italic",style:{color:"rgba(230,237,243,0.35)"},children:"No graph yet — run onboarding to index this repo."})}),C.jsx(gs,{title:"Git History",children:c===null?C.jsx(ok,{count:6,widths:["w-14","w-16","flex-1","w-12"]}):c.length===0?C.jsx("p",{className:"text-sm font-mono italic",style:{color:"rgba(230,237,243,0.35)"},children:"No commits yet."}):C.jsx("div",{className:"flex flex-col gap-2",children:c.map(I=>C.jsxs("div",{className:"flex items-start gap-2 min-w-0",children:[i.git_url&&/^https:\/\//i.test(i.git_url)?C.jsx("a",{href:`${i.git_url.replace(/\.git$/,"")}/commit/${I.sha}`,target:"_blank",rel:"noopener noreferrer",className:"shrink-0 text-[10px] font-mono hover:underline",style:{color:"#79c0ff",marginTop:"1px"},children:I.shortSha}):C.jsx("span",{className:"shrink-0 text-[10px] font-mono",style:{color:"#79c0ff",marginTop:"1px"},children:I.shortSha}),C.jsx("span",{className:"shrink-0 text-[9px] font-mono truncate max-w-[80px]",style:{color:"rgba(230,237,243,0.45)"},title:I.author,children:I.author}),C.jsx("span",{className:"flex-1 text-[10px] font-mono truncate",style:{color:"rgba(230,237,243,0.8)"},title:I.message,children:I.message.length>72?`${I.message.slice(0,72)}…`:I.message}),C.jsx("span",{className:"shrink-0 text-[9px] font-mono",style:{color:"rgba(230,237,243,0.3)"},children:I.date})]},I.sha))})}),C.jsx(gs,{title:"Contributors",children:g===null?C.jsx(lk,{count:4}):g.length===0?C.jsx("p",{className:"text-sm font-mono italic",style:{color:"rgba(230,237,243,0.35)"},children:"No contributors found."}):C.jsx("div",{className:"flex flex-col gap-2",children:g.map((I,U)=>{const W=I.name.split(" ").map(H=>H[0]??"").join("").slice(0,2).toUpperCase();return C.jsxs("div",{className:"flex items-center gap-2",children:[C.jsx("span",{className:"shrink-0 w-6 h-6 rounded-full flex items-center justify-center text-[9px] font-bold font-mono",style:{background:"rgba(121,192,255,0.15)",color:"#79c0ff"},children:W}),C.jsx("span",{className:"flex-1 text-xs font-mono truncate",style:{color:"rgba(230,237,243,0.8)"},children:I.name}),C.jsxs("span",{className:"shrink-0 text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:[I.commits," commit",I.commits!==1?"s":""]})]},`${I.email}-${I.name}-${U}`)})})})]})]})]})}const aw="rgba(230,237,243,0.06)";function ov({className:t}){return C.jsx("span",{className:`inline-block rounded animate-pulse ${t}`,style:{background:aw}})}function ok({count:t,widths:e}){return C.jsx("div",{className:"flex flex-col gap-2.5",children:Array.from({length:t},(r,n)=>C.jsx("div",{className:"flex items-center gap-2 min-w-0",style:{opacity:Math.max(.15,1-n*.12)},children:e.map((i,s)=>C.jsx(ov,{className:`h-2.5 ${i}`},s))},n))})}function lk({count:t}){return C.jsx("div",{className:"flex flex-col gap-2.5",children:Array.from({length:t},(e,r)=>C.jsxs("div",{className:"flex items-center gap-2",style:{opacity:Math.max(.15,1-r*.18)},children:[C.jsx("span",{className:"shrink-0 w-6 h-6 rounded-full animate-pulse",style:{background:aw}}),C.jsx(ov,{className:"h-2.5 w-28"}),C.jsx(ov,{className:"h-2 w-14 ml-auto"})]},r))})}function gs({title:t,children:e}){return C.jsxs("div",{className:"rounded-2xl p-6",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.07)"},children:[C.jsx("h2",{className:"text-[10px] font-semibold uppercase tracking-widest mb-4 font-mono",style:{color:"rgba(230,237,243,0.4)"},children:t}),e]})}function lv(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function uk(t){if(Array.isArray(t))return t}function ck(t){if(Array.isArray(t))return lv(t)}function ia(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function hk(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,ow(n.key),n)}}function aa(t,e,r){return e&&hk(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function on(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Vv(t))||e){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(l){throw l},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
46
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s,o=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var l=r.next();return o=l.done,l},e:function(l){a=!0,s=l},f:function(){try{o||r.return==null||r.return()}finally{if(a)throw s}}}}function sw(t,e,r){return(e=ow(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function fk(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function dk(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,s,o,a=[],l=!0,u=!1;try{if(s=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=s.call(r)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(c){u=!0,i=c}finally{try{if(!l&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw i}}return a}}function pk(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
47
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function vk(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
48
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function pr(t,e){return uk(t)||dk(t,e)||Vv(t,e)||pk()}function Cc(t){return ck(t)||fk(t)||Vv(t)||vk()}function gk(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function ow(t){var e=gk(t,"string");return typeof e=="symbol"?e:e+""}function xr(t){"@babel/helpers - typeof";return xr=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},xr(t)}function Vv(t,e){if(t){if(typeof t=="string")return lv(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)?lv(t,e):void 0}}var mr=typeof window>"u"?null:window,m0=mr?mr.navigator:null;mr&&mr.document;var mk=xr(""),lw=xr({}),yk=xr(function(){}),xk=typeof HTMLElement>"u"?"undefined":xr(HTMLElement),wl=function(e){return e&&e.instanceString&&nr(e.instanceString)?e.instanceString():null},ut=function(e){return e!=null&&xr(e)==mk},nr=function(e){return e!=null&&xr(e)===yk},Ut=function(e){return!mn(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},Dt=function(e){return e!=null&&xr(e)===lw&&!Ut(e)&&e.constructor===Object},bk=function(e){return e!=null&&xr(e)===lw},Xe=function(e){return e!=null&&xr(e)===xr(1)&&!isNaN(e)},wk=function(e){return Xe(e)&&Math.floor(e)===e},Ec=function(e){if(xk!=="undefined")return e!=null&&e instanceof HTMLElement},mn=function(e){return _l(e)||uw(e)},_l=function(e){return wl(e)==="collection"&&e._private.single},uw=function(e){return wl(e)==="collection"&&!e._private.single},$v=function(e){return wl(e)==="core"},cw=function(e){return wl(e)==="stylesheet"},_k=function(e){return wl(e)==="event"},Qi=function(e){return e==null?!0:!!(e===""||e.match(/^\s+$/))},Sk=function(e){return typeof HTMLElement>"u"?!1:e instanceof HTMLElement},Ck=function(e){return Dt(e)&&Xe(e.x1)&&Xe(e.x2)&&Xe(e.y1)&&Xe(e.y2)},Ek=function(e){return bk(e)&&nr(e.then)},kk=function(){return m0&&m0.userAgent.match(/msie|trident|edge/i)},js=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 n=function(){var s=this,o=arguments,a,l=r.apply(s,o),u=n.cache;return(a=u[l])||(a=u[l]=e.apply(s,o)),a};return n.cache={},n},Gv=js(function(t){return t.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),Wc=js(function(t){return t.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),hw=js(function(t,e){return t+e[0].toUpperCase()+e.substring(1)},function(t,e){return t+"$"+e}),y0=function(e){return Qi(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},Gi=function(e,r){return e.slice(-1*r.length)===r},yr="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",Tk="rgb[a]?\\(("+yr+"[%]?)\\s*,\\s*("+yr+"[%]?)\\s*,\\s*("+yr+"[%]?)(?:\\s*,\\s*("+yr+"))?\\)",Rk="rgb[a]?\\((?:"+yr+"[%]?)\\s*,\\s*(?:"+yr+"[%]?)\\s*,\\s*(?:"+yr+"[%]?)(?:\\s*,\\s*(?:"+yr+"))?\\)",Lk="hsl[a]?\\(("+yr+")\\s*,\\s*("+yr+"[%])\\s*,\\s*("+yr+"[%])(?:\\s*,\\s*("+yr+"))?\\)",Nk="hsl[a]?\\((?:"+yr+")\\s*,\\s*(?:"+yr+"[%])\\s*,\\s*(?:"+yr+"[%])(?:\\s*,\\s*(?:"+yr+"))?\\)",Dk="\\#[0-9a-fA-F]{3}",Ak="\\#[0-9a-fA-F]{6}",fw=function(e,r){return e<r?-1:e>r?1:0},Mk=function(e,r){return-1*fw(e,r)},dt=Object.assign!=null?Object.assign.bind(Object):function(t){for(var e=arguments,r=1;r<e.length;r++){var n=e[r];if(n!=null)for(var i=Object.keys(n),s=0;s<i.length;s++){var o=i[s];t[o]=n[o]}}return t},Pk=function(e){if(!(!(e.length===4||e.length===7)||e[0]!=="#")){var r=e.length===4,n,i,s,o=16;return r?(n=parseInt(e[1]+e[1],o),i=parseInt(e[2]+e[2],o),s=parseInt(e[3]+e[3],o)):(n=parseInt(e[1]+e[2],o),i=parseInt(e[3]+e[4],o),s=parseInt(e[5]+e[6],o)),[n,i,s]}},Ik=function(e){var r,n,i,s,o,a,l,u;function c(x,w,v){return v<0&&(v+=1),v>1&&(v-=1),v<1/6?x+(w-x)*6*v:v<1/2?w:v<2/3?x+(w-x)*(2/3-v)*6:x}var h=new RegExp("^"+Lk+"$").exec(e);if(h){if(n=parseInt(h[1]),n<0?n=(360- -1*n%360)%360:n>360&&(n=n%360),n/=360,i=parseFloat(h[2]),i<0||i>100||(i=i/100,s=parseFloat(h[3]),s<0||s>100)||(s=s/100,o=h[4],o!==void 0&&(o=parseFloat(o),o<0||o>1)))return;if(i===0)a=l=u=Math.round(s*255);else{var g=s<.5?s*(1+i):s+i-s*i,p=2*s-g;a=Math.round(255*c(p,g,n+1/3)),l=Math.round(255*c(p,g,n)),u=Math.round(255*c(p,g,n-1/3))}r=[a,l,u,o]}return r},Ok=function(e){var r,n=new RegExp("^"+Tk+"$").exec(e);if(n){r=[];for(var i=[],s=1;s<=3;s++){var o=n[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 a=i[1]||i[2]||i[3],l=i[1]&&i[2]&&i[3];if(a&&!l)return;var u=n[4];if(u!==void 0){if(u=parseFloat(u),u<0||u>1)return;r.push(u)}}return r},Bk=function(e){return Fk[e.toLowerCase()]},dw=function(e){return(Ut(e)?e:null)||Bk(e)||Pk(e)||Ok(e)||Ik(e)},Fk={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]},pw=function(e){for(var r=e.map,n=e.keys,i=n.length,s=0;s<i;s++){var o=n[s];if(Dt(o))throw Error("Tried to set map with object key");s<n.length-1?(r[o]==null&&(r[o]={}),r=r[o]):r[o]=e.value}},vw=function(e){for(var r=e.map,n=e.keys,i=n.length,s=0;s<i;s++){var o=n[s];if(Dt(o))throw Error("Tried to get map with object key");if(r=r[o],r==null)return r}return r},Wu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Sl(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var sd,x0;function Cl(){if(x0)return sd;x0=1;function t(e){var r=typeof e;return e!=null&&(r=="object"||r=="function")}return sd=t,sd}var od,b0;function jk(){if(b0)return od;b0=1;var t=typeof Wu=="object"&&Wu&&Wu.Object===Object&&Wu;return od=t,od}var ld,w0;function Vc(){if(w0)return ld;w0=1;var t=jk(),e=typeof self=="object"&&self&&self.Object===Object&&self,r=t||e||Function("return this")();return ld=r,ld}var ud,_0;function zk(){if(_0)return ud;_0=1;var t=Vc(),e=function(){return t.Date.now()};return ud=e,ud}var cd,S0;function Hk(){if(S0)return cd;S0=1;var t=/\s/;function e(r){for(var n=r.length;n--&&t.test(r.charAt(n)););return n}return cd=e,cd}var hd,C0;function Uk(){if(C0)return hd;C0=1;var t=Hk(),e=/^\s+/;function r(n){return n&&n.slice(0,t(n)+1).replace(e,"")}return hd=r,hd}var fd,E0;function qv(){if(E0)return fd;E0=1;var t=Vc(),e=t.Symbol;return fd=e,fd}var dd,k0;function Wk(){if(k0)return dd;k0=1;var t=qv(),e=Object.prototype,r=e.hasOwnProperty,n=e.toString,i=t?t.toStringTag:void 0;function s(o){var a=r.call(o,i),l=o[i];try{o[i]=void 0;var u=!0}catch{}var c=n.call(o);return u&&(a?o[i]=l:delete o[i]),c}return dd=s,dd}var pd,T0;function Vk(){if(T0)return pd;T0=1;var t=Object.prototype,e=t.toString;function r(n){return e.call(n)}return pd=r,pd}var vd,R0;function gw(){if(R0)return vd;R0=1;var t=qv(),e=Wk(),r=Vk(),n="[object Null]",i="[object Undefined]",s=t?t.toStringTag:void 0;function o(a){return a==null?a===void 0?i:n:s&&s in Object(a)?e(a):r(a)}return vd=o,vd}var gd,L0;function $k(){if(L0)return gd;L0=1;function t(e){return e!=null&&typeof e=="object"}return gd=t,gd}var md,N0;function El(){if(N0)return md;N0=1;var t=gw(),e=$k(),r="[object Symbol]";function n(i){return typeof i=="symbol"||e(i)&&t(i)==r}return md=n,md}var yd,D0;function Gk(){if(D0)return yd;D0=1;var t=Uk(),e=Cl(),r=El(),n=NaN,i=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,o=/^0o[0-7]+$/i,a=parseInt;function l(u){if(typeof u=="number")return u;if(r(u))return n;if(e(u)){var c=typeof u.valueOf=="function"?u.valueOf():u;u=e(c)?c+"":c}if(typeof u!="string")return u===0?u:+u;u=t(u);var h=s.test(u);return h||o.test(u)?a(u.slice(2),h?2:8):i.test(u)?n:+u}return yd=l,yd}var xd,A0;function qk(){if(A0)return xd;A0=1;var t=Cl(),e=zk(),r=Gk(),n="Expected a function",i=Math.max,s=Math.min;function o(a,l,u){var c,h,g,p,x,w,v=0,m=!1,y=!1,b=!0;if(typeof a!="function")throw new TypeError(n);l=r(l)||0,t(u)&&(m=!!u.leading,y="maxWait"in u,g=y?i(r(u.maxWait)||0,l):g,b="trailing"in u?!!u.trailing:b);function _(j){var D=c,I=h;return c=h=void 0,v=j,p=a.apply(I,D),p}function R(j){return v=j,x=setTimeout(k,l),m?_(j):p}function E(j){var D=j-w,I=j-v,U=l-D;return y?s(U,g-I):U}function T(j){var D=j-w,I=j-v;return w===void 0||D>=l||D<0||y&&I>=g}function k(){var j=e();if(T(j))return N(j);x=setTimeout(k,E(j))}function N(j){return x=void 0,b&&c?_(j):(c=h=void 0,p)}function M(){x!==void 0&&clearTimeout(x),v=0,c=w=h=x=void 0}function B(){return x===void 0?p:N(e())}function A(){var j=e(),D=T(j);if(c=arguments,h=this,w=j,D){if(x===void 0)return R(w);if(y)return clearTimeout(x),x=setTimeout(k,l),_(w)}return x===void 0&&(x=setTimeout(k,l)),p}return A.cancel=M,A.flush=B,A}return xd=o,xd}var Yk=qk(),kl=Sl(Yk),bd=mr?mr.performance:null,mw=bd&&bd.now?function(){return bd.now()}:function(){return Date.now()},Xk=(function(){if(mr){if(mr.requestAnimationFrame)return function(t){mr.requestAnimationFrame(t)};if(mr.mozRequestAnimationFrame)return function(t){mr.mozRequestAnimationFrame(t)};if(mr.webkitRequestAnimationFrame)return function(t){mr.webkitRequestAnimationFrame(t)};if(mr.msRequestAnimationFrame)return function(t){mr.msRequestAnimationFrame(t)}}return function(t){t&&setTimeout(function(){t(mw())},1e3/60)}})(),kc=function(e){return Xk(e)},vi=mw,Da=9261,yw=65599,Ls=5381,xw=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Da,n=r,i;i=e.next(),!i.done;)n=n*yw+i.value|0;return n},ul=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Da;return r*yw+e|0},cl=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ls;return(r<<5)+r+e|0},Kk=function(e,r){return e*2097152+r},Hi=function(e){return e[0]*2097152+e[1]},Vu=function(e,r){return[ul(e[0],r[0]),cl(e[1],r[1])]},M0=function(e,r){var n={value:0,done:!1},i=0,s=e.length,o={next:function(){return i<s?n.value=e[i++]:n.done=!0,n}};return xw(o,r)},Oa=function(e,r){var n={value:0,done:!1},i=0,s=e.length,o={next:function(){return i<s?n.value=e.charCodeAt(i++):n.done=!0,n}};return xw(o,r)},bw=function(){return Qk(arguments)},Qk=function(e){for(var r,n=0;n<e.length;n++){var i=e[n];n===0?r=Oa(i):r=Oa(i,r)}return r};function Zk(t,e,r,n,i){var s=i*Math.PI/180,o=Math.cos(s)*(t-r)-Math.sin(s)*(e-n)+r,a=Math.sin(s)*(t-r)+Math.cos(s)*(e-n)+n;return{x:o,y:a}}var Jk=function(e,r,n,i,s,o){return{x:(e-n)*s+n,y:(r-i)*o+i}};function e3(t,e,r){if(r===0)return t;var n=(e.x1+e.x2)/2,i=(e.y1+e.y2)/2,s=e.w/e.h,o=1/s,a=Zk(t.x,t.y,n,i,r),l=Jk(a.x,a.y,n,i,s,o);return{x:l.x,y:l.y}}var P0=!0,t3=console.warn!=null,r3=console.trace!=null,Yv=Number.MAX_SAFE_INTEGER||9007199254740991,ww=function(){return!0},Tc=function(){return!1},I0=function(){return 0},Xv=function(){},Jt=function(e){throw new Error(e)},_w=function(e){if(e!==void 0)P0=!!e;else return P0},Bt=function(e){_w()&&(t3?console.warn(e):(console.log(e),r3&&console.trace()))},n3=function(e){return dt({},e)},Zn=function(e){return e==null?e:Ut(e)?e.slice():Dt(e)?n3(e):e},i3=function(e){return e.slice()},Sw=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},a3={},Cw=function(){return a3},Ar=function(e){var r=Object.keys(e);return function(n){for(var i={},s=0;s<r.length;s++){var o=r[s],a=n==null?void 0:n[o];i[o]=a===void 0?e[o]:a}return i}},Zi=function(e,r,n){for(var i=e.length-1;i>=0;i--)e[i]===r&&e.splice(i,1)},Kv=function(e){e.splice(0,e.length)},s3=function(e,r){for(var n=0;n<r.length;n++){var i=r[n];e.push(i)}},Yr=function(e,r,n){return n&&(r=hw(n,r)),e[r]},Qn=function(e,r,n,i){n&&(r=hw(n,r)),e[r]=i},o3=(function(){function t(){ia(this,t),this._obj={}}return aa(t,[{key:"set",value:function(r,n){return this._obj[r]=n,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]}}])})(),pi=typeof Map<"u"?Map:o3,l3="undefined",u3=(function(){function t(e){if(ia(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 n=0;n<r.length;n++)this.add(r[n])}}return aa(t,[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(r){var n=this._obj;n[r]!==1&&(n[r]=1,this.size++)}},{key:"delete",value:function(r){var n=this._obj;n[r]===1&&(n[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(n){return r.has(n)})}},{key:"forEach",value:function(r,n){return this.toArray().forEach(r,n)}}])})(),Gs=(typeof Set>"u"?"undefined":xr(Set))!==l3?Set:u3,$c=function(e,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||r===void 0||!$v(e)){Jt("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"){Jt("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 Gs,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,a=e.pan(),l=e.zoom();s.position={x:(o.x-a.x)/l,y:(o.y-a.y)/l}}var u=[];Ut(r.classes)?u=r.classes:ut(r.classes)&&(u=r.classes.split(/\s+/));for(var c=0,h=u.length;c<h;c++){var g=u[c];!g||g===""||s.classes.add(g)}this.createEmitter(),(n===void 0||n)&&this.restore();var p=r.style||r.css;p&&(Bt("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(p))},O0=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(n,i,s){var o;Dt(n)&&!mn(n)&&(o=n,n=o.roots||o.root,i=o.visit,s=o.directed),s=arguments.length===2&&!nr(i)?i:s,i=nr(i)?i:function(){};for(var a=this._private.cy,l=n=ut(n)?this.filter(n):n,u=[],c=[],h={},g={},p={},x=0,w,v=this.byGroup(),m=v.nodes,y=v.edges,b=0;b<l.length;b++){var _=l[b],R=_.id();_.isNode()&&(u.unshift(_),e.bfs&&(p[R]=!0,c.push(_)),g[R]=0)}for(var E=function(){var j=e.bfs?u.shift():u.pop(),D=j.id();if(e.dfs){if(p[D])return 0;p[D]=!0,c.push(j)}var I=g[D],U=h[D],W=U!=null?U.source():null,H=U!=null?U.target():null,z=U==null?void 0:j.same(W)?H[0]:W[0],P;if(P=i(j,U,z,x++,I),P===!0)return w=j,1;if(P===!1)return 1;for(var F=j.connectedEdges().filter(function(ne){return(!s||ne.source().same(j))&&y.has(ne)}),G=0;G<F.length;G++){var $=F[G],ee=$.connectedNodes().filter(function(ne){return!ne.same(j)&&m.has(ne)}),re=ee.id();ee.length!==0&&!p[re]&&(ee=ee[0],u.push(ee),e.bfs&&(p[re]=!0,c.push(ee)),h[re]=$,g[re]=g[D]+1)}},T;u.length!==0&&(T=E(),!(T!==0&&T===1)););for(var k=a.collection(),N=0;N<c.length;N++){var M=c[N],B=h[M.id()];B!=null&&k.push(B),k.push(M)}return{path:a.collection(k),found:a.collection(w)}}},hl={breadthFirstSearch:O0({bfs:!0}),depthFirstSearch:O0({dfs:!0})};hl.bfs=hl.breadthFirstSearch;hl.dfs=hl.depthFirstSearch;var lc={exports:{}},c3=lc.exports,B0;function h3(){return B0||(B0=1,(function(t,e){(function(){var r,n,i,s,o,a,l,u,c,h,g,p,x,w,v;i=Math.floor,h=Math.min,n=function(m,y){return m<y?-1:m>y?1:0},c=function(m,y,b,_,R){var E;if(b==null&&(b=0),R==null&&(R=n),b<0)throw new Error("lo must be non-negative");for(_==null&&(_=m.length);b<_;)E=i((b+_)/2),R(y,m[E])<0?_=E:b=E+1;return[].splice.apply(m,[b,b-b].concat(y)),y},a=function(m,y,b){return b==null&&(b=n),m.push(y),w(m,0,m.length-1,b)},o=function(m,y){var b,_;return y==null&&(y=n),b=m.pop(),m.length?(_=m[0],m[0]=b,v(m,0,y)):_=b,_},u=function(m,y,b){var _;return b==null&&(b=n),_=m[0],m[0]=y,v(m,0,b),_},l=function(m,y,b){var _;return b==null&&(b=n),m.length&&b(m[0],y)<0&&(_=[m[0],y],y=_[0],m[0]=_[1],v(m,0,b)),y},s=function(m,y){var b,_,R,E,T,k;for(y==null&&(y=n),E=(function(){k=[];for(var N=0,M=i(m.length/2);0<=M?N<M:N>M;0<=M?N++:N--)k.push(N);return k}).apply(this).reverse(),T=[],_=0,R=E.length;_<R;_++)b=E[_],T.push(v(m,b,y));return T},x=function(m,y,b){var _;if(b==null&&(b=n),_=m.indexOf(y),_!==-1)return w(m,0,_,b),v(m,_,b)},g=function(m,y,b){var _,R,E,T,k;if(b==null&&(b=n),R=m.slice(0,y),!R.length)return R;for(s(R,b),k=m.slice(y),E=0,T=k.length;E<T;E++)_=k[E],l(R,_,b);return R.sort(b).reverse()},p=function(m,y,b){var _,R,E,T,k,N,M,B,A;if(b==null&&(b=n),y*10<=m.length){if(E=m.slice(0,y).sort(b),!E.length)return E;for(R=E[E.length-1],M=m.slice(y),T=0,N=M.length;T<N;T++)_=M[T],b(_,R)<0&&(c(E,_,0,null,b),E.pop(),R=E[E.length-1]);return E}for(s(m,b),A=[],k=0,B=h(y,m.length);0<=B?k<B:k>B;0<=B?++k:--k)A.push(o(m,b));return A},w=function(m,y,b,_){var R,E,T;for(_==null&&(_=n),R=m[b];b>y;){if(T=b-1>>1,E=m[T],_(R,E)<0){m[b]=E,b=T;continue}break}return m[b]=R},v=function(m,y,b){var _,R,E,T,k;for(b==null&&(b=n),R=m.length,k=y,E=m[y],_=2*y+1;_<R;)T=_+1,T<R&&!(b(m[_],m[T])<0)&&(_=T),m[y]=m[_],y=_,_=2*y+1;return m[y]=E,w(m,k,y,b)},r=(function(){m.push=a,m.pop=o,m.replace=u,m.pushpop=l,m.heapify=s,m.updateItem=x,m.nlargest=g,m.nsmallest=p;function m(y){this.cmp=y??n,this.nodes=[]}return m.prototype.push=function(y){return a(this.nodes,y,this.cmp)},m.prototype.pop=function(){return o(this.nodes,this.cmp)},m.prototype.peek=function(){return this.nodes[0]},m.prototype.contains=function(y){return this.nodes.indexOf(y)!==-1},m.prototype.replace=function(y){return u(this.nodes,y,this.cmp)},m.prototype.pushpop=function(y){return l(this.nodes,y,this.cmp)},m.prototype.heapify=function(){return s(this.nodes,this.cmp)},m.prototype.updateItem=function(y){return x(this.nodes,y,this.cmp)},m.prototype.clear=function(){return this.nodes=[]},m.prototype.empty=function(){return this.nodes.length===0},m.prototype.size=function(){return this.nodes.length},m.prototype.clone=function(){var y;return y=new m,y.nodes=this.nodes.slice(0),y},m.prototype.toArray=function(){return this.nodes.slice(0)},m.prototype.insert=m.prototype.push,m.prototype.top=m.prototype.peek,m.prototype.front=m.prototype.peek,m.prototype.has=m.prototype.contains,m.prototype.copy=m.prototype.clone,m})(),(function(m,y){return t.exports=y()})(this,function(){return r})}).call(c3)})(lc)),lc.exports}var wd,F0;function f3(){return F0||(F0=1,wd=h3()),wd}var d3=f3(),Tl=Sl(d3),p3=Ar({root:null,weight:function(e){return 1},directed:!1}),v3={dijkstra:function(e){if(!Dt(e)){var r=arguments;e={root:r[0],weight:r[1],directed:r[2]}}var n=p3(e),i=n.root,s=n.weight,o=n.directed,a=this,l=s,u=ut(i)?this.filter(i)[0]:i[0],c={},h={},g={},p=this.byGroup(),x=p.nodes,w=p.edges;w.unmergeBy(function(I){return I.isLoop()});for(var v=function(U){return c[U.id()]},m=function(U,W){c[U.id()]=W,y.updateItem(U)},y=new Tl(function(I,U){return v(I)-v(U)}),b=0;b<x.length;b++){var _=x[b];c[_.id()]=_.same(u)?0:1/0,y.push(_)}for(var R=function(U,W){for(var H=(o?U.edgesTo(W):U.edgesWith(W)).intersect(w),z=1/0,P,F=0;F<H.length;F++){var G=H[F],$=l(G);($<z||!P)&&(z=$,P=G)}return{edge:P,dist:z}};y.size()>0;){var E=y.pop(),T=v(E),k=E.id();if(g[k]=T,T!==1/0)for(var N=E.neighborhood().intersect(x),M=0;M<N.length;M++){var B=N[M],A=B.id(),j=R(E,B),D=T+j.dist;D<v(B)&&(m(B,D),h[A]={node:E,edge:j.edge})}}return{distanceTo:function(U){var W=ut(U)?x.filter(U)[0]:U[0];return g[W.id()]},pathTo:function(U){var W=ut(U)?x.filter(U)[0]:U[0],H=[],z=W,P=z.id();if(W.length>0)for(H.unshift(W);h[P];){var F=h[P];H.unshift(F.edge),H.unshift(F.node),z=F.node,P=z.id()}return a.spawn(H)}}}},g3={kruskal:function(e){e=e||function(b){return 1};for(var r=this.byGroup(),n=r.nodes,i=r.edges,s=n.length,o=new Array(s),a=n,l=function(_){for(var R=0;R<o.length;R++){var E=o[R];if(E.has(_))return R}},u=0;u<s;u++)o[u]=this.spawn(n[u]);for(var c=i.sort(function(b,_){return e(b)-e(_)}),h=0;h<c.length;h++){var g=c[h],p=g.source()[0],x=g.target()[0],w=l(p),v=l(x),m=o[w],y=o[v];w!==v&&(a.merge(g),m.merge(y),o.splice(v,1))}return a}},m3=Ar({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),y3={aStar:function(e){var r=this.cy(),n=m3(e),i=n.root,s=n.goal,o=n.heuristic,a=n.directed,l=n.weight;i=r.collection(i)[0],s=r.collection(s)[0];var u=i.id(),c=s.id(),h={},g={},p={},x=new Tl(function(P,F){return g[P.id()]-g[F.id()]}),w=new Gs,v={},m={},y=function(F,G){x.push(F),w.add(G)},b,_,R=function(){b=x.pop(),_=b.id(),w.delete(_)},E=function(F){return w.has(F)};y(i,u),h[u]=0,g[u]=o(i);for(var T=0;x.size()>0;){if(R(),T++,_===c){for(var k=[],N=s,M=c,B=m[M];k.unshift(N),B!=null&&k.unshift(B),N=v[M],N!=null;)M=N.id(),B=m[M];return{found:!0,distance:h[_],path:this.spawn(k),steps:T}}p[_]=!0;for(var A=b._private.edges,j=0;j<A.length;j++){var D=A[j];if(this.hasElementWithId(D.id())&&!(a&&D.data("source")!==_)){var I=D.source(),U=D.target(),W=I.id()!==_?I:U,H=W.id();if(this.hasElementWithId(H)&&!p[H]){var z=h[_]+l(D);if(!E(H)){h[H]=z,g[H]=z+o(W),y(W,H),v[H]=b,m[H]=D;continue}z<h[H]&&(h[H]=z,g[H]=z+o(W),v[H]=b,m[H]=D)}}}}return{found:!1,distance:void 0,path:void 0,steps:T}}},x3=Ar({weight:function(e){return 1},directed:!1}),b3={floydWarshall:function(e){for(var r=this.cy(),n=x3(e),i=n.weight,s=n.directed,o=i,a=this.byGroup(),l=a.nodes,u=a.edges,c=l.length,h=c*c,g=function($){return l.indexOf($)},p=function($){return l[$]},x=new Array(h),w=0;w<h;w++){var v=w%c,m=(w-v)/c;m===v?x[w]=0:x[w]=1/0}for(var y=new Array(h),b=new Array(h),_=0;_<u.length;_++){var R=u[_],E=R.source()[0],T=R.target()[0];if(E!==T){var k=g(E),N=g(T),M=k*c+N,B=o(R);if(x[M]>B&&(x[M]=B,y[M]=N,b[M]=R),!s){var A=N*c+k;!s&&x[A]>B&&(x[A]=B,y[A]=k,b[A]=R)}}}for(var j=0;j<c;j++)for(var D=0;D<c;D++)for(var I=D*c+j,U=0;U<c;U++){var W=D*c+U,H=j*c+U;x[I]+x[H]<x[W]&&(x[W]=x[I]+x[H],y[W]=y[I])}var z=function($){return(ut($)?r.filter($):$)[0]},P=function($){return g(z($))},F={distance:function($,ee){var re=P($),ne=P(ee);return x[re*c+ne]},path:function($,ee){var re=P($),ne=P(ee),Y=p(re);if(re===ne)return Y.collection();if(y[re*c+ne]==null)return r.collection();var q=r.collection(),K=re,X;for(q.merge(Y);re!==ne;)K=re,re=y[re*c+ne],X=b[K*c+re],q.merge(X),q.merge(p(re));return q}};return F}},w3=Ar({weight:function(e){return 1},directed:!1,root:null}),_3={bellmanFord:function(e){var r=this,n=w3(e),i=n.weight,s=n.directed,o=n.root,a=i,l=this,u=this.cy(),c=this.byGroup(),h=c.edges,g=c.nodes,p=g.length,x=new pi,w=!1,v=[];o=u.collection(o)[0],h.unmergeBy(function(_e){return _e.isLoop()});for(var m=h.length,y=function(ke){var Ne=x.get(ke.id());return Ne||(Ne={},x.set(ke.id(),Ne)),Ne},b=function(ke){return(ut(ke)?u.$(ke):ke)[0]},_=function(ke){return y(b(ke)).dist},R=function(ke){for(var Ne=arguments.length>1&&arguments[1]!==void 0?arguments[1]:o,Ee=b(ke),Me=[],Pe=Ee;;){if(Pe==null)return r.spawn();var De=y(Pe),Ue=De.edge,Ye=De.pred;if(Me.unshift(Pe[0]),Pe.same(Ne)&&Me.length>0)break;Ue!=null&&Me.unshift(Ue),Pe=Ye}return l.spawn(Me)},E=0;E<p;E++){var T=g[E],k=y(T);T.same(o)?k.dist=0:k.dist=1/0,k.pred=null,k.edge=null}for(var N=!1,M=function(ke,Ne,Ee,Me,Pe,De){var Ue=Me.dist+De;Ue<Pe.dist&&!Ee.same(Me.edge)&&(Pe.dist=Ue,Pe.pred=ke,Pe.edge=Ee,N=!0)},B=1;B<p;B++){N=!1;for(var A=0;A<m;A++){var j=h[A],D=j.source(),I=j.target(),U=a(j),W=y(D),H=y(I);M(D,I,j,W,H,U),s||M(I,D,j,H,W,U)}if(!N)break}if(N)for(var z=[],P=0;P<m;P++){var F=h[P],G=F.source(),$=F.target(),ee=a(F),re=y(G).dist,ne=y($).dist;if(re+ee<ne||!s&&ne+ee<re)if(w||(Bt("Graph contains a negative weight cycle for Bellman-Ford"),w=!0),e.findNegativeWeightCycles!==!1){var Y=[];re+ee<ne&&Y.push(G),!s&&ne+ee<re&&Y.push($);for(var q=Y.length,K=0;K<q;K++){var X=Y[K],J=[X];J.push(y(X).edge);for(var ie=y(X).pred;J.indexOf(ie)===-1;)J.push(ie),J.push(y(ie).edge),ie=y(ie).pred;J=J.slice(J.indexOf(ie));for(var ce=J[0].id(),de=0,Le=2;Le<J.length;Le+=2)J[Le].id()<ce&&(ce=J[Le].id(),de=Le);J=J.slice(de).concat(J.slice(0,de)),J.push(J[0]);var je=J.map(function(_e){return _e.id()}).join(",");z.indexOf(je)===-1&&(v.push(l.spawn(J)),z.push(je))}}else break}return{distanceTo:_,pathTo:R,hasNegativeWeightCycle:w,negativeWeightCycles:v}}},S3=Math.sqrt(2),C3=function(e,r,n){n.length===0&&Jt("Karger-Stein must be run on a connected (sub)graph");for(var i=n[e],s=i[1],o=i[2],a=r[s],l=r[o],u=n,c=u.length-1;c>=0;c--){var h=u[c],g=h[1],p=h[2];(r[g]===a&&r[p]===l||r[g]===l&&r[p]===a)&&u.splice(c,1)}for(var x=0;x<u.length;x++){var w=u[x];w[1]===l?(u[x]=w.slice(),u[x][1]=a):w[2]===l&&(u[x]=w.slice(),u[x][2]=a)}for(var v=0;v<r.length;v++)r[v]===l&&(r[v]=a);return u},_d=function(e,r,n,i){for(;n>i;){var s=Math.floor(Math.random()*r.length);r=C3(s,e,r),n--}return r},E3={kargerStein:function(){var e=this,r=this.byGroup(),n=r.nodes,i=r.edges;i.unmergeBy(function(H){return H.isLoop()});var s=n.length,o=i.length,a=Math.ceil(Math.pow(Math.log(s)/Math.LN2,2)),l=Math.floor(s/S3);if(s<2){Jt("At least 2 nodes are required for Karger-Stein algorithm");return}for(var u=[],c=0;c<o;c++){var h=i[c];u.push([c,n.indexOf(h.source()),n.indexOf(h.target())])}for(var g=1/0,p=[],x=new Array(s),w=new Array(s),v=new Array(s),m=function(z,P){for(var F=0;F<s;F++)P[F]=z[F]},y=0;y<=a;y++){for(var b=0;b<s;b++)w[b]=b;var _=_d(w,u.slice(),s,l),R=_.slice();m(w,v);var E=_d(w,_,l,2),T=_d(v,R,l,2);E.length<=T.length&&E.length<g?(g=E.length,p=E,m(w,x)):T.length<=E.length&&T.length<g&&(g=T.length,p=T,m(v,x))}for(var k=this.spawn(p.map(function(H){return i[H[0]]})),N=this.spawn(),M=this.spawn(),B=x[0],A=0;A<x.length;A++){var j=x[A],D=n[A];j===B?N.merge(D):M.merge(D)}var I=function(z){var P=e.spawn();return z.forEach(function(F){P.merge(F),F.connectedEdges().forEach(function(G){e.contains(G)&&!k.contains(G)&&P.merge(G)})}),P},U=[I(N),I(M)],W={cut:k,components:U,partition1:N,partition2:M};return W}},Sd,k3=function(e){return{x:e.x,y:e.y}},Gc=function(e,r,n){return{x:e.x*r+n.x,y:e.y*r+n.y}},Ew=function(e,r,n){return{x:(e.x-n.x)/r,y:(e.y-n.y)/r}},As=function(e){return{x:e[0],y:e[1]}},T3=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,i=1/0,s=r;s<n;s++){var o=e[s];isFinite(o)&&(i=Math.min(o,i))}return i},R3=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,i=-1/0,s=r;s<n;s++){var o=e[s];isFinite(o)&&(i=Math.max(o,i))}return i},L3=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,i=0,s=0,o=r;o<n;o++){var a=e[o];isFinite(a)&&(i+=a,s++)}return i/s},N3=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=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,n):(n<e.length&&e.splice(n,e.length-n),r>0&&e.splice(0,r));for(var a=0,l=e.length-1;l>=0;l--){var u=e[l];o?isFinite(u)||(e[l]=-1/0,a++):e.splice(l,1)}s&&e.sort(function(g,p){return g-p});var c=e.length,h=Math.floor(c/2);return c%2!==0?e[h+1+a]:(e[h-1+a]+e[h+a])/2},D3=function(e){return Math.PI*e/180},$u=function(e,r){return Math.atan2(r,e)-Math.PI/2},Qv=Math.log2||function(t){return Math.log(t)/Math.log(2)},Zv=function(e){return e>0?1:e<0?-1:0},Ba=function(e,r){return Math.sqrt(Ra(e,r))},Ra=function(e,r){var n=r.x-e.x,i=r.y-e.y;return n*n+i*i},A3=function(e){for(var r=e.length,n=0,i=0;i<r;i++)n+=e[i];for(var s=0;s<r;s++)e[s]=e[s]/n;return e},Cr=function(e,r,n,i){return(1-i)*(1-i)*e+2*(1-i)*i*r+i*i*n},Is=function(e,r,n,i){return{x:Cr(e.x,r.x,n.x,i),y:Cr(e.y,r.y,n.y,i)}},M3=function(e,r,n,i){var s={x:r.x-e.x,y:r.y-e.y},o=Ba(e,r),a={x:s.x/o,y:s.y/o};return n=n??0,i=i??n*o,{x:e.x+a.x*i,y:e.y+a.y*i}},fl=function(e,r,n){return Math.max(e,Math.min(n,r))},Kr=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}}},P3=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},I3=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},O3=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},kw=function(e,r,n){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,n),e.y2=Math.max(e.y2,n),e.h=e.y2-e.y1},uc=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},cc=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],n,i,s,o;if(r.length===1)n=i=s=o=r[0];else if(r.length===2)n=s=r[0],o=i=r[1];else if(r.length===4){var a=pr(r,4);n=a[0],i=a[1],s=a[2],o=a[3]}return e.x1-=o,e.x2+=i,e.y1-=n,e.y2+=s,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},j0=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},Jv=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)},qi=function(e,r,n){return e.x1<=r&&r<=e.x2&&e.y1<=n&&n<=e.y2},z0=function(e,r){return qi(e,r.x,r.y)},Tw=function(e,r){return qi(e,r.x1,r.y1)&&qi(e,r.x2,r.y2)},B3=(Sd=Math.hypot)!==null&&Sd!==void 0?Sd:function(t,e){return Math.sqrt(t*t+e*e)};function F3(t,e){if(t.length<3)throw new Error("Need at least 3 vertices");var r=function(k,N){return{x:k.x+N.x,y:k.y+N.y}},n=function(k,N){return{x:k.x-N.x,y:k.y-N.y}},i=function(k,N){return{x:k.x*N,y:k.y*N}},s=function(k,N){return k.x*N.y-k.y*N.x},o=function(k){var N=B3(k.x,k.y);return N===0?{x:0,y:0}:{x:k.x/N,y:k.y/N}},a=function(k){for(var N=0,M=0;M<k.length;M++){var B=k[M],A=k[(M+1)%k.length];N+=B.x*A.y-A.x*B.y}return N/2},l=function(k,N,M,B){var A=n(N,k),j=n(B,M),D=s(A,j);if(Math.abs(D)<1e-9)return r(k,i(A,.5));var I=s(n(M,k),j)/D;return r(k,i(A,I))},u=t.map(function(T){return{x:T.x,y:T.y}});a(u)<0&&u.reverse();for(var c=u.length,h=[],g=0;g<c;g++){var p=u[g],x=u[(g+1)%c],w=n(x,p),v=o({x:w.y,y:-w.x});h.push(v)}for(var m=h.map(function(T,k){var N=r(u[k],i(T,e)),M=r(u[(k+1)%c],i(T,e));return{p1:N,p2:M}}),y=[],b=0;b<c;b++){var _=m[(b-1+c)%c],R=m[b],E=l(_.p1,_.p2,R.p1,R.p2);y.push(E)}return y}function j3(t,e,r,n,i,s){var o=Y3(t,e,r,n,i),a=F3(o,s),l=Kr();return a.forEach(function(u){return kw(l,u.x,u.y)}),l}var Rw=function(e,r,n,i,s,o,a){var l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:"auto",u=l==="auto"?Ji(s,o):l,c=s/2,h=o/2;u=Math.min(u,c,h);var g=u!==c,p=u!==h,x;if(g){var w=n-c+u-a,v=i-h-a,m=n+c-u+a,y=v;if(x=Yi(e,r,n,i,w,v,m,y,!1),x.length>0)return x}if(p){var b=n+c+a,_=i-h+u-a,R=b,E=i+h-u+a;if(x=Yi(e,r,n,i,b,_,R,E,!1),x.length>0)return x}if(g){var T=n-c+u-a,k=i+h+a,N=n+c-u+a,M=k;if(x=Yi(e,r,n,i,T,k,N,M,!1),x.length>0)return x}if(p){var B=n-c-a,A=i-h+u-a,j=B,D=i+h-u+a;if(x=Yi(e,r,n,i,B,A,j,D,!1),x.length>0)return x}var I;{var U=n-c+u,W=i-h+u;if(I=Zo(e,r,n,i,U,W,u+a),I.length>0&&I[0]<=U&&I[1]<=W)return[I[0],I[1]]}{var H=n+c-u,z=i-h+u;if(I=Zo(e,r,n,i,H,z,u+a),I.length>0&&I[0]>=H&&I[1]<=z)return[I[0],I[1]]}{var P=n+c-u,F=i+h-u;if(I=Zo(e,r,n,i,P,F,u+a),I.length>0&&I[0]>=P&&I[1]>=F)return[I[0],I[1]]}{var G=n-c+u,$=i+h-u;if(I=Zo(e,r,n,i,G,$,u+a),I.length>0&&I[0]<=G&&I[1]>=$)return[I[0],I[1]]}return[]},z3=function(e,r,n,i,s,o,a){var l=a,u=Math.min(n,s),c=Math.max(n,s),h=Math.min(i,o),g=Math.max(i,o);return u-l<=e&&e<=c+l&&h-l<=r&&r<=g+l},H3=function(e,r,n,i,s,o,a,l,u){var c={x1:Math.min(n,a,s)-u,x2:Math.max(n,a,s)+u,y1:Math.min(i,l,o)-u,y2:Math.max(i,l,o)+u};return!(e<c.x1||e>c.x2||r<c.y1||r>c.y2)},U3=function(e,r,n,i){n-=i;var s=r*r-4*e*n;if(s<0)return[];var o=Math.sqrt(s),a=2*e,l=(-r+o)/a,u=(-r-o)/a;return[l,u]},W3=function(e,r,n,i,s){var o=1e-5;e===0&&(e=o),r/=e,n/=e,i/=e;var a,l,u,c,h,g,p,x;if(l=(3*n-r*r)/9,u=-(27*i)+r*(9*n-2*(r*r)),u/=54,a=l*l*l+u*u,s[1]=0,p=r/3,a>0){h=u+Math.sqrt(a),h=h<0?-Math.pow(-h,1/3):Math.pow(h,1/3),g=u-Math.sqrt(a),g=g<0?-Math.pow(-g,1/3):Math.pow(g,1/3),s[0]=-p+h+g,p+=(h+g)/2,s[4]=s[2]=-p,p=Math.sqrt(3)*(-g+h)/2,s[3]=p,s[5]=-p;return}if(s[5]=s[3]=0,a===0){x=u<0?-Math.pow(-u,1/3):Math.pow(u,1/3),s[0]=-p+2*x,s[4]=s[2]=-(x+p);return}l=-l,c=l*l*l,c=Math.acos(u/Math.sqrt(c)),x=2*Math.sqrt(l),s[0]=-p+x*Math.cos(c/3),s[2]=-p+x*Math.cos((c+2*Math.PI)/3),s[4]=-p+x*Math.cos((c+4*Math.PI)/3)},V3=function(e,r,n,i,s,o,a,l){var u=1*n*n-4*n*s+2*n*a+4*s*s-4*s*a+a*a+i*i-4*i*o+2*i*l+4*o*o-4*o*l+l*l,c=9*n*s-3*n*n-3*n*a-6*s*s+3*s*a+9*i*o-3*i*i-3*i*l-6*o*o+3*o*l,h=3*n*n-6*n*s+n*a-n*e+2*s*s+2*s*e-a*e+3*i*i-6*i*o+i*l-i*r+2*o*o+2*o*r-l*r,g=1*n*s-n*n+n*e-s*e+i*o-i*i+i*r-o*r,p=[];W3(u,c,h,g,p);for(var x=1e-7,w=[],v=0;v<6;v+=2)Math.abs(p[v+1])<x&&p[v]>=0&&p[v]<=1&&w.push(p[v]);w.push(1),w.push(0);for(var m=-1,y,b,_,R=0;R<w.length;R++)y=Math.pow(1-w[R],2)*n+2*(1-w[R])*w[R]*s+w[R]*w[R]*a,b=Math.pow(1-w[R],2)*i+2*(1-w[R])*w[R]*o+w[R]*w[R]*l,_=Math.pow(y-e,2)+Math.pow(b-r,2),m>=0?_<m&&(m=_):m=_;return m},$3=function(e,r,n,i,s,o){var a=[e-n,r-i],l=[s-n,o-i],u=l[0]*l[0]+l[1]*l[1],c=a[0]*a[0]+a[1]*a[1],h=a[0]*l[0]+a[1]*l[1],g=h*h/u;return h<0?c:g>u?(e-s)*(e-s)+(r-o)*(r-o):c-g},sn=function(e,r,n){for(var i,s,o,a,l,u=0,c=0;c<n.length/2;c++)if(i=n[c*2],s=n[c*2+1],c+1<n.length/2?(o=n[(c+1)*2],a=n[(c+1)*2+1]):(o=n[(c+1-n.length/2)*2],a=n[(c+1-n.length/2)*2+1]),!(i==e&&o==e))if(i>=e&&e>=o||i<=e&&e<=o)l=(e-i)/(o-i)*(a-s)+s,l>r&&u++;else continue;return u%2!==0},gi=function(e,r,n,i,s,o,a,l,u){var c=new Array(n.length),h;l[0]!=null?(h=Math.atan(l[1]/l[0]),l[0]<0?h=h+Math.PI/2:h=-h-Math.PI/2):h=l;for(var g=Math.cos(-h),p=Math.sin(-h),x=0;x<c.length/2;x++)c[x*2]=o/2*(n[x*2]*g-n[x*2+1]*p),c[x*2+1]=a/2*(n[x*2+1]*g+n[x*2]*p),c[x*2]+=i,c[x*2+1]+=s;var w;if(u>0){var v=Lc(c,-u);w=Rc(v)}else w=c;return sn(e,r,w)},G3=function(e,r,n,i,s,o,a,l){for(var u=new Array(n.length*2),c=0;c<l.length;c++){var h=l[c];u[c*4+0]=h.startX,u[c*4+1]=h.startY,u[c*4+2]=h.stopX,u[c*4+3]=h.stopY;var g=Math.pow(h.cx-e,2)+Math.pow(h.cy-r,2);if(g<=Math.pow(h.radius,2))return!0}return sn(e,r,u)},Rc=function(e){for(var r=new Array(e.length/2),n,i,s,o,a,l,u,c,h=0;h<e.length/4;h++){n=e[h*4],i=e[h*4+1],s=e[h*4+2],o=e[h*4+3],h<e.length/4-1?(a=e[(h+1)*4],l=e[(h+1)*4+1],u=e[(h+1)*4+2],c=e[(h+1)*4+3]):(a=e[0],l=e[1],u=e[2],c=e[3]);var g=Yi(n,i,s,o,a,l,u,c,!0);r[h*2]=g[0],r[h*2+1]=g[1]}return r},Lc=function(e,r){for(var n=new Array(e.length*2),i,s,o,a,l=0;l<e.length/2;l++){i=e[l*2],s=e[l*2+1],l<e.length/2-1?(o=e[(l+1)*2],a=e[(l+1)*2+1]):(o=e[0],a=e[1]);var u=a-s,c=-(o-i),h=Math.sqrt(u*u+c*c),g=u/h,p=c/h;n[l*4]=i+g*r,n[l*4+1]=s+p*r,n[l*4+2]=o+g*r,n[l*4+3]=a+p*r}return n},q3=function(e,r,n,i,s,o){var a=n-e,l=i-r;a/=s,l/=o;var u=Math.sqrt(a*a+l*l),c=u-1;if(c<0)return[];var h=c/u;return[(n-e)*h+e,(i-r)*h+r]},Ma=function(e,r,n,i,s,o,a){return e-=s,r-=o,e/=n/2+a,r/=i/2+a,e*e+r*r<=1},Zo=function(e,r,n,i,s,o,a){var l=[n-e,i-r],u=[e-s,r-o],c=l[0]*l[0]+l[1]*l[1],h=2*(u[0]*l[0]+u[1]*l[1]),g=u[0]*u[0]+u[1]*u[1]-a*a,p=h*h-4*c*g;if(p<0)return[];var x=(-h+Math.sqrt(p))/(2*c),w=(-h-Math.sqrt(p))/(2*c),v=Math.min(x,w),m=Math.max(x,w),y=[];if(v>=0&&v<=1&&y.push(v),m>=0&&m<=1&&y.push(m),y.length===0)return[];var b=y[0]*l[0]+e,_=y[0]*l[1]+r;if(y.length>1){if(y[0]==y[1])return[b,_];var R=y[1]*l[0]+e,E=y[1]*l[1]+r;return[b,_,R,E]}else return[b,_]},Cd=function(e,r,n){return r<=e&&e<=n||n<=e&&e<=r?e:e<=r&&r<=n||n<=r&&r<=e?r:n},Yi=function(e,r,n,i,s,o,a,l,u){var c=e-s,h=n-e,g=a-s,p=r-o,x=i-r,w=l-o,v=g*p-w*c,m=h*p-x*c,y=w*h-g*x;if(y!==0){var b=v/y,_=m/y,R=.001,E=0-R,T=1+R;return E<=b&&b<=T&&E<=_&&_<=T?[e+b*h,r+b*x]:u?[e+b*h,r+b*x]:[]}else return v===0||m===0?Cd(e,n,a)===a?[a,l]:Cd(e,n,s)===s?[s,o]:Cd(s,a,n)===n?[n,i]:[]:[]},Y3=function(e,r,n,i,s){var o=[],a=i/2,l=s/2,u=r,c=n;o.push({x:u+a*e[0],y:c+l*e[1]});for(var h=1;h<e.length/2;h++)o.push({x:u+a*e[h*2],y:c+l*e[h*2+1]});return o},dl=function(e,r,n,i,s,o,a,l){var u=[],c,h=new Array(n.length),g=!0;o==null&&(g=!1);var p;if(g){for(var x=0;x<h.length/2;x++)h[x*2]=n[x*2]*o+i,h[x*2+1]=n[x*2+1]*a+s;if(l>0){var w=Lc(h,-l);p=Rc(w)}else p=h}else p=n;for(var v,m,y,b,_=0;_<p.length/2;_++)v=p[_*2],m=p[_*2+1],_<p.length/2-1?(y=p[(_+1)*2],b=p[(_+1)*2+1]):(y=p[0],b=p[1]),c=Yi(e,r,i,s,v,m,y,b),c.length!==0&&u.push(c[0],c[1]);return u},X3=function(e,r,n,i,s,o,a,l,u){var c=[],h,g=new Array(n.length*2);u.forEach(function(y,b){b===0?(g[g.length-2]=y.startX,g[g.length-1]=y.startY):(g[b*4-2]=y.startX,g[b*4-1]=y.startY),g[b*4]=y.stopX,g[b*4+1]=y.stopY,h=Zo(e,r,i,s,y.cx,y.cy,y.radius),h.length!==0&&c.push(h[0],h[1])});for(var p=0;p<g.length/4;p++)h=Yi(e,r,i,s,g[p*4],g[p*4+1],g[p*4+2],g[p*4+3],!1),h.length!==0&&c.push(h[0],h[1]);if(c.length>2){for(var x=[c[0],c[1]],w=Math.pow(x[0]-e,2)+Math.pow(x[1]-r,2),v=1;v<c.length/2;v++){var m=Math.pow(c[v*2]-e,2)+Math.pow(c[v*2+1]-r,2);m<=w&&(x[0]=c[v*2],x[1]=c[v*2+1],w=m)}return x}return c},Gu=function(e,r,n){var i=[e[0]-r[0],e[1]-r[1]],s=Math.sqrt(i[0]*i[0]+i[1]*i[1]),o=(s-n)/s;return o<0&&(o=1e-5),[r[0]+o*i[0],r[1]+o*i[1]]},qr=function(e,r){var n=uv(e,r);return n=Lw(n),n},Lw=function(e){for(var r,n,i=e.length/2,s=1/0,o=1/0,a=-1/0,l=-1/0,u=0;u<i;u++)r=e[2*u],n=e[2*u+1],s=Math.min(s,r),a=Math.max(a,r),o=Math.min(o,n),l=Math.max(l,n);for(var c=2/(a-s),h=2/(l-o),g=0;g<i;g++)r=e[2*g]=e[2*g]*c,n=e[2*g+1]=e[2*g+1]*h,s=Math.min(s,r),a=Math.max(a,r),o=Math.min(o,n),l=Math.max(l,n);if(o<-1)for(var p=0;p<i;p++)n=e[2*p+1]=e[2*p+1]+(-1-o);return e},uv=function(e,r){var n=1/e*2*Math.PI,i=e%2===0?Math.PI/2+n/2:Math.PI/2;i+=r;for(var s=new Array(e*2),o,a=0;a<e;a++)o=a*n+i,s[2*a]=Math.cos(o),s[2*a+1]=Math.sin(-o);return s},Ji=function(e,r){return Math.min(e/4,r/4,8)},Nw=function(e,r){return Math.min(e/10,r/10,8)},eg=function(){return 8},K3=function(e,r,n){return[e-2*r+n,2*(r-e),e]},cv=function(e,r){return{heightOffset:Math.min(15,.05*r),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}};function Ed(t,e){function r(h){for(var g=[],p=0;p<h.length;p++){var x=h[p],w=h[(p+1)%h.length],v={x:w.x-x.x,y:w.y-x.y},m={x:-v.y,y:v.x},y=Math.sqrt(m.x*m.x+m.y*m.y);g.push({x:m.x/y,y:m.y/y})}return g}function n(h,g){var p=1/0,x=-1/0,w=on(h),v;try{for(w.s();!(v=w.n()).done;){var m=v.value,y=m.x*g.x+m.y*g.y;p=Math.min(p,y),x=Math.max(x,y)}}catch(b){w.e(b)}finally{w.f()}return{min:p,max:x}}function i(h,g){return!(h.max<g.min||g.max<h.min)}var s=[].concat(Cc(r(t)),Cc(r(e))),o=on(s),a;try{for(o.s();!(a=o.n()).done;){var l=a.value,u=n(t,l),c=n(e,l);if(!i(u,c))return!1}}catch(h){o.e(h)}finally{o.f()}return!0}var Q3=Ar({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),Z3={pageRank:function(e){for(var r=Q3(e),n=r.dampingFactor,i=r.precision,s=r.iterations,o=r.weight,a=this._private.cy,l=this.byGroup(),u=l.nodes,c=l.edges,h=u.length,g=h*h,p=c.length,x=new Array(g),w=new Array(h),v=(1-n)/h,m=0;m<h;m++){for(var y=0;y<h;y++){var b=m*h+y;x[b]=0}w[m]=0}for(var _=0;_<p;_++){var R=c[_],E=R.data("source"),T=R.data("target");if(E!==T){var k=u.indexOfId(E),N=u.indexOfId(T),M=o(R),B=N*h+k;x[B]+=M,w[k]+=M}}for(var A=1/h+v,j=0;j<h;j++)if(w[j]===0)for(var D=0;D<h;D++){var I=D*h+j;x[I]=A}else for(var U=0;U<h;U++){var W=U*h+j;x[W]=x[W]/w[j]+v}for(var H=new Array(h),z=new Array(h),P,F=0;F<h;F++)H[F]=1;for(var G=0;G<s;G++){for(var $=0;$<h;$++)z[$]=0;for(var ee=0;ee<h;ee++)for(var re=0;re<h;re++){var ne=ee*h+re;z[ee]+=x[ne]*H[re]}A3(z),P=H,H=z,z=P;for(var Y=0,q=0;q<h;q++){var K=P[q]-H[q];Y+=K*K}if(Y<i)break}var X={rank:function(ie){return ie=a.collection(ie)[0],H[u.indexOf(ie)]}};return X}},H0=Ar({root:null,weight:function(e){return 1},directed:!1,alpha:0}),Os={degreeCentralityNormalized:function(e){e=H0(e);var r=this.cy(),n=this.nodes(),i=n.length;if(e.directed){for(var c={},h={},g=0,p=0,x=0;x<i;x++){var w=n[x],v=w.id();e.root=w;var m=this.degreeCentrality(e);g<m.indegree&&(g=m.indegree),p<m.outdegree&&(p=m.outdegree),c[v]=m.indegree,h[v]=m.outdegree}return{indegree:function(b){return g==0?0:(ut(b)&&(b=r.filter(b)),c[b.id()]/g)},outdegree:function(b){return p===0?0:(ut(b)&&(b=r.filter(b)),h[b.id()]/p)}}}else{for(var s={},o=0,a=0;a<i;a++){var l=n[a];e.root=l;var u=this.degreeCentrality(e);o<u.degree&&(o=u.degree),s[l.id()]=u.degree}return{degree:function(b){return o===0?0:(ut(b)&&(b=r.filter(b)),s[b.id()]/o)}}}},degreeCentrality:function(e){e=H0(e);var r=this.cy(),n=this,i=e,s=i.root,o=i.weight,a=i.directed,l=i.alpha;if(s=r.collection(s)[0],a){for(var p=s.connectedEdges(),x=p.filter(function(E){return E.target().same(s)&&n.has(E)}),w=p.filter(function(E){return E.source().same(s)&&n.has(E)}),v=x.length,m=w.length,y=0,b=0,_=0;_<x.length;_++)y+=o(x[_]);for(var R=0;R<w.length;R++)b+=o(w[R]);return{indegree:Math.pow(v,1-l)*Math.pow(y,l),outdegree:Math.pow(m,1-l)*Math.pow(b,l)}}else{for(var u=s.connectedEdges().intersection(n),c=u.length,h=0,g=0;g<u.length;g++)h+=o(u[g]);return{degree:Math.pow(c,1-l)*Math.pow(h,l)}}}};Os.dc=Os.degreeCentrality;Os.dcn=Os.degreeCentralityNormalised=Os.degreeCentralityNormalized;var U0=Ar({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),Bs={closenessCentralityNormalized:function(e){for(var r=U0(e),n=r.harmonic,i=r.weight,s=r.directed,o=this.cy(),a={},l=0,u=this.nodes(),c=this.floydWarshall({weight:i,directed:s}),h=0;h<u.length;h++){for(var g=0,p=u[h],x=0;x<u.length;x++)if(h!==x){var w=c.distance(p,u[x]);n?g+=1/w:g+=w}n||(g=1/g),l<g&&(l=g),a[p.id()]=g}return{closeness:function(m){return l==0?0:(ut(m)?m=o.filter(m)[0].id():m=m.id(),a[m]/l)}}},closenessCentrality:function(e){var r=U0(e),n=r.root,i=r.weight,s=r.directed,o=r.harmonic;n=this.filter(n)[0];for(var a=this.dijkstra({root:n,weight:i,directed:s}),l=0,u=this.nodes(),c=0;c<u.length;c++){var h=u[c];if(!h.same(n)){var g=a.distanceTo(h);o?l+=1/g:l+=g}}return o?l:1/l}};Bs.cc=Bs.closenessCentrality;Bs.ccn=Bs.closenessCentralityNormalised=Bs.closenessCentralityNormalized;var J3=Ar({weight:null,directed:!1}),hv={betweennessCentrality:function(e){for(var r=J3(e),n=r.directed,i=r.weight,s=i!=null,o=this.cy(),a=this.nodes(),l={},u={},c=0,h={set:function(b,_){u[b]=_,_>c&&(c=_)},get:function(b){return u[b]}},g=0;g<a.length;g++){var p=a[g],x=p.id();n?l[x]=p.outgoers().nodes():l[x]=p.openNeighborhood().nodes(),h.set(x,0)}for(var w=function(){for(var b=a[v].id(),_=[],R={},E={},T={},k=new Tl(function(ee,re){return T[ee]-T[re]}),N=0;N<a.length;N++){var M=a[N].id();R[M]=[],E[M]=0,T[M]=1/0}for(E[b]=1,T[b]=0,k.push(b);!k.empty();){var B=k.pop();if(_.push(B),s)for(var A=0;A<l[B].length;A++){var j=l[B][A],D=o.getElementById(B),I=void 0;D.edgesTo(j).length>0?I=D.edgesTo(j)[0]:I=j.edgesTo(D)[0];var U=i(I);j=j.id(),T[j]>T[B]+U&&(T[j]=T[B]+U,k.nodes.indexOf(j)<0?k.push(j):k.updateItem(j),E[j]=0,R[j]=[]),T[j]==T[B]+U&&(E[j]=E[j]+E[B],R[j].push(B))}else for(var W=0;W<l[B].length;W++){var H=l[B][W].id();T[H]==1/0&&(k.push(H),T[H]=T[B]+1),T[H]==T[B]+1&&(E[H]=E[H]+E[B],R[H].push(B))}}for(var z={},P=0;P<a.length;P++)z[a[P].id()]=0;for(;_.length>0;){for(var F=_.pop(),G=0;G<R[F].length;G++){var $=R[F][G];z[$]=z[$]+E[$]/E[F]*(1+z[F])}F!=a[v].id()&&h.set(F,h.get(F)+z[F])}},v=0;v<a.length;v++)w();var m={betweenness:function(b){var _=o.collection(b).id();return h.get(_)},betweennessNormalized:function(b){if(c==0)return 0;var _=o.collection(b).id();return h.get(_)/c}};return m.betweennessNormalised=m.betweennessNormalized,m}};hv.bc=hv.betweennessCentrality;var eT=Ar({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(t){return 1}]}),tT=function(e){return eT(e)},rT=function(e,r){for(var n=0,i=0;i<r.length;i++)n+=r[i](e);return n},nT=function(e,r,n){for(var i=0;i<r;i++)e[i*r+i]=n},Dw=function(e,r){for(var n,i=0;i<r;i++){n=0;for(var s=0;s<r;s++)n+=e[s*r+i];for(var o=0;o<r;o++)e[o*r+i]=e[o*r+i]/n}},iT=function(e,r,n){for(var i=new Array(n*n),s=0;s<n;s++){for(var o=0;o<n;o++)i[s*n+o]=0;for(var a=0;a<n;a++)for(var l=0;l<n;l++)i[s*n+l]+=e[s*n+a]*r[a*n+l]}return i},aT=function(e,r,n){for(var i=e.slice(0),s=1;s<n;s++)e=iT(e,i,r);return e},sT=function(e,r,n){for(var i=new Array(r*r),s=0;s<r*r;s++)i[s]=Math.pow(e[s],n);return Dw(i,r),i},oT=function(e,r,n,i){for(var s=0;s<n;s++){var o=Math.round(e[s]*Math.pow(10,i))/Math.pow(10,i),a=Math.round(r[s]*Math.pow(10,i))/Math.pow(10,i);if(o!==a)return!1}return!0},lT=function(e,r,n,i){for(var s=[],o=0;o<r;o++){for(var a=[],l=0;l<r;l++)Math.round(e[o*r+l]*1e3)/1e3>0&&a.push(n[l]);a.length!==0&&s.push(i.collection(a))}return s},uT=function(e,r){for(var n=0;n<e.length;n++)if(!r[n]||e[n].id()!==r[n].id())return!1;return!0},cT=function(e){for(var r=0;r<e.length;r++)for(var n=0;n<e.length;n++)r!=n&&uT(e[r],e[n])&&e.splice(n,1);return e},W0=function(e){for(var r=this.nodes(),n=this.edges(),i=this.cy(),s=tT(e),o={},a=0;a<r.length;a++)o[r[a].id()]=a;for(var l=r.length,u=l*l,c=new Array(u),h,g=0;g<u;g++)c[g]=0;for(var p=0;p<n.length;p++){var x=n[p],w=o[x.source().id()],v=o[x.target().id()],m=rT(x,s.attributes);c[w*l+v]+=m,c[v*l+w]+=m}nT(c,l,s.multFactor),Dw(c,l);for(var y=!0,b=0;y&&b<s.maxIterations;)y=!1,h=aT(c,l,s.expandFactor),c=sT(h,l,s.inflateFactor),oT(c,h,u,4)||(y=!0),b++;var _=lT(c,l,r,i);return _=cT(_),_},hT={markovClustering:W0,mcl:W0},fT=function(e){return e},Aw=function(e,r){return Math.abs(r-e)},V0=function(e,r,n){return e+Aw(r,n)},$0=function(e,r,n){return e+Math.pow(n-r,2)},dT=function(e){return Math.sqrt(e)},pT=function(e,r,n){return Math.max(e,Aw(r,n))},Fo=function(e,r,n,i,s){for(var o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:fT,a=i,l,u,c=0;c<e;c++)l=r(c),u=n(c),a=s(a,l,u);return o(a)},zs={euclidean:function(e,r,n){return e>=2?Fo(e,r,n,0,$0,dT):Fo(e,r,n,0,V0)},squaredEuclidean:function(e,r,n){return Fo(e,r,n,0,$0)},manhattan:function(e,r,n){return Fo(e,r,n,0,V0)},max:function(e,r,n){return Fo(e,r,n,-1/0,pT)}};zs["squared-euclidean"]=zs.squaredEuclidean;zs.squaredeuclidean=zs.squaredEuclidean;function qc(t,e,r,n,i,s){var o;return nr(t)?o=t:o=zs[t]||zs.euclidean,e===0&&nr(t)?o(i,s):o(e,r,n,i,s)}var vT=Ar({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),tg=function(e){return vT(e)},Nc=function(e,r,n,i,s){var o=s!=="kMedoids",a=o?function(h){return n[h]}:function(h){return i[h](n)},l=function(g){return i[g](r)},u=n,c=r;return qc(e,i.length,a,l,u,c)},kd=function(e,r,n){for(var i=n.length,s=new Array(i),o=new Array(i),a=new Array(r),l=null,u=0;u<i;u++)s[u]=e.min(n[u]).value,o[u]=e.max(n[u]).value;for(var c=0;c<r;c++){l=[];for(var h=0;h<i;h++)l[h]=Math.random()*(o[h]-s[h])+s[h];a[c]=l}return a},Mw=function(e,r,n,i,s){for(var o=1/0,a=0,l=0;l<r.length;l++){var u=Nc(n,e,r[l],i,s);u<o&&(o=u,a=l)}return a},Pw=function(e,r,n){for(var i=[],s=null,o=0;o<r.length;o++)s=r[o],n[s.id()]===e&&i.push(s);return i},gT=function(e,r,n){return Math.abs(r-e)<=n},mT=function(e,r,n){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>n)return!1}return!0},yT=function(e,r,n){for(var i=0;i<n;i++)if(e===r[i])return!0;return!1},G0=function(e,r){var n=new Array(r);if(e.length<50)for(var i=0;i<r;i++){for(var s=e[Math.floor(Math.random()*e.length)];yT(s,n,i);)s=e[Math.floor(Math.random()*e.length)];n[i]=s}else for(var o=0;o<r;o++)n[o]=e[Math.floor(Math.random()*e.length)];return n},q0=function(e,r,n){for(var i=0,s=0;s<r.length;s++)i+=Nc("manhattan",r[s],e,n,"kMedoids");return i},xT=function(e){var r=this.cy(),n=this.nodes(),i=null,s=tg(e),o=new Array(s.k),a={},l;s.testMode?typeof s.testCentroids=="number"?(s.testCentroids,l=kd(n,s.k,s.attributes)):xr(s.testCentroids)==="object"?l=s.testCentroids:l=kd(n,s.k,s.attributes):l=kd(n,s.k,s.attributes);for(var u=!0,c=0;u&&c<s.maxIterations;){for(var h=0;h<n.length;h++)i=n[h],a[i.id()]=Mw(i,l,s.distance,s.attributes,"kMeans");u=!1;for(var g=0;g<s.k;g++){var p=Pw(g,n,a);if(p.length!==0){for(var x=s.attributes.length,w=l[g],v=new Array(x),m=new Array(x),y=0;y<x;y++){m[y]=0;for(var b=0;b<p.length;b++)i=p[b],m[y]+=s.attributes[y](i);v[y]=m[y]/p.length,gT(v[y],w[y],s.sensitivityThreshold)||(u=!0)}l[g]=v,o[g]=r.collection(p)}}c++}return o},bT=function(e){var r=this.cy(),n=this.nodes(),i=null,s=tg(e),o=new Array(s.k),a,l={},u,c=new Array(s.k);s.testMode?typeof s.testCentroids=="number"||(xr(s.testCentroids)==="object"?a=s.testCentroids:a=G0(n,s.k)):a=G0(n,s.k);for(var h=!0,g=0;h&&g<s.maxIterations;){for(var p=0;p<n.length;p++)i=n[p],l[i.id()]=Mw(i,a,s.distance,s.attributes,"kMedoids");h=!1;for(var x=0;x<a.length;x++){var w=Pw(x,n,l);if(w.length!==0){c[x]=q0(a[x],w,s.attributes);for(var v=0;v<w.length;v++)u=q0(w[v],w,s.attributes),u<c[x]&&(c[x]=u,a[x]=w[v],h=!0);o[x]=r.collection(w)}}g++}return o},wT=function(e,r,n,i,s){for(var o,a,l=0;l<r.length;l++)for(var u=0;u<e.length;u++)i[l][u]=Math.pow(n[l][u],s.m);for(var c=0;c<e.length;c++)for(var h=0;h<s.attributes.length;h++){o=0,a=0;for(var g=0;g<r.length;g++)o+=i[g][c]*s.attributes[h](r[g]),a+=i[g][c];e[c][h]=o/a}},_T=function(e,r,n,i,s){for(var o=0;o<e.length;o++)r[o]=e[o].slice();for(var a,l,u,c=2/(s.m-1),h=0;h<n.length;h++)for(var g=0;g<i.length;g++){a=0;for(var p=0;p<n.length;p++)l=Nc(s.distance,i[g],n[h],s.attributes,"cmeans"),u=Nc(s.distance,i[g],n[p],s.attributes,"cmeans"),a+=Math.pow(l/u,c);e[g][h]=1/a}},ST=function(e,r,n,i){for(var s=new Array(n.k),o=0;o<s.length;o++)s[o]=[];for(var a,l,u=0;u<r.length;u++){a=-1/0,l=-1;for(var c=0;c<r[0].length;c++)r[u][c]>a&&(a=r[u][c],l=c);s[l].push(e[u])}for(var h=0;h<s.length;h++)s[h]=i.collection(s[h]);return s},Y0=function(e){var r=this.cy(),n=this.nodes(),i=tg(e),s,o,a,l,u;l=new Array(n.length);for(var c=0;c<n.length;c++)l[c]=new Array(i.k);a=new Array(n.length);for(var h=0;h<n.length;h++)a[h]=new Array(i.k);for(var g=0;g<n.length;g++){for(var p=0,x=0;x<i.k;x++)a[g][x]=Math.random(),p+=a[g][x];for(var w=0;w<i.k;w++)a[g][w]=a[g][w]/p}o=new Array(i.k);for(var v=0;v<i.k;v++)o[v]=new Array(i.attributes.length);u=new Array(n.length);for(var m=0;m<n.length;m++)u[m]=new Array(i.k);for(var y=!0,b=0;y&&b<i.maxIterations;)y=!1,wT(o,n,a,u,i),_T(a,l,o,n,i),mT(a,l,i.sensitivityThreshold)||(y=!0),b++;return s=ST(n,a,i,r),{clusters:s,degreeOfMembership:a}},CT={kMeans:xT,kMedoids:bT,fuzzyCMeans:Y0,fcm:Y0},ET=Ar({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),kT={single:"min",complete:"max"},TT=function(e){var r=ET(e),n=kT[r.linkage];return n!=null&&(r.linkage=n),r},X0=function(e,r,n,i,s){for(var o=0,a=1/0,l,u=s.attributes,c=function(N,M){return qc(s.distance,u.length,function(B){return u[B](N)},function(B){return u[B](M)},N,M)},h=0;h<e.length;h++){var g=e[h].key,p=n[g][i[g]];p<a&&(o=g,a=p)}if(s.mode==="threshold"&&a>=s.threshold||s.mode==="dendrogram"&&e.length===1)return!1;var x=r[o],w=r[i[o]],v;s.mode==="dendrogram"?v={left:x,right:w,key:x.key}:v={value:x.value.concat(w.value),key:x.key},e[x.index]=v,e.splice(w.index,1),r[x.key]=v;for(var m=0;m<e.length;m++){var y=e[m];x.key===y.key?l=1/0:s.linkage==="min"?(l=n[x.key][y.key],n[x.key][y.key]>n[w.key][y.key]&&(l=n[w.key][y.key])):s.linkage==="max"?(l=n[x.key][y.key],n[x.key][y.key]<n[w.key][y.key]&&(l=n[w.key][y.key])):s.linkage==="mean"?l=(n[x.key][y.key]*x.size+n[w.key][y.key]*w.size)/(x.size+w.size):s.mode==="dendrogram"?l=c(y.value,x.value):l=c(y.value[0],x.value[0]),n[x.key][y.key]=n[y.key][x.key]=l}for(var b=0;b<e.length;b++){var _=e[b].key;if(i[_]===x.key||i[_]===w.key){for(var R=_,E=0;E<e.length;E++){var T=e[E].key;n[_][T]<n[_][R]&&(R=T)}i[_]=R}e[b].index=b}return x.key=w.key=x.index=w.index=null,!0},Ms=function(e,r,n){e&&(e.value?r.push(e.value):(e.left&&Ms(e.left,r),e.right&&Ms(e.right,r)))},fv=function(e,r){if(!e)return"";if(e.left&&e.right){var n=fv(e.left,r),i=fv(e.right,r),s=r.add({group:"nodes",data:{id:n+","+i}});return r.add({group:"edges",data:{source:n,target:s.id()}}),r.add({group:"edges",data:{source:i,target:s.id()}}),s.id()}else if(e.value)return e.value.id()},dv=function(e,r,n){if(!e)return[];var i=[],s=[],o=[];return r===0?(e.left&&Ms(e.left,i),e.right&&Ms(e.right,s),o=i.concat(s),[n.collection(o)]):r===1?e.value?[n.collection(e.value)]:(e.left&&Ms(e.left,i),e.right&&Ms(e.right,s),[n.collection(i),n.collection(s)]):e.value?[n.collection(e.value)]:(e.left&&(i=dv(e.left,r-1,n)),e.right&&(s=dv(e.right,r-1,n)),i.concat(s))},K0=function(e){for(var r=this.cy(),n=this.nodes(),i=TT(e),s=i.attributes,o=function(b,_){return qc(i.distance,s.length,function(R){return s[R](b)},function(R){return s[R](_)},b,_)},a=[],l=[],u=[],c=[],h=0;h<n.length;h++){var g={value:i.mode==="dendrogram"?n[h]:[n[h]],key:h,index:h};a[h]=g,c[h]=g,l[h]=[],u[h]=0}for(var p=0;p<a.length;p++)for(var x=0;x<=p;x++){var w=void 0;i.mode==="dendrogram"?w=p===x?1/0:o(a[p].value,a[x].value):w=p===x?1/0:o(a[p].value[0],a[x].value[0]),l[p][x]=w,l[x][p]=w,w<l[p][u[p]]&&(u[p]=x)}for(var v=X0(a,c,l,u,i);v;)v=X0(a,c,l,u,i);var m;return i.mode==="dendrogram"?(m=dv(a[0],i.dendrogramDepth,r),i.addDendrogram&&fv(a[0],r)):(m=new Array(a.length),a.forEach(function(y,b){y.key=y.index=null,m[b]=r.collection(y.value)})),m},RT={hierarchicalClustering:K0,hca:K0},LT=Ar({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),NT=function(e){var r=e.damping,n=e.preference;.5<=r&&r<1||Jt("Damping must range on [0.5, 1). Got: ".concat(r));var i=["median","mean","min","max"];return i.some(function(s){return s===n})||Xe(n)||Jt("Preference must be one of [".concat(i.map(function(s){return"'".concat(s,"'")}).join(", "),"] or a number. Got: ").concat(n)),LT(e)},DT=function(e,r,n,i){var s=function(a,l){return i[l](a)};return-qc(e,i.length,function(o){return s(r,o)},function(o){return s(n,o)},r,n)},AT=function(e,r){var n=null;return r==="median"?n=N3(e):r==="mean"?n=L3(e):r==="min"?n=T3(e):r==="max"?n=R3(e):n=r,n},MT=function(e,r,n){for(var i=[],s=0;s<e;s++)r[s*e+s]+n[s*e+s]>0&&i.push(s);return i},Q0=function(e,r,n){for(var i=[],s=0;s<e;s++){for(var o=-1,a=-1/0,l=0;l<n.length;l++){var u=n[l];r[s*e+u]>a&&(o=u,a=r[s*e+u])}o>0&&i.push(o)}for(var c=0;c<n.length;c++)i[n[c]]=n[c];return i},PT=function(e,r,n){for(var i=Q0(e,r,n),s=0;s<n.length;s++){for(var o=[],a=0;a<i.length;a++)i[a]===n[s]&&o.push(a);for(var l=-1,u=-1/0,c=0;c<o.length;c++){for(var h=0,g=0;g<o.length;g++)h+=r[o[g]*e+o[c]];h>u&&(l=c,u=h)}n[s]=o[l]}return i=Q0(e,r,n),i},Z0=function(e){for(var r=this.cy(),n=this.nodes(),i=NT(e),s={},o=0;o<n.length;o++)s[n[o].id()]=o;var a,l,u,c,h,g;a=n.length,l=a*a,u=new Array(l);for(var p=0;p<l;p++)u[p]=-1/0;for(var x=0;x<a;x++)for(var w=0;w<a;w++)x!==w&&(u[x*a+w]=DT(i.distance,n[x],n[w],i.attributes));c=AT(u,i.preference);for(var v=0;v<a;v++)u[v*a+v]=c;h=new Array(l);for(var m=0;m<l;m++)h[m]=0;g=new Array(l);for(var y=0;y<l;y++)g[y]=0;for(var b=new Array(a),_=new Array(a),R=new Array(a),E=0;E<a;E++)b[E]=0,_[E]=0,R[E]=0;for(var T=new Array(a*i.minIterations),k=0;k<T.length;k++)T[k]=0;var N;for(N=0;N<i.maxIterations;N++){for(var M=0;M<a;M++){for(var B=-1/0,A=-1/0,j=-1,D=0,I=0;I<a;I++)b[I]=h[M*a+I],D=g[M*a+I]+u[M*a+I],D>=B?(A=B,B=D,j=I):D>A&&(A=D);for(var U=0;U<a;U++)h[M*a+U]=(1-i.damping)*(u[M*a+U]-B)+i.damping*b[U];h[M*a+j]=(1-i.damping)*(u[M*a+j]-A)+i.damping*b[j]}for(var W=0;W<a;W++){for(var H=0,z=0;z<a;z++)b[z]=g[z*a+W],_[z]=Math.max(0,h[z*a+W]),H+=_[z];H-=_[W],_[W]=h[W*a+W],H+=_[W];for(var P=0;P<a;P++)g[P*a+W]=(1-i.damping)*Math.min(0,H-_[P])+i.damping*b[P];g[W*a+W]=(1-i.damping)*(H-_[W])+i.damping*b[W]}for(var F=0,G=0;G<a;G++){var $=g[G*a+G]+h[G*a+G]>0?1:0;T[N%i.minIterations*a+G]=$,F+=$}if(F>0&&(N>=i.minIterations-1||N==i.maxIterations-1)){for(var ee=0,re=0;re<a;re++){R[re]=0;for(var ne=0;ne<i.minIterations;ne++)R[re]+=T[ne*a+re];(R[re]===0||R[re]===i.minIterations)&&ee++}if(ee===a)break}}for(var Y=MT(a,h,g),q=PT(a,u,Y),K={},X=0;X<Y.length;X++)K[Y[X]]=[];for(var J=0;J<n.length;J++){var ie=s[n[J].id()],ce=q[ie];ce!=null&&K[ce].push(n[J])}for(var de=new Array(Y.length),Le=0;Le<Y.length;Le++)de[Le]=r.collection(K[Y[Le]]);return de},IT={affinityPropagation:Z0,ap:Z0},OT=Ar({root:void 0,directed:!1}),BT={hierholzer:function(e){if(!Dt(e)){var r=arguments;e={root:r[0],directed:r[1]}}var n=OT(e),i=n.root,s=n.directed,o=this,a=!1,l,u,c;i&&(c=ut(i)?this.filter(i)[0].id():i[0].id());var h={},g={};s?o.forEach(function(y){var b=y.id();if(y.isNode()){var _=y.indegree(!0),R=y.outdegree(!0),E=_-R,T=R-_;E==1?l?a=!0:l=b:T==1?u?a=!0:u=b:(T>1||E>1)&&(a=!0),h[b]=[],y.outgoers().forEach(function(k){k.isEdge()&&h[b].push(k.id())})}else g[b]=[void 0,y.target().id()]}):o.forEach(function(y){var b=y.id();if(y.isNode()){var _=y.degree(!0);_%2&&(l?u?a=!0:u=b:l=b),h[b]=[],y.connectedEdges().forEach(function(R){return h[b].push(R.id())})}else g[b]=[y.source().id(),y.target().id()]});var p={found:!1,trail:void 0};if(a)return p;if(u&&l)if(s){if(c&&u!=c)return p;c=u}else{if(c&&u!=c&&l!=c)return p;c||(c=u)}else c||(c=o[0].id());var x=function(b){for(var _=b,R=[b],E,T,k;h[_].length;)E=h[_].shift(),T=g[E][0],k=g[E][1],_!=k?(h[k]=h[k].filter(function(N){return N!=E}),_=k):!s&&_!=T&&(h[T]=h[T].filter(function(N){return N!=E}),_=T),R.unshift(E),R.unshift(_);return R},w=[],v=[];for(v=x(c);v.length!=1;)h[v[0]].length==0?(w.unshift(o.getElementById(v.shift())),w.unshift(o.getElementById(v.shift()))):v=x(v.shift()).concat(v);w.unshift(o.getElementById(v.shift()));for(var m in h)if(h[m].length)return p;return p.found=!0,p.trail=this.spawn(w,!0),p}},qu=function(){var e=this,r={},n=0,i=0,s=[],o=[],a={},l=function(g,p){for(var x=o.length-1,w=[],v=e.spawn();o[x].x!=g||o[x].y!=p;)w.push(o.pop().edge),x--;w.push(o.pop().edge),w.forEach(function(m){var y=m.connectedNodes().intersection(e);v.merge(m),y.forEach(function(b){var _=b.id(),R=b.connectedEdges().intersection(e);v.merge(b),r[_].cutVertex?v.merge(R.filter(function(E){return E.isLoop()})):v.merge(R)})}),s.push(v)},u=function(g,p,x){g===x&&(i+=1),r[p]={id:n,low:n++,cutVertex:!1};var w=e.getElementById(p).connectedEdges().intersection(e);if(w.size()===0)s.push(e.spawn(e.getElementById(p)));else{var v,m,y,b;w.forEach(function(_){v=_.source().id(),m=_.target().id(),y=v===p?m:v,y!==x&&(b=_.id(),a[b]||(a[b]=!0,o.push({x:p,y,edge:_})),y in r?r[p].low=Math.min(r[p].low,r[y].id):(u(g,y,p),r[p].low=Math.min(r[p].low,r[y].low),r[p].id<=r[y].low&&(r[p].cutVertex=!0,l(p,y))))})}};e.forEach(function(h){if(h.isNode()){var g=h.id();g in r||(i=0,u(g,g),r[g].cutVertex=i>1)}});var c=Object.keys(r).filter(function(h){return r[h].cutVertex}).map(function(h){return e.getElementById(h)});return{cut:e.spawn(c),components:s}},FT={hopcroftTarjanBiconnected:qu,htbc:qu,htb:qu,hopcroftTarjanBiconnectedComponents:qu},Yu=function(){var e=this,r={},n=0,i=[],s=[],o=e.spawn(e),a=function(u){s.push(u),r[u]={index:n,low:n++,explored:!1};var c=e.getElementById(u).connectedEdges().intersection(e);if(c.forEach(function(w){var v=w.target().id();v!==u&&(v in r||a(v),r[v].explored||(r[u].low=Math.min(r[u].low,r[v].low)))}),r[u].index===r[u].low){for(var h=e.spawn();;){var g=s.pop();if(h.merge(e.getElementById(g)),r[g].low=r[u].index,r[g].explored=!0,g===u)break}var p=h.edgesWith(h),x=h.merge(p);i.push(x),o=o.difference(x)}};return e.forEach(function(l){if(l.isNode()){var u=l.id();u in r||a(u)}}),{cut:o,components:i}},jT={tarjanStronglyConnected:Yu,tsc:Yu,tscc:Yu,tarjanStronglyConnectedComponents:Yu},Iw={};[hl,v3,g3,y3,b3,_3,E3,Z3,Os,Bs,hv,hT,CT,RT,IT,BT,FT,jT].forEach(function(t){dt(Iw,t)});/*!
49
+ Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable
50
+ Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com)
51
+ Licensed under The MIT License (http://opensource.org/licenses/MIT)
52
+ */var Ow=0,Bw=1,Fw=2,Hn=function(e){if(!(this instanceof Hn))return new Hn(e);this.id="Thenable/1.0.7",this.state=Ow,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))};Hn.prototype={fulfill:function(e){return J0(this,Bw,"fulfillValue",e)},reject:function(e){return J0(this,Fw,"rejectReason",e)},then:function(e,r){var n=this,i=new Hn;return n.onFulfilled.push(tx(e,i,"fulfill")),n.onRejected.push(tx(r,i,"reject")),jw(n),i.proxy}};var J0=function(e,r,n,i){return e.state===Ow&&(e.state=r,e[n]=i,jw(e)),e},jw=function(e){e.state===Bw?ex(e,"onFulfilled",e.fulfillValue):e.state===Fw&&ex(e,"onRejected",e.rejectReason)},ex=function(e,r,n){if(e[r].length!==0){var i=e[r];e[r]=[];var s=function(){for(var a=0;a<i.length;a++)i[a](n)};typeof setImmediate=="function"?setImmediate(s):setTimeout(s,0)}},tx=function(e,r,n){return function(i){if(typeof e!="function")r[n].call(r,i);else{var s;try{s=e(i)}catch(o){r.reject(o);return}zw(r,s)}}},zw=function(e,r){if(e===r||e.proxy===r){e.reject(new TypeError("cannot resolve promise with itself"));return}var n;if(xr(r)==="object"&&r!==null||typeof r=="function")try{n=r.then}catch(s){e.reject(s);return}if(typeof n=="function"){var i=!1;try{n.call(r,function(s){i||(i=!0,s===r?e.reject(new TypeError("circular thenable chain")):zw(e,s))},function(s){i||(i=!0,e.reject(s))})}catch(s){i||e.reject(s)}return}e.fulfill(r)};Hn.all=function(t){return new Hn(function(e,r){for(var n=new Array(t.length),i=0,s=function(l,u){n[l]=u,i++,i===t.length&&e(n)},o=0;o<t.length;o++)(function(a){var l=t[a],u=l!=null&&l.then!=null;if(u)l.then(function(h){s(a,h)},function(h){r(h)});else{var c=l;s(a,c)}})(o)})};Hn.resolve=function(t){return new Hn(function(e,r){e(t)})};Hn.reject=function(t){return new Hn(function(e,r){r(t)})};var qs=typeof Promise<"u"?Promise:Hn,pv=function(e,r,n){var i=$v(e),s=!i,o=this._private=dt({duration:1e3},r,n);if(o.target=e,o.style=o.style||o.css,o.started=!1,o.playing=!1,o.hooked=!1,o.applying=!1,o.progress=0,o.completes=[],o.frames=[],o.complete&&nr(o.complete)&&o.completes.push(o.complete),s){var a=e.position();o.startPosition=o.startPosition||{x:a.x,y:a.y},o.startStyle=o.startStyle||e.cy().style().getAnimationStartStyle(e,o.style)}if(i){var l=e.pan();o.startPan={x:l.x,y:l.y},o.startZoom=e.zoom()}this.length=1,this[0]=this},Fa=pv.prototype;dt(Fa,{instanceString:function(){return"animation"},hook:function(){var e=this._private;if(!e.hooked){var r,n=e.target._private.animation;e.queue?r=n.queue:r=n.current,r.push(this),mn(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,n=r.playing;return e===void 0?r.progress:(n&&this.pause(),r.progress=e,r.started=!1,n&&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 n=function(u,c){var h=e[u];h!=null&&(e[u]=e[c],e[c]=h)};if(n("zoom","startZoom"),n("pan","startPan"),n("position","startPosition"),e.style)for(var i=0;i<e.style.length;i++){var s=e.style[i],o=s.name,a=e.startStyle[o];e.startStyle[o]=s,e.style[i]=a}return r&&this.play(),this},promise:function(e){var r=this._private,n;switch(e){case"frame":n=r.frames;break;default:case"complete":case"completed":n=r.completes}return new qs(function(i,s){n.push(function(){i()})})}});Fa.complete=Fa.completed;Fa.run=Fa.play;Fa.running=Fa.playing;var zT={animated:function(){return function(){var r=this,n=r.length!==void 0,i=n?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,n=r.length!==void 0,i=n?r:[r],s=this._private.cy||this;if(!s.styleEnabled())return this;for(var o=0;o<i.length;o++){var a=i[o];a._private.animation.queue=[]}return this}},delay:function(){return function(r,n){var i=this._private.cy||this;return i.styleEnabled()?this.animate({delay:r,duration:r,complete:n}):this}},delayAnimation:function(){return function(r,n){var i=this._private.cy||this;return i.styleEnabled()?this.animation({delay:r,duration:r,complete:n}):this}},animation:function(){return function(r,n){var i=this,s=i.length!==void 0,o=s?i:[i],a=this._private.cy||this,l=!s,u=!l;if(!a.styleEnabled())return this;var c=a.style();r=dt({},r,n);var h=Object.keys(r).length===0;if(h)return new pv(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(u&&(r.style=c.getPropsList(r.style||r.css),r.css=void 0),u&&r.renderedPosition!=null){var g=r.renderedPosition,p=a.pan(),x=a.zoom();r.position=Ew(g,x,p)}if(l&&r.panBy!=null){var w=r.panBy,v=a.pan();r.pan={x:v.x+w.x,y:v.y+w.y}}var m=r.center||r.centre;if(l&&m!=null){var y=a.getCenterPan(m.eles,r.zoom);y!=null&&(r.pan=y)}if(l&&r.fit!=null){var b=r.fit,_=a.getFitViewport(b.eles||b.boundingBox,b.padding);_!=null&&(r.pan=_.pan,r.zoom=_.zoom)}if(l&&Dt(r.zoom)){var R=a.getZoomedViewport(r.zoom);R!=null?(R.zoomed&&(r.zoom=R.zoom),R.panned&&(r.pan=R.pan)):r.zoom=null}return new pv(o[0],r)}},animate:function(){return function(r,n){var i=this,s=i.length!==void 0,o=s?i:[i],a=this._private.cy||this;if(!a.styleEnabled())return this;n&&(r=dt({},r,n));for(var l=0;l<o.length;l++){var u=o[l],c=u.animated()&&(r.queue===void 0||r.queue),h=u.animation(r,c?{queue:!0}:void 0);h.play()}return this}},stop:function(){return function(r,n){var i=this,s=i.length!==void 0,o=s?i:[i],a=this._private.cy||this;if(!a.styleEnabled())return this;for(var l=0;l<o.length;l++){for(var u=o[l],c=u._private,h=c.animation.current,g=0;g<h.length;g++){var p=h[g],x=p._private;n&&(x.duration=0)}r&&(c.animation.queue=[]),n||(c.animation.current=[])}return a.notify("draw"),this}}},Td,rx;function Yc(){if(rx)return Td;rx=1;var t=Array.isArray;return Td=t,Td}var Rd,nx;function HT(){if(nx)return Rd;nx=1;var t=Yc(),e=El(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(s,o){if(t(s))return!1;var a=typeof s;return a=="number"||a=="symbol"||a=="boolean"||s==null||e(s)?!0:n.test(s)||!r.test(s)||o!=null&&s in Object(o)}return Rd=i,Rd}var Ld,ix;function UT(){if(ix)return Ld;ix=1;var t=gw(),e=Cl(),r="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",s="[object Proxy]";function o(a){if(!e(a))return!1;var l=t(a);return l==n||l==i||l==r||l==s}return Ld=o,Ld}var Nd,ax;function WT(){if(ax)return Nd;ax=1;var t=Vc(),e=t["__core-js_shared__"];return Nd=e,Nd}var Dd,sx;function VT(){if(sx)return Dd;sx=1;var t=WT(),e=(function(){var n=/[^.]+$/.exec(t&&t.keys&&t.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function r(n){return!!e&&e in n}return Dd=r,Dd}var Ad,ox;function $T(){if(ox)return Ad;ox=1;var t=Function.prototype,e=t.toString;function r(n){if(n!=null){try{return e.call(n)}catch{}try{return n+""}catch{}}return""}return Ad=r,Ad}var Md,lx;function GT(){if(lx)return Md;lx=1;var t=UT(),e=VT(),r=Cl(),n=$T(),i=/[\\^$.*+?()[\]{}|]/g,s=/^\[object .+?Constructor\]$/,o=Function.prototype,a=Object.prototype,l=o.toString,u=a.hasOwnProperty,c=RegExp("^"+l.call(u).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function h(g){if(!r(g)||e(g))return!1;var p=t(g)?c:s;return p.test(n(g))}return Md=h,Md}var Pd,ux;function qT(){if(ux)return Pd;ux=1;function t(e,r){return e==null?void 0:e[r]}return Pd=t,Pd}var Id,cx;function rg(){if(cx)return Id;cx=1;var t=GT(),e=qT();function r(n,i){var s=e(n,i);return t(s)?s:void 0}return Id=r,Id}var Od,hx;function Xc(){if(hx)return Od;hx=1;var t=rg(),e=t(Object,"create");return Od=e,Od}var Bd,fx;function YT(){if(fx)return Bd;fx=1;var t=Xc();function e(){this.__data__=t?t(null):{},this.size=0}return Bd=e,Bd}var Fd,dx;function XT(){if(dx)return Fd;dx=1;function t(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r}return Fd=t,Fd}var jd,px;function KT(){if(px)return jd;px=1;var t=Xc(),e="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function i(s){var o=this.__data__;if(t){var a=o[s];return a===e?void 0:a}return n.call(o,s)?o[s]:void 0}return jd=i,jd}var zd,vx;function QT(){if(vx)return zd;vx=1;var t=Xc(),e=Object.prototype,r=e.hasOwnProperty;function n(i){var s=this.__data__;return t?s[i]!==void 0:r.call(s,i)}return zd=n,zd}var Hd,gx;function ZT(){if(gx)return Hd;gx=1;var t=Xc(),e="__lodash_hash_undefined__";function r(n,i){var s=this.__data__;return this.size+=this.has(n)?0:1,s[n]=t&&i===void 0?e:i,this}return Hd=r,Hd}var Ud,mx;function JT(){if(mx)return Ud;mx=1;var t=YT(),e=XT(),r=KT(),n=QT(),i=ZT();function s(o){var a=-1,l=o==null?0:o.length;for(this.clear();++a<l;){var u=o[a];this.set(u[0],u[1])}}return s.prototype.clear=t,s.prototype.delete=e,s.prototype.get=r,s.prototype.has=n,s.prototype.set=i,Ud=s,Ud}var Wd,yx;function eR(){if(yx)return Wd;yx=1;function t(){this.__data__=[],this.size=0}return Wd=t,Wd}var Vd,xx;function Hw(){if(xx)return Vd;xx=1;function t(e,r){return e===r||e!==e&&r!==r}return Vd=t,Vd}var $d,bx;function Kc(){if(bx)return $d;bx=1;var t=Hw();function e(r,n){for(var i=r.length;i--;)if(t(r[i][0],n))return i;return-1}return $d=e,$d}var Gd,wx;function tR(){if(wx)return Gd;wx=1;var t=Kc(),e=Array.prototype,r=e.splice;function n(i){var s=this.__data__,o=t(s,i);if(o<0)return!1;var a=s.length-1;return o==a?s.pop():r.call(s,o,1),--this.size,!0}return Gd=n,Gd}var qd,_x;function rR(){if(_x)return qd;_x=1;var t=Kc();function e(r){var n=this.__data__,i=t(n,r);return i<0?void 0:n[i][1]}return qd=e,qd}var Yd,Sx;function nR(){if(Sx)return Yd;Sx=1;var t=Kc();function e(r){return t(this.__data__,r)>-1}return Yd=e,Yd}var Xd,Cx;function iR(){if(Cx)return Xd;Cx=1;var t=Kc();function e(r,n){var i=this.__data__,s=t(i,r);return s<0?(++this.size,i.push([r,n])):i[s][1]=n,this}return Xd=e,Xd}var Kd,Ex;function aR(){if(Ex)return Kd;Ex=1;var t=eR(),e=tR(),r=rR(),n=nR(),i=iR();function s(o){var a=-1,l=o==null?0:o.length;for(this.clear();++a<l;){var u=o[a];this.set(u[0],u[1])}}return s.prototype.clear=t,s.prototype.delete=e,s.prototype.get=r,s.prototype.has=n,s.prototype.set=i,Kd=s,Kd}var Qd,kx;function sR(){if(kx)return Qd;kx=1;var t=rg(),e=Vc(),r=t(e,"Map");return Qd=r,Qd}var Zd,Tx;function oR(){if(Tx)return Zd;Tx=1;var t=JT(),e=aR(),r=sR();function n(){this.size=0,this.__data__={hash:new t,map:new(r||e),string:new t}}return Zd=n,Zd}var Jd,Rx;function lR(){if(Rx)return Jd;Rx=1;function t(e){var r=typeof e;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?e!=="__proto__":e===null}return Jd=t,Jd}var ep,Lx;function Qc(){if(Lx)return ep;Lx=1;var t=lR();function e(r,n){var i=r.__data__;return t(n)?i[typeof n=="string"?"string":"hash"]:i.map}return ep=e,ep}var tp,Nx;function uR(){if(Nx)return tp;Nx=1;var t=Qc();function e(r){var n=t(this,r).delete(r);return this.size-=n?1:0,n}return tp=e,tp}var rp,Dx;function cR(){if(Dx)return rp;Dx=1;var t=Qc();function e(r){return t(this,r).get(r)}return rp=e,rp}var np,Ax;function hR(){if(Ax)return np;Ax=1;var t=Qc();function e(r){return t(this,r).has(r)}return np=e,np}var ip,Mx;function fR(){if(Mx)return ip;Mx=1;var t=Qc();function e(r,n){var i=t(this,r),s=i.size;return i.set(r,n),this.size+=i.size==s?0:1,this}return ip=e,ip}var ap,Px;function dR(){if(Px)return ap;Px=1;var t=oR(),e=uR(),r=cR(),n=hR(),i=fR();function s(o){var a=-1,l=o==null?0:o.length;for(this.clear();++a<l;){var u=o[a];this.set(u[0],u[1])}}return s.prototype.clear=t,s.prototype.delete=e,s.prototype.get=r,s.prototype.has=n,s.prototype.set=i,ap=s,ap}var sp,Ix;function pR(){if(Ix)return sp;Ix=1;var t=dR(),e="Expected a function";function r(n,i){if(typeof n!="function"||i!=null&&typeof i!="function")throw new TypeError(e);var s=function(){var o=arguments,a=i?i.apply(this,o):o[0],l=s.cache;if(l.has(a))return l.get(a);var u=n.apply(this,o);return s.cache=l.set(a,u)||l,u};return s.cache=new(r.Cache||t),s}return r.Cache=t,sp=r,sp}var op,Ox;function vR(){if(Ox)return op;Ox=1;var t=pR(),e=500;function r(n){var i=t(n,function(o){return s.size===e&&s.clear(),o}),s=i.cache;return i}return op=r,op}var lp,Bx;function Uw(){if(Bx)return lp;Bx=1;var t=vR(),e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,n=t(function(i){var s=[];return i.charCodeAt(0)===46&&s.push(""),i.replace(e,function(o,a,l,u){s.push(l?u.replace(r,"$1"):a||o)}),s});return lp=n,lp}var up,Fx;function Ww(){if(Fx)return up;Fx=1;function t(e,r){for(var n=-1,i=e==null?0:e.length,s=Array(i);++n<i;)s[n]=r(e[n],n,e);return s}return up=t,up}var cp,jx;function gR(){if(jx)return cp;jx=1;var t=qv(),e=Ww(),r=Yc(),n=El(),i=t?t.prototype:void 0,s=i?i.toString:void 0;function o(a){if(typeof a=="string")return a;if(r(a))return e(a,o)+"";if(n(a))return s?s.call(a):"";var l=a+"";return l=="0"&&1/a==-1/0?"-0":l}return cp=o,cp}var hp,zx;function Vw(){if(zx)return hp;zx=1;var t=gR();function e(r){return r==null?"":t(r)}return hp=e,hp}var fp,Hx;function $w(){if(Hx)return fp;Hx=1;var t=Yc(),e=HT(),r=Uw(),n=Vw();function i(s,o){return t(s)?s:e(s,o)?[s]:r(n(s))}return fp=i,fp}var dp,Ux;function ng(){if(Ux)return dp;Ux=1;var t=El();function e(r){if(typeof r=="string"||t(r))return r;var n=r+"";return n=="0"&&1/r==-1/0?"-0":n}return dp=e,dp}var pp,Wx;function mR(){if(Wx)return pp;Wx=1;var t=$w(),e=ng();function r(n,i){i=t(i,n);for(var s=0,o=i.length;n!=null&&s<o;)n=n[e(i[s++])];return s&&s==o?n:void 0}return pp=r,pp}var vp,Vx;function yR(){if(Vx)return vp;Vx=1;var t=mR();function e(r,n,i){var s=r==null?void 0:t(r,n);return s===void 0?i:s}return vp=e,vp}var xR=yR(),bR=Sl(xR),gp,$x;function wR(){if($x)return gp;$x=1;var t=rg(),e=(function(){try{var r=t(Object,"defineProperty");return r({},"",{}),r}catch{}})();return gp=e,gp}var mp,Gx;function _R(){if(Gx)return mp;Gx=1;var t=wR();function e(r,n,i){n=="__proto__"&&t?t(r,n,{configurable:!0,enumerable:!0,value:i,writable:!0}):r[n]=i}return mp=e,mp}var yp,qx;function SR(){if(qx)return yp;qx=1;var t=_R(),e=Hw(),r=Object.prototype,n=r.hasOwnProperty;function i(s,o,a){var l=s[o];(!(n.call(s,o)&&e(l,a))||a===void 0&&!(o in s))&&t(s,o,a)}return yp=i,yp}var xp,Yx;function CR(){if(Yx)return xp;Yx=1;var t=9007199254740991,e=/^(?:0|[1-9]\d*)$/;function r(n,i){var s=typeof n;return i=i??t,!!i&&(s=="number"||s!="symbol"&&e.test(n))&&n>-1&&n%1==0&&n<i}return xp=r,xp}var bp,Xx;function ER(){if(Xx)return bp;Xx=1;var t=SR(),e=$w(),r=CR(),n=Cl(),i=ng();function s(o,a,l,u){if(!n(o))return o;a=e(a,o);for(var c=-1,h=a.length,g=h-1,p=o;p!=null&&++c<h;){var x=i(a[c]),w=l;if(x==="__proto__"||x==="constructor"||x==="prototype")return o;if(c!=g){var v=p[x];w=u?u(v,x,p):void 0,w===void 0&&(w=n(v)?v:r(a[c+1])?[]:{})}t(p,x,w),p=p[x]}return o}return bp=s,bp}var wp,Kx;function kR(){if(Kx)return wp;Kx=1;var t=ER();function e(r,n,i){return r==null?r:t(r,n,i)}return wp=e,wp}var TR=kR(),RR=Sl(TR),_p,Qx;function LR(){if(Qx)return _p;Qx=1;function t(e,r){var n=-1,i=e.length;for(r||(r=Array(i));++n<i;)r[n]=e[n];return r}return _p=t,_p}var Sp,Zx;function NR(){if(Zx)return Sp;Zx=1;var t=Ww(),e=LR(),r=Yc(),n=El(),i=Uw(),s=ng(),o=Vw();function a(l){return r(l)?t(l,s):n(l)?[l]:e(i(o(l)))}return Sp=a,Sp}var DR=NR(),AR=Sl(DR),MR={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=dt({},r,e),function(i,s){var o=e,a=this,l=a.length!==void 0,u=l?a:[a],c=l?a[0]:a;if(ut(i)){var h=i.indexOf(".")!==-1,g=h&&AR(i);if(o.allowGetting&&s===void 0){var p;return c&&(o.beforeGet(c),g&&c._private[o.field][i]===void 0?p=bR(c._private[o.field],g):p=c._private[o.field][i]),p}else if(o.allowSetting&&s!==void 0){var x=!o.immutableKeys[i];if(x){var w=sw({},i,s);o.beforeSet(a,w);for(var v=0,m=u.length;v<m;v++){var y=u[v];o.canSet(y)&&(g&&c._private[o.field][i]===void 0?RR(y._private[o.field],g,s):y._private[o.field][i]=s)}o.updateStyle&&a.updateStyle(),o.onSet(a),o.settingTriggersEvent&&a[o.triggerFnName](o.settingEvent)}}}else if(o.allowSetting&&Dt(i)){var b=i,_,R,E=Object.keys(b);o.beforeSet(a,b);for(var T=0;T<E.length;T++){_=E[T],R=b[_];var k=!o.immutableKeys[_];if(k)for(var N=0;N<u.length;N++){var M=u[N];o.canSet(M)&&(M._private[o.field][_]=R)}}o.updateStyle&&a.updateStyle(),o.onSet(a),o.settingTriggersEvent&&a[o.triggerFnName](o.settingEvent)}else if(o.allowBinding&&nr(i)){var B=i;a.on(o.bindingEvent,B)}else if(o.allowGetting&&i===void 0){var A;return c&&(o.beforeGet(c),A=c._private[o.field]),A}return a}},removeData:function(e){var r={field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}};return e=dt({},r,e),function(i){var s=e,o=this,a=o.length!==void 0,l=a?o:[o];if(ut(i)){for(var u=i.split(/\s+/),c=u.length,h=0;h<c;h++){var g=u[h];if(!Qi(g)){var p=!s.immutableKeys[g];if(p)for(var x=0,w=l.length;x<w;x++)l[x]._private[s.field][g]=void 0}}s.triggerEvent&&o[s.triggerFnName](s.event)}else if(i===void 0){for(var v=0,m=l.length;v<m;v++)for(var y=l[v]._private[s.field],b=Object.keys(y),_=0;_<b.length;_++){var R=b[_],E=!s.immutableKeys[R];E&&(y[R]=void 0)}s.triggerEvent&&o[s.triggerFnName](s.event)}return o}}},PR={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(n,i){var s=this,o=Array.prototype.slice.call(arguments,0);return new qs(function(a,l){var u=function(p){s.off.apply(s,h),a(p)},c=o.concat([u]),h=c.concat([]);s.on.apply(s,c)})}}},Ot={};[zT,MR,PR].forEach(function(t){dt(Ot,t)});var IR={animate:Ot.animate(),animation:Ot.animation(),animated:Ot.animated(),clearQueue:Ot.clearQueue(),delay:Ot.delay(),delayAnimation:Ot.delayAnimation(),stop:Ot.stop()},hc={classes:function(e){var r=this;if(e===void 0){var n=[];return r[0]._private.classes.forEach(function(x){return n.push(x)}),n}else Ut(e)||(e=(e||"").match(/\S+/g)||[]);for(var i=[],s=new Gs(e),o=0;o<r.length;o++){for(var a=r[o],l=a._private,u=l.classes,c=!1,h=0;h<e.length;h++){var g=e[h],p=u.has(g);if(!p){c=!0;break}}c||(c=u.size!==e.length),c&&(l.classes=s,i.push(a))}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){Ut(e)||(e=e.match(/\S+/g)||[]);for(var n=this,i=r===void 0,s=[],o=0,a=n.length;o<a;o++)for(var l=n[o],u=l._private.classes,c=!1,h=0;h<e.length;h++){var g=e[h],p=u.has(g),x=!1;r||i&&!p?(u.add(g),x=!0):(!r||i&&p)&&(u.delete(g),x=!0),!c&&x&&(s.push(l),c=!0)}return s.length>0&&this.spawn(s).updateStyle().emit("class"),n},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,r){var n=this;if(r==null)r=250;else if(r===0)return n;return n.addClass(e),setTimeout(function(){n.removeClass(e)},r),n}};hc.className=hc.classNames=hc.classes;var Nt={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:yr,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};Nt.variable="(?:[\\w-.]|(?:\\\\"+Nt.metaChar+"))+";Nt.className="(?:[\\w-]|(?:\\\\"+Nt.metaChar+"))+";Nt.value=Nt.string+"|"+Nt.number;Nt.id=Nt.variable;(function(){var t,e,r;for(t=Nt.comparatorOp.split("|"),r=0;r<t.length;r++)e=t[r],Nt.comparatorOp+="|@"+e;for(t=Nt.comparatorOp.split("|"),r=0;r<t.length;r++)e=t[r],!(e.indexOf("!")>=0)&&e!=="="&&(Nt.comparatorOp+="|\\!"+e)})();var jt=function(){return{checks:[]}},tt={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},vv=[{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 Mk(t.selector,e.selector)}),OR=(function(){for(var t={},e,r=0;r<vv.length;r++)e=vv[r],t[e.selector]=e.matches;return t})(),BR=function(e,r){return OR[e](r)},FR="("+vv.map(function(t){return t.selector}).join("|")+")",ms=function(e){return e.replace(new RegExp("\\\\("+Nt.metaChar+")","g"),function(r,n){return n})},Ui=function(e,r,n){e[e.length-1]=n},gv=[{name:"group",query:!0,regex:"("+Nt.group+")",populate:function(e,r,n){var i=pr(n,1),s=i[0];r.checks.push({type:tt.GROUP,value:s==="*"?s:s+"s"})}},{name:"state",query:!0,regex:FR,populate:function(e,r,n){var i=pr(n,1),s=i[0];r.checks.push({type:tt.STATE,value:s})}},{name:"id",query:!0,regex:"\\#("+Nt.id+")",populate:function(e,r,n){var i=pr(n,1),s=i[0];r.checks.push({type:tt.ID,value:ms(s)})}},{name:"className",query:!0,regex:"\\.("+Nt.className+")",populate:function(e,r,n){var i=pr(n,1),s=i[0];r.checks.push({type:tt.CLASS,value:ms(s)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+Nt.variable+")\\s*\\]",populate:function(e,r,n){var i=pr(n,1),s=i[0];r.checks.push({type:tt.DATA_EXIST,field:ms(s)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+Nt.variable+")\\s*("+Nt.comparatorOp+")\\s*("+Nt.value+")\\s*\\]",populate:function(e,r,n){var i=pr(n,3),s=i[0],o=i[1],a=i[2],l=new RegExp("^"+Nt.string+"$").exec(a)!=null;l?a=a.substring(1,a.length-1):a=parseFloat(a),r.checks.push({type:tt.DATA_COMPARE,field:ms(s),operator:o,value:a})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+Nt.boolOp+")\\s*("+Nt.variable+")\\s*\\]",populate:function(e,r,n){var i=pr(n,2),s=i[0],o=i[1];r.checks.push({type:tt.DATA_BOOL,field:ms(o),operator:s})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+Nt.meta+")\\s*("+Nt.comparatorOp+")\\s*("+Nt.number+")\\s*\\]\\]",populate:function(e,r,n){var i=pr(n,3),s=i[0],o=i[1],a=i[2];r.checks.push({type:tt.META_COMPARE,field:ms(s),operator:o,value:parseFloat(a)})}},{name:"nextQuery",separator:!0,regex:Nt.separator,populate:function(e,r){var n=e.currentSubject,i=e.edgeCount,s=e.compoundCount,o=e[e.length-1];n!=null&&(o.subject=n,e.currentSubject=null),o.edgeCount=i,o.compoundCount=s,e.edgeCount=0,e.compoundCount=0;var a=e[e.length++]=jt();return a}},{name:"directedEdge",separator:!0,regex:Nt.directedEdge,populate:function(e,r){if(e.currentSubject==null){var n=jt(),i=r,s=jt();return n.checks.push({type:tt.DIRECTED_EDGE,source:i,target:s}),Ui(e,r,n),e.edgeCount++,s}else{var o=jt(),a=r,l=jt();return o.checks.push({type:tt.NODE_SOURCE,source:a,target:l}),Ui(e,r,o),e.edgeCount++,l}}},{name:"undirectedEdge",separator:!0,regex:Nt.undirectedEdge,populate:function(e,r){if(e.currentSubject==null){var n=jt(),i=r,s=jt();return n.checks.push({type:tt.UNDIRECTED_EDGE,nodes:[i,s]}),Ui(e,r,n),e.edgeCount++,s}else{var o=jt(),a=r,l=jt();return o.checks.push({type:tt.NODE_NEIGHBOR,node:a,neighbor:l}),Ui(e,r,o),l}}},{name:"child",separator:!0,regex:Nt.child,populate:function(e,r){if(e.currentSubject==null){var n=jt(),i=jt(),s=e[e.length-1];return n.checks.push({type:tt.CHILD,parent:s,child:i}),Ui(e,r,n),e.compoundCount++,i}else if(e.currentSubject===r){var o=jt(),a=e[e.length-1],l=jt(),u=jt(),c=jt(),h=jt();return o.checks.push({type:tt.COMPOUND_SPLIT,left:a,right:l,subject:u}),u.checks=r.checks,r.checks=[{type:tt.TRUE}],h.checks.push({type:tt.TRUE}),l.checks.push({type:tt.PARENT,parent:h,child:c}),Ui(e,a,o),e.currentSubject=u,e.compoundCount++,c}else{var g=jt(),p=jt(),x=[{type:tt.PARENT,parent:g,child:p}];return g.checks=r.checks,r.checks=x,e.compoundCount++,p}}},{name:"descendant",separator:!0,regex:Nt.descendant,populate:function(e,r){if(e.currentSubject==null){var n=jt(),i=jt(),s=e[e.length-1];return n.checks.push({type:tt.DESCENDANT,ancestor:s,descendant:i}),Ui(e,r,n),e.compoundCount++,i}else if(e.currentSubject===r){var o=jt(),a=e[e.length-1],l=jt(),u=jt(),c=jt(),h=jt();return o.checks.push({type:tt.COMPOUND_SPLIT,left:a,right:l,subject:u}),u.checks=r.checks,r.checks=[{type:tt.TRUE}],h.checks.push({type:tt.TRUE}),l.checks.push({type:tt.ANCESTOR,ancestor:h,descendant:c}),Ui(e,a,o),e.currentSubject=u,e.compoundCount++,c}else{var g=jt(),p=jt(),x=[{type:tt.ANCESTOR,ancestor:g,descendant:p}];return g.checks=r.checks,r.checks=x,e.compoundCount++,p}}},{name:"subject",modifier:!0,regex:Nt.subject,populate:function(e,r){if(e.currentSubject!=null&&e.currentSubject!==r)return Bt("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=r;var n=e[e.length-1],i=n.checks[0],s=i==null?null:i.type;s===tt.DIRECTED_EDGE?i.type=tt.NODE_TARGET:s===tt.UNDIRECTED_EDGE&&(i.type=tt.NODE_NEIGHBOR,i.node=i.nodes[1],i.neighbor=i.nodes[0],i.nodes=null)}}];gv.forEach(function(t){return t.regexObj=new RegExp("^"+t.regex)});var jR=function(e){for(var r,n,i,s=0;s<gv.length;s++){var o=gv[s],a=o.name,l=e.match(o.regexObj);if(l!=null){n=l,r=o,i=a;var u=l[0];e=e.substring(u.length);break}}return{expr:r,match:n,name:i,remaining:e}},zR=function(e){var r=e.match(/^\s+/);if(r){var n=r[0];e=e.substring(n.length)}return e},HR=function(e){var r=this,n=r.inputText=e,i=r[0]=jt();for(r.length=1,n=zR(n);;){var s=jR(n);if(s.expr==null)return Bt("The selector `"+e+"`is invalid"),!1;var o=s.match.slice(1),a=s.expr.populate(r,i,o);if(a===!1)return!1;if(a!=null&&(i=a),n=s.remaining,n.match(/^\s*$/))break}var l=r[r.length-1];r.currentSubject!=null&&(l.subject=r.currentSubject),l.edgeCount=r.edgeCount,l.compoundCount=r.compoundCount;for(var u=0;u<r.length;u++){var c=r[u];if(c.compoundCount>0&&c.edgeCount>0)return Bt("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(c.edgeCount>1)return Bt("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;c.edgeCount===1&&Bt("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(c){return c??""},r=function(c){return ut(c)?'"'+c+'"':e(c)},n=function(c){return" "+c+" "},i=function(c,h){var g=c.type,p=c.value;switch(g){case tt.GROUP:{var x=e(p);return x.substring(0,x.length-1)}case tt.DATA_COMPARE:{var w=c.field,v=c.operator;return"["+w+n(e(v))+r(p)+"]"}case tt.DATA_BOOL:{var m=c.operator,y=c.field;return"["+e(m)+y+"]"}case tt.DATA_EXIST:{var b=c.field;return"["+b+"]"}case tt.META_COMPARE:{var _=c.operator,R=c.field;return"[["+R+n(e(_))+r(p)+"]]"}case tt.STATE:return p;case tt.ID:return"#"+p;case tt.CLASS:return"."+p;case tt.PARENT:case tt.CHILD:return s(c.parent,h)+n(">")+s(c.child,h);case tt.ANCESTOR:case tt.DESCENDANT:return s(c.ancestor,h)+" "+s(c.descendant,h);case tt.COMPOUND_SPLIT:{var E=s(c.left,h),T=s(c.subject,h),k=s(c.right,h);return E+(E.length>0?" ":"")+T+k}case tt.TRUE:return""}},s=function(c,h){return c.checks.reduce(function(g,p,x){return g+(h===c&&x===0?"$":"")+i(p,h)},"")},o="",a=0;a<this.length;a++){var l=this[a];o+=s(l,l.subject),this.length>1&&a<this.length-1&&(o+=", ")}return this.toStringCache=o,o},WR={parse:HR,toString:UR},Gw=function(e,r,n){var i,s=ut(e),o=Xe(e),a=ut(n),l,u,c=!1,h=!1,g=!1;switch(r.indexOf("!")>=0&&(r=r.replace("!",""),h=!0),r.indexOf("@")>=0&&(r=r.replace("@",""),c=!0),(s||a||c)&&(l=!s&&!o?"":""+e,u=""+n),c&&(e=l=l.toLowerCase(),n=u=u.toLowerCase()),r){case"*=":i=l.indexOf(u)>=0;break;case"$=":i=l.indexOf(u,l.length-u.length)>=0;break;case"^=":i=l.indexOf(u)===0;break;case"=":i=e===n;break;case">":g=!0,i=e>n;break;case">=":g=!0,i=e>=n;break;case"<":g=!0,i=e<n;break;case"<=":g=!0,i=e<=n;break;default:i=!1;break}return h&&(e!=null||!g)&&(i=!i),i},VR=function(e,r){switch(r){case"?":return!!e;case"!":return!e;case"^":return e===void 0}},$R=function(e){return e!==void 0},ig=function(e,r){return e.data(r)},GR=function(e,r){return e[r]()},sr=[],Xt=function(e,r){return e.checks.every(function(n){return sr[n.type](n,r)})};sr[tt.GROUP]=function(t,e){var r=t.value;return r==="*"||r===e.group()};sr[tt.STATE]=function(t,e){var r=t.value;return BR(r,e)};sr[tt.ID]=function(t,e){var r=t.value;return e.id()===r};sr[tt.CLASS]=function(t,e){var r=t.value;return e.hasClass(r)};sr[tt.META_COMPARE]=function(t,e){var r=t.field,n=t.operator,i=t.value;return Gw(GR(e,r),n,i)};sr[tt.DATA_COMPARE]=function(t,e){var r=t.field,n=t.operator,i=t.value;return Gw(ig(e,r),n,i)};sr[tt.DATA_BOOL]=function(t,e){var r=t.field,n=t.operator;return VR(ig(e,r),n)};sr[tt.DATA_EXIST]=function(t,e){var r=t.field;return t.operator,$R(ig(e,r))};sr[tt.UNDIRECTED_EDGE]=function(t,e){var r=t.nodes[0],n=t.nodes[1],i=e.source(),s=e.target();return Xt(r,i)&&Xt(n,s)||Xt(n,i)&&Xt(r,s)};sr[tt.NODE_NEIGHBOR]=function(t,e){return Xt(t.node,e)&&e.neighborhood().some(function(r){return r.isNode()&&Xt(t.neighbor,r)})};sr[tt.DIRECTED_EDGE]=function(t,e){return Xt(t.source,e.source())&&Xt(t.target,e.target())};sr[tt.NODE_SOURCE]=function(t,e){return Xt(t.source,e)&&e.outgoers().some(function(r){return r.isNode()&&Xt(t.target,r)})};sr[tt.NODE_TARGET]=function(t,e){return Xt(t.target,e)&&e.incomers().some(function(r){return r.isNode()&&Xt(t.source,r)})};sr[tt.CHILD]=function(t,e){return Xt(t.child,e)&&Xt(t.parent,e.parent())};sr[tt.PARENT]=function(t,e){return Xt(t.parent,e)&&e.children().some(function(r){return Xt(t.child,r)})};sr[tt.DESCENDANT]=function(t,e){return Xt(t.descendant,e)&&e.ancestors().some(function(r){return Xt(t.ancestor,r)})};sr[tt.ANCESTOR]=function(t,e){return Xt(t.ancestor,e)&&e.descendants().some(function(r){return Xt(t.descendant,r)})};sr[tt.COMPOUND_SPLIT]=function(t,e){return Xt(t.subject,e)&&Xt(t.left,e)&&Xt(t.right,e)};sr[tt.TRUE]=function(){return!0};sr[tt.COLLECTION]=function(t,e){var r=t.value;return r.has(e)};sr[tt.FILTER]=function(t,e){var r=t.value;return r(e)};var qR=function(e){var r=this;if(r.length===1&&r[0].checks.length===1&&r[0].checks[0].type===tt.ID)return e.getElementById(r[0].checks[0].value).collection();var n=function(s){for(var o=0;o<r.length;o++){var a=r[o];if(Xt(a,s))return!0}return!1};return r.text()==null&&(n=function(){return!0}),e.filter(n)},YR=function(e){for(var r=this,n=0;n<r.length;n++){var i=r[n];if(Xt(i,e))return!0}return!1},XR={matches:YR,filter:qR},ea=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,e==null||ut(e)&&e.match(/^\s*$/)||(mn(e)?this.addQuery({checks:[{type:tt.COLLECTION,value:e.collection()}]}):nr(e)?this.addQuery({checks:[{type:tt.FILTER,value:e}]}):ut(e)?this.parse(e)||(this.invalid=!0):Jt("A selector must be created from a string; found "))},ta=ea.prototype;[WR,XR].forEach(function(t){return dt(ta,t)});ta.text=function(){return this.inputText};ta.size=function(){return this.length};ta.eq=function(t){return this[t]};ta.sameText=function(t){return!this.invalid&&!t.invalid&&this.text()===t.text()};ta.addQuery=function(t){this[this.length++]=t};ta.selector=ta.toString;var Xi={allAre:function(e){var r=new ea(e);return this.every(function(n){return r.matches(n)})},is:function(e){var r=new ea(e);return this.some(function(n){return r.matches(n)})},some:function(e,r){for(var n=0;n<this.length;n++){var i=r?e.apply(r,[this[n],n,this]):e(this[n],n,this);if(i)return!0}return!1},every:function(e,r){for(var n=0;n<this.length;n++){var i=r?e.apply(r,[this[n],n,this]):e(this[n],n,this);if(!i)return!1}return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var r=this.length,n=e.length;return r!==n?!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(n){return r.hasElementWithId(n.id())})},contains:function(e){e=this.cy().collection(e);var r=this;return e.every(function(n){return r.hasElementWithId(n.id())})}};Xi.allAreNeighbours=Xi.allAreNeighbors;Xi.has=Xi.contains;Xi.equal=Xi.equals=Xi.same;var Ln=function(e,r){return function(i,s,o,a){var l=i,u=this,c;if(l==null?c="":mn(l)&&l.length===1&&(c=l.id()),u.length===1&&c){var h=u[0]._private,g=h.traversalCache=h.traversalCache||{},p=g[r]=g[r]||[],x=Oa(c),w=p[x];return w||(p[x]=e.call(u,i,s,o,a))}else return e.call(u,i,s,o,a)}},Hs={parent:function(e){var r=[];if(this.length===1){var n=this[0]._private.parent;if(n)return n}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=[],n=this.parent();n.nonempty();){for(var i=0;i<n.length;i++){var s=n[i];r.push(s)}n=n.parent()}return this.spawn(r,!0).filter(e)},commonAncestors:function(e){for(var r,n=0;n<this.length;n++){var i=this[n],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:Ln(function(t){for(var e=[],r=0;r<this.length;r++)for(var n=this[r],i=n._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 n(i){for(var s=0;s<i.length;s++){var o=i[s];r.push(o),o.children().nonempty()&&n(o.children())}}return n(this.children()),this.spawn(r,!0).filter(e)}};function ag(t,e,r,n){for(var i=[],s=new Gs,o=t.cy(),a=o.hasCompoundNodes(),l=0;l<t.length;l++){var u=t[l];r?i.push(u):a&&n(i,s,u)}for(;i.length>0;){var c=i.shift();e(c),s.add(c.id()),a&&n(i,s,c)}return t}function qw(t,e,r){if(r.isParent())for(var n=r._private.children,i=0;i<n.length;i++){var s=n[i];e.has(s.id())||t.push(s)}}Hs.forEachDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return ag(this,t,e,qw)};function Yw(t,e,r){if(r.isChild()){var n=r._private.parent;e.has(n.id())||t.push(n)}}Hs.forEachUp=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return ag(this,t,e,Yw)};function KR(t,e,r){Yw(t,e,r),qw(t,e,r)}Hs.forEachUpAndDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return ag(this,t,e,KR)};Hs.ancestors=Hs.parents;var pl,Xw;pl=Xw={data:Ot.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:Ot.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Ot.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Ot.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Ot.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Ot.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}};pl.attr=pl.data;pl.removeAttr=pl.removeData;var QR=Xw,Zc={};function Cp(t){return function(e){var r=this;if(e===void 0&&(e=!0),r.length!==0)if(r.isNode()&&!r.removed()){for(var n=0,i=r[0],s=i._private.edges,o=0;o<s.length;o++){var a=s[o];!e&&a.isLoop()||(n+=t(i,a))}return n}else return}}dt(Zc,{degree:Cp(function(t,e){return e.source().same(e.target())?2:1}),indegree:Cp(function(t,e){return e.target().same(t)?1:0}),outdegree:Cp(function(t,e){return e.source().same(t)?1:0})});function ys(t,e){return function(r){for(var n,i=this.nodes(),s=0;s<i.length;s++){var o=i[s],a=o[t](r);a!==void 0&&(n===void 0||e(a,n))&&(n=a)}return n}}dt(Zc,{minDegree:ys("degree",function(t,e){return t<e}),maxDegree:ys("degree",function(t,e){return t>e}),minIndegree:ys("indegree",function(t,e){return t<e}),maxIndegree:ys("indegree",function(t,e){return t>e}),minOutdegree:ys("outdegree",function(t,e){return t<e}),maxOutdegree:ys("outdegree",function(t,e){return t>e})});dt(Zc,{totalDegree:function(e){for(var r=0,n=this.nodes(),i=0;i<n.length;i++)r+=n[i].degree(e);return r}});var jn,Kw,Qw=function(e,r,n){for(var i=0;i<e.length;i++){var s=e[i];if(!s.locked()){var o=s._private.position,a={x:r.x!=null?r.x-o.x:0,y:r.y!=null?r.y-o.y:0};s.isParent()&&!(a.x===0&&a.y===0)&&s.children().shift(a,n),s.dirtyBoundingBoxCache()}}},Jx={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){Qw(e,r,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};jn=Kw={position:Ot.data(Jx),silentPosition:Ot.data(dt({},Jx,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,r){Qw(e,r,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,r){if(Dt(e))r?this.silentPosition(e):this.position(e);else if(nr(e)){var n=e,i=this.cy();i.startBatch();for(var s=0;s<this.length;s++){var o=this[s],a=void 0;(a=n(o,s))&&(r?o.silentPosition(a):o.position(a))}i.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,r,n){var i;if(Dt(e)?(i={x:Xe(e.x)?e.x:0,y:Xe(e.y)?e.y:0},n=r):ut(e)&&Xe(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 a=this[o];if(!(s.hasCompoundNodes()&&a.isChild()&&a.ancestors().anySame(this))){var l=a.position(),u={x:l.x+i.x,y:l.y+i.y};n?a.silentPosition(u):a.position(u)}}s.endBatch()}return this},silentShift:function(e,r){return Dt(e)?this.shift(e,!0):ut(e)&&Xe(r)&&this.shift(e,r,!0),this},renderedPosition:function(e,r){var n=this[0],i=this.cy(),s=i.zoom(),o=i.pan(),a=Dt(e)?e:void 0,l=a!==void 0||r!==void 0&&ut(e);if(n&&n.isNode())if(l)for(var u=0;u<this.length;u++){var c=this[u];r!==void 0?c.position(e,(r-o[e])/s):a!==void 0&&c.position(Ew(a,s,o))}else{var h=n.position();return a=Gc(h,s,o),e===void 0?a:a[e]}else if(!l)return;return this},relativePosition:function(e,r){var n=this[0],i=this.cy(),s=Dt(e)?e:void 0,o=s!==void 0||r!==void 0&&ut(e),a=i.hasCompoundNodes();if(n&&n.isNode())if(o)for(var l=0;l<this.length;l++){var u=this[l],c=a?u.parent():null,h=c&&c.length>0,g=h;h&&(c=c[0]);var p=g?c.position():{x:0,y:0};r!==void 0?u.position(e,r+p[e]):s!==void 0&&u.position({x:s.x+p.x,y:s.y+p.y})}else{var x=n.position(),w=a?n.parent():null,v=w&&w.length>0,m=v;v&&(w=w[0]);var y=m?w.position():{x:0,y:0};return s={x:x.x-y.x,y:x.y-y.y},e===void 0?s:s[e]}else if(!o)return;return this}};jn.modelPosition=jn.point=jn.position;jn.modelPositions=jn.points=jn.positions;jn.renderedPoint=jn.renderedPosition;jn.relativePoint=jn.relativePosition;var ZR=Kw,Us=function(e){switch(e){case"left":case"right-inside":return"left";case"right":case"left-inside":return"right";default:return"center"}},Ws=function(e){switch(e){case"top":case"bottom-inside":return"top";case"bottom":case"top-inside":return"bottom";default:return"center"}},JR=function(e){switch(e){case"left":return"right";case"right":return"left";case"left-inside":return"left";case"right-inside":return"right";default:return"center"}},Fs,sa;Fs=sa={};sa.renderedBoundingBox=function(t){var e=this.boundingBox(t),r=this.cy(),n=r.zoom(),i=r.pan(),s=e.x1*n+i.x,o=e.x2*n+i.x,a=e.y1*n+i.y,l=e.y2*n+i.y;return{x1:s,x2:o,y1:a,y2:l,w:o-s,h:l-a}};sa.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 n=r._private;n.compoundBoundsClean=!1,n.bbCache=null,t||r.emitAndNotify("bounds")}}),this)};sa.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 a=o._private,l=o.children(),u=o.pstyle("compound-sizing-wrt-labels").value==="include",c={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")}},h=l.boundingBox({includeLabels:u,includeOverlays:!1,useCache:!1}),g=a.position;(h.w===0||h.h===0)&&(h={w:o.pstyle("width").pfValue,h:o.pstyle("height").pfValue},h.x1=g.x-h.w/2,h.x2=g.x+h.w/2,h.y1=g.y-h.h/2,h.y2=g.y+h.h/2);function p(N,M,B){var A=0,j=0,D=M+B;return N>0&&D>0&&(A=M/D*N,j=B/D*N),{biasDiff:A,biasComplementDiff:j}}function x(N,M,B,A){if(B.units==="%")switch(A){case"width":return N>0?B.pfValue*N:0;case"height":return M>0?B.pfValue*M:0;case"average":return N>0&&M>0?B.pfValue*(N+M)/2:0;case"min":return N>0&&M>0?N>M?B.pfValue*M:B.pfValue*N:0;case"max":return N>0&&M>0?N>M?B.pfValue*N:B.pfValue*M:0;default:return 0}else return B.units==="px"?B.pfValue:0}var w=c.width.left.value;c.width.left.units==="px"&&c.width.val>0&&(w=w*100/c.width.val);var v=c.width.right.value;c.width.right.units==="px"&&c.width.val>0&&(v=v*100/c.width.val);var m=c.height.top.value;c.height.top.units==="px"&&c.height.val>0&&(m=m*100/c.height.val);var y=c.height.bottom.value;c.height.bottom.units==="px"&&c.height.val>0&&(y=y*100/c.height.val);var b=p(c.width.val-h.w,w,v),_=b.biasDiff,R=b.biasComplementDiff,E=p(c.height.val-h.h,m,y),T=E.biasDiff,k=E.biasComplementDiff;a.autoPadding=x(h.w,h.h,o.pstyle("padding"),o.pstyle("padding-relative-to").value),a.autoWidth=Math.max(h.w,c.width.val),g.x=(-_+h.x1+h.x2+R)/2,a.autoHeight=Math.max(h.h,c.height.val),g.y=(-T+h.y1+h.y2+k)/2}for(var n=0;n<this.length;n++){var i=this[n],s=i._private;(!s.compoundBoundsClean||t)&&(r(i),e.batching()||(s.compoundBoundsClean=!0))}return this};var Tn=function(e){return e===1/0||e===-1/0?0:e},Fn=function(e,r,n,i,s){i-r===0||s-n===0||r==null||n==null||i==null||s==null||(e.x1=r<e.x1?r:e.x1,e.x2=i>e.x2?i:e.x2,e.y1=n<e.y1?n:e.y1,e.y2=s>e.y2?s:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},Vi=function(e,r){return r==null?e:Fn(e,r.x1,r.y1,r.x2,r.y2)},jo=function(e,r,n){return Yr(e,r,n)},Xu=function(e,r,n){if(!r.cy().headless()){var i=r._private,s=i.rstyle,o=s.arrowWidth/2,a=r.pstyle(n+"-arrow-shape").value,l,u;if(a!=="none"){n==="source"?(l=s.srcX,u=s.srcY):n==="target"?(l=s.tgtX,u=s.tgtY):(l=s.midX,u=s.midY);var c=i.arrowBounds=i.arrowBounds||{},h=c[n]=c[n]||{};h.x1=l-o,h.y1=u-o,h.x2=l+o,h.y2=u+o,h.w=h.x2-h.x1,h.h=h.y2-h.y1,uc(h,1),Fn(e,h.x1,h.y1,h.x2,h.y2)}}},Ep=function(e,r,n){if(!r.cy().headless()){var i;n?i=n+"-":i="";var s=r._private,o=s.rstyle,a=r.pstyle(i+"label").strValue;if(a){var l=r.pstyle("text-halign"),u=r.pstyle("text-valign"),c=jo(o,"labelWidth",n),h=jo(o,"labelHeight",n),g=jo(o,"labelX",n),p=jo(o,"labelY",n),x=r.pstyle(i+"text-margin-x").pfValue,w=r.pstyle(i+"text-margin-y").pfValue,v=r.isEdge(),m=r.pstyle(i+"text-rotation"),y=r.pstyle("text-outline-width").pfValue,b=r.pstyle("text-border-width").pfValue,_=b/2,R=r.pstyle("text-background-padding").pfValue,E=2,T=h,k=c,N=k/2,M=T/2,B,A,j,D;if(v)B=g-N,A=g+N,j=p-M,D=p+M;else{switch(Us(l.value)){case"left":B=g-k,A=g;break;case"center":B=g-N,A=g+N;break;case"right":B=g,A=g+k;break}switch(Ws(u.value)){case"top":j=p-T,D=p;break;case"center":j=p-M,D=p+M;break;case"bottom":j=p,D=p+T;break}}var I=x-Math.max(y,_)-R-E,U=x+Math.max(y,_)+R+E,W=w-Math.max(y,_)-R-E,H=w+Math.max(y,_)+R+E;B+=I,A+=U,j+=W,D+=H;var z=n||"main",P=s.labelBounds,F=P[z]=P[z]||{};F.x1=B,F.y1=j,F.x2=A,F.y2=D,F.w=A-B,F.h=D-j,F.leftPad=I,F.rightPad=U,F.topPad=W,F.botPad=H;var G=v&&m.strValue==="autorotate",$=m.pfValue!=null&&m.pfValue!==0;if(G||$){var ee=G?jo(s.rstyle,"labelAngle",n):m.pfValue,re=Math.cos(ee),ne=Math.sin(ee),Y=(B+A)/2,q=(j+D)/2;if(!v){switch(Us(l.value)){case"left":Y=A;break;case"right":Y=B;break}switch(Ws(u.value)){case"top":q=D;break;case"bottom":q=j;break}}var K=function(_e,ke){return _e=_e-Y,ke=ke-q,{x:_e*re-ke*ne+Y,y:_e*ne+ke*re+q}},X=K(B,j),J=K(B,D),ie=K(A,j),ce=K(A,D);B=Math.min(X.x,J.x,ie.x,ce.x),A=Math.max(X.x,J.x,ie.x,ce.x),j=Math.min(X.y,J.y,ie.y,ce.y),D=Math.max(X.y,J.y,ie.y,ce.y)}var de=z+"Rot",Le=P[de]=P[de]||{};Le.x1=B,Le.y1=j,Le.x2=A,Le.y2=D,Le.w=A-B,Le.h=D-j,Fn(e,B,j,A,D),Fn(s.labelBounds.all,B,j,A,D)}return e}},e1=function(e,r){if(!r.cy().headless()){var n=r.pstyle("outline-opacity").value,i=r.pstyle("outline-width").value,s=r.pstyle("outline-offset").value,o=i+s;Zw(e,r,n,o,"outside",o/2)}},Zw=function(e,r,n,i,s,o){if(!(n===0||i<=0||s==="inside")){var a=r.cy(),l=a.renderer(),u=l.nodeShapes[l.getNodeShape(r)];if(u){var c=r.position(),h=c.x,g=c.y,p=r.width(),x=r.height();if(u.hasMiterBounds){s==="center"&&(i/=2);var w=u.miterBounds(h,g,p,x,i);Vi(e,w)}else o!=null&&o>0&&cc(e,[o,o,o,o])}}},eL=function(e,r){if(!r.cy().headless()){var n=r.pstyle("border-opacity").value,i=r.pstyle("border-width").pfValue,s=r.pstyle("border-position").value;Zw(e,r,n,i,s)}},tL=function(e,r){var n=e._private.cy,i=n.styleEnabled(),s=n.headless(),o=Kr(),a=e._private,l=e.isNode(),u=e.isEdge(),c,h,g,p,x,w,v=a.rstyle,m=l&&i?e.pstyle("bounds-expansion").pfValue:[0],y=function(je){return je.pstyle("display").value!=="none"},b=!i||y(e)&&(!u||y(e.source())&&y(e.target()));if(b){var _=0,R=0;i&&r.includeOverlays&&(_=e.pstyle("overlay-opacity").value,_!==0&&(R=e.pstyle("overlay-padding").value));var E=0,T=0;i&&r.includeUnderlays&&(E=e.pstyle("underlay-opacity").value,E!==0&&(T=e.pstyle("underlay-padding").value));var k=Math.max(R,T),N=0,M=0;if(i&&(N=e.pstyle("width").pfValue,M=N/2),l&&r.includeNodes){var B=e.position();x=B.x,w=B.y;var A=e.outerWidth(),j=A/2,D=e.outerHeight(),I=D/2;c=x-j,h=x+j,g=w-I,p=w+I,Fn(o,c,g,h,p),i&&e1(o,e),i&&r.includeOutlines&&!s&&e1(o,e),i&&eL(o,e)}else if(u&&r.includeEdges)if(i&&!s){var U=e.pstyle("curve-style").strValue;if(c=Math.min(v.srcX,v.midX,v.tgtX),h=Math.max(v.srcX,v.midX,v.tgtX),g=Math.min(v.srcY,v.midY,v.tgtY),p=Math.max(v.srcY,v.midY,v.tgtY),c-=M,h+=M,g-=M,p+=M,Fn(o,c,g,h,p),U==="haystack"){var W=v.haystackPts;if(W&&W.length===2){if(c=W[0].x,g=W[0].y,h=W[1].x,p=W[1].y,c>h){var H=c;c=h,h=H}if(g>p){var z=g;g=p,p=z}Fn(o,c-M,g-M,h+M,p+M)}}else if(U==="bezier"||U==="unbundled-bezier"||Gi(U,"segments")||Gi(U,"taxi")){var P;switch(U){case"bezier":case"unbundled-bezier":P=v.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":P=v.linePts;break}if(P!=null)for(var F=0;F<P.length;F++){var G=P[F];c=G.x-M,h=G.x+M,g=G.y-M,p=G.y+M,Fn(o,c,g,h,p)}}}else{var $=e.source(),ee=$.position(),re=e.target(),ne=re.position();if(c=ee.x,h=ne.x,g=ee.y,p=ne.y,c>h){var Y=c;c=h,h=Y}if(g>p){var q=g;g=p,p=q}c-=M,h+=M,g-=M,p+=M,Fn(o,c,g,h,p)}if(i&&r.includeEdges&&u&&(Xu(o,e,"mid-source"),Xu(o,e,"mid-target"),Xu(o,e,"source"),Xu(o,e,"target")),i){var K=e.pstyle("ghost").value==="yes";if(K){var X=e.pstyle("ghost-offset-x").pfValue,J=e.pstyle("ghost-offset-y").pfValue;Fn(o,o.x1+X,o.y1+J,o.x2+X,o.y2+J)}}var ie=a.bodyBounds=a.bodyBounds||{};j0(ie,o),cc(ie,m),uc(ie,1),i&&(c=o.x1,h=o.x2,g=o.y1,p=o.y2,Fn(o,c-k,g-k,h+k,p+k));var ce=a.overlayBounds=a.overlayBounds||{};j0(ce,o),cc(ce,m),uc(ce,1);var de=a.labelBounds=a.labelBounds||{};de.all!=null?I3(de.all):de.all=Kr(),i&&r.includeLabels&&(r.includeMainLabels&&Ep(o,e,null),u&&(r.includeSourceLabels&&Ep(o,e,"source"),r.includeTargetLabels&&Ep(o,e,"target")))}return o.x1=Tn(o.x1),o.y1=Tn(o.y1),o.x2=Tn(o.x2),o.y2=Tn(o.y2),o.w=Tn(o.x2-o.x1),o.h=Tn(o.y2-o.y1),o.w>0&&o.h>0&&b&&(cc(o,m),uc(o,1)),o},Jw=function(e){var r=0,n=function(o){return(o?1:0)<<r++},i=0;return i+=n(e.incudeNodes),i+=n(e.includeEdges),i+=n(e.includeLabels),i+=n(e.includeMainLabels),i+=n(e.includeSourceLabels),i+=n(e.includeTargetLabels),i+=n(e.includeOverlays),i+=n(e.includeOutlines),i},e_=function(e){var r=function(a){return Math.round(a)};if(e.isEdge()){var n=e.source().position(),i=e.target().position();return M0([r(n.x),r(n.y),r(i.x),r(i.y)])}else{var s=e.position();return M0([r(s.x),r(s.y)])}},t1=function(e,r){var n=e._private,i,s=e.isEdge(),o=r==null?r1:Jw(r),a=o===r1;if(n.bbCache==null?(i=tL(e,vl),n.bbCache=i,n.bbCachePosKey=e_(e)):i=n.bbCache,!a){var l=e.isNode();i=Kr(),(r.includeNodes&&l||r.includeEdges&&!l)&&(r.includeOverlays?Vi(i,n.overlayBounds):Vi(i,n.bodyBounds)),r.includeLabels&&(r.includeMainLabels&&(!s||r.includeSourceLabels&&r.includeTargetLabels)?Vi(i,n.labelBounds.all):(r.includeMainLabels&&Vi(i,n.labelBounds.mainRot),r.includeSourceLabels&&Vi(i,n.labelBounds.sourceRot),r.includeTargetLabels&&Vi(i,n.labelBounds.targetRot))),i.w=i.x2-i.x1,i.h=i.y2-i.y1}return i},vl={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},r1=Jw(vl),n1=Ar(vl);sa.boundingBox=function(t){var e,r=t===void 0||t.useCache===void 0||t.useCache===!0,n=js(function(c){var h=c._private;return h.bbCache==null||h.styleDirty||h.bbCachePosKey!==e_(c)},function(c){return c.id()});if(r&&this.length===1&&!n(this[0]))t===void 0?t=vl:t=n1(t),e=t1(this[0],t);else{e=Kr(),t=t||vl;var i=n1(t),s=this,o=s.cy(),a=o.styleEnabled();this.edges().forEach(n),this.nodes().forEach(n),a&&this.recalculateRenderedStyle(r),this.updateCompoundBounds(!r);for(var l=0;l<s.length;l++){var u=s[l];n(u)&&u.dirtyBoundingBoxCache(),Vi(e,t1(u,i))}}return e.x1=Tn(e.x1),e.y1=Tn(e.y1),e.x2=Tn(e.x2),e.y2=Tn(e.y2),e.w=Tn(e.x2-e.x1),e.h=Tn(e.y2-e.y1),e};sa.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};sa.boundingBoxAt=function(t){var e=this.nodes(),r=this.cy(),n=r.hasCompoundNodes(),i=r.collection();if(n&&(i=e.filter(function(u){return u.isParent()}),e=e.not(i)),Dt(t)){var s=t;t=function(){return s}}var o=function(c,h){return c._private.bbAtOldPos=t(c,h)},a=function(c){return c._private.bbAtOldPos};r.startBatch(),e.forEach(o).silentPositions(t),n&&(i.dirtyCompoundBoundsCache(),i.dirtyBoundingBoxCache(),i.updateCompoundBounds(!0));var l=P3(this.boundingBox({useCache:!1}));return e.silentPositions(a),n&&(i.dirtyCompoundBoundsCache(),i.dirtyBoundingBoxCache(),i.updateCompoundBounds(!0)),r.endBatch(),l};Fs.boundingbox=Fs.bb=Fs.boundingBox;Fs.renderedBoundingbox=Fs.renderedBoundingBox;var rL=sa,Jo,Rl;Jo=Rl={};var t_=function(e){e.uppercaseName=y0(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=y0(e.outerName),Jo[e.name]=function(){var n=this[0],i=n._private,s=i.cy,o=s._private.styleEnabled;if(n)if(o){if(n.isParent())return n.updateCompoundBounds(),i[e.autoName]||0;var a=n.pstyle(e.name);switch(a.strValue){case"label":return n.recalculateRenderedStyle(),i.rstyle[e.labelName]||0;default:return a.pfValue}}else return 1},Jo["outer"+e.uppercaseName]=function(){var n=this[0],i=n._private,s=i.cy,o=s._private.styleEnabled;if(n)if(o){var a=n[e.name](),l=n.pstyle("border-position").value,u;l==="center"?u=n.pstyle("border-width").pfValue:l==="outside"?u=2*n.pstyle("border-width").pfValue:u=0;var c=2*n.padding();return a+u+c}else return 1},Jo["rendered"+e.uppercaseName]=function(){var n=this[0];if(n){var i=n[e.name]();return i*this.cy().zoom()}},Jo["rendered"+e.uppercaseOuterName]=function(){var n=this[0];if(n){var i=n[e.outerName]();return i*this.cy().zoom()}}};t_({name:"width"});t_({name:"height"});Rl.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};Rl.paddedHeight=function(){var t=this[0];return t.height()+2*t.padding()};Rl.paddedWidth=function(){var t=this[0];return t.width()+2*t.padding()};var nL=Rl,iL=function(e,r){if(e.isEdge()&&e.takesUpSpace())return r(e)},aL=function(e,r){if(e.isEdge()&&e.takesUpSpace()){var n=e.cy();return Gc(r(e),n.zoom(),n.pan())}},sL=function(e,r){if(e.isEdge()&&e.takesUpSpace()){var n=e.cy(),i=n.pan(),s=n.zoom();return r(e).map(function(o){return Gc(o,s,i)})}},oL=function(e){return e.renderer().getControlPoints(e)},lL=function(e){return e.renderer().getSegmentPoints(e)},uL=function(e){return e.renderer().getSourceEndpoint(e)},cL=function(e){return e.renderer().getTargetEndpoint(e)},hL=function(e){return e.renderer().getEdgeMidpoint(e)},i1={controlPoints:{get:oL,mult:!0},segmentPoints:{get:lL,mult:!0},sourceEndpoint:{get:uL},targetEndpoint:{get:cL},midpoint:{get:hL}},fL=function(e){return"rendered"+e[0].toUpperCase()+e.substr(1)},dL=Object.keys(i1).reduce(function(t,e){var r=i1[e],n=fL(e);return t[e]=function(){return iL(this,r.get)},r.mult?t[n]=function(){return sL(this,r.get)}:t[n]=function(){return aL(this,r.get)},t},{}),pL=dt({},ZR,rL,nL,dL);/*!
53
+ Event object based on jQuery events, MIT license
54
+
55
+ https://jquery.org/license/
56
+ https://tldrlegal.com/license/mit-license
57
+ https://github.com/jquery/jquery/blob/master/src/event.js
58
+ */var r_=function(e,r){this.recycle(e,r)};function zo(){return!1}function Ku(){return!0}r_.prototype={instanceString:function(){return"event"},recycle:function(e,r){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=zo,e!=null&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?Ku:zo):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 n=this.position,i=this.cy.zoom(),s=this.cy.pan();this.renderedPosition={x:n.x*i+s.x,y:n.y*i+s.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=Ku;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=Ku;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Ku,this.stopPropagation()},isDefaultPrevented:zo,isPropagationStopped:zo,isImmediatePropagationStopped:zo};var n_=/^([^.]+)(\.(?:[^.]+))?$/,vL=".*",i_={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},a1=Object.keys(i_),gL={};function Jc(){for(var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:gL,e=arguments.length>1?arguments[1]:void 0,r=0;r<a1.length;r++){var n=a1[r];this[n]=t[n]||i_[n]}this.context=e||this.context,this.listeners=[],this.emitting=0}var ra=Jc.prototype,a_=function(e,r,n,i,s,o,a){nr(i)&&(s=i,i=null),a&&(o==null?o=a:o=dt({},o,a));for(var l=Ut(n)?n:n.split(/\s+/),u=0;u<l.length;u++){var c=l[u];if(!Qi(c)){var h=c.match(n_);if(h){var g=h[1],p=h[2]?h[2]:null,x=r(e,c,g,p,i,s,o);if(x===!1)break}}}},s1=function(e,r){return e.addEventFields(e.context,r),new r_(r.type,r)},mL=function(e,r,n){if(_k(n)){r(e,n);return}else if(Dt(n)){r(e,s1(e,n));return}for(var i=Ut(n)?n:n.split(/\s+/),s=0;s<i.length;s++){var o=i[s];if(!Qi(o)){var a=o.match(n_);if(a){var l=a[1],u=a[2]?a[2]:null,c=s1(e,{type:l,namespace:u,target:e.context});r(e,c)}}}};ra.on=ra.addListener=function(t,e,r,n,i){return a_(this,function(s,o,a,l,u,c,h){nr(c)&&s.listeners.push({event:o,callback:c,type:a,namespace:l,qualifier:u,conf:h})},t,e,r,n,i),this};ra.one=function(t,e,r,n){return this.on(t,e,r,n,{one:!0})};ra.removeListener=ra.off=function(t,e,r,n){var i=this;this.emitting!==0&&(this.listeners=i3(this.listeners));for(var s=this.listeners,o=function(u){var c=s[u];a_(i,function(h,g,p,x,w,v){if((c.type===p||t==="*")&&(!x&&c.namespace!==".*"||c.namespace===x)&&(!w||h.qualifierCompare(c.qualifier,w))&&(!v||c.callback===v))return s.splice(u,1),!1},t,e,r,n)},a=s.length-1;a>=0;a--)o(a);return this};ra.removeAllListeners=function(){return this.removeListener("*")};ra.emit=ra.trigger=function(t,e,r){var n=this.listeners,i=n.length;return this.emitting++,Ut(e)||(e=[e]),mL(this,function(s,o){r!=null&&(n=[{event:o.event,type:o.type,namespace:o.namespace,callback:r}],i=n.length);for(var a=function(){var c=n[l];if(c.type===o.type&&(!c.namespace||c.namespace===o.namespace||c.namespace===vL)&&s.eventMatches(s.context,c,o)){var h=[o];e!=null&&s3(h,e),s.beforeEmit(s.context,c,o),c.conf&&c.conf.one&&(s.listeners=s.listeners.filter(function(x){return x!==c}));var g=s.callbackContext(s.context,c,o),p=c.callback.apply(g,h);s.afterEmit(s.context,c,o),p===!1&&(o.stopPropagation(),o.preventDefault())}},l=0;l<i;l++)a();s.bubble(s.context)&&!o.isPropagationStopped()&&s.parent(s.context).emit(o,e)},t),this.emitting--,this};var yL={qualifierCompare:function(e,r){return e==null||r==null?e==null&&r==null:e.sameText(r)},eventMatches:function(e,r,n){var i=r.qualifier;return i!=null?e!==n.target&&_l(n.target)&&i.matches(n.target):!0},addEventFields:function(e,r){r.cy=e.cy(),r.target=e},callbackContext:function(e,r,n){return r.qualifier!=null?n.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()}},Qu=function(e){return ut(e)?new ea(e):e},s_={createEmitter:function(){for(var e=0;e<this.length;e++){var r=this[e],n=r._private;n.emitter||(n.emitter=new Jc(yL,r))}return this},emitter:function(){return this._private.emitter},on:function(e,r,n){for(var i=Qu(r),s=0;s<this.length;s++){var o=this[s];o.emitter().on(e,i,n)}return this},removeListener:function(e,r,n){for(var i=Qu(r),s=0;s<this.length;s++){var o=this[s];o.emitter().removeListener(e,i,n)}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,n){for(var i=Qu(r),s=0;s<this.length;s++){var o=this[s];o.emitter().one(e,i,n)}return this},once:function(e,r,n){for(var i=Qu(r),s=0;s<this.length;s++){var o=this[s];o.emitter().on(e,i,n,{once:!0,onceCollection:this})}},emit:function(e,r){for(var n=0;n<this.length;n++){var i=this[n];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}};Ot.eventAliasesOn(s_);var o_={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(),n=0;n<this.length;n++){var i=this[n];i.isNode()?e.push(i):r.push(i)}return{nodes:e,edges:r}},filter:function(e,r){if(e===void 0)return this;if(ut(e)||mn(e))return new ea(e).filter(this);if(nr(e)){for(var n=this.spawn(),i=this,s=0;s<i.length;s++){var o=i[s],a=r?e.apply(r,[o,s,i]):e(o,s,i);a&&n.push(o)}return n}return this.spawn()},not:function(e){if(e){ut(e)&&(e=this.filter(e));for(var r=this.spawn(),n=0;n<this.length;n++){var i=this[n],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(ut(e)){var r=e;return this.filter(r)}for(var n=this.spawn(),i=this,s=e,o=this.length<e.length,a=o?i:s,l=o?s:i,u=0;u<a.length;u++){var c=a[u];l.has(c)&&n.push(c)}return n},xor:function(e){var r=this._private.cy;ut(e)&&(e=r.$(e));var n=this.spawn(),i=this,s=e,o=function(l,u){for(var c=0;c<l.length;c++){var h=l[c],g=h._private.data.id,p=u.hasElementWithId(g);p||n.push(h)}};return o(i,s),o(s,i),n},diff:function(e){var r=this._private.cy;ut(e)&&(e=r.$(e));var n=this.spawn(),i=this.spawn(),s=this.spawn(),o=this,a=e,l=function(c,h,g){for(var p=0;p<c.length;p++){var x=c[p],w=x._private.data.id,v=h.hasElementWithId(w);v?s.merge(x):g.push(x)}};return l(o,a,n),l(a,o,i),{left:n,right:i,both:s}},add:function(e){var r=this._private.cy;if(!e)return this;if(ut(e)){var n=e;e=r.mutableElements().filter(n)}for(var i=this.spawnSelf(),s=0;s<e.length;s++){var o=e[s],a=!this.has(o);a&&i.push(o)}return i},merge:function(e){var r=this._private,n=r.cy;if(!e)return this;if(e&&ut(e)){var i=e;e=n.mutableElements().filter(i)}for(var s=r.map,o=0;o<e.length;o++){var a=e[o],l=a._private.data.id,u=!s.has(l);if(u){var c=this.length++;this[c]=a,s.set(l,{ele:a,index:c})}}return this},unmergeAt:function(e){var r=this[e],n=r.id(),i=this._private,s=i.map;this[e]=void 0,s.delete(n);var o=e===this.length-1;if(this.length>1&&!o){var a=this.length-1,l=this[a],u=l._private.data.id;this[a]=void 0,this[e]=l,s.set(u,{ele:l,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var r=this._private,n=e._private.data.id,i=r.map,s=i.get(n);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&&ut(e)){var n=e;e=r.mutableElements().filter(n)}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 n=this[r];e(n)&&this.unmergeAt(r)}return this},map:function(e,r){for(var n=[],i=this,s=0;s<i.length;s++){var o=i[s],a=r?e.apply(r,[o,s,i]):e(o,s,i);n.push(a)}return n},reduce:function(e,r){for(var n=r,i=this,s=0;s<i.length;s++)n=e(n,i[s],s,i);return n},max:function(e,r){for(var n=-1/0,i,s=this,o=0;o<s.length;o++){var a=s[o],l=r?e.apply(r,[a,o,s]):e(a,o,s);l>n&&(n=l,i=a)}return{value:n,ele:i}},min:function(e,r){for(var n=1/0,i,s=this,o=0;o<s.length;o++){var a=s[o],l=r?e.apply(r,[a,o,s]):e(a,o,s);l<n&&(n=l,i=a)}return{value:n,ele:i}}},Pt=o_;Pt.u=Pt["|"]=Pt["+"]=Pt.union=Pt.or=Pt.add;Pt["\\"]=Pt["!"]=Pt["-"]=Pt.difference=Pt.relativeComplement=Pt.subtract=Pt.not;Pt.n=Pt["&"]=Pt["."]=Pt.and=Pt.intersection=Pt.intersect;Pt["^"]=Pt["(+)"]=Pt["(-)"]=Pt.symmetricDifference=Pt.symdiff=Pt.xor;Pt.fnFilter=Pt.filterFn=Pt.stdFilter=Pt.filter;Pt.complement=Pt.abscomp=Pt.absoluteComplement;var xL={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}},l_=function(e,r){var n=e.cy(),i=n.hasCompoundNodes();function s(c){var h=c.pstyle("z-compound-depth");return h.value==="auto"?i?c.zDepth():0:h.value==="bottom"?-1:h.value==="top"?Yv:0}var o=s(e)-s(r);if(o!==0)return o;function a(c){var h=c.pstyle("z-index-compare");return h.value==="auto"&&c.isNode()?1:0}var l=a(e)-a(r);if(l!==0)return l;var u=e.pstyle("z-index").value-r.pstyle("z-index").value;return u!==0?u:e.poolIndex()-r.poolIndex()},Dc={forEach:function(e,r){if(nr(e))for(var n=this.length,i=0;i<n;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 n=[],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++)n.push(this[s]);return this.spawn(n)},size:function(){return this.length},eq:function(e){return this[e]||this.spawn()},first:function(){return this[0]||this.spawn()},last:function(){return this[this.length-1]||this.spawn()},empty:function(){return this.length===0},nonempty:function(){return!this.empty()},sort:function(e){if(!nr(e))return this;var r=this.toArray().sort(e);return this.spawn(r)},sortByZIndex:function(){return this.sort(l_)},zDepth:function(){var e=this[0];if(e){var r=e._private,n=r.group;if(n==="nodes"){var i=r.data.parent?e.parents().size():0;return e.isParent()?i:Yv-1}else{var s=r.source,o=r.target,a=s.zDepth(),l=o.zDepth();return Math.max(a,l,0)}}}};Dc.each=Dc.forEach;var bL=function(){var e="undefined",r=(typeof Symbol>"u"?"undefined":xr(Symbol))!=e&&xr(Symbol.iterator)!=e;r&&(Dc[Symbol.iterator]=function(){var n=this,i={value:void 0,done:!1},s=0,o=this.length;return sw({next:function(){return s<o?i.value=n[s++]:(i.value=void 0,i.done=!0),i}},Symbol.iterator,function(){return this})})};bL();var wL=Ar({nodeDimensionsIncludeLabels:!1}),fc={layoutDimensions:function(e){e=wL(e);var r;if(!this.takesUpSpace())r={w:0,h:0};else if(e.nodeDimensionsIncludeLabels){var n=this.boundingBox();r={w:n.w,h:n.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,n){var i=this.nodes().filter(function(R){return!R.isParent()}),s=this.cy(),o=r.eles,a=function(E){return E.id()},l=js(n,a);e.emit({type:"layoutstart",layout:e}),e.animations=[];var u=function(E,T,k){var N={x:T.x1+T.w/2,y:T.y1+T.h/2},M={x:(k.x-N.x)*E,y:(k.y-N.y)*E};return{x:N.x+M.x,y:N.y+M.y}},c=r.spacingFactor&&r.spacingFactor!==1,h=function(){if(!c)return null;for(var E=Kr(),T=0;T<i.length;T++){var k=i[T],N=l(k,T);kw(E,N.x,N.y)}return E},g=h(),p=js(function(R,E){var T=l(R,E);if(c){var k=Math.abs(r.spacingFactor);T=u(k,g,T)}return r.transform!=null&&(T=r.transform(R,T)),T},a);if(r.animate){for(var x=0;x<i.length;x++){var w=i[x],v=p(w,x),m=r.animateFilter==null||r.animateFilter(w,x);if(m){var y=w.animation({position:v,duration:r.animationDuration,easing:r.animationEasing});e.animations.push(y)}else w.position(v)}if(r.fit){var b=s.animation({fit:{boundingBox:o.boundingBoxAt(p),padding:r.padding},duration:r.animationDuration,easing:r.animationEasing});e.animations.push(b)}else if(r.zoom!==void 0&&r.pan!==void 0){var _=s.animation({zoom:r.zoom,pan:r.pan,duration:r.animationDuration,easing:r.animationEasing});e.animations.push(_)}e.animations.forEach(function(R){return R.play()}),e.one("layoutready",r.ready),e.emit({type:"layoutready",layout:e}),qs.all(e.animations.map(function(R){return R.promise()})).then(function(){e.one("layoutstop",r.stop),e.emit({type:"layoutstop",layout:e})})}else i.positions(p),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(dt({},e,{eles:this}))}};fc.createLayout=fc.makeLayout=fc.layout;function u_(t,e,r){var n=r._private,i=n.styleCache=n.styleCache||[],s;return(s=i[t])!=null||(s=i[t]=e(r)),s}function eh(t,e){return t=Oa(t),function(n){return u_(t,e,n)}}function th(t,e){t=Oa(t);var r=function(i){return e.call(i)};return function(){var i=this[0];if(i)return u_(t,r,i)}}var Nr={recalculateRenderedStyle:function(e){var r=this.cy(),n=r.renderer(),i=r.styleEnabled();return n&&i&&n.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e=this.cy(),r=function(s){return s._private.styleCache=null};if(e.hasCompoundNodes()){var n;n=this.spawnSelf().merge(this.descendants()).merge(this.parents()),n.merge(n.connectedEdges()),n.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 n=r._private.batchStyleEles;return n.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(a){return a._private.styleDirty=!0}),this},cleanStyle:function(){var e=this.cy();if(e.styleEnabled())for(var r=0;r<this.length;r++){var n=this[r];n._private.styleDirty&&(n._private.styleDirty=!1,e.style().apply(n))}},parsedStyle:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this[0],i=n.cy();if(i.styleEnabled()&&n){n._private.styleDirty&&(n._private.styleDirty=!1,i.style().apply(n));var s=n._private.style[e];return s??(r?i.style().getDefaultProperty(e):null)}},numericStyle:function(e){var r=this[0];if(r.cy().styleEnabled()&&r){var n=r.pstyle(e);return n.pfValue!==void 0?n.pfValue:n.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 n=this[0];if(n)return r.style().getRenderedStyle(n,e)},style:function(e,r){var n=this.cy();if(!n.styleEnabled())return this;var i=!1,s=n.style();if(Dt(e)){var o=e;s.applyBypass(this,o,i),this.emitAndNotify("style")}else if(ut(e))if(r===void 0){var a=this[0];return a?s.getStylePropertyValue(a,e):void 0}else s.applyBypass(this,e,r,i),this.emitAndNotify("style");else if(e===void 0){var l=this[0];return l?s.getRawStyle(l):void 0}return this},removeStyle:function(e){var r=this.cy();if(!r.styleEnabled())return this;var n=!1,i=r.style(),s=this;if(e===void 0)for(var o=0;o<s.length;o++){var a=s[o];i.removeAllBypasses(a,n)}else{e=e.split(/\s+/);for(var l=0;l<s.length;l++){var u=s[l];i.removeBypasses(u,e,n)}}return this.emitAndNotify("style"),this},show:function(){return this.css("display","element"),this},hide:function(){return this.css("display","none"),this},effectiveOpacity:function(){var e=this.cy();if(!e.styleEnabled())return 1;var r=e.hasCompoundNodes(),n=this[0];if(n){var i=n._private,s=n.pstyle("opacity").value;if(!r)return s;var o=i.data.parent?n.parents():null;if(o)for(var a=0;a<o.length;a++){var l=o[a],u=l.pstyle("opacity").value;s=u*s}return s}},transparent:function(){var e=this.cy();if(!e.styleEnabled())return!1;var r=this[0],n=r.cy().hasCompoundNodes();if(r)return n?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 kp(t,e){var r=t._private,n=r.data.parent?t.parents():null;if(n)for(var i=0;i<n.length;i++){var s=n[i];if(!e(s))return!1}return!0}function sg(t){var e=t.ok,r=t.edgeOkViaNode||t.ok,n=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 a=s._private;if(!e(s))return!1;if(s.isNode())return!o||kp(s,n);var l=a.source,u=a.target;return r(l)&&(!o||kp(l,r))&&(l===u||r(u)&&(!o||kp(u,r)))}}}var Ys=eh("eleTakesUpSpace",function(t){return t.pstyle("display").value==="element"&&t.width()!==0&&(t.isNode()?t.height()!==0:!0)});Nr.takesUpSpace=th("takesUpSpace",sg({ok:Ys}));var _L=eh("eleInteractive",function(t){return t.pstyle("events").value==="yes"&&t.pstyle("visibility").value==="visible"&&Ys(t)}),SL=eh("parentInteractive",function(t){return t.pstyle("visibility").value==="visible"&&Ys(t)});Nr.interactive=th("interactive",sg({ok:_L,parentOk:SL,edgeOkViaNode:Ys}));Nr.noninteractive=function(){var t=this[0];if(t)return!t.interactive()};var CL=eh("eleVisible",function(t){return t.pstyle("visibility").value==="visible"&&t.pstyle("opacity").pfValue!==0&&Ys(t)}),EL=Ys;Nr.visible=th("visible",sg({ok:CL,edgeOkViaNode:EL}));Nr.hidden=function(){var t=this[0];if(t)return!t.visible()};Nr.isBundledBezier=th("isBundledBezier",function(){return this.cy().styleEnabled()?!this.removed()&&this.pstyle("curve-style").value==="bezier"&&this.takesUpSpace():!1});Nr.bypass=Nr.css=Nr.style;Nr.renderedCss=Nr.renderedStyle;Nr.removeBypass=Nr.removeCss=Nr.removeStyle;Nr.pstyle=Nr.parsedStyle;var Ki={};function o1(t){return function(){var e=arguments,r=[];if(e.length===2){var n=e[0],i=e[1];this.on(t.event,n,i)}else if(e.length===1&&nr(e[0])){var s=e[0];this.on(t.event,s)}else if(e.length===0||e.length===1&&Ut(e[0])){for(var o=e.length===1?e[0]:null,a=0;a<this.length;a++){var l=this[a],u=!t.ableField||l._private[t.ableField],c=l._private[t.field]!=t.value;if(t.overrideAble){var h=t.overrideAble(l);if(h!==void 0&&(u=h,!h))return this}u&&(l._private[t.field]=t.value,c&&r.push(l))}var g=this.spawn(r);g.updateStyle(),g.emit(t.event),o&&g.emit(o)}return this}}function Xs(t){Ki[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]}},Ki[t.on]=o1({event:t.on,field:t.field,ableField:t.ableField,overrideAble:t.overrideAble,value:!0}),Ki[t.off]=o1({event:t.off,field:t.field,ableField:t.ableField,overrideAble:t.overrideAble,value:!1})}Xs({field:"locked",overrideField:function(e){return e.cy().autolock()?!0:void 0},on:"lock",off:"unlock"});Xs({field:"grabbable",overrideField:function(e){return e.cy().autoungrabify()||e.pannable()?!1:void 0},on:"grabify",off:"ungrabify"});Xs({field:"selected",ableField:"selectable",overrideAble:function(e){return e.cy().autounselectify()?!1:void 0},on:"select",off:"unselect"});Xs({field:"selectable",overrideField:function(e){return e.cy().autounselectify()?!1:void 0},on:"selectify",off:"unselectify"});Ki.deselect=Ki.unselect;Ki.grabbed=function(){var t=this[0];if(t)return t._private.grabbed};Xs({field:"active",on:"activate",off:"unactivate"});Xs({field:"pannable",on:"panify",off:"unpanify"});Ki.inactive=function(){var t=this[0];if(t)return!t._private.active};var zr={},l1=function(e){return function(n){for(var i=this,s=[],o=0;o<i.length;o++){var a=i[o];if(a.isNode()){for(var l=!1,u=a.connectedEdges(),c=0;c<u.length;c++){var h=u[c],g=h.source(),p=h.target();if(e.noIncomingEdges&&p===a&&g!==a||e.noOutgoingEdges&&g===a&&p!==a){l=!0;break}}l||s.push(a)}}return this.spawn(s,!0).filter(n)}},u1=function(e){return function(r){for(var n=this,i=[],s=0;s<n.length;s++){var o=n[s];if(o.isNode())for(var a=o.connectedEdges(),l=0;l<a.length;l++){var u=a[l],c=u.source(),h=u.target();e.outgoing&&c===o?(i.push(u),i.push(h)):e.incoming&&h===o&&(i.push(u),i.push(c))}}return this.spawn(i,!0).filter(r)}},c1=function(e){return function(r){for(var n=this,i=[],s={};;){var o=e.outgoing?n.outgoers():n.incomers();if(o.length===0)break;for(var a=!1,l=0;l<o.length;l++){var u=o[l],c=u.id();s[c]||(s[c]=!0,i.push(u),a=!0)}if(!a)break;n=o}return this.spawn(i,!0).filter(r)}};zr.clearTraversalCache=function(){for(var t=0;t<this.length;t++)this[t]._private.traversalCache=null};dt(zr,{roots:l1({noIncomingEdges:!0}),leaves:l1({noOutgoingEdges:!0}),outgoers:Ln(u1({outgoing:!0}),"outgoers"),successors:c1({outgoing:!0}),incomers:Ln(u1({incoming:!0}),"incomers"),predecessors:c1({})});dt(zr,{neighborhood:Ln(function(t){for(var e=[],r=this.nodes(),n=0;n<r.length;n++)for(var i=r[n],s=i.connectedEdges(),o=0;o<s.length;o++){var a=s[o],l=a.source(),u=a.target(),c=i===l?u:l;c.length>0&&e.push(c[0]),e.push(a[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)}});zr.neighbourhood=zr.neighborhood;zr.closedNeighbourhood=zr.closedNeighborhood;zr.openNeighbourhood=zr.openNeighborhood;dt(zr,{source:Ln(function(e){var r=this[0],n;return r&&(n=r._private.source||r.cy().collection()),n&&e?n.filter(e):n},"source"),target:Ln(function(e){var r=this[0],n;return r&&(n=r._private.target||r.cy().collection()),n&&e?n.filter(e):n},"target"),sources:h1({attr:"source"}),targets:h1({attr:"target"})});function h1(t){return function(r){for(var n=[],i=0;i<this.length;i++){var s=this[i],o=s._private[t.attr];o&&n.push(o)}return this.spawn(n,!0).filter(r)}}dt(zr,{edgesWith:Ln(f1(),"edgesWith"),edgesTo:Ln(f1({thisIsSrc:!0}),"edgesTo")});function f1(t){return function(r){var n=[],i=this._private.cy,s=t||{};ut(r)&&(r=i.$(r));for(var o=0;o<r.length;o++)for(var a=r[o]._private.edges,l=0;l<a.length;l++){var u=a[l],c=u._private.data,h=this.hasElementWithId(c.source)&&r.hasElementWithId(c.target),g=r.hasElementWithId(c.source)&&this.hasElementWithId(c.target),p=h||g;p&&((s.thisIsSrc||s.thisIsTgt)&&(s.thisIsSrc&&!h||s.thisIsTgt&&!g)||n.push(u))}return this.spawn(n,!0)}}dt(zr,{connectedEdges:Ln(function(t){for(var e=[],r=this,n=0;n<r.length;n++){var i=r[n];if(i.isNode())for(var s=i._private.edges,o=0;o<s.length;o++){var a=s[o];e.push(a)}}return this.spawn(e,!0).filter(t)},"connectedEdges"),connectedNodes:Ln(function(t){for(var e=[],r=this,n=0;n<r.length;n++){var i=r[n];i.isEdge()&&(e.push(i.source()[0]),e.push(i.target()[0]))}return this.spawn(e,!0).filter(t)},"connectedNodes"),parallelEdges:Ln(d1(),"parallelEdges"),codirectedEdges:Ln(d1({codirected:!0}),"codirectedEdges")});function d1(t){var e={codirected:!1};return t=dt({},e,t),function(n){for(var i=[],s=this.edges(),o=t,a=0;a<s.length;a++)for(var l=s[a],u=l._private,c=u.source,h=c._private.data.id,g=u.data.target,p=c._private.edges,x=0;x<p.length;x++){var w=p[x],v=w._private.data,m=v.target,y=v.source,b=m===g&&y===h,_=h===m&&g===y;(o.codirected&&b||!o.codirected&&(b||_))&&i.push(w)}return this.spawn(i,!0).filter(n)}}dt(zr,{components:function(e){var r=this,n=r.cy(),i=n.collection(),s=e==null?r.nodes():e.nodes(),o=[];e!=null&&s.empty()&&(s=e.sources());var a=function(c,h){i.merge(c),s.unmerge(c),h.merge(c)};if(s.empty())return r.spawn();var l=function(){var c=n.collection();o.push(c);var h=s[0];a(h,c),r.bfs({directed:!1,roots:h,visit:function(p){return a(p,c)}}),c.forEach(function(g){g.connectedEdges().forEach(function(p){r.has(p)&&c.has(p.source())&&c.has(p.target())&&c.merge(p)})})};do l();while(s.length>0);return o},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}});zr.componentsOf=zr.components;var Dr=function(e,r){var n=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){Jt("A collection must have a reference to the core");return}var s=new pi,o=!1;if(!r)r=[];else if(r.length>0&&Dt(r[0])&&!_l(r[0])){o=!0;for(var a=[],l=new Gs,u=0,c=r.length;u<c;u++){var h=r[u];h.data==null&&(h.data={});var g=h.data;if(g.id==null)g.id=Sw();else if(e.hasElementWithId(g.id)||l.has(g.id))continue;var p=new $c(e,h,!1);a.push(p),l.add(g.id)}r=a}this.length=0;for(var x=0,w=r.length;x<w;x++){var v=r[x][0];if(v!=null){var m=v._private.data.id;(!n||!s.has(m))&&(n&&s.set(m,{index:this.length,ele:v}),this[this.length]=v,this.length++)}}this._private={eles:this,cy:e,get map(){return this.lazyMap==null&&this.rebuildMap(),this.lazyMap},set map(y){this.lazyMap=y},rebuildMap:function(){for(var b=this.lazyMap=new pi,_=this.eles,R=0;R<_.length;R++){var E=_[R];b.set(E.id(),{index:R,ele:E})}}},n&&(this._private.map=s),o&&!i&&this.restore()},Gt=$c.prototype=Dr.prototype=Object.create(Array.prototype);Gt.instanceString=function(){return"collection"};Gt.spawn=function(t,e){return new Dr(this.cy(),t,e)};Gt.spawnSelf=function(){return this.spawn(this)};Gt.cy=function(){return this._private.cy};Gt.renderer=function(){return this._private.cy.renderer()};Gt.element=function(){return this[0]};Gt.collection=function(){return uw(this)?this:new Dr(this._private.cy,[this])};Gt.unique=function(){return new Dr(this._private.cy,this,!0)};Gt.hasElementWithId=function(t){return t=""+t,this._private.map.has(t)};Gt.getElementById=function(t){t=""+t;var e=this._private.cy,r=this._private.map.get(t);return r?r.ele:new Dr(e)};Gt.$id=Gt.getElementById;Gt.poolIndex=function(){var t=this._private.cy,e=t._private.elements,r=this[0]._private.data.id;return e._private.map.get(r).index};Gt.indexOf=function(t){var e=t[0]._private.data.id;return this._private.map.get(e).index};Gt.indexOfId=function(t){return t=""+t,this._private.map.get(t).index};Gt.json=function(t){var e=this.element(),r=this.cy();if(e==null&&t)return this;if(e!=null){var n=e._private;if(Dt(t)){if(r.startBatch(),t.data){e.data(t.data);var i=n.data;if(e.isEdge()){var s=!1,o={},a=t.data.source,l=t.data.target;a!=null&&a!=i.source&&(o.source=""+a,s=!0),l!=null&&l!=i.target&&(o.target=""+l,s=!0),s&&(e=e.move(o))}else{var u="parent"in t.data,c=t.data.parent;u&&(c!=null||i.parent!=null)&&c!=i.parent&&(c===void 0&&(c=null),c!=null&&(c=""+c),e=e.move({parent:c}))}}t.position&&e.position(t.position);var h=function(w,v,m){var y=t[w];y!=null&&y!==n[w]&&(y?e[v]():e[m]())};return h("removed","remove","restore"),h("selected","select","unselect"),h("selectable","selectify","unselectify"),h("locked","lock","unlock"),h("grabbable","grabify","ungrabify"),h("pannable","panify","unpanify"),t.classes!=null&&e.classes(t.classes),r.endBatch(),this}else if(t===void 0){var g={data:Zn(n.data),position:Zn(n.position),group:n.group,removed:n.removed,selected:n.selected,selectable:n.selectable,locked:n.locked,grabbable:n.grabbable,pannable:n.pannable,classes:null};g.classes="";var p=0;return n.classes.forEach(function(x){return g.classes+=p++===0?x:" "+x}),g}}};Gt.jsons=function(){for(var t=[],e=0;e<this.length;e++){var r=this[e],n=r.json();t.push(n)}return t};Gt.clone=function(){for(var t=this.cy(),e=[],r=0;r<this.length;r++){var n=this[r],i=n.json(),s=new $c(t,i,!1);e.push(s)}return new Dr(t,e)};Gt.copy=Gt.clone;Gt.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,n=r.cy(),i=n._private,s=[],o=[],a,l=0,u=r.length;l<u;l++){var c=r[l];e&&!c.removed()||(c.isNode()?s.push(c):o.push(c))}a=s.concat(o);var h,g=function(){a.splice(h,1),h--};for(h=0;h<a.length;h++){var p=a[h],x=p._private,w=x.data;if(p.clearTraversalCache(),!(!e&&!x.removed)){if(w.id===void 0)w.id=Sw();else if(Xe(w.id))w.id=""+w.id;else if(Qi(w.id)||!ut(w.id)){Jt("Can not create element with invalid string ID `"+w.id+"`"),g();continue}else if(n.hasElementWithId(w.id)){Jt("Can not create second element with ID `"+w.id+"`"),g();continue}}var v=w.id;if(p.isNode()){var m=x.position;m.x==null&&(m.x=0),m.y==null&&(m.y=0)}if(p.isEdge()){for(var y=p,b=["source","target"],_=b.length,R=!1,E=0;E<_;E++){var T=b[E],k=w[T];Xe(k)&&(k=w[T]=""+w[T]),k==null||k===""?(Jt("Can not create edge `"+v+"` with unspecified "+T),R=!0):n.hasElementWithId(k)||(Jt("Can not create edge `"+v+"` with nonexistent "+T+" `"+k+"`"),R=!0)}if(R){g();continue}var N=n.getElementById(w.source),M=n.getElementById(w.target);N.same(M)?N._private.edges.push(y):(N._private.edges.push(y),M._private.edges.push(y)),y._private.source=N,y._private.target=M}x.map=new pi,x.map.set(v,{ele:p,index:0}),x.removed=!1,e&&n.addToPool(p)}for(var B=0;B<s.length;B++){var A=s[B],j=A._private.data;Xe(j.parent)&&(j.parent=""+j.parent);var D=j.parent,I=D!=null;if(I||A._private.parent){var U=A._private.parent?n.collection().merge(A._private.parent):n.getElementById(D);if(U.empty())j.parent=void 0;else if(U[0].removed())Bt("Node added with missing parent, reference to parent removed"),j.parent=void 0,A._private.parent=null;else{for(var W=!1,H=U;!H.empty();){if(A.same(H)){W=!0,j.parent=void 0;break}H=H.parent()}W||(U[0]._private.children.push(A),A._private.parent=U[0],i.hasCompoundNodes=!0)}}}if(a.length>0){for(var z=a.length===r.length?r:new Dr(n,a),P=0;P<z.length;P++){var F=z[P];F.isNode()||(F.parallelEdges().clearTraversalCache(),F.source().clearTraversalCache(),F.target().clearTraversalCache())}var G;i.hasCompoundNodes?G=n.collection().merge(z).merge(z.connectedNodes()).merge(z.parent()):G=z,G.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(t),t?z.emitAndNotify("add"):e&&z.emit("add")}return r};Gt.removed=function(){var t=this[0];return t&&t._private.removed};Gt.inside=function(){var t=this[0];return t&&!t._private.removed};Gt.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,n=[],i={},s=r._private.cy;function o(D){for(var I=D._private.edges,U=0;U<I.length;U++)l(I[U])}function a(D){for(var I=D._private.children,U=0;U<I.length;U++)l(I[U])}function l(D){var I=i[D.id()];e&&D.removed()||I||(i[D.id()]=!0,D.isNode()?(n.push(D),o(D),a(D)):n.unshift(D))}for(var u=0,c=r.length;u<c;u++){var h=r[u];l(h)}function g(D,I){var U=D._private.edges;Zi(U,I),D.clearTraversalCache()}function p(D){D.clearTraversalCache()}var x=[];x.ids={};function w(D,I){I=I[0],D=D[0];var U=D._private.children,W=D.id();Zi(U,I),I._private.parent=null,x.ids[W]||(x.ids[W]=!0,x.push(D))}r.dirtyCompoundBoundsCache(),e&&s.removeFromPool(n);for(var v=0;v<n.length;v++){var m=n[v];if(m.isEdge()){var y=m.source()[0],b=m.target()[0];g(y,m),g(b,m);for(var _=m.parallelEdges(),R=0;R<_.length;R++){var E=_[R];p(E),E.isBundledBezier()&&E.dirtyBoundingBoxCache()}}else{var T=m.parent();T.length!==0&&w(T,m)}e&&(m._private.removed=!0)}var k=s._private.elements;s._private.hasCompoundNodes=!1;for(var N=0;N<k.length;N++){var M=k[N];if(M.isParent()){s._private.hasCompoundNodes=!0;break}}var B=new Dr(this.cy(),n);B.size()>0&&(t?B.emitAndNotify("remove"):e&&B.emit("remove"));for(var A=0;A<x.length;A++){var j=x[A];(!e||!j.removed())&&j.updateStyle()}return B};Gt.move=function(t){var e=this._private.cy,r=this,n=!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),a=s(t.target),l=o!=null&&e.hasElementWithId(o),u=a!=null&&e.hasElementWithId(a);(l||u)&&(e.batch(function(){r.remove(n,i),r.emitAndNotify("moveout");for(var p=0;p<r.length;p++){var x=r[p],w=x._private.data;x.isEdge()&&(l&&(w.source=o),u&&(w.target=a))}r.restore(n,i)}),r.emitAndNotify("move"))}else if(t.parent!==void 0){var c=s(t.parent),h=c===null||e.hasElementWithId(c);if(h){var g=c===null?void 0:c;e.batch(function(){var p=r.remove(n,i);p.emitAndNotify("moveout");for(var x=0;x<r.length;x++){var w=r[x],v=w._private.data;w.isNode()&&(v.parent=g)}p.restore(n,i)}),r.emitAndNotify("move")}}return this};[Iw,IR,hc,Xi,Hs,QR,Zc,pL,s_,o_,xL,Dc,fc,Nr,Ki,zr].forEach(function(t){dt(Gt,t)});var kL={add:function(e){var r,n=this;if(mn(e)){var i=e;if(i._private.cy===n)r=i.restore();else{for(var s=[],o=0;o<i.length;o++){var a=i[o];s.push(a.json())}r=new Dr(n,s)}}else if(Ut(e)){var l=e;r=new Dr(n,l)}else if(Dt(e)&&(Ut(e.nodes)||Ut(e.edges))){for(var u=e,c=[],h=["nodes","edges"],g=0,p=h.length;g<p;g++){var x=h[g],w=u[x];if(Ut(w))for(var v=0,m=w.length;v<m;v++){var y=dt({group:x},w[v]);c.push(y)}}r=new Dr(n,c)}else{var b=e;r=new $c(n,b).collection()}return r},remove:function(e){if(!mn(e)){if(ut(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 TL(t,e,r,n){var i=4,s=.001,o=1e-7,a=10,l=11,u=1/(l-1),c=typeof Float32Array<"u";if(arguments.length!==4)return!1;for(var h=0;h<4;++h)if(typeof arguments[h]!="number"||isNaN(arguments[h])||!isFinite(arguments[h]))return!1;t=Math.min(t,1),r=Math.min(r,1),t=Math.max(t,0),r=Math.max(r,0);var g=c?new Float32Array(l):new Array(l);function p(M,B){return 1-3*B+3*M}function x(M,B){return 3*B-6*M}function w(M){return 3*M}function v(M,B,A){return((p(B,A)*M+x(B,A))*M+w(B))*M}function m(M,B,A){return 3*p(B,A)*M*M+2*x(B,A)*M+w(B)}function y(M,B){for(var A=0;A<i;++A){var j=m(B,t,r);if(j===0)return B;var D=v(B,t,r)-M;B-=D/j}return B}function b(){for(var M=0;M<l;++M)g[M]=v(M*u,t,r)}function _(M,B,A){var j,D,I=0;do D=B+(A-B)/2,j=v(D,t,r)-M,j>0?A=D:B=D;while(Math.abs(j)>o&&++I<a);return D}function R(M){for(var B=0,A=1,j=l-1;A!==j&&g[A]<=M;++A)B+=u;--A;var D=(M-g[A])/(g[A+1]-g[A]),I=B+D*u,U=m(I,t,r);return U>=s?y(M,I):U===0?I:_(M,B,B+u)}var E=!1;function T(){E=!0,(t!==e||r!==n)&&b()}var k=function(B){return E||T(),t===e&&r===n?B:B===0?0:B===1?1:v(R(B),e,n)};k.getControlPoints=function(){return[{x:t,y:e},{x:r,y:n}]};var N="generateBezier("+[t,e,r,n]+")";return k.toString=function(){return N},k}/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */var RL=(function(){function t(n){return-n.tension*n.x-n.friction*n.v}function e(n,i,s){var o={x:n.x+s.dx*i,v:n.v+s.dv*i,tension:n.tension,friction:n.friction};return{dx:o.v,dv:t(o)}}function r(n,i){var s={dx:n.v,dv:t(n)},o=e(n,i*.5,s),a=e(n,i*.5,o),l=e(n,i,a),u=1/6*(s.dx+2*(o.dx+a.dx)+l.dx),c=1/6*(s.dv+2*(o.dv+a.dv)+l.dv);return n.x=n.x+u*i,n.v=n.v+c*i,n}return function n(i,s,o){var a={x:-1,v:0,tension:null,friction:null},l=[0],u=0,c=1/1e4,h=16/1e3,g,p,x;for(i=parseFloat(i)||500,s=parseFloat(s)||20,o=o||null,a.tension=i,a.friction=s,g=o!==null,g?(u=n(i,s),p=u/o*h):p=h;x=r(x||a,p),l.push(1+x.x),u+=16,Math.abs(x.x)>c&&Math.abs(x.v)>c;);return g?function(w){return l[w*(l.length-1)|0]}:u}})(),$t=function(e,r,n,i){var s=TL(e,r,n,i);return function(o,a,l){return o+(a-o)*s(l)}},dc={linear:function(e,r,n){return e+(r-e)*n},ease:$t(.25,.1,.25,1),"ease-in":$t(.42,0,1,1),"ease-out":$t(0,0,.58,1),"ease-in-out":$t(.42,0,.58,1),"ease-in-sine":$t(.47,0,.745,.715),"ease-out-sine":$t(.39,.575,.565,1),"ease-in-out-sine":$t(.445,.05,.55,.95),"ease-in-quad":$t(.55,.085,.68,.53),"ease-out-quad":$t(.25,.46,.45,.94),"ease-in-out-quad":$t(.455,.03,.515,.955),"ease-in-cubic":$t(.55,.055,.675,.19),"ease-out-cubic":$t(.215,.61,.355,1),"ease-in-out-cubic":$t(.645,.045,.355,1),"ease-in-quart":$t(.895,.03,.685,.22),"ease-out-quart":$t(.165,.84,.44,1),"ease-in-out-quart":$t(.77,0,.175,1),"ease-in-quint":$t(.755,.05,.855,.06),"ease-out-quint":$t(.23,1,.32,1),"ease-in-out-quint":$t(.86,0,.07,1),"ease-in-expo":$t(.95,.05,.795,.035),"ease-out-expo":$t(.19,1,.22,1),"ease-in-out-expo":$t(1,0,0,1),"ease-in-circ":$t(.6,.04,.98,.335),"ease-out-circ":$t(.075,.82,.165,1),"ease-in-out-circ":$t(.785,.135,.15,.86),spring:function(e,r,n){if(n===0)return dc.linear;var i=RL(e,r,n);return function(s,o,a){return s+(o-s)*i(a)}},"cubic-bezier":$t};function p1(t,e,r,n,i){if(n===1||e===r)return r;var s=i(e,r,n);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 v1(t,e){return t.pfValue!=null||t.value!=null?t.pfValue!=null&&(e==null||e.type.units!=="%")?t.pfValue:t.value:t}function xs(t,e,r,n,i){var s=i!=null?i.type:null;r<0?r=0:r>1&&(r=1);var o=v1(t,i),a=v1(e,i);if(Xe(o)&&Xe(a))return p1(s,o,a,r,n);if(Ut(o)&&Ut(a)){for(var l=[],u=0;u<a.length;u++){var c=o[u],h=a[u];if(c!=null&&h!=null){var g=p1(s,c,h,r,n);l.push(g)}else l.push(h)}return l}}function LL(t,e,r,n){var i=!n,s=t._private,o=e._private,a=o.easing,l=o.startTime,u=n?t:t.cy(),c=u.style();if(!o.easingImpl)if(a==null)o.easingImpl=dc.linear;else{var h;if(ut(a)){var g=c.parse("transition-timing-function",a);h=g.value}else h=a;var p,x;ut(h)?(p=h,x=[]):(p=h[1],x=h.slice(2).map(function(z){return+z})),x.length>0?(p==="spring"&&x.push(o.duration),o.easingImpl=dc[p].apply(null,x)):o.easingImpl=dc[p]}var w=o.easingImpl,v;if(o.duration===0?v=1:v=(r-l)/o.duration,o.applying&&(v=o.progress),v<0?v=0:v>1&&(v=1),o.delay==null){var m=o.startPosition,y=o.position;if(y&&i&&!t.locked()){var b={};Ho(m.x,y.x)&&(b.x=xs(m.x,y.x,v,w)),Ho(m.y,y.y)&&(b.y=xs(m.y,y.y,v,w)),t.position(b)}var _=o.startPan,R=o.pan,E=s.pan,T=R!=null&&n;T&&(Ho(_.x,R.x)&&(E.x=xs(_.x,R.x,v,w)),Ho(_.y,R.y)&&(E.y=xs(_.y,R.y,v,w)),t.emit("pan"));var k=o.startZoom,N=o.zoom,M=N!=null&&n;M&&(Ho(k,N)&&(s.zoom=fl(s.minZoom,xs(k,N,v,w),s.maxZoom)),t.emit("zoom")),(T||M)&&t.emit("viewport");var B=o.style;if(B&&B.length>0&&i){for(var A=0;A<B.length;A++){var j=B[A],D=j.name,I=j,U=o.startStyle[D],W=c.properties[U.name],H=xs(U,I,v,w,W);c.overrideBypass(t,D,H)}t.emit("style")}}return o.progress=v,v}function Ho(t,e){return t==null||e==null?!1:Xe(t)&&Xe(e)?!0:!!(t&&e)}function NL(t,e,r,n){var i=e._private;i.started=!0,i.startTime=r-i.progress*i.duration}function g1(t,e){var r=e._private.aniEles,n=[];function i(c,h){var g=c._private,p=g.animation.current,x=g.animation.queue,w=!1;if(p.length===0){var v=x.shift();v&&p.push(v)}for(var m=function(E){for(var T=E.length-1;T>=0;T--){var k=E[T];k()}E.splice(0,E.length)},y=p.length-1;y>=0;y--){var b=p[y],_=b._private;if(_.stopped){p.splice(y,1),_.hooked=!1,_.playing=!1,_.started=!1,m(_.frames);continue}!_.playing&&!_.applying||(_.playing&&_.applying&&(_.applying=!1),_.started||NL(c,b,t),LL(c,b,t,h),_.applying&&(_.applying=!1),m(_.frames),_.step!=null&&_.step(t),b.completed()&&(p.splice(y,1),_.hooked=!1,_.playing=!1,_.started=!1,m(_.completes)),w=!0)}return!h&&p.length===0&&x.length===0&&n.push(c),w}for(var s=!1,o=0;o<r.length;o++){var a=r[o],l=i(a);s=s||l}var u=i(e,!0);(s||u)&&(r.length>0?e.notify("draw",r):e.notify("draw")),r.unmerge(n),e.emit("step")}var DL={animate:Ot.animate(),animation:Ot.animation(),animated:Ot.animated(),clearQueue:Ot.clearQueue(),delay:Ot.delay(),delayAnimation:Ot.delayAnimation(),stop:Ot.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&&kc(function(s){g1(s,e),r()})}var n=e.renderer();n&&n.beforeRender?n.beforeRender(function(s,o){g1(o,e)},n.beforeRenderPriorities.animations):r()}},AL={qualifierCompare:function(e,r){return e==null||r==null?e==null&&r==null:e.sameText(r)},eventMatches:function(e,r,n){var i=r.qualifier;return i!=null?e!==n.target&&_l(n.target)&&i.matches(n.target):!0},addEventFields:function(e,r){r.cy=e,r.target=e},callbackContext:function(e,r,n){return r.qualifier!=null?n.target:e}},Zu=function(e){return ut(e)?new ea(e):e},c_={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new Jc(AL,this)),this},emitter:function(){return this._private.emitter},on:function(e,r,n){return this.emitter().on(e,Zu(r),n),this},removeListener:function(e,r,n){return this.emitter().removeListener(e,Zu(r),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,r,n){return this.emitter().one(e,Zu(r),n),this},once:function(e,r,n){return this.emitter().one(e,Zu(r),n),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}};Ot.eventAliasesOn(c_);var mv={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)}};mv.jpeg=mv.jpg;var pc={layout:function(e){var r=this;if(e==null){Jt("Layout options must be specified to make a layout");return}if(e.name==null){Jt("A `name` must be specified to make a layout");return}var n=e.name,i=r.extension("layout",n);if(i==null){Jt("No such layout `"+n+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var s;ut(e.eles)?s=r.$(e.eles):s=e.eles!=null?e.eles:r.$();var o=new i(dt({},e,{cy:r,eles:s}));return o}};pc.createLayout=pc.makeLayout=pc.layout;var ML={notify:function(e,r){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var i=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();r!=null&&i.merge(r);return}if(n.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(n){var i=e.batchNotifications[n];i.empty()?r.notify(n):r.notify(n,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 n=Object.keys(e),i=0;i<n.length;i++){var s=n[i],o=e[s],a=r.getElementById(s);a.data(o)}})}},PL=Ar({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]}),yv={renderTo:function(e,r,n,i){var s=this._private.renderer;return s.renderTo(e,r,n,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,n=r.extension("renderer",e.name);if(n==null){Jt("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&&Bt("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=PL(e);i.cy=r,r._private.renderer=new n(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(n){var i=n._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)}};yv.invalidateDimensions=yv.resize;var vc={collection:function(e,r){return ut(e)?this.$(e):mn(e)?e.collection():Ut(e)?(r||(r={}),new Dr(this,e,r.unique,r.removed)):new Dr(this)},nodes:function(e){var r=this.$(function(n){return n.isNode()});return e?r.filter(e):r},edges:function(e){var r=this.$(function(n){return n.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}};vc.elements=vc.filter=vc.$;var kr={},rl="t",IL="f";kr.apply=function(t){for(var e=this,r=e._private,n=r.cy,i=n.collection(),s=0;s<t.length;s++){var o=t[s],a=e.getContextMeta(o);if(!a.empty){var l=e.getContextStyle(a),u=e.applyContextStyle(a,l,o);o._private.appliedInitStyle?e.updateTransitions(o,u.diffProps):o._private.appliedInitStyle=!0;var c=e.updateStyleHints(o);c&&i.push(o)}}return i};kr.getPropertiesDiff=function(t,e){var r=this,n=r._private.propDiffs=r._private.propDiffs||{},i=t+"-"+e,s=n[i];if(s)return s;for(var o=[],a={},l=0;l<r.length;l++){var u=r[l],c=t[l]===rl,h=e[l]===rl,g=c!==h,p=u.mappedProperties.length>0;if(g||h&&p){var x=void 0;g&&p||g?x=u.properties:p&&(x=u.mappedProperties);for(var w=0;w<x.length;w++){for(var v=x[w],m=v.name,y=!1,b=l+1;b<r.length;b++){var _=r[b],R=e[b]===rl;if(R&&(y=_.properties[v.name]!=null,y))break}!a[m]&&!y&&(a[m]=!0,o.push(m))}}}return n[i]=o,o};kr.getContextMeta=function(t){for(var e=this,r="",n,i=t._private.styleCxtKey||"",s=0;s<e.length;s++){var o=e[s],a=o.selector&&o.selector.matches(t);a?r+=rl:r+=IL}return n=e.getPropertiesDiff(i,r),t._private.styleCxtKey=r,{key:r,diffPropNames:n,empty:n.length===0}};kr.getContextStyle=function(t){var e=t.key,r=this,n=this._private.contextStyles=this._private.contextStyles||{};if(n[e])return n[e];for(var i={_private:{key:e}},s=0;s<r.length;s++){var o=r[s],a=e[s]===rl;if(a)for(var l=0;l<o.properties.length;l++){var u=o.properties[l];i[u.name]=u}}return n[e]=i,i};kr.applyContextStyle=function(t,e,r){for(var n=this,i=t.diffPropNames,s={},o=n.types,a=0;a<i.length;a++){var l=i[a],u=e[l],c=r.pstyle(l);if(!u)if(c)c.bypass?u={name:l,deleteBypassed:!0}:u={name:l,delete:!0};else continue;if(c!==u){if(u.mapped===o.fn&&c!=null&&c.mapping!=null&&c.mapping.value===u.value){var h=c.mapping,g=h.fnValue=u.value(r);if(g===h.prevFnValue)continue}var p=s[l]={prev:c};n.applyParsedProperty(r,u),p.next=r.pstyle(l),p.next&&p.next.bypass&&(p.next=p.next.bypassed)}}return{diffProps:s}};kr.updateStyleHints=function(t){var e=t._private,r=this,n=r.propertyGroupNames,i=r.propertyGroupKeys,s=function(ie,ce,de){return r.getPropertiesHash(ie,ce,de)},o=e.styleKey;if(t.removed())return!1;var a=e.group==="nodes",l=t._private.style;n=Object.keys(l);for(var u=0;u<i.length;u++){var c=i[u];e.styleKeys[c]=[Da,Ls]}for(var h=function(ie,ce){return e.styleKeys[ce][0]=ul(ie,e.styleKeys[ce][0])},g=function(ie,ce){return e.styleKeys[ce][1]=cl(ie,e.styleKeys[ce][1])},p=function(ie,ce){h(ie,ce),g(ie,ce)},x=function(ie,ce){for(var de=0;de<ie.length;de++){var Le=ie.charCodeAt(de);h(Le,ce),g(Le,ce)}},w=2e9,v=function(ie){return-128<ie&&ie<128&&Math.floor(ie)!==ie?w-(ie*1024|0):ie},m=0;m<n.length;m++){var y=n[m],b=l[y];if(b!=null){var _=this.properties[y],R=_.type,E=_.groupKey,T=void 0;_.hashOverride!=null?T=_.hashOverride(t,b):b.pfValue!=null&&(T=b.pfValue);var k=_.enums==null?b.value:null,N=T!=null,M=k!=null,B=N||M,A=b.units;if(R.number&&B&&!R.multiple){var j=N?T:k;p(v(j),E),!N&&A!=null&&x(A,E)}else x(b.strValue,E)}}for(var D=[Da,Ls],I=0;I<i.length;I++){var U=i[I],W=e.styleKeys[U];D[0]=ul(W[0],D[0]),D[1]=cl(W[1],D[1])}e.styleKey=Kk(D[0],D[1]);var H=e.styleKeys;e.labelDimsKey=Hi(H.labelDimensions);var z=s(t,["label"],H.labelDimensions);if(e.labelKey=Hi(z),e.labelStyleKey=Hi(Vu(H.commonLabel,z)),!a){var P=s(t,["source-label"],H.labelDimensions);e.sourceLabelKey=Hi(P),e.sourceLabelStyleKey=Hi(Vu(H.commonLabel,P));var F=s(t,["target-label"],H.labelDimensions);e.targetLabelKey=Hi(F),e.targetLabelStyleKey=Hi(Vu(H.commonLabel,F))}if(a){var G=e.styleKeys,$=G.nodeBody,ee=G.nodeBorder,re=G.nodeOutline,ne=G.backgroundImage,Y=G.compound,q=G.pie,K=G.stripe,X=[$,ee,re,ne,Y,q,K].filter(function(J){return J!=null}).reduce(Vu,[Da,Ls]);e.nodeKey=Hi(X),e.hasPie=q!=null&&q[0]!==Da&&q[1]!==Ls,e.hasStripe=K!=null&&K[0]!==Da&&K[1]!==Ls}return o!==e.styleKey};kr.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};kr.applyParsedProperty=function(t,e){var r=this,n=e,i=t._private.style,s,o=r.types,a=r.properties[n.name].type,l=n.bypass,u=i[n.name],c=u&&u.bypass,h=t._private,g="mapping",p=function($){return $==null?null:$.pfValue!=null?$.pfValue:$.value},x=function(){var $=p(u),ee=p(n);r.checkTriggers(t,n.name,$,ee)};if(e.name==="curve-style"&&t.isEdge()&&(e.value!=="bezier"&&t.isLoop()||e.value==="haystack"&&(t.source().isParent()||t.target().isParent()))&&(n=e=this.parse(e.name,"bezier",l)),n.delete)return i[n.name]=void 0,x(),!0;if(n.deleteBypassed)return u?u.bypass?(u.bypassed=void 0,x(),!0):!1:(x(),!0);if(n.deleteBypass)return u?u.bypass?(i[n.name]=u.bypassed,x(),!0):!1:(x(),!0);var w=function(){Bt("Do not assign mappings to elements without corresponding data (i.e. ele `"+t.id()+"` has no mapping for property `"+n.name+"` with data field `"+n.field+"`); try a `["+n.field+"]` selector to limit scope to elements with `"+n.field+"` defined")};switch(n.mapped){case o.mapData:{for(var v=n.field.split("."),m=h.data,y=0;y<v.length&&m;y++){var b=v[y];m=m[b]}if(m==null)return w(),!1;var _;if(Xe(m)){var R=n.fieldMax-n.fieldMin;R===0?_=0:_=(m-n.fieldMin)/R}else return Bt("Do not use continuous mappers without specifying numeric data (i.e. `"+n.field+": "+m+"` for `"+t.id()+"` is non-numeric)"),!1;if(_<0?_=0:_>1&&(_=1),a.color){var E=n.valueMin[0],T=n.valueMax[0],k=n.valueMin[1],N=n.valueMax[1],M=n.valueMin[2],B=n.valueMax[2],A=n.valueMin[3]==null?1:n.valueMin[3],j=n.valueMax[3]==null?1:n.valueMax[3],D=[Math.round(E+(T-E)*_),Math.round(k+(N-k)*_),Math.round(M+(B-M)*_),Math.round(A+(j-A)*_)];s={bypass:n.bypass,name:n.name,value:D,strValue:"rgb("+D[0]+", "+D[1]+", "+D[2]+")"}}else if(a.number){var I=n.valueMin+(n.valueMax-n.valueMin)*_;s=this.parse(n.name,I,n.bypass,g)}else return!1;if(!s)return w(),!1;s.mapping=n,n=s;break}case o.data:{for(var U=n.field.split("."),W=h.data,H=0;H<U.length&&W;H++){var z=U[H];W=W[z]}if(W!=null&&(s=this.parse(n.name,W,n.bypass,g)),!s)return w(),!1;s.mapping=n,n=s;break}case o.fn:{var P=n.value,F=n.fnValue!=null?n.fnValue:P(t);if(n.prevFnValue=F,F==null)return Bt("Custom function mappers may not return null (i.e. `"+n.name+"` for ele `"+t.id()+"` is null)"),!1;if(s=this.parse(n.name,F,n.bypass,g),!s)return Bt("Custom function mappers may not return invalid values for the property type (i.e. `"+n.name+"` for ele `"+t.id()+"` is invalid)"),!1;s.mapping=Zn(n),n=s;break}case void 0:break;default:return!1}return l?(c?n.bypassed=u.bypassed:n.bypassed=u,i[n.name]=n):c?u.bypassed=n:i[n.name]=n,x(),!0};kr.cleanElements=function(t,e){for(var r=0;r<t.length;r++){var n=t[r];if(this.clearStyleHints(n),n.dirtyCompoundBoundsCache(),n.dirtyBoundingBoxCache(),!e)n._private.style={};else for(var i=n._private.style,s=Object.keys(i),o=0;o<s.length;o++){var a=s[o],l=i[a];l!=null&&(l.bypass?l.bypassed=null:i[a]=null)}}};kr.update=function(){var t=this._private.cy,e=t.mutableElements();e.updateStyle()};kr.updateTransitions=function(t,e){var r=this,n=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 a={},l=!1,u=0;u<i.length;u++){var c=i[u],h=t.pstyle(c),g=e[c];if(g){var p=g.prev,x=p,w=g.next!=null?g.next:h,v=!1,m=void 0,y=1e-6;x&&(Xe(x.pfValue)&&Xe(w.pfValue)?(v=w.pfValue-x.pfValue,m=x.pfValue+y*v):Xe(x.value)&&Xe(w.value)?(v=w.value-x.value,m=x.value+y*v):Ut(x.value)&&Ut(w.value)&&(v=x.value[0]!==w.value[0]||x.value[1]!==w.value[1]||x.value[2]!==w.value[2],m=x.strValue),v&&(a[c]=w.strValue,this.applyBypass(t,c,m),l=!0))}}if(!l)return;n.transitioning=!0,new qs(function(b){o>0?t.delayAnimation(o).play().promise().then(b):b()}).then(function(){return t.animation({style:a,duration:s,easing:t.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){r.removeBypasses(t,i),t.emitAndNotify("style"),n.transitioning=!1})}else n.transitioning&&(this.removeBypasses(t,i),t.emitAndNotify("style"),n.transitioning=!1)};kr.checkTrigger=function(t,e,r,n,i,s){var o=this.properties[e],a=i(o);t.removed()||a!=null&&a(r,n,t)&&s(o)};kr.checkZOrderTrigger=function(t,e,r,n){var i=this;this.checkTrigger(t,e,r,n,function(s){return s.triggersZOrder},function(){i._private.cy.notify("zorder",t)})};kr.checkBoundsTrigger=function(t,e,r,n){this.checkTrigger(t,e,r,n,function(i){return i.triggersBounds},function(i){t.dirtyCompoundBoundsCache(),t.dirtyBoundingBoxCache()})};kr.checkConnectedEdgesBoundsTrigger=function(t,e,r,n){this.checkTrigger(t,e,r,n,function(i){return i.triggersBoundsOfConnectedEdges},function(i){t.connectedEdges().forEach(function(s){s.dirtyBoundingBoxCache()})})};kr.checkParallelEdgesBoundsTrigger=function(t,e,r,n){this.checkTrigger(t,e,r,n,function(i){return i.triggersBoundsOfParallelEdges},function(i){t.parallelEdges().forEach(function(s){s.dirtyBoundingBoxCache()})})};kr.checkTriggers=function(t,e,r,n){t.dirtyStyleCache(),this.checkZOrderTrigger(t,e,r,n),this.checkBoundsTrigger(t,e,r,n),this.checkConnectedEdgesBoundsTrigger(t,e,r,n),this.checkParallelEdgesBoundsTrigger(t,e,r,n)};var Ll={};Ll.applyBypass=function(t,e,r,n){var i=this,s=[],o=!0;if(e==="*"||e==="**"){if(r!==void 0)for(var a=0;a<i.properties.length;a++){var l=i.properties[a],u=l.name,c=this.parse(u,r,!0);c&&s.push(c)}}else if(ut(e)){var h=this.parse(e,r,!0);h&&s.push(h)}else if(Dt(e)){var g=e;n=r;for(var p=Object.keys(g),x=0;x<p.length;x++){var w=p[x],v=g[w];if(v===void 0&&(v=g[Wc(w)]),v!==void 0){var m=this.parse(w,v,!0);m&&s.push(m)}}}else return!1;if(s.length===0)return!1;for(var y=!1,b=0;b<t.length;b++){for(var _=t[b],R={},E=void 0,T=0;T<s.length;T++){var k=s[T];if(n){var N=_.pstyle(k.name);E=R[k.name]={prev:N}}y=this.applyParsedProperty(_,Zn(k))||y,n&&(E.next=_.pstyle(k.name))}y&&this.updateStyleHints(_),n&&this.updateTransitions(_,R,o)}return y};Ll.overrideBypass=function(t,e,r){e=Gv(e);for(var n=0;n<t.length;n++){var i=t[n],s=i._private.style[e],o=this.properties[e].type,a=o.color,l=o.mutiple,u=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),a?s.strValue="rgb("+r.join(",")+")":l?s.strValue=r.join(" "):s.strValue=""+r,this.updateStyleHints(i)),this.checkTriggers(i,e,u,r)}};Ll.removeAllBypasses=function(t,e){return this.removeBypasses(t,this.propertyNames,e)};Ll.removeBypasses=function(t,e,r){for(var n=!0,i=0;i<t.length;i++){for(var s=t[i],o={},a=0;a<e.length;a++){var l=e[a],u=this.properties[l],c=s.pstyle(u.name);if(!(!c||!c.bypass)){var h="",g=this.parse(l,h,!0),p=o[u.name]={prev:c};this.applyParsedProperty(s,g),p.next=s.pstyle(u.name)}}this.updateStyleHints(s),r&&this.updateTransitions(s,o,n)}};var og={};og.getEmSizeInPixels=function(){var t=this.containerCss("font-size");return t!=null?parseFloat(t):1};og.containerCss=function(t){var e=this._private.cy,r=e.container(),n=e.window();if(n&&r&&n.getComputedStyle)return n.getComputedStyle(r).getPropertyValue(t)};var ei={};ei.getRenderedStyle=function(t,e){return e?this.getStylePropertyValue(t,e,!0):this.getRawStyle(t,!0)};ei.getRawStyle=function(t,e){var r=this;if(t=t[0],t){for(var n={},i=0;i<r.properties.length;i++){var s=r.properties[i],o=r.getStylePropertyValue(t,s.name,e);o!=null&&(n[s.name]=o,n[Wc(s.name)]=o)}return n}};ei.getIndexedStyle=function(t,e,r,n){var i=t.pstyle(e)[r][n];return i??t.cy().style().getDefaultProperty(e)[r][0]};ei.getStylePropertyValue=function(t,e,r){var n=this;if(t=t[0],t){var i=n.properties[e];i.alias&&(i=i.pointsTo);var s=i.type,o=t.pstyle(i.name);if(o){var a=o.value,l=o.units,u=o.strValue;if(r&&s.number&&a!=null&&Xe(a)){var c=t.cy().zoom(),h=function(v){return v*c},g=function(v,m){return h(v)+m},p=Ut(a),x=p?l.every(function(w){return w!=null}):l!=null;return x?p?a.map(function(w,v){return g(w,l[v])}).join(" "):g(a,l):p?a.map(function(w){return ut(w)?w:""+h(w)}).join(" "):""+h(a)}else if(u!=null)return u}return null}};ei.getAnimationStartStyle=function(t,e){for(var r={},n=0;n<e.length;n++){var i=e[n],s=i.name,o=t.pstyle(s);o!==void 0&&(Dt(o)?o=this.parse(s,o.strValue):o=this.parse(s,o)),o&&(r[s]=o)}return r};ei.getPropsList=function(t){var e=this,r=[],n=t,i=e.properties;if(n)for(var s=Object.keys(n),o=0;o<s.length;o++){var a=s[o],l=n[a],u=i[a]||i[Gv(a)],c=this.parse(u.name,l);c&&r.push(c)}return r};ei.getNonDefaultPropertiesHash=function(t,e,r){var n=r.slice(),i,s,o,a,l,u;for(l=0;l<e.length;l++)if(i=e[l],s=t.pstyle(i,!1),s!=null)if(s.pfValue!=null)n[0]=ul(a,n[0]),n[1]=cl(a,n[1]);else for(o=s.strValue,u=0;u<o.length;u++)a=o.charCodeAt(u),n[0]=ul(a,n[0]),n[1]=cl(a,n[1]);return n};ei.getPropertiesHash=ei.getNonDefaultPropertiesHash;var rh={};rh.appendFromJson=function(t){for(var e=this,r=0;r<t.length;r++){var n=t[r],i=n.selector,s=n.style||n.css,o=Object.keys(s);e.selector(i);for(var a=0;a<o.length;a++){var l=o[a],u=s[l];e.css(l,u)}}return e};rh.fromJson=function(t){var e=this;return e.resetToDefault(),e.appendFromJson(t),e};rh.json=function(){for(var t=[],e=this.defaultLength;e<this.length;e++){for(var r=this[e],n=r.selector,i=r.properties,s={},o=0;o<i.length;o++){var a=i[o];s[a.name]=a.strValue}t.push({selector:n?n.toString():"core",style:s})}return t};var lg={};lg.appendFromString=function(t){var e=this,r=this,n=""+t,i,s,o;n=n.replace(/[/][*](\s|.)+?[*][/]/g,"");function a(){n.length>i.length?n=n.substr(i.length):n=""}function l(){s.length>o.length?s=s.substr(o.length):s=""}for(;;){var u=n.match(/^\s*$/);if(u)break;var c=n.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!c){Bt("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+n);break}i=c[0];var h=c[1];if(h!=="core"){var g=new ea(h);if(g.invalid){Bt("Skipping parsing of block: Invalid selector found in string stylesheet: "+h),a();continue}}var p=c[2],x=!1;s=p;for(var w=[];;){var v=s.match(/^\s*$/);if(v)break;var m=s.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!m){Bt("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+p),x=!0;break}o=m[0];var y=m[1],b=m[2],_=e.properties[y];if(!_){Bt("Skipping property: Invalid property name in: "+o),l();continue}var R=r.parse(y,b);if(!R){Bt("Skipping property: Invalid property definition in: "+o),l();continue}w.push({name:y,val:b}),l()}if(x){a();break}r.selector(h);for(var E=0;E<w.length;E++){var T=w[E];r.css(T.name,T.val)}a()}return r};lg.fromString=function(t){var e=this;return e.resetToDefault(),e.appendFromString(t),e};var dr={};(function(){var t=yr,e=Rk,r=Nk,n=Dk,i=Ak,s=function(J){return"^"+J+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},o=function(J){var ie=t+"|\\w+|"+e+"|"+r+"|"+n+"|"+i;return"^"+J+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+t+")\\s*\\,\\s*("+t+")\\s*,\\s*("+ie+")\\s*\\,\\s*("+ie+")\\)$"},a=[`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`,"^(none)$","^(.+)$"];dr.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","top-inside","center","bottom","bottom-inside"]},halign:{enums:["left","left-inside","center","right","right-inside"]},justification:{enums:["left","center","right","auto"]},textMetrics:{enums:["font","glyph"]},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:a,singleRegexMatchValue:!0},urls:{regexes:a,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(J,ie){switch(J.length){case 2:return ie[0]!=="deg"&&ie[0]!=="rad"&&ie[1]!=="deg"&&ie[1]!=="rad";case 1:return ut(J[0])||ie[0]==="deg"||ie[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(J){var ie=J.length;return ie===1||ie===2||ie===4}}};var l={zeroNonZero:function(J,ie){return(J==null||ie==null)&&J!==ie||J==0&&ie!=0?!0:J!=0&&ie==0},any:function(J,ie){return J!=ie},emptyNonEmpty:function(J,ie){var ce=Qi(J),de=Qi(ie);return ce&&!de||!ce&&de}},u=dr.types,c=[{name:"label",type:u.text,triggersBounds:l.any,triggersZOrder:l.emptyNonEmpty},{name:"text-rotation",type:u.textRotation,triggersBounds:l.any},{name:"text-margin-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"text-margin-y",type:u.bidirectionalSize,triggersBounds:l.any}],h=[{name:"source-label",type:u.text,triggersBounds:l.any},{name:"source-text-rotation",type:u.textRotation,triggersBounds:l.any},{name:"source-text-margin-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"source-text-margin-y",type:u.bidirectionalSize,triggersBounds:l.any},{name:"source-text-offset",type:u.size,triggersBounds:l.any}],g=[{name:"target-label",type:u.text,triggersBounds:l.any},{name:"target-text-rotation",type:u.textRotation,triggersBounds:l.any},{name:"target-text-margin-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"target-text-margin-y",type:u.bidirectionalSize,triggersBounds:l.any},{name:"target-text-offset",type:u.size,triggersBounds:l.any}],p=[{name:"font-family",type:u.fontFamily,triggersBounds:l.any},{name:"font-style",type:u.fontStyle,triggersBounds:l.any},{name:"font-weight",type:u.fontWeight,triggersBounds:l.any},{name:"font-size",type:u.size,triggersBounds:l.any},{name:"text-transform",type:u.textTransform,triggersBounds:l.any},{name:"text-wrap",type:u.textWrap,triggersBounds:l.any},{name:"text-overflow-wrap",type:u.textOverflowWrap,triggersBounds:l.any},{name:"text-max-width",type:u.size,triggersBounds:l.any},{name:"text-outline-width",type:u.size,triggersBounds:l.any},{name:"line-height",type:u.positiveNumber,triggersBounds:l.any}],x=[{name:"text-valign",type:u.valign,triggersBounds:l.any},{name:"text-halign",type:u.halign,triggersBounds:l.any},{name:"color",type:u.color},{name:"text-outline-color",type:u.color},{name:"text-outline-opacity",type:u.zeroOneNumber},{name:"text-background-color",type:u.color},{name:"text-background-opacity",type:u.zeroOneNumber},{name:"text-background-padding",type:u.size,triggersBounds:l.any},{name:"text-border-opacity",type:u.zeroOneNumber},{name:"text-border-color",type:u.color},{name:"text-border-width",type:u.size,triggersBounds:l.any},{name:"text-border-style",type:u.borderStyle,triggersBounds:l.any},{name:"text-background-shape",type:u.textBackgroundShape,triggersBounds:l.any},{name:"text-justification",type:u.justification},{name:"text-metrics",type:u.textMetrics},{name:"box-select-labels",type:u.bool,triggersBounds:l.any}],w=[{name:"events",type:u.bool,triggersZOrder:l.any},{name:"text-events",type:u.bool,triggersZOrder:l.any},{name:"box-selection",type:u.boxSelection,triggersZOrder:l.any}],v=[{name:"display",type:u.display,triggersZOrder:l.any,triggersBounds:l.any,triggersBoundsOfConnectedEdges:l.any,triggersBoundsOfParallelEdges:function(J,ie,ce){return J===ie?!1:ce.pstyle("curve-style").value==="bezier"}},{name:"visibility",type:u.visibility,triggersZOrder:l.any},{name:"opacity",type:u.zeroOneNumber,triggersZOrder:l.zeroNonZero},{name:"text-opacity",type:u.zeroOneNumber},{name:"min-zoomed-font-size",type:u.size},{name:"z-compound-depth",type:u.zCompoundDepth,triggersZOrder:l.any},{name:"z-index-compare",type:u.zIndexCompare,triggersZOrder:l.any},{name:"z-index",type:u.number,triggersZOrder:l.any}],m=[{name:"overlay-padding",type:u.size,triggersBounds:l.any},{name:"overlay-color",type:u.color},{name:"overlay-opacity",type:u.zeroOneNumber,triggersBounds:l.zeroNonZero},{name:"overlay-shape",type:u.overlayShape,triggersBounds:l.any},{name:"overlay-corner-radius",type:u.cornerRadius}],y=[{name:"underlay-padding",type:u.size,triggersBounds:l.any},{name:"underlay-color",type:u.color},{name:"underlay-opacity",type:u.zeroOneNumber,triggersBounds:l.zeroNonZero},{name:"underlay-shape",type:u.overlayShape,triggersBounds:l.any},{name:"underlay-corner-radius",type:u.cornerRadius}],b=[{name:"transition-property",type:u.propList},{name:"transition-duration",type:u.time},{name:"transition-delay",type:u.time},{name:"transition-timing-function",type:u.easing}],_=function(J,ie){return ie.value==="label"?-J.poolIndex():ie.pfValue},R=[{name:"height",type:u.nodeSize,triggersBounds:l.any,hashOverride:_},{name:"width",type:u.nodeSize,triggersBounds:l.any,hashOverride:_},{name:"shape",type:u.nodeShape,triggersBounds:l.any},{name:"shape-polygon-points",type:u.polygonPointList,triggersBounds:l.any},{name:"corner-radius",type:u.cornerRadius},{name:"background-color",type:u.color},{name:"background-fill",type:u.fill},{name:"background-opacity",type:u.zeroOneNumber},{name:"background-blacken",type:u.nOneOneNumber},{name:"background-gradient-stop-colors",type:u.colors},{name:"background-gradient-stop-positions",type:u.percentages},{name:"background-gradient-direction",type:u.gradientDirection},{name:"padding",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"padding-relative-to",type:u.paddingRelativeTo,triggersBounds:l.any},{name:"bounds-expansion",type:u.boundsExpansion,triggersBounds:l.any}],E=[{name:"border-color",type:u.color},{name:"border-opacity",type:u.zeroOneNumber},{name:"border-width",type:u.size,triggersBounds:l.any},{name:"border-style",type:u.borderStyle},{name:"border-cap",type:u.lineCap},{name:"border-join",type:u.lineJoin},{name:"border-dash-pattern",type:u.numbers},{name:"border-dash-offset",type:u.number},{name:"border-position",type:u.linePosition}],T=[{name:"outline-color",type:u.color},{name:"outline-opacity",type:u.zeroOneNumber},{name:"outline-width",type:u.size,triggersBounds:l.any},{name:"outline-style",type:u.borderStyle},{name:"outline-offset",type:u.size,triggersBounds:l.any}],k=[{name:"background-image",type:u.urls},{name:"background-image-crossorigin",type:u.bgCrossOrigin},{name:"background-image-opacity",type:u.zeroOneNumbers},{name:"background-image-containment",type:u.bgContainment},{name:"background-image-smoothing",type:u.bools},{name:"background-position-x",type:u.bgPos},{name:"background-position-y",type:u.bgPos},{name:"background-width-relative-to",type:u.bgRelativeTo},{name:"background-height-relative-to",type:u.bgRelativeTo},{name:"background-repeat",type:u.bgRepeat},{name:"background-fit",type:u.bgFit},{name:"background-clip",type:u.bgClip},{name:"background-width",type:u.bgWH},{name:"background-height",type:u.bgWH},{name:"background-offset-x",type:u.bgPos},{name:"background-offset-y",type:u.bgPos}],N=[{name:"position",type:u.position,triggersBounds:l.any},{name:"compound-sizing-wrt-labels",type:u.compoundIncludeLabels,triggersBounds:l.any},{name:"min-width",type:u.size,triggersBounds:l.any},{name:"min-width-bias-left",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"min-width-bias-right",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"min-height",type:u.size,triggersBounds:l.any},{name:"min-height-bias-top",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"min-height-bias-bottom",type:u.sizeMaybePercent,triggersBounds:l.any}],M=[{name:"line-style",type:u.lineStyle},{name:"line-color",type:u.color},{name:"line-fill",type:u.fill},{name:"line-cap",type:u.lineCap},{name:"line-opacity",type:u.zeroOneNumber},{name:"line-dash-pattern",type:u.numbers},{name:"line-dash-offset",type:u.number},{name:"line-outline-width",type:u.size},{name:"line-outline-color",type:u.color},{name:"line-gradient-stop-colors",type:u.colors},{name:"line-gradient-stop-positions",type:u.percentages},{name:"curve-style",type:u.curveStyle,triggersBounds:l.any,triggersBoundsOfParallelEdges:function(J,ie){return J===ie?!1:J==="bezier"||ie==="bezier"}},{name:"haystack-radius",type:u.zeroOneNumber,triggersBounds:l.any},{name:"source-endpoint",type:u.edgeEndpoint,triggersBounds:l.any},{name:"target-endpoint",type:u.edgeEndpoint,triggersBounds:l.any},{name:"control-point-step-size",type:u.size,triggersBounds:l.any},{name:"control-point-distances",type:u.bidirectionalSizes,triggersBounds:l.any},{name:"control-point-weights",type:u.numbers,triggersBounds:l.any},{name:"segment-distances",type:u.bidirectionalSizes,triggersBounds:l.any},{name:"segment-weights",type:u.numbers,triggersBounds:l.any},{name:"segment-radii",type:u.numbers,triggersBounds:l.any},{name:"radius-type",type:u.radiusType,triggersBounds:l.any},{name:"taxi-turn",type:u.bidirectionalSizeMaybePercent,triggersBounds:l.any},{name:"taxi-turn-min-distance",type:u.size,triggersBounds:l.any},{name:"taxi-direction",type:u.axisDirection,triggersBounds:l.any},{name:"taxi-radius",type:u.number,triggersBounds:l.any},{name:"edge-distances",type:u.edgeDistances,triggersBounds:l.any},{name:"arrow-scale",type:u.positiveNumber,triggersBounds:l.any},{name:"loop-direction",type:u.angle,triggersBounds:l.any},{name:"loop-sweep",type:u.angle,triggersBounds:l.any},{name:"source-distance-from-node",type:u.size,triggersBounds:l.any},{name:"target-distance-from-node",type:u.size,triggersBounds:l.any}],B=[{name:"ghost",type:u.bool,triggersBounds:l.any},{name:"ghost-offset-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"ghost-offset-y",type:u.bidirectionalSize,triggersBounds:l.any},{name:"ghost-opacity",type:u.zeroOneNumber}],A=[{name:"selection-box-color",type:u.color},{name:"selection-box-opacity",type:u.zeroOneNumber},{name:"selection-box-border-color",type:u.color},{name:"selection-box-border-width",type:u.size},{name:"active-bg-color",type:u.color},{name:"active-bg-opacity",type:u.zeroOneNumber},{name:"active-bg-size",type:u.size},{name:"outside-texture-bg-color",type:u.color},{name:"outside-texture-bg-opacity",type:u.zeroOneNumber}],j=[];dr.pieBackgroundN=16,j.push({name:"pie-size",type:u.sizeMaybePercent}),j.push({name:"pie-hole",type:u.sizeMaybePercent}),j.push({name:"pie-start-angle",type:u.angle});for(var D=1;D<=dr.pieBackgroundN;D++)j.push({name:"pie-"+D+"-background-color",type:u.color}),j.push({name:"pie-"+D+"-background-size",type:u.percent}),j.push({name:"pie-"+D+"-background-opacity",type:u.zeroOneNumber});var I=[];dr.stripeBackgroundN=16,I.push({name:"stripe-size",type:u.sizeMaybePercent}),I.push({name:"stripe-direction",type:u.axisDirectionPrimary});for(var U=1;U<=dr.stripeBackgroundN;U++)I.push({name:"stripe-"+U+"-background-color",type:u.color}),I.push({name:"stripe-"+U+"-background-size",type:u.percent}),I.push({name:"stripe-"+U+"-background-opacity",type:u.zeroOneNumber});var W=[],H=dr.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:u.arrowShape,triggersBounds:l.any},{name:"arrow-color",type:u.color},{name:"arrow-fill",type:u.arrowFill},{name:"arrow-width",type:u.arrowWidth}].forEach(function(X){H.forEach(function(J){var ie=J+"-"+X.name,ce=X.type,de=X.triggersBounds;W.push({name:ie,type:ce,triggersBounds:de})})},{});var z=dr.properties=[].concat(w,b,v,m,y,B,x,p,c,h,g,R,E,T,k,j,I,N,M,W,A),P=dr.propertyGroups={behavior:w,transition:b,visibility:v,overlay:m,underlay:y,ghost:B,commonLabel:x,labelDimensions:p,mainLabel:c,sourceLabel:h,targetLabel:g,nodeBody:R,nodeBorder:E,nodeOutline:T,backgroundImage:k,pie:j,stripe:I,compound:N,edgeLine:M,edgeArrow:W,core:A},F=dr.propertyGroupNames={},G=dr.propertyGroupKeys=Object.keys(P);G.forEach(function(X){F[X]=P[X].map(function(J){return J.name}),P[X].forEach(function(J){return J.groupKey=X})});var $=dr.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"}];dr.propertyNames=z.map(function(X){return X.name});for(var ee=0;ee<z.length;ee++){var re=z[ee];z[re.name]=re}for(var ne=0;ne<$.length;ne++){var Y=$[ne],q=z[Y.pointsTo],K={name:Y.name,alias:!0,pointsTo:q};z.push(K),z[Y.name]=K}})();dr.getDefaultProperty=function(t){return this.getDefaultProperties()[t]};dr.getDefaultProperties=function(){var t=this._private;if(t.defaultProperties!=null)return t.defaultProperties;for(var e=dt({"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","text-metrics":"font","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(l,u){for(var c=1;c<=dr.pieBackgroundN;c++){var h=u.name.replace("{{i}}",c),g=u.value;l[h]=g}return l},{}),{"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(l,u){for(var c=1;c<=dr.stripeBackgroundN;c++){var h=u.name.replace("{{i}}",c),g=u.value;l[h]=g}return l},{}),{"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(l,u){return dr.arrowPrefixes.forEach(function(c){var h=c+"-"+u.name,g=u.value;l[h]=g}),l},{})),r={},n=0;n<this.properties.length;n++){var i=this.properties[n];if(!i.pointsTo){var s=i.name,o=e[s],a=this.parse(s,o);r[s]=a}}return t.defaultProperties=r,t.defaultProperties};dr.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 nh={};nh.parse=function(t,e,r,n){var i=this;if(nr(e))return i.parseImplWarn(t,e,r,n);var s=n==="mapping"||n===!0||n===!1||n==null?"dontcare":n,o=r?"t":"f",a=""+e,l=bw(t,a,o,s),u=i.propCache=i.propCache||[],c;return(c=u[l])||(c=u[l]=i.parseImplWarn(t,e,r,n)),(r||n==="mapping")&&(c=Zn(c),c&&(c.value=Zn(c.value))),c};nh.parseImplWarn=function(t,e,r,n){var i=this.parseImpl(t,e,r,n);return!i&&e!=null&&Bt("The style property `".concat(t,": ").concat(e,"` is invalid")),i&&(i.name==="width"||i.name==="height")&&e==="label"&&Bt("The style value of `label` is deprecated for `"+i.name+"`"),i};nh.parseImpl=function(t,e,r,n){var i=this;t=Gv(t);var s=i.properties[t],o=e,a=i.types;if(!s||e===void 0)return null;s.alias&&(s=s.pointsTo,t=s.name);var l=ut(e);l&&(e=e.trim());var u=s.type;if(!u)return null;if(r&&(e===""||e===null))return{name:t,value:e,bypass:!0,deleteBypass:!0};if(nr(e))return{name:t,value:e,strValue:"fn",mapped:a.fn,bypass:r};var c,h;if(!(!l||n||e.length<7||e[1]!=="a")){if(e.length>=7&&e[0]==="d"&&(c=new RegExp(a.data.regex).exec(e))){if(r)return!1;var g=a.data;return{name:t,value:c,strValue:""+e,mapped:g,field:c[1],bypass:r}}else if(e.length>=10&&e[0]==="m"&&(h=new RegExp(a.mapData.regex).exec(e))){if(r||u.multiple)return!1;var p=a.mapData;if(!(u.color||u.number))return!1;var x=this.parse(t,h[4]);if(!x||x.mapped)return!1;var w=this.parse(t,h[5]);if(!w||w.mapped)return!1;if(x.pfValue===w.pfValue||x.strValue===w.strValue)return Bt("`"+t+": "+e+"` is not a valid mapper because the output range is zero; converting to `"+t+": "+x.strValue+"`"),this.parse(t,x.strValue);if(u.color){var v=x.value,m=w.value,y=v[0]===m[0]&&v[1]===m[1]&&v[2]===m[2]&&(v[3]===m[3]||(v[3]==null||v[3]===1)&&(m[3]==null||m[3]===1));if(y)return!1}return{name:t,value:h,strValue:""+e,mapped:p,field:h[1],fieldMin:parseFloat(h[2]),fieldMax:parseFloat(h[3]),valueMin:x.value,valueMax:w.value,bypass:r}}}if(u.multiple&&n!=="multiple"){var b;if(l?b=e.split(/\s+/):Ut(e)?b=e:b=[e],u.evenMultiple&&b.length%2!==0)return null;for(var _=[],R=[],E=[],T="",k=!1,N=0;N<b.length;N++){var M=i.parse(t,b[N],r,"multiple");k=k||ut(M.value),_.push(M.value),E.push(M.pfValue!=null?M.pfValue:M.value),R.push(M.units),T+=(N>0?" ":"")+M.strValue}return u.validate&&!u.validate(_,R)?null:u.singleEnum&&k?_.length===1&&ut(_[0])?{name:t,value:_[0],strValue:_[0],bypass:r}:null:{name:t,value:_,pfValue:E,strValue:T,bypass:r,units:R}}var B=function(){for(var K=0;K<u.enums.length;K++){var X=u.enums[K];if(X===e)return{name:t,value:e,strValue:""+e,bypass:r}}return null};if(u.number){var A,j="px";if(u.units&&(A=u.units),u.implicitUnits&&(j=u.implicitUnits),!u.unitless)if(l){var D="px|em"+(u.allowPercent?"|\\%":"");A&&(D=A);var I=e.match("^("+yr+")("+D+")?$");I&&(e=I[1],A=I[2]||j)}else(!A||u.implicitUnits)&&(A=j);if(e=parseFloat(e),isNaN(e)&&u.enums===void 0)return null;if(isNaN(e)&&u.enums!==void 0)return e=o,B();if(u.integer&&!wk(e)||u.min!==void 0&&(e<u.min||u.strictMin&&e===u.min)||u.max!==void 0&&(e>u.max||u.strictMax&&e===u.max))return null;var U={name:t,value:e,strValue:""+e+(A||""),units:A,bypass:r};return u.unitless||A!=="px"&&A!=="em"?U.pfValue=e:U.pfValue=A==="px"||!A?e:this.getEmSizeInPixels()*e,(A==="ms"||A==="s")&&(U.pfValue=A==="ms"?e:1e3*e),(A==="deg"||A==="rad")&&(U.pfValue=A==="rad"?e:D3(e)),A==="%"&&(U.pfValue=e/100),U}else if(u.propList){var W=[],H=""+e;if(H!=="none"){for(var z=H.split(/\s*,\s*|\s+/),P=0;P<z.length;P++){var F=z[P].trim();i.properties[F]?W.push(F):Bt("`"+F+"` is not a valid property name")}if(W.length===0)return null}return{name:t,value:W,strValue:W.length===0?"none":W.join(" "),bypass:r}}else if(u.color){var G=dw(e);return G?{name:t,value:G,pfValue:G,strValue:"rgb("+G[0]+","+G[1]+","+G[2]+")",bypass:r}:null}else if(u.regex||u.regexes){if(u.enums){var $=B();if($)return $}for(var ee=u.regexes?u.regexes:[u.regex],re=0;re<ee.length;re++){var ne=new RegExp(ee[re]),Y=ne.exec(e);if(Y)return{name:t,value:u.singleRegexMatchValue?Y[1]:Y,strValue:""+e,bypass:r}}return null}else return u.string?{name:t,value:""+e,strValue:""+e,bypass:r}:u.enums?B():null};var Er=function(e){if(!(this instanceof Er))return new Er(e);if(!$v(e)){Jt("A style must have a core reference");return}this._private={cy:e,coreStyle:{}},this.length=0,this.resetToDefault()},Hr=Er.prototype;Hr.instanceString=function(){return"style"};Hr.clear=function(){for(var t=this._private,e=t.cy,r=e.elements(),n=0;n<this.length;n++)this[n]=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};Hr.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this};Hr.core=function(t){return this._private.coreStyle[t]||this.getDefaultProperty(t)};Hr.selector=function(t){var e=t==="core"?null:new ea(t),r=this.length++;return this[r]={selector:e,properties:[],mappedProperties:[],index:r},this};Hr.css=function(){var t=this,e=arguments;if(e.length===1)for(var r=e[0],n=0;n<t.properties.length;n++){var i=t.properties[n],s=r[i.name];s===void 0&&(s=r[Wc(i.name)]),s!==void 0&&this.cssRule(i.name,s)}else e.length===2&&this.cssRule(e[0],e[1]);return this};Hr.style=Hr.css;Hr.cssRule=function(t,e){var r=this.parse(t,e);if(r){var n=this.length-1;this[n].properties.push(r),this[n].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[n].mappedProperties.push(r);var i=!this[n].selector;i&&(this._private.coreStyle[r.name]=r)}return this};Hr.append=function(t){return cw(t)?t.appendToStyle(this):Ut(t)?this.appendFromJson(t):ut(t)&&this.appendFromString(t),this};Er.fromJson=function(t,e){var r=new Er(t);return r.fromJson(e),r};Er.fromString=function(t,e){return new Er(t).fromString(e)};[kr,Ll,og,ei,rh,lg,dr,nh].forEach(function(t){dt(Hr,t)});Er.types=Hr.types;Er.properties=Hr.properties;Er.propertyGroups=Hr.propertyGroups;Er.propertyGroupNames=Hr.propertyGroupNames;Er.propertyGroupKeys=Hr.propertyGroupKeys;var OL={style:function(e){if(e){var r=this.setStyle(e);r.update()}return this._private.style},setStyle:function(e){var r=this._private;return cw(e)?r.style=e.generateStyle(this):Ut(e)?r.style=Er.fromJson(this,e):ut(e)?r.style=Er.fromString(this,e):r.style=Er(this),r.style},updateStyle:function(){this.mutableElements().updateStyle()}},BL="single",ja={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=BL),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,n,i,s,o,a;switch(e.length){case 0:return r;case 1:if(ut(e[0]))return n=e[0],r[n];if(Dt(e[0])){if(!this._private.panningEnabled)return this;s=e[0],o=s.x,a=s.y,Xe(o)&&(r.x=o),Xe(a)&&(r.y=a),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;n=e[0],i=e[1],(n==="x"||n==="y")&&Xe(i)&&(r[n]=i),this.emit("pan viewport");break}return this.notify("viewport"),this},panBy:function(e,r){var n=arguments,i=this._private.pan,s,o,a,l,u;if(!this._private.panningEnabled)return this;switch(n.length){case 1:Dt(e)&&(a=n[0],l=a.x,u=a.y,Xe(l)&&(i.x+=l),Xe(u)&&(i.y+=u),this.emit("pan viewport"));break;case 2:s=e,o=r,(s==="x"||s==="y")&&Xe(o)&&(i[s]+=o),this.emit("pan viewport");break}return this.notify("viewport"),this},gc:function(){this.notify("gc")},fit:function(e,r){var n=this.getFitViewport(e,r);if(n){var i=this._private;i.zoom=n.zoom,i.pan=n.pan,this.emit("pan zoom viewport"),this.notify("viewport")}return this},getFitViewport:function(e,r){if(Xe(e)&&r===void 0&&(r=e,e=void 0),!(!this._private.panningEnabled||!this._private.zoomingEnabled)){var n;if(ut(e)){var i=e;e=this.$(i)}else if(Ck(e)){var s=e;n={x1:s.x1,y1:s.y1,x2:s.x2,y2:s.y2},n.w=n.x2-n.x1,n.h=n.y2-n.y1}else mn(e)||(e=this.mutableElements());if(!(mn(e)&&e.empty())){n=n||e.boundingBox();var o=this.width(),a=this.height(),l;if(r=Xe(r)?r:0,!isNaN(o)&&!isNaN(a)&&o>0&&a>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0){l=Math.min((o-2*r)/n.w,(a-2*r)/n.h),l=l>this._private.maxZoom?this._private.maxZoom:l,l=l<this._private.minZoom?this._private.minZoom:l;var u={x:(o-l*(n.x1+n.x2))/2,y:(a-l*(n.y1+n.y2))/2};return{zoom:l,pan:u}}}}},zoomRange:function(e,r){var n=this._private;if(r==null){var i=e;e=i.min,r=i.max}return Xe(e)&&Xe(r)&&e<=r?(n.minZoom=e,n.maxZoom=r):Xe(e)&&r===void 0&&e<=n.maxZoom?n.minZoom=e:Xe(r)&&e===void 0&&r>=n.minZoom&&(n.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,n=r.pan,i=r.zoom,s,o,a=!1;if(r.zoomingEnabled||(a=!0),Xe(e)?o=e:Dt(e)&&(o=e.level,e.position!=null?s=Gc(e.position,i,n):e.renderedPosition!=null&&(s=e.renderedPosition),s!=null&&!r.panningEnabled&&(a=!0)),o=o>r.maxZoom?r.maxZoom:o,o=o<r.minZoom?r.minZoom:o,a||!Xe(o)||o===i||s!=null&&(!Xe(s.x)||!Xe(s.y)))return null;if(s!=null){var l=n,u=i,c=o,h={x:-c/u*(s.x-l.x)+s.x,y:-c/u*(s.y-l.y)+s.y};return{zoomed:!0,panned:!0,zoom:c,pan:h}}else return{zoomed:!0,panned:!1,zoom:o,pan:n}},zoom:function(e){if(e===void 0)return this._private.zoom;var r=this.getZoomedViewport(e),n=this._private;return r==null||!r.zoomed?this:(n.zoom=r.zoom,r.panned&&(n.pan.x=r.pan.x,n.pan.y=r.pan.y),this.emit("zoom"+(r.panned?" pan":"")+" viewport"),this.notify("viewport"),this)},viewport:function(e){var r=this._private,n=!0,i=!0,s=[],o=!1,a=!1;if(!e)return this;if(Xe(e.zoom)||(n=!1),Dt(e.pan)||(i=!1),!n&&!i)return this;if(n){var l=e.zoom;l<r.minZoom||l>r.maxZoom||!r.zoomingEnabled?o=!0:(r.zoom=l,s.push("zoom"))}if(i&&(!o||!e.cancelOnFailedZoom)&&r.panningEnabled){var u=e.pan;Xe(u.x)&&(r.pan.x=u.x,a=!1),Xe(u.y)&&(r.pan.y=u.y,a=!1),a||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(ut(e)){var n=e;e=this.mutableElements().filter(n)}else mn(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 a={x:(s-r*(i.x1+i.x2))/2,y:(o-r*(i.y1+i.y2))/2};return a}}},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,n=this;return e.sizeCache=e.sizeCache||(r?(function(){var i=n.window().getComputedStyle(r),s=function(a){return parseFloat(i.getPropertyValue(a))};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,n=this.renderedExtent(),i={x1:(n.x1-e.x)/r,x2:(n.x2-e.x)/r,y1:(n.y1-e.y)/r,y2:(n.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}};ja.centre=ja.center;ja.autolockNodes=ja.autolock;ja.autoungrabifyNodes=ja.autoungrabify;var gl={data:Ot.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:Ot.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:Ot.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Ot.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};gl.attr=gl.data;gl.removeAttr=gl.removeData;var ml=function(e){var r=this;e=dt({},e);var n=e.container;n&&!Ec(n)&&Ec(n[0])&&(n=n[0]);var i=n?n._cyreg:null;i=i||{},i&&i.cy&&(i.cy.destroy(),i={});var s=i.readies=i.readies||[];n&&(n._cyreg=i),i.cy=r;var o=mr!==void 0&&n!==void 0&&!e.headless,a=e;a.layout=dt({name:o?"grid":"null"},a.layout),a.renderer=dt({name:o?"canvas":"null"},a.renderer);var l=function(x,w,v){return w!==void 0?w:v!==void 0?v:x},u=this._private={container:n,ready:!1,options:a,elements:new Dr(this),listeners:[],aniEles:new Dr(this),data:a.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:l(!0,a.zoomingEnabled),userZoomingEnabled:l(!0,a.userZoomingEnabled),panningEnabled:l(!0,a.panningEnabled),userPanningEnabled:l(!0,a.userPanningEnabled),boxSelectionEnabled:l(!0,a.boxSelectionEnabled),autolock:l(!1,a.autolock,a.autolockNodes),autoungrabify:l(!1,a.autoungrabify,a.autoungrabifyNodes),autounselectify:l(!1,a.autounselectify),styleEnabled:a.styleEnabled===void 0?o:a.styleEnabled,zoom:Xe(a.zoom)?a.zoom:1,pan:{x:Dt(a.pan)&&Xe(a.pan.x)?a.pan.x:0,y:Dt(a.pan)&&Xe(a.pan.y)?a.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:l(250,a.multiClickDebounceTime)};this.createEmitter(),this.selectionType(a.selectionType),this.zoomRange({min:a.minZoom,max:a.maxZoom});var c=function(x,w){var v=x.some(Ek);if(v)return qs.all(x).then(w);w(x)};u.styleEnabled&&r.setStyle([]);var h=dt({},a,a.renderer);r.initRenderer(h);var g=function(x,w,v){r.notifications(!1);var m=r.mutableElements();m.length>0&&m.remove(),x!=null&&(Dt(x)||Ut(x))&&r.add(x),r.one("layoutready",function(b){r.notifications(!0),r.emit(b),r.one("load",w),r.emitAndNotify("load")}).one("layoutstop",function(){r.one("done",v),r.emit("done")});var y=dt({},r._private.options.layout);y.eles=r.elements(),r.layout(y).run()};c([a.style,a.elements],function(p){var x=p[0],w=p[1];u.styleEnabled&&r.style().append(x),g(w,function(){r.startAnimationLoop(),u.ready=!0,nr(a.ready)&&r.on("ready",a.ready);for(var v=0;v<s.length;v++){var m=s[v];r.on("ready",m)}i&&(i.readies=[]),r.emit("ready")},a.done)})},Ac=ml.prototype;dt(Ac,{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 mr;var r=this._private.container.ownerDocument;return r===void 0||r==null?mr:r.defaultView||mr},mount:function(e){if(e!=null){var r=this,n=r._private,i=n.options;return!Ec(e)&&Ec(e[0])&&(e=e[0]),r.stopAnimationLoop(),r.destroyRenderer(),n.container=e,n.styleEnabled=!0,r.invalidateSize(),r.initRenderer(dt({},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 Zn(this._private.options)},json:function(e){var r=this,n=r._private,i=r.mutableElements(),s=function(_){return r.getElementById(_.id())};if(Dt(e)){if(r.startBatch(),e.elements){var o={},a=function(_,R){for(var E=[],T=[],k=0;k<_.length;k++){var N=_[k];if(!N.data.id){Bt("cy.json() cannot handle elements without an ID attribute");continue}var M=""+N.data.id,B=r.getElementById(M);o[M]=!0,B.length!==0?T.push({ele:B,json:N}):(R&&(N.group=R),E.push(N))}r.add(E);for(var A=0;A<T.length;A++){var j=T[A],D=j.ele,I=j.json;D.json(I)}};if(Ut(e.elements))a(e.elements);else for(var l=["nodes","edges"],u=0;u<l.length;u++){var c=l[u],h=e.elements[c];Ut(h)&&a(h,c)}var g=r.collection();i.filter(function(b){return!o[b.id()]}).forEach(function(b){b.isParent()?g.merge(b):b.remove()}),g.forEach(function(b){return b.children().move({parent:null})}),g.forEach(function(b){return s(b).remove()})}e.style&&r.style(e.style),e.zoom!=null&&e.zoom!==n.zoom&&r.zoom(e.zoom),e.pan&&(e.pan.x!==n.pan.x||e.pan.y!==n.pan.y)&&r.pan(e.pan),e.data&&r.data(e.data);for(var p=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],x=0;x<p.length;x++){var w=p[x];e[w]!=null&&r[w](e[w])}return r.endBatch(),this}else{var v=!!e,m={};v?m.elements=this.elements().map(function(b){return b.json()}):(m.elements={},i.forEach(function(b){var _=b.group();m.elements[_]||(m.elements[_]=[]),m.elements[_].push(b.json())})),this._private.styleEnabled&&(m.style=r.style().json()),m.data=Zn(r.data());var y=n.options;return m.zoomingEnabled=n.zoomingEnabled,m.userZoomingEnabled=n.userZoomingEnabled,m.zoom=n.zoom,m.minZoom=n.minZoom,m.maxZoom=n.maxZoom,m.panningEnabled=n.panningEnabled,m.userPanningEnabled=n.userPanningEnabled,m.pan=Zn(n.pan),m.boxSelectionEnabled=n.boxSelectionEnabled,m.renderer=Zn(y.renderer),m.hideEdgesOnViewport=y.hideEdgesOnViewport,m.textureOnViewport=y.textureOnViewport,m.wheelSensitivity=y.wheelSensitivity,m.motionBlur=y.motionBlur,m.multiClickDebounceTime=y.multiClickDebounceTime,m}}});Ac.$id=Ac.getElementById;[kL,DL,c_,mv,pc,ML,yv,vc,OL,ja,gl].forEach(function(t){dt(Ac,t)});var FL={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}},jL={maximal:!1,acyclic:!1},bs=function(e){return e.scratch("breadthfirst")},m1=function(e,r){return e.scratch("breadthfirst",r)};function h_(t){this.options=dt({},FL,jL,t)}h_.prototype.run=function(){var t=this.options,e=t.cy,r=t.eles,n=r.nodes().filter(function(Ne){return Ne.isChildless()}),i=r,s=t.directed,o=t.acyclic||t.maximal||t.maximalAdjustments>0,a=!!t.boundingBox,l=Kr(a?t.boundingBox:structuredClone(e.extent())),u;if(mn(t.roots))u=t.roots;else if(Ut(t.roots)){for(var c=[],h=0;h<t.roots.length;h++){var g=t.roots[h],p=e.getElementById(g);c.push(p)}u=e.collection(c)}else if(ut(t.roots))u=e.$(t.roots);else if(s)u=n.roots();else{var x=r.components();u=e.collection();for(var w=function(){var Ee=x[v],Me=Ee.maxDegree(!1),Pe=Ee.filter(function(De){return De.degree(!1)===Me});u=u.add(Pe)},v=0;v<x.length;v++)w()}var m=[],y={},b=function(Ee,Me){m[Me]==null&&(m[Me]=[]);var Pe=m[Me].length;m[Me].push(Ee),m1(Ee,{index:Pe,depth:Me})},_=function(Ee,Me){var Pe=bs(Ee),De=Pe.depth,Ue=Pe.index;m[De][Ue]=null,Ee.isChildless()&&b(Ee,Me)};i.bfs({roots:u,directed:t.directed,visit:function(Ee,Me,Pe,De,Ue){var Ye=Ee[0],ge=Ye.id();Ye.isChildless()&&b(Ye,Ue),y[ge]=!0}});for(var R=[],E=0;E<n.length;E++){var T=n[E];y[T.id()]||R.push(T)}var k=function(Ee){for(var Me=m[Ee],Pe=0;Pe<Me.length;Pe++){var De=Me[Pe];if(De==null){Me.splice(Pe,1),Pe--;continue}m1(De,{depth:Ee,index:Pe})}},N=function(Ee,Me){for(var Pe=bs(Ee),De=Ee.incomers().filter(function(me){return me.isNode()&&r.has(me)}),Ue=-1,Ye=Ee.id(),ge=0;ge<De.length;ge++){var Ce=De[ge],Ae=bs(Ce);Ue=Math.max(Ue,Ae.depth)}if(Pe.depth<=Ue){if(!t.acyclic&&Me[Ye])return null;var Be=Ue+1;return _(Ee,Be),Me[Ye]=Be,!0}return!1};if(s&&o){var M=[],B={},A=function(Ee){return M.push(Ee)},j=function(){return M.shift()};for(n.forEach(function(Ne){return M.push(Ne)});M.length>0;){var D=j(),I=N(D,B);if(I)D.outgoers().filter(function(Ne){return Ne.isNode()&&r.has(Ne)}).forEach(A);else if(I===null){Bt("Detected double maximal shift for node `"+D.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var U=0;if(t.avoidOverlap)for(var W=0;W<n.length;W++){var H=n[W],z=H.layoutDimensions(t),P=z.w,F=z.h;U=Math.max(U,P,F)}var G={},$=function(Ee){if(G[Ee.id()])return G[Ee.id()];for(var Me=bs(Ee).depth,Pe=Ee.neighborhood(),De=0,Ue=0,Ye=0;Ye<Pe.length;Ye++){var ge=Pe[Ye];if(!(ge.isEdge()||ge.isParent()||!n.has(ge))){var Ce=bs(ge);if(Ce!=null){var Ae=Ce.index,Be=Ce.depth;if(!(Ae==null||Be==null)){var me=m[Be].length;Be<Me&&(De+=Ae/me,Ue++)}}}}return Ue=Math.max(1,Ue),De=De/Ue,Ue===0&&(De=0),G[Ee.id()]=De,De},ee=function(Ee,Me){var Pe=$(Ee),De=$(Me),Ue=Pe-De;return Ue===0?fw(Ee.id(),Me.id()):Ue};t.depthSort!==void 0&&(ee=t.depthSort);for(var re=m.length,ne=0;ne<re;ne++)m[ne].sort(ee),k(ne);for(var Y=[],q=0;q<R.length;q++)Y.push(R[q]);var K=function(){for(var Ee=0;Ee<re;Ee++)k(Ee)};Y.length&&(m.unshift(Y),re=m.length,K());for(var X=0,J=0;J<re;J++)X=Math.max(m[J].length,X);var ie={x:l.x1+l.w/2,y:l.y1+l.h/2},ce=n.reduce(function(Ne,Ee){return(function(Me){return{w:Ne.w===-1?Me.w:(Ne.w+Me.w)/2,h:Ne.h===-1?Me.h:(Ne.h+Me.h)/2}})(Ee.boundingBox({includeLabels:t.nodeDimensionsIncludeLabels}))},{w:-1,h:-1}),de=Math.max(re===1?0:a?(l.h-t.padding*2-ce.h)/(re-1):(l.h-t.padding*2-ce.h)/(re+1),U),Le=m.reduce(function(Ne,Ee){return Math.max(Ne,Ee.length)},0),je=function(Ee){var Me=bs(Ee),Pe=Me.depth,De=Me.index;if(t.circle){var Ue=Math.min(l.w/2/re,l.h/2/re);Ue=Math.max(Ue,U);var Ye=Ue*Pe+Ue-(re>0&&m[0].length<=3?Ue/2:0),ge=2*Math.PI/m[Pe].length*De;return Pe===0&&m[0].length===1&&(Ye=1),{x:ie.x+Ye*Math.cos(ge),y:ie.y+Ye*Math.sin(ge)}}else{var Ce=m[Pe].length,Ae=Math.max(Ce===1?0:a?(l.w-t.padding*2-ce.w)/((t.grid?Le:Ce)-1):(l.w-t.padding*2-ce.w)/((t.grid?Le:Ce)+1),U),Be={x:ie.x+(De+1-(Ce+1)/2)*Ae,y:ie.y+(Pe+1-(re+1)/2)*de};return Be}},_e={downward:0,leftward:90,upward:180,rightward:-90};Object.keys(_e).indexOf(t.direction)===-1&&Jt("Invalid direction '".concat(t.direction,"' specified for breadthfirst layout. Valid values are: ").concat(Object.keys(_e).join(", ")));var ke=function(Ee){return e3(je(Ee),l,_e[t.direction])};return r.nodes().layoutPositions(this,t,ke),this};var zL={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 f_(t){this.options=dt({},zL,t)}f_.prototype.run=function(){var t=this.options,e=t,r=t.cy,n=e.eles,i=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,s=n.nodes().not(":parent");e.sort&&(s=s.sort(e.sort));for(var o=Kr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),a={x:o.x1+o.w/2,y:o.y1+o.h/2},l=e.sweep===void 0?2*Math.PI-2*Math.PI/s.length:e.sweep,u=l/Math.max(1,s.length-1),c,h=0,g=0;g<s.length;g++){var p=s[g],x=p.layoutDimensions(e),w=x.w,v=x.h;h=Math.max(h,w,v)}if(Xe(e.radius)?c=e.radius:s.length<=1?c=0:c=Math.min(o.h,o.w)/2-h,s.length>1&&e.avoidOverlap){h*=1.75;var m=Math.cos(u)-Math.cos(0),y=Math.sin(u)-Math.sin(0),b=Math.sqrt(h*h/(m*m+y*y));c=Math.max(b,c)}var _=function(E,T){var k=e.startAngle+T*u*(i?1:-1),N=c*Math.cos(k),M=c*Math.sin(k),B={x:a.x+N,y:a.y+M};return B};return n.nodes().layoutPositions(this,e,_),this};var HL={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 d_(t){this.options=dt({},HL,t)}d_.prototype.run=function(){for(var t=this.options,e=t,r=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,n=t.cy,i=e.eles,s=i.nodes().not(":parent"),o=Kr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),a={x:o.x1+o.w/2,y:o.y1+o.h/2},l=[],u=0,c=0;c<s.length;c++){var h=s[c],g=void 0;g=e.concentric(h),l.push({value:g,node:h}),h._private.scratch.concentric=g}s.updateStyle();for(var p=0;p<s.length;p++){var x=s[p],w=x.layoutDimensions(e);u=Math.max(u,w.w,w.h)}l.sort(function(de,Le){return Le.value-de.value});for(var v=e.levelWidth(s),m=[[]],y=m[0],b=0;b<l.length;b++){var _=l[b];if(y.length>0){var R=Math.abs(y[0].value-_.value);R>=v&&(y=[],m.push(y))}y.push(_)}var E=u+e.minNodeSpacing;if(!e.avoidOverlap){var T=m.length>0&&m[0].length>1,k=Math.min(o.w,o.h)/2-E,N=k/(m.length+T?1:0);E=Math.min(E,N)}for(var M=0,B=0;B<m.length;B++){var A=m[B],j=e.sweep===void 0?2*Math.PI-2*Math.PI/A.length:e.sweep,D=A.dTheta=j/Math.max(1,A.length-1);if(A.length>1&&e.avoidOverlap){var I=Math.cos(D)-Math.cos(0),U=Math.sin(D)-Math.sin(0),W=Math.sqrt(E*E/(I*I+U*U));M=Math.max(W,M)}A.r=M,M+=E}if(e.equidistant){for(var H=0,z=0,P=0;P<m.length;P++){var F=m[P],G=F.r-z;H=Math.max(H,G)}z=0;for(var $=0;$<m.length;$++){var ee=m[$];$===0&&(z=ee.r),ee.r=z,z+=H}}for(var re={},ne=0;ne<m.length;ne++)for(var Y=m[ne],q=Y.dTheta,K=Y.r,X=0;X<Y.length;X++){var J=Y[X],ie=e.startAngle+(r?1:-1)*q*X,ce={x:a.x+K*Math.cos(ie),y:a.y+K*Math.sin(ie)};re[J.node.id()]=ce}return i.nodes().layoutPositions(this,e,function(de){var Le=de.id();return re[Le]}),this};var Tp,UL={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 ih(t){this.options=dt({},UL,t),this.options.layout=this;var e=this.options.eles.nodes(),r=this.options.eles.edges(),n=r.filter(function(i){var s=i.source().data("id"),o=i.target().data("id"),a=e.some(function(u){return u.data("id")===s}),l=e.some(function(u){return u.data("id")===o});return!a||!l});this.options.eles=this.options.eles.not(n)}ih.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?Tp=!0:Tp=!1;var n=WL(e,r,t);Tp&&$L(n),t.randomize&&GL(n);var i=vi(),s=function(){qL(n,e,t),t.fit===!0&&e.fit(t.padding)},o=function(g){return!(r.stopped||g>=t.numIter||(YL(n,t),n.temperature=n.temperature*t.coolingFactor,n.temperature<t.minTemp))},a=function(){if(t.animate===!0||t.animate===!1)s(),r.one("layoutstop",t.stop),r.emit({type:"layoutstop",layout:r});else{var g=t.eles.nodes(),p=v_(n,t,g);g.layoutPositions(r,t,p)}},l=0,u=!0;if(t.animate===!0){var c=function(){for(var g=0;u&&g<t.refresh;)u=o(l),l++,g++;if(!u)x1(n,t),a();else{var p=vi();p-i>=t.animationThreshold&&s(),kc(c)}};c()}else{for(;u;)u=o(l),l++;x1(n,t),a()}return this};ih.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this};ih.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var WL=function(e,r,n){for(var i=n.eles.edges(),s=n.eles.nodes(),o=Kr(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),a={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:s.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:i.size(),temperature:n.initialTemp,clientWidth:o.w,clientHeight:o.h,boundingBox:o},l=n.eles.components(),u={},c=0;c<l.length;c++)for(var h=l[c],g=0;g<h.length;g++){var p=h[g];u[p.id()]=c}for(var c=0;c<a.nodeSize;c++){var x=s[c],w=x.layoutDimensions(n),v={};v.isLocked=x.locked(),v.id=x.data("id"),v.parentId=x.data("parent"),v.cmptId=u[x.id()],v.children=[],v.positionX=x.position("x"),v.positionY=x.position("y"),v.offsetX=0,v.offsetY=0,v.height=w.w,v.width=w.h,v.maxX=v.positionX+v.width/2,v.minX=v.positionX-v.width/2,v.maxY=v.positionY+v.height/2,v.minY=v.positionY-v.height/2,v.padLeft=parseFloat(x.style("padding")),v.padRight=parseFloat(x.style("padding")),v.padTop=parseFloat(x.style("padding")),v.padBottom=parseFloat(x.style("padding")),v.nodeRepulsion=nr(n.nodeRepulsion)?n.nodeRepulsion(x):n.nodeRepulsion,a.layoutNodes.push(v),a.idToIndex[v.id]=c}for(var m=[],y=0,b=-1,_=[],c=0;c<a.nodeSize;c++){var x=a.layoutNodes[c],R=x.parentId;R!=null?a.layoutNodes[a.idToIndex[R]].children.push(x.id):(m[++b]=x.id,_.push(x.id))}for(a.graphSet.push(_);y<=b;){var E=m[y++],T=a.idToIndex[E],p=a.layoutNodes[T],k=p.children;if(k.length>0){a.graphSet.push(k);for(var c=0;c<k.length;c++)m[++b]=k[c]}}for(var c=0;c<a.graphSet.length;c++)for(var N=a.graphSet[c],g=0;g<N.length;g++){var M=a.idToIndex[N[g]];a.indexToGraph[M]=c}for(var c=0;c<a.edgeSize;c++){var B=i[c],A={};A.id=B.data("id"),A.sourceId=B.data("source"),A.targetId=B.data("target");var j=nr(n.idealEdgeLength)?n.idealEdgeLength(B):n.idealEdgeLength,D=nr(n.edgeElasticity)?n.edgeElasticity(B):n.edgeElasticity,I=a.idToIndex[A.sourceId],U=a.idToIndex[A.targetId],W=a.indexToGraph[I],H=a.indexToGraph[U];if(W!=H){for(var z=VL(A.sourceId,A.targetId,a),P=a.graphSet[z],F=0,v=a.layoutNodes[I];P.indexOf(v.id)===-1;)v=a.layoutNodes[a.idToIndex[v.parentId]],F++;for(v=a.layoutNodes[U];P.indexOf(v.id)===-1;)v=a.layoutNodes[a.idToIndex[v.parentId]],F++;j*=F*n.nestingFactor}A.idealLength=j,A.elasticity=D,a.layoutEdges.push(A)}return a},VL=function(e,r,n){var i=p_(e,r,0,n);return 2>i.count?0:i.graph},p_=function(e,r,n,i){var s=i.graphSet[n];if(-1<s.indexOf(e)&&-1<s.indexOf(r))return{count:2,graph:n};for(var o=0,a=0;a<s.length;a++){var l=s[a],u=i.idToIndex[l],c=i.layoutNodes[u].children;if(c.length!==0){var h=i.indexToGraph[i.idToIndex[c[0]]],g=p_(e,r,h,i);if(g.count!==0)if(g.count===1){if(o++,o===2)break}else return g}}return{count:o,graph:n}},$L,GL=function(e,r){for(var n=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()*n,o.positionY=Math.random()*i)}},v_=function(e,r,n){var i=e.boundingBox,s={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return r.boundingBox&&(n.forEach(function(o){var a=e.layoutNodes[e.idToIndex[o.data("id")]];s.x1=Math.min(s.x1,a.positionX),s.x2=Math.max(s.x2,a.positionX),s.y1=Math.min(s.y1,a.positionY),s.y2=Math.max(s.y2,a.positionY)}),s.w=s.x2-s.x1,s.h=s.y2-s.y1),function(o,a){var l=e.layoutNodes[e.idToIndex[o.data("id")]];if(r.boundingBox){var u=s.w===0?.5:(l.positionX-s.x1)/s.w,c=s.h===0?.5:(l.positionY-s.y1)/s.h;return{x:i.x1+u*i.w,y:i.y1+c*i.h}}else return{x:l.positionX,y:l.positionY}}},qL=function(e,r,n){var i=n.layout,s=n.eles.nodes(),o=v_(e,n,s);s.positions(o),e.ready!==!0&&(e.ready=!0,i.one("layoutready",n.ready),i.emit({type:"layoutready",layout:this}))},YL=function(e,r,n){XL(e,r),ZL(e),JL(e,r),eN(e),tN(e)},XL=function(e,r){for(var n=0;n<e.graphSet.length;n++)for(var i=e.graphSet[n],s=i.length,o=0;o<s;o++)for(var a=e.layoutNodes[e.idToIndex[i[o]]],l=o+1;l<s;l++){var u=e.layoutNodes[e.idToIndex[i[l]]];KL(a,u,e,r)}},y1=function(e){return-e+2*e*Math.random()},KL=function(e,r,n,i){var s=e.cmptId,o=r.cmptId;if(!(s!==o&&!n.isCompound)){var a=r.positionX-e.positionX,l=r.positionY-e.positionY,u=1;a===0&&l===0&&(a=y1(u),l=y1(u));var c=QL(e,r,a,l);if(c>0)var h=i.nodeOverlap*c,g=Math.sqrt(a*a+l*l),p=h*a/g,x=h*l/g;else var w=Mc(e,a,l),v=Mc(r,-1*a,-1*l),m=v.x-w.x,y=v.y-w.y,b=m*m+y*y,g=Math.sqrt(b),h=(e.nodeRepulsion+r.nodeRepulsion)/b,p=h*m/g,x=h*y/g;e.isLocked||(e.offsetX-=p,e.offsetY-=x),r.isLocked||(r.offsetX+=p,r.offsetY+=x)}},QL=function(e,r,n,i){if(n>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},Mc=function(e,r,n){var i=e.positionX,s=e.positionY,o=e.height||1,a=e.width||1,l=n/r,u=o/a,c={};return r===0&&0<n||r===0&&0>n?(c.x=i,c.y=s+o/2,c):0<r&&-1*u<=l&&l<=u?(c.x=i+a/2,c.y=s+a*n/2/r,c):0>r&&-1*u<=l&&l<=u?(c.x=i-a/2,c.y=s-a*n/2/r,c):0<n&&(l<=-1*u||l>=u)?(c.x=i+o*r/2/n,c.y=s+o/2,c):(0>n&&(l<=-1*u||l>=u)&&(c.x=i-o*r/2/n,c.y=s-o/2),c)},ZL=function(e,r){for(var n=0;n<e.edgeSize;n++){var i=e.layoutEdges[n],s=e.idToIndex[i.sourceId],o=e.layoutNodes[s],a=e.idToIndex[i.targetId],l=e.layoutNodes[a],u=l.positionX-o.positionX,c=l.positionY-o.positionY;if(!(u===0&&c===0)){var h=Mc(o,u,c),g=Mc(l,-1*u,-1*c),p=g.x-h.x,x=g.y-h.y,w=Math.sqrt(p*p+x*x),v=Math.pow(i.idealLength-w,2)/i.elasticity;if(w!==0)var m=v*p/w,y=v*x/w;else var m=0,y=0;o.isLocked||(o.offsetX+=m,o.offsetY+=y),l.isLocked||(l.offsetX-=m,l.offsetY-=y)}}},JL=function(e,r){if(r.gravity!==0)for(var n=1,i=0;i<e.graphSet.length;i++){var s=e.graphSet[i],o=s.length;if(i===0)var a=e.clientHeight/2,l=e.clientWidth/2;else var u=e.layoutNodes[e.idToIndex[s[0]]],c=e.layoutNodes[e.idToIndex[u.parentId]],a=c.positionX,l=c.positionY;for(var h=0;h<o;h++){var g=e.layoutNodes[e.idToIndex[s[h]]];if(!g.isLocked){var p=a-g.positionX,x=l-g.positionY,w=Math.sqrt(p*p+x*x);if(w>n){var v=r.gravity*p/w,m=r.gravity*x/w;g.offsetX+=v,g.offsetY+=m}}}}},eN=function(e,r){var n=[],i=0,s=-1;for(n.push.apply(n,e.graphSet[0]),s+=e.graphSet[0].length;i<=s;){var o=n[i++],a=e.idToIndex[o],l=e.layoutNodes[a],u=l.children;if(0<u.length&&!l.isLocked){for(var c=l.offsetX,h=l.offsetY,g=0;g<u.length;g++){var p=e.layoutNodes[e.idToIndex[u[g]]];p.offsetX+=c,p.offsetY+=h,n[++s]=u[g]}l.offsetX=0,l.offsetY=0}}},tN=function(e,r){for(var n=0;n<e.nodeSize;n++){var i=e.layoutNodes[n];0<i.children.length&&(i.maxX=void 0,i.minX=void 0,i.maxY=void 0,i.minY=void 0)}for(var n=0;n<e.nodeSize;n++){var i=e.layoutNodes[n];if(!(0<i.children.length||i.isLocked)){var s=rN(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,g_(i,e)}}for(var n=0;n<e.nodeSize;n++){var i=e.layoutNodes[n];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)}},rN=function(e,r,n){var i=Math.sqrt(e*e+r*r);if(i>n)var s={x:n*e/i,y:n*r/i};else var s={x:e,y:r};return s},g_=function(e,r){var n=e.parentId;if(n!=null){var i=r.layoutNodes[r.idToIndex[n]],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 g_(i,r)}},x1=function(e,r){for(var n=e.layoutNodes,i=[],s=0;s<n.length;s++){var o=n[s],a=o.cmptId,l=i[a]=i[a]||[];l.push(o)}for(var u=0,s=0;s<i.length;s++){var c=i[s];if(c){c.x1=1/0,c.x2=-1/0,c.y1=1/0,c.y2=-1/0;for(var h=0;h<c.length;h++){var g=c[h];c.x1=Math.min(c.x1,g.positionX-g.width/2),c.x2=Math.max(c.x2,g.positionX+g.width/2),c.y1=Math.min(c.y1,g.positionY-g.height/2),c.y2=Math.max(c.y2,g.positionY+g.height/2)}c.w=c.x2-c.x1,c.h=c.y2-c.y1,u+=c.w*c.h}}i.sort(function(y,b){return b.w*b.h-y.w*y.h});for(var p=0,x=0,w=0,v=0,m=Math.sqrt(u)*e.clientWidth/e.clientHeight,s=0;s<i.length;s++){var c=i[s];if(c){for(var h=0;h<c.length;h++){var g=c[h];g.isLocked||(g.positionX+=p-c.x1,g.positionY+=x-c.y1)}p+=c.w+r.componentSpacing,w+=c.w+r.componentSpacing,v=Math.max(v,c.h),w>m&&(x+=v+r.componentSpacing,p=0,w=0,v=0)}}},nN={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 m_(t){this.options=dt({},nN,t)}m_.prototype.run=function(){var t=this.options,e=t,r=t.cy,n=e.eles,i=n.nodes().not(":parent");e.sort&&(i=i.sort(e.sort));var s=Kr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(s.h===0||s.w===0)n.nodes().layoutPositions(this,e,function($){return{x:s.x1,y:s.y1}});else{var o=i.size(),a=Math.sqrt(o*s.h/s.w),l=Math.round(a),u=Math.round(s.w/s.h*a),c=function(ee){if(ee==null)return Math.min(l,u);var re=Math.min(l,u);re==l?l=ee:u=ee},h=function(ee){if(ee==null)return Math.max(l,u);var re=Math.max(l,u);re==l?l=ee:u=ee},g=e.rows,p=e.cols!=null?e.cols:e.columns;if(g!=null&&p!=null)l=g,u=p;else if(g!=null&&p==null)l=g,u=Math.ceil(o/l);else if(g==null&&p!=null)u=p,l=Math.ceil(o/u);else if(u*l>o){var x=c(),w=h();(x-1)*w>=o?c(x-1):(w-1)*x>=o&&h(w-1)}else for(;u*l<o;){var v=c(),m=h();(m+1)*v>=o?h(m+1):c(v+1)}var y=s.w/u,b=s.h/l;if(e.condense&&(y=0,b=0),e.avoidOverlap)for(var _=0;_<i.length;_++){var R=i[_],E=R._private.position;(E.x==null||E.y==null)&&(E.x=0,E.y=0);var T=R.layoutDimensions(e),k=e.avoidOverlapPadding,N=T.w+k,M=T.h+k;y=Math.max(y,N),b=Math.max(b,M)}for(var B={},A=function(ee,re){return!!B["c-"+ee+"-"+re]},j=function(ee,re){B["c-"+ee+"-"+re]=!0},D=0,I=0,U=function(){I++,I>=u&&(I=0,D++)},W={},H=0;H<i.length;H++){var z=i[H],P=e.position(z);if(P&&(P.row!==void 0||P.col!==void 0)){var F={row:P.row,col:P.col};if(F.col===void 0)for(F.col=0;A(F.row,F.col);)F.col++;else if(F.row===void 0)for(F.row=0;A(F.row,F.col);)F.row++;W[z.id()]=F,j(F.row,F.col)}}var G=function(ee,re){var ne,Y;if(ee.locked()||ee.isParent())return!1;var q=W[ee.id()];if(q)ne=q.col*y+y/2+s.x1,Y=q.row*b+b/2+s.y1;else{for(;A(D,I);)U();ne=I*y+y/2+s.x1,Y=D*b+b/2+s.y1,j(D,I),U()}return{x:ne,y:Y}};i.layoutPositions(this,e,G)}return this};var iN={ready:function(){},stop:function(){}};function ug(t){this.options=dt({},iN,t)}ug.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};ug.prototype.stop=function(){return this};var aN={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 y_(t){this.options=dt({},aN,t)}y_.prototype.run=function(){var t=this.options,e=t.eles,r=e.nodes(),n=nr(t.positions);function i(s){if(t.positions==null)return k3(s.position());if(n)return t.positions(s);var o=t.positions[s._private.data.id];return o??null}return r.layoutPositions(this,t,function(s,o){var a=i(s);return s.locked()||a==null?!1:a}),this};var sN={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 x_(t){this.options=dt({},sN,t)}x_.prototype.run=function(){var t=this.options,e=t.cy,r=t.eles,n=Kr(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),i=function(o,a){return{x:n.x1+Math.round(Math.random()*n.w),y:n.y1+Math.round(Math.random()*n.h)}};return r.nodes().layoutPositions(this,t,i),this};var oN=[{name:"breadthfirst",impl:h_},{name:"circle",impl:f_},{name:"concentric",impl:d_},{name:"cose",impl:ih},{name:"grid",impl:m_},{name:"null",impl:ug},{name:"preset",impl:y_},{name:"random",impl:x_}];function b_(t){this.options=t,this.notifications=0}var b1=function(){},w1=function(){throw new Error("A headless instance can not render images")};b_.prototype={recalculateRenderedStyle:b1,notify:function(){this.notifications++},init:b1,isHeadless:function(){return!0},png:w1,jpg:w1};var cg={};cg.arrowShapeWidth=.3;cg.registerArrowShapes=function(){var t=this.arrowShapes={},e=this,r=function(u,c,h,g,p,x,w){var v=p.x-h/2-w,m=p.x+h/2+w,y=p.y-h/2-w,b=p.y+h/2+w,_=v<=u&&u<=m&&y<=c&&c<=b;return _},n=function(u,c,h,g,p){var x=u*Math.cos(g)-c*Math.sin(g),w=u*Math.sin(g)+c*Math.cos(g),v=x*h,m=w*h,y=v+p.x,b=m+p.y;return{x:y,y:b}},i=function(u,c,h,g){for(var p=[],x=0;x<u.length;x+=2){var w=u[x],v=u[x+1];p.push(n(w,v,c,h,g))}return p},s=function(u){for(var c=[],h=0;h<u.length;h++){var g=u[h];c.push(g.x,g.y)}return c},o=function(u){return u.pstyle("width").pfValue*u.pstyle("arrow-scale").pfValue*2},a=function(u,c){ut(c)&&(c=t[c]),t[u]=dt({name:u,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(g,p,x,w,v,m){var y=s(i(this.points,x+2*m,w,v)),b=sn(g,p,y);return b},roughCollide:r,draw:function(g,p,x,w){var v=i(this.points,p,x,w);e.arrowShapeImpl("polygon")(g,v)},spacing:function(g){return 0},gap:o},c)};a("none",{collide:Tc,roughCollide:Tc,draw:Xv,spacing:I0,gap:I0}),a("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),a("arrow","triangle"),a("triangle-backcurve",{points:t.triangle.points,controlPoint:[0,-.15],roughCollide:r,draw:function(u,c,h,g,p){var x=i(this.points,c,h,g),w=this.controlPoint,v=n(w[0],w[1],c,h,g);e.arrowShapeImpl(this.name)(u,x,v)},gap:function(u){return o(u)*.8}}),a("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(u,c,h,g,p,x,w){var v=s(i(this.points,h+2*w,g,p)),m=s(i(this.pointsTee,h+2*w,g,p)),y=sn(u,c,v)||sn(u,c,m);return y},draw:function(u,c,h,g,p){var x=i(this.points,c,h,g),w=i(this.pointsTee,c,h,g);e.arrowShapeImpl(this.name)(u,x,w)}}),a("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(u,c,h,g,p,x,w){var v=p,m=Math.pow(v.x-u,2)+Math.pow(v.y-c,2)<=Math.pow((h+2*w)*this.radius,2),y=s(i(this.points,h+2*w,g,p));return sn(u,c,y)||m},draw:function(u,c,h,g,p){var x=i(this.pointsTr,c,h,g);e.arrowShapeImpl(this.name)(u,x,g.x,g.y,this.radius*c)},spacing:function(u){return e.getArrowWidth(u.pstyle("width").pfValue,u.pstyle("arrow-scale").value)*this.radius}}),a("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(u,c){var h=this.baseCrossLinePts.slice(),g=c/u,p=3,x=5;return h[p]=h[p]-g,h[x]=h[x]-g,h},collide:function(u,c,h,g,p,x,w){var v=s(i(this.points,h+2*w,g,p)),m=s(i(this.crossLinePts(h,x),h+2*w,g,p)),y=sn(u,c,v)||sn(u,c,m);return y},draw:function(u,c,h,g,p){var x=i(this.points,c,h,g),w=i(this.crossLinePts(c,p),c,h,g);e.arrowShapeImpl(this.name)(u,x,w)}}),a("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(u){return o(u)*.525}}),a("circle",{radius:.15,collide:function(u,c,h,g,p,x,w){var v=p,m=Math.pow(v.x-u,2)+Math.pow(v.y-c,2)<=Math.pow((h+2*w)*this.radius,2);return m},draw:function(u,c,h,g,p){e.arrowShapeImpl(this.name)(u,g.x,g.y,this.radius*c)},spacing:function(u){return e.getArrowWidth(u.pstyle("width").pfValue,u.pstyle("arrow-scale").value)*this.radius}}),a("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(u){return 1},gap:function(u){return 1}}),a("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),a("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(u){return u.pstyle("width").pfValue*u.pstyle("arrow-scale").value}}),a("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(u){return .95*u.pstyle("width").pfValue*u.pstyle("arrow-scale").value}})};var Ua={};Ua.projectIntoViewport=function(t,e){var r=this.cy,n=this.findContainerClientCoords(),i=n[0],s=n[1],o=n[4],a=r.pan(),l=r.zoom(),u=((t-i)/o-a.x)/l,c=((e-s)/o-a.y)/l;return[u,c]};Ua.findContainerClientCoords=function(){if(this.containerBB)return this.containerBB;var t=this.container,e=t.getBoundingClientRect(),r=this.cy.window().getComputedStyle(t),n=function(m){return parseFloat(r.getPropertyValue(m))},i={left:n("padding-left"),right:n("padding-right"),top:n("padding-top"),bottom:n("padding-bottom")},s={left:n("border-left-width"),right:n("border-right-width"),top:n("border-top-width"),bottom:n("border-bottom-width")},o=t.clientWidth,a=t.clientHeight,l=i.left+i.right,u=i.top+i.bottom,c=s.left+s.right,h=e.width/(o+c),g=o-l,p=a-u,x=e.left+i.left+s.left,w=e.top+i.top+s.top;return this.containerBB=[x,w,g,p,h]};Ua.invalidateContainerClientCoordsCache=function(){this.containerBB=null};Ua.findNearestElement=function(t,e,r,n){return this.findNearestElements(t,e,r,n)[0]};Ua.findNearestElements=function(t,e,r,n){var i=this,s=this,o=s.getCachedZSortedEles(),a=[],l=s.cy.zoom(),u=s.cy.hasCompoundNodes(),c=(n?24:8)/l,h=(n?8:2)/l,g=(n?8:2)/l,p=1/0,x,w;r&&(o=o.interactive);function v(T,k){if(T.isNode()){if(w)return;w=T,a.push(T)}if(T.isEdge()&&(k==null||k<p))if(x){if(x.pstyle("z-compound-depth").value===T.pstyle("z-compound-depth").value&&x.pstyle("z-compound-depth").value===T.pstyle("z-compound-depth").value){for(var N=0;N<a.length;N++)if(a[N].isEdge()){a[N]=T,x=T,p=k??p;break}}}else a.push(T),x=T,p=k??p}function m(T){var k=T.outerWidth()+2*h,N=T.outerHeight()+2*h,M=k/2,B=N/2,A=T.position(),j=T.pstyle("corner-radius").value==="auto"?"auto":T.pstyle("corner-radius").pfValue,D=T._private.rscratch;if(A.x-M<=t&&t<=A.x+M&&A.y-B<=e&&e<=A.y+B){var I=s.nodeShapes[i.getNodeShape(T)];if(I.checkPoint(t,e,0,k,N,A.x,A.y,j,D))return v(T,0),!0}}function y(T){var k=T._private,N=k.rscratch,M=T.pstyle("width").pfValue,B=T.pstyle("arrow-scale").value,A=M/2+c,j=A*A,D=A*2,H=k.source,z=k.target,I;if(N.edgeType==="segments"||N.edgeType==="straight"||N.edgeType==="haystack"){for(var U=N.allpts,W=0;W+3<U.length;W+=2)if(z3(t,e,U[W],U[W+1],U[W+2],U[W+3],D)&&j>(I=$3(t,e,U[W],U[W+1],U[W+2],U[W+3])))return v(T,I),!0}else if(N.edgeType==="bezier"||N.edgeType==="multibezier"||N.edgeType==="self"||N.edgeType==="compound"){for(var U=N.allpts,W=0;W+5<N.allpts.length;W+=4)if(H3(t,e,U[W],U[W+1],U[W+2],U[W+3],U[W+4],U[W+5],D)&&j>(I=V3(t,e,U[W],U[W+1],U[W+2],U[W+3],U[W+4],U[W+5])))return v(T,I),!0}for(var H=H||k.source,z=z||k.target,P=i.getArrowWidth(M,B),F=[{name:"source",x:N.arrowStartX,y:N.arrowStartY,angle:N.srcArrowAngle},{name:"target",x:N.arrowEndX,y:N.arrowEndY,angle:N.tgtArrowAngle},{name:"mid-source",x:N.midX,y:N.midY,angle:N.midsrcArrowAngle},{name:"mid-target",x:N.midX,y:N.midY,angle:N.midtgtArrowAngle}],W=0;W<F.length;W++){var G=F[W],$=s.arrowShapes[T.pstyle(G.name+"-arrow-shape").value],ee=T.pstyle("width").pfValue;if($.roughCollide(t,e,P,G.angle,{x:G.x,y:G.y},ee,c)&&$.collide(t,e,P,G.angle,{x:G.x,y:G.y},ee,c))return v(T),!0}u&&a.length>0&&(m(H),m(z))}function b(T,k,N){return Yr(T,k,N)}function _(T,k){var N=T._private,M=g,B;k?B=k+"-":B="",T.boundingBox();var A=N.labelBounds[k||"main"],j=T.pstyle(B+"label").value,D=T.pstyle("text-events").strValue==="yes";if(!(!D||!j)){var I=b(N.rscratch,"labelX",k),U=b(N.rscratch,"labelY",k),W=b(N.rscratch,"labelAngle",k),H=T.pstyle(B+"text-margin-x").pfValue,z=T.pstyle(B+"text-margin-y").pfValue,P=A.x1-M-H,F=A.x2+M-H,G=A.y1-M-z,$=A.y2+M-z;if(W){var ee=Math.cos(W),re=Math.sin(W),ne=function(ce,de){return ce=ce-I,de=de-U,{x:ce*ee-de*re+I,y:ce*re+de*ee+U}},Y=ne(P,G),q=ne(P,$),K=ne(F,G),X=ne(F,$),J=[Y.x+H,Y.y+z,K.x+H,K.y+z,X.x+H,X.y+z,q.x+H,q.y+z];if(sn(t,e,J))return v(T),!0}else if(qi(A,t,e))return v(T),!0}}for(var R=o.length-1;R>=0;R--){var E=o[R];E.isNode()?m(E)||_(E):y(E)||_(E)||_(E,"source")||_(E,"target")}return a};Ua.getAllInBox=function(t,e,r,n){var i=this.getCachedZSortedEles().interactive,s=this.cy.zoom(),o=2/s,a=[],l=Math.min(t,r),u=Math.max(t,r),c=Math.min(e,n),h=Math.max(e,n);t=l,r=u,e=c,n=h;var g=Kr({x1:t,y1:e,x2:r,y2:n}),p=[{x:g.x1,y:g.y1},{x:g.x2,y:g.y1},{x:g.x2,y:g.y2},{x:g.x1,y:g.y2}],x=[[p[0],p[1]],[p[1],p[2]],[p[2],p[3]],[p[3],p[0]]];function w(ce,de,Le){return Yr(ce,de,Le)}function v(ce,de){var Le=ce._private,je=o,_e="";ce.boundingBox();var ke=Le.labelBounds.main;if(!ke)return null;var Ne=w(Le.rscratch,"labelX",de),Ee=w(Le.rscratch,"labelY",de),Me=w(Le.rscratch,"labelAngle",de),Pe=ce.pstyle(_e+"text-margin-x").pfValue,De=ce.pstyle(_e+"text-margin-y").pfValue,Ue=ke.x1-je-Pe,Ye=ke.x2+je-Pe,ge=ke.y1-je-De,Ce=ke.y2+je-De;if(Me){var Ae=Math.cos(Me),Be=Math.sin(Me),me=function(te,oe){return te=te-Ne,oe=oe-Ee,{x:te*Ae-oe*Be+Ne,y:te*Be+oe*Ae+Ee}};return[me(Ue,ge),me(Ye,ge),me(Ye,Ce),me(Ue,Ce)]}else return[{x:Ue,y:ge},{x:Ye,y:ge},{x:Ye,y:Ce},{x:Ue,y:Ce}]}function m(ce,de,Le,je){function _e(ke,Ne,Ee){return(Ee.y-ke.y)*(Ne.x-ke.x)>(Ne.y-ke.y)*(Ee.x-ke.x)}return _e(ce,Le,je)!==_e(de,Le,je)&&_e(ce,de,Le)!==_e(ce,de,je)}for(var y=0;y<i.length;y++){var b=i[y];if(b.isNode()){var _=b,R=_.pstyle("text-events").strValue==="yes",E=_.pstyle("box-selection").strValue,T=_.pstyle("box-select-labels").strValue==="yes";if(E==="none")continue;var k=(E==="overlap"||T)&&R,N=_.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:k});if(E==="contain"){var M=!1;if(T&&R){var B=v(_);B&&Ed(B,p)&&(a.push(_),M=!0)}!M&&Tw(g,N)&&a.push(_)}else if(E==="overlap"&&Jv(g,N)){var A=_.boundingBox({includeNodes:!0,includeEdges:!0,includeLabels:!1,includeMainLabels:!1,includeSourceLabels:!1,includeTargetLabels:!1}),j=[{x:A.x1,y:A.y1},{x:A.x2,y:A.y1},{x:A.x2,y:A.y2},{x:A.x1,y:A.y2}];if(Ed(j,p))a.push(_);else{var D=v(_);D&&Ed(D,p)&&a.push(_)}}}else{var I=b,U=I._private,W=U.rscratch,H=I.pstyle("box-selection").strValue;if(H==="none")continue;if(H==="contain"){if(W.startX!=null&&W.startY!=null&&!qi(g,W.startX,W.startY)||W.endX!=null&&W.endY!=null&&!qi(g,W.endX,W.endY))continue;if(W.edgeType==="bezier"||W.edgeType==="multibezier"||W.edgeType==="self"||W.edgeType==="compound"||W.edgeType==="segments"||W.edgeType==="haystack"){for(var z=U.rstyle.bezierPts||U.rstyle.linePts||U.rstyle.haystackPts,P=!0,F=0;F<z.length;F++)if(!z0(g,z[F])){P=!1;break}P&&a.push(I)}else W.edgeType==="straight"&&a.push(I)}else if(H==="overlap"){var G=!1;if(W.startX!=null&&W.startY!=null&&W.endX!=null&&W.endY!=null&&(qi(g,W.startX,W.startY)||qi(g,W.endX,W.endY)))a.push(I),G=!0;else if(!G&&W.edgeType==="haystack"){for(var $=U.rstyle.haystackPts,ee=0;ee<$.length;ee++)if(z0(g,$[ee])){a.push(I),G=!0;break}}if(!G){var re=U.rstyle.bezierPts||U.rstyle.linePts||U.rstyle.haystackPts;if((!re||re.length<2)&&W.edgeType==="straight"&&W.startX!=null&&W.startY!=null&&W.endX!=null&&W.endY!=null&&(re=[{x:W.startX,y:W.startY},{x:W.endX,y:W.endY}]),!re||re.length<2)continue;for(var ne=0;ne<re.length-1;ne++){for(var Y=re[ne],q=re[ne+1],K=0;K<x.length;K++){var X=pr(x[K],2),J=X[0],ie=X[1];if(m(Y,q,J,ie)){a.push(I),G=!0;break}}if(G)break}}}}}return a};var Pc={};Pc.calculateArrowAngles=function(t){var e=t._private.rscratch,r=e.edgeType==="haystack",n=e.edgeType==="bezier",i=e.edgeType==="multibezier",s=e.edgeType==="segments",o=e.edgeType==="compound",a=e.edgeType==="self",l,u,c,h,g,p,m,y;if(r?(c=e.haystackPts[0],h=e.haystackPts[1],g=e.haystackPts[2],p=e.haystackPts[3]):(c=e.arrowStartX,h=e.arrowStartY,g=e.arrowEndX,p=e.arrowEndY),m=e.midX,y=e.midY,s)l=c-e.segpts[0],u=h-e.segpts[1];else if(i||o||a||n){var x=e.allpts,w=Cr(x[0],x[2],x[4],.1),v=Cr(x[1],x[3],x[5],.1);l=c-w,u=h-v}else l=c-m,u=h-y;e.srcArrowAngle=$u(l,u);var m=e.midX,y=e.midY;if(r&&(m=(c+g)/2,y=(h+p)/2),l=g-c,u=p-h,s){var x=e.allpts;if(x.length/2%2===0){var b=x.length/2,_=b-2;l=x[b]-x[_],u=x[b+1]-x[_+1]}else if(e.isRound)l=e.midVector[1],u=-e.midVector[0];else{var b=x.length/2-1,_=b-2;l=x[b]-x[_],u=x[b+1]-x[_+1]}}else if(i||o||a){var x=e.allpts,R=e.ctrlpts,E,T,k,N;if(R.length/2%2===0){var M=x.length/2-1,B=M+2,A=B+2;E=Cr(x[M],x[B],x[A],0),T=Cr(x[M+1],x[B+1],x[A+1],0),k=Cr(x[M],x[B],x[A],1e-4),N=Cr(x[M+1],x[B+1],x[A+1],1e-4)}else{var B=x.length/2-1,M=B-2,A=B+2;E=Cr(x[M],x[B],x[A],.4999),T=Cr(x[M+1],x[B+1],x[A+1],.4999),k=Cr(x[M],x[B],x[A],.5),N=Cr(x[M+1],x[B+1],x[A+1],.5)}l=k-E,u=N-T}if(e.midtgtArrowAngle=$u(l,u),e.midDispX=l,e.midDispY=u,l*=-1,u*=-1,s){var x=e.allpts;if(x.length/2%2!==0){if(!e.isRound){var b=x.length/2-1,j=b+2;l=-(x[j]-x[b]),u=-(x[j+1]-x[b+1])}}}if(e.midsrcArrowAngle=$u(l,u),s)l=g-e.segpts[e.segpts.length-2],u=p-e.segpts[e.segpts.length-1];else if(i||o||a||n){var x=e.allpts,D=x.length,w=Cr(x[D-6],x[D-4],x[D-2],.9),v=Cr(x[D-5],x[D-3],x[D-1],.9);l=g-w,u=p-v}else l=g-m,u=p-y;e.tgtArrowAngle=$u(l,u)};Pc.getArrowWidth=Pc.getArrowHeight=function(t,e){var r=this.arrowWidthCache=this.arrowWidthCache||{},n=r[t+", "+e];return n||(n=Math.max(Math.pow(t*13.37,.9),29)*e,r[t+", "+e]=n,n)};var xv,bv,Xn={},kn={},_1,S1,Aa,gc,di,Ca,La,qn,ws,Ju,w_,__,wv,_v,C1,E1=function(e,r,n){n.x=r.x-e.x,n.y=r.y-e.y,n.len=Math.sqrt(n.x*n.x+n.y*n.y),n.nx=n.x/n.len,n.ny=n.y/n.len,n.ang=Math.atan2(n.ny,n.nx)},lN=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},uN=function(e,r,n,i,s){if(e!==C1?E1(r,e,Xn):lN(kn,Xn),E1(r,n,kn),_1=Xn.nx*kn.ny-Xn.ny*kn.nx,S1=Xn.nx*kn.nx-Xn.ny*-kn.ny,di=Math.asin(Math.max(-1,Math.min(1,_1))),Math.abs(di)<1e-6){xv=r.x,bv=r.y,La=ws=0;return}Aa=1,gc=!1,S1<0?di<0?di=Math.PI+di:(di=Math.PI-di,Aa=-1,gc=!0):di>0&&(Aa=-1,gc=!0),r.radius!==void 0?ws=r.radius:ws=i,Ca=di/2,Ju=Math.min(Xn.len/2,kn.len/2),s?(qn=Math.abs(Math.cos(Ca)*ws/Math.sin(Ca)),qn>Ju?(qn=Ju,La=Math.abs(qn*Math.sin(Ca)/Math.cos(Ca))):La=ws):(qn=Math.min(Ju,ws),La=Math.abs(qn*Math.sin(Ca)/Math.cos(Ca))),wv=r.x+kn.nx*qn,_v=r.y+kn.ny*qn,xv=wv-kn.ny*La*Aa,bv=_v+kn.nx*La*Aa,w_=r.x+Xn.nx*qn,__=r.y+Xn.ny*qn,C1=r};function S_(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 hg(t,e,r,n){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return n===0||e.radius===0?{cx:e.x,cy:e.y,radius:0,startX:e.x,startY:e.y,stopX:e.x,stopY:e.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(uN(t,e,r,n,i),{cx:xv,cy:bv,radius:La,startX:w_,startY:__,stopX:wv,stopY:_v,startAngle:Xn.ang+Math.PI/2*Aa,endAngle:kn.ang-Math.PI/2*Aa,counterClockwise:gc})}var yl=.01,cN=Math.sqrt(2*yl),Ur={};Ur.findMidptPtsEtc=function(t,e){var r=e.posPts,n=e.intersectionPts,i=e.vectorNormInverse,s,o=t.pstyle("source-endpoint"),a=t.pstyle("target-endpoint"),l=o.units!=null&&a.units!=null,u=function(R,E,T,k){var N=k-E,M=T-R,B=Math.sqrt(M*M+N*N);return{x:-N/B,y:M/B}},c=t.pstyle("edge-distances").value;switch(c){case"node-position":s=r;break;case"intersection":s=n;break;case"endpoints":{if(l){var h=this.manualEndptToPx(t.source()[0],o),g=pr(h,2),p=g[0],x=g[1],w=this.manualEndptToPx(t.target()[0],a),v=pr(w,2),m=v[0],y=v[1],b={x1:p,y1:x,x2:m,y2:y};i=u(p,x,m,y),s=b}else Bt("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=n;break}}return{midptPts:s,vectorNormInverse:i}};Ur.findHaystackPoints=function(t){for(var e=0;e<t.length;e++){var r=t[e],n=r._private,i=n.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=n.source,a=n.target,l=o.position(),u=a.position(),c=o.width(),h=a.width(),g=o.height(),p=a.height(),x=r.pstyle("haystack-radius").value,w=x/2;i.haystackPts=i.allpts=[i.source.x*c*w+l.x,i.source.y*g*w+l.y,i.target.x*h*w+u.x,i.target.y*p*w+u.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)}};Ur.findSegmentsPoints=function(t,e){var r=t._private.rscratch,n=t.pstyle("segment-weights"),i=t.pstyle("segment-distances"),s=t.pstyle("segment-radii"),o=t.pstyle("radius-type"),a=Math.min(n.pfValue.length,i.pfValue.length),l=s.pfValue[s.pfValue.length-1],u=o.pfValue[o.pfValue.length-1];r.edgeType="segments",r.segpts=[],r.radii=[],r.isArcRadius=[];for(var c=0;c<a;c++){var h=n.pfValue[c],g=i.pfValue[c],p=1-h,x=h,w=this.findMidptPtsEtc(t,e),v=w.midptPts,m=w.vectorNormInverse,y={x:v.x1*p+v.x2*x,y:v.y1*p+v.y2*x};r.segpts.push(y.x+m.x*g,y.y+m.y*g),r.radii.push(s.pfValue[c]!==void 0?s.pfValue[c]:l),r.isArcRadius.push((o.pfValue[c]!==void 0?o.pfValue[c]:u)==="arc-radius")}};Ur.findLoopPoints=function(t,e,r,n){var i=t._private.rscratch,s=e.dirCounts,o=e.srcPos,a=t.pstyle("control-point-distances"),l=a?a.pfValue[0]:void 0,u=t.pstyle("loop-direction").pfValue,c=t.pstyle("loop-sweep").pfValue,h=t.pstyle("control-point-step-size").pfValue;i.edgeType="self";var g=r,p=h;n&&(g=0,p=l);var x=u-Math.PI/2,w=x-c/2,v=x+c/2,m=u+"_"+c;g=s[m]===void 0?s[m]=0:++s[m],i.ctrlpts=[o.x+Math.cos(w)*1.4*p*(g/3+1),o.y+Math.sin(w)*1.4*p*(g/3+1),o.x+Math.cos(v)*1.4*p*(g/3+1),o.y+Math.sin(v)*1.4*p*(g/3+1)]};Ur.findCompoundLoopPoints=function(t,e,r,n){var i=t._private.rscratch;i.edgeType="compound";var s=e.srcPos,o=e.tgtPos,a=e.srcW,l=e.srcH,u=e.tgtW,c=e.tgtH,h=t.pstyle("control-point-step-size").pfValue,g=t.pstyle("control-point-distances"),p=g?g.pfValue[0]:void 0,x=r,w=h;n&&(x=0,w=p);var v=50,m={x:s.x-a/2,y:s.y-l/2},y={x:o.x-u/2,y:o.y-c/2},b={x:Math.min(m.x,y.x),y:Math.min(m.y,y.y)},_=.5,R=Math.max(_,Math.log(a*yl)),E=Math.max(_,Math.log(u*yl));i.ctrlpts=[b.x,b.y-(1+Math.pow(v,1.12)/100)*w*(x/3+1)*R,b.x-(1+Math.pow(v,1.12)/100)*w*(x/3+1)*E,b.y]};Ur.findStraightEdgePoints=function(t){t._private.rscratch.edgeType="straight"};Ur.findBezierPoints=function(t,e,r,n,i){var s=t._private.rscratch,o=t.pstyle("control-point-step-size").pfValue,a=t.pstyle("control-point-distances"),l=t.pstyle("control-point-weights"),u=a&&l?Math.min(a.value.length,l.value.length):1,c=a?a.pfValue[0]:void 0,h=l.value[0],g=n;s.edgeType=g?"multibezier":"bezier",s.ctrlpts=[];for(var p=0;p<u;p++){var x=(.5-e.eles.length/2+r)*o*(i?-1:1),w=void 0,v=Zv(x);g&&(c=a?a.pfValue[p]:o,h=l.value[p]),n?w=c:w=c!==void 0?v*c:void 0;var m=w!==void 0?w:x,y=1-h,b=h,_=this.findMidptPtsEtc(t,e),R=_.midptPts,E=_.vectorNormInverse,T={x:R.x1*y+R.x2*b,y:R.y1*y+R.y2*b};s.ctrlpts.push(T.x+E.x*m,T.y+E.y*m)}};Ur.findTaxiPoints=function(t,e){var r=t._private.rscratch;r.edgeType="segments";var n="vertical",i="horizontal",s="leftward",o="rightward",a="downward",l="upward",u="auto",c=e.posPts,h=e.srcW,g=e.srcH,p=e.tgtW,x=e.tgtH,w=t.pstyle("edge-distances").value,v=w!=="node-position",m=t.pstyle("taxi-direction").value,y=m,b=t.pstyle("taxi-turn"),_=b.units==="%",R=b.pfValue,E=R<0,T=t.pstyle("taxi-turn-min-distance").pfValue,k=v?(h+p)/2:0,N=v?(g+x)/2:0,M=c.x2-c.x1,B=c.y2-c.y1,A=function(oe,ue){return oe>0?Math.max(oe-ue,0):Math.min(oe+ue,0)},j=A(M,k),D=A(B,N),I=!1;y===u?m=Math.abs(j)>Math.abs(D)?i:n:y===l||y===a?(m=n,I=!0):(y===s||y===o)&&(m=i,I=!0);var U=m===n,W=U?D:j,H=U?B:M,z=Zv(H),P=!1;!(I&&(_||E))&&(y===a&&H<0||y===l&&H>0||y===s&&H>0||y===o&&H<0)&&(z*=-1,W=z*Math.abs(W),P=!0);var F;if(_){var G=R<0?1+R:R;F=G*W}else{var $=R<0?W:0;F=$+R*z}var ee=function(oe){return Math.abs(oe)<T||Math.abs(oe)>=Math.abs(W)},re=ee(F),ne=ee(Math.abs(W)-Math.abs(F)),Y=re||ne;if(Y&&!P)if(U){var q=Math.abs(H)<=g/2,K=Math.abs(M)<=p/2;if(q){var X=(c.x1+c.x2)/2,J=c.y1,ie=c.y2;r.segpts=[X,J,X,ie]}else if(K){var ce=(c.y1+c.y2)/2,de=c.x1,Le=c.x2;r.segpts=[de,ce,Le,ce]}else r.segpts=[c.x1,c.y2]}else{var je=Math.abs(H)<=h/2,_e=Math.abs(B)<=x/2;if(je){var ke=(c.y1+c.y2)/2,Ne=c.x1,Ee=c.x2;r.segpts=[Ne,ke,Ee,ke]}else if(_e){var Me=(c.x1+c.x2)/2,Pe=c.y1,De=c.y2;r.segpts=[Me,Pe,Me,De]}else r.segpts=[c.x2,c.y1]}else if(U){var Ue=c.y1+F+(v?g/2*z:0),Ye=c.x1,ge=c.x2;r.segpts=[Ye,Ue,ge,Ue]}else{var Ce=c.x1+F+(v?h/2*z:0),Ae=c.y1,Be=c.y2;r.segpts=[Ce,Ae,Ce,Be]}if(r.isRound){var me=t.pstyle("taxi-radius").value,Z=t.pstyle("radius-type").value[0]==="arc-radius";r.radii=new Array(r.segpts.length/2).fill(me),r.isArcRadius=new Array(r.segpts.length/2).fill(Z)}};Ur.tryToCorrectInvalidPoints=function(t,e){var r=t._private.rscratch;if(r.edgeType==="bezier"){var n=e.srcPos,i=e.tgtPos,s=e.srcW,o=e.srcH,a=e.tgtW,l=e.tgtH,u=e.srcShape,c=e.tgtShape,h=e.srcCornerRadius,g=e.tgtCornerRadius,p=e.srcRs,x=e.tgtRs,w=!Xe(r.startX)||!Xe(r.startY),v=!Xe(r.arrowStartX)||!Xe(r.arrowStartY),m=!Xe(r.endX)||!Xe(r.endY),y=!Xe(r.arrowEndX)||!Xe(r.arrowEndY),b=3,_=this.getArrowWidth(t.pstyle("width").pfValue,t.pstyle("arrow-scale").value)*this.arrowShapeWidth,R=b*_,E=Ba({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.startX,y:r.startY}),T=E<R,k=Ba({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.endX,y:r.endY}),N=k<R,M=!1;if(w||v||T){M=!0;var B={x:r.ctrlpts[0]-n.x,y:r.ctrlpts[1]-n.y},A=Math.sqrt(B.x*B.x+B.y*B.y),j={x:B.x/A,y:B.y/A},D=Math.max(s,o),I={x:r.ctrlpts[0]+j.x*2*D,y:r.ctrlpts[1]+j.y*2*D},U=u.intersectLine(n.x,n.y,s,o,I.x,I.y,0,h,p);T?(r.ctrlpts[0]=r.ctrlpts[0]+j.x*(R-E),r.ctrlpts[1]=r.ctrlpts[1]+j.y*(R-E)):(r.ctrlpts[0]=U[0]+j.x*R,r.ctrlpts[1]=U[1]+j.y*R)}if(m||y||N){M=!0;var W={x:r.ctrlpts[0]-i.x,y:r.ctrlpts[1]-i.y},H=Math.sqrt(W.x*W.x+W.y*W.y),z={x:W.x/H,y:W.y/H},P=Math.max(s,o),F={x:r.ctrlpts[0]+z.x*2*P,y:r.ctrlpts[1]+z.y*2*P},G=c.intersectLine(i.x,i.y,a,l,F.x,F.y,0,g,x);N?(r.ctrlpts[0]=r.ctrlpts[0]+z.x*(R-k),r.ctrlpts[1]=r.ctrlpts[1]+z.y*(R-k)):(r.ctrlpts[0]=G[0]+z.x*R,r.ctrlpts[1]=G[1]+z.y*R)}M&&this.findEndpoints(t)}};Ur.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 n,i;e.ctrlpts.length/2%2===0?(n=e.allpts.length/2-1,e.midX=e.allpts[n],e.midY=e.allpts[n+1]):(n=e.allpts.length/2-3,i=.5,e.midX=Cr(e.allpts[n],e.allpts[n+2],e.allpts[n+4],i),e.midY=Cr(e.allpts[n+1],e.allpts[n+3],e.allpts[n+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],a=e.isArcRadius[s/2-1];e.roundCorners.push(hg({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,a))}}if(e.segpts.length%4===0){var l=e.segpts.length/2,u=l-2;e.midX=(e.segpts[u]+e.segpts[l])/2,e.midY=(e.segpts[u+1]+e.segpts[l+1])/2}else{var c=e.segpts.length/2-1;if(!e.isRound)e.midX=e.segpts[c],e.midY=e.segpts[c+1];else{var h={x:e.segpts[c],y:e.segpts[c+1]},g=e.roundCorners[c/2];if(g.radius===0){var p={x:e.segpts[c+2],y:e.segpts[c+3]};e.midX=h.x,e.midY=h.y,e.midVector=[h.y-p.y,p.x-h.x]}else{var x=[h.x-g.cx,h.y-g.cy],w=g.radius/Math.sqrt(Math.pow(x[0],2)+Math.pow(x[1],2));x=x.map(function(v){return v*w}),e.midX=g.cx+x[0],e.midY=g.cy+x[1],e.midVector=x}}}}};Ur.checkForInvalidEdgeWarning=function(t){var e=t[0]._private.rscratch;e.nodesOverlap||Xe(e.startX)&&Xe(e.startY)&&Xe(e.endX)&&Xe(e.endY)?e.loggedErr=!1:e.loggedErr||(e.loggedErr=!0,Bt("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."))};Ur.findEdgeControlPoints=function(t){var e=this;if(!(!t||t.length===0)){for(var r=this,n=r.cy,i=n.hasCompoundNodes(),s=new pi,o=function(N,M){return[].concat(Cc(N),[M?1:0]).join("-")},a=[],l=[],u=0;u<t.length;u++){var c=t[u],h=c._private,g=c.pstyle("curve-style").value;if(!(c.removed()||!c.takesUpSpace())){if(g==="haystack"){l.push(c);continue}var p=g==="unbundled-bezier"||Gi(g,"segments")||g==="straight"||g==="straight-triangle"||Gi(g,"taxi"),x=g==="unbundled-bezier"||g==="bezier",w=h.source,v=h.target,m=w.poolIndex(),y=v.poolIndex(),b=[m,y].sort(),_=o(b,p),R=s.get(_);R==null&&(R={eles:[]},a.push({pairId:b,edgeIsUnbundled:p}),s.set(_,R)),R.eles.push(c),p&&(R.hasUnbundled=!0),x&&(R.hasBezier=!0)}}for(var E=function(){var N=a[T],M=N.pairId,B=N.edgeIsUnbundled,A=o(M,B),j=s.get(A),D;if(!j.hasUnbundled){var I=j.eles[0].parallelEdges().filter(function(Z){return Z.isBundledBezier()});Kv(j.eles),I.forEach(function(Z){return j.eles.push(Z)}),j.eles.sort(function(Z,te){return Z.poolIndex()-te.poolIndex()})}var U=j.eles[0],W=U.source(),H=U.target();if(W.poolIndex()>H.poolIndex()){var z=W;W=H,H=z}var P=j.srcPos=W.position(),F=j.tgtPos=H.position(),G=j.srcW=W.outerWidth(),$=j.srcH=W.outerHeight(),ee=j.tgtW=H.outerWidth(),re=j.tgtH=H.outerHeight(),ne=j.srcShape=r.nodeShapes[e.getNodeShape(W)],Y=j.tgtShape=r.nodeShapes[e.getNodeShape(H)],q=j.srcCornerRadius=W.pstyle("corner-radius").value==="auto"?"auto":W.pstyle("corner-radius").pfValue,K=j.tgtCornerRadius=H.pstyle("corner-radius").value==="auto"?"auto":H.pstyle("corner-radius").pfValue,X=j.tgtRs=H._private.rscratch,J=j.srcRs=W._private.rscratch;j.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var ie=0;ie<j.eles.length;ie++){var ce=j.eles[ie],de=ce[0]._private.rscratch,Le=ce.pstyle("curve-style").value,je=Le==="unbundled-bezier"||Gi(Le,"segments")||Gi(Le,"taxi"),_e=!W.same(ce.source());if(!j.calculatedIntersection&&W!==H&&(j.hasBezier||j.hasUnbundled)){j.calculatedIntersection=!0;var ke=ne.intersectLine(P.x,P.y,G,$,F.x,F.y,0,q,J),Ne=j.srcIntn=ke,Ee=Y.intersectLine(F.x,F.y,ee,re,P.x,P.y,0,K,X),Me=j.tgtIntn=Ee,Pe=j.intersectionPts={x1:ke[0],x2:Ee[0],y1:ke[1],y2:Ee[1]},De=j.posPts={x1:P.x,x2:F.x,y1:P.y,y2:F.y},Ue=Ee[1]-ke[1],Ye=Ee[0]-ke[0],ge=Math.sqrt(Ye*Ye+Ue*Ue);Xe(ge)&&ge>=cN||(ge=Math.sqrt(Math.max(Ye*Ye,yl)+Math.max(Ue*Ue,yl)));var Ce=j.vector={x:Ye,y:Ue},Ae=j.vectorNorm={x:Ce.x/ge,y:Ce.y/ge},Be={x:-Ae.y,y:Ae.x};j.nodesOverlap=!Xe(ge)||Y.checkPoint(ke[0],ke[1],0,ee,re,F.x,F.y,K,X)||ne.checkPoint(Ee[0],Ee[1],0,G,$,P.x,P.y,q,J),j.vectorNormInverse=Be,D={nodesOverlap:j.nodesOverlap,dirCounts:j.dirCounts,calculatedIntersection:!0,hasBezier:j.hasBezier,hasUnbundled:j.hasUnbundled,eles:j.eles,srcPos:F,srcRs:X,tgtPos:P,tgtRs:J,srcW:ee,srcH:re,tgtW:G,tgtH:$,srcIntn:Me,tgtIntn:Ne,srcShape:Y,tgtShape:ne,posPts:{x1:De.x2,y1:De.y2,x2:De.x1,y2:De.y1},intersectionPts:{x1:Pe.x2,y1:Pe.y2,x2:Pe.x1,y2:Pe.y1},vector:{x:-Ce.x,y:-Ce.y},vectorNorm:{x:-Ae.x,y:-Ae.y},vectorNormInverse:{x:-Be.x,y:-Be.y}}}var me=_e?D:j;de.nodesOverlap=me.nodesOverlap,de.srcIntn=me.srcIntn,de.tgtIntn=me.tgtIntn,de.isRound=Le.startsWith("round"),i&&(W.isParent()||W.isChild()||H.isParent()||H.isChild())&&(W.parents().anySame(H)||H.parents().anySame(W)||W.same(H)&&W.isParent())?e.findCompoundLoopPoints(ce,me,ie,je):W===H?e.findLoopPoints(ce,me,ie,je):Le.endsWith("segments")?e.findSegmentsPoints(ce,me):Le.endsWith("taxi")?e.findTaxiPoints(ce,me):Le==="straight"||!je&&j.eles.length%2===1&&ie===Math.floor(j.eles.length/2)?e.findStraightEdgePoints(ce):e.findBezierPoints(ce,me,ie,je,_e),e.findEndpoints(ce),e.tryToCorrectInvalidPoints(ce,me),e.checkForInvalidEdgeWarning(ce),e.storeAllpts(ce),e.storeEdgeProjections(ce),e.calculateArrowAngles(ce),e.recalculateEdgeLabelProjections(ce),e.calculateLabelAngles(ce)}},T=0;T<a.length;T++)E();this.findHaystackPoints(l)}};function C_(t){var e=[];if(t!=null){for(var r=0;r<t.length;r+=2){var n=t[r],i=t[r+1];e.push({x:n,y:i})}return e}}Ur.getSegmentPoints=function(t){var e=t[0]._private.rscratch;this.recalculateRenderedStyle(t);var r=e.edgeType;if(r==="segments")return C_(e.segpts)};Ur.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 C_(e.ctrlpts)};Ur.getEdgeMidpoint=function(t){var e=t[0]._private.rscratch;return this.recalculateRenderedStyle(t),{x:e.midX,y:e.midY}};var Nl={};Nl.manualEndptToPx=function(t,e){var r=this,n=t.position(),i=t.outerWidth(),s=t.outerHeight(),o=t._private.rscratch;if(e.value.length===2){var a=[e.pfValue[0],e.pfValue[1]];return e.units[0]==="%"&&(a[0]=a[0]*i),e.units[1]==="%"&&(a[1]=a[1]*s),a[0]+=n.x,a[1]+=n.y,a}else{var l=e.pfValue[0];l=-Math.PI/2+l;var u=2*Math.max(i,s),c=[n.x+Math.cos(l)*u,n.y+Math.sin(l)*u];return r.nodeShapes[this.getNodeShape(t)].intersectLine(n.x,n.y,i,s,c[0],c[1],0,t.pstyle("corner-radius").value==="auto"?"auto":t.pstyle("corner-radius").pfValue,o)}};Nl.findEndpoints=function(t){var e,r,n,i,s=this,o,a=t.source()[0],l=t.target()[0],u=a.position(),c=l.position(),h=t.pstyle("target-arrow-shape").value,g=t.pstyle("source-arrow-shape").value,p=t.pstyle("target-distance-from-node").pfValue,x=t.pstyle("source-distance-from-node").pfValue,w=a._private.rscratch,v=l._private.rscratch,m=t.pstyle("curve-style").value,y=t._private.rscratch,b=y.edgeType,_=Gi(m,"taxi"),R=b==="self"||b==="compound",E=b==="bezier"||b==="multibezier"||R,T=b!=="bezier",k=b==="straight"||b==="segments",N=b==="segments",M=E||T||k,B=R||_,A=t.pstyle("source-endpoint"),j=B?"outside-to-node":A.value,D=a.pstyle("corner-radius").value==="auto"?"auto":a.pstyle("corner-radius").pfValue,I=t.pstyle("target-endpoint"),U=B?"outside-to-node":I.value,W=l.pstyle("corner-radius").value==="auto"?"auto":l.pstyle("corner-radius").pfValue;y.srcManEndpt=A,y.tgtManEndpt=I;var H,z,P,F,G=(e=(I==null||(r=I.pfValue)===null||r===void 0?void 0:r.length)===2?I.pfValue:null)!==null&&e!==void 0?e:[0,0],$=(n=(A==null||(i=A.pfValue)===null||i===void 0?void 0:i.length)===2?A.pfValue:null)!==null&&n!==void 0?n:[0,0];if(E){var ee=[y.ctrlpts[0],y.ctrlpts[1]],re=T?[y.ctrlpts[y.ctrlpts.length-2],y.ctrlpts[y.ctrlpts.length-1]]:ee;H=re,z=ee}else if(k){var ne=N?y.segpts.slice(0,2):[c.x+G[0],c.y+G[1]],Y=N?y.segpts.slice(y.segpts.length-2):[u.x+$[0],u.y+$[1]];H=Y,z=ne}if(U==="inside-to-node")o=[c.x,c.y];else if(I.units)o=this.manualEndptToPx(l,I);else if(U==="outside-to-line")o=y.tgtIntn;else if(U==="outside-to-node"||U==="outside-to-node-or-label"?P=H:(U==="outside-to-line"||U==="outside-to-line-or-label")&&(P=[u.x,u.y]),o=s.nodeShapes[this.getNodeShape(l)].intersectLine(c.x,c.y,l.outerWidth(),l.outerHeight(),P[0],P[1],0,W,v),U==="outside-to-node-or-label"||U==="outside-to-line-or-label"){var q=l._private.rscratch,K=q.labelWidth,X=q.labelHeight,J=q.labelX,ie=q.labelY,ce=K/2,de=X/2,Le=l.pstyle("text-valign").value;Le=Ws(Le),Le==="top"?ie-=de:Le==="bottom"&&(ie+=de);var je=l.pstyle("text-halign").value;je=Us(je),je==="left"?J-=ce:je==="right"&&(J+=ce);var _e=dl(P[0],P[1],[J-ce,ie-de,J+ce,ie-de,J+ce,ie+de,J-ce,ie+de],c.x,c.y);if(_e.length>0){var ke=u,Ne=Ra(ke,As(o)),Ee=Ra(ke,As(_e)),Me=Ne;if(Ee<Ne&&(o=_e,Me=Ee),_e.length>2){var Pe=Ra(ke,{x:_e[2],y:_e[3]});Pe<Me&&(o=[_e[2],_e[3]])}}}var De=Gu(o,H,s.arrowShapes[h].spacing(t)+p),Ue=Gu(o,H,s.arrowShapes[h].gap(t)+p);if(y.endX=Ue[0],y.endY=Ue[1],y.arrowEndX=De[0],y.arrowEndY=De[1],j==="inside-to-node")o=[u.x,u.y];else if(A.units)o=this.manualEndptToPx(a,A);else if(j==="outside-to-line")o=y.srcIntn;else if(j==="outside-to-node"||j==="outside-to-node-or-label"?F=z:(j==="outside-to-line"||j==="outside-to-line-or-label")&&(F=[c.x,c.y]),o=s.nodeShapes[this.getNodeShape(a)].intersectLine(u.x,u.y,a.outerWidth(),a.outerHeight(),F[0],F[1],0,D,w),j==="outside-to-node-or-label"||j==="outside-to-line-or-label"){var Ye=a._private.rscratch,ge=Ye.labelWidth,Ce=Ye.labelHeight,Ae=Ye.labelX,Be=Ye.labelY,me=ge/2,Z=Ce/2,te=a.pstyle("text-valign").value;te=Ws(te),te==="top"?Be-=Z:te==="bottom"&&(Be+=Z);var oe=a.pstyle("text-halign").value;oe=Us(oe),oe==="left"?Ae-=me:oe==="right"&&(Ae+=me);var ue=dl(F[0],F[1],[Ae-me,Be-Z,Ae+me,Be-Z,Ae+me,Be+Z,Ae-me,Be+Z],u.x,u.y);if(ue.length>0){var se=c,he=Ra(se,As(o)),pe=Ra(se,As(ue)),be=he;if(pe<he&&(o=[ue[0],ue[1]],be=pe),ue.length>2){var Se=Ra(se,{x:ue[2],y:ue[3]});Se<be&&(o=[ue[2],ue[3]])}}}var Te=Gu(o,z,s.arrowShapes[g].spacing(t)+x),Re=Gu(o,z,s.arrowShapes[g].gap(t)+x);y.startX=Re[0],y.startY=Re[1],y.arrowStartX=Te[0],y.arrowStartY=Te[1],M&&(!Xe(y.startX)||!Xe(y.startY)||!Xe(y.endX)||!Xe(y.endY)?y.badLine=!0:y.badLine=!1)};Nl.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}}};Nl.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 fg={};function hN(t,e,r){for(var n=function(u,c,h,g){return Cr(u,c,h,g)},i=e._private,s=i.rstyle.bezierPts,o=0;o<t.bezierProjPcts.length;o++){var a=t.bezierProjPcts[o];s.push({x:n(r[0],r[2],r[4],a),y:n(r[1],r[3],r[5],a)})}}fg.storeEdgeProjections=function(t){var e=t._private,r=e.rscratch,n=r.edgeType;if(e.rstyle.bezierPts=null,e.rstyle.linePts=null,e.rstyle.haystackPts=null,n==="multibezier"||n==="bezier"||n==="self"||n==="compound"){e.rstyle.bezierPts=[];for(var i=0;i+5<r.allpts.length;i+=4)hN(this,t,r.allpts.slice(i,i+6))}else if(n==="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(n==="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};fg.recalculateEdgeProjections=function(t){this.findEdgeControlPoints(t)};var ti={};ti.recalculateNodeLabelProjection=function(t){var e=t.pstyle("label").strValue;if(!Qi(e)){var r,n,i=t._private,s=t.width(),o=t.height(),a=t.padding(),l=t.position(),u=t.pstyle("text-halign").strValue,c=t.pstyle("text-valign").strValue,h=i.rscratch,g=i.rstyle;switch(u){case"left":r=l.x-s/2-a;break;case"left-inside":r=l.x-s/2+a;break;case"right":r=l.x+s/2+a;break;case"right-inside":r=l.x+s/2-a;break;default:r=l.x}switch(c){case"top":n=l.y-o/2-a;break;case"top-inside":n=l.y-o/2+a;break;case"bottom":n=l.y+o/2+a;break;case"bottom-inside":n=l.y+o/2-a;break;default:n=l.y}h.labelX=r,h.labelY=n,g.labelX=r,g.labelY=n,this.calculateLabelAngles(t),this.applyLabelDimensions(t)}};var E_=function(e,r){var n=Math.atan(r/e);return e===0&&n<0&&(n=n*-1),n},k_=function(e,r){var n=r.x-e.x,i=r.y-e.y;return E_(n,i)},fN=function(e,r,n,i){var s=fl(0,i-.001,1),o=fl(0,i+.001,1),a=Is(e,r,n,s),l=Is(e,r,n,o);return k_(a,l)};ti.recalculateEdgeLabelProjections=function(t){var e,r=t._private,n=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:n.midX,y:n.midY};var o=function(h,g,p){Qn(r.rscratch,h,g,p),Qn(r.rstyle,h,g,p)};o("labelX",null,e.x),o("labelY",null,e.y);var a=E_(n.midDispX,n.midDispY);o("labelAutoAngle",null,a);var l=function(){if(l.cache)return l.cache;for(var h=[],g=0;g+5<n.allpts.length;g+=4){var p={x:n.allpts[g],y:n.allpts[g+1]},x={x:n.allpts[g+2],y:n.allpts[g+3]},w={x:n.allpts[g+4],y:n.allpts[g+5]};h.push({p0:p,p1:x,p2:w,startDist:0,length:0,segments:[]})}var v=r.rstyle.bezierPts,m=i.bezierProjPcts.length;function y(T,k,N,M,B){var A=Ba(k,N),j=T.segments[T.segments.length-1],D={p0:k,p1:N,t0:M,t1:B,startDist:j?j.startDist+j.length:0,length:A};T.segments.push(D),T.length+=A}for(var b=0;b<h.length;b++){var _=h[b],R=h[b-1];R&&(_.startDist=R.startDist+R.length),y(_,_.p0,v[b*m],0,i.bezierProjPcts[0]);for(var E=0;E<m-1;E++)y(_,v[b*m+E],v[b*m+E+1],i.bezierProjPcts[E],i.bezierProjPcts[E+1]);y(_,v[b*m+m-1],_.p2,i.bezierProjPcts[m-1],1)}return l.cache=h},u=function(h){var g,p=h==="source";if(s[h]){var x=t.pstyle(h+"-text-offset").pfValue;switch(n.edgeType){case"self":case"compound":case"bezier":case"multibezier":{for(var w=l(),v,m=0,y=0,b=0;b<w.length;b++){for(var _=w[p?b:w.length-1-b],R=0;R<_.segments.length;R++){var E=_.segments[p?R:_.segments.length-1-R],T=b===w.length-1&&R===_.segments.length-1;if(m=y,y+=E.length,y>=x||T){v={cp:_,segment:E};break}}if(v)break}var k=v.cp,N=v.segment,M=(x-m)/N.length,B=N.t1-N.t0,A=p?N.t0+B*M:N.t1-B*M;A=fl(0,A,1),e=Is(k.p0,k.p1,k.p2,A),g=fN(k.p0,k.p1,k.p2,A);break}case"straight":case"segments":case"haystack":{for(var j=0,D,I,U,W,H=n.allpts.length,z=0;z+3<H&&(p?(U={x:n.allpts[z],y:n.allpts[z+1]},W={x:n.allpts[z+2],y:n.allpts[z+3]}):(U={x:n.allpts[H-2-z],y:n.allpts[H-1-z]},W={x:n.allpts[H-4-z],y:n.allpts[H-3-z]}),D=Ba(U,W),I=j,j+=D,!(j>=x));z+=2);var P=x-I,F=P/D;F=fl(0,F,1),e=M3(U,W,F),g=k_(U,W);break}}o("labelX",h,e.x),o("labelY",h,e.y),o("labelAutoAngle",h,g)}};u("source"),u("target"),this.applyLabelDimensions(t)}};ti.applyLabelDimensions=function(t){this.applyPrefixedLabelDimensions(t),t.isEdge()&&(this.applyPrefixedLabelDimensions(t,"source"),this.applyPrefixedLabelDimensions(t,"target"))};ti.applyPrefixedLabelDimensions=function(t,e){var r=t._private,n=this.getLabelText(t,e),i=Oa(n,t._private.labelDimsKey);if(Yr(r.rscratch,"prefixedLabelDimsKey",e)!==i){Qn(r.rscratch,"prefixedLabelDimsKey",e,i);var s=this.calculateLabelDimensions(t,n),o=t.pstyle("line-height").pfValue,a=t.pstyle("font-size").pfValue,l=t.pstyle("text-wrap").strValue,u=Yr(r.rscratch,"labelWrapCachedLines",e)||[],c=l!=="wrap"?1:Math.max(u.length,1),h=a*o,g=s.width,p=s.height+(c-1)*(o-1)*a;Qn(r.rstyle,"labelWidth",e,g),Qn(r.rscratch,"labelWidth",e,g),Qn(r.rstyle,"labelHeight",e,p),Qn(r.rscratch,"labelHeight",e,p),Qn(r.rscratch,"labelLineHeight",e,h),Qn(r.rscratch,"labelActualDescent",e,s.labelActualDescent)}};ti.getLabelText=function(t,e){var r=t._private,n=e?e+"-":"",i=t.pstyle(n+"label").strValue,s=t.pstyle("text-transform").value,o=function($,ee){return ee?(Qn(r.rscratch,$,e,ee),ee):Yr(r.rscratch,$,e)};if(!i)return"";s=="none"||(s=="uppercase"?i=i.toUpperCase():s=="lowercase"&&(i=i.toLowerCase()));var a=t.pstyle("text-wrap").value;if(a==="wrap"){var l=o("labelKey");if(l!=null&&o("labelWrapKey")===l)return o("labelWrapCachedText");for(var u="​",c=i.split(`
59
+ `),h=t.pstyle("text-max-width").pfValue,g=t.pstyle("text-overflow-wrap").value,p=g==="anywhere",x=[],w=/[\s\u200b]+|$/g,v=0;v<c.length;v++){var m=c[v],y=this.calculateLabelDimensions(t,m),b=y.width;if(p){var _=m.split("").join(u);m=_}if(b>h){var R=m.matchAll(w),E="",T=0,k=on(R),N;try{for(k.s();!(N=k.n()).done;){var M=N.value,B=M[0],A=m.substring(T,M.index);T=M.index+B.length;var j=E.length===0?A:E+A+B,D=this.calculateLabelDimensions(t,j),I=D.width;I<=h?E+=A+B:(E&&x.push(E),E=A+B)}}catch(G){k.e(G)}finally{k.f()}E.match(/^[\s\u200b]+$/)||x.push(E)}else x.push(m)}o("labelWrapCachedLines",x),i=o("labelWrapCachedText",x.join(`
60
+ `)),o("labelWrapKey",l)}else if(a==="ellipsis"){var U=t.pstyle("text-max-width").pfValue,W="",H="…",z=!1;if(this.calculateLabelDimensions(t,i).width<U)return i;for(var P=0;P<i.length;P++){var F=this.calculateLabelDimensions(t,W+i[P]+H).width;if(F>U)break;W+=i[P],P===i.length-1&&(z=!0)}return z||(W+=H),W}return i};ti.getLabelJustification=function(t){var e=t.pstyle("text-justification").strValue,r=t.pstyle("text-halign").strValue;return e==="auto"?t.isNode()?JR(r):"center":e};ti.calculateLabelDimensions=function(t,e){var r=this,n=r.cy.window(),i=n.document,s=0,o=t.pstyle("font-style").strValue,a=t.pstyle("font-size").pfValue,l=t.pstyle("font-family").strValue,u=t.pstyle("font-weight").strValue,c=t.pstyle("text-metrics").strValue||"font",h=this.labelCalcCanvas,g=this.labelCalcCanvasContext;if(!h){h=this.labelCalcCanvas=i.createElement("canvas"),g=this.labelCalcCanvasContext=h.getContext("2d");var p=h.style;p.position="absolute",p.left="-9999px",p.top="-9999px",p.zIndex="-1",p.visibility="hidden",p.pointerEvents="none"}g.font="".concat(o," ").concat(u," ").concat(a,"px ").concat(l);for(var x=0,w=0,v=e.split(`
61
+ `),m=v.length,y=0,b=0,_=0;_<m;_++){var R=v[_],E=g.measureText(R),T=Math.ceil(E.width),k=a;c==="glyph"&&(_===0&&(b=E.actualBoundingBoxAscent),_===m-1&&(y=E.actualBoundingBoxDescent)),x=Math.max(T,x),w+=k}return c==="glyph"&&(w-=a-b-y),x+=s,w+=s,{width:x,height:w,labelActualAscent:b,labelActualDescent:y}};ti.calculateLabelAngle=function(t,e){var r=t._private,n=r.rscratch,i=t.isEdge(),s=e?e+"-":"",o=t.pstyle(s+"text-rotation"),a=o.strValue;return a==="none"?0:i&&a==="autorotate"?n.labelAutoAngle:a==="autorotate"?0:o.pfValue};ti.calculateLabelAngles=function(t){var e=this,r=t.isEdge(),n=t._private,i=n.rscratch;i.labelAngle=e.calculateLabelAngle(t),r&&(i.sourceLabelAngle=e.calculateLabelAngle(t,"source"),i.targetLabelAngle=e.calculateLabelAngle(t,"target"))};var T_={},k1=28,T1=!1;T_.getNodeShape=function(t){var e=this,r=t.pstyle("shape").value;if(r==="cutrectangle"&&(t.width()<k1||t.height()<k1))return T1||(Bt("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),T1=!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 n=t.pstyle("shape-polygon-points").value;return e.nodeShapes.makePolygon(n).name}return r};var ah={};ah.registerCalculationListeners=function(){var t=this.cy,e=t.collection(),r=this,n=function(o){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e.merge(o),a)for(var l=0;l<o.length;l++){var u=o[l],c=u._private,h=c.rstyle;h.clean=!1,h.cleanConnected=!1}};r.binder(t).on("bounds.* dirty.*",function(o){var a=o.target;n(a)}).on("style.* background.*",function(o){var a=o.target;n(a,!1)});var i=function(o){if(o){var a=r.onUpdateEleCalcsFns;e.cleanStyle();for(var l=0;l<e.length;l++){var u=e[l],c=u._private.rstyle;u.isNode()&&!c.cleanConnected&&(n(u.connectedEdges()),c.cleanConnected=!0)}if(a)for(var h=0;h<a.length;h++){var g=a[h];g(o,e)}r.recalculateRenderedStyle(e),e=t.collection()}};r.flushRenderedStyleQueue=function(){i(!0)},r.beforeRender(i,r.beforeRenderPriorities.eleCalcs)};ah.onUpdateEleCalcs=function(t){var e=this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[];e.push(t)};ah.recalculateRenderedStyle=function(t,e){var r=function(_){return _._private.rstyle.cleanConnected};if(t.length!==0){var n=[],i=[];if(!this.destroyed){e===void 0&&(e=!0);for(var s=0;s<t.length;s++){var o=t[s],a=o._private,l=a.rstyle;o.isEdge()&&(!r(o.source())||!r(o.target()))&&(l.clean=!1),o.isEdge()&&o.isBundledBezier()&&o.parallelEdges().some(function(b){return!b._private.rstyle.clean&&b.isBundledBezier()})&&(l.clean=!1),!(e&&l.clean||o.removed())&&o.pstyle("display").value!=="none"&&(a.group==="nodes"?i.push(o):n.push(o),l.clean=!0)}for(var u=0;u<i.length;u++){var c=i[u],h=c._private,g=h.rstyle,p=c.position();this.recalculateNodeLabelProjection(c),g.nodeX=p.x,g.nodeY=p.y,g.nodeW=c.pstyle("width").pfValue,g.nodeH=c.pstyle("height").pfValue}this.recalculateEdgeProjections(n);for(var x=0;x<n.length;x++){var w=n[x],v=w._private,m=v.rstyle,y=v.rscratch;m.srcX=y.arrowStartX,m.srcY=y.arrowStartY,m.tgtX=y.arrowEndX,m.tgtY=y.arrowEndY,m.midX=y.midX,m.midY=y.midY,m.labelAngle=y.labelAngle,m.sourceLabelAngle=y.sourceLabelAngle,m.targetLabelAngle=y.targetLabelAngle}}}};var sh={};sh.updateCachedGrabbedEles=function(){var t=this.cachedZSortedEles;if(t){t.drag=[],t.nondrag=[];for(var e=[],r=0;r<t.length;r++){var n=t[r],i=n._private.rscratch;n.grabbed()&&!n.isParent()?e.push(n):i.inDragLayer?t.drag.push(n):t.nondrag.push(n)}for(var r=0;r<e.length;r++){var n=e[r];t.drag.push(n)}}};sh.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null};sh.getCachedZSortedEles=function(t){if(t||!this.cachedZSortedEles){var e=this.cy.mutableElements().toArray();e.sort(l_),e.interactive=e.filter(function(r){return r.interactive()}),this.cachedZSortedEles=e,this.updateCachedGrabbedEles()}else e=this.cachedZSortedEles;return e};var R_={};[Ua,Pc,Ur,Nl,fg,ti,T_,ah,sh].forEach(function(t){dt(R_,t)});var L_={};L_.getCachedImage=function(t,e,r){var n=this,i=n.imageCache=n.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 a="data:",l=t.substring(0,a.length).toLowerCase()===a;return l||(e=e==="null"?null:e,o.crossOrigin=e),o.src=t,o};var N_=function(e,r){var n=e[0];!n||n._private.grabbed===r||(n._private.grabbed=r,e.updateStyle(!1))},dN=function(e){N_(e,!0)},pN=function(e){N_(e,!1)},Ks={};Ks.registerBinding=function(t,e,r,n){var i=Array.prototype.slice.apply(arguments,[1]);if(Array.isArray(t)){for(var s=[],o=0;o<t.length;o++){var a=t[o];if(a!==void 0){var l=this.binder(a);s.push(l.on.apply(l,i))}}return s}var l=this.binder(t);return l.on.apply(l,i)};Ks.binder=function(t){var e=this,r=e.cy.window(),n=t===r||t===r.document||t===r.document.body||Sk(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(l,u,c){var h=Array.prototype.slice.call(arguments);return n&&e.supportsPassiveEvents&&(h[2]={capture:c??!1,passive:!1,once:!1}),e.bindings.push({target:t,args:h}),(t.addEventListener||t.on).apply(t,h),this};return{on:o,addEventListener:o,addListener:o,bind:o}};Ks.nodeIsDraggable=function(t){return t&&t.isNode()&&!t.locked()&&t.grabbable()};Ks.nodeIsGrabbable=function(t){return this.nodeIsDraggable(t)&&t.interactive()};Ks.load=function(){var t=this,e=t.cy.window(),r=function(Z){return Z.selected()},n=function(Z){var te=Z.getRootNode();if(te&&te.nodeType===11&&te.host!==void 0)return te},i=function(Z,te,oe,ue){Z==null&&(Z=t.cy);for(var se=0;se<te.length;se++){var he=te[se];Z.emit({originalEvent:oe,type:he,position:ue})}},s=function(Z){return Z.shiftKey||Z.metaKey||Z.ctrlKey},o=function(Z,te){var oe=!0;if(t.cy.hasCompoundNodes()&&Z&&Z.pannable())for(var ue=0;te&&ue<te.length;ue++){var Z=te[ue];if(Z.isNode()&&Z.isParent()&&!Z.pannable()){oe=!1;break}}else oe=!0;return oe},a=function(Z){Z[0]._private.rscratch.inDragLayer=!0},l=function(Z){Z[0]._private.rscratch.inDragLayer=!1},u=function(Z){Z[0]._private.rscratch.isGrabTarget=!0},c=function(Z){Z[0]._private.rscratch.isGrabTarget=!1},h=function(Z,te){var oe=te.addToList,ue=oe.has(Z);!ue&&Z.grabbable()&&!Z.locked()&&(oe.merge(Z),dN(Z))},g=function(Z,te){if(Z.cy().hasCompoundNodes()&&!(te.inDragLayer==null&&te.addToList==null)){var oe=Z.descendants();te.inDragLayer&&(oe.forEach(a),oe.connectedEdges().forEach(a)),te.addToList&&h(oe,te)}},p=function(Z,te){te=te||{};var oe=Z.cy().hasCompoundNodes();te.inDragLayer&&(Z.forEach(a),Z.neighborhood().stdFilter(function(ue){return!oe||ue.isEdge()}).forEach(a)),te.addToList&&Z.forEach(function(ue){h(ue,te)}),g(Z,te),v(Z,{inDragLayer:te.inDragLayer}),t.updateCachedGrabbedEles()},x=p,w=function(Z){Z&&(t.getCachedZSortedEles().forEach(function(te){pN(te),l(te),c(te)}),t.updateCachedGrabbedEles())},v=function(Z,te){if(!(te.inDragLayer==null&&te.addToList==null)&&Z.cy().hasCompoundNodes()){var oe=Z.ancestors().orphans();if(!oe.same(Z)){var ue=oe.descendants().spawnSelf().merge(oe).unmerge(Z).unmerge(Z.descendants()),se=ue.connectedEdges();te.inDragLayer&&(se.forEach(a),ue.forEach(a)),te.addToList&&ue.forEach(function(he){h(he,te)})}}},m=function(){document.activeElement!=null&&document.activeElement.blur!=null&&document.activeElement.blur()},y=typeof MutationObserver<"u",b=typeof ResizeObserver<"u";y?(t.removeObserver=new MutationObserver(function(me){for(var Z=0;Z<me.length;Z++){var te=me[Z],oe=te.removedNodes;if(oe)for(var ue=0;ue<oe.length;ue++){var se=oe[ue];if(se===t.container){t.destroy();break}}}}),t.container.parentNode&&t.removeObserver.observe(t.container.parentNode,{childList:!0})):t.registerBinding(t.container,"DOMNodeRemoved",function(me){t.destroy()});var _=kl(function(){t.cy.resize()},100);y&&(t.styleObserver=new MutationObserver(_),t.styleObserver.observe(t.container,{attributes:!0})),t.registerBinding(e,"resize",_),b&&(t.resizeObserver=new ResizeObserver(_),t.resizeObserver.observe(t.container));var R=function(Z,te){for(;Z!=null;)te(Z),Z=Z.parentNode},E=function(){t.invalidateContainerClientCoordsCache()};R(t.container,function(me){t.registerBinding(me,"transitionend",E),t.registerBinding(me,"animationend",E),t.registerBinding(me,"scroll",E)}),t.registerBinding(t.container,"contextmenu",function(me){me.preventDefault()});var T=function(){return t.selection[4]!==0},k=function(Z){for(var te=t.findContainerClientCoords(),oe=te[0],ue=te[1],se=te[2],he=te[3],pe=Z.touches?Z.touches:[Z],be=!1,Se=0;Se<pe.length;Se++){var Te=pe[Se];if(oe<=Te.clientX&&Te.clientX<=oe+se&&ue<=Te.clientY&&Te.clientY<=ue+he){be=!0;break}}if(!be)return!1;for(var Re=t.container,ze=Z.target,Fe=ze.parentNode,Ge=!1;Fe;){if(Fe===Re){Ge=!0;break}Fe=Fe.parentNode}return!!Ge};t.registerBinding(t.container,"mousedown",function(Z){if(k(Z)&&!(t.hoverData.which===1&&Z.which!==1)){Z.preventDefault(),m(),t.hoverData.capture=!0,t.hoverData.which=Z.which;var te=t.cy,oe=[Z.clientX,Z.clientY],ue=t.projectIntoViewport(oe[0],oe[1]),se=t.selection,he=t.findNearestElements(ue[0],ue[1],!0,!1),pe=he[0],be=t.dragData.possibleDragElements;t.hoverData.mdownPos=ue,t.hoverData.mdownGPos=oe;var Se=function(it){return{originalEvent:Z,type:it,position:{x:ue[0],y:ue[1]}}},Te=function(){t.hoverData.tapholdCancelled=!1,clearTimeout(t.hoverData.tapholdTimeout),t.hoverData.tapholdTimeout=setTimeout(function(){if(!t.hoverData.tapholdCancelled){var it=t.hoverData.down;it?it.emit(Se("taphold")):te.emit(Se("taphold"))}},t.tapholdDuration)};if(Z.which==3){t.hoverData.cxtStarted=!0;var Re={originalEvent:Z,type:"cxttapstart",position:{x:ue[0],y:ue[1]}};pe?(pe.activate(),pe.emit(Re),t.hoverData.down=pe):te.emit(Re),t.hoverData.downTime=new Date().getTime(),t.hoverData.cxtDragged=!1}else if(Z.which==1){pe&&pe.activate();{if(pe!=null&&t.nodeIsGrabbable(pe)){var ze=function(it){it.emit(Se("grab"))};if(u(pe),!pe.selected())be=t.dragData.possibleDragElements=te.collection(),x(pe,{addToList:be}),pe.emit(Se("grabon")).emit(Se("grab"));else{be=t.dragData.possibleDragElements=te.collection();var Fe=te.$(function(Ge){return Ge.isNode()&&Ge.selected()&&t.nodeIsGrabbable(Ge)});p(Fe,{addToList:be}),pe.emit(Se("grabon")),Fe.forEach(ze)}t.redrawHint("eles",!0),t.redrawHint("drag",!0)}t.hoverData.down=pe,t.hoverData.downs=he,t.hoverData.downTime=new Date().getTime()}i(pe,["mousedown","tapstart","vmousedown"],Z,{x:ue[0],y:ue[1]}),pe==null?(se[4]=1,t.data.bgActivePosistion={x:ue[0],y:ue[1]},t.redrawHint("select",!0),t.redraw()):pe.pannable()&&(se[4]=1),Te()}se[0]=se[2]=ue[0],se[1]=se[3]=ue[1]}},!1);var N=n(t.container);t.registerBinding([e,N],"mousemove",function(Z){var te=t.hoverData.capture;if(!(!te&&!k(Z))){var oe=!1,ue=t.cy,se=ue.zoom(),he=[Z.clientX,Z.clientY],pe=t.projectIntoViewport(he[0],he[1]),be=t.hoverData.mdownPos,Se=t.hoverData.mdownGPos,Te=t.selection,Re=null;!t.hoverData.draggingEles&&!t.hoverData.dragging&&!t.hoverData.selecting&&(Re=t.findNearestElement(pe[0],pe[1],!0,!1));var ze=t.hoverData.last,Fe=t.hoverData.down,Ge=[pe[0]-Te[2],pe[1]-Te[3]],it=t.dragData.possibleDragElements,Ze;if(Se){var qe=he[0]-Se[0],pt=qe*qe,Qe=he[1]-Se[1],Ke=Qe*Qe,xt=pt+Ke;t.hoverData.isOverThresholdDrag=Ze=xt>=t.desktopTapThreshold2}var st=s(Z);Ze&&(t.hoverData.tapholdCancelled=!0);var vt=function(){var ir=t.hoverData.dragDelta=t.hoverData.dragDelta||[];ir.length===0?(ir.push(Ge[0]),ir.push(Ge[1])):(ir[0]+=Ge[0],ir[1]+=Ge[1])};oe=!0,i(Re,["mousemove","vmousemove","tapdrag"],Z,{x:pe[0],y:pe[1]});var yt=function(ir){return{originalEvent:Z,type:ir,position:{x:pe[0],y:pe[1]}}},Rt=function(){t.data.bgActivePosistion=void 0,t.hoverData.selecting||ue.emit(yt("boxstart")),Te[4]=1,t.hoverData.selecting=!0,t.redrawHint("select",!0),t.redraw()};if(t.hoverData.which===3){if(Ze){var It=yt("cxtdrag");Fe?Fe.emit(It):ue.emit(It),t.hoverData.cxtDragged=!0,(!t.hoverData.cxtOver||Re!==t.hoverData.cxtOver)&&(t.hoverData.cxtOver&&t.hoverData.cxtOver.emit(yt("cxtdragout")),t.hoverData.cxtOver=Re,Re&&Re.emit(yt("cxtdragover")))}}else if(t.hoverData.dragging){if(oe=!0,ue.panningEnabled()&&ue.userPanningEnabled()){var kt;if(t.hoverData.justStartedPan){var Tr=t.hoverData.mdownPos;kt={x:(pe[0]-Tr[0])*se,y:(pe[1]-Tr[1])*se},t.hoverData.justStartedPan=!1}else kt={x:Ge[0]*se,y:Ge[1]*se};ue.panBy(kt),ue.emit(yt("dragpan")),t.hoverData.dragged=!0}pe=t.projectIntoViewport(Z.clientX,Z.clientY)}else if(Te[4]==1&&(Fe==null||Fe.pannable())){if(Ze){if(!t.hoverData.dragging&&ue.boxSelectionEnabled()&&(st||!ue.panningEnabled()||!ue.userPanningEnabled()))Rt();else if(!t.hoverData.selecting&&ue.panningEnabled()&&ue.userPanningEnabled()){var Pr=o(Fe,t.hoverData.downs);Pr&&(t.hoverData.dragging=!0,t.hoverData.justStartedPan=!0,Te[4]=0,t.data.bgActivePosistion=As(be),t.redrawHint("select",!0),t.redraw())}Fe&&Fe.pannable()&&Fe.active()&&Fe.unactivate()}}else{if(Fe&&Fe.pannable()&&Fe.active()&&Fe.unactivate(),(!Fe||!Fe.grabbed())&&Re!=ze&&(ze&&i(ze,["mouseout","tapdragout"],Z,{x:pe[0],y:pe[1]}),Re&&i(Re,["mouseover","tapdragover"],Z,{x:pe[0],y:pe[1]}),t.hoverData.last=Re),Fe)if(Ze){if(ue.boxSelectionEnabled()&&st)Fe&&Fe.grabbed()&&(w(it),Fe.emit(yt("freeon")),it.emit(yt("free")),t.dragData.didDrag&&(Fe.emit(yt("dragfreeon")),it.emit(yt("dragfree")))),Rt();else if(Fe&&Fe.grabbed()&&t.nodeIsDraggable(Fe)){var ur=!t.dragData.didDrag;ur&&t.redrawHint("eles",!0),t.dragData.didDrag=!0,t.hoverData.draggingEles||p(it,{inDragLayer:!0});var At={x:0,y:0};if(Xe(Ge[0])&&Xe(Ge[1])&&(At.x+=Ge[0],At.y+=Ge[1],ur)){var Kt=t.hoverData.dragDelta;Kt&&Xe(Kt[0])&&Xe(Kt[1])&&(At.x+=Kt[0],At.y+=Kt[1])}t.hoverData.draggingEles=!0,it.silentShift(At).emit(yt("position")).emit(yt("drag")),t.redrawHint("drag",!0),t.redraw()}}else vt();oe=!0}if(Te[2]=pe[0],Te[3]=pe[1],oe)return Z.stopPropagation&&Z.stopPropagation(),Z.preventDefault&&Z.preventDefault(),!1}},!1);var M,B,A;t.registerBinding(e,"mouseup",function(Z){if(!(t.hoverData.which===1&&Z.which!==1&&t.hoverData.capture)){var te=t.hoverData.capture;if(te){t.hoverData.capture=!1;var oe=t.cy,ue=t.projectIntoViewport(Z.clientX,Z.clientY),se=t.selection,he=t.findNearestElement(ue[0],ue[1],!0,!1),pe=t.dragData.possibleDragElements,be=t.hoverData.down,Se=s(Z);t.data.bgActivePosistion&&(t.redrawHint("select",!0),t.redraw()),t.hoverData.tapholdCancelled=!0,t.data.bgActivePosistion=void 0,be&&be.unactivate();var Te=function(qe){return{originalEvent:Z,type:qe,position:{x:ue[0],y:ue[1]}}};if(t.hoverData.which===3){var Re=Te("cxttapend");if(be?be.emit(Re):oe.emit(Re),!t.hoverData.cxtDragged){var ze=Te("cxttap");be?be.emit(ze):oe.emit(ze)}t.hoverData.cxtDragged=!1,t.hoverData.which=null}else if(t.hoverData.which===1){if(i(he,["mouseup","tapend","vmouseup"],Z,{x:ue[0],y:ue[1]}),!t.dragData.didDrag&&!t.hoverData.dragged&&!t.hoverData.selecting&&!t.hoverData.isOverThresholdDrag&&(i(be,["click","tap","vclick"],Z,{x:ue[0],y:ue[1]}),B=!1,Z.timeStamp-A<=oe.multiClickDebounceTime()?(M&&clearTimeout(M),B=!0,A=null,i(be,["dblclick","dbltap","vdblclick"],Z,{x:ue[0],y:ue[1]})):(M=setTimeout(function(){B||i(be,["oneclick","onetap","voneclick"],Z,{x:ue[0],y:ue[1]})},oe.multiClickDebounceTime()),A=Z.timeStamp)),be==null&&!t.dragData.didDrag&&!t.hoverData.selecting&&!t.hoverData.dragged&&!s(Z)&&(oe.$(r).unselect(["tapunselect"]),pe.length>0&&t.redrawHint("eles",!0),t.dragData.possibleDragElements=pe=oe.collection()),he==be&&!t.dragData.didDrag&&!t.hoverData.selecting&&he!=null&&he._private.selectable&&(t.hoverData.dragging||(oe.selectionType()==="additive"||Se?he.selected()?he.unselect(["tapunselect"]):he.select(["tapselect"]):Se||(oe.$(r).unmerge(he).unselect(["tapunselect"]),he.select(["tapselect"]))),t.redrawHint("eles",!0)),t.hoverData.selecting){var Fe=oe.collection(t.getAllInBox(se[0],se[1],se[2],se[3]));t.redrawHint("select",!0),Fe.length>0&&t.redrawHint("eles",!0),oe.emit(Te("boxend"));var Ge=function(qe){return qe.selectable()&&!qe.selected()};oe.selectionType()==="additive"||Se||oe.$(r).unmerge(Fe).unselect(),Fe.emit(Te("box")).stdFilter(Ge).select().emit(Te("boxselect")),t.redraw()}if(t.hoverData.dragging&&(t.hoverData.dragging=!1,t.redrawHint("select",!0),t.redrawHint("eles",!0),t.redraw()),!se[4]){t.redrawHint("drag",!0),t.redrawHint("eles",!0);var it=be&&be.grabbed();w(pe),it&&(be.emit(Te("freeon")),pe.emit(Te("free")),t.dragData.didDrag&&(be.emit(Te("dragfreeon")),pe.emit(Te("dragfree"))))}}se[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 j=[],D=4,I,U=1e5,W=function(Z,te){for(var oe=0;oe<Z.length;oe++)if(Z[oe]%te!==0)return!1;return!0},H=function(Z){for(var te=Math.abs(Z[0]),oe=1;oe<Z.length;oe++)if(Math.abs(Z[oe])!==te)return!1;return!0},z=function(Z){var te=!1,oe=Z.deltaY;if(oe==null&&(Z.wheelDeltaY!=null?oe=Z.wheelDeltaY/4:Z.wheelDelta!=null&&(oe=Z.wheelDelta/4)),oe!==0){if(I==null)if(j.length>=D){var ue=j;if(I=W(ue,5),!I){var se=Math.abs(ue[0]);I=H(ue)&&se>5}if(I)for(var he=0;he<ue.length;he++)U=Math.min(Math.abs(ue[he]),U)}else j.push(oe),te=!0;else I&&(U=Math.min(Math.abs(oe),U));if(!t.scrollingPage){var pe=t.cy,be=pe.zoom(),Se=pe.pan(),Te=t.projectIntoViewport(Z.clientX,Z.clientY),Re=[Te[0]*be+Se.x,Te[1]*be+Se.y];if(t.hoverData.draggingEles||t.hoverData.dragging||t.hoverData.cxtStarted||T()){Z.preventDefault();return}if(pe.panningEnabled()&&pe.userPanningEnabled()&&pe.zoomingEnabled()&&pe.userZoomingEnabled()){Z.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 ze;te&&Math.abs(oe)>5&&(oe=Zv(oe)*5),ze=oe/-250,I&&(ze/=U,ze*=3),ze=ze*t.wheelSensitivity;var Fe=Z.deltaMode===1;Fe&&(ze*=33);var Ge=pe.zoom()*Math.pow(10,ze);Z.type==="gesturechange"&&(Ge=t.gestureStartZoom*Z.scale),pe.zoom({level:Ge,renderedPosition:{x:Re[0],y:Re[1]}}),pe.emit({type:Z.type==="gesturechange"?"pinchzoom":"scrollzoom",originalEvent:Z,position:{x:Te[0],y:Te[1]}})}}}};t.registerBinding(t.container,"wheel",z,!0),t.registerBinding(e,"scroll",function(Z){t.scrollingPage=!0,clearTimeout(t.scrollingPageTimeout),t.scrollingPageTimeout=setTimeout(function(){t.scrollingPage=!1},250)},!0),t.registerBinding(t.container,"gesturestart",function(Z){t.gestureStartZoom=t.cy.zoom(),t.hasTouchStarted||Z.preventDefault()},!0),t.registerBinding(t.container,"gesturechange",function(me){t.hasTouchStarted||z(me)},!0),t.registerBinding(t.container,"mouseout",function(Z){var te=t.projectIntoViewport(Z.clientX,Z.clientY);t.cy.emit({originalEvent:Z,type:"mouseout",position:{x:te[0],y:te[1]}})},!1),t.registerBinding(t.container,"mouseover",function(Z){var te=t.projectIntoViewport(Z.clientX,Z.clientY);t.cy.emit({originalEvent:Z,type:"mouseover",position:{x:te[0],y:te[1]}})},!1);var P,F,G,$,ee,re,ne,Y,q,K,X,J,ie,ce=function(Z,te,oe,ue){return Math.sqrt((oe-Z)*(oe-Z)+(ue-te)*(ue-te))},de=function(Z,te,oe,ue){return(oe-Z)*(oe-Z)+(ue-te)*(ue-te)},Le;t.registerBinding(t.container,"touchstart",Le=function(Z){if(t.hasTouchStarted=!0,!!k(Z)){m(),t.touchData.capture=!0,t.data.bgActivePosistion=void 0;var te=t.cy,oe=t.touchData.now,ue=t.touchData.earlier;if(Z.touches[0]){var se=t.projectIntoViewport(Z.touches[0].clientX,Z.touches[0].clientY);oe[0]=se[0],oe[1]=se[1]}if(Z.touches[1]){var se=t.projectIntoViewport(Z.touches[1].clientX,Z.touches[1].clientY);oe[2]=se[0],oe[3]=se[1]}if(Z.touches[2]){var se=t.projectIntoViewport(Z.touches[2].clientX,Z.touches[2].clientY);oe[4]=se[0],oe[5]=se[1]}var he=function(st){return{originalEvent:Z,type:st,position:{x:oe[0],y:oe[1]}}};if(Z.touches[1]){t.touchData.singleTouchMoved=!0,w(t.dragData.touchDragEles);var pe=t.findContainerClientCoords();q=pe[0],K=pe[1],X=pe[2],J=pe[3],P=Z.touches[0].clientX-q,F=Z.touches[0].clientY-K,G=Z.touches[1].clientX-q,$=Z.touches[1].clientY-K,ie=0<=P&&P<=X&&0<=G&&G<=X&&0<=F&&F<=J&&0<=$&&$<=J;var be=te.pan(),Se=te.zoom();ee=ce(P,F,G,$),re=de(P,F,G,$),ne=[(P+G)/2,(F+$)/2],Y=[(ne[0]-be.x)/Se,(ne[1]-be.y)/Se];var Te=200,Re=Te*Te;if(re<Re&&!Z.touches[2]){var ze=t.findNearestElement(oe[0],oe[1],!0,!0),Fe=t.findNearestElement(oe[2],oe[3],!0,!0);ze&&ze.isNode()?(ze.activate().emit(he("cxttapstart")),t.touchData.start=ze):Fe&&Fe.isNode()?(Fe.activate().emit(he("cxttapstart")),t.touchData.start=Fe):te.emit(he("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(Z.touches[2])te.boxSelectionEnabled()&&Z.preventDefault();else if(!Z.touches[1]){if(Z.touches[0]){var Ge=t.findNearestElements(oe[0],oe[1],!0,!0),it=Ge[0];if(it!=null&&(it.activate(),t.touchData.start=it,t.touchData.starts=Ge,t.nodeIsGrabbable(it))){var Ze=t.dragData.touchDragEles=te.collection(),qe=null;t.redrawHint("eles",!0),t.redrawHint("drag",!0),it.selected()?(qe=te.$(function(xt){return xt.selected()&&t.nodeIsGrabbable(xt)}),p(qe,{addToList:Ze})):x(it,{addToList:Ze}),u(it),it.emit(he("grabon")),qe?qe.forEach(function(xt){xt.emit(he("grab"))}):it.emit(he("grab"))}i(it,["touchstart","tapstart","vmousedown"],Z,{x:oe[0],y:oe[1]}),it==null&&(t.data.bgActivePosistion={x:se[0],y:se[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"],Z,{x:oe[0],y:oe[1]})},t.tapholdDuration)}}if(Z.touches.length>=1){for(var pt=t.touchData.startPosition=[null,null,null,null,null,null],Qe=0;Qe<oe.length;Qe++)pt[Qe]=ue[Qe]=oe[Qe];var Ke=Z.touches[0];t.touchData.startGPosition=[Ke.clientX,Ke.clientY]}}},!1);var je;t.registerBinding(e,"touchmove",je=function(Z){var te=t.touchData.capture;if(!(!te&&!k(Z))){var oe=t.selection,ue=t.cy,se=t.touchData.now,he=t.touchData.earlier,pe=ue.zoom();if(Z.touches[0]){var be=t.projectIntoViewport(Z.touches[0].clientX,Z.touches[0].clientY);se[0]=be[0],se[1]=be[1]}if(Z.touches[1]){var be=t.projectIntoViewport(Z.touches[1].clientX,Z.touches[1].clientY);se[2]=be[0],se[3]=be[1]}if(Z.touches[2]){var be=t.projectIntoViewport(Z.touches[2].clientX,Z.touches[2].clientY);se[4]=be[0],se[5]=be[1]}var Se=function(Ga){return{originalEvent:Z,type:Ga,position:{x:se[0],y:se[1]}}},Te=t.touchData.startGPosition,Re;if(te&&Z.touches[0]&&Te){for(var ze=[],Fe=0;Fe<se.length;Fe++)ze[Fe]=se[Fe]-he[Fe];var Ge=Z.touches[0].clientX-Te[0],it=Ge*Ge,Ze=Z.touches[0].clientY-Te[1],qe=Ze*Ze,pt=it+qe;Re=pt>=t.touchTapThreshold2}if(te&&t.touchData.cxt){Z.preventDefault();var Qe=Z.touches[0].clientX-q,Ke=Z.touches[0].clientY-K,xt=Z.touches[1].clientX-q,st=Z.touches[1].clientY-K,vt=de(Qe,Ke,xt,st),yt=vt/re,Rt=150,It=Rt*Rt,kt=1.5,Tr=kt*kt;if(yt>=Tr||vt>=It){t.touchData.cxt=!1,t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var Pr=Se("cxttapend");t.touchData.start?(t.touchData.start.unactivate().emit(Pr),t.touchData.start=null):ue.emit(Pr)}}if(te&&t.touchData.cxt){var Pr=Se("cxtdrag");t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.touchData.start?t.touchData.start.emit(Pr):ue.emit(Pr),t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxtDragged=!0;var ur=t.findNearestElement(se[0],se[1],!0,!0);(!t.touchData.cxtOver||ur!==t.touchData.cxtOver)&&(t.touchData.cxtOver&&t.touchData.cxtOver.emit(Se("cxtdragout")),t.touchData.cxtOver=ur,ur&&ur.emit(Se("cxtdragover")))}else if(te&&Z.touches[2]&&ue.boxSelectionEnabled())Z.preventDefault(),t.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,t.touchData.selecting||ue.emit(Se("boxstart")),t.touchData.selecting=!0,t.touchData.didSelect=!0,oe[4]=1,!oe||oe.length===0||oe[0]===void 0?(oe[0]=(se[0]+se[2]+se[4])/3,oe[1]=(se[1]+se[3]+se[5])/3,oe[2]=(se[0]+se[2]+se[4])/3+1,oe[3]=(se[1]+se[3]+se[5])/3+1):(oe[2]=(se[0]+se[2]+se[4])/3,oe[3]=(se[1]+se[3]+se[5])/3),t.redrawHint("select",!0),t.redraw();else if(te&&Z.touches[1]&&!t.touchData.didSelect&&ue.zoomingEnabled()&&ue.panningEnabled()&&ue.userZoomingEnabled()&&ue.userPanningEnabled()){Z.preventDefault(),t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var At=t.dragData.touchDragEles;if(At){t.redrawHint("drag",!0);for(var Kt=0;Kt<At.length;Kt++){var Vr=At[Kt]._private;Vr.grabbed=!1,Vr.rscratch.inDragLayer=!1}}var ir=t.touchData.start,Qe=Z.touches[0].clientX-q,Ke=Z.touches[0].clientY-K,xt=Z.touches[1].clientX-q,st=Z.touches[1].clientY-K,Un=ce(Qe,Ke,xt,st),Nn=Un/ee;if(ie){var Dn=Qe-P,ca=Ke-F,ha=xt-G,$a=st-$,zt=(Dn+ha)/2,eo=(ca+$a)/2,un=ue.zoom(),ii=un*Nn,xn=ue.pan(),bi=Y[0]*un+xn.x,wi=Y[1]*un+xn.y,Qt={x:-ii/un*(bi-xn.x-zt)+bi,y:-ii/un*(wi-xn.y-eo)+wi};if(ir&&ir.active()){var At=t.dragData.touchDragEles;w(At),t.redrawHint("drag",!0),t.redrawHint("eles",!0),ir.unactivate().emit(Se("freeon")),At.emit(Se("free")),t.dragData.didDrag&&(ir.emit(Se("dragfreeon")),At.emit(Se("dragfree")))}ue.viewport({zoom:ii,pan:Qt,cancelOnFailedZoom:!0}),ue.emit(Se("pinchzoom")),ee=Un,P=Qe,F=Ke,G=xt,$=st,t.pinching=!0}if(Z.touches[0]){var be=t.projectIntoViewport(Z.touches[0].clientX,Z.touches[0].clientY);se[0]=be[0],se[1]=be[1]}if(Z.touches[1]){var be=t.projectIntoViewport(Z.touches[1].clientX,Z.touches[1].clientY);se[2]=be[0],se[3]=be[1]}if(Z.touches[2]){var be=t.projectIntoViewport(Z.touches[2].clientX,Z.touches[2].clientY);se[4]=be[0],se[5]=be[1]}}else if(Z.touches[0]&&!t.touchData.didSelect){var rt=t.touchData.start,Et=t.touchData.last,ur;if(!t.hoverData.draggingEles&&!t.swipePanning&&(ur=t.findNearestElement(se[0],se[1],!0,!0)),te&&rt!=null&&Z.preventDefault(),te&&rt!=null&&t.nodeIsDraggable(rt))if(Re){var At=t.dragData.touchDragEles,er=!t.dragData.didDrag;er&&p(At,{inDragLayer:!0}),t.dragData.didDrag=!0;var cr={x:0,y:0};if(Xe(ze[0])&&Xe(ze[1])&&(cr.x+=ze[0],cr.y+=ze[1],er)){t.redrawHint("eles",!0);var cn=t.touchData.dragDelta;cn&&Xe(cn[0])&&Xe(cn[1])&&(cr.x+=cn[0],cr.y+=cn[1])}t.hoverData.draggingEles=!0,At.silentShift(cr).emit(Se("position")).emit(Se("drag")),t.redrawHint("drag",!0),t.touchData.startPosition[0]==he[0]&&t.touchData.startPosition[1]==he[1]&&t.redrawHint("eles",!0),t.redraw()}else{var cn=t.touchData.dragDelta=t.touchData.dragDelta||[];cn.length===0?(cn.push(ze[0]),cn.push(ze[1])):(cn[0]+=ze[0],cn[1]+=ze[1])}if(i(rt||ur,["touchmove","tapdrag","vmousemove"],Z,{x:se[0],y:se[1]}),(!rt||!rt.grabbed())&&ur!=Et&&(Et&&Et.emit(Se("tapdragout")),ur&&ur.emit(Se("tapdragover"))),t.touchData.last=ur,te)for(var Kt=0;Kt<se.length;Kt++)se[Kt]&&t.touchData.startPosition[Kt]&&Re&&(t.touchData.singleTouchMoved=!0);if(te&&(rt==null||rt.pannable())&&ue.panningEnabled()&&ue.userPanningEnabled()){var fh=o(rt,t.touchData.starts);fh&&(Z.preventDefault(),t.data.bgActivePosistion||(t.data.bgActivePosistion=As(t.touchData.startPosition)),t.swipePanning?(ue.panBy({x:ze[0]*pe,y:ze[1]*pe}),ue.emit(Se("dragpan"))):Re&&(t.swipePanning=!0,ue.panBy({x:Ge*pe,y:Ze*pe}),ue.emit(Se("dragpan")),rt&&(rt.unactivate(),t.redrawHint("select",!0),t.touchData.start=null)));var be=t.projectIntoViewport(Z.touches[0].clientX,Z.touches[0].clientY);se[0]=be[0],se[1]=be[1]}}for(var Fe=0;Fe<se.length;Fe++)he[Fe]=se[Fe];te&&Z.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 _e;t.registerBinding(e,"touchcancel",_e=function(Z){var te=t.touchData.start;t.touchData.capture=!1,te&&te.unactivate()});var ke,Ne,Ee,Me;if(t.registerBinding(e,"touchend",ke=function(Z){var te=t.touchData.start,oe=t.touchData.capture;if(oe)Z.touches.length===0&&(t.touchData.capture=!1),Z.preventDefault();else return;var ue=t.selection;t.swipePanning=!1,t.hoverData.draggingEles=!1;var se=t.cy,he=se.zoom(),pe=t.touchData.now,be=t.touchData.earlier;if(Z.touches[0]){var Se=t.projectIntoViewport(Z.touches[0].clientX,Z.touches[0].clientY);pe[0]=Se[0],pe[1]=Se[1]}if(Z.touches[1]){var Se=t.projectIntoViewport(Z.touches[1].clientX,Z.touches[1].clientY);pe[2]=Se[0],pe[3]=Se[1]}if(Z.touches[2]){var Se=t.projectIntoViewport(Z.touches[2].clientX,Z.touches[2].clientY);pe[4]=Se[0],pe[5]=Se[1]}var Te=function(It){return{originalEvent:Z,type:It,position:{x:pe[0],y:pe[1]}}};te&&te.unactivate();var Re;if(t.touchData.cxt){if(Re=Te("cxttapend"),te?te.emit(Re):se.emit(Re),!t.touchData.cxtDragged){var ze=Te("cxttap");te?te.emit(ze):se.emit(ze)}t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxt=!1,t.touchData.start=null,t.redraw();return}if(!Z.touches[2]&&se.boxSelectionEnabled()&&t.touchData.selecting){t.touchData.selecting=!1;var Fe=se.collection(t.getAllInBox(ue[0],ue[1],ue[2],ue[3]));ue[0]=void 0,ue[1]=void 0,ue[2]=void 0,ue[3]=void 0,ue[4]=0,t.redrawHint("select",!0),se.emit(Te("boxend"));var Ge=function(It){return It.selectable()&&!It.selected()};Fe.emit(Te("box")).stdFilter(Ge).select().emit(Te("boxselect")),Fe.nonempty()&&t.redrawHint("eles",!0),t.redraw()}if(te!=null&&te.unactivate(),Z.touches[2])t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);else if(!Z.touches[1]){if(!Z.touches[0]){if(!Z.touches[0]){t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var it=t.dragData.touchDragEles;if(te!=null){var Ze=te._private.grabbed;w(it),t.redrawHint("drag",!0),t.redrawHint("eles",!0),Ze&&(te.emit(Te("freeon")),it.emit(Te("free")),t.dragData.didDrag&&(te.emit(Te("dragfreeon")),it.emit(Te("dragfree")))),i(te,["touchend","tapend","vmouseup","tapdragout"],Z,{x:pe[0],y:pe[1]}),te.unactivate(),t.touchData.start=null}else{var qe=t.findNearestElement(pe[0],pe[1],!0,!0);i(qe,["touchend","tapend","vmouseup","tapdragout"],Z,{x:pe[0],y:pe[1]})}var pt=t.touchData.startPosition[0]-pe[0],Qe=pt*pt,Ke=t.touchData.startPosition[1]-pe[1],xt=Ke*Ke,st=Qe+xt,vt=st*he*he;t.touchData.singleTouchMoved||(te||se.$(":selected").unselect(["tapunselect"]),i(te,["tap","vclick"],Z,{x:pe[0],y:pe[1]}),Ne=!1,Z.timeStamp-Me<=se.multiClickDebounceTime()?(Ee&&clearTimeout(Ee),Ne=!0,Me=null,i(te,["dbltap","vdblclick"],Z,{x:pe[0],y:pe[1]})):(Ee=setTimeout(function(){Ne||i(te,["onetap","voneclick"],Z,{x:pe[0],y:pe[1]})},se.multiClickDebounceTime()),Me=Z.timeStamp)),te!=null&&!t.dragData.didDrag&&te._private.selectable&&vt<t.touchTapThreshold2&&!t.pinching&&(se.selectionType()==="single"?(se.$(r).unmerge(te).unselect(["tapunselect"]),te.select(["tapselect"])):te.selected()?te.unselect(["tapunselect"]):te.select(["tapselect"]),t.redrawHint("eles",!0)),t.touchData.singleTouchMoved=!0}}}for(var yt=0;yt<pe.length;yt++)be[yt]=pe[yt];t.dragData.didDrag=!1,Z.touches.length===0&&(t.touchData.dragDelta=[],t.touchData.startPosition=[null,null,null,null,null,null],t.touchData.startGPosition=null,t.touchData.didSelect=!1),Z.touches.length<2&&(Z.touches.length===1&&(t.touchData.startGPosition=[Z.touches[0].clientX,Z.touches[0].clientY]),t.pinching=!1,t.redrawHint("eles",!0),t.redraw())},!1),typeof TouchEvent>"u"){var Pe=[],De=function(Z){return{clientX:Z.clientX,clientY:Z.clientY,force:1,identifier:Z.pointerId,pageX:Z.pageX,pageY:Z.pageY,radiusX:Z.width/2,radiusY:Z.height/2,screenX:Z.screenX,screenY:Z.screenY,target:Z.target}},Ue=function(Z){return{event:Z,touch:De(Z)}},Ye=function(Z){Pe.push(Ue(Z))},ge=function(Z){for(var te=0;te<Pe.length;te++){var oe=Pe[te];if(oe.event.pointerId===Z.pointerId){Pe.splice(te,1);return}}},Ce=function(Z){var te=Pe.filter(function(oe){return oe.event.pointerId===Z.pointerId})[0];te.event=Z,te.touch=De(Z)},Ae=function(Z){Z.touches=Pe.map(function(te){return te.touch})},Be=function(Z){return Z.pointerType==="mouse"||Z.pointerType===4};t.registerBinding(t.container,"pointerdown",function(me){Be(me)||(me.preventDefault(),Ye(me),Ae(me),Le(me))}),t.registerBinding(t.container,"pointerup",function(me){Be(me)||(ge(me),Ae(me),ke(me))}),t.registerBinding(t.container,"pointercancel",function(me){Be(me)||(ge(me),Ae(me),_e(me))}),t.registerBinding(t.container,"pointermove",function(me){Be(me)||(me.preventDefault(),Ce(me),Ae(me),je(me))})}};var mi={};mi.generatePolygon=function(t,e){return this.nodeShapes[t]={renderer:this,name:t,points:e,draw:function(n,i,s,o,a,l){this.renderer.nodeShapeImpl("polygon",n,i,s,o,a,this.points)},intersectLine:function(n,i,s,o,a,l,u,c){return dl(a,l,this.points,n,i,s/2,o/2,u)},checkPoint:function(n,i,s,o,a,l,u,c){return gi(n,i,this.points,l,u,o,a,[0,-1],s)},hasMiterBounds:t!=="rectangle",miterBounds:function(n,i,s,o,a,l){return j3(this.points,n,i,s,o,a)}}};mi.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,r,n,i,s,o){this.renderer.nodeShapeImpl(this.name,e,r,n,i,s)},intersectLine:function(e,r,n,i,s,o,a,l){return q3(s,o,e,r,n/2+a,i/2+a)},checkPoint:function(e,r,n,i,s,o,a,l){return Ma(e,r,i,s,o,a,n)}}};mi.generateRoundPolygon=function(t,e){return this.nodeShapes[t]={renderer:this,name:t,points:e,getOrCreateCorners:function(n,i,s,o,a,l,u){if(l[u]!==void 0&&l[u+"-cx"]===n&&l[u+"-cy"]===i)return l[u];l[u]=new Array(e.length/2),l[u+"-cx"]=n,l[u+"-cy"]=i;var c=s/2,h=o/2;a=a==="auto"?Nw(s,o):a;for(var g=new Array(e.length/2),p=0;p<e.length/2;p++)g[p]={x:n+c*e[p*2],y:i+h*e[p*2+1]};var x,w,v,m,y=g.length;for(w=g[y-1],x=0;x<y;x++)v=g[x%y],m=g[(x+1)%y],l[u][x]=hg(w,v,m,a),w=v,v=m;return l[u]},draw:function(n,i,s,o,a,l,u){this.renderer.nodeShapeImpl("round-polygon",n,i,s,o,a,this.points,this.getOrCreateCorners(i,s,o,a,l,u,"drawCorners"))},intersectLine:function(n,i,s,o,a,l,u,c,h){return X3(a,l,this.points,n,i,s,o,u,this.getOrCreateCorners(n,i,s,o,c,h,"corners"))},checkPoint:function(n,i,s,o,a,l,u,c,h){return G3(n,i,this.points,l,u,o,a,this.getOrCreateCorners(l,u,o,a,c,h,"corners"))}}};mi.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:qr(4,0),draw:function(e,r,n,i,s,o){this.renderer.nodeShapeImpl(this.name,e,r,n,i,s,this.points,o)},intersectLine:function(e,r,n,i,s,o,a,l){return Rw(s,o,e,r,n,i,a,l)},checkPoint:function(e,r,n,i,s,o,a,l){var u=i/2,c=s/2;l=l==="auto"?Ji(i,s):l,l=Math.min(u,c,l);var h=l*2;return!!(gi(e,r,this.points,o,a,i,s-h,[0,-1],n)||gi(e,r,this.points,o,a,i-h,s,[0,-1],n)||Ma(e,r,h,h,o-u+l,a-c+l,n)||Ma(e,r,h,h,o+u-l,a-c+l,n)||Ma(e,r,h,h,o+u-l,a+c-l,n)||Ma(e,r,h,h,o-u+l,a+c-l,n))}}};mi.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:eg(),points:qr(4,0),draw:function(e,r,n,i,s,o){this.renderer.nodeShapeImpl(this.name,e,r,n,i,s,null,o)},generateCutTrianglePts:function(e,r,n,i,s){var o=s==="auto"?this.cornerLength:s,a=r/2,l=e/2,u=n-l,c=n+l,h=i-a,g=i+a;return{topLeft:[u,h+o,u+o,h,u+o,h+o],topRight:[c-o,h,c,h+o,c-o,h+o],bottomRight:[c,g-o,c-o,g,c-o,g-o],bottomLeft:[u+o,g,u,g-o,u+o,g-o]}},intersectLine:function(e,r,n,i,s,o,a,l){var u=this.generateCutTrianglePts(n+2*a,i+2*a,e,r,l),c=[].concat.apply([],[u.topLeft.splice(0,4),u.topRight.splice(0,4),u.bottomRight.splice(0,4),u.bottomLeft.splice(0,4)]);return dl(s,o,c,e,r)},checkPoint:function(e,r,n,i,s,o,a,l){var u=l==="auto"?this.cornerLength:l;if(gi(e,r,this.points,o,a,i,s-2*u,[0,-1],n)||gi(e,r,this.points,o,a,i-2*u,s,[0,-1],n))return!0;var c=this.generateCutTrianglePts(i,s,o,a);return sn(e,r,c.topLeft)||sn(e,r,c.topRight)||sn(e,r,c.bottomRight)||sn(e,r,c.bottomLeft)}}};mi.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:qr(4,0),draw:function(e,r,n,i,s,o){this.renderer.nodeShapeImpl(this.name,e,r,n,i,s)},intersectLine:function(e,r,n,i,s,o,a,l){var u=.15,c=.5,h=.85,g=this.generateBarrelBezierPts(n+2*a,i+2*a,e,r),p=function(v){var m=Is({x:v[0],y:v[1]},{x:v[2],y:v[3]},{x:v[4],y:v[5]},u),y=Is({x:v[0],y:v[1]},{x:v[2],y:v[3]},{x:v[4],y:v[5]},c),b=Is({x:v[0],y:v[1]},{x:v[2],y:v[3]},{x:v[4],y:v[5]},h);return[v[0],v[1],m.x,m.y,y.x,y.y,b.x,b.y,v[4],v[5]]},x=[].concat(p(g.topLeft),p(g.topRight),p(g.bottomRight),p(g.bottomLeft));return dl(s,o,x,e,r)},generateBarrelBezierPts:function(e,r,n,i){var s=r/2,o=e/2,a=n-o,l=n+o,u=i-s,c=i+s,h=cv(e,r),g=h.heightOffset,p=h.widthOffset,x=h.ctrlPtOffsetPct*e,w={topLeft:[a,u+g,a+x,u,a+p,u],topRight:[l-p,u,l-x,u,l,u+g],bottomRight:[l,c-g,l-x,c,l-p,c],bottomLeft:[a+p,c,a+x,c,a,c-g]};return w.topLeft.isTop=!0,w.topRight.isTop=!0,w.bottomLeft.isBottom=!0,w.bottomRight.isBottom=!0,w},checkPoint:function(e,r,n,i,s,o,a,l){var u=cv(i,s),c=u.heightOffset,h=u.widthOffset;if(gi(e,r,this.points,o,a,i,s-2*c,[0,-1],n)||gi(e,r,this.points,o,a,i-2*h,s,[0,-1],n))return!0;for(var g=this.generateBarrelBezierPts(i,s,o,a),p=function(k,N,M){var B=M[4],A=M[2],j=M[0],D=M[5],I=M[1],U=Math.min(B,j),W=Math.max(B,j),H=Math.min(D,I),z=Math.max(D,I);if(U<=k&&k<=W&&H<=N&&N<=z){var P=K3(B,A,j),F=U3(P[0],P[1],P[2],k),G=F.filter(function($){return 0<=$&&$<=1});if(G.length>0)return G[0]}return null},x=Object.keys(g),w=0;w<x.length;w++){var v=x[w],m=g[v],y=p(e,r,m);if(y!=null){var b=m[5],_=m[3],R=m[1],E=Cr(b,_,R,y);if(m.isTop&&E<=r||m.isBottom&&r<=E)return!0}}return!1}}};mi.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:qr(4,0),draw:function(e,r,n,i,s,o){this.renderer.nodeShapeImpl(this.name,e,r,n,i,s,this.points,o)},intersectLine:function(e,r,n,i,s,o,a,l){var u=e-(n/2+a),c=r-(i/2+a),h=c,g=e+(n/2+a),p=Yi(s,o,e,r,u,c,g,h,!1);return p.length>0?p:Rw(s,o,e,r,n,i,a,l)},checkPoint:function(e,r,n,i,s,o,a,l){l=l==="auto"?Ji(i,s):l;var u=2*l;if(gi(e,r,this.points,o,a,i,s-u,[0,-1],n)||gi(e,r,this.points,o,a,i-u,s,[0,-1],n))return!0;var c=i/2+2*n,h=s/2+2*n,g=[o-c,a-h,o-c,a,o+c,a,o+c,a-h];return!!(sn(e,r,g)||Ma(e,r,u,u,o+i/2-l,a+s/2-l,n)||Ma(e,r,u,u,o-i/2+l,a+s/2-l,n))}}};mi.registerNodeShapes=function(){var t=this.nodeShapes={},e=this;this.generateEllipse(),this.generatePolygon("triangle",qr(3,0)),this.generateRoundPolygon("round-triangle",qr(3,0)),this.generatePolygon("rectangle",qr(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",qr(5,0)),this.generateRoundPolygon("round-pentagon",qr(5,0)),this.generatePolygon("hexagon",qr(6,0)),this.generateRoundPolygon("round-hexagon",qr(6,0)),this.generatePolygon("heptagon",qr(7,0)),this.generateRoundPolygon("round-heptagon",qr(7,0)),this.generatePolygon("octagon",qr(8,0)),this.generateRoundPolygon("round-octagon",qr(8,0));var n=new Array(20);{var i=uv(5,0),s=uv(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var a=0;a<s.length/2;a++)s[a*2]*=o,s[a*2+1]*=o;for(var a=0;a<20/4;a++)n[a*4]=i[a*2],n[a*4+1]=i[a*2+1],n[a*4+2]=s[a*2],n[a*4+3]=s[a*2+1]}n=Lw(n),this.generatePolygon("star",n),this.generatePolygon("vee",[-1,-1,0,-.333,1,-1,0,1]),this.generatePolygon("rhomboid",[-1,-1,.333,-1,1,1,-.333,1]),this.generatePolygon("right-rhomboid",[-.333,-1,1,-1,.333,1,-1,1]),this.nodeShapes.concavehexagon=this.generatePolygon("concave-hexagon",[-1,-.95,-.75,0,-1,.95,1,.95,.75,0,1,-.95]);{var l=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",l),this.generateRoundPolygon("round-tag",l)}t.makePolygon=function(u){var c=u.join("$"),h="polygon-"+c,g;return(g=this[h])?g:e.generatePolygon(h,u)}};var Dl={};Dl.timeToRender=function(){return this.redrawTotalTime/this.redrawCount};Dl.redraw=function(t){t=t||Cw();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};Dl.beforeRender=function(t,e){if(!this.destroyed){e==null&&Jt("Priority is not optional for beforeRender");var r=this.beforeRenderCallbacks;r.push({fn:t,priority:e}),r.sort(function(n,i){return i.priority-n.priority})}};var R1=function(e,r,n){for(var i=e.beforeRenderCallbacks,s=0;s<i.length;s++)i[s].fn(r,n)};Dl.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){R1(t,!0,i);var s=vi();t.render(t.renderOptions);var o=t.lastDrawTime=vi();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 a=o-s;t.redrawTotalTime+=a,t.lastRedrawTime=a,t.averageRedrawTime=t.averageRedrawTime/2+a/2,t.requestedFrame=!1}else R1(t,!1,i);t.skipFrame=!1,kc(r)}};kc(r)}};var vN=function(e){this.init(e)},D_=vN,Qs=D_.prototype;Qs.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"];Qs.init=function(t){var e=this;e.options=t,e.cy=t.cy;var r=e.container=t.cy.container(),n=e.cy.window();if(n){var i=n.document,s=i.head,o="__________cytoscape_stylesheet",a="__________cytoscape_container",l=i.getElementById(o)!=null;if(r.className.indexOf(a)<0&&(r.className=(r.className||"")+" "+a),!l){var u=i.createElement("style");u.id=o,u.textContent="."+a+" { position: relative; }",s.insertBefore(u,s.children[0])}var c=n.getComputedStyle(r),h=c.getPropertyValue("position");h==="static"&&Bt("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=Xe(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()};Qs.notify=function(t,e){var r=this,n=r.cy;if(!this.destroyed){if(t==="init"){r.load();return}if(t==="destroy"){r.destroy();return}(t==="add"||t==="remove"||t==="move"&&n.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()}};Qs.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],n=r,i=n.target;(i.off||i.removeEventListener).apply(i,n.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{}};Qs.isHeadless=function(){return!1};[cg,R_,L_,Ks,mi,Dl].forEach(function(t){dt(Qs,t)});var Rp=1e3/60,A_={setupDequeueing:function(e){return function(){var n=this,i=this.renderer;if(!n.dequeueingSetup){n.dequeueingSetup=!0;var s=kl(function(){i.redrawHint("eles",!0),i.redrawHint("drag",!0),i.redraw()},e.deqRedrawThreshold),o=function(u,c){var h=vi(),g=i.averageRedrawTime,p=i.lastRedrawTime,x=[],w=i.cy.extent(),v=i.getPixelRatio();for(u||i.flushRenderedStyleQueue();;){var m=vi(),y=m-h,b=m-c;if(p<Rp){var _=Rp-(u?g:0);if(b>=e.deqFastCost*_)break}else if(u){if(y>=e.deqCost*p||y>=e.deqAvgCost*g)break}else if(b>=e.deqNoDrawCost*Rp)break;var R=e.deq(n,v,w);if(R.length>0)for(var E=0;E<R.length;E++)x.push(R[E]);else break}x.length>0&&(e.onDeqd(n,x),!u&&e.shouldRedraw(n,x,v,w)&&s())},a=e.priority||Xv;i.beforeRender(o,a(n))}}}},gN=(function(){function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Tc;ia(this,t),this.idsByKey=new pi,this.keyForId=new pi,this.cachesByLvl=new pi,this.lvls=[],this.getKey=e,this.doesEleInvalidateKey=r}return aa(t,[{key:"getIdsFor",value:function(r){r==null&&Jt("Can not get id list for null key");var n=this.idsByKey,i=this.idsByKey.get(r);return i||(i=new Gs,n.set(r,i)),i}},{key:"addIdForKey",value:function(r,n){r!=null&&this.getIdsFor(r).add(n)}},{key:"deleteIdForKey",value:function(r,n){r!=null&&this.getIdsFor(r).delete(n)}},{key:"getNumberOfIdsForKey",value:function(r){return r==null?0:this.getIdsFor(r).size}},{key:"updateKeyMappingFor",value:function(r){var n=r.id(),i=this.keyForId.get(n),s=this.getKey(r);this.deleteIdForKey(i,n),this.addIdForKey(s,n),this.keyForId.set(n,s)}},{key:"deleteKeyMappingFor",value:function(r){var n=r.id(),i=this.keyForId.get(n);this.deleteIdForKey(i,n),this.keyForId.delete(n)}},{key:"keyHasChangedFor",value:function(r){var n=r.id(),i=this.keyForId.get(n),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 n=this.cachesByLvl,i=this.lvls,s=n.get(r);return s||(s=new pi,n.set(r,s),i.push(r)),s}},{key:"getCache",value:function(r,n){return this.getCachesAt(n).get(r)}},{key:"get",value:function(r,n){var i=this.getKey(r),s=this.getCache(i,n);return s!=null&&this.updateKeyMappingFor(r),s}},{key:"getForCachedKey",value:function(r,n){var i=this.keyForId.get(r.id()),s=this.getCache(i,n);return s}},{key:"hasCache",value:function(r,n){return this.getCachesAt(n).has(r)}},{key:"has",value:function(r,n){var i=this.getKey(r);return this.hasCache(i,n)}},{key:"setCache",value:function(r,n,i){i.key=r,this.getCachesAt(n).set(r,i)}},{key:"set",value:function(r,n,i){var s=this.getKey(r);this.setCache(s,n,i),this.updateKeyMappingFor(r)}},{key:"deleteCache",value:function(r,n){this.getCachesAt(n).delete(r)}},{key:"delete",value:function(r,n){var i=this.getKey(r);this.deleteCache(i,n)}},{key:"invalidateKey",value:function(r){var n=this;this.lvls.forEach(function(i){return n.deleteCache(r,i)})}},{key:"invalidate",value:function(r){var n=r.id(),i=this.keyForId.get(n);this.deleteKeyMappingFor(r);var s=this.doesEleInvalidateKey(r);return s&&this.invalidateKey(i),s||this.getNumberOfIdsForKey(i)===0}}])})(),L1=25,ec=50,mc=-4,Sv=3,M_=7.99,mN=8,yN=1024,xN=1024,bN=1024,wN=.2,_N=.8,SN=10,CN=.15,EN=.1,kN=.9,TN=.9,RN=100,LN=1,Ps={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},NN=Ar({getKey:null,doesEleInvalidateKey:Tc,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:ww,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),el=function(e,r){var n=this;n.renderer=e,n.onDequeues=[];var i=NN(r);dt(n,i),n.lookup=new gN(i.getKey,i.doesEleInvalidateKey),n.setupDequeueing()},br=el.prototype;br.reasons=Ps;br.getTextureQueue=function(t){var e=this;return e.eleImgCaches=e.eleImgCaches||{},e.eleImgCaches[t]=e.eleImgCaches[t]||[]};br.getRetiredTextureQueue=function(t){var e=this,r=e.eleImgCaches.retired=e.eleImgCaches.retired||{},n=r[t]=r[t]||[];return n};br.getElementQueue=function(){var t=this,e=t.eleCacheQueue=t.eleCacheQueue||new Tl(function(r,n){return n.reqs-r.reqs});return e};br.getElementKeyToQueue=function(){var t=this,e=t.eleKeyToCacheQueue=t.eleKeyToCacheQueue||{};return e};br.getElement=function(t,e,r,n,i){var s=this,o=this.renderer,a=o.cy.zoom(),l=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(n==null&&(n=Math.ceil(Qv(a*r))),n<mc)n=mc;else if(a>=M_||n>Sv)return null;var u=Math.pow(2,n),c=e.h*u,h=e.w*u,g=o.eleTextBiggerThanMin(t,u);if(!this.isVisible(t,g))return null;var p=l.get(t,n);if(p&&p.invalidated&&(p.invalidated=!1,p.texture.invalidatedWidth-=p.width),p)return p;var x;if(c<=L1?x=L1:c<=ec?x=ec:x=Math.ceil(c/ec)*ec,c>bN||h>xN)return null;var w=s.getTextureQueue(x),v=w[w.length-2],m=function(){return s.recycleTexture(x,h)||s.addTexture(x,h)};v||(v=w[w.length-1]),v||(v=m()),v.width-v.usedWidth<h&&(v=m());for(var y=function(U){return U&&U.scaledLabelShown===g},b=i&&i===Ps.dequeue,_=i&&i===Ps.highQuality,R=i&&i===Ps.downscale,E,T=n+1;T<=Sv;T++){var k=l.get(t,T);if(k){E=k;break}}var N=E&&E.level===n+1?E:null,M=function(){v.context.drawImage(N.texture.canvas,N.x,0,N.width,N.height,v.usedWidth,0,h,c)};if(v.context.setTransform(1,0,0,1,0,0),v.context.clearRect(v.usedWidth,0,h,x),y(N))M();else if(y(E))if(_){for(var B=E.level;B>n;B--)N=s.getElement(t,e,r,B,Ps.downscale);M()}else return s.queueElement(t,E.level-1),E;else{var A;if(!b&&!_&&!R)for(var j=n-1;j>=mc;j--){var D=l.get(t,j);if(D){A=D;break}}if(y(A))return s.queueElement(t,n),A;v.context.translate(v.usedWidth,0),v.context.scale(u,u),this.drawElement(v.context,t,e,g,!1),v.context.scale(1/u,1/u),v.context.translate(-v.usedWidth,0)}return p={x:v.usedWidth,texture:v,level:n,scale:u,width:h,height:c,scaledLabelShown:g},v.usedWidth+=Math.ceil(h+mN),v.eleCaches.push(p),l.set(t,n,p),s.checkTextureFullness(v),p};br.invalidateElements=function(t){for(var e=0;e<t.length;e++)this.invalidateElement(t[e])};br.invalidateElement=function(t){var e=this,r=e.lookup,n=[],i=r.isInvalid(t);if(i){for(var s=mc;s<=Sv;s++){var o=r.getForCachedKey(t,s);o&&n.push(o)}var a=r.invalidate(t);if(a)for(var l=0;l<n.length;l++){var u=n[l],c=u.texture;c.invalidatedWidth+=u.width,u.invalidated=!0,e.checkTextureUtility(c)}e.removeFromQueue(t)}};br.checkTextureUtility=function(t){t.invalidatedWidth>=wN*t.width&&this.retireTexture(t)};br.checkTextureFullness=function(t){var e=this,r=e.getTextureQueue(t.height);t.usedWidth/t.width>_N&&t.fullnessChecks>=SN?Zi(r,t):t.fullnessChecks++};br.retireTexture=function(t){var e=this,r=t.height,n=e.getTextureQueue(r),i=this.lookup;Zi(n,t),t.retired=!0;for(var s=t.eleCaches,o=0;o<s.length;o++){var a=s[o];i.deleteCache(a.key,a.level)}Kv(s);var l=e.getRetiredTextureQueue(r);l.push(t)};br.addTexture=function(t,e){var r=this,n=r.getTextureQueue(t),i={};return n.push(i),i.eleCaches=[],i.height=t,i.width=Math.max(yN,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};br.recycleTexture=function(t,e){for(var r=this,n=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,Kv(o.eleCaches),o.context.setTransform(1,0,0,1,0,0),o.context.clearRect(0,0,o.width,o.height),Zi(i,o),n.push(o),o}};br.queueElement=function(t,e){var r=this,n=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++,n.updateItem(o);else{var a={eles:t.spawn().merge(t),level:e,reqs:1,key:s};n.push(a),i[s]=a}};br.dequeue=function(t){for(var e=this,r=e.getElementQueue(),n=e.getElementKeyToQueue(),i=[],s=e.lookup,o=0;o<LN&&r.size()>0;o++){var a=r.pop(),l=a.key,u=a.eles[0],c=s.hasCache(u,a.level);if(n[l]=null,c)continue;i.push(a);var h=e.getBoundingBox(u);e.getElement(u,h,t,a.level,Ps.dequeue)}return i};br.removeFromQueue=function(t){var e=this,r=e.getElementQueue(),n=e.getElementKeyToQueue(),i=this.getKey(t),s=n[i];s!=null&&(s.eles.length===1?(s.reqs=Yv,r.updateItem(s),r.pop(),n[i]=null):s.eles.unmerge(t))};br.onDequeue=function(t){this.onDequeues.push(t)};br.offDequeue=function(t){Zi(this.onDequeues,t)};br.setupDequeueing=A_.setupDequeueing({deqRedrawThreshold:RN,deqCost:CN,deqAvgCost:EN,deqNoDrawCost:kN,deqFastCost:TN,deq:function(e,r,n){return e.dequeue(r,n)},onDeqd:function(e,r){for(var n=0;n<e.onDequeues.length;n++){var i=e.onDequeues[n];i(r)}},shouldRedraw:function(e,r,n,i){for(var s=0;s<r.length;s++)for(var o=r[s].eles,a=0;a<o.length;a++){var l=o[a].boundingBox();if(Jv(l,i))return!0}return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var DN=1,nl=-4,Ic=2,AN=3.99,MN=50,PN=50,IN=.15,ON=.1,BN=.9,FN=.9,jN=1,N1=250,zN=4e3*4e3,D1=32767,HN=!0,P_=function(e){var r=this,n=r.renderer=e,i=n.cy;r.layersByLevel={},r.firstGet=!0,r.lastInvalidationTime=vi()-2*N1,r.skipping=!1,r.eleTxrDeqs=i.collection(),r.scheduleElementRefinement=kl(function(){r.refineElementTextures(r.eleTxrDeqs),r.eleTxrDeqs.unmerge(r.eleTxrDeqs)},PN),n.beforeRender(function(o,a){a-r.lastInvalidationTime<=N1?r.skipping=!0:r.skipping=!1},n.beforeRenderPriorities.lyrTxrSkip);var s=function(a,l){return l.reqs-a.reqs};r.layersQueue=new Tl(s),r.setupDequeueing()},Mr=P_.prototype,A1=0,UN=Math.pow(2,53)-1;Mr.makeLayer=function(t,e){var r=Math.pow(2,e),n=Math.ceil(t.w*r),i=Math.ceil(t.h*r),s=this.renderer.makeOffscreenCanvas(n,i),o={id:A1=++A1%UN,bb:t,level:e,width:n,height:i,canvas:s,context:s.getContext("2d"),eles:[],elesQueue:[],reqs:0},a=o.context,l=-o.bb.x1,u=-o.bb.y1;return a.scale(r,r),a.translate(l,u),o};Mr.getLayers=function(t,e,r){var n=this,i=n.renderer,s=i.cy,o=s.zoom(),a=n.firstGet;if(n.firstGet=!1,r==null){if(r=Math.ceil(Qv(o*e)),r<nl)r=nl;else if(o>=AN||r>Ic)return null}n.validateLayersElesOrdering(r,t);var l=n.layersByLevel,u=Math.pow(2,r),c=l[r]=l[r]||[],h,g=n.levelIsComplete(r,t),p,x=function(){var M=function(I){if(n.validateLayersElesOrdering(I,t),n.levelIsComplete(I,t))return p=l[I],!0},B=function(I){if(!p)for(var U=r+I;nl<=U&&U<=Ic&&!M(U);U+=I);};B(1),B(-1);for(var A=c.length-1;A>=0;A--){var j=c[A];j.invalid&&Zi(c,j)}};if(!g)x();else return c;var w=function(){if(!h){h=Kr();for(var M=0;M<t.length;M++)O3(h,t[M].boundingBox())}return h},v=function(M){M=M||{};var B=M.after;w();var A=Math.ceil(h.w*u),j=Math.ceil(h.h*u);if(A>D1||j>D1)return null;var D=A*j;if(D>zN)return null;var I=n.makeLayer(h,r);if(B!=null){var U=c.indexOf(B)+1;c.splice(U,0,I)}else(M.insert===void 0||M.insert)&&c.unshift(I);return I};if(n.skipping&&!a)return null;for(var m=null,y=t.length/DN,b=!a,_=0;_<t.length;_++){var R=t[_],E=R._private.rscratch,T=E.imgLayerCaches=E.imgLayerCaches||{},k=T[r];if(k){m=k;continue}if((!m||m.eles.length>=y||!Tw(m.bb,R.boundingBox()))&&(m=v({insert:!0,after:m}),!m))return null;p||b?n.queueLayer(m,R):n.drawEleInLayer(m,R,r,e),m.eles.push(R),T[r]=m}return p||(b?null:c)};Mr.getEleLevelForLayerLevel=function(t,e){return t};Mr.drawEleInLayer=function(t,e,r,n){var i=this,s=this.renderer,o=t.context,a=e.boundingBox();a.w===0||a.h===0||!e.visible()||(r=i.getEleLevelForLayerLevel(r,n),s.setImgSmoothing(o,!1),s.drawCachedElement(o,e,null,null,r,HN),s.setImgSmoothing(o,!0))};Mr.levelIsComplete=function(t,e){var r=this,n=r.layersByLevel[t];if(!n||n.length===0)return!1;for(var i=0,s=0;s<n.length;s++){var o=n[s];if(o.reqs>0||o.invalid)return!1;i+=o.eles.length}return i===e.length};Mr.validateLayersElesOrdering=function(t,e){var r=this.layersByLevel[t];if(r)for(var n=0;n<r.length;n++){for(var i=r[n],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 a=s,o=0;o<i.eles.length;o++)if(i.eles[o]!==e[a+o]){this.invalidateLayer(i);break}}};Mr.updateElementsInLayers=function(t,e){for(var r=this,n=_l(t[0]),i=0;i<t.length;i++)for(var s=n?null:t[i],o=n?t[i]:t[i].ele,a=o._private.rscratch,l=a.imgLayerCaches=a.imgLayerCaches||{},u=nl;u<=Ic;u++){var c=l[u];c&&(s&&r.getEleLevelForLayerLevel(c.level)!==s.level||e(c,o,s))}};Mr.haveLayers=function(){for(var t=this,e=!1,r=nl;r<=Ic;r++){var n=t.layersByLevel[r];if(n&&n.length>0){e=!0;break}}return e};Mr.invalidateElements=function(t){var e=this;t.length!==0&&(e.lastInvalidationTime=vi(),!(t.length===0||!e.haveLayers())&&e.updateElementsInLayers(t,function(n,i,s){e.invalidateLayer(n)}))};Mr.invalidateLayer=function(t){if(this.lastInvalidationTime=vi(),!t.invalid){var e=t.level,r=t.eles,n=this.layersByLevel[e];Zi(n,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)}}};Mr.refineElementTextures=function(t){var e=this;e.updateElementsInLayers(t,function(n,i,s){var o=n.replacement;if(o||(o=n.replacement=e.makeLayer(n.bb,n.level),o.replaces=n,o.eles=n.eles),!o.reqs)for(var a=0;a<o.eles.length;a++)e.queueLayer(o,o.eles[a])})};Mr.enqueueElementRefinement=function(t){this.eleTxrDeqs.merge(t),this.scheduleElementRefinement()};Mr.queueLayer=function(t,e){var r=this,n=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++,n.updateItem(t)):(t.reqs=1,n.push(t))}};Mr.dequeue=function(t){for(var e=this,r=e.layersQueue,n=[],i=0;i<jN&&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++),n.length===0&&n.push(!0),s.elesQueue.length===0&&(r.pop(),s.reqs=0,s.replaces&&e.applyLayerReplacement(s),e.requestRedraw())}return n};Mr.applyLayerReplacement=function(t){var e=this,r=e.layersByLevel[t.level],n=t.replaces,i=r.indexOf(n);if(!(i<0||n.invalid)){r[i]=t;for(var s=0;s<t.eles.length;s++){var o=t.eles[s]._private,a=o.imgLayerCaches=o.imgLayerCaches||{};a&&(a[t.level]=t)}e.requestRedraw()}};Mr.requestRedraw=kl(function(){var t=this.renderer;t.redrawHint("eles",!0),t.redrawHint("drag",!0),t.redraw()},100);Mr.setupDequeueing=A_.setupDequeueing({deqRedrawThreshold:MN,deqCost:IN,deqAvgCost:ON,deqNoDrawCost:BN,deqFastCost:FN,deq:function(e,r){return e.dequeue(r)},onDeqd:Xv,shouldRedraw:ww,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var I_={},M1;function WN(t,e){for(var r=0;r<e.length;r++){var n=e[r];t.lineTo(n.x,n.y)}}function VN(t,e,r){for(var n,i=0;i<e.length;i++){var s=e[i];i===0&&(n=s),t.lineTo(s.x,s.y)}t.quadraticCurveTo(r.x,r.y,n.x,n.y)}function P1(t,e,r){t.beginPath&&t.beginPath();for(var n=e,i=0;i<n.length;i++){var s=n[i];t.lineTo(s.x,s.y)}var o=r,a=r[0];t.moveTo(a.x,a.y);for(var i=1;i<o.length;i++){var s=o[i];t.lineTo(s.x,s.y)}t.closePath&&t.closePath()}function $N(t,e,r,n,i){t.beginPath&&t.beginPath(),t.arc(r,n,i,0,Math.PI*2,!1);var s=e,o=s[0];t.moveTo(o.x,o.y);for(var a=0;a<s.length;a++){var l=s[a];t.lineTo(l.x,l.y)}t.closePath&&t.closePath()}function GN(t,e,r,n){t.arc(e,r,n,0,Math.PI*2,!1)}I_.arrowShapeImpl=function(t){return(M1||(M1={polygon:WN,"triangle-backcurve":VN,"triangle-tee":P1,"circle-triangle":$N,"triangle-cross":P1,circle:GN}))[t]};var ri={};ri.drawElement=function(t,e,r,n,i,s){var o=this;e.isNode()?o.drawNode(t,e,r,n,i,s):o.drawEdge(t,e,r,n,i,s)};ri.drawElementOverlay=function(t,e){var r=this;e.isNode()?r.drawNodeOverlay(t,e):r.drawEdgeOverlay(t,e)};ri.drawElementUnderlay=function(t,e){var r=this;e.isNode()?r.drawNodeUnderlay(t,e):r.drawEdgeUnderlay(t,e)};ri.drawCachedElementPortion=function(t,e,r,n,i,s,o,a){var l=this,u=r.getBoundingBox(e);if(!(u.w===0||u.h===0)){var c=r.getElement(e,u,n,i,s);if(c!=null){var h=a(l,e);if(h===0)return;var g=o(l,e),p=u.x1,x=u.y1,w=u.w,v=u.h,m,y,b,_,R;if(g!==0){var E=r.getRotationPoint(e);b=E.x,_=E.y,t.translate(b,_),t.rotate(g),R=l.getImgSmoothing(t),R||l.setImgSmoothing(t,!0);var T=r.getRotationOffset(e);m=T.x,y=T.y}else m=p,y=x;var k;h!==1&&(k=t.globalAlpha,t.globalAlpha=k*h),t.drawImage(c.texture.canvas,c.x,0,c.width,c.height,m,y,w,v),h!==1&&(t.globalAlpha=k),g!==0&&(t.rotate(-g),t.translate(-b,-_),R||l.setImgSmoothing(t,!1))}else r.drawElement(t,e)}};var qN=function(){return 0},YN=function(e,r){return e.getTextAngle(r,null)},XN=function(e,r){return e.getTextAngle(r,"source")},KN=function(e,r){return e.getTextAngle(r,"target")},QN=function(e,r){return r.effectiveOpacity()},Lp=function(e,r){return r.pstyle("text-opacity").pfValue*r.effectiveOpacity()};ri.drawCachedElement=function(t,e,r,n,i,s){var o=this,a=o.data,l=a.eleTxrCache,u=a.lblTxrCache,c=a.slbTxrCache,h=a.tlbTxrCache,g=e.boundingBox(),p=s===!0?l.reasons.highQuality:null;if(!(g.w===0||g.h===0||!e.visible())&&(!n||Jv(g,n))){var x=e.isEdge(),w=e.element()._private.rscratch.badLine;o.drawElementUnderlay(t,e),o.drawCachedElementPortion(t,e,l,r,i,p,qN,QN),(!x||!w)&&o.drawCachedElementPortion(t,e,u,r,i,p,YN,Lp),x&&!w&&(o.drawCachedElementPortion(t,e,c,r,i,p,XN,Lp),o.drawCachedElementPortion(t,e,h,r,i,p,KN,Lp)),o.drawElementOverlay(t,e)}};ri.drawElements=function(t,e){for(var r=this,n=0;n<e.length;n++){var i=e[n];r.drawElement(t,i)}};ri.drawCachedElements=function(t,e,r,n){for(var i=this,s=0;s<e.length;s++){var o=e[s];i.drawCachedElement(t,o,r,n)}};ri.drawCachedNodes=function(t,e,r,n){for(var i=this,s=0;s<e.length;s++){var o=e[s];o.isNode()&&i.drawCachedElement(t,o,r,n)}};ri.drawLayeredElements=function(t,e,r,n){var i=this,s=i.data.lyrTxrCache.getLayers(e,r);if(s)for(var o=0;o<s.length;o++){var a=s[o],l=a.bb;l.w===0||l.h===0||t.drawImage(a.canvas,l.x1,l.y1,l.w,l.h)}else i.drawCachedElements(t,e,r,n)};var yi={};yi.drawEdge=function(t,e,r){var n=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,a=e._private.rscratch;if(!(s&&!e.visible())&&!(a.badLine||a.allpts==null||isNaN(a.allpts[0]))){var l;r&&(l=r,t.translate(-l.x1,-l.y1));var u=s?e.pstyle("opacity").value:1,c=s?e.pstyle("line-opacity").value:1,h=e.pstyle("curve-style").value,g=e.pstyle("line-style").value,p=e.pstyle("width").pfValue,x=e.pstyle("line-cap").value,w=e.pstyle("line-outline-width").value,v=e.pstyle("line-outline-color").value,m=u*c,y=u*c,b=function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:m;h==="straight-triangle"?(o.eleStrokeStyle(t,e,I),o.drawEdgeTrianglePath(e,t,a.allpts)):(t.lineWidth=p,t.lineCap=x,o.eleStrokeStyle(t,e,I),o.drawEdgePath(e,t,a.allpts,g),t.lineCap="butt")},_=function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:m;if(t.lineWidth=p+w,t.lineCap=x,w>0)o.colorStrokeStyle(t,v[0],v[1],v[2],I);else{t.lineCap="butt";return}h==="straight-triangle"?o.drawEdgeTrianglePath(e,t,a.allpts):(o.drawEdgePath(e,t,a.allpts,g),t.lineCap="butt")},R=function(){i&&o.drawEdgeOverlay(t,e)},E=function(){i&&o.drawEdgeUnderlay(t,e)},T=function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:y;o.drawArrowheads(t,e,I)},k=function(){o.drawElementText(t,e,null,n)};t.lineJoin="round";var N=e.pstyle("ghost").value==="yes";if(N){var M=e.pstyle("ghost-offset-x").pfValue,B=e.pstyle("ghost-offset-y").pfValue,A=e.pstyle("ghost-opacity").value,j=m*A;t.translate(M,B),b(j),T(j),t.translate(-M,-B)}else _();E(),b(),T(),R(),k(),r&&t.translate(l.x1,l.y1)}};var O_=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(r,n){if(n.visible()){var i=n.pstyle("".concat(e,"-opacity")).value;if(i!==0){var s=this,o=s.usePaths(),a=n._private.rscratch,l=n.pstyle("".concat(e,"-padding")).pfValue,u=2*l,c=n.pstyle("".concat(e,"-color")).value;r.lineWidth=u,a.edgeType==="self"&&!o?r.lineCap="butt":r.lineCap="round",s.colorStrokeStyle(r,c[0],c[1],c[2],i),s.drawEdgePath(n,r,a.allpts,"solid")}}}};yi.drawEdgeOverlay=O_("overlay");yi.drawEdgeUnderlay=O_("underlay");yi.drawEdgePath=function(t,e,r,n){var i=t._private.rscratch,s=e,o,a=!1,l=this.usePaths(),u=t.pstyle("line-dash-pattern").pfValue,c=t.pstyle("line-dash-offset").pfValue;if(l){var h=r.join("$"),g=i.pathCacheKey&&i.pathCacheKey===h;g?(o=e=i.pathCache,a=!0):(o=e=new Path2D,i.pathCacheKey=h,i.pathCache=o)}if(s.setLineDash)switch(n){case"dotted":s.setLineDash([1,1]);break;case"dashed":s.setLineDash(u),s.lineDashOffset=c;break;case"solid":s.setLineDash([]);break}if(!a&&!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 p=2;p+3<r.length;p+=4)e.quadraticCurveTo(r[p],r[p+1],r[p+2],r[p+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 w=on(i.roundCorners),v;try{for(w.s();!(v=w.n()).done;){var m=v.value;S_(e,m)}}catch(b){w.e(b)}finally{w.f()}e.lineTo(r[r.length-2],r[r.length-1])}else for(var y=2;y+1<r.length;y+=2)e.lineTo(r[y],r[y+1]);break}e=s,l?e.stroke(o):e.stroke(),e.setLineDash&&e.setLineDash([])};yi.drawEdgeTrianglePath=function(t,e,r){e.fillStyle=e.strokeStyle;for(var n=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]),a=[s[1]/o,-s[0]/o],l=[a[0]*n/2,a[1]*n/2];e.beginPath(),e.moveTo(r[i]-l[0],r[i+1]-l[1]),e.lineTo(r[i]+l[0],r[i+1]+l[1]),e.lineTo(r[i+2],r[i+3]),e.closePath(),e.fill()}};yi.drawArrowheads=function(t,e,r){var n=e._private.rscratch,i=n.edgeType==="haystack";i||this.drawArrowhead(t,e,"source",n.arrowStartX,n.arrowStartY,n.srcArrowAngle,r),this.drawArrowhead(t,e,"mid-target",n.midX,n.midY,n.midtgtArrowAngle,r),this.drawArrowhead(t,e,"mid-source",n.midX,n.midY,n.midsrcArrowAngle,r),i||this.drawArrowhead(t,e,"target",n.arrowEndX,n.arrowEndY,n.tgtArrowAngle,r)};yi.drawArrowhead=function(t,e,r,n,i,s,o){if(!(isNaN(n)||n==null||isNaN(i)||i==null||isNaN(s)||s==null)){var a=this,l=e.pstyle(r+"-arrow-shape").value;if(l!=="none"){var u=e.pstyle(r+"-arrow-fill").value==="hollow"?"both":"filled",c=e.pstyle(r+"-arrow-fill").value,h=e.pstyle("width").pfValue,g=e.pstyle(r+"-arrow-width"),p=g.value==="match-line"?h:g.pfValue;g.units==="%"&&(p*=h);var x=e.pstyle("opacity").value;o===void 0&&(o=x);var w=t.globalCompositeOperation;(o!==1||c==="hollow")&&(t.globalCompositeOperation="destination-out",a.colorFillStyle(t,255,255,255,1),a.colorStrokeStyle(t,255,255,255,1),a.drawArrowShape(e,t,u,h,l,p,n,i,s),t.globalCompositeOperation=w);var v=e.pstyle(r+"-arrow-color").value;a.colorFillStyle(t,v[0],v[1],v[2],o),a.colorStrokeStyle(t,v[0],v[1],v[2],o),a.drawArrowShape(e,t,c,h,l,p,n,i,s)}}};yi.drawArrowShape=function(t,e,r,n,i,s,o,a,l){var u=this,c=this.usePaths()&&i!=="triangle-cross",h=!1,g,p=e,x={x:o,y:a},w=t.pstyle("arrow-scale").value,v=this.getArrowWidth(n,w),m=u.arrowShapes[i];if(c){var y=u.arrowPathCache=u.arrowPathCache||[],b=Oa(i),_=y[b];_!=null?(g=e=_,h=!0):(g=e=new Path2D,y[b]=g)}h||(e.beginPath&&e.beginPath(),c?m.draw(e,1,0,{x:0,y:0},1):m.draw(e,v,l,x,n),e.closePath&&e.closePath()),e=p,c&&(e.translate(o,a),e.rotate(l),e.scale(v,v)),(r==="filled"||r==="both")&&(c?e.fill(g):e.fill()),(r==="hollow"||r==="both")&&(e.lineWidth=s/(c?v:1),e.lineJoin="miter",c?e.stroke(g):e.stroke()),c&&(e.scale(1/v,1/v),e.rotate(-l),e.translate(-o,-a))};var dg={};dg.safeDrawImage=function(t,e,r,n,i,s,o,a,l,u){if(!(i<=0||s<=0||l<=0||u<=0))try{t.drawImage(e,r,n,i,s,o,a,l,u)}catch(c){Bt(c)}};dg.drawInscribedImage=function(t,e,r,n,i){var s=this,o=r.position(),a=o.x,l=o.y,u=r.cy().style(),c=u.getIndexedStyle.bind(u),h=c(r,"background-fit","value",n),g=c(r,"background-repeat","value",n),p=r.width(),x=r.height(),w=r.padding()*2,v=p+(c(r,"background-width-relative-to","value",n)==="inner"?0:w),m=x+(c(r,"background-height-relative-to","value",n)==="inner"?0:w),y=r._private.rscratch,b=c(r,"background-clip","value",n),_=b==="node",R=c(r,"background-image-opacity","value",n)*i,E=c(r,"background-image-smoothing","value",n),T=r.pstyle("corner-radius").value;T!=="auto"&&(T=r.pstyle("corner-radius").pfValue);var k=e.width||e.cachedW,N=e.height||e.cachedH;(k==null||N==null)&&(document.body.appendChild(e),k=e.cachedW=e.width||e.offsetWidth,N=e.cachedH=e.height||e.offsetHeight,document.body.removeChild(e));var M=k,B=N;if(c(r,"background-width","value",n)!=="auto"&&(c(r,"background-width","units",n)==="%"?M=c(r,"background-width","pfValue",n)*v:M=c(r,"background-width","pfValue",n)),c(r,"background-height","value",n)!=="auto"&&(c(r,"background-height","units",n)==="%"?B=c(r,"background-height","pfValue",n)*m:B=c(r,"background-height","pfValue",n)),!(M===0||B===0)){if(h==="contain"){var A=Math.min(v/M,m/B);M*=A,B*=A}else if(h==="cover"){var A=Math.max(v/M,m/B);M*=A,B*=A}var j=a-v/2,D=c(r,"background-position-x","units",n),I=c(r,"background-position-x","pfValue",n);D==="%"?j+=(v-M)*I:j+=I;var U=c(r,"background-offset-x","units",n),W=c(r,"background-offset-x","pfValue",n);U==="%"?j+=(v-M)*W:j+=W;var H=l-m/2,z=c(r,"background-position-y","units",n),P=c(r,"background-position-y","pfValue",n);z==="%"?H+=(m-B)*P:H+=P;var F=c(r,"background-offset-y","units",n),G=c(r,"background-offset-y","pfValue",n);F==="%"?H+=(m-B)*G:H+=G,y.pathCache&&(j-=a,H-=l,a=0,l=0);var $=t.globalAlpha;t.globalAlpha=R;var ee=s.getImgSmoothing(t),re=!1;if(E==="no"&&ee?(s.setImgSmoothing(t,!1),re=!0):E==="yes"&&!ee&&(s.setImgSmoothing(t,!0),re=!0),g==="no-repeat")_&&(t.save(),y.pathCache?t.clip(y.pathCache):(s.nodeShapes[s.getNodeShape(r)].draw(t,a,l,v,m,T,y),t.clip())),s.safeDrawImage(t,e,0,0,k,N,j,H,M,B),_&&t.restore();else{var ne=t.createPattern(e,g);t.fillStyle=ne,s.nodeShapes[s.getNodeShape(r)].draw(t,a,l,v,m,T,y),t.translate(j,H),t.fill(),t.translate(-j,-H)}t.globalAlpha=$,re&&s.setImgSmoothing(t,ee)}};var Wa={};Wa.eleTextBiggerThanMin=function(t,e){if(!e){var r=t.cy().zoom(),n=this.getPixelRatio(),i=Math.ceil(Qv(r*n));e=Math.pow(2,i)}var s=t.pstyle("font-size").pfValue*e,o=t.pstyle("min-zoomed-font-size").pfValue;return!(s<o)};Wa.drawElementText=function(t,e,r,n,i){var s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this;if(n==null){if(s&&!o.eleTextBiggerThanMin(e))return}else if(n===!1)return;if(e.isNode()){var a=e.pstyle("label");if(!a||!a.value)return;var l=o.getLabelJustification(e),u=e.pstyle("text-metrics").strValue==="glyph";t.textAlign=l,t.textBaseline=u?"alphabetic":"bottom"}else{var c=e.element()._private.rscratch.badLine,h=e.pstyle("label"),g=e.pstyle("source-label"),p=e.pstyle("target-label");if(c||(!h||!h.value)&&(!g||!g.value)&&(!p||!p.value))return;t.textAlign="center",t.textBaseline="bottom"}var x=!r,w;r&&(w=r,t.translate(-w.x1,-w.y1)),i==null?(o.drawText(t,e,null,x,s),e.isEdge()&&(o.drawText(t,e,"source",x,s),o.drawText(t,e,"target",x,s))):o.drawText(t,e,i,x,s),r&&t.translate(w.x1,w.y1)};Wa.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};Wa.setupTextStyle=function(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,n=e.pstyle("font-style").strValue,i=e.pstyle("font-size").pfValue+"px",s=e.pstyle("font-family").strValue,o=e.pstyle("font-weight").strValue,a=r?e.effectiveOpacity()*e.pstyle("text-opacity").value:1,l=e.pstyle("text-outline-opacity").value*a,u=e.pstyle("color").value,c=e.pstyle("text-outline-color").value;t.font=n+" "+o+" "+i+" "+s,t.lineJoin="round",this.colorFillStyle(t,u[0],u[1],u[2],a),this.colorStrokeStyle(t,c[0],c[1],c[2],l)};function ZN(t,e,r,n,i){var s=Math.min(n,i),o=s/2,a=e+n/2,l=r+i/2;t.beginPath(),t.arc(a,l,o,0,Math.PI*2),t.closePath()}function I1(t,e,r,n,i){var s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,o=Math.min(s,n/2,i/2);t.beginPath(),t.moveTo(e+o,r),t.lineTo(e+n-o,r),t.quadraticCurveTo(e+n,r,e+n,r+o),t.lineTo(e+n,r+i-o),t.quadraticCurveTo(e+n,r+i,e+n-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()}Wa.getTextAngle=function(t,e){var r,n=t._private,i=n.rscratch,s=e?e+"-":"",o=t.pstyle(s+"text-rotation");if(o.strValue==="autorotate"){var a=Yr(i,"labelAngle",e);r=t.isEdge()?a:0}else o.strValue==="none"?r=0:r=o.pfValue;return r};Wa.drawText=function(t,e,r){var n=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,a=i?e.effectiveOpacity():1;if(!(i&&(a===0||e.pstyle("text-opacity").value===0))){r==="main"&&(r=null);var l=Yr(o,"labelX",r),u=Yr(o,"labelY",r),c,h,g=this.getLabelText(e,r);if(g!=null&&g!==""&&!isNaN(l)&&!isNaN(u)){this.setupTextStyle(t,e,i);var p=r?r+"-":"",x=Yr(o,"labelWidth",r),w=Yr(o,"labelHeight",r),v=Yr(o,"labelActualDescent",r),m=e.pstyle(p+"text-margin-x").pfValue,y=e.pstyle(p+"text-margin-y").pfValue,b=e.isEdge(),_=e.pstyle("text-halign").value,R=e.pstyle("text-valign").value;b&&(_="center",R="center"),l+=m,u+=y;var E;n?E=this.getTextAngle(e,r):E=0,E!==0&&(c=l,h=u,t.translate(c,h),t.rotate(E),l=0,u=0);var T=Us(_),k=Ws(R);switch(k){case"top":break;case"center":u+=w/2;break;case"bottom":u+=w;break}var N=e.pstyle("text-background-opacity").value,M=e.pstyle("text-border-opacity").value,B=e.pstyle("text-border-width").pfValue,A=e.pstyle("text-background-padding").pfValue,j=e.pstyle("text-background-shape").strValue,D=j==="round-rectangle"||j==="roundrectangle",I=j==="circle",U=2;if(N>0||B>0&&M>0){var W=t.fillStyle,H=t.strokeStyle,z=t.lineWidth,P=e.pstyle("text-background-color").value,F=e.pstyle("text-border-color").value,G=e.pstyle("text-border-style").value,$=N>0,ee=B>0&&M>0,re=l-A;switch(T){case"left":re-=x;break;case"center":re-=x/2;break}var ne=u-w-A,Y=x+2*A,q=w+2*A;if($&&(t.fillStyle="rgba(".concat(P[0],",").concat(P[1],",").concat(P[2],",").concat(N*a,")")),ee&&(t.strokeStyle="rgba(".concat(F[0],",").concat(F[1],",").concat(F[2],",").concat(M*a,")"),t.lineWidth=B,t.setLineDash))switch(G){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"double":t.lineWidth=B/4,t.setLineDash([]);break;case"solid":default:t.setLineDash([]);break}if(D?(t.beginPath(),I1(t,re,ne,Y,q,U)):I?(t.beginPath(),ZN(t,re,ne,Y,q)):(t.beginPath(),t.rect(re,ne,Y,q)),$&&t.fill(),ee&&t.stroke(),ee&&G==="double"){var K=B/2;t.beginPath(),D?I1(t,re+K,ne+K,Y-2*K,q-2*K,U):t.rect(re+K,ne+K,Y-2*K,q-2*K),t.stroke()}t.fillStyle=W,t.strokeStyle=H,t.lineWidth=z,t.setLineDash&&t.setLineDash([])}var X=2*e.pstyle("text-outline-width").pfValue;if(X>0&&(t.lineWidth=X),u-=v,e.pstyle("text-wrap").value==="wrap"){var J=Yr(o,"labelWrapCachedLines",r),ie=Yr(o,"labelLineHeight",r),ce=x/2,de=this.getLabelJustification(e);switch(de==="auto"||(T==="left"?de==="left"?l+=-x:de==="center"&&(l+=-ce):T==="center"?de==="left"?l+=-ce:de==="right"&&(l+=ce):T==="right"&&(de==="center"?l+=ce:de==="right"&&(l+=x))),k){case"top":u-=(J.length-1)*ie;break;case"center":case"bottom":u-=(J.length-1)*ie;break}for(var Le=0;Le<J.length;Le++)X>0&&t.strokeText(J[Le],l,u),t.fillText(J[Le],l,u),u+=ie}else X>0&&t.strokeText(g,l,u),t.fillText(g,l,u);E!==0&&(t.rotate(-E),t.translate(-c,-h))}}};var oa={};oa.drawNode=function(t,e,r){var n=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,a,l,u=e._private,c=u.rscratch,h=e.position();if(!(!Xe(h.x)||!Xe(h.y))&&!(s&&!e.visible())){var g=s?e.effectiveOpacity():1,p=o.usePaths(),x,w=!1,v=e.padding();a=e.width()+2*v,l=e.height()+2*v;var m;r&&(m=r,t.translate(-m.x1,-m.y1));for(var y=e.pstyle("background-image"),b=y.value,_=new Array(b.length),R=new Array(b.length),E=0,T=0;T<b.length;T++){var k=b[T],N=_[T]=k!=null&&k!=="none";if(N){var M=e.cy().style().getIndexedStyle(e,"background-image-crossorigin","value",T);E++,R[T]=o.getCachedImage(k,M,function(){u.backgroundTimestamp=Date.now(),e.emitAndNotify("background")})}}var B=e.pstyle("background-blacken").value,A=e.pstyle("border-width").pfValue,j=e.pstyle("background-opacity").value*g,D=e.pstyle("border-color").value,I=e.pstyle("border-style").value,U=e.pstyle("border-join").value,W=e.pstyle("border-cap").value,H=e.pstyle("border-position").value,z=e.pstyle("border-dash-pattern").pfValue,P=e.pstyle("border-dash-offset").pfValue,F=e.pstyle("border-opacity").value*g,G=e.pstyle("outline-width").pfValue,$=e.pstyle("outline-color").value,ee=e.pstyle("outline-style").value,re=e.pstyle("outline-opacity").value*g,ne=e.pstyle("outline-offset").value,Y=e.pstyle("corner-radius").value;Y!=="auto"&&(Y=e.pstyle("corner-radius").pfValue);var q=function(){var Z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:j;o.eleFillStyle(t,e,Z)},K=function(){var Z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:F;o.colorStrokeStyle(t,D[0],D[1],D[2],Z)},X=function(){var Z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:re;o.colorStrokeStyle(t,$[0],$[1],$[2],Z)},J=function(Z,te,oe,ue){var se=o.nodePathCache=o.nodePathCache||[],he=bw(oe==="polygon"?oe+","+ue.join(","):oe,""+te,""+Z,""+Y),pe=se[he],be,Se=!1;return pe!=null?(be=pe,Se=!0,c.pathCache=be):(be=new Path2D,se[he]=c.pathCache=be),{path:be,cacheHit:Se}},ie=e.pstyle("shape").strValue,ce=e.pstyle("shape-polygon-points").pfValue;if(p){t.translate(h.x,h.y);var de=J(a,l,ie,ce);x=de.path,w=de.cacheHit}var Le=function(){if(!w){var Z=h;p&&(Z={x:0,y:0}),o.nodeShapes[o.getNodeShape(e)].draw(x||t,Z.x,Z.y,a,l,Y,c)}p?t.fill(x):t.fill()},je=function(){for(var Z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:g,te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,oe=u.backgrounding,ue=0,se=0;se<R.length;se++){var he=e.cy().style().getIndexedStyle(e,"background-image-containment","value",se);if(te&&he==="over"||!te&&he==="inside"){ue++;continue}_[se]&&R[se].complete&&!R[se].error&&(ue++,o.drawInscribedImage(t,R[se],e,se,Z))}u.backgrounding=ue!==E,oe!==u.backgrounding&&e.updateStyle(!1)},_e=function(){var Z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:g;o.hasPie(e)&&(o.drawPie(t,e,te),Z&&(p||o.nodeShapes[o.getNodeShape(e)].draw(t,h.x,h.y,a,l,Y,c)))},ke=function(){var Z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:g;o.hasStripe(e)&&(t.save(),p?t.clip(c.pathCache):(o.nodeShapes[o.getNodeShape(e)].draw(t,h.x,h.y,a,l,Y,c),t.clip()),o.drawStripe(t,e,te),t.restore(),Z&&(p||o.nodeShapes[o.getNodeShape(e)].draw(t,h.x,h.y,a,l,Y,c)))},Ne=function(){var Z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:g,te=(B>0?B:-B)*Z,oe=B>0?0:255;B!==0&&(o.colorFillStyle(t,oe,oe,oe,te),p?t.fill(x):t.fill())},Ee=function(){if(A>0){if(t.lineWidth=A,t.lineCap=W,t.lineJoin=U,t.setLineDash)switch(I){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash(z),t.lineDashOffset=P;break;case"solid":case"double":t.setLineDash([]);break}if(H!=="center"){if(t.save(),t.lineWidth*=2,H==="inside")p?t.clip(x):t.clip();else{var Z=new Path2D;Z.rect(-a/2-A,-l/2-A,a+2*A,l+2*A),Z.addPath(x),t.clip(Z,"evenodd")}p?t.stroke(x):t.stroke(),t.restore()}else p?t.stroke(x):t.stroke();if(I==="double"){t.lineWidth=A/3;var te=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",p?t.stroke(x):t.stroke(),t.globalCompositeOperation=te}t.setLineDash&&t.setLineDash([])}},Me=function(){if(G>0){if(t.lineWidth=G,t.lineCap="butt",t.setLineDash)switch(ee){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"solid":case"double":t.setLineDash([]);break}var Z=h;p&&(Z={x:0,y:0});var te=o.getNodeShape(e),oe=A;H==="inside"&&(oe=0),H==="outside"&&(oe*=2);var ue=(a+oe+(G+ne))/a,se=(l+oe+(G+ne))/l,he=a*ue,pe=l*se,be=o.nodeShapes[te].points,Se;if(p){var Te=J(he,pe,te,be);Se=Te.path}if(te==="ellipse")o.drawEllipsePath(Se||t,Z.x,Z.y,he,pe);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(te)){var Re=0,ze=0,Fe=0;te==="round-diamond"?Re=(oe+ne+G)*1.4:te==="round-heptagon"?(Re=(oe+ne+G)*1.075,Fe=-(oe/2+ne+G)/35):te==="round-hexagon"?Re=(oe+ne+G)*1.12:te==="round-pentagon"?(Re=(oe+ne+G)*1.13,Fe=-(oe/2+ne+G)/15):te==="round-tag"?(Re=(oe+ne+G)*1.12,ze=(oe/2+G+ne)*.07):te==="round-triangle"&&(Re=(oe+ne+G)*(Math.PI/2),Fe=-(oe+ne/2+G)/Math.PI),Re!==0&&(ue=(a+Re)/a,he=a*ue,["round-hexagon","round-tag"].includes(te)||(se=(l+Re)/l,pe=l*se)),Y=Y==="auto"?Nw(he,pe):Y;for(var Ge=he/2,it=pe/2,Ze=Y+(oe+G+ne)/2,qe=new Array(be.length/2),pt=new Array(be.length/2),Qe=0;Qe<be.length/2;Qe++)qe[Qe]={x:Z.x+ze+Ge*be[Qe*2],y:Z.y+Fe+it*be[Qe*2+1]};var Ke,xt,st,vt,yt=qe.length;for(xt=qe[yt-1],Ke=0;Ke<yt;Ke++)st=qe[Ke%yt],vt=qe[(Ke+1)%yt],pt[Ke]=hg(xt,st,vt,Ze),xt=st,st=vt;o.drawRoundPolygonPath(Se||t,Z.x+ze,Z.y+Fe,a*ue,l*se,be,pt)}else if(["roundrectangle","round-rectangle"].includes(te))Y=Y==="auto"?Ji(he,pe):Y,o.drawRoundRectanglePath(Se||t,Z.x,Z.y,he,pe,Y+(oe+G+ne)/2);else if(["cutrectangle","cut-rectangle"].includes(te))Y=Y==="auto"?eg():Y,o.drawCutRectanglePath(Se||t,Z.x,Z.y,he,pe,null,Y+(oe+G+ne)/4);else if(["bottomroundrectangle","bottom-round-rectangle"].includes(te))Y=Y==="auto"?Ji(he,pe):Y,o.drawBottomRoundRectanglePath(Se||t,Z.x,Z.y,he,pe,Y+(oe+G+ne)/2);else if(te==="barrel")o.drawBarrelPath(Se||t,Z.x,Z.y,he,pe);else if(te.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(te)){var Rt=(oe+G+ne)/a;be=Rc(Lc(be,Rt)),o.drawPolygonPath(Se||t,Z.x,Z.y,a,l,be)}else{var It=(oe+G+ne)/a;be=Rc(Lc(be,-It)),o.drawPolygonPath(Se||t,Z.x,Z.y,a,l,be)}if(p?t.stroke(Se):t.stroke(),ee==="double"){t.lineWidth=oe/3;var kt=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",p?t.stroke(Se):t.stroke(),t.globalCompositeOperation=kt}t.setLineDash&&t.setLineDash([])}},Pe=function(){i&&o.drawNodeOverlay(t,e,h,a,l)},De=function(){i&&o.drawNodeUnderlay(t,e,h,a,l)},Ue=function(){o.drawElementText(t,e,null,n)},Ye=e.pstyle("ghost").value==="yes";if(Ye){var ge=e.pstyle("ghost-offset-x").pfValue,Ce=e.pstyle("ghost-offset-y").pfValue,Ae=e.pstyle("ghost-opacity").value,Be=Ae*g;t.translate(ge,Ce),X(),Me(),q(Ae*j),Le(),je(Be,!0),K(Ae*F),Ee(),_e(B!==0||A!==0),ke(B!==0||A!==0),je(Be,!1),Ne(Be),t.translate(-ge,-Ce)}p&&t.translate(-h.x,-h.y),De(),p&&t.translate(h.x,h.y),X(),Me(),q(),Le(),je(g,!0),K(),Ee(),_e(B!==0||A!==0),ke(B!==0||A!==0),je(g,!1),Ne(),p&&t.translate(-h.x,-h.y),Ue(),Pe(),r&&t.translate(m.x1,m.y1)}};var B_=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(r,n,i,s,o){var a=this;if(n.visible()){var l=n.pstyle("".concat(e,"-padding")).pfValue,u=n.pstyle("".concat(e,"-opacity")).value,c=n.pstyle("".concat(e,"-color")).value,h=n.pstyle("".concat(e,"-shape")).value,g=n.pstyle("".concat(e,"-corner-radius")).value;if(u>0){if(i=i||n.position(),s==null||o==null){var p=n.padding();s=n.width()+2*p,o=n.height()+2*p}a.colorFillStyle(r,c[0],c[1],c[2],u),a.nodeShapes[h].draw(r,i.x,i.y,s+l*2,o+l*2,g),r.fill()}}}};oa.drawNodeOverlay=B_("overlay");oa.drawNodeUnderlay=B_("underlay");oa.hasPie=function(t){return t=t[0],t._private.hasPie};oa.hasStripe=function(t){return t=t[0],t._private.hasStripe};oa.drawPie=function(t,e,r,n){e=e[0],n=n||e.position();var i=e.cy().style(),s=e.pstyle("pie-size"),o=e.pstyle("pie-hole"),a=e.pstyle("pie-start-angle").pfValue,l=n.x,u=n.y,c=e.width(),h=e.height(),g=Math.min(c,h)/2,p,x=0,w=this.usePaths();if(w&&(l=0,u=0),s.units==="%"?g=g*s.pfValue:s.pfValue!==void 0&&(g=s.pfValue/2),o.units==="%"?p=g*o.pfValue:o.pfValue!==void 0&&(p=o.pfValue/2),!(p>=g))for(var v=1;v<=i.pieBackgroundN;v++){var m=e.pstyle("pie-"+v+"-background-size").value,y=e.pstyle("pie-"+v+"-background-color").value,b=e.pstyle("pie-"+v+"-background-opacity").value*r,_=m/100;_+x>1&&(_=1-x);var R=1.5*Math.PI+2*Math.PI*x;R+=a;var E=2*Math.PI*_,T=R+E;m===0||x>=1||x+_>1||(p===0?(t.beginPath(),t.moveTo(l,u),t.arc(l,u,g,R,T),t.closePath()):(t.beginPath(),t.arc(l,u,g,R,T),t.arc(l,u,p,T,R,!0),t.closePath()),this.colorFillStyle(t,y[0],y[1],y[2],b),t.fill(),x+=_)}};oa.drawStripe=function(t,e,r,n){e=e[0],n=n||e.position();var i=e.cy().style(),s=n.x,o=n.y,a=e.width(),l=e.height(),u=0,c=this.usePaths();t.save();var h=e.pstyle("stripe-direction").value,g=e.pstyle("stripe-size");switch(h){case"vertical":break;case"righward":t.rotate(-Math.PI/2);break}var p=a,x=l;g.units==="%"?(p=p*g.pfValue,x=x*g.pfValue):g.pfValue!==void 0&&(p=g.pfValue,x=g.pfValue),c&&(s=0,o=0),o-=p/2,s-=x/2;for(var w=1;w<=i.stripeBackgroundN;w++){var v=e.pstyle("stripe-"+w+"-background-size").value,m=e.pstyle("stripe-"+w+"-background-color").value,y=e.pstyle("stripe-"+w+"-background-opacity").value*r,b=v/100;b+u>1&&(b=1-u),!(v===0||u>=1||u+b>1)&&(t.beginPath(),t.rect(s,o+x*u,p,x*b),t.closePath(),this.colorFillStyle(t,m[0],m[1],m[2],y),t.fill(),u+=b)}t.restore()};var Qr={},JN=100;Qr.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};Qr.paintCache=function(t){for(var e=this.paintCaches=this.paintCaches||[],r=!0,n,i=0;i<e.length;i++)if(n=e[i],n.context===t){r=!1;break}return r&&(n={context:t},e.push(n)),n};Qr.createGradientStyleFor=function(t,e,r,n,i){var s,o=this.usePaths(),a=r.pstyle(e+"-gradient-stop-colors").value,l=r.pstyle(e+"-gradient-stop-positions").pfValue;if(n==="radial-gradient")if(r.isEdge()){var u=r.sourceEndpoint(),c=r.targetEndpoint(),h=r.midpoint(),g=Ba(u,h),p=Ba(c,h);s=t.createRadialGradient(h.x,h.y,0,h.x,h.y,Math.max(g,p))}else{var x=o?{x:0,y:0}:r.position(),w=r.paddedWidth(),v=r.paddedHeight();s=t.createRadialGradient(x.x,x.y,0,x.x,x.y,Math.max(w,v))}else if(r.isEdge()){var m=r.sourceEndpoint(),y=r.targetEndpoint();s=t.createLinearGradient(m.x,m.y,y.x,y.y)}else{var b=o?{x:0,y:0}:r.position(),_=r.paddedWidth(),R=r.paddedHeight(),E=_/2,T=R/2,k=r.pstyle("background-gradient-direction").value;switch(k){case"to-bottom":s=t.createLinearGradient(b.x,b.y-T,b.x,b.y+T);break;case"to-top":s=t.createLinearGradient(b.x,b.y+T,b.x,b.y-T);break;case"to-left":s=t.createLinearGradient(b.x+E,b.y,b.x-E,b.y);break;case"to-right":s=t.createLinearGradient(b.x-E,b.y,b.x+E,b.y);break;case"to-bottom-right":case"to-right-bottom":s=t.createLinearGradient(b.x-E,b.y-T,b.x+E,b.y+T);break;case"to-top-right":case"to-right-top":s=t.createLinearGradient(b.x-E,b.y+T,b.x+E,b.y-T);break;case"to-bottom-left":case"to-left-bottom":s=t.createLinearGradient(b.x+E,b.y-T,b.x-E,b.y+T);break;case"to-top-left":case"to-left-top":s=t.createLinearGradient(b.x+E,b.y+T,b.x-E,b.y-T);break}}if(!s)return null;for(var N=l.length===a.length,M=a.length,B=0;B<M;B++)s.addColorStop(N?l[B]:B/(M-1),"rgba("+a[B][0]+","+a[B][1]+","+a[B][2]+","+i+")");return s};Qr.gradientFillStyle=function(t,e,r,n){var i=this.createGradientStyleFor(t,"background",e,r,n);if(!i)return null;t.fillStyle=i};Qr.colorFillStyle=function(t,e,r,n,i){t.fillStyle="rgba("+e+","+r+","+n+","+i+")"};Qr.eleFillStyle=function(t,e,r){var n=e.pstyle("background-fill").value;if(n==="linear-gradient"||n==="radial-gradient")this.gradientFillStyle(t,e,n,r);else{var i=e.pstyle("background-color").value;this.colorFillStyle(t,i[0],i[1],i[2],r)}};Qr.gradientStrokeStyle=function(t,e,r,n){var i=this.createGradientStyleFor(t,"line",e,r,n);if(!i)return null;t.strokeStyle=i};Qr.colorStrokeStyle=function(t,e,r,n,i){t.strokeStyle="rgba("+e+","+r+","+n+","+i+")"};Qr.eleStrokeStyle=function(t,e,r){var n=e.pstyle("line-fill").value;if(n==="linear-gradient"||n==="radial-gradient")this.gradientStrokeStyle(t,e,n,r);else{var i=e.pstyle("line-color").value;this.colorStrokeStyle(t,i[0],i[1],i[2],r)}};Qr.matchCanvasSize=function(t){var e=this,r=e.data,n=e.findContainerClientCoords(),i=n[2],s=n[3],o=e.getPixelRatio(),a=e.motionBlurPxRatio;(t===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE]||t===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG])&&(o=a);var l=i*o,u=s*o,c;if(!(l===e.canvasWidth&&u===e.canvasHeight)){e.fontCaches=null;var h=r.canvasContainer;h.style.width=i+"px",h.style.height=s+"px";for(var g=0;g<e.CANVAS_LAYERS;g++)c=r.canvases[g],c.width=l,c.height=u,c.style.width=i+"px",c.style.height=s+"px";for(var g=0;g<e.BUFFER_COUNT;g++)c=r.bufferCanvases[g],c.width=l,c.height=u,c.style.width=i+"px",c.style.height=s+"px";e.textureMult=1,o<=1&&(c=r.bufferCanvases[e.TEXTURE_BUFFER],e.textureMult=2,c.width=l*e.textureMult,c.height=u*e.textureMult),e.canvasWidth=l,e.canvasHeight=u,e.pixelRatio=o}};Qr.renderTo=function(t,e,r,n){this.render({forcedContext:t,forcedZoom:e,forcedPan:r,drawAllLayers:!0,forcedPxRatio:n})};Qr.clearCanvas=function(){var t=this,e=t.data;function r(n){n.clearRect(0,0,t.canvasWidth,t.canvasHeight)}r(e.contexts[t.NODE]),r(e.contexts[t.DRAG])};Qr.render=function(t){var e=this;t=t||Cw();var r=e.cy,n=t.forcedContext,i=t.drawAllLayers,s=t.drawOnlyNodeLayer,o=t.forcedZoom,a=t.forcedPan,l=t.forcedPxRatio===void 0?this.getPixelRatio():t.forcedPxRatio,u=e.data,c=u.canvasNeedsRedraw,h=e.textureOnViewport&&!n&&(e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming),g=t.motionBlur!==void 0?t.motionBlur:e.motionBlur,p=e.motionBlurPxRatio,x=r.hasCompoundNodes(),w=e.hoverData.draggingEles,v=!!(e.hoverData.selecting||e.touchData.selecting);g=g&&!n&&e.motionBlurEnabled&&!v;var m=g;n||(e.prevPxRatio!==l&&(e.invalidateContainerClientCoordsCache(),e.matchCanvasSize(e.container),e.redrawHint("eles",!0),e.redrawHint("drag",!0)),e.prevPxRatio=l),!n&&e.motionBlurTimeout&&clearTimeout(e.motionBlurTimeout),g&&(e.mbFrames==null&&(e.mbFrames=0),e.mbFrames++,e.mbFrames<3&&(m=!1),e.mbFrames>e.minMbLowQualFrames&&(e.motionBlurPxRatio=e.mbPxRBlurry)),e.clearingMotionBlur&&(e.motionBlurPxRatio=1),e.textureDrawLastFrame&&!h&&(c[e.NODE]=!0,c[e.SELECT_BOX]=!0);var y=r.style(),b=r.zoom(),_=o!==void 0?o:b,R=r.pan(),E={x:R.x,y:R.y},T={zoom:b,pan:{x:R.x,y:R.y}},k=e.prevViewport,N=k===void 0||T.zoom!==k.zoom||T.pan.x!==k.pan.x||T.pan.y!==k.pan.y;!N&&!(w&&!x)&&(e.motionBlurPxRatio=1),a&&(E=a),_*=l,E.x*=l,E.y*=l;var M=e.getCachedZSortedEles();function B(K,X,J,ie,ce){var de=K.globalCompositeOperation;K.globalCompositeOperation="destination-out",e.colorFillStyle(K,255,255,255,e.motionBlurTransparency),K.fillRect(X,J,ie,ce),K.globalCompositeOperation=de}function A(K,X){var J,ie,ce,de;!e.clearingMotionBlur&&(K===u.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]||K===u.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG])?(J={x:R.x*p,y:R.y*p},ie=b*p,ce=e.canvasWidth*p,de=e.canvasHeight*p):(J=E,ie=_,ce=e.canvasWidth,de=e.canvasHeight),K.setTransform(1,0,0,1,0,0),X==="motionBlur"?B(K,0,0,ce,de):!n&&(X===void 0||X)&&K.clearRect(0,0,ce,de),i||(K.translate(J.x,J.y),K.scale(ie,ie)),a&&K.translate(a.x,a.y),o&&K.scale(o,o)}if(h||(e.textureDrawLastFrame=!1),h){if(e.textureDrawLastFrame=!0,!e.textureCache){e.textureCache={},e.textureCache.bb=r.mutableElements().boundingBox(),e.textureCache.texture=e.data.bufferCanvases[e.TEXTURE_BUFFER];var j=e.data.bufferContexts[e.TEXTURE_BUFFER];j.setTransform(1,0,0,1,0,0),j.clearRect(0,0,e.canvasWidth*e.textureMult,e.canvasHeight*e.textureMult),e.render({forcedContext:j,drawOnlyNodeLayer:!0,forcedPxRatio:l*e.textureMult});var T=e.textureCache.viewport={zoom:r.zoom(),pan:r.pan(),width:e.canvasWidth,height:e.canvasHeight};T.mpan={x:(0-T.pan.x)/T.zoom,y:(0-T.pan.y)/T.zoom}}c[e.DRAG]=!1,c[e.NODE]=!1;var D=u.contexts[e.NODE],I=e.textureCache.texture,T=e.textureCache.viewport;D.setTransform(1,0,0,1,0,0),g?B(D,0,0,T.width,T.height):D.clearRect(0,0,T.width,T.height);var U=y.core("outside-texture-bg-color").value,W=y.core("outside-texture-bg-opacity").value;e.colorFillStyle(D,U[0],U[1],U[2],W),D.fillRect(0,0,T.width,T.height);var b=r.zoom();A(D,!1),D.clearRect(T.mpan.x,T.mpan.y,T.width/T.zoom/l,T.height/T.zoom/l),D.drawImage(I,T.mpan.x,T.mpan.y,T.width/T.zoom/l,T.height/T.zoom/l)}else e.textureOnViewport&&!n&&(e.textureCache=null);var H=r.extent(),z=e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming||e.hoverData.draggingEles||e.cy.animated(),P=e.hideEdgesOnViewport&&z,F=[];if(F[e.NODE]=!c[e.NODE]&&g&&!e.clearedForMotionBlur[e.NODE]||e.clearingMotionBlur,F[e.NODE]&&(e.clearedForMotionBlur[e.NODE]=!0),F[e.DRAG]=!c[e.DRAG]&&g&&!e.clearedForMotionBlur[e.DRAG]||e.clearingMotionBlur,F[e.DRAG]&&(e.clearedForMotionBlur[e.DRAG]=!0),c[e.NODE]||i||s||F[e.NODE]){var G=g&&!F[e.NODE]&&p!==1,D=n||(G?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]:u.contexts[e.NODE]),$=g&&!G?"motionBlur":void 0;A(D,$),P?e.drawCachedNodes(D,M.nondrag,l,H):e.drawLayeredElements(D,M.nondrag,l,H),e.debug&&e.drawDebugPoints(D,M.nondrag),!i&&!g&&(c[e.NODE]=!1)}if(!s&&(c[e.DRAG]||i||F[e.DRAG])){var G=g&&!F[e.DRAG]&&p!==1,D=n||(G?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG]:u.contexts[e.DRAG]);A(D,g&&!G?"motionBlur":void 0),P?e.drawCachedNodes(D,M.drag,l,H):e.drawCachedElements(D,M.drag,l,H),e.debug&&e.drawDebugPoints(D,M.drag),!i&&!g&&(c[e.DRAG]=!1)}if(this.drawSelectionRectangle(t,A),g&&p!==1){var ee=u.contexts[e.NODE],re=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE],ne=u.contexts[e.DRAG],Y=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG],q=function(X,J,ie){X.setTransform(1,0,0,1,0,0),ie||!m?X.clearRect(0,0,e.canvasWidth,e.canvasHeight):B(X,0,0,e.canvasWidth,e.canvasHeight);var ce=p;X.drawImage(J,0,0,e.canvasWidth*ce,e.canvasHeight*ce,0,0,e.canvasWidth,e.canvasHeight)};(c[e.NODE]||F[e.NODE])&&(q(ee,re,F[e.NODE]),c[e.NODE]=!1),(c[e.DRAG]||F[e.DRAG])&&(q(ne,Y,F[e.DRAG]),c[e.DRAG]=!1)}e.prevViewport=T,e.clearingMotionBlur&&(e.clearingMotionBlur=!1,e.motionBlurCleared=!0,e.motionBlur=!0),g&&(e.motionBlurTimeout=setTimeout(function(){e.motionBlurTimeout=null,e.clearedForMotionBlur[e.NODE]=!1,e.clearedForMotionBlur[e.DRAG]=!1,e.motionBlur=!1,e.clearingMotionBlur=!h,e.mbFrames=0,c[e.NODE]=!0,c[e.DRAG]=!0,e.redraw()},JN)),n||r.emit("render")};var Uo;Qr.drawSelectionRectangle=function(t,e){var r=this,n=r.cy,i=r.data,s=n.style(),o=t.drawOnlyNodeLayer,a=t.drawAllLayers,l=i.canvasNeedsRedraw,u=t.forcedContext;if(r.showFps||!o&&l[r.SELECT_BOX]&&!a){var c=u||i.contexts[r.SELECT_BOX];if(e(c),r.selection[4]==1&&(r.hoverData.selecting||r.touchData.selecting)){var h=r.cy.zoom(),g=s.core("selection-box-border-width").value/h;c.lineWidth=g,c.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+")",c.fillRect(r.selection[0],r.selection[1],r.selection[2]-r.selection[0],r.selection[3]-r.selection[1]),g>0&&(c.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+")",c.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 h=r.cy.zoom(),p=i.bgActivePosistion;c.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+")",c.beginPath(),c.arc(p.x,p.y,s.core("active-bg-size").pfValue/h,0,2*Math.PI),c.fill()}var x=r.lastRedrawTime;if(r.showFps&&x){x=Math.round(x);var w=Math.round(1e3/x),v="1 frame = "+x+" ms = "+w+" fps";if(c.setTransform(1,0,0,1,0,0),c.fillStyle="rgba(255, 0, 0, 0.75)",c.strokeStyle="rgba(255, 0, 0, 0.75)",c.font="30px Arial",!Uo){var m=c.measureText(v);Uo=m.actualBoundingBoxAscent}c.fillText(v,0,Uo);var y=60;c.strokeRect(0,Uo+10,250,20),c.fillRect(0,Uo+10,250*Math.min(w/y,1),20)}a||(l[r.SELECT_BOX]=!1)}};function O1(t,e,r){var n=t.createShader(e);if(t.shaderSource(n,r),t.compileShader(n),!t.getShaderParameter(n,t.COMPILE_STATUS))throw new Error(t.getShaderInfoLog(n));return n}function eD(t,e,r){var n=O1(t,t.VERTEX_SHADER,e),i=O1(t,t.FRAGMENT_SHADER,r),s=t.createProgram();if(t.attachShader(s,n),t.attachShader(s,i),t.linkProgram(s),!t.getProgramParameter(s,t.LINK_STATUS))throw new Error("Could not initialize shaders");return s}function tD(t,e,r){r===void 0&&(r=e);var n=t.makeOffscreenCanvas(e,r),i=n.context=n.getContext("2d");return n.clear=function(){return i.clearRect(0,0,n.width,n.height)},n.clear(),n}function pg(t){var e=t.pixelRatio,r=t.cy.zoom(),n=t.cy.pan();return{zoom:r*e,pan:{x:n.x*e,y:n.y*e}}}function rD(t){var e=t.pixelRatio,r=t.cy.zoom();return r*e}function nD(t,e,r,n,i){var s=n*r+e.x,o=i*r+e.y;return o=Math.round(t.canvasHeight-o),[s,o]}function iD(t,e){return e.picking?!0:t.pstyle("background-fill").value!=="solid"||t.pstyle("background-image").strValue!=="none"?!1:t.pstyle("border-width").value===0||t.pstyle("border-opacity").value===0?!0:t.pstyle("border-style").value==="solid"}function aD(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 Ea(t,e,r){var n=t[0]/255,i=t[1]/255,s=t[2]/255,o=e,a=r||new Array(4);return a[0]=n*o,a[1]=i*o,a[2]=s*o,a[3]=o,a}function _s(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 sD(t){return t[0]+(t[1]<<8)+(t[2]<<16)+(t[3]<<24)}function oD(t,e){var r=t.createTexture();return r.buffer=function(n){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,n),t.generateMipmap(t.TEXTURE_2D),t.bindTexture(t.TEXTURE_2D,null)},r.deleteTexture=function(){t.deleteTexture(r)},r}function F_(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 j_(t,e,r){switch(e){case t.FLOAT:return new Float32Array(r);case t.INT:return new Int32Array(r)}}function lD(t,e,r,n,i,s){switch(e){case t.FLOAT:return new Float32Array(r.buffer,s*n,i);case t.INT:return new Int32Array(r.buffer,s*n,i)}}function uD(t,e,r,n){var i=F_(t,e),s=pr(i,2),o=s[0],a=s[1],l=j_(t,a,n),u=t.createBuffer();return t.bindBuffer(t.ARRAY_BUFFER,u),t.bufferData(t.ARRAY_BUFFER,l,t.STATIC_DRAW),a===t.FLOAT?t.vertexAttribPointer(r,o,a,!1,0,0):a===t.INT&&t.vertexAttribIPointer(r,o,a,0,0),t.enableVertexAttribArray(r),t.bindBuffer(t.ARRAY_BUFFER,null),u}function Yn(t,e,r,n){var i=F_(t,r),s=pr(i,3),o=s[0],a=s[1],l=s[2],u=j_(t,a,e*o),c=o*l,h=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,h),t.bufferData(t.ARRAY_BUFFER,e*c,t.DYNAMIC_DRAW),t.enableVertexAttribArray(n),a===t.FLOAT?t.vertexAttribPointer(n,o,a,!1,c,0):a===t.INT&&t.vertexAttribIPointer(n,o,a,c,0),t.vertexAttribDivisor(n,1),t.bindBuffer(t.ARRAY_BUFFER,null);for(var g=new Array(e),p=0;p<e;p++)g[p]=lD(t,a,u,c,o,p);return h.dataArray=u,h.stride=c,h.size=o,h.getView=function(x){return g[x]},h.setPoint=function(x,w,v){var m=g[x];m[0]=w,m[1]=v},h.bufferSubData=function(x){t.bindBuffer(t.ARRAY_BUFFER,h),x?t.bufferSubData(t.ARRAY_BUFFER,0,u,0,x*o):t.bufferSubData(t.ARRAY_BUFFER,0,u)},h}function cD(t,e,r){for(var n=9,i=new Float32Array(e*n),s=new Array(e),o=0;o<e;o++){var a=o*n*4;s[o]=new Float32Array(i.buffer,a,n)}var l=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,l),t.bufferData(t.ARRAY_BUFFER,i.byteLength,t.DYNAMIC_DRAW);for(var u=0;u<3;u++){var c=r+u;t.enableVertexAttribArray(c),t.vertexAttribPointer(c,3,t.FLOAT,!1,36,u*12),t.vertexAttribDivisor(c,1)}return t.bindBuffer(t.ARRAY_BUFFER,null),l.getMatrixView=function(h){return s[h]},l.setData=function(h,g){s[g].set(h,0)},l.bufferSubData=function(){t.bindBuffer(t.ARRAY_BUFFER,l),t.bufferSubData(t.ARRAY_BUFFER,0,i)},l}function hD(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(n,i){t.bindTexture(t.TEXTURE_2D,r),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,n,i,0,t.RGBA,t.UNSIGNED_BYTE,null)},e}var B1=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 Np(){var t=new B1(9);return B1!=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 F1(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 fD(t,e,r){var n=e[0],i=e[1],s=e[2],o=e[3],a=e[4],l=e[5],u=e[6],c=e[7],h=e[8],g=r[0],p=r[1],x=r[2],w=r[3],v=r[4],m=r[5],y=r[6],b=r[7],_=r[8];return t[0]=g*n+p*o+x*u,t[1]=g*i+p*a+x*c,t[2]=g*s+p*l+x*h,t[3]=w*n+v*o+m*u,t[4]=w*i+v*a+m*c,t[5]=w*s+v*l+m*h,t[6]=y*n+b*o+_*u,t[7]=y*i+b*a+_*c,t[8]=y*s+b*l+_*h,t}function yc(t,e,r){var n=e[0],i=e[1],s=e[2],o=e[3],a=e[4],l=e[5],u=e[6],c=e[7],h=e[8],g=r[0],p=r[1];return t[0]=n,t[1]=i,t[2]=s,t[3]=o,t[4]=a,t[5]=l,t[6]=g*n+p*o+u,t[7]=g*i+p*a+c,t[8]=g*s+p*l+h,t}function j1(t,e,r){var n=e[0],i=e[1],s=e[2],o=e[3],a=e[4],l=e[5],u=e[6],c=e[7],h=e[8],g=Math.sin(r),p=Math.cos(r);return t[0]=p*n+g*o,t[1]=p*i+g*a,t[2]=p*s+g*l,t[3]=p*o-g*n,t[4]=p*a-g*i,t[5]=p*l-g*s,t[6]=u,t[7]=c,t[8]=h,t}function Cv(t,e,r){var n=r[0],i=r[1];return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*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 dD(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 pD=(function(){function t(e,r,n,i){ia(this,t),this.debugID=Math.floor(Math.random()*1e4),this.r=e,this.texSize=r,this.texRows=n,this.texHeight=Math.floor(r/n),this.enableWrapping=!0,this.locked=!1,this.texture=null,this.needsBuffer=!0,this.freePointer={x:0,row:0},this.keyToLocation=new Map,this.canvas=i(e,r,r),this.scratch=i(e,r,this.texHeight,"scratch")}return aa(t,[{key:"lock",value:function(){this.locked=!0}},{key:"getKeys",value:function(){return new Set(this.keyToLocation.keys())}},{key:"getScale",value:function(r){var n=r.w,i=r.h,s=this.texHeight,o=this.texSize,a=s/i,l=n*a,u=i*a;return l>o&&(a=o/n,l=n*a,u=i*a),{scale:a,texW:l,texH:u}}},{key:"draw",value:function(r,n,i){var s=this;if(this.locked)throw new Error("can't draw, atlas is locked");var o=this.texSize,a=this.texRows,l=this.texHeight,u=this.getScale(n),c=u.scale,h=u.texW,g=u.texH,p=function(b,_){if(i&&_){var R=_.context,E=b.x,T=b.row,k=E,N=l*T;R.save(),R.translate(k,N),R.scale(c,c),i(R,n),R.restore()}},x=[null,null],w=function(){p(s.freePointer,s.canvas),x[0]={x:s.freePointer.x,y:s.freePointer.row*l,w:h,h:g},x[1]={x:s.freePointer.x+h,y:s.freePointer.row*l,w:0,h:g},s.freePointer.x+=h,s.freePointer.x==o&&(s.freePointer.x=0,s.freePointer.row++)},v=function(){var b=s.scratch,_=s.canvas;b.clear(),p({x:0,row:0},b);var R=o-s.freePointer.x,E=h-R,T=l;{var k=s.freePointer.x,N=s.freePointer.row*l,M=R;_.context.drawImage(b,0,0,M,T,k,N,M,T),x[0]={x:k,y:N,w:M,h:g}}{var B=R,A=(s.freePointer.row+1)*l,j=E;_&&_.context.drawImage(b,B,0,j,T,0,A,j,T),x[1]={x:0,y:A,w:j,h:g}}s.freePointer.x=E,s.freePointer.row++},m=function(){s.freePointer.x=0,s.freePointer.row++};if(this.freePointer.x+h<=o)w();else{if(this.freePointer.row>=a-1)return!1;this.freePointer.x===o?(m(),w()):this.enableWrapping?v():(m(),w())}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 n=this.texSize,i=this.texRows,s=this.getScale(r),o=s.texW;return this.freePointer.x+o>n?this.freePointer.row<i-1:!0}},{key:"bufferIfNeeded",value:function(r){this.texture||(this.texture=oD(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}}])})(),vD=(function(){function t(e,r,n,i){ia(this,t),this.r=e,this.texSize=r,this.texRows=n,this.createTextureCanvas=i,this.atlases=[],this.styleKeyToAtlas=new Map,this.markedKeys=new Set}return aa(t,[{key:"getKeys",value:function(){return new Set(this.styleKeyToAtlas.keys())}},{key:"_createAtlas",value:function(){var r=this.r,n=this.texSize,i=this.texRows,s=this.createTextureCanvas;return new pD(r,n,i,s)}},{key:"_getScratchCanvas",value:function(){if(!this.scratch){var r=this.r,n=this.texSize,i=this.texRows,s=this.createTextureCanvas,o=Math.floor(n/i);this.scratch=s(r,n,o,"scratch")}return this.scratch}},{key:"draw",value:function(r,n,i){var s=this.styleKeyToAtlas.get(r);return s||(s=this.atlases[this.atlases.length-1],(!s||!s.canFit(n))&&(s&&s.lock(),s=this._createAtlas(),this.atlases.push(s)),s.draw(r,n,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,n=this.markedKeys;if(n.size===0){console.log("nothing to garbage collect");return}var i=[],s=new Map,o=null,a=on(this.atlases),l;try{var u=function(){var h=l.value,g=h.getKeys(),p=gD(n,g);if(p.size===0)return i.push(h),g.forEach(function(R){return s.set(R,h)}),1;o||(o=r._createAtlas(),i.push(o));var x=on(g),w;try{for(x.s();!(w=x.n()).done;){var v=w.value;if(!p.has(v)){var m=h.getOffsets(v),y=pr(m,2),b=y[0],_=y[1];o.canFit({w:b.w+_.w,h:b.h})||(o.lock(),o=r._createAtlas(),i.push(o)),h.canvas&&(r._copyTextureToNewAtlas(v,h,o),s.set(v,o))}}}catch(R){x.e(R)}finally{x.f()}h.dispose()};for(a.s();!(l=a.n()).done;)u()}catch(c){a.e(c)}finally{a.f()}this.atlases=i,this.styleKeyToAtlas=s,this.markedKeys=new Set}},{key:"_copyTextureToNewAtlas",value:function(r,n,i){var s=n.getOffsets(r),o=pr(s,2),a=o[0],l=o[1];if(l.w===0)i.draw(r,a,function(g){g.drawImage(n.canvas,a.x,a.y,a.w,a.h,0,0,a.w,a.h)});else{var u=this._getScratchCanvas();u.clear(),u.context.drawImage(n.canvas,a.x,a.y,a.w,a.h,0,0,a.w,a.h),u.context.drawImage(n.canvas,l.x,l.y,l.w,l.h,a.w,0,l.w,l.h);var c=a.w+l.w,h=a.h;i.draw(r,{w:c,h},function(g){g.drawImage(u,0,0,c,h,0,0,c,h)})}}},{key:"getCounts",value:function(){return{keyCount:this.styleKeyToAtlas.size,atlasCount:new Set(this.styleKeyToAtlas.values()).size}}}])})();function gD(t,e){return t.intersection?t.intersection(e):new Set(Cc(t).filter(function(r){return e.has(r)}))}var mD=(function(){function t(e,r){ia(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 aa(t,[{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"addAtlasCollection",value:function(r,n){var i=this.globalOptions,s=i.webglTexSize,o=i.createTextureCanvas,a=n.texRows,l=this._cacheScratchCanvas(o),u=new vD(this.r,s,a,l);this.collections.set(r,u)}},{key:"addRenderType",value:function(r,n){var i=n.collection;if(!this.collections.has(i))throw new Error("invalid atlas collection name '".concat(i,"'"));var s=this.collections.get(i),o=dt({type:r,atlasCollection:s},n);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 n=-1,i=-1,s=null;return function(o,a,l,u){return u?((!s||a!=n||l!=i)&&(n=a,i=l,s=r(o,a,l)),s):r(o,a,l)}}},{key:"_key",value:function(r,n){return"".concat(r,"-").concat(n)}},{key:"invalidate",value:function(r){var n=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=i.forceRedraw,o=s===void 0?!1:s,a=i.filterEle,l=a===void 0?function(){return!0}:a,u=i.filterType,c=u===void 0?function(){return!0}:u,h=!1,g=!1,p=on(r),x;try{for(p.s();!(x=p.n()).done;){var w=x.value;if(l(w)){var v=on(this.renderTypes.values()),m;try{var y=function(){var _=m.value,R=_.type;if(c(R)){var E=n.collections.get(_.collection),T=_.getKey(w),k=Array.isArray(T)?T:[T];if(o)k.forEach(function(A){return E.markKeyForGC(A)}),g=!0;else{var N=_.getID?_.getID(w):w.id(),M=n._key(R,N),B=n.typeAndIdToKey.get(M);B!==void 0&&!aD(k,B)&&(h=!0,n.typeAndIdToKey.delete(M),B.forEach(function(A){return E.markKeyForGC(A)}))}}};for(v.s();!(m=v.n()).done;)y()}catch(b){v.e(b)}finally{v.f()}}}}catch(b){p.e(b)}finally{p.f()}return g&&(this.gc(),h=!1),h}},{key:"gc",value:function(){var r=on(this.collections.values()),n;try{for(r.s();!(n=r.n()).done;){var i=n.value;i.gc()}}catch(s){r.e(s)}finally{r.f()}}},{key:"getOrCreateAtlas",value:function(r,n,i,s){var o=this.renderTypes.get(n),a=this.collections.get(o.collection),l=!1,u=a.draw(s,i,function(g){o.drawClipped?(g.save(),g.beginPath(),g.rect(0,0,i.w,i.h),g.clip(),o.drawElement(g,r,i,!0,!0),g.restore()):o.drawElement(g,r,i,!0,!0),l=!0});if(l){var c=o.getID?o.getID(r):r.id(),h=this._key(n,c);this.typeAndIdToKey.has(h)?this.typeAndIdToKey.get(h).push(s):this.typeAndIdToKey.set(h,[s])}return u}},{key:"getAtlasInfo",value:function(r,n){var i=this,s=this.renderTypes.get(n),o=s.getKey(r),a=Array.isArray(o)?o:[o];return a.map(function(l){var u=s.getBoundingBox(r,l),c=i.getOrCreateAtlas(r,n,u,l),h=c.getOffsets(l),g=pr(h,2),p=g[0],x=g[1];return{atlas:c,tex:p,tex1:p,tex2:x,bb:u}})}},{key:"getDebugInfo",value:function(){var r=[],n=on(this.collections),i;try{for(n.s();!(i=n.n()).done;){var s=pr(i.value,2),o=s[0],a=s[1],l=a.getCounts(),u=l.keyCount,c=l.atlasCount;r.push({type:o,keyCount:u,atlasCount:c})}}catch(h){n.e(h)}finally{n.f()}return r}}])})(),yD=(function(){function t(e){ia(this,t),this.globalOptions=e,this.atlasSize=e.webglTexSize,this.maxAtlasesPerBatch=e.webglTexPerBatch,this.batchAtlases=[]}return aa(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,n){return n})}},{key:"startBatch",value:function(){this.batchAtlases=[]}},{key:"getAtlasCount",value:function(){return this.batchAtlases.length}},{key:"getAtlases",value:function(){return this.batchAtlases}},{key:"canAddToCurrentBatch",value:function(r){return this.batchAtlases.length===this.maxAtlasesPerBatch?this.batchAtlases.includes(r):!0}},{key:"getAtlasIndexForBatch",value:function(r){var n=this.batchAtlases.indexOf(r);if(n<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)throw new Error("cannot add more atlases to batch");this.batchAtlases.push(r),n=this.batchAtlases.length-1}return n}}])})(),xD=`
62
+ float circleSD(vec2 p, float r) {
63
+ return distance(vec2(0), p) - r; // signed distance
64
+ }
65
+ `,bD=`
66
+ float rectangleSD(vec2 p, vec2 b) {
67
+ vec2 d = abs(p)-b;
68
+ return distance(vec2(0),max(d,0.0)) + min(max(d.x,d.y),0.0);
69
+ }
70
+ `,wD=`
71
+ float roundRectangleSD(vec2 p, vec2 b, vec4 cr) {
72
+ cr.xy = (p.x > 0.0) ? cr.xy : cr.zw;
73
+ cr.x = (p.y > 0.0) ? cr.x : cr.y;
74
+ vec2 q = abs(p) - b + cr.x;
75
+ return min(max(q.x, q.y), 0.0) + distance(vec2(0), max(q, 0.0)) - cr.x;
76
+ }
77
+ `,_D=`
78
+ float ellipseSD(vec2 p, vec2 ab) {
79
+ p = abs( p ); // symmetry
80
+
81
+ // find root with Newton solver
82
+ vec2 q = ab*(p-ab);
83
+ float w = (q.x<q.y)? 1.570796327 : 0.0;
84
+ for( int i=0; i<5; i++ ) {
85
+ vec2 cs = vec2(cos(w),sin(w));
86
+ vec2 u = ab*vec2( cs.x,cs.y);
87
+ vec2 v = ab*vec2(-cs.y,cs.x);
88
+ w = w + dot(p-u,v)/(dot(p-u,u)+dot(v,v));
89
+ }
90
+
91
+ // compute final point and distance
92
+ float d = length(p-ab*vec2(cos(w),sin(w)));
93
+
94
+ // return signed distance
95
+ return (dot(p/ab,p/ab)>1.0) ? d : -d;
96
+ }
97
+ `,il={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},Oc={IGNORE:1,USE_BB:2},Dp=0,z1=1,H1=2,Ap=3,Ss=4,tc=5,Wo=6,Vo=7,SD=(function(){function t(e,r,n){ia(this,t),this.r=e,this.gl=r,this.maxInstances=n.webglBatchSize,this.atlasSize=n.webglTexSize,this.bgColor=n.bgColor,this.debug=n.webglDebug,this.batchDebugInfo=[],n.enableWrapping=!0,n.createTextureCanvas=tD,this.atlasManager=new mD(e,n),this.batchManager=new yD(n),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(il.SCREEN),this.pickingProgram=this._createShaderProgram(il.PICKING),this.vao=this._createVAO()}return aa(t,[{key:"addAtlasCollection",value:function(r,n){this.atlasManager.addAtlasCollection(r,n)}},{key:"addTextureAtlasRenderType",value:function(r,n){this.atlasManager.addRenderType(r,n)}},{key:"addSimpleShapeRenderType",value:function(r,n){this.simpleShapeOptions.set(r,n)}},{key:"invalidate",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=n.type,s=this.atlasManager;return i?s.invalidate(r,{filterType:function(a){return a===i},forceRedraw:!0}):s.invalidate(r)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"_createShaderProgram",value:function(r){var n=this.gl,i=`#version 300 es
98
+ precision highp float;
99
+
100
+ uniform mat3 uPanZoomMatrix;
101
+ uniform int uAtlasSize;
102
+
103
+ // instanced
104
+ in vec2 aPosition; // a vertex from the unit square
105
+
106
+ in mat3 aTransform; // used to transform verticies, eg into a bounding box
107
+ in int aVertType; // the type of thing we are rendering
108
+
109
+ // the z-index that is output when using picking mode
110
+ in vec4 aIndex;
111
+
112
+ // For textures
113
+ in int aAtlasId; // which shader unit/atlas to use
114
+ in vec4 aTex; // x/y/w/h of texture in atlas
115
+
116
+ // for edges
117
+ in vec4 aPointAPointB;
118
+ in vec4 aPointCPointD;
119
+ in vec2 aLineWidth; // also used for node border width
120
+
121
+ // simple shapes
122
+ in vec4 aCornerRadius; // for round-rectangle [top-right, bottom-right, top-left, bottom-left]
123
+ in vec4 aColor; // also used for edges
124
+ in vec4 aBorderColor; // aLineWidth is used for border width
125
+
126
+ // output values passed to the fragment shader
127
+ out vec2 vTexCoord;
128
+ out vec4 vColor;
129
+ out vec2 vPosition;
130
+ // flat values are not interpolated
131
+ flat out int vAtlasId;
132
+ flat out int vVertType;
133
+ flat out vec2 vTopRight;
134
+ flat out vec2 vBotLeft;
135
+ flat out vec4 vCornerRadius;
136
+ flat out vec4 vBorderColor;
137
+ flat out vec2 vBorderWidth;
138
+ flat out vec4 vIndex;
139
+
140
+ void main(void) {
141
+ int vid = gl_VertexID;
142
+ vec2 position = aPosition; // TODO make this a vec3, simplifies some code below
143
+
144
+ if(aVertType == `.concat(Dp,`) {
145
+ float texX = aTex.x; // texture coordinates
146
+ float texY = aTex.y;
147
+ float texW = aTex.z;
148
+ float texH = aTex.w;
149
+
150
+ if(vid == 1 || vid == 2 || vid == 4) {
151
+ texX += texW;
152
+ }
153
+ if(vid == 2 || vid == 4 || vid == 5) {
154
+ texY += texH;
155
+ }
156
+
157
+ float d = float(uAtlasSize);
158
+ vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1
159
+
160
+ gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
161
+ }
162
+ else if(aVertType == `).concat(Ss," || aVertType == ").concat(Vo,`
163
+ || aVertType == `).concat(tc," || aVertType == ").concat(Wo,`) { // simple shapes
164
+
165
+ // the bounding box is needed by the fragment shader
166
+ vBotLeft = (aTransform * vec3(0, 0, 1)).xy; // flat
167
+ vTopRight = (aTransform * vec3(1, 1, 1)).xy; // flat
168
+ vPosition = (aTransform * vec3(position, 1)).xy; // will be interpolated
169
+
170
+ // calculations are done in the fragment shader, just pass these along
171
+ vColor = aColor;
172
+ vCornerRadius = aCornerRadius;
173
+ vBorderColor = aBorderColor;
174
+ vBorderWidth = aLineWidth;
175
+
176
+ gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
177
+ }
178
+ else if(aVertType == `).concat(z1,`) {
179
+ vec2 source = aPointAPointB.xy;
180
+ vec2 target = aPointAPointB.zw;
181
+
182
+ // adjust the geometry so that the line is centered on the edge
183
+ position.y = position.y - 0.5;
184
+
185
+ // stretch the unit square into a long skinny rectangle
186
+ vec2 xBasis = target - source;
187
+ vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));
188
+ vec2 point = source + xBasis * position.x + yBasis * aLineWidth[0] * position.y;
189
+
190
+ gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);
191
+ vColor = aColor;
192
+ }
193
+ else if(aVertType == `).concat(H1,`) {
194
+ vec2 pointA = aPointAPointB.xy;
195
+ vec2 pointB = aPointAPointB.zw;
196
+ vec2 pointC = aPointCPointD.xy;
197
+ vec2 pointD = aPointCPointD.zw;
198
+
199
+ // adjust the geometry so that the line is centered on the edge
200
+ position.y = position.y - 0.5;
201
+
202
+ vec2 p0, p1, p2, pos;
203
+ if(position.x == 0.0) { // The left side of the unit square
204
+ p0 = pointA;
205
+ p1 = pointB;
206
+ p2 = pointC;
207
+ pos = position;
208
+ } else { // The right side of the unit square, use same approach but flip the geometry upside down
209
+ p0 = pointD;
210
+ p1 = pointC;
211
+ p2 = pointB;
212
+ pos = vec2(0.0, -position.y);
213
+ }
214
+
215
+ vec2 p01 = p1 - p0;
216
+ vec2 p12 = p2 - p1;
217
+ vec2 p21 = p1 - p2;
218
+
219
+ // Find the normal vector.
220
+ vec2 tangent = normalize(normalize(p12) + normalize(p01));
221
+ vec2 normal = vec2(-tangent.y, tangent.x);
222
+
223
+ // Find the vector perpendicular to p0 -> p1.
224
+ vec2 p01Norm = normalize(vec2(-p01.y, p01.x));
225
+
226
+ // Determine the bend direction.
227
+ float sigma = sign(dot(p01 + p21, normal));
228
+ float width = aLineWidth[0];
229
+
230
+ if(sign(pos.y) == -sigma) {
231
+ // This is an intersecting vertex. Adjust the position so that there's no overlap.
232
+ vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);
233
+ gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
234
+ } else {
235
+ // This is a non-intersecting vertex. Treat it like a mitre join.
236
+ vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);
237
+ gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
238
+ }
239
+
240
+ vColor = aColor;
241
+ }
242
+ else if(aVertType == `).concat(Ap,` && vid < 3) {
243
+ // massage the first triangle into an edge arrow
244
+ if(vid == 0)
245
+ position = vec2(-0.15, -0.3);
246
+ if(vid == 1)
247
+ position = vec2( 0.0, 0.0);
248
+ if(vid == 2)
249
+ position = vec2( 0.15, -0.3);
250
+
251
+ gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
252
+ vColor = aColor;
253
+ }
254
+ else {
255
+ gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space
256
+ }
257
+
258
+ vAtlasId = aAtlasId;
259
+ vVertType = aVertType;
260
+ vIndex = aIndex;
261
+ }
262
+ `),s=this.batchManager.getIndexArray(),o=`#version 300 es
263
+ precision highp float;
264
+
265
+ // declare texture unit for each texture atlas in the batch
266
+ `.concat(s.map(function(u){return"uniform sampler2D uTexture".concat(u,";")}).join(`
267
+ `),`
268
+
269
+ uniform vec4 uBGColor;
270
+ uniform float uZoom;
271
+
272
+ in vec2 vTexCoord;
273
+ in vec4 vColor;
274
+ in vec2 vPosition; // model coordinates
275
+
276
+ flat in int vAtlasId;
277
+ flat in vec4 vIndex;
278
+ flat in int vVertType;
279
+ flat in vec2 vTopRight;
280
+ flat in vec2 vBotLeft;
281
+ flat in vec4 vCornerRadius;
282
+ flat in vec4 vBorderColor;
283
+ flat in vec2 vBorderWidth;
284
+
285
+ out vec4 outColor;
286
+
287
+ `).concat(xD,`
288
+ `).concat(bD,`
289
+ `).concat(wD,`
290
+ `).concat(_D,`
291
+
292
+ vec4 blend(vec4 top, vec4 bot) { // blend colors with premultiplied alpha
293
+ return vec4(
294
+ top.rgb + (bot.rgb * (1.0 - top.a)),
295
+ top.a + (bot.a * (1.0 - top.a))
296
+ );
297
+ }
298
+
299
+ vec4 distInterp(vec4 cA, vec4 cB, float d) { // interpolate color using Signed Distance
300
+ // scale to the zoom level so that borders don't look blurry when zoomed in
301
+ // note 1.5 is an aribitrary value chosen because it looks good
302
+ return mix(cA, cB, 1.0 - smoothstep(0.0, 1.5 / uZoom, abs(d)));
303
+ }
304
+
305
+ void main(void) {
306
+ if(vVertType == `).concat(Dp,`) {
307
+ // look up the texel from the texture unit
308
+ `).concat(s.map(function(u){return"if(vAtlasId == ".concat(u,") outColor = texture(uTexture").concat(u,", vTexCoord);")}).join(`
309
+ else `),`
310
+ }
311
+ else if(vVertType == `).concat(Ap,`) {
312
+ // mimics how canvas renderer uses context.globalCompositeOperation = 'destination-out';
313
+ outColor = blend(vColor, uBGColor);
314
+ outColor.a = 1.0; // make opaque, masks out line under arrow
315
+ }
316
+ else if(vVertType == `).concat(Ss,` && vBorderWidth == vec2(0.0)) { // simple rectangle with no border
317
+ outColor = vColor; // unit square is already transformed to the rectangle, nothing else needs to be done
318
+ }
319
+ else if(vVertType == `).concat(Ss," || vVertType == ").concat(Vo,`
320
+ || vVertType == `).concat(tc," || vVertType == ").concat(Wo,`) { // use SDF
321
+
322
+ float outerBorder = vBorderWidth[0];
323
+ float innerBorder = vBorderWidth[1];
324
+ float borderPadding = outerBorder * 2.0;
325
+ float w = vTopRight.x - vBotLeft.x - borderPadding;
326
+ float h = vTopRight.y - vBotLeft.y - borderPadding;
327
+ vec2 b = vec2(w/2.0, h/2.0); // half width, half height
328
+ vec2 p = vPosition - vec2(vTopRight.x - b[0] - outerBorder, vTopRight.y - b[1] - outerBorder); // translate to center
329
+
330
+ float d; // signed distance
331
+ if(vVertType == `).concat(Ss,`) {
332
+ d = rectangleSD(p, b);
333
+ } else if(vVertType == `).concat(Vo,` && w == h) {
334
+ d = circleSD(p, b.x); // faster than ellipse
335
+ } else if(vVertType == `).concat(Vo,`) {
336
+ d = ellipseSD(p, b);
337
+ } else {
338
+ d = roundRectangleSD(p, b, vCornerRadius.wzyx);
339
+ }
340
+
341
+ // use the distance to interpolate a color to smooth the edges of the shape, doesn't need multisampling
342
+ // we must smooth colors inwards, because we can't change pixels outside the shape's bounding box
343
+ if(d > 0.0) {
344
+ if(d > outerBorder) {
345
+ discard;
346
+ } else {
347
+ outColor = distInterp(vBorderColor, vec4(0), d - outerBorder);
348
+ }
349
+ } else {
350
+ if(d > innerBorder) {
351
+ vec4 outerColor = outerBorder == 0.0 ? vec4(0) : vBorderColor;
352
+ vec4 innerBorderColor = blend(vBorderColor, vColor);
353
+ outColor = distInterp(innerBorderColor, outerColor, d);
354
+ }
355
+ else {
356
+ vec4 outerColor;
357
+ if(innerBorder == 0.0 && outerBorder == 0.0) {
358
+ outerColor = vec4(0);
359
+ } else if(innerBorder == 0.0) {
360
+ outerColor = vBorderColor;
361
+ } else {
362
+ outerColor = blend(vBorderColor, vColor);
363
+ }
364
+ outColor = distInterp(vColor, outerColor, d - innerBorder);
365
+ }
366
+ }
367
+ }
368
+ else {
369
+ outColor = vColor;
370
+ }
371
+
372
+ `).concat(r.picking?`if(outColor.a == 0.0) discard;
373
+ else outColor = vIndex;`:"",`
374
+ }
375
+ `),a=eD(n,i,o);a.aPosition=n.getAttribLocation(a,"aPosition"),a.aIndex=n.getAttribLocation(a,"aIndex"),a.aVertType=n.getAttribLocation(a,"aVertType"),a.aTransform=n.getAttribLocation(a,"aTransform"),a.aAtlasId=n.getAttribLocation(a,"aAtlasId"),a.aTex=n.getAttribLocation(a,"aTex"),a.aPointAPointB=n.getAttribLocation(a,"aPointAPointB"),a.aPointCPointD=n.getAttribLocation(a,"aPointCPointD"),a.aLineWidth=n.getAttribLocation(a,"aLineWidth"),a.aColor=n.getAttribLocation(a,"aColor"),a.aCornerRadius=n.getAttribLocation(a,"aCornerRadius"),a.aBorderColor=n.getAttribLocation(a,"aBorderColor"),a.uPanZoomMatrix=n.getUniformLocation(a,"uPanZoomMatrix"),a.uAtlasSize=n.getUniformLocation(a,"uAtlasSize"),a.uBGColor=n.getUniformLocation(a,"uBGColor"),a.uZoom=n.getUniformLocation(a,"uZoom"),a.uTextures=[];for(var l=0;l<this.batchManager.getMaxAtlasesPerBatch();l++)a.uTextures.push(n.getUniformLocation(a,"uTexture".concat(l)));return a}},{key:"_createVAO",value:function(){var r=[0,0,1,0,1,1,0,0,1,1,0,1];this.vertexCount=r.length/2;var n=this.maxInstances,i=this.gl,s=this.program,o=i.createVertexArray();return i.bindVertexArray(o),uD(i,"vec2",s.aPosition,r),this.transformBuffer=cD(i,n,s.aTransform),this.indexBuffer=Yn(i,n,"vec4",s.aIndex),this.vertTypeBuffer=Yn(i,n,"int",s.aVertType),this.atlasIdBuffer=Yn(i,n,"int",s.aAtlasId),this.texBuffer=Yn(i,n,"vec4",s.aTex),this.pointAPointBBuffer=Yn(i,n,"vec4",s.aPointAPointB),this.pointCPointDBuffer=Yn(i,n,"vec4",s.aPointCPointD),this.lineWidthBuffer=Yn(i,n,"vec2",s.aLineWidth),this.colorBuffer=Yn(i,n,"vec4",s.aColor),this.cornerRadiusBuffer=Yn(i,n,"vec4",s.aCornerRadius),this.borderColorBuffer=Yn(i,n,"vec4",s.aBorderColor),i.bindVertexArray(null),o}},{key:"buffers",get:function(){var r=this;return this._buffers||(this._buffers=Object.keys(this).filter(function(n){return Gi(n,"Buffer")}).map(function(n){return r[n]})),this._buffers}},{key:"startFrame",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:il.SCREEN;this.panZoomMatrix=r,this.renderTarget=n,this.batchDebugInfo=[],this.wrappedCount=0,this.simpleCount=0,this.startBatch()}},{key:"startBatch",value:function(){this.instanceCount=0,this.batchManager.startBatch()}},{key:"endFrame",value:function(){this.endBatch()}},{key:"_isVisible",value:function(r,n){return r.visible()?n&&n.isVisible?n.isVisible(r):!0:!1}},{key:"drawTexture",value:function(r,n,i){var s=this.atlasManager,o=this.batchManager,a=s.getRenderTypeOpts(i);if(this._isVisible(r,a)&&!(r.isEdge()&&!this._isValidEdge(r))){if(this.renderTarget.picking&&a.getTexPickingMode){var l=a.getTexPickingMode(r);if(l===Oc.IGNORE)return;if(l==Oc.USE_BB){this.drawPickingRectangle(r,n,i);return}}var u=s.getAtlasInfo(r,i),c=on(u),h;try{for(c.s();!(h=c.n()).done;){var g=h.value,p=g.atlas,x=g.tex1,w=g.tex2;o.canAddToCurrentBatch(p)||this.endBatch();for(var v=o.getAtlasIndexForBatch(p),m=0,y=[[x,!0],[w,!1]];m<y.length;m++){var b=pr(y[m],2),_=b[0],R=b[1];if(_.w!=0){var E=this.instanceCount;this.vertTypeBuffer.getView(E)[0]=Dp;var T=this.indexBuffer.getView(E);_s(n,T);var k=this.atlasIdBuffer.getView(E);k[0]=v;var N=this.texBuffer.getView(E);N[0]=_.x,N[1]=_.y,N[2]=_.w,N[3]=_.h;var M=this.transformBuffer.getMatrixView(E);this.setTransformMatrix(r,M,a,g,R),this.instanceCount++,R||this.wrappedCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}catch(B){c.e(B)}finally{c.f()}}}},{key:"setTransformMatrix",value:function(r,n,i,s){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=0;if(i.shapeProps&&i.shapeProps.padding&&(a=r.pstyle(i.shapeProps.padding).pfValue),s){var l=s.bb,u=s.tex1,c=s.tex2,h=u.w/(u.w+c.w);o||(h=1-h);var g=this._getAdjustedBB(l,a,o,h);this._applyTransformMatrix(n,g,i,r)}else{var p=i.getBoundingBox(r),x=this._getAdjustedBB(p,a,!0,1);this._applyTransformMatrix(n,x,i,r)}}},{key:"_applyTransformMatrix",value:function(r,n,i,s){var o,a;F1(r);var l=i.getRotation?i.getRotation(s):0;if(l!==0){var u=i.getRotationPoint(s),c=u.x,h=u.y;yc(r,r,[c,h]),j1(r,r,l);var g=i.getRotationOffset(s);o=g.x+(n.xOffset||0),a=g.y+(n.yOffset||0)}else o=n.x1,a=n.y1;yc(r,r,[o,a]),Cv(r,r,[n.w,n.h])}},{key:"_getAdjustedBB",value:function(r,n,i,s){var o=r.x1,a=r.y1,l=r.w,u=r.h,c=r.yOffset;n&&(o-=n,a-=n,l+=2*n,u+=2*n);var h=0,g=l*s;return i&&s<1?l=g:!i&&s<1&&(h=l-g,o+=h,l=g),{x1:o,y1:a,w:l,h:u,xOffset:h,yOffset:c}}},{key:"drawPickingRectangle",value:function(r,n,i){var s=this.atlasManager.getRenderTypeOpts(i),o=this.instanceCount;this.vertTypeBuffer.getView(o)[0]=Ss;var a=this.indexBuffer.getView(o);_s(n,a);var l=this.colorBuffer.getView(o);Ea([0,0,0],1,l);var u=this.transformBuffer.getMatrixView(o);this.setTransformMatrix(r,u,s),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:"drawNode",value:function(r,n,i){var s=this.simpleShapeOptions.get(i);if(this._isVisible(r,s)){var o=s.shapeProps,a=this._getVertTypeForShape(r,o.shape);if(a===void 0||s.isSimple&&!s.isSimple(r,this.renderTarget)){this.drawTexture(r,n,i);return}var l=this.instanceCount;if(this.vertTypeBuffer.getView(l)[0]=a,a===tc||a===Wo){var u=s.getBoundingBox(r),c=this._getCornerRadius(r,o.radius,u),h=this.cornerRadiusBuffer.getView(l);h[0]=c,h[1]=c,h[2]=c,h[3]=c,a===Wo&&(h[0]=0,h[2]=0)}var g=this.indexBuffer.getView(l);_s(n,g);var p=this.renderTarget.picking?1:i==="node-body"?r.effectiveOpacity():1,x=this.renderTarget.picking?1:r.pstyle(o.opacity).value*p,w=r.pstyle(o.color).value,v=this.colorBuffer.getView(l);Ea(w,x,v);var m=this.lineWidthBuffer.getView(l);if(m[0]=0,m[1]=0,o.border){var y=r.pstyle("border-width").value;if(y>0){var b=r.pstyle("border-color").value,_=p*r.pstyle("border-opacity").value,R=this.borderColorBuffer.getView(l);Ea(b,_,R);var E=r.pstyle("border-position").value;if(E==="inside")m[0]=0,m[1]=-y;else if(E==="outside")m[0]=y,m[1]=0;else{var T=y/2;m[0]=T,m[1]=-T}}}var k=this.transformBuffer.getMatrixView(l);this.setTransformMatrix(r,k,s),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:"_getVertTypeForShape",value:function(r,n){var i=r.pstyle(n).value;switch(i){case"rectangle":return Ss;case"ellipse":return Vo;case"roundrectangle":case"round-rectangle":return tc;case"bottom-round-rectangle":return Wo;default:return}}},{key:"_getCornerRadius",value:function(r,n,i){var s=i.w,o=i.h;if(r.pstyle(n).value==="auto")return Ji(s,o);var a=r.pstyle(n).pfValue,l=s/2,u=o/2;return Math.min(a,u,l)}},{key:"drawEdgeArrow",value:function(r,n,i){if(r.visible()){var s=r._private.rscratch,o,a,l;if(i==="source"?(o=s.arrowStartX,a=s.arrowStartY,l=s.srcArrowAngle):(o=s.arrowEndX,a=s.arrowEndY,l=s.tgtArrowAngle),!(isNaN(o)||o==null||isNaN(a)||a==null||isNaN(l)||l==null)){var u=r.pstyle(i+"-arrow-shape").value;if(u!=="none"){var c=r.pstyle(i+"-arrow-color").value,h=r.pstyle("opacity").value,g=r.pstyle("line-opacity").value,p=h*g,x=r.pstyle("width").pfValue,w=r.pstyle("arrow-scale").value,v=this.r.getArrowWidth(x,w),m=this.instanceCount,y=this.transformBuffer.getMatrixView(m);F1(y),yc(y,y,[o,a]),Cv(y,y,[v,v]),j1(y,y,l),this.vertTypeBuffer.getView(m)[0]=Ap;var b=this.indexBuffer.getView(m);_s(n,b);var _=this.colorBuffer.getView(m);Ea(c,p,_),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"drawEdgeLine",value:function(r,n){if(r.visible()){var i=this._getEdgePoints(r);if(i){var s=r.pstyle("opacity").value,o=r.pstyle("line-opacity").value,a=r.pstyle("width").pfValue,l=r.pstyle("line-color").value,u=s*o;if(i.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),i.length==4){var c=this.instanceCount;this.vertTypeBuffer.getView(c)[0]=z1;var h=this.indexBuffer.getView(c);_s(n,h);var g=this.colorBuffer.getView(c);Ea(l,u,g);var p=this.lineWidthBuffer.getView(c);p[0]=a;var x=this.pointAPointBBuffer.getView(c);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 w=0;w<i.length-2;w+=2){var v=this.instanceCount;this.vertTypeBuffer.getView(v)[0]=H1;var m=this.indexBuffer.getView(v);_s(n,m);var y=this.colorBuffer.getView(v);Ea(l,u,y);var b=this.lineWidthBuffer.getView(v);b[0]=a;var _=i[w-2],R=i[w-1],E=i[w],T=i[w+1],k=i[w+2],N=i[w+3],M=i[w+4],B=i[w+5];w==0&&(_=2*E-k+.001,R=2*T-N+.001),w==i.length-4&&(M=2*k-E+.001,B=2*N-T+.001);var A=this.pointAPointBBuffer.getView(v);A[0]=_,A[1]=R,A[2]=E,A[3]=T;var j=this.pointCPointDBuffer.getView(v);j[0]=k,j[1]=N,j[2]=M,j[3]=B,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"_isValidEdge",value:function(r){var n=r._private.rscratch;return!(n.badLine||n.allpts==null||isNaN(n.allpts[0]))}},{key:"_getEdgePoints",value:function(r){var n=r._private.rscratch;if(this._isValidEdge(r)){var i=n.allpts;if(i.length==4)return i;var s=this._getNumSegments(r);return this._getCurveSegmentPoints(i,s)}}},{key:"_getNumSegments",value:function(r){var n=15;return Math.min(Math.max(n,5),this.maxInstances)}},{key:"_getCurveSegmentPoints",value:function(r,n){if(r.length==4)return r;for(var i=Array((n+1)*2),s=0;s<=n;s++)if(s==0)i[0]=r[0],i[1]=r[1];else if(s==n)i[s*2]=r[r.length-2],i[s*2+1]=r[r.length-1];else{var o=s/n;this._setCurvePoint(r,o,i,s*2)}return i}},{key:"_setCurvePoint",value:function(r,n,i,s){if(r.length<=2)i[s]=r[0],i[s+1]=r[1];else{for(var o=Array(r.length-2),a=0;a<o.length;a+=2){var l=(1-n)*r[a]+n*r[a+2],u=(1-n)*r[a+1]+n*r[a+3];o[a]=l,o[a+1]=u}return this._setCurvePoint(o,n,i,s)}}},{key:"endBatch",value:function(){var r=this.gl,n=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(n);var a=on(this.buffers),l;try{for(a.s();!(l=a.n()).done;){var u=l.value;u.bufferSubData(s)}}catch(x){a.e(x)}finally{a.f()}for(var c=this.batchManager.getAtlases(),h=0;h<c.length;h++)c[h].bufferIfNeeded(r);for(var g=0;g<c.length;g++)r.activeTexture(r.TEXTURE0+g),r.bindTexture(r.TEXTURE_2D,c[g].texture),r.uniform1i(o.uTextures[g],g);r.uniform1f(o.uZoom,rD(this.r)),r.uniformMatrix3fv(o.uPanZoomMatrix,!1,this.panZoomMatrix),r.uniform1i(o.uAtlasSize,this.batchManager.getAtlasSize());var p=Ea(this.bgColor,1);r.uniform4fv(o.uBGColor,p),r.drawArraysInstanced(r.TRIANGLES,0,i,s),r.bindVertexArray(null),r.bindTexture(r.TEXTURE_2D,null),this.debug&&this.batchDebugInfo.push({count:s,atlasCount:c.length}),this.startBatch()}}},{key:"getDebugInfo",value:function(){var r=this.atlasManager.getDebugInfo(),n=r.reduce(function(o,a){return o+a.atlasCount},0),i=this.batchDebugInfo,s=i.reduce(function(o,a){return o+a.count},0);return{atlasInfo:r,totalAtlases:n,wrappedCount:this.wrappedCount,simpleCount:this.simpleCount,batchCount:i.length,batchInfo:i,totalInstances:s}}}])})(),z_={};z_.initWebgl=function(t,e){var r=this,n=r.data.contexts[r.WEBGL];t.bgColor=CD(r),t.webglTexSize=Math.min(t.webglTexSize,n.getParameter(n.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,n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS)),r.webglDebug=t.webglDebug,r.webglDebugShowAtlases=t.webglDebugShowAtlases,r.pickingFrameBuffer=hD(n),r.pickingFrameBuffer.needsDraw=!0,r.drawing=new SD(r,n,t);var i=function(h){return function(g){return r.getTextAngle(g,h)}},s=function(h){return function(g){var p=g.pstyle(h);return p&&p.value}},o=function(h){return function(g){return g.pstyle("".concat(h,"-opacity")).value>0}},a=function(h){var g=h.pstyle("text-events").strValue==="yes";return g?Oc.USE_BB:Oc.IGNORE},l=function(h){var g=h.position(),p=g.x,x=g.y,w=h.outerWidth(),v=h.outerHeight();return{w,h:v,x1:p-w/2,y1:x-v/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:l,isSimple:iD,shapeProps:{shape:"shape",color:"background-color",opacity:"background-opacity",radius:"corner-radius",border:!0}}),r.drawing.addSimpleShapeRenderType("node-overlay",{getBoundingBox:l,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:l,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:a,getKey:Mp(e.getLabelKey,null),getBoundingBox:Pp(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:a,getKey:Mp(e.getSourceLabelKey,"source"),getBoundingBox:Pp(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:a,getKey:Mp(e.getTargetLabelKey,"target"),getBoundingBox:Pp(e.getTargetLabelBox,"target"),drawClipped:!0,drawElement:e.drawTargetLabel,getRotation:i("target"),getRotationPoint:e.getTargetLabelRotationPoint,getRotationOffset:e.getTargetLabelRotationOffset,isVisible:s("target-label")});var u=kl(function(){console.log("garbage collect flag set"),r.data.gc=!0},1e4);r.onUpdateEleCalcs(function(c,h){var g=!1;h&&h.length>0&&(g|=r.drawing.invalidate(h)),g&&u()}),ED(r)};function CD(t){var e=t.cy.container(),r=e&&e.style&&e.style.backgroundColor||"white";return dw(r)}function H_(t,e){var r=t._private.rscratch;return Yr(r,"labelWrapCachedLines",e)||[]}var Mp=function(e,r){return function(n){var i=e(n),s=H_(n,r);return s.length>1?s.map(function(o,a){return"".concat(i,"_").concat(a)}):i}},Pp=function(e,r){return function(n,i){var s=e(n);if(typeof i=="string"){var o=i.indexOf("_");if(o>0){var a=Number(i.substring(o+1)),l=H_(n,r),u=s.h/l.length,c=u*a,h=s.y1+c;return{x1:s.x1,w:s.w,y1:h,h:u,yOffset:c}}}return s}};function ED(t){{var e=t.render;t.render=function(s){s=s||{};var o=t.cy;t.webgl&&(o.zoom()>M_?(kD(t),e.call(t,s)):(TD(t),W_(t,s,il.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,a,l){return MD(t,s,o)};{var n=t.invalidateCachedZSortedEles;t.invalidateCachedZSortedEles=function(){n.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 kD(t){var e=t.data.contexts[t.WEBGL];e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)}function TD(t){var e=function(n){n.save(),n.setTransform(1,0,0,1,0,0),n.clearRect(0,0,t.canvasWidth,t.canvasHeight),n.restore()};e(t.data.contexts[t.NODE]),e(t.data.contexts[t.DRAG])}function RD(t){var e=t.canvasWidth,r=t.canvasHeight,n=pg(t),i=n.pan,s=n.zoom,o=Np();yc(o,o,[i.x,i.y]),Cv(o,o,[s,s]);var a=Np();dD(a,e,r);var l=Np();return fD(l,a,o),l}function U_(t,e){var r=t.canvasWidth,n=t.canvasHeight,i=pg(t),s=i.pan,o=i.zoom;e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,r,n),e.translate(s.x,s.y),e.scale(o,o)}function LD(t,e){t.drawSelectionRectangle(e,function(r){return U_(t,r)})}function ND(t){var e=t.data.contexts[t.NODE];e.save(),U_(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 DD(t){var e=function(i,s,o){for(var a=i.atlasManager.getAtlasCollection(s),l=t.data.contexts[t.NODE],u=a.atlases,c=0;c<u.length;c++){var h=u[c],g=h.canvas;if(g){var p=g.width,x=g.height,w=p*c,v=g.height*o,m=.4;l.save(),l.scale(m,m),l.drawImage(g,w,v),l.strokeStyle="black",l.rect(w,v,p,x),l.stroke(),l.restore()}}},r=0;e(t.drawing,"node",r++),e(t.drawing,"label",r++)}function AD(t,e,r,n,i){var s,o,a,l,u=pg(t),c=u.pan,h=u.zoom;{var g=nD(t,c,h,e,r),p=pr(g,2),x=p[0],w=p[1],v=6;s=x-v/2,o=w-v/2,a=v,l=v}if(a===0||l===0)return[];var m=t.data.contexts[t.WEBGL];m.bindFramebuffer(m.FRAMEBUFFER,t.pickingFrameBuffer),t.pickingFrameBuffer.needsDraw&&(m.viewport(0,0,m.canvas.width,m.canvas.height),W_(t,null,il.PICKING),t.pickingFrameBuffer.needsDraw=!1);var y=a*l,b=new Uint8Array(y*4);m.readPixels(s,o,a,l,m.RGBA,m.UNSIGNED_BYTE,b),m.bindFramebuffer(m.FRAMEBUFFER,null);for(var _=new Set,R=0;R<y;R++){var E=b.slice(R*4,R*4+4),T=sD(E)-1;T>=0&&_.add(T)}return _}function MD(t,e,r){var n=AD(t,e,r),i=t.getCachedZSortedEles(),s,o,a=on(n),l;try{for(a.s();!(l=a.n()).done;){var u=l.value,c=i[u];if(!s&&c.isNode()&&(s=c),!o&&c.isEdge()&&(o=c),s&&o)break}}catch(h){a.e(h)}finally{a.f()}return[s,o].filter(Boolean)}function Ip(t,e,r){var n=t.drawing;e+=1,r.isNode()?(n.drawNode(r,e,"node-underlay"),n.drawNode(r,e,"node-body"),n.drawTexture(r,e,"label"),n.drawNode(r,e,"node-overlay")):(n.drawEdgeLine(r,e),n.drawEdgeArrow(r,e,"source"),n.drawEdgeArrow(r,e,"target"),n.drawTexture(r,e,"label"),n.drawTexture(r,e,"edge-source-label"),n.drawTexture(r,e,"edge-target-label"))}function W_(t,e,r){var n;t.webglDebug&&(n=performance.now());var i=t.drawing,s=0;if(r.screen&&t.data.canvasNeedsRedraw[t.SELECT_BOX]&&LD(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 a=RD(t),l=t.getCachedZSortedEles();if(s=l.length,i.startFrame(a,r),r.screen){for(var u=0;u<l.nondrag.length;u++)Ip(t,u,l.nondrag[u]);for(var c=0;c<l.drag.length;c++)Ip(t,c,l.drag[c])}else if(r.picking)for(var h=0;h<l.length;h++)Ip(t,h,l[h]);i.endFrame(),r.screen&&t.webglDebugShowAtlases&&(ND(t),DD(t)),t.data.canvasNeedsRedraw[t.NODE]=!1,t.data.canvasNeedsRedraw[t.DRAG]=!1}if(t.webglDebug){var g=performance.now(),p=!1,x=Math.ceil(g-n),w=i.getDebugInfo(),v=["".concat(s," elements"),"".concat(w.totalInstances," instances"),"".concat(w.batchCount," batches"),"".concat(w.totalAtlases," atlases"),"".concat(w.wrappedCount," wrapped textures"),"".concat(w.simpleCount," simple shapes")].join(", ");if(p)console.log("WebGL (".concat(r.name,") - time ").concat(x,"ms, ").concat(v));else{console.log("WebGL (".concat(r.name,") - frame time ").concat(x,"ms")),console.log("Totals:"),console.log(" ".concat(v)),console.log("Texture Atlases Used:");var m=w.atlasInfo,y=on(m),b;try{for(y.s();!(b=y.n()).done;){var _=b.value;console.log(" ".concat(_.type,": ").concat(_.keyCount," keys, ").concat(_.atlasCount," atlases"))}}catch(R){y.e(R)}finally{y.f()}console.log("")}}t.data.gc&&(console.log("Garbage Collect!"),t.data.gc=!1,i.gc())}var la={};la.drawPolygonPath=function(t,e,r,n,i,s){var o=n/2,a=i/2;t.beginPath&&t.beginPath(),t.moveTo(e+o*s[0],r+a*s[1]);for(var l=1;l<s.length/2;l++)t.lineTo(e+o*s[l*2],r+a*s[l*2+1]);t.closePath()};la.drawRoundPolygonPath=function(t,e,r,n,i,s,o){o.forEach(function(a){return S_(t,a)}),t.closePath()};la.drawRoundRectanglePath=function(t,e,r,n,i,s){var o=n/2,a=i/2,l=s==="auto"?Ji(n,i):Math.min(s,a,o);t.beginPath&&t.beginPath(),t.moveTo(e,r-a),t.arcTo(e+o,r-a,e+o,r,l),t.arcTo(e+o,r+a,e,r+a,l),t.arcTo(e-o,r+a,e-o,r,l),t.arcTo(e-o,r-a,e,r-a,l),t.lineTo(e,r-a),t.closePath()};la.drawBottomRoundRectanglePath=function(t,e,r,n,i,s){var o=n/2,a=i/2,l=s==="auto"?Ji(n,i):s;t.beginPath&&t.beginPath(),t.moveTo(e,r-a),t.lineTo(e+o,r-a),t.lineTo(e+o,r),t.arcTo(e+o,r+a,e,r+a,l),t.arcTo(e-o,r+a,e-o,r,l),t.lineTo(e-o,r-a),t.lineTo(e,r-a),t.closePath()};la.drawCutRectanglePath=function(t,e,r,n,i,s,o){var a=n/2,l=i/2,u=o==="auto"?eg():o;t.beginPath&&t.beginPath(),t.moveTo(e-a+u,r-l),t.lineTo(e+a-u,r-l),t.lineTo(e+a,r-l+u),t.lineTo(e+a,r+l-u),t.lineTo(e+a-u,r+l),t.lineTo(e-a+u,r+l),t.lineTo(e-a,r+l-u),t.lineTo(e-a,r-l+u),t.closePath()};la.drawBarrelPath=function(t,e,r,n,i){var s=n/2,o=i/2,a=e-s,l=e+s,u=r-o,c=r+o,h=cv(n,i),g=h.widthOffset,p=h.heightOffset,x=h.ctrlPtOffsetPct*g;t.beginPath&&t.beginPath(),t.moveTo(a,u+p),t.lineTo(a,c-p),t.quadraticCurveTo(a+x,c,a+g,c),t.lineTo(l-g,c),t.quadraticCurveTo(l-x,c,l,c-p),t.lineTo(l,u+p),t.quadraticCurveTo(l-x,u,l-g,u),t.lineTo(a+g,u),t.quadraticCurveTo(a+x,u,a,u+p),t.closePath()};var U1=Math.sin(0),W1=Math.cos(0),Ev={},kv={},V_=Math.PI/40;for(var Cs=0*Math.PI;Cs<2*Math.PI;Cs+=V_)Ev[Cs]=Math.sin(Cs),kv[Cs]=Math.cos(Cs);la.drawEllipsePath=function(t,e,r,n,i){if(t.beginPath&&t.beginPath(),t.ellipse)t.ellipse(e,r,n/2,i/2,0,0,2*Math.PI);else for(var s,o,a=n/2,l=i/2,u=0*Math.PI;u<2*Math.PI;u+=V_)s=e-a*Ev[u]*U1+a*kv[u]*W1,o=r+l*kv[u]*U1+l*Ev[u]*W1,u===0?t.moveTo(s,o):t.lineTo(s,o);t.closePath()};var Al={};Al.createBuffer=function(t,e){var r=document.createElement("canvas");return r.width=t,r.height=e,[r,r.getContext("2d")]};Al.bufferCanvasImage=function(t){var e=this.cy,r=e.mutableElements(),n=r.boundingBox(),i=this.findContainerClientCoords(),s=t.full?Math.ceil(n.w):i[2],o=t.full?Math.ceil(n.h):i[3],a=Xe(t.maxWidth)||Xe(t.maxHeight),l=this.getPixelRatio(),u=1;if(t.scale!==void 0)s*=t.scale,o*=t.scale,u=t.scale;else if(a){var c=1/0,h=1/0;Xe(t.maxWidth)&&(c=u*t.maxWidth/s),Xe(t.maxHeight)&&(h=u*t.maxHeight/o),u=Math.min(c,h),s*=u,o*=u}a||(s*=l,o*=l,u*=l);var g=document.createElement("canvas");g.width=s,g.height=o,g.style.width=s+"px",g.style.height=o+"px";var p=g.getContext("2d");if(s>0&&o>0){p.clearRect(0,0,s,o),p.globalCompositeOperation="source-over";var x=this.getCachedZSortedEles();if(t.full)p.translate(-n.x1*u,-n.y1*u),p.scale(u,u),this.drawElements(p,x),p.scale(1/u,1/u),p.translate(n.x1*u,n.y1*u);else{var w=e.pan(),v={x:w.x*u,y:w.y*u};u*=e.zoom(),p.translate(v.x,v.y),p.scale(u,u),this.drawElements(p,x),p.scale(1/u,1/u),p.translate(-v.x,-v.y)}t.bg&&(p.globalCompositeOperation="destination-over",p.fillStyle=t.bg,p.rect(0,0,s,o),p.fill())}return g};function PD(t,e){for(var r=atob(t),n=new ArrayBuffer(r.length),i=new Uint8Array(n),s=0;s<r.length;s++)i[s]=r.charCodeAt(s);return new Blob([n],{type:e})}function V1(t){var e=t.indexOf(",");return t.substr(e+1)}function $_(t,e,r){var n=function(){return e.toDataURL(r,t.quality)};switch(t.output){case"blob-promise":return new qs(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 PD(V1(n()),r);case"base64":return V1(n());case"base64uri":default:return n()}}Al.png=function(t){return $_(t,this.bufferCanvasImage(t),"image/png")};Al.jpg=function(t){return $_(t,this.bufferCanvasImage(t),"image/jpeg")};var G_={};G_.nodeShapeImpl=function(t,e,r,n,i,s,o,a){switch(t){case"ellipse":return this.drawEllipsePath(e,r,n,i,s);case"polygon":return this.drawPolygonPath(e,r,n,i,s,o);case"round-polygon":return this.drawRoundPolygonPath(e,r,n,i,s,o,a);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(e,r,n,i,s,a);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(e,r,n,i,s,o,a);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(e,r,n,i,s,a);case"barrel":return this.drawBarrelPath(e,r,n,i,s)}};var ID=q_,bt=q_.prototype;bt.CANVAS_LAYERS=3;bt.SELECT_BOX=0;bt.DRAG=1;bt.NODE=2;bt.WEBGL=3;bt.CANVAS_TYPES=["2d","2d","2d","webgl2"];bt.BUFFER_COUNT=3;bt.TEXTURE_BUFFER=0;bt.MOTIONBLUR_BUFFER_NODE=1;bt.MOTIONBLUR_BUFFER_DRAG=2;function q_(t){var e=this,r=e.cy.window(),n=r.document;t.webgl&&(bt.CANVAS_LAYERS=e.CANVAS_LAYERS=4,console.log("webgl rendering enabled")),e.data={canvases:new Array(bt.CANVAS_LAYERS),contexts:new Array(bt.CANVAS_LAYERS),canvasNeedsRedraw:new Array(bt.CANVAS_LAYERS),bufferCanvases:new Array(bt.BUFFER_COUNT),bufferContexts:new Array(bt.CANVAS_LAYERS)};var i="-webkit-tap-highlight-color",s="rgba(0,0,0,0)";e.data.canvasContainer=n.createElement("div");var o=e.data.canvasContainer.style;e.data.canvasContainer.style[i]=s,o.position="relative",o.zIndex="0",o.overflow="hidden";var a=t.cy.container();a.appendChild(e.data.canvasContainer),a.style[i]=s;var l={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};kk()&&(l["-ms-touch-action"]="none",l["touch-action"]="none");for(var u=0;u<bt.CANVAS_LAYERS;u++){var c=e.data.canvases[u]=n.createElement("canvas"),h=bt.CANVAS_TYPES[u];e.data.contexts[u]=c.getContext(h),e.data.contexts[u]||Jt("Could not create canvas of type "+h),Object.keys(l).forEach(function(K){c.style[K]=l[K]}),c.style.position="absolute",c.setAttribute("data-id","layer"+u),c.style.zIndex=String(bt.CANVAS_LAYERS-u),e.data.canvasContainer.appendChild(c),e.data.canvasNeedsRedraw[u]=!1}e.data.topCanvas=e.data.canvases[0],e.data.canvases[bt.NODE].setAttribute("data-id","layer"+bt.NODE+"-node"),e.data.canvases[bt.SELECT_BOX].setAttribute("data-id","layer"+bt.SELECT_BOX+"-selectbox"),e.data.canvases[bt.DRAG].setAttribute("data-id","layer"+bt.DRAG+"-drag"),e.data.canvases[bt.WEBGL]&&e.data.canvases[bt.WEBGL].setAttribute("data-id","layer"+bt.WEBGL+"-webgl");for(var u=0;u<bt.BUFFER_COUNT;u++)e.data.bufferCanvases[u]=n.createElement("canvas"),e.data.bufferContexts[u]=e.data.bufferCanvases[u].getContext("2d"),e.data.bufferCanvases[u].style.position="absolute",e.data.bufferCanvases[u].setAttribute("data-id","buffer"+u),e.data.bufferCanvases[u].style.zIndex=String(-u-1),e.data.bufferCanvases[u].style.visibility="hidden";e.pathsEnabled=!0;var g=Kr(),p=function(X){return{x:(X.x1+X.x2)/2,y:(X.y1+X.y2)/2}},x=function(X){return{x:-X.w/2,y:-X.h/2}},w=function(X){var J=X[0]._private,ie=J.oldBackgroundTimestamp===J.backgroundTimestamp;return!ie},v=function(X){return X[0]._private.nodeKey},m=function(X){return X[0]._private.labelStyleKey},y=function(X){return X[0]._private.sourceLabelStyleKey},b=function(X){return X[0]._private.targetLabelStyleKey},_=function(X,J,ie,ce,de){return e.drawElement(X,J,ie,!1,!1,de)},R=function(X,J,ie,ce,de){return e.drawElementText(X,J,ie,ce,"main",de)},E=function(X,J,ie,ce,de){return e.drawElementText(X,J,ie,ce,"source",de)},T=function(X,J,ie,ce,de){return e.drawElementText(X,J,ie,ce,"target",de)},k=function(X){return X.boundingBox(),X[0]._private.bodyBounds},N=function(X){return X.boundingBox(),X[0]._private.labelBounds.main||g},M=function(X){return X.boundingBox(),X[0]._private.labelBounds.source||g},B=function(X){return X.boundingBox(),X[0]._private.labelBounds.target||g},A=function(X,J){return J},j=function(X){return p(k(X))},D=function(X,J,ie){var ce=X?X+"-":"";return{x:J.x+ie.pstyle(ce+"text-margin-x").pfValue,y:J.y+ie.pstyle(ce+"text-margin-y").pfValue}},I=function(X,J,ie){var ce=X[0]._private.rscratch;return{x:ce[J],y:ce[ie]}},U=function(X){return D("",I(X,"labelX","labelY"),X)},W=function(X){return D("source",I(X,"sourceLabelX","sourceLabelY"),X)},H=function(X){return D("target",I(X,"targetLabelX","targetLabelY"),X)},z=function(X){return x(k(X))},P=function(X){return x(M(X))},F=function(X){return x(B(X))},G=function(X){var J=N(X),ie=x(N(X));if(X.isNode()){switch(Us(X.pstyle("text-halign").value)){case"left":ie.x=-J.w-(J.leftPad||0);break;case"right":ie.x=-(J.rightPad||0);break}switch(Ws(X.pstyle("text-valign").value)){case"top":ie.y=-J.h-(J.topPad||0);break;case"bottom":ie.y=-(J.botPad||0);break}}return ie},$=e.data.eleTxrCache=new el(e,{getKey:v,doesEleInvalidateKey:w,drawElement:_,getBoundingBox:k,getRotationPoint:j,getRotationOffset:z,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),ee=e.data.lblTxrCache=new el(e,{getKey:m,drawElement:R,getBoundingBox:N,getRotationPoint:U,getRotationOffset:G,isVisible:A}),re=e.data.slbTxrCache=new el(e,{getKey:y,drawElement:E,getBoundingBox:M,getRotationPoint:W,getRotationOffset:P,isVisible:A}),ne=e.data.tlbTxrCache=new el(e,{getKey:b,drawElement:T,getBoundingBox:B,getRotationPoint:H,getRotationOffset:F,isVisible:A}),Y=e.data.lyrTxrCache=new P_(e);e.onUpdateEleCalcs(function(X,J){$.invalidateElements(J),ee.invalidateElements(J),re.invalidateElements(J),ne.invalidateElements(J),Y.invalidateElements(J);for(var ie=0;ie<J.length;ie++){var ce=J[ie]._private;ce.oldBackgroundTimestamp=ce.backgroundTimestamp}});var q=function(X){for(var J=0;J<X.length;J++)Y.enqueueElementRefinement(X[J].ele)};$.onDequeue(q),ee.onDequeue(q),re.onDequeue(q),ne.onDequeue(q),t.webgl&&e.initWebgl(t,{getStyleKey:v,getLabelKey:m,getSourceLabelKey:y,getTargetLabelKey:b,drawElement:_,drawLabel:R,drawSourceLabel:E,drawTargetLabel:T,getElementBox:k,getLabelBox:N,getSourceLabelBox:M,getTargetLabelBox:B,getElementRotationPoint:j,getElementRotationOffset:z,getLabelRotationPoint:U,getSourceLabelRotationPoint:W,getTargetLabelRotationPoint:H,getLabelRotationOffset:G,getSourceLabelRotationOffset:P,getTargetLabelRotationOffset:F})}bt.redrawHint=function(t,e){var r=this;switch(t){case"eles":r.data.canvasNeedsRedraw[bt.NODE]=e;break;case"drag":r.data.canvasNeedsRedraw[bt.DRAG]=e;break;case"select":r.data.canvasNeedsRedraw[bt.SELECT_BOX]=e;break;case"gc":r.data.gc=!0;break}};var OD=typeof Path2D<"u";bt.path2dEnabled=function(t){if(t===void 0)return this.pathsEnabled;this.pathsEnabled=!!t};bt.usePaths=function(){return OD&&this.pathsEnabled};bt.setImgSmoothing=function(t,e){t.imageSmoothingEnabled!=null?t.imageSmoothingEnabled=e:(t.webkitImageSmoothingEnabled=e,t.mozImageSmoothingEnabled=e,t.msImageSmoothingEnabled=e)};bt.getImgSmoothing=function(t){return t.imageSmoothingEnabled!=null?t.imageSmoothingEnabled:t.webkitImageSmoothingEnabled||t.mozImageSmoothingEnabled||t.msImageSmoothingEnabled};bt.makeOffscreenCanvas=function(t,e){var r;if((typeof OffscreenCanvas>"u"?"undefined":xr(OffscreenCanvas))!=="undefined")r=new OffscreenCanvas(t,e);else{var n=this.cy.window(),i=n.document;r=i.createElement("canvas"),r.width=t,r.height=e}return r};[I_,ri,yi,dg,Wa,oa,Qr,z_,la,Al,G_].forEach(function(t){dt(bt,t)});var BD=[{name:"null",impl:b_},{name:"base",impl:D_},{name:"canvas",impl:ID}],FD=[{type:"layout",extensions:oN},{type:"renderer",extensions:BD}],Y_={},X_={};function K_(t,e,r){var n=r,i=function(k){Bt("Can not register `"+e+"` for `"+t+"` since `"+k+"` already exists in the prototype and can not be overridden")};if(t==="core"){if(ml.prototype[e])return i(e);ml.prototype[e]=r}else if(t==="collection"){if(Dr.prototype[e])return i(e);Dr.prototype[e]=r}else if(t==="layout"){for(var s=function(k){this.options=k,r.call(this,k),Dt(this._private)||(this._private={}),this._private.cy=k.cy,this._private.listeners=[],this.createEmitter()},o=s.prototype=Object.create(r.prototype),a=[],l=0;l<a.length;l++){var u=a[l];o[u]=o[u]||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 c=r.prototype.stop;o.stop=function(){var T=this.options;if(T&&T.animate){var k=this.animations;if(k)for(var N=0;N<k.length;N++)k[N].stop()}return c?c.call(this):this.emit("layoutstop"),this},o.destroy||(o.destroy=function(){return this}),o.cy=function(){return this._private.cy};var h=function(k){return k._private.cy},g={addEventFields:function(k,N){N.layout=k,N.cy=h(k),N.target=k},bubble:function(){return!0},parent:function(k){return h(k)}};dt(o,{createEmitter:function(){return this._private.emitter=new Jc(g,this),this},emitter:function(){return this._private.emitter},on:function(k,N){return this.emitter().on(k,N),this},one:function(k,N){return this.emitter().one(k,N),this},once:function(k,N){return this.emitter().one(k,N),this},removeListener:function(k,N){return this.emitter().removeListener(k,N),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(k,N){return this.emitter().emit(k,N),this}}),Ot.eventAliasesOn(o),n=s}else if(t==="renderer"&&e!=="null"&&e!=="base"){var p=Q_("renderer","base"),x=p.prototype,w=r,v=r.prototype,m=function(){p.apply(this,arguments),w.apply(this,arguments)},y=m.prototype;for(var b in x){var _=x[b],R=v[b]!=null;if(R)return i(b);y[b]=_}for(var E in v)y[E]=v[E];x.clientFunctions.forEach(function(T){y[T]=y[T]||function(){Jt("Renderer does not implement `renderer."+T+"()` on its prototype")}}),n=m}else if(t==="__proto__"||t==="constructor"||t==="prototype")return Jt(t+" is an illegal type to be registered, possibly lead to prototype pollutions");return pw({map:Y_,keys:[t,e],value:n})}function Q_(t,e){return vw({map:Y_,keys:[t,e]})}function jD(t,e,r,n,i){return pw({map:X_,keys:[t,e,r,n],value:i})}function zD(t,e,r,n){return vw({map:X_,keys:[t,e,r,n]})}var Tv=function(){if(arguments.length===2)return Q_.apply(null,arguments);if(arguments.length===3)return K_.apply(null,arguments);if(arguments.length===4)return zD.apply(null,arguments);if(arguments.length===5)return jD.apply(null,arguments);Jt("Invalid extension access syntax")};ml.prototype.extension=Tv;FD.forEach(function(t){t.extensions.forEach(function(e){K_(t.type,e.name,e.impl)})});var Bc=function(){if(!(this instanceof Bc))return new Bc;this.length=0},za=Bc.prototype;za.instanceString=function(){return"stylesheet"};za.selector=function(t){var e=this.length++;return this[e]={selector:t,properties:[]},this};za.css=function(t,e){var r=this.length-1;if(ut(t))this[r].properties.push({name:t,value:e});else if(Dt(t))for(var n=t,i=Object.keys(n),s=0;s<i.length;s++){var o=i[s],a=n[o];if(a!=null){var l=Er.properties[o]||Er.properties[Wc(o)];if(l!=null){var u=l.name,c=a;this[r].properties.push({name:u,value:c})}}}return this};za.style=za.css;za.generateStyle=function(t){var e=new Er(t);return this.appendToStyle(e)};za.appendToStyle=function(t){for(var e=0;e<this.length;e++){var r=this[e],n=r.selector,i=r.properties;t.selector(n);for(var s=0;s<i.length;s++){var o=i[s];t.css(o.name,o.value)}}return t};var HD="3.34.0",na=function(e){if(e===void 0&&(e={}),Dt(e))return new ml(e);if(ut(e))return Tv.apply(Tv,arguments)};na.use=function(t){var e=Array.prototype.slice.call(arguments,1);return e.unshift(na),t.apply(null,e),this};na.warnings=function(t){return _w(t)};na.version=HD;na.stylesheet=na.Stylesheet=Bc;var xc={exports:{}},bc={exports:{}},wc={exports:{}},UD=wc.exports,$1;function WD(){return $1||($1=1,(function(t,e){(function(n,i){t.exports=i()})(UD,function(){return(function(r){var n={};function i(s){if(n[s])return n[s].exports;var o=n[s]={i:s,l:!1,exports:{}};return r[s].call(o.exports,o,o.exports,i),o.l=!0,o.exports}return i.m=r,i.c=n,i.i=function(s){return s},i.d=function(s,o,a){i.o(s,o)||Object.defineProperty(s,o,{configurable:!1,enumerable:!0,get:a})},i.n=function(s){var o=s&&s.__esModule?function(){return s.default}:function(){return s};return i.d(o,"a",o),o},i.o=function(s,o){return Object.prototype.hasOwnProperty.call(s,o)},i.p="",i(i.s=28)})([(function(r,n,i){function s(){}s.QUALITY=1,s.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,s.DEFAULT_INCREMENTAL=!1,s.DEFAULT_ANIMATION_ON_LAYOUT=!0,s.DEFAULT_ANIMATION_DURING_LAYOUT=!1,s.DEFAULT_ANIMATION_PERIOD=50,s.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,s.DEFAULT_GRAPH_MARGIN=15,s.NODE_DIMENSIONS_INCLUDE_LABELS=!1,s.SIMPLE_NODE_SIZE=40,s.SIMPLE_NODE_HALF_SIZE=s.SIMPLE_NODE_SIZE/2,s.EMPTY_COMPOUND_NODE_SIZE=40,s.MIN_EDGE_LENGTH=1,s.WORLD_BOUNDARY=1e6,s.INITIAL_WORLD_BOUNDARY=s.WORLD_BOUNDARY/1e3,s.WORLD_CENTER_X=1200,s.WORLD_CENTER_Y=900,r.exports=s}),(function(r,n,i){var s=i(2),o=i(8),a=i(9);function l(c,h,g){s.call(this,g),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=g,this.bendpoints=[],this.source=c,this.target=h}l.prototype=Object.create(s.prototype);for(var u in s)l[u]=s[u];l.prototype.getSource=function(){return this.source},l.prototype.getTarget=function(){return this.target},l.prototype.isInterGraph=function(){return this.isInterGraph},l.prototype.getLength=function(){return this.length},l.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},l.prototype.getBendpoints=function(){return this.bendpoints},l.prototype.getLca=function(){return this.lca},l.prototype.getSourceInLca=function(){return this.sourceInLca},l.prototype.getTargetInLca=function(){return this.targetInLca},l.prototype.getOtherEnd=function(c){if(this.source===c)return this.target;if(this.target===c)return this.source;throw"Node is not incident with this edge"},l.prototype.getOtherEndInGraph=function(c,h){for(var g=this.getOtherEnd(c),p=h.getGraphManager().getRoot();;){if(g.getOwner()==h)return g;if(g.getOwner()==p)break;g=g.getOwner().getParent()}return null},l.prototype.updateLength=function(){var c=new Array(4);this.isOverlapingSourceAndTarget=o.getIntersection(this.target.getRect(),this.source.getRect(),c),this.isOverlapingSourceAndTarget||(this.lengthX=c[0]-c[2],this.lengthY=c[1]-c[3],Math.abs(this.lengthX)<1&&(this.lengthX=a.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=a.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},l.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=a.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=a.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},r.exports=l}),(function(r,n,i){function s(o){this.vGraphObject=o}r.exports=s}),(function(r,n,i){var s=i(2),o=i(10),a=i(13),l=i(0),u=i(16),c=i(5);function h(p,x,w,v){w==null&&v==null&&(v=x),s.call(this,v),p.graphManager!=null&&(p=p.graphManager),this.estimatedSize=o.MIN_VALUE,this.inclusionTreeDepth=o.MAX_VALUE,this.vGraphObject=v,this.edges=[],this.graphManager=p,w!=null&&x!=null?this.rect=new a(x.x,x.y,w.width,w.height):this.rect=new a}h.prototype=Object.create(s.prototype);for(var g in s)h[g]=s[g];h.prototype.getEdges=function(){return this.edges},h.prototype.getChild=function(){return this.child},h.prototype.getOwner=function(){return this.owner},h.prototype.getWidth=function(){return this.rect.width},h.prototype.setWidth=function(p){this.rect.width=p},h.prototype.getHeight=function(){return this.rect.height},h.prototype.setHeight=function(p){this.rect.height=p},h.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},h.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},h.prototype.getCenter=function(){return new c(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},h.prototype.getLocation=function(){return new c(this.rect.x,this.rect.y)},h.prototype.getRect=function(){return this.rect},h.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},h.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},h.prototype.setRect=function(p,x){this.rect.x=p.x,this.rect.y=p.y,this.rect.width=x.width,this.rect.height=x.height},h.prototype.setCenter=function(p,x){this.rect.x=p-this.rect.width/2,this.rect.y=x-this.rect.height/2},h.prototype.setLocation=function(p,x){this.rect.x=p,this.rect.y=x},h.prototype.moveBy=function(p,x){this.rect.x+=p,this.rect.y+=x},h.prototype.getEdgeListToNode=function(p){var x=[],w=this;return w.edges.forEach(function(v){if(v.target==p){if(v.source!=w)throw"Incorrect edge source!";x.push(v)}}),x},h.prototype.getEdgesBetween=function(p){var x=[],w=this;return w.edges.forEach(function(v){if(!(v.source==w||v.target==w))throw"Incorrect edge source and/or target";(v.target==p||v.source==p)&&x.push(v)}),x},h.prototype.getNeighborsList=function(){var p=new Set,x=this;return x.edges.forEach(function(w){if(w.source==x)p.add(w.target);else{if(w.target!=x)throw"Incorrect incidency!";p.add(w.source)}}),p},h.prototype.withChildren=function(){var p=new Set,x,w;if(p.add(this),this.child!=null)for(var v=this.child.getNodes(),m=0;m<v.length;m++)x=v[m],w=x.withChildren(),w.forEach(function(y){p.add(y)});return p},h.prototype.getNoOfChildren=function(){var p=0,x;if(this.child==null)p=1;else for(var w=this.child.getNodes(),v=0;v<w.length;v++)x=w[v],p+=x.getNoOfChildren();return p==0&&(p=1),p},h.prototype.getEstimatedSize=function(){if(this.estimatedSize==o.MIN_VALUE)throw"assert failed";return this.estimatedSize},h.prototype.calcEstimatedSize=function(){return this.child==null?this.estimatedSize=(this.rect.width+this.rect.height)/2:(this.estimatedSize=this.child.calcEstimatedSize(),this.rect.width=this.estimatedSize,this.rect.height=this.estimatedSize,this.estimatedSize)},h.prototype.scatter=function(){var p,x,w=-l.INITIAL_WORLD_BOUNDARY,v=l.INITIAL_WORLD_BOUNDARY;p=l.WORLD_CENTER_X+u.nextDouble()*(v-w)+w;var m=-l.INITIAL_WORLD_BOUNDARY,y=l.INITIAL_WORLD_BOUNDARY;x=l.WORLD_CENTER_Y+u.nextDouble()*(y-m)+m,this.rect.x=p,this.rect.y=x},h.prototype.updateBounds=function(){if(this.getChild()==null)throw"assert failed";if(this.getChild().getNodes().length!=0){var p=this.getChild();if(p.updateBounds(!0),this.rect.x=p.getLeft(),this.rect.y=p.getTop(),this.setWidth(p.getRight()-p.getLeft()),this.setHeight(p.getBottom()-p.getTop()),l.NODE_DIMENSIONS_INCLUDE_LABELS){var x=p.getRight()-p.getLeft(),w=p.getBottom()-p.getTop();this.labelWidth&&(this.labelPosHorizontal=="left"?(this.rect.x-=this.labelWidth,this.setWidth(x+this.labelWidth)):this.labelPosHorizontal=="center"&&this.labelWidth>x?(this.rect.x-=(this.labelWidth-x)/2,this.setWidth(this.labelWidth)):this.labelPosHorizontal=="right"&&this.setWidth(x+this.labelWidth)),this.labelHeight&&(this.labelPosVertical=="top"?(this.rect.y-=this.labelHeight,this.setHeight(w+this.labelHeight)):this.labelPosVertical=="center"&&this.labelHeight>w?(this.rect.y-=(this.labelHeight-w)/2,this.setHeight(this.labelHeight)):this.labelPosVertical=="bottom"&&this.setHeight(w+this.labelHeight))}}},h.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==o.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},h.prototype.transform=function(p){var x=this.rect.x;x>l.WORLD_BOUNDARY?x=l.WORLD_BOUNDARY:x<-l.WORLD_BOUNDARY&&(x=-l.WORLD_BOUNDARY);var w=this.rect.y;w>l.WORLD_BOUNDARY?w=l.WORLD_BOUNDARY:w<-l.WORLD_BOUNDARY&&(w=-l.WORLD_BOUNDARY);var v=new c(x,w),m=p.inverseTransformPoint(v);this.setLocation(m.x,m.y)},h.prototype.getLeft=function(){return this.rect.x},h.prototype.getRight=function(){return this.rect.x+this.rect.width},h.prototype.getTop=function(){return this.rect.y},h.prototype.getBottom=function(){return this.rect.y+this.rect.height},h.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},r.exports=h}),(function(r,n,i){var s=i(0);function o(){}for(var a in s)o[a]=s[a];o.MAX_ITERATIONS=2500,o.DEFAULT_EDGE_LENGTH=50,o.DEFAULT_SPRING_STRENGTH=.45,o.DEFAULT_REPULSION_STRENGTH=4500,o.DEFAULT_GRAVITY_STRENGTH=.4,o.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,o.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,o.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,o.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,o.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,o.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,o.COOLING_ADAPTATION_FACTOR=.33,o.ADAPTATION_LOWER_NODE_LIMIT=1e3,o.ADAPTATION_UPPER_NODE_LIMIT=5e3,o.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,o.MAX_NODE_DISPLACEMENT=o.MAX_NODE_DISPLACEMENT_INCREMENTAL*3,o.MIN_REPULSION_DIST=o.DEFAULT_EDGE_LENGTH/10,o.CONVERGENCE_CHECK_PERIOD=100,o.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,o.MIN_EDGE_LENGTH=1,o.GRID_CALCULATION_CHECK_PERIOD=10,r.exports=o}),(function(r,n,i){function s(o,a){o==null&&a==null?(this.x=0,this.y=0):(this.x=o,this.y=a)}s.prototype.getX=function(){return this.x},s.prototype.getY=function(){return this.y},s.prototype.setX=function(o){this.x=o},s.prototype.setY=function(o){this.y=o},s.prototype.getDifference=function(o){return new DimensionD(this.x-o.x,this.y-o.y)},s.prototype.getCopy=function(){return new s(this.x,this.y)},s.prototype.translate=function(o){return this.x+=o.width,this.y+=o.height,this},r.exports=s}),(function(r,n,i){var s=i(2),o=i(10),a=i(0),l=i(7),u=i(3),c=i(1),h=i(13),g=i(12),p=i(11);function x(v,m,y){s.call(this,y),this.estimatedSize=o.MIN_VALUE,this.margin=a.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=v,m!=null&&m instanceof l?this.graphManager=m:m!=null&&m instanceof Layout&&(this.graphManager=m.graphManager)}x.prototype=Object.create(s.prototype);for(var w in s)x[w]=s[w];x.prototype.getNodes=function(){return this.nodes},x.prototype.getEdges=function(){return this.edges},x.prototype.getGraphManager=function(){return this.graphManager},x.prototype.getParent=function(){return this.parent},x.prototype.getLeft=function(){return this.left},x.prototype.getRight=function(){return this.right},x.prototype.getTop=function(){return this.top},x.prototype.getBottom=function(){return this.bottom},x.prototype.isConnected=function(){return this.isConnected},x.prototype.add=function(v,m,y){if(m==null&&y==null){var b=v;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(b)>-1)throw"Node already in graph!";return b.owner=this,this.getNodes().push(b),b}else{var _=v;if(!(this.getNodes().indexOf(m)>-1&&this.getNodes().indexOf(y)>-1))throw"Source or target not in graph!";if(!(m.owner==y.owner&&m.owner==this))throw"Both owners must be this graph!";return m.owner!=y.owner?null:(_.source=m,_.target=y,_.isInterGraph=!1,this.getEdges().push(_),m.edges.push(_),y!=m&&y.edges.push(_),_)}},x.prototype.remove=function(v){var m=v;if(v instanceof u){if(m==null)throw"Node is null!";if(!(m.owner!=null&&m.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var y=m.edges.slice(),b,_=y.length,R=0;R<_;R++)b=y[R],b.isInterGraph?this.graphManager.remove(b):b.source.owner.remove(b);var E=this.nodes.indexOf(m);if(E==-1)throw"Node not in owner node list!";this.nodes.splice(E,1)}else if(v instanceof c){var b=v;if(b==null)throw"Edge is null!";if(!(b.source!=null&&b.target!=null))throw"Source and/or target is null!";if(!(b.source.owner!=null&&b.target.owner!=null&&b.source.owner==this&&b.target.owner==this))throw"Source and/or target owner is invalid!";var T=b.source.edges.indexOf(b),k=b.target.edges.indexOf(b);if(!(T>-1&&k>-1))throw"Source and/or target doesn't know this edge!";b.source.edges.splice(T,1),b.target!=b.source&&b.target.edges.splice(k,1);var E=b.source.owner.getEdges().indexOf(b);if(E==-1)throw"Not in owner's edge list!";b.source.owner.getEdges().splice(E,1)}},x.prototype.updateLeftTop=function(){for(var v=o.MAX_VALUE,m=o.MAX_VALUE,y,b,_,R=this.getNodes(),E=R.length,T=0;T<E;T++){var k=R[T];y=k.getTop(),b=k.getLeft(),v>y&&(v=y),m>b&&(m=b)}return v==o.MAX_VALUE?null:(R[0].getParent().paddingLeft!=null?_=R[0].getParent().paddingLeft:_=this.margin,this.left=m-_,this.top=v-_,new g(this.left,this.top))},x.prototype.updateBounds=function(v){for(var m=o.MAX_VALUE,y=-o.MAX_VALUE,b=o.MAX_VALUE,_=-o.MAX_VALUE,R,E,T,k,N,M=this.nodes,B=M.length,A=0;A<B;A++){var j=M[A];v&&j.child!=null&&j.updateBounds(),R=j.getLeft(),E=j.getRight(),T=j.getTop(),k=j.getBottom(),m>R&&(m=R),y<E&&(y=E),b>T&&(b=T),_<k&&(_=k)}var D=new h(m,b,y-m,_-b);m==o.MAX_VALUE&&(this.left=this.parent.getLeft(),this.right=this.parent.getRight(),this.top=this.parent.getTop(),this.bottom=this.parent.getBottom()),M[0].getParent().paddingLeft!=null?N=M[0].getParent().paddingLeft:N=this.margin,this.left=D.x-N,this.right=D.x+D.width+N,this.top=D.y-N,this.bottom=D.y+D.height+N},x.calculateBounds=function(v){for(var m=o.MAX_VALUE,y=-o.MAX_VALUE,b=o.MAX_VALUE,_=-o.MAX_VALUE,R,E,T,k,N=v.length,M=0;M<N;M++){var B=v[M];R=B.getLeft(),E=B.getRight(),T=B.getTop(),k=B.getBottom(),m>R&&(m=R),y<E&&(y=E),b>T&&(b=T),_<k&&(_=k)}var A=new h(m,b,y-m,_-b);return A},x.prototype.getInclusionTreeDepth=function(){return this==this.graphManager.getRoot()?1:this.parent.getInclusionTreeDepth()},x.prototype.getEstimatedSize=function(){if(this.estimatedSize==o.MIN_VALUE)throw"assert failed";return this.estimatedSize},x.prototype.calcEstimatedSize=function(){for(var v=0,m=this.nodes,y=m.length,b=0;b<y;b++){var _=m[b];v+=_.calcEstimatedSize()}return v==0?this.estimatedSize=a.EMPTY_COMPOUND_NODE_SIZE:this.estimatedSize=v/Math.sqrt(this.nodes.length),this.estimatedSize},x.prototype.updateConnected=function(){var v=this;if(this.nodes.length==0){this.isConnected=!0;return}var m=new p,y=new Set,b=this.nodes[0],_,R,E=b.withChildren();for(E.forEach(function(A){m.push(A),y.add(A)});m.length!==0;){b=m.shift(),_=b.getEdges();for(var T=_.length,k=0;k<T;k++){var N=_[k];if(R=N.getOtherEndInGraph(b,this),R!=null&&!y.has(R)){var M=R.withChildren();M.forEach(function(A){m.push(A),y.add(A)})}}}if(this.isConnected=!1,y.size>=this.nodes.length){var B=0;y.forEach(function(A){A.owner==v&&B++}),B==this.nodes.length&&(this.isConnected=!0)}},r.exports=x}),(function(r,n,i){var s,o=i(1);function a(l){s=i(6),this.layout=l,this.graphs=[],this.edges=[]}a.prototype.addRoot=function(){var l=this.layout.newGraph(),u=this.layout.newNode(null),c=this.add(l,u);return this.setRootGraph(c),this.rootGraph},a.prototype.add=function(l,u,c,h,g){if(c==null&&h==null&&g==null){if(l==null)throw"Graph is null!";if(u==null)throw"Parent node is null!";if(this.graphs.indexOf(l)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(l),l.parent!=null)throw"Already has a parent!";if(u.child!=null)throw"Already has a child!";return l.parent=u,u.child=l,l}else{g=c,h=u,c=l;var p=h.getOwner(),x=g.getOwner();if(!(p!=null&&p.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(x!=null&&x.getGraphManager()==this))throw"Target not in this graph mgr!";if(p==x)return c.isInterGraph=!1,p.add(c,h,g);if(c.isInterGraph=!0,c.source=h,c.target=g,this.edges.indexOf(c)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(c),!(c.source!=null&&c.target!=null))throw"Edge source and/or target is null!";if(!(c.source.edges.indexOf(c)==-1&&c.target.edges.indexOf(c)==-1))throw"Edge already in source and/or target incidency list!";return c.source.edges.push(c),c.target.edges.push(c),c}},a.prototype.remove=function(l){if(l instanceof s){var u=l;if(u.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(u==this.rootGraph||u.parent!=null&&u.parent.graphManager==this))throw"Invalid parent node!";var c=[];c=c.concat(u.getEdges());for(var h,g=c.length,p=0;p<g;p++)h=c[p],u.remove(h);var x=[];x=x.concat(u.getNodes());var w;g=x.length;for(var p=0;p<g;p++)w=x[p],u.remove(w);u==this.rootGraph&&this.setRootGraph(null);var v=this.graphs.indexOf(u);this.graphs.splice(v,1),u.parent=null}else if(l instanceof o){if(h=l,h==null)throw"Edge is null!";if(!h.isInterGraph)throw"Not an inter-graph edge!";if(!(h.source!=null&&h.target!=null))throw"Source and/or target is null!";if(!(h.source.edges.indexOf(h)!=-1&&h.target.edges.indexOf(h)!=-1))throw"Source and/or target doesn't know this edge!";var v=h.source.edges.indexOf(h);if(h.source.edges.splice(v,1),v=h.target.edges.indexOf(h),h.target.edges.splice(v,1),!(h.source.owner!=null&&h.source.owner.getGraphManager()!=null))throw"Edge owner graph or owner graph manager is null!";if(h.source.owner.getGraphManager().edges.indexOf(h)==-1)throw"Not in owner graph manager's edge list!";var v=h.source.owner.getGraphManager().edges.indexOf(h);h.source.owner.getGraphManager().edges.splice(v,1)}},a.prototype.updateBounds=function(){this.rootGraph.updateBounds(!0)},a.prototype.getGraphs=function(){return this.graphs},a.prototype.getAllNodes=function(){if(this.allNodes==null){for(var l=[],u=this.getGraphs(),c=u.length,h=0;h<c;h++)l=l.concat(u[h].getNodes());this.allNodes=l}return this.allNodes},a.prototype.resetAllNodes=function(){this.allNodes=null},a.prototype.resetAllEdges=function(){this.allEdges=null},a.prototype.resetAllNodesToApplyGravitation=function(){this.allNodesToApplyGravitation=null},a.prototype.getAllEdges=function(){if(this.allEdges==null){var l=[],u=this.getGraphs();u.length;for(var c=0;c<u.length;c++)l=l.concat(u[c].getEdges());l=l.concat(this.edges),this.allEdges=l}return this.allEdges},a.prototype.getAllNodesToApplyGravitation=function(){return this.allNodesToApplyGravitation},a.prototype.setAllNodesToApplyGravitation=function(l){if(this.allNodesToApplyGravitation!=null)throw"assert failed";this.allNodesToApplyGravitation=l},a.prototype.getRoot=function(){return this.rootGraph},a.prototype.setRootGraph=function(l){if(l.getGraphManager()!=this)throw"Root not in this graph mgr!";this.rootGraph=l,l.parent==null&&(l.parent=this.layout.newNode("Root node"))},a.prototype.getLayout=function(){return this.layout},a.prototype.isOneAncestorOfOther=function(l,u){if(!(l!=null&&u!=null))throw"assert failed";if(l==u)return!0;var c=l.getOwner(),h;do{if(h=c.getParent(),h==null)break;if(h==u)return!0;if(c=h.getOwner(),c==null)break}while(!0);c=u.getOwner();do{if(h=c.getParent(),h==null)break;if(h==l)return!0;if(c=h.getOwner(),c==null)break}while(!0);return!1},a.prototype.calcLowestCommonAncestors=function(){for(var l,u,c,h,g,p=this.getAllEdges(),x=p.length,w=0;w<x;w++){if(l=p[w],u=l.source,c=l.target,l.lca=null,l.sourceInLca=u,l.targetInLca=c,u==c){l.lca=u.getOwner();continue}for(h=u.getOwner();l.lca==null;){for(l.targetInLca=c,g=c.getOwner();l.lca==null;){if(g==h){l.lca=g;break}if(g==this.rootGraph)break;if(l.lca!=null)throw"assert failed";l.targetInLca=g.getParent(),g=l.targetInLca.getOwner()}if(h==this.rootGraph)break;l.lca==null&&(l.sourceInLca=h.getParent(),h=l.sourceInLca.getOwner())}if(l.lca==null)throw"assert failed"}},a.prototype.calcLowestCommonAncestor=function(l,u){if(l==u)return l.getOwner();var c=l.getOwner();do{if(c==null)break;var h=u.getOwner();do{if(h==null)break;if(h==c)return h;h=h.getParent().getOwner()}while(!0);c=c.getParent().getOwner()}while(!0);return c},a.prototype.calcInclusionTreeDepths=function(l,u){l==null&&u==null&&(l=this.rootGraph,u=1);for(var c,h=l.getNodes(),g=h.length,p=0;p<g;p++)c=h[p],c.inclusionTreeDepth=u,c.child!=null&&this.calcInclusionTreeDepths(c.child,u+1)},a.prototype.includesInvalidEdge=function(){for(var l,u=[],c=this.edges.length,h=0;h<c;h++)l=this.edges[h],this.isOneAncestorOfOther(l.source,l.target)&&u.push(l);for(var h=0;h<u.length;h++)this.remove(u[h]);return!1},r.exports=a}),(function(r,n,i){var s=i(12);function o(){}o.calcSeparationAmount=function(a,l,u,c){if(!a.intersects(l))throw"assert failed";var h=new Array(2);this.decideDirectionsForOverlappingNodes(a,l,h),u[0]=Math.min(a.getRight(),l.getRight())-Math.max(a.x,l.x),u[1]=Math.min(a.getBottom(),l.getBottom())-Math.max(a.y,l.y),a.getX()<=l.getX()&&a.getRight()>=l.getRight()?u[0]+=Math.min(l.getX()-a.getX(),a.getRight()-l.getRight()):l.getX()<=a.getX()&&l.getRight()>=a.getRight()&&(u[0]+=Math.min(a.getX()-l.getX(),l.getRight()-a.getRight())),a.getY()<=l.getY()&&a.getBottom()>=l.getBottom()?u[1]+=Math.min(l.getY()-a.getY(),a.getBottom()-l.getBottom()):l.getY()<=a.getY()&&l.getBottom()>=a.getBottom()&&(u[1]+=Math.min(a.getY()-l.getY(),l.getBottom()-a.getBottom()));var g=Math.abs((l.getCenterY()-a.getCenterY())/(l.getCenterX()-a.getCenterX()));l.getCenterY()===a.getCenterY()&&l.getCenterX()===a.getCenterX()&&(g=1);var p=g*u[0],x=u[1]/g;u[0]<x?x=u[0]:p=u[1],u[0]=-1*h[0]*(x/2+c),u[1]=-1*h[1]*(p/2+c)},o.decideDirectionsForOverlappingNodes=function(a,l,u){a.getCenterX()<l.getCenterX()?u[0]=-1:u[0]=1,a.getCenterY()<l.getCenterY()?u[1]=-1:u[1]=1},o.getIntersection2=function(a,l,u){var c=a.getCenterX(),h=a.getCenterY(),g=l.getCenterX(),p=l.getCenterY();if(a.intersects(l))return u[0]=c,u[1]=h,u[2]=g,u[3]=p,!0;var x=a.getX(),w=a.getY(),v=a.getRight(),m=a.getX(),y=a.getBottom(),b=a.getRight(),_=a.getWidthHalf(),R=a.getHeightHalf(),E=l.getX(),T=l.getY(),k=l.getRight(),N=l.getX(),M=l.getBottom(),B=l.getRight(),A=l.getWidthHalf(),j=l.getHeightHalf(),D=!1,I=!1;if(c===g){if(h>p)return u[0]=c,u[1]=w,u[2]=g,u[3]=M,!1;if(h<p)return u[0]=c,u[1]=y,u[2]=g,u[3]=T,!1}else if(h===p){if(c>g)return u[0]=x,u[1]=h,u[2]=k,u[3]=p,!1;if(c<g)return u[0]=v,u[1]=h,u[2]=E,u[3]=p,!1}else{var U=a.height/a.width,W=l.height/l.width,H=(p-h)/(g-c),z=void 0,P=void 0,F=void 0,G=void 0,$=void 0,ee=void 0;if(-U===H?c>g?(u[0]=m,u[1]=y,D=!0):(u[0]=v,u[1]=w,D=!0):U===H&&(c>g?(u[0]=x,u[1]=w,D=!0):(u[0]=b,u[1]=y,D=!0)),-W===H?g>c?(u[2]=N,u[3]=M,I=!0):(u[2]=k,u[3]=T,I=!0):W===H&&(g>c?(u[2]=E,u[3]=T,I=!0):(u[2]=B,u[3]=M,I=!0)),D&&I)return!1;if(c>g?h>p?(z=this.getCardinalDirection(U,H,4),P=this.getCardinalDirection(W,H,2)):(z=this.getCardinalDirection(-U,H,3),P=this.getCardinalDirection(-W,H,1)):h>p?(z=this.getCardinalDirection(-U,H,1),P=this.getCardinalDirection(-W,H,3)):(z=this.getCardinalDirection(U,H,2),P=this.getCardinalDirection(W,H,4)),!D)switch(z){case 1:G=w,F=c+-R/H,u[0]=F,u[1]=G;break;case 2:F=b,G=h+_*H,u[0]=F,u[1]=G;break;case 3:G=y,F=c+R/H,u[0]=F,u[1]=G;break;case 4:F=m,G=h+-_*H,u[0]=F,u[1]=G;break}if(!I)switch(P){case 1:ee=T,$=g+-j/H,u[2]=$,u[3]=ee;break;case 2:$=B,ee=p+A*H,u[2]=$,u[3]=ee;break;case 3:ee=M,$=g+j/H,u[2]=$,u[3]=ee;break;case 4:$=N,ee=p+-A*H,u[2]=$,u[3]=ee;break}}return!1},o.getCardinalDirection=function(a,l,u){return a>l?u:1+u%4},o.getIntersection=function(a,l,u,c){if(c==null)return this.getIntersection2(a,l,u);var h=a.x,g=a.y,p=l.x,x=l.y,w=u.x,v=u.y,m=c.x,y=c.y,b=void 0,_=void 0,R=void 0,E=void 0,T=void 0,k=void 0,N=void 0,M=void 0,B=void 0;return R=x-g,T=h-p,N=p*g-h*x,E=y-v,k=w-m,M=m*v-w*y,B=R*k-E*T,B===0?null:(b=(T*M-k*N)/B,_=(E*N-R*M)/B,new s(b,_))},o.angleOfVector=function(a,l,u,c){var h=void 0;return a!==u?(h=Math.atan((c-l)/(u-a)),u<a?h+=Math.PI:c<l&&(h+=this.TWO_PI)):c<l?h=this.ONE_AND_HALF_PI:h=this.HALF_PI,h},o.doIntersect=function(a,l,u,c){var h=a.x,g=a.y,p=l.x,x=l.y,w=u.x,v=u.y,m=c.x,y=c.y,b=(p-h)*(y-v)-(m-w)*(x-g);if(b===0)return!1;var _=((y-v)*(m-h)+(w-m)*(y-g))/b,R=((g-x)*(m-h)+(p-h)*(y-g))/b;return 0<_&&_<1&&0<R&&R<1},o.findCircleLineIntersections=function(a,l,u,c,h,g,p){var x=(u-a)*(u-a)+(c-l)*(c-l),w=2*((a-h)*(u-a)+(l-g)*(c-l)),v=(a-h)*(a-h)+(l-g)*(l-g)-p*p,m=w*w-4*x*v;if(m>=0){var y=(-w+Math.sqrt(w*w-4*x*v))/(2*x),b=(-w-Math.sqrt(w*w-4*x*v))/(2*x),_=null;return y>=0&&y<=1?[y]:b>=0&&b<=1?[b]:_}else return null},o.HALF_PI=.5*Math.PI,o.ONE_AND_HALF_PI=1.5*Math.PI,o.TWO_PI=2*Math.PI,o.THREE_PI=3*Math.PI,r.exports=o}),(function(r,n,i){function s(){}s.sign=function(o){return o>0?1:o<0?-1:0},s.floor=function(o){return o<0?Math.ceil(o):Math.floor(o)},s.ceil=function(o){return o<0?Math.floor(o):Math.ceil(o)},r.exports=s}),(function(r,n,i){function s(){}s.MAX_VALUE=2147483647,s.MIN_VALUE=-2147483648,r.exports=s}),(function(r,n,i){var s=(function(){function h(g,p){for(var x=0;x<p.length;x++){var w=p[x];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(g,w.key,w)}}return function(g,p,x){return p&&h(g.prototype,p),x&&h(g,x),g}})();function o(h,g){if(!(h instanceof g))throw new TypeError("Cannot call a class as a function")}var a=function(g){return{value:g,next:null,prev:null}},l=function(g,p,x,w){return g!==null?g.next=p:w.head=p,x!==null?x.prev=p:w.tail=p,p.prev=g,p.next=x,w.length++,p},u=function(g,p){var x=g.prev,w=g.next;return x!==null?x.next=w:p.head=w,w!==null?w.prev=x:p.tail=x,g.prev=g.next=null,p.length--,g},c=(function(){function h(g){var p=this;o(this,h),this.length=0,this.head=null,this.tail=null,g!=null&&g.forEach(function(x){return p.push(x)})}return s(h,[{key:"size",value:function(){return this.length}},{key:"insertBefore",value:function(p,x){return l(x.prev,a(p),x,this)}},{key:"insertAfter",value:function(p,x){return l(x,a(p),x.next,this)}},{key:"insertNodeBefore",value:function(p,x){return l(x.prev,p,x,this)}},{key:"insertNodeAfter",value:function(p,x){return l(x,p,x.next,this)}},{key:"push",value:function(p){return l(this.tail,a(p),null,this)}},{key:"unshift",value:function(p){return l(null,a(p),this.head,this)}},{key:"remove",value:function(p){return u(p,this)}},{key:"pop",value:function(){return u(this.tail,this).value}},{key:"popNode",value:function(){return u(this.tail,this)}},{key:"shift",value:function(){return u(this.head,this).value}},{key:"shiftNode",value:function(){return u(this.head,this)}},{key:"get_object_at",value:function(p){if(p<=this.length()){for(var x=1,w=this.head;x<p;)w=w.next,x++;return w.value}}},{key:"set_object_at",value:function(p,x){if(p<=this.length()){for(var w=1,v=this.head;w<p;)v=v.next,w++;v.value=x}}}]),h})();r.exports=c}),(function(r,n,i){function s(o,a,l){this.x=null,this.y=null,o==null&&a==null&&l==null?(this.x=0,this.y=0):typeof o=="number"&&typeof a=="number"&&l==null?(this.x=o,this.y=a):o.constructor.name=="Point"&&a==null&&l==null&&(l=o,this.x=l.x,this.y=l.y)}s.prototype.getX=function(){return this.x},s.prototype.getY=function(){return this.y},s.prototype.getLocation=function(){return new s(this.x,this.y)},s.prototype.setLocation=function(o,a,l){o.constructor.name=="Point"&&a==null&&l==null?(l=o,this.setLocation(l.x,l.y)):typeof o=="number"&&typeof a=="number"&&l==null&&(parseInt(o)==o&&parseInt(a)==a?this.move(o,a):(this.x=Math.floor(o+.5),this.y=Math.floor(a+.5)))},s.prototype.move=function(o,a){this.x=o,this.y=a},s.prototype.translate=function(o,a){this.x+=o,this.y+=a},s.prototype.equals=function(o){if(o.constructor.name=="Point"){var a=o;return this.x==a.x&&this.y==a.y}return this==o},s.prototype.toString=function(){return new s().constructor.name+"[x="+this.x+",y="+this.y+"]"},r.exports=s}),(function(r,n,i){function s(o,a,l,u){this.x=0,this.y=0,this.width=0,this.height=0,o!=null&&a!=null&&l!=null&&u!=null&&(this.x=o,this.y=a,this.width=l,this.height=u)}s.prototype.getX=function(){return this.x},s.prototype.setX=function(o){this.x=o},s.prototype.getY=function(){return this.y},s.prototype.setY=function(o){this.y=o},s.prototype.getWidth=function(){return this.width},s.prototype.setWidth=function(o){this.width=o},s.prototype.getHeight=function(){return this.height},s.prototype.setHeight=function(o){this.height=o},s.prototype.getRight=function(){return this.x+this.width},s.prototype.getBottom=function(){return this.y+this.height},s.prototype.intersects=function(o){return!(this.getRight()<o.x||this.getBottom()<o.y||o.getRight()<this.x||o.getBottom()<this.y)},s.prototype.getCenterX=function(){return this.x+this.width/2},s.prototype.getMinX=function(){return this.getX()},s.prototype.getMaxX=function(){return this.getX()+this.width},s.prototype.getCenterY=function(){return this.y+this.height/2},s.prototype.getMinY=function(){return this.getY()},s.prototype.getMaxY=function(){return this.getY()+this.height},s.prototype.getWidthHalf=function(){return this.width/2},s.prototype.getHeightHalf=function(){return this.height/2},r.exports=s}),(function(r,n,i){var s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a};function o(){}o.lastID=0,o.createID=function(a){return o.isPrimitive(a)?a:(a.uniqueID!=null||(a.uniqueID=o.getString(),o.lastID++),a.uniqueID)},o.getString=function(a){return a==null&&(a=o.lastID),"Object#"+a},o.isPrimitive=function(a){var l=typeof a>"u"?"undefined":s(a);return a==null||l!="object"&&l!="function"},r.exports=o}),(function(r,n,i){function s(w){if(Array.isArray(w)){for(var v=0,m=Array(w.length);v<w.length;v++)m[v]=w[v];return m}else return Array.from(w)}var o=i(0),a=i(7),l=i(3),u=i(1),c=i(6),h=i(5),g=i(17),p=i(29);function x(w){p.call(this),this.layoutQuality=o.QUALITY,this.createBendsAsNeeded=o.DEFAULT_CREATE_BENDS_AS_NEEDED,this.incremental=o.DEFAULT_INCREMENTAL,this.animationOnLayout=o.DEFAULT_ANIMATION_ON_LAYOUT,this.animationDuringLayout=o.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=o.DEFAULT_ANIMATION_PERIOD,this.uniformLeafNodeSizes=o.DEFAULT_UNIFORM_LEAF_NODE_SIZES,this.edgeToDummyNodes=new Map,this.graphManager=new a(this),this.isLayoutFinished=!1,this.isSubLayout=!1,this.isRemoteUse=!1,w!=null&&(this.isRemoteUse=w)}x.RANDOM_SEED=1,x.prototype=Object.create(p.prototype),x.prototype.getGraphManager=function(){return this.graphManager},x.prototype.getAllNodes=function(){return this.graphManager.getAllNodes()},x.prototype.getAllEdges=function(){return this.graphManager.getAllEdges()},x.prototype.getAllNodesToApplyGravitation=function(){return this.graphManager.getAllNodesToApplyGravitation()},x.prototype.newGraphManager=function(){var w=new a(this);return this.graphManager=w,w},x.prototype.newGraph=function(w){return new c(null,this.graphManager,w)},x.prototype.newNode=function(w){return new l(this.graphManager,w)},x.prototype.newEdge=function(w){return new u(null,null,w)},x.prototype.checkLayoutSuccess=function(){return this.graphManager.getRoot()==null||this.graphManager.getRoot().getNodes().length==0||this.graphManager.includesInvalidEdge()},x.prototype.runLayout=function(){this.isLayoutFinished=!1,this.tilingPreLayout&&this.tilingPreLayout(),this.initParameters();var w;return this.checkLayoutSuccess()?w=!1:w=this.layout(),o.ANIMATE==="during"?!1:(w&&(this.isSubLayout||this.doPostLayout()),this.tilingPostLayout&&this.tilingPostLayout(),this.isLayoutFinished=!0,w)},x.prototype.doPostLayout=function(){this.incremental||this.transform(),this.update()},x.prototype.update2=function(){if(this.createBendsAsNeeded&&(this.createBendpointsFromDummyNodes(),this.graphManager.resetAllEdges()),!this.isRemoteUse){for(var w=this.graphManager.getAllEdges(),v=0;v<w.length;v++)w[v];for(var m=this.graphManager.getRoot().getNodes(),v=0;v<m.length;v++)m[v];this.update(this.graphManager.getRoot())}},x.prototype.update=function(w){if(w==null)this.update2();else if(w instanceof l){var v=w;if(v.getChild()!=null)for(var m=v.getChild().getNodes(),y=0;y<m.length;y++)update(m[y]);if(v.vGraphObject!=null){var b=v.vGraphObject;b.update(v)}}else if(w instanceof u){var _=w;if(_.vGraphObject!=null){var R=_.vGraphObject;R.update(_)}}else if(w instanceof c){var E=w;if(E.vGraphObject!=null){var T=E.vGraphObject;T.update(E)}}},x.prototype.initParameters=function(){this.isSubLayout||(this.layoutQuality=o.QUALITY,this.animationDuringLayout=o.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=o.DEFAULT_ANIMATION_PERIOD,this.animationOnLayout=o.DEFAULT_ANIMATION_ON_LAYOUT,this.incremental=o.DEFAULT_INCREMENTAL,this.createBendsAsNeeded=o.DEFAULT_CREATE_BENDS_AS_NEEDED,this.uniformLeafNodeSizes=o.DEFAULT_UNIFORM_LEAF_NODE_SIZES),this.animationDuringLayout&&(this.animationOnLayout=!1)},x.prototype.transform=function(w){if(w==null)this.transform(new h(0,0));else{var v=new g,m=this.graphManager.getRoot().updateLeftTop();if(m!=null){v.setWorldOrgX(w.x),v.setWorldOrgY(w.y),v.setDeviceOrgX(m.x),v.setDeviceOrgY(m.y);for(var y=this.getAllNodes(),b,_=0;_<y.length;_++)b=y[_],b.transform(v)}}},x.prototype.positionNodesRandomly=function(w){if(w==null)this.positionNodesRandomly(this.getGraphManager().getRoot()),this.getGraphManager().getRoot().updateBounds(!0);else for(var v,m,y=w.getNodes(),b=0;b<y.length;b++)v=y[b],m=v.getChild(),m==null||m.getNodes().length==0?v.scatter():(this.positionNodesRandomly(m),v.updateBounds())},x.prototype.getFlatForest=function(){for(var w=[],v=!0,m=this.graphManager.getRoot().getNodes(),y=!0,b=0;b<m.length;b++)m[b].getChild()!=null&&(y=!1);if(!y)return w;var _=new Set,R=[],E=new Map,T=[];for(T=T.concat(m);T.length>0&&v;){for(R.push(T[0]);R.length>0&&v;){var k=R[0];R.splice(0,1),_.add(k);for(var N=k.getEdges(),b=0;b<N.length;b++){var M=N[b].getOtherEnd(k);if(E.get(k)!=M)if(!_.has(M))R.push(M),E.set(M,k);else{v=!1;break}}}if(!v)w=[];else{var B=[].concat(s(_));w.push(B);for(var b=0;b<B.length;b++){var A=B[b],j=T.indexOf(A);j>-1&&T.splice(j,1)}_=new Set,E=new Map}}return w},x.prototype.createDummyNodesForBendpoints=function(w){for(var v=[],m=w.source,y=this.graphManager.calcLowestCommonAncestor(w.source,w.target),b=0;b<w.bendpoints.length;b++){var _=this.newNode(null);_.setRect(new Point(0,0),new Dimension(1,1)),y.add(_);var R=this.newEdge(null);this.graphManager.add(R,m,_),v.add(_),m=_}var R=this.newEdge(null);return this.graphManager.add(R,m,w.target),this.edgeToDummyNodes.set(w,v),w.isInterGraph()?this.graphManager.remove(w):y.remove(w),v},x.prototype.createBendpointsFromDummyNodes=function(){var w=[];w=w.concat(this.graphManager.getAllEdges()),w=[].concat(s(this.edgeToDummyNodes.keys())).concat(w);for(var v=0;v<w.length;v++){var m=w[v];if(m.bendpoints.length>0){for(var y=this.edgeToDummyNodes.get(m),b=0;b<y.length;b++){var _=y[b],R=new h(_.getCenterX(),_.getCenterY()),E=m.bendpoints.get(b);E.x=R.x,E.y=R.y,_.getOwner().remove(_)}this.graphManager.add(m,m.source,m.target)}}},x.transform=function(w,v,m,y){if(m!=null&&y!=null){var b=v;if(w<=50){var _=v/m;b-=(v-_)/50*(50-w)}else{var R=v*y;b+=(R-v)/50*(w-50)}return b}else{var E,T;return w<=50?(E=9*v/500,T=v/10):(E=9*v/50,T=-8*v),E*w+T}},x.findCenterOfTree=function(w){var v=[];v=v.concat(w);var m=[],y=new Map,b=!1,_=null;(v.length==1||v.length==2)&&(b=!0,_=v[0]);for(var R=0;R<v.length;R++){var E=v[R],T=E.getNeighborsList().size;y.set(E,E.getNeighborsList().size),T==1&&m.push(E)}var k=[];for(k=k.concat(m);!b;){var N=[];N=N.concat(k),k=[];for(var R=0;R<v.length;R++){var E=v[R],M=v.indexOf(E);M>=0&&v.splice(M,1);var B=E.getNeighborsList();B.forEach(function(D){if(m.indexOf(D)<0){var I=y.get(D),U=I-1;U==1&&k.push(D),y.set(D,U)}})}m=m.concat(k),(v.length==1||v.length==2)&&(b=!0,_=v[0])}return _},x.prototype.setGraphManager=function(w){this.graphManager=w},r.exports=x}),(function(r,n,i){function s(){}s.seed=1,s.x=0,s.nextDouble=function(){return s.x=Math.sin(s.seed++)*1e4,s.x-Math.floor(s.x)},r.exports=s}),(function(r,n,i){var s=i(5);function o(a,l){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}o.prototype.getWorldOrgX=function(){return this.lworldOrgX},o.prototype.setWorldOrgX=function(a){this.lworldOrgX=a},o.prototype.getWorldOrgY=function(){return this.lworldOrgY},o.prototype.setWorldOrgY=function(a){this.lworldOrgY=a},o.prototype.getWorldExtX=function(){return this.lworldExtX},o.prototype.setWorldExtX=function(a){this.lworldExtX=a},o.prototype.getWorldExtY=function(){return this.lworldExtY},o.prototype.setWorldExtY=function(a){this.lworldExtY=a},o.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},o.prototype.setDeviceOrgX=function(a){this.ldeviceOrgX=a},o.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},o.prototype.setDeviceOrgY=function(a){this.ldeviceOrgY=a},o.prototype.getDeviceExtX=function(){return this.ldeviceExtX},o.prototype.setDeviceExtX=function(a){this.ldeviceExtX=a},o.prototype.getDeviceExtY=function(){return this.ldeviceExtY},o.prototype.setDeviceExtY=function(a){this.ldeviceExtY=a},o.prototype.transformX=function(a){var l=0,u=this.lworldExtX;return u!=0&&(l=this.ldeviceOrgX+(a-this.lworldOrgX)*this.ldeviceExtX/u),l},o.prototype.transformY=function(a){var l=0,u=this.lworldExtY;return u!=0&&(l=this.ldeviceOrgY+(a-this.lworldOrgY)*this.ldeviceExtY/u),l},o.prototype.inverseTransformX=function(a){var l=0,u=this.ldeviceExtX;return u!=0&&(l=this.lworldOrgX+(a-this.ldeviceOrgX)*this.lworldExtX/u),l},o.prototype.inverseTransformY=function(a){var l=0,u=this.ldeviceExtY;return u!=0&&(l=this.lworldOrgY+(a-this.ldeviceOrgY)*this.lworldExtY/u),l},o.prototype.inverseTransformPoint=function(a){var l=new s(this.inverseTransformX(a.x),this.inverseTransformY(a.y));return l},r.exports=o}),(function(r,n,i){function s(p){if(Array.isArray(p)){for(var x=0,w=Array(p.length);x<p.length;x++)w[x]=p[x];return w}else return Array.from(p)}var o=i(15),a=i(4),l=i(0),u=i(8),c=i(9);function h(){o.call(this),this.useSmartIdealEdgeLengthCalculation=a.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=a.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=a.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=a.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=a.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.displacementThresholdPerNode=3*a.DEFAULT_EDGE_LENGTH/100,this.coolingFactor=a.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.initialCoolingFactor=a.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.totalDisplacement=0,this.oldTotalDisplacement=0,this.maxIterations=a.MAX_ITERATIONS}h.prototype=Object.create(o.prototype);for(var g in o)h[g]=o[g];h.prototype.initParameters=function(){o.prototype.initParameters.call(this,arguments),this.totalIterations=0,this.notAnimatedIterations=0,this.useFRGridVariant=a.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION,this.grid=[]},h.prototype.calcIdealEdgeLengths=function(){for(var p,x,w,v,m,y,b,_=this.getGraphManager().getAllEdges(),R=0;R<_.length;R++)p=_[R],x=p.idealLength,p.isInterGraph&&(v=p.getSource(),m=p.getTarget(),y=p.getSourceInLca().getEstimatedSize(),b=p.getTargetInLca().getEstimatedSize(),this.useSmartIdealEdgeLengthCalculation&&(p.idealLength+=y+b-2*l.SIMPLE_NODE_SIZE),w=p.getLca().getInclusionTreeDepth(),p.idealLength+=x*a.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR*(v.getInclusionTreeDepth()+m.getInclusionTreeDepth()-2*w))},h.prototype.initSpringEmbedder=function(){var p=this.getAllNodes().length;this.incremental?(p>a.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*a.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(p-a.ADAPTATION_LOWER_NODE_LIMIT)/(a.ADAPTATION_UPPER_NODE_LIMIT-a.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-a.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=a.MAX_NODE_DISPLACEMENT_INCREMENTAL):(p>a.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(a.COOLING_ADAPTATION_FACTOR,1-(p-a.ADAPTATION_LOWER_NODE_LIMIT)/(a.ADAPTATION_UPPER_NODE_LIMIT-a.ADAPTATION_LOWER_NODE_LIMIT)*(1-a.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=a.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.displacementThresholdPerNode=3*a.DEFAULT_EDGE_LENGTH/100,this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},h.prototype.calcSpringForces=function(){for(var p=this.getAllEdges(),x,w=0;w<p.length;w++)x=p[w],this.calcSpringForce(x,x.idealLength)},h.prototype.calcRepulsionForces=function(){var p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,w,v,m,y,b=this.getAllNodes(),_;if(this.useFRGridVariant)for(this.totalIterations%a.GRID_CALCULATION_CHECK_PERIOD==1&&p&&this.updateGrid(),_=new Set,w=0;w<b.length;w++)m=b[w],this.calculateRepulsionForceOfANode(m,_,p,x),_.add(m);else for(w=0;w<b.length;w++)for(m=b[w],v=w+1;v<b.length;v++)y=b[v],m.getOwner()==y.getOwner()&&this.calcRepulsionForce(m,y)},h.prototype.calcGravitationalForces=function(){for(var p,x=this.getAllNodesToApplyGravitation(),w=0;w<x.length;w++)p=x[w],this.calcGravitationalForce(p)},h.prototype.moveNodes=function(){for(var p=this.getAllNodes(),x,w=0;w<p.length;w++)x=p[w],x.move()},h.prototype.calcSpringForce=function(p,x){var w=p.getSource(),v=p.getTarget(),m,y,b,_;if(this.uniformLeafNodeSizes&&w.getChild()==null&&v.getChild()==null)p.updateLengthSimple();else if(p.updateLength(),p.isOverlapingSourceAndTarget)return;m=p.getLength(),m!=0&&(y=p.edgeElasticity*(m-x),b=y*(p.lengthX/m),_=y*(p.lengthY/m),w.springForceX+=b,w.springForceY+=_,v.springForceX-=b,v.springForceY-=_)},h.prototype.calcRepulsionForce=function(p,x){var w=p.getRect(),v=x.getRect(),m=new Array(2),y=new Array(4),b,_,R,E,T,k,N;if(w.intersects(v)){u.calcSeparationAmount(w,v,m,a.DEFAULT_EDGE_LENGTH/2),k=2*m[0],N=2*m[1];var M=p.noOfChildren*x.noOfChildren/(p.noOfChildren+x.noOfChildren);p.repulsionForceX-=M*k,p.repulsionForceY-=M*N,x.repulsionForceX+=M*k,x.repulsionForceY+=M*N}else this.uniformLeafNodeSizes&&p.getChild()==null&&x.getChild()==null?(b=v.getCenterX()-w.getCenterX(),_=v.getCenterY()-w.getCenterY()):(u.getIntersection(w,v,y),b=y[2]-y[0],_=y[3]-y[1]),Math.abs(b)<a.MIN_REPULSION_DIST&&(b=c.sign(b)*a.MIN_REPULSION_DIST),Math.abs(_)<a.MIN_REPULSION_DIST&&(_=c.sign(_)*a.MIN_REPULSION_DIST),R=b*b+_*_,E=Math.sqrt(R),T=(p.nodeRepulsion/2+x.nodeRepulsion/2)*p.noOfChildren*x.noOfChildren/R,k=T*b/E,N=T*_/E,p.repulsionForceX-=k,p.repulsionForceY-=N,x.repulsionForceX+=k,x.repulsionForceY+=N},h.prototype.calcGravitationalForce=function(p){var x,w,v,m,y,b,_,R;x=p.getOwner(),w=(x.getRight()+x.getLeft())/2,v=(x.getTop()+x.getBottom())/2,m=p.getCenterX()-w,y=p.getCenterY()-v,b=Math.abs(m)+p.getWidth()/2,_=Math.abs(y)+p.getHeight()/2,p.getOwner()==this.graphManager.getRoot()?(R=x.getEstimatedSize()*this.gravityRangeFactor,(b>R||_>R)&&(p.gravitationForceX=-this.gravityConstant*m,p.gravitationForceY=-this.gravityConstant*y)):(R=x.getEstimatedSize()*this.compoundGravityRangeFactor,(b>R||_>R)&&(p.gravitationForceX=-this.gravityConstant*m*this.compoundGravityConstant,p.gravitationForceY=-this.gravityConstant*y*this.compoundGravityConstant))},h.prototype.isConverged=function(){var p,x=!1;return this.totalIterations>this.maxIterations/3&&(x=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),p=this.totalDisplacement<this.totalDisplacementThreshold,this.oldTotalDisplacement=this.totalDisplacement,p||x},h.prototype.animate=function(){this.animationDuringLayout&&!this.isSubLayout&&(this.notAnimatedIterations==this.animationPeriod?(this.update(),this.notAnimatedIterations=0):this.notAnimatedIterations++)},h.prototype.calcNoOfChildrenForAllNodes=function(){for(var p,x=this.graphManager.getAllNodes(),w=0;w<x.length;w++)p=x[w],p.noOfChildren=p.getNoOfChildren()},h.prototype.calcGrid=function(p){var x=0,w=0;x=parseInt(Math.ceil((p.getRight()-p.getLeft())/this.repulsionRange)),w=parseInt(Math.ceil((p.getBottom()-p.getTop())/this.repulsionRange));for(var v=new Array(x),m=0;m<x;m++)v[m]=new Array(w);for(var m=0;m<x;m++)for(var y=0;y<w;y++)v[m][y]=new Array;return v},h.prototype.addNodeToGrid=function(p,x,w){var v=0,m=0,y=0,b=0;v=parseInt(Math.floor((p.getRect().x-x)/this.repulsionRange)),m=parseInt(Math.floor((p.getRect().width+p.getRect().x-x)/this.repulsionRange)),y=parseInt(Math.floor((p.getRect().y-w)/this.repulsionRange)),b=parseInt(Math.floor((p.getRect().height+p.getRect().y-w)/this.repulsionRange));for(var _=v;_<=m;_++)for(var R=y;R<=b;R++)this.grid[_][R].push(p),p.setGridCoordinates(v,m,y,b)},h.prototype.updateGrid=function(){var p,x,w=this.getAllNodes();for(this.grid=this.calcGrid(this.graphManager.getRoot()),p=0;p<w.length;p++)x=w[p],this.addNodeToGrid(x,this.graphManager.getRoot().getLeft(),this.graphManager.getRoot().getTop())},h.prototype.calculateRepulsionForceOfANode=function(p,x,w,v){if(this.totalIterations%a.GRID_CALCULATION_CHECK_PERIOD==1&&w||v){var m=new Set;p.surrounding=new Array;for(var y,b=this.grid,_=p.startX-1;_<p.finishX+2;_++)for(var R=p.startY-1;R<p.finishY+2;R++)if(!(_<0||R<0||_>=b.length||R>=b[0].length)){for(var E=0;E<b[_][R].length;E++)if(y=b[_][R][E],!(p.getOwner()!=y.getOwner()||p==y)&&!x.has(y)&&!m.has(y)){var T=Math.abs(p.getCenterX()-y.getCenterX())-(p.getWidth()/2+y.getWidth()/2),k=Math.abs(p.getCenterY()-y.getCenterY())-(p.getHeight()/2+y.getHeight()/2);T<=this.repulsionRange&&k<=this.repulsionRange&&m.add(y)}}p.surrounding=[].concat(s(m))}for(_=0;_<p.surrounding.length;_++)this.calcRepulsionForce(p,p.surrounding[_])},h.prototype.calcRepulsionRange=function(){return 0},r.exports=h}),(function(r,n,i){var s=i(1),o=i(4);function a(u,c,h){s.call(this,u,c,h),this.idealLength=o.DEFAULT_EDGE_LENGTH,this.edgeElasticity=o.DEFAULT_SPRING_STRENGTH}a.prototype=Object.create(s.prototype);for(var l in s)a[l]=s[l];r.exports=a}),(function(r,n,i){var s=i(3),o=i(4);function a(u,c,h,g){s.call(this,u,c,h,g),this.nodeRepulsion=o.DEFAULT_REPULSION_STRENGTH,this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0,this.startX=0,this.finishX=0,this.startY=0,this.finishY=0,this.surrounding=[]}a.prototype=Object.create(s.prototype);for(var l in s)a[l]=s[l];a.prototype.setGridCoordinates=function(u,c,h,g){this.startX=u,this.finishX=c,this.startY=h,this.finishY=g},r.exports=a}),(function(r,n,i){function s(o,a){this.width=0,this.height=0,o!==null&&a!==null&&(this.height=a,this.width=o)}s.prototype.getWidth=function(){return this.width},s.prototype.setWidth=function(o){this.width=o},s.prototype.getHeight=function(){return this.height},s.prototype.setHeight=function(o){this.height=o},r.exports=s}),(function(r,n,i){var s=i(14);function o(){this.map={},this.keys=[]}o.prototype.put=function(a,l){var u=s.createID(a);this.contains(u)||(this.map[u]=l,this.keys.push(a))},o.prototype.contains=function(a){return s.createID(a),this.map[a]!=null},o.prototype.get=function(a){var l=s.createID(a);return this.map[l]},o.prototype.keySet=function(){return this.keys},r.exports=o}),(function(r,n,i){var s=i(14);function o(){this.set={}}o.prototype.add=function(a){var l=s.createID(a);this.contains(l)||(this.set[l]=a)},o.prototype.remove=function(a){delete this.set[s.createID(a)]},o.prototype.clear=function(){this.set={}},o.prototype.contains=function(a){return this.set[s.createID(a)]==a},o.prototype.isEmpty=function(){return this.size()===0},o.prototype.size=function(){return Object.keys(this.set).length},o.prototype.addAllTo=function(a){for(var l=Object.keys(this.set),u=l.length,c=0;c<u;c++)a.push(this.set[l[c]])},o.prototype.size=function(){return Object.keys(this.set).length},o.prototype.addAll=function(a){for(var l=a.length,u=0;u<l;u++){var c=a[u];this.add(c)}},r.exports=o}),(function(r,n,i){function s(){}s.multMat=function(o,a){for(var l=[],u=0;u<o.length;u++){l[u]=[];for(var c=0;c<a[0].length;c++){l[u][c]=0;for(var h=0;h<o[0].length;h++)l[u][c]+=o[u][h]*a[h][c]}}return l},s.transpose=function(o){for(var a=[],l=0;l<o[0].length;l++){a[l]=[];for(var u=0;u<o.length;u++)a[l][u]=o[u][l]}return a},s.multCons=function(o,a){for(var l=[],u=0;u<o.length;u++)l[u]=o[u]*a;return l},s.minusOp=function(o,a){for(var l=[],u=0;u<o.length;u++)l[u]=o[u]-a[u];return l},s.dotProduct=function(o,a){for(var l=0,u=0;u<o.length;u++)l+=o[u]*a[u];return l},s.mag=function(o){return Math.sqrt(this.dotProduct(o,o))},s.normalize=function(o){for(var a=[],l=this.mag(o),u=0;u<o.length;u++)a[u]=o[u]/l;return a},s.multGamma=function(o){for(var a=[],l=0,u=0;u<o.length;u++)l+=o[u];l*=-1/o.length;for(var c=0;c<o.length;c++)a[c]=l+o[c];return a},s.multL=function(o,a,l){for(var u=[],c=[],h=[],g=0;g<a[0].length;g++){for(var p=0,x=0;x<a.length;x++)p+=-.5*a[x][g]*o[x];c[g]=p}for(var w=0;w<l.length;w++){for(var v=0,m=0;m<l.length;m++)v+=l[w][m]*c[m];h[w]=v}for(var y=0;y<a.length;y++){for(var b=0,_=0;_<a[0].length;_++)b+=a[y][_]*h[_];u[y]=b}return u},r.exports=s}),(function(r,n,i){var s=(function(){function u(c,h){for(var g=0;g<h.length;g++){var p=h[g];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(c,p.key,p)}}return function(c,h,g){return h&&u(c.prototype,h),g&&u(c,g),c}})();function o(u,c){if(!(u instanceof c))throw new TypeError("Cannot call a class as a function")}var a=i(11),l=(function(){function u(c,h){o(this,u),(h!==null||h!==void 0)&&(this.compareFunction=this._defaultCompareFunction);var g=void 0;c instanceof a?g=c.size():g=c.length,this._quicksort(c,0,g-1)}return s(u,[{key:"_quicksort",value:function(h,g,p){if(g<p){var x=this._partition(h,g,p);this._quicksort(h,g,x),this._quicksort(h,x+1,p)}}},{key:"_partition",value:function(h,g,p){for(var x=this._get(h,g),w=g,v=p;;){for(;this.compareFunction(x,this._get(h,v));)v--;for(;this.compareFunction(this._get(h,w),x);)w++;if(w<v)this._swap(h,w,v),w++,v--;else return v}}},{key:"_get",value:function(h,g){return h instanceof a?h.get_object_at(g):h[g]}},{key:"_set",value:function(h,g,p){h instanceof a?h.set_object_at(g,p):h[g]=p}},{key:"_swap",value:function(h,g,p){var x=this._get(h,g);this._set(h,g,this._get(h,p)),this._set(h,p,x)}},{key:"_defaultCompareFunction",value:function(h,g){return g>h}}]),u})();r.exports=l}),(function(r,n,i){function s(){}s.svd=function(o){this.U=null,this.V=null,this.s=null,this.m=0,this.n=0,this.m=o.length,this.n=o[0].length;var a=Math.min(this.m,this.n);this.s=(function(st){for(var vt=[];st-- >0;)vt.push(0);return vt})(Math.min(this.m+1,this.n)),this.U=(function(st){var vt=function yt(Rt){if(Rt.length==0)return 0;for(var It=[],kt=0;kt<Rt[0];kt++)It.push(yt(Rt.slice(1)));return It};return vt(st)})([this.m,a]),this.V=(function(st){var vt=function yt(Rt){if(Rt.length==0)return 0;for(var It=[],kt=0;kt<Rt[0];kt++)It.push(yt(Rt.slice(1)));return It};return vt(st)})([this.n,this.n]);for(var l=(function(st){for(var vt=[];st-- >0;)vt.push(0);return vt})(this.n),u=(function(st){for(var vt=[];st-- >0;)vt.push(0);return vt})(this.m),c=!0,h=Math.min(this.m-1,this.n),g=Math.max(0,Math.min(this.n-2,this.m)),p=0;p<Math.max(h,g);p++){if(p<h){this.s[p]=0;for(var x=p;x<this.m;x++)this.s[p]=s.hypot(this.s[p],o[x][p]);if(this.s[p]!==0){o[p][p]<0&&(this.s[p]=-this.s[p]);for(var w=p;w<this.m;w++)o[w][p]/=this.s[p];o[p][p]+=1}this.s[p]=-this.s[p]}for(var v=p+1;v<this.n;v++){if((function(st,vt){return st&&vt})(p<h,this.s[p]!==0)){for(var m=0,y=p;y<this.m;y++)m+=o[y][p]*o[y][v];m=-m/o[p][p];for(var b=p;b<this.m;b++)o[b][v]+=m*o[b][p]}l[v]=o[p][v]}if((function(st,vt){return vt})(c,p<h))for(var _=p;_<this.m;_++)this.U[_][p]=o[_][p];if(p<g){l[p]=0;for(var R=p+1;R<this.n;R++)l[p]=s.hypot(l[p],l[R]);if(l[p]!==0){l[p+1]<0&&(l[p]=-l[p]);for(var E=p+1;E<this.n;E++)l[E]/=l[p];l[p+1]+=1}if(l[p]=-l[p],(function(st,vt){return st&&vt})(p+1<this.m,l[p]!==0)){for(var T=p+1;T<this.m;T++)u[T]=0;for(var k=p+1;k<this.n;k++)for(var N=p+1;N<this.m;N++)u[N]+=l[k]*o[N][k];for(var M=p+1;M<this.n;M++)for(var B=-l[M]/l[p+1],A=p+1;A<this.m;A++)o[A][M]+=B*u[A]}for(var j=p+1;j<this.n;j++)this.V[j][p]=l[j]}}var D=Math.min(this.n,this.m+1);h<this.n&&(this.s[h]=o[h][h]),this.m<D&&(this.s[D-1]=0),g+1<D&&(l[g]=o[g][D-1]),l[D-1]=0;{for(var I=h;I<a;I++){for(var U=0;U<this.m;U++)this.U[U][I]=0;this.U[I][I]=1}for(var W=h-1;W>=0;W--)if(this.s[W]!==0){for(var H=W+1;H<a;H++){for(var z=0,P=W;P<this.m;P++)z+=this.U[P][W]*this.U[P][H];z=-z/this.U[W][W];for(var F=W;F<this.m;F++)this.U[F][H]+=z*this.U[F][W]}for(var G=W;G<this.m;G++)this.U[G][W]=-this.U[G][W];this.U[W][W]=1+this.U[W][W];for(var $=0;$<W-1;$++)this.U[$][W]=0}else{for(var ee=0;ee<this.m;ee++)this.U[ee][W]=0;this.U[W][W]=1}}for(var re=this.n-1;re>=0;re--){if((function(st,vt){return st&&vt})(re<g,l[re]!==0))for(var ne=re+1;ne<a;ne++){for(var Y=0,q=re+1;q<this.n;q++)Y+=this.V[q][re]*this.V[q][ne];Y=-Y/this.V[re+1][re];for(var K=re+1;K<this.n;K++)this.V[K][ne]+=Y*this.V[K][re]}for(var X=0;X<this.n;X++)this.V[X][re]=0;this.V[re][re]=1}for(var J=D-1,ie=Math.pow(2,-52),ce=Math.pow(2,-966);D>0;){var de=void 0,Le=void 0;for(de=D-2;de>=-1&&de!==-1;de--)if(Math.abs(l[de])<=ce+ie*(Math.abs(this.s[de])+Math.abs(this.s[de+1]))){l[de]=0;break}if(de===D-2)Le=4;else{var je=void 0;for(je=D-1;je>=de&&je!==de;je--){var _e=(je!==D?Math.abs(l[je]):0)+(je!==de+1?Math.abs(l[je-1]):0);if(Math.abs(this.s[je])<=ce+ie*_e){this.s[je]=0;break}}je===de?Le=3:je===D-1?Le=1:(Le=2,de=je)}switch(de++,Le){case 1:{var ke=l[D-2];l[D-2]=0;for(var Ne=D-2;Ne>=de;Ne--){var Ee=s.hypot(this.s[Ne],ke),Me=this.s[Ne]/Ee,Pe=ke/Ee;this.s[Ne]=Ee,Ne!==de&&(ke=-Pe*l[Ne-1],l[Ne-1]=Me*l[Ne-1]);for(var De=0;De<this.n;De++)Ee=Me*this.V[De][Ne]+Pe*this.V[De][D-1],this.V[De][D-1]=-Pe*this.V[De][Ne]+Me*this.V[De][D-1],this.V[De][Ne]=Ee}}break;case 2:{var Ue=l[de-1];l[de-1]=0;for(var Ye=de;Ye<D;Ye++){var ge=s.hypot(this.s[Ye],Ue),Ce=this.s[Ye]/ge,Ae=Ue/ge;this.s[Ye]=ge,Ue=-Ae*l[Ye],l[Ye]=Ce*l[Ye];for(var Be=0;Be<this.m;Be++)ge=Ce*this.U[Be][Ye]+Ae*this.U[Be][de-1],this.U[Be][de-1]=-Ae*this.U[Be][Ye]+Ce*this.U[Be][de-1],this.U[Be][Ye]=ge}}break;case 3:{var me=Math.max(Math.max(Math.max(Math.max(Math.abs(this.s[D-1]),Math.abs(this.s[D-2])),Math.abs(l[D-2])),Math.abs(this.s[de])),Math.abs(l[de])),Z=this.s[D-1]/me,te=this.s[D-2]/me,oe=l[D-2]/me,ue=this.s[de]/me,se=l[de]/me,he=((te+Z)*(te-Z)+oe*oe)/2,pe=Z*oe*(Z*oe),be=0;(function(st,vt){return st||vt})(he!==0,pe!==0)&&(be=Math.sqrt(he*he+pe),he<0&&(be=-be),be=pe/(he+be));for(var Se=(ue+Z)*(ue-Z)+be,Te=ue*se,Re=de;Re<D-1;Re++){var ze=s.hypot(Se,Te),Fe=Se/ze,Ge=Te/ze;Re!==de&&(l[Re-1]=ze),Se=Fe*this.s[Re]+Ge*l[Re],l[Re]=Fe*l[Re]-Ge*this.s[Re],Te=Ge*this.s[Re+1],this.s[Re+1]=Fe*this.s[Re+1];for(var it=0;it<this.n;it++)ze=Fe*this.V[it][Re]+Ge*this.V[it][Re+1],this.V[it][Re+1]=-Ge*this.V[it][Re]+Fe*this.V[it][Re+1],this.V[it][Re]=ze;if(ze=s.hypot(Se,Te),Fe=Se/ze,Ge=Te/ze,this.s[Re]=ze,Se=Fe*l[Re]+Ge*this.s[Re+1],this.s[Re+1]=-Ge*l[Re]+Fe*this.s[Re+1],Te=Ge*l[Re+1],l[Re+1]=Fe*l[Re+1],Re<this.m-1)for(var Ze=0;Ze<this.m;Ze++)ze=Fe*this.U[Ze][Re]+Ge*this.U[Ze][Re+1],this.U[Ze][Re+1]=-Ge*this.U[Ze][Re]+Fe*this.U[Ze][Re+1],this.U[Ze][Re]=ze}l[D-2]=Se}break;case 4:{if(this.s[de]<=0){this.s[de]=this.s[de]<0?-this.s[de]:0;for(var qe=0;qe<=J;qe++)this.V[qe][de]=-this.V[qe][de]}for(;de<J&&!(this.s[de]>=this.s[de+1]);){var pt=this.s[de];if(this.s[de]=this.s[de+1],this.s[de+1]=pt,de<this.n-1)for(var Qe=0;Qe<this.n;Qe++)pt=this.V[Qe][de+1],this.V[Qe][de+1]=this.V[Qe][de],this.V[Qe][de]=pt;if(de<this.m-1)for(var Ke=0;Ke<this.m;Ke++)pt=this.U[Ke][de+1],this.U[Ke][de+1]=this.U[Ke][de],this.U[Ke][de]=pt;de++}D--}break}}var xt={U:this.U,V:this.V,S:this.s};return xt},s.hypot=function(o,a){var l=void 0;return Math.abs(o)>Math.abs(a)?(l=a/o,l=Math.abs(o)*Math.sqrt(1+l*l)):a!=0?(l=o/a,l=Math.abs(a)*Math.sqrt(1+l*l)):l=0,l},r.exports=s}),(function(r,n,i){var s=(function(){function l(u,c){for(var h=0;h<c.length;h++){var g=c[h];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(u,g.key,g)}}return function(u,c,h){return c&&l(u.prototype,c),h&&l(u,h),u}})();function o(l,u){if(!(l instanceof u))throw new TypeError("Cannot call a class as a function")}var a=(function(){function l(u,c){var h=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,g=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,p=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;o(this,l),this.sequence1=u,this.sequence2=c,this.match_score=h,this.mismatch_penalty=g,this.gap_penalty=p,this.iMax=u.length+1,this.jMax=c.length+1,this.grid=new Array(this.iMax);for(var x=0;x<this.iMax;x++){this.grid[x]=new Array(this.jMax);for(var w=0;w<this.jMax;w++)this.grid[x][w]=0}this.tracebackGrid=new Array(this.iMax);for(var v=0;v<this.iMax;v++){this.tracebackGrid[v]=new Array(this.jMax);for(var m=0;m<this.jMax;m++)this.tracebackGrid[v][m]=[null,null,null]}this.alignments=[],this.score=-1,this.computeGrids()}return s(l,[{key:"getScore",value:function(){return this.score}},{key:"getAlignments",value:function(){return this.alignments}},{key:"computeGrids",value:function(){for(var c=1;c<this.jMax;c++)this.grid[0][c]=this.grid[0][c-1]+this.gap_penalty,this.tracebackGrid[0][c]=[!1,!1,!0];for(var h=1;h<this.iMax;h++)this.grid[h][0]=this.grid[h-1][0]+this.gap_penalty,this.tracebackGrid[h][0]=[!1,!0,!1];for(var g=1;g<this.iMax;g++)for(var p=1;p<this.jMax;p++){var x=void 0;this.sequence1[g-1]===this.sequence2[p-1]?x=this.grid[g-1][p-1]+this.match_score:x=this.grid[g-1][p-1]+this.mismatch_penalty;var w=this.grid[g-1][p]+this.gap_penalty,v=this.grid[g][p-1]+this.gap_penalty,m=[x,w,v],y=this.arrayAllMaxIndexes(m);this.grid[g][p]=m[y[0]],this.tracebackGrid[g][p]=[y.includes(0),y.includes(1),y.includes(2)]}this.score=this.grid[this.iMax-1][this.jMax-1]}},{key:"alignmentTraceback",value:function(){var c=[];for(c.push({pos:[this.sequence1.length,this.sequence2.length],seq1:"",seq2:""});c[0];){var h=c[0],g=this.tracebackGrid[h.pos[0]][h.pos[1]];g[0]&&c.push({pos:[h.pos[0]-1,h.pos[1]-1],seq1:this.sequence1[h.pos[0]-1]+h.seq1,seq2:this.sequence2[h.pos[1]-1]+h.seq2}),g[1]&&c.push({pos:[h.pos[0]-1,h.pos[1]],seq1:this.sequence1[h.pos[0]-1]+h.seq1,seq2:"-"+h.seq2}),g[2]&&c.push({pos:[h.pos[0],h.pos[1]-1],seq1:"-"+h.seq1,seq2:this.sequence2[h.pos[1]-1]+h.seq2}),h.pos[0]===0&&h.pos[1]===0&&this.alignments.push({sequence1:h.seq1,sequence2:h.seq2}),c.shift()}return this.alignments}},{key:"getAllIndexes",value:function(c,h){for(var g=[],p=-1;(p=c.indexOf(h,p+1))!==-1;)g.push(p);return g}},{key:"arrayAllMaxIndexes",value:function(c){return this.getAllIndexes(c,Math.max.apply(null,c))}}]),l})();r.exports=a}),(function(r,n,i){var s=function(){};s.FDLayout=i(18),s.FDLayoutConstants=i(4),s.FDLayoutEdge=i(19),s.FDLayoutNode=i(20),s.DimensionD=i(21),s.HashMap=i(22),s.HashSet=i(23),s.IGeometry=i(8),s.IMath=i(9),s.Integer=i(10),s.Point=i(12),s.PointD=i(5),s.RandomSeed=i(16),s.RectangleD=i(13),s.Transform=i(17),s.UniqueIDGeneretor=i(14),s.Quicksort=i(25),s.LinkedList=i(11),s.LGraphObject=i(2),s.LGraph=i(6),s.LEdge=i(1),s.LGraphManager=i(7),s.LNode=i(3),s.Layout=i(15),s.LayoutConstants=i(0),s.NeedlemanWunsch=i(27),s.Matrix=i(24),s.SVD=i(26),r.exports=s}),(function(r,n,i){function s(){this.listeners=[]}var o=s.prototype;o.addListener=function(a,l){this.listeners.push({event:a,callback:l})},o.removeListener=function(a,l){for(var u=this.listeners.length;u>=0;u--){var c=this.listeners[u];c.event===a&&c.callback===l&&this.listeners.splice(u,1)}},o.emit=function(a,l){for(var u=0;u<this.listeners.length;u++){var c=this.listeners[u];a===c.event&&c.callback(l)}},r.exports=s})])})})(wc)),wc.exports}var VD=bc.exports,G1;function $D(){return G1||(G1=1,(function(t,e){(function(n,i){t.exports=i(WD())})(VD,function(r){return(()=>{var n={45:((a,l,u)=>{var c={};c.layoutBase=u(551),c.CoSEConstants=u(806),c.CoSEEdge=u(767),c.CoSEGraph=u(880),c.CoSEGraphManager=u(578),c.CoSELayout=u(765),c.CoSENode=u(991),c.ConstraintHandler=u(902),a.exports=c}),806:((a,l,u)=>{var c=u(551).FDLayoutConstants;function h(){}for(var g in c)h[g]=c[g];h.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,h.DEFAULT_RADIAL_SEPARATION=c.DEFAULT_EDGE_LENGTH,h.DEFAULT_COMPONENT_SEPERATION=60,h.TILE=!0,h.TILING_PADDING_VERTICAL=10,h.TILING_PADDING_HORIZONTAL=10,h.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,h.ENFORCE_CONSTRAINTS=!0,h.APPLY_LAYOUT=!0,h.RELAX_MOVEMENT_ON_CONSTRAINTS=!0,h.TREE_REDUCTION_ON_INCREMENTAL=!0,h.PURE_INCREMENTAL=h.DEFAULT_INCREMENTAL,a.exports=h}),767:((a,l,u)=>{var c=u(551).FDLayoutEdge;function h(p,x,w){c.call(this,p,x,w)}h.prototype=Object.create(c.prototype);for(var g in c)h[g]=c[g];a.exports=h}),880:((a,l,u)=>{var c=u(551).LGraph;function h(p,x,w){c.call(this,p,x,w)}h.prototype=Object.create(c.prototype);for(var g in c)h[g]=c[g];a.exports=h}),578:((a,l,u)=>{var c=u(551).LGraphManager;function h(p){c.call(this,p)}h.prototype=Object.create(c.prototype);for(var g in c)h[g]=c[g];a.exports=h}),765:((a,l,u)=>{var c=u(551).FDLayout,h=u(578),g=u(880),p=u(991),x=u(767),w=u(806),v=u(902),m=u(551).FDLayoutConstants,y=u(551).LayoutConstants,b=u(551).Point,_=u(551).PointD,R=u(551).DimensionD,E=u(551).Layout,T=u(551).Integer,k=u(551).IGeometry,N=u(551).LGraph,M=u(551).Transform,B=u(551).LinkedList;function A(){c.call(this),this.toBeTiled={},this.constraints={}}A.prototype=Object.create(c.prototype);for(var j in c)A[j]=c[j];A.prototype.newGraphManager=function(){var D=new h(this);return this.graphManager=D,D},A.prototype.newGraph=function(D){return new g(null,this.graphManager,D)},A.prototype.newNode=function(D){return new p(this.graphManager,D)},A.prototype.newEdge=function(D){return new x(null,null,D)},A.prototype.initParameters=function(){c.prototype.initParameters.call(this,arguments),this.isSubLayout||(w.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=w.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=w.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=m.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=m.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=m.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=m.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1)},A.prototype.initSpringEmbedder=function(){c.prototype.initSpringEmbedder.call(this),this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/m.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=.04,this.coolingAdjuster=1},A.prototype.layout=function(){var D=y.DEFAULT_CREATE_BENDS_AS_NEEDED;return D&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},A.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental){if(w.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var I=new Set(this.getAllNodes()),U=this.nodesWithGravity.filter(function(z){return I.has(z)});this.graphManager.setAllNodesToApplyGravitation(U)}}else{var D=this.getFlatForest();if(D.length>0)this.positionNodesRadially(D);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var I=new Set(this.getAllNodes()),U=this.nodesWithGravity.filter(function(W){return I.has(W)});this.graphManager.setAllNodesToApplyGravitation(U),this.positionNodesRandomly()}}return Object.keys(this.constraints).length>0&&(v.handleConstraints(this),this.initConstraintVariables()),this.initSpringEmbedder(),w.APPLY_LAYOUT&&this.runSpringEmbedder(),!0},A.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%m.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var D=new Set(this.getAllNodes()),I=this.nodesWithGravity.filter(function(H){return D.has(H)});this.graphManager.setAllNodesToApplyGravitation(I),this.graphManager.updateBounds(),this.updateGrid(),w.PURE_INCREMENTAL?this.coolingFactor=m.DEFAULT_COOLING_FACTOR_INCREMENTAL/2:this.coolingFactor=m.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),w.PURE_INCREMENTAL?this.coolingFactor=m.DEFAULT_COOLING_FACTOR_INCREMENTAL/2*((100-this.afterGrowthIterations)/100):this.coolingFactor=m.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var U=!this.isTreeGrowing&&!this.isGrowthFinished,W=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(U,W),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},A.prototype.getPositionsData=function(){for(var D=this.graphManager.getAllNodes(),I={},U=0;U<D.length;U++){var W=D[U].rect,H=D[U].id;I[H]={id:H,x:W.getCenterX(),y:W.getCenterY(),w:W.width,h:W.height}}return I},A.prototype.runSpringEmbedder=function(){this.initialAnimationPeriod=25,this.animationPeriod=this.initialAnimationPeriod;var D=!1;if(m.ANIMATE==="during")this.emit("layoutstarted");else{for(;!D;)D=this.tick();this.graphManager.updateBounds()}},A.prototype.moveNodes=function(){for(var D=this.getAllNodes(),I,U=0;U<D.length;U++)I=D[U],I.calculateDisplacement();Object.keys(this.constraints).length>0&&this.updateDisplacements();for(var U=0;U<D.length;U++)I=D[U],I.move()},A.prototype.initConstraintVariables=function(){var D=this;this.idToNodeMap=new Map,this.fixedNodeSet=new Set;for(var I=this.graphManager.getAllNodes(),U=0;U<I.length;U++){var W=I[U];this.idToNodeMap.set(W.id,W)}var H=function K(X){for(var J=X.getChild().getNodes(),ie,ce=0,de=0;de<J.length;de++)ie=J[de],ie.getChild()==null?D.fixedNodeSet.has(ie.id)&&(ce+=100):ce+=K(ie);return ce};if(this.constraints.fixedNodeConstraint){this.constraints.fixedNodeConstraint.forEach(function(J){D.fixedNodeSet.add(J.nodeId)});for(var I=this.graphManager.getAllNodes(),W,U=0;U<I.length;U++)if(W=I[U],W.getChild()!=null){var z=H(W);z>0&&(W.fixedNodeWeight=z)}}if(this.constraints.relativePlacementConstraint){var P=new Map,F=new Map;if(this.dummyToNodeForVerticalAlignment=new Map,this.dummyToNodeForHorizontalAlignment=new Map,this.fixedNodesOnHorizontal=new Set,this.fixedNodesOnVertical=new Set,this.fixedNodeSet.forEach(function(K){D.fixedNodesOnHorizontal.add(K),D.fixedNodesOnVertical.add(K)}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var G=this.constraints.alignmentConstraint.vertical,U=0;U<G.length;U++)this.dummyToNodeForVerticalAlignment.set("dummy"+U,[]),G[U].forEach(function(X){P.set(X,"dummy"+U),D.dummyToNodeForVerticalAlignment.get("dummy"+U).push(X),D.fixedNodeSet.has(X)&&D.fixedNodesOnHorizontal.add("dummy"+U)});if(this.constraints.alignmentConstraint.horizontal)for(var $=this.constraints.alignmentConstraint.horizontal,U=0;U<$.length;U++)this.dummyToNodeForHorizontalAlignment.set("dummy"+U,[]),$[U].forEach(function(X){F.set(X,"dummy"+U),D.dummyToNodeForHorizontalAlignment.get("dummy"+U).push(X),D.fixedNodeSet.has(X)&&D.fixedNodesOnVertical.add("dummy"+U)})}if(w.RELAX_MOVEMENT_ON_CONSTRAINTS)this.shuffle=function(K){var X,J,ie;for(ie=K.length-1;ie>=2*K.length/3;ie--)X=Math.floor(Math.random()*(ie+1)),J=K[ie],K[ie]=K[X],K[X]=J;return K},this.nodesInRelativeHorizontal=[],this.nodesInRelativeVertical=[],this.nodeToRelativeConstraintMapHorizontal=new Map,this.nodeToRelativeConstraintMapVertical=new Map,this.nodeToTempPositionMapHorizontal=new Map,this.nodeToTempPositionMapVertical=new Map,this.constraints.relativePlacementConstraint.forEach(function(K){if(K.left){var X=P.has(K.left)?P.get(K.left):K.left,J=P.has(K.right)?P.get(K.right):K.right;D.nodesInRelativeHorizontal.includes(X)||(D.nodesInRelativeHorizontal.push(X),D.nodeToRelativeConstraintMapHorizontal.set(X,[]),D.dummyToNodeForVerticalAlignment.has(X)?D.nodeToTempPositionMapHorizontal.set(X,D.idToNodeMap.get(D.dummyToNodeForVerticalAlignment.get(X)[0]).getCenterX()):D.nodeToTempPositionMapHorizontal.set(X,D.idToNodeMap.get(X).getCenterX())),D.nodesInRelativeHorizontal.includes(J)||(D.nodesInRelativeHorizontal.push(J),D.nodeToRelativeConstraintMapHorizontal.set(J,[]),D.dummyToNodeForVerticalAlignment.has(J)?D.nodeToTempPositionMapHorizontal.set(J,D.idToNodeMap.get(D.dummyToNodeForVerticalAlignment.get(J)[0]).getCenterX()):D.nodeToTempPositionMapHorizontal.set(J,D.idToNodeMap.get(J).getCenterX())),D.nodeToRelativeConstraintMapHorizontal.get(X).push({right:J,gap:K.gap}),D.nodeToRelativeConstraintMapHorizontal.get(J).push({left:X,gap:K.gap})}else{var ie=F.has(K.top)?F.get(K.top):K.top,ce=F.has(K.bottom)?F.get(K.bottom):K.bottom;D.nodesInRelativeVertical.includes(ie)||(D.nodesInRelativeVertical.push(ie),D.nodeToRelativeConstraintMapVertical.set(ie,[]),D.dummyToNodeForHorizontalAlignment.has(ie)?D.nodeToTempPositionMapVertical.set(ie,D.idToNodeMap.get(D.dummyToNodeForHorizontalAlignment.get(ie)[0]).getCenterY()):D.nodeToTempPositionMapVertical.set(ie,D.idToNodeMap.get(ie).getCenterY())),D.nodesInRelativeVertical.includes(ce)||(D.nodesInRelativeVertical.push(ce),D.nodeToRelativeConstraintMapVertical.set(ce,[]),D.dummyToNodeForHorizontalAlignment.has(ce)?D.nodeToTempPositionMapVertical.set(ce,D.idToNodeMap.get(D.dummyToNodeForHorizontalAlignment.get(ce)[0]).getCenterY()):D.nodeToTempPositionMapVertical.set(ce,D.idToNodeMap.get(ce).getCenterY())),D.nodeToRelativeConstraintMapVertical.get(ie).push({bottom:ce,gap:K.gap}),D.nodeToRelativeConstraintMapVertical.get(ce).push({top:ie,gap:K.gap})}});else{var ee=new Map,re=new Map;this.constraints.relativePlacementConstraint.forEach(function(K){if(K.left){var X=P.has(K.left)?P.get(K.left):K.left,J=P.has(K.right)?P.get(K.right):K.right;ee.has(X)?ee.get(X).push(J):ee.set(X,[J]),ee.has(J)?ee.get(J).push(X):ee.set(J,[X])}else{var ie=F.has(K.top)?F.get(K.top):K.top,ce=F.has(K.bottom)?F.get(K.bottom):K.bottom;re.has(ie)?re.get(ie).push(ce):re.set(ie,[ce]),re.has(ce)?re.get(ce).push(ie):re.set(ce,[ie])}});var ne=function(X,J){var ie=[],ce=[],de=new B,Le=new Set,je=0;return X.forEach(function(_e,ke){if(!Le.has(ke)){ie[je]=[],ce[je]=!1;var Ne=ke;for(de.push(Ne),Le.add(Ne),ie[je].push(Ne);de.length!=0;){Ne=de.shift(),J.has(Ne)&&(ce[je]=!0);var Ee=X.get(Ne);Ee.forEach(function(Me){Le.has(Me)||(de.push(Me),Le.add(Me),ie[je].push(Me))})}je++}}),{components:ie,isFixed:ce}},Y=ne(ee,D.fixedNodesOnHorizontal);this.componentsOnHorizontal=Y.components,this.fixedComponentsOnHorizontal=Y.isFixed;var q=ne(re,D.fixedNodesOnVertical);this.componentsOnVertical=q.components,this.fixedComponentsOnVertical=q.isFixed}}},A.prototype.updateDisplacements=function(){var D=this;if(this.constraints.fixedNodeConstraint&&this.constraints.fixedNodeConstraint.forEach(function(q){var K=D.idToNodeMap.get(q.nodeId);K.displacementX=0,K.displacementY=0}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var I=this.constraints.alignmentConstraint.vertical,U=0;U<I.length;U++){for(var W=0,H=0;H<I[U].length;H++){if(this.fixedNodeSet.has(I[U][H])){W=0;break}W+=this.idToNodeMap.get(I[U][H]).displacementX}for(var z=W/I[U].length,H=0;H<I[U].length;H++)this.idToNodeMap.get(I[U][H]).displacementX=z}if(this.constraints.alignmentConstraint.horizontal)for(var P=this.constraints.alignmentConstraint.horizontal,U=0;U<P.length;U++){for(var F=0,H=0;H<P[U].length;H++){if(this.fixedNodeSet.has(P[U][H])){F=0;break}F+=this.idToNodeMap.get(P[U][H]).displacementY}for(var G=F/P[U].length,H=0;H<P[U].length;H++)this.idToNodeMap.get(P[U][H]).displacementY=G}}if(this.constraints.relativePlacementConstraint)if(w.RELAX_MOVEMENT_ON_CONSTRAINTS)this.totalIterations%10==0&&(this.shuffle(this.nodesInRelativeHorizontal),this.shuffle(this.nodesInRelativeVertical)),this.nodesInRelativeHorizontal.forEach(function(q){if(!D.fixedNodesOnHorizontal.has(q)){var K=0;D.dummyToNodeForVerticalAlignment.has(q)?K=D.idToNodeMap.get(D.dummyToNodeForVerticalAlignment.get(q)[0]).displacementX:K=D.idToNodeMap.get(q).displacementX,D.nodeToRelativeConstraintMapHorizontal.get(q).forEach(function(X){if(X.right){var J=D.nodeToTempPositionMapHorizontal.get(X.right)-D.nodeToTempPositionMapHorizontal.get(q)-K;J<X.gap&&(K-=X.gap-J)}else{var J=D.nodeToTempPositionMapHorizontal.get(q)-D.nodeToTempPositionMapHorizontal.get(X.left)+K;J<X.gap&&(K+=X.gap-J)}}),D.nodeToTempPositionMapHorizontal.set(q,D.nodeToTempPositionMapHorizontal.get(q)+K),D.dummyToNodeForVerticalAlignment.has(q)?D.dummyToNodeForVerticalAlignment.get(q).forEach(function(X){D.idToNodeMap.get(X).displacementX=K}):D.idToNodeMap.get(q).displacementX=K}}),this.nodesInRelativeVertical.forEach(function(q){if(!D.fixedNodesOnHorizontal.has(q)){var K=0;D.dummyToNodeForHorizontalAlignment.has(q)?K=D.idToNodeMap.get(D.dummyToNodeForHorizontalAlignment.get(q)[0]).displacementY:K=D.idToNodeMap.get(q).displacementY,D.nodeToRelativeConstraintMapVertical.get(q).forEach(function(X){if(X.bottom){var J=D.nodeToTempPositionMapVertical.get(X.bottom)-D.nodeToTempPositionMapVertical.get(q)-K;J<X.gap&&(K-=X.gap-J)}else{var J=D.nodeToTempPositionMapVertical.get(q)-D.nodeToTempPositionMapVertical.get(X.top)+K;J<X.gap&&(K+=X.gap-J)}}),D.nodeToTempPositionMapVertical.set(q,D.nodeToTempPositionMapVertical.get(q)+K),D.dummyToNodeForHorizontalAlignment.has(q)?D.dummyToNodeForHorizontalAlignment.get(q).forEach(function(X){D.idToNodeMap.get(X).displacementY=K}):D.idToNodeMap.get(q).displacementY=K}});else{for(var U=0;U<this.componentsOnHorizontal.length;U++){var $=this.componentsOnHorizontal[U];if(this.fixedComponentsOnHorizontal[U])for(var H=0;H<$.length;H++)this.dummyToNodeForVerticalAlignment.has($[H])?this.dummyToNodeForVerticalAlignment.get($[H]).forEach(function(X){D.idToNodeMap.get(X).displacementX=0}):this.idToNodeMap.get($[H]).displacementX=0;else{for(var ee=0,re=0,H=0;H<$.length;H++)if(this.dummyToNodeForVerticalAlignment.has($[H])){var ne=this.dummyToNodeForVerticalAlignment.get($[H]);ee+=ne.length*this.idToNodeMap.get(ne[0]).displacementX,re+=ne.length}else ee+=this.idToNodeMap.get($[H]).displacementX,re++;for(var Y=ee/re,H=0;H<$.length;H++)this.dummyToNodeForVerticalAlignment.has($[H])?this.dummyToNodeForVerticalAlignment.get($[H]).forEach(function(X){D.idToNodeMap.get(X).displacementX=Y}):this.idToNodeMap.get($[H]).displacementX=Y}}for(var U=0;U<this.componentsOnVertical.length;U++){var $=this.componentsOnVertical[U];if(this.fixedComponentsOnVertical[U])for(var H=0;H<$.length;H++)this.dummyToNodeForHorizontalAlignment.has($[H])?this.dummyToNodeForHorizontalAlignment.get($[H]).forEach(function(J){D.idToNodeMap.get(J).displacementY=0}):this.idToNodeMap.get($[H]).displacementY=0;else{for(var ee=0,re=0,H=0;H<$.length;H++)if(this.dummyToNodeForHorizontalAlignment.has($[H])){var ne=this.dummyToNodeForHorizontalAlignment.get($[H]);ee+=ne.length*this.idToNodeMap.get(ne[0]).displacementY,re+=ne.length}else ee+=this.idToNodeMap.get($[H]).displacementY,re++;for(var Y=ee/re,H=0;H<$.length;H++)this.dummyToNodeForHorizontalAlignment.has($[H])?this.dummyToNodeForHorizontalAlignment.get($[H]).forEach(function(de){D.idToNodeMap.get(de).displacementY=Y}):this.idToNodeMap.get($[H]).displacementY=Y}}}},A.prototype.calculateNodesToApplyGravitationTo=function(){var D=[],I,U=this.graphManager.getGraphs(),W=U.length,H;for(H=0;H<W;H++)I=U[H],I.updateConnected(),I.isConnected||(D=D.concat(I.getNodes()));return D},A.prototype.createBendpoints=function(){var D=[];D=D.concat(this.graphManager.getAllEdges());var I=new Set,U;for(U=0;U<D.length;U++){var W=D[U];if(!I.has(W)){var H=W.getSource(),z=W.getTarget();if(H==z)W.getBendpoints().push(new _),W.getBendpoints().push(new _),this.createDummyNodesForBendpoints(W),I.add(W);else{var P=[];if(P=P.concat(H.getEdgeListToNode(z)),P=P.concat(z.getEdgeListToNode(H)),!I.has(P[0])){if(P.length>1){var F;for(F=0;F<P.length;F++){var G=P[F];G.getBendpoints().push(new _),this.createDummyNodesForBendpoints(G)}}P.forEach(function($){I.add($)})}}}if(I.size==D.length)break}},A.prototype.positionNodesRadially=function(D){for(var I=new b(0,0),U=Math.ceil(Math.sqrt(D.length)),W=0,H=0,z=0,P=new _(0,0),F=0;F<D.length;F++){F%U==0&&(z=0,H=W,F!=0&&(H+=w.DEFAULT_COMPONENT_SEPERATION),W=0);var G=D[F],$=E.findCenterOfTree(G);I.x=z,I.y=H,P=A.radialLayout(G,$,I),P.y>W&&(W=Math.floor(P.y)),z=Math.floor(P.x+w.DEFAULT_COMPONENT_SEPERATION)}this.transform(new _(y.WORLD_CENTER_X-P.x/2,y.WORLD_CENTER_Y-P.y/2))},A.radialLayout=function(D,I,U){var W=Math.max(this.maxDiagonalInTree(D),w.DEFAULT_RADIAL_SEPARATION);A.branchRadialLayout(I,null,0,359,0,W);var H=N.calculateBounds(D),z=new M;z.setDeviceOrgX(H.getMinX()),z.setDeviceOrgY(H.getMinY()),z.setWorldOrgX(U.x),z.setWorldOrgY(U.y);for(var P=0;P<D.length;P++){var F=D[P];F.transform(z)}var G=new _(H.getMaxX(),H.getMaxY());return z.inverseTransformPoint(G)},A.branchRadialLayout=function(D,I,U,W,H,z){var P=(W-U+1)/2;P<0&&(P+=180);var F=(P+U)%360,G=F*k.TWO_PI/360,$=H*Math.cos(G),ee=H*Math.sin(G);D.setCenter($,ee);var re=[];re=re.concat(D.getEdges());var ne=re.length;I!=null&&ne--;for(var Y=0,q=re.length,K,X=D.getEdgesBetween(I);X.length>1;){var J=X[0];X.splice(0,1);var ie=re.indexOf(J);ie>=0&&re.splice(ie,1),q--,ne--}I!=null?K=(re.indexOf(X[0])+1)%q:K=0;for(var ce=Math.abs(W-U)/ne,de=K;Y!=ne;de=++de%q){var Le=re[de].getOtherEnd(D);if(Le!=I){var je=(U+Y*ce)%360,_e=(je+ce)%360;A.branchRadialLayout(Le,D,je,_e,H+z,z),Y++}}},A.maxDiagonalInTree=function(D){for(var I=T.MIN_VALUE,U=0;U<D.length;U++){var W=D[U],H=W.getDiagonal();H>I&&(I=H)}return I},A.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},A.prototype.groupZeroDegreeMembers=function(){var D=this,I={};this.memberGroups={},this.idToDummyNode={};for(var U=[],W=this.graphManager.getAllNodes(),H=0;H<W.length;H++){var z=W[H],P=z.getParent();this.getNodeDegreeWithChildren(z)===0&&(P.id==null||!this.getToBeTiled(P))&&U.push(z)}for(var H=0;H<U.length;H++){var z=U[H],F=z.getParent().id;typeof I[F]>"u"&&(I[F]=[]),I[F]=I[F].concat(z)}Object.keys(I).forEach(function(G){if(I[G].length>1){var $="DummyCompound_"+G;D.memberGroups[$]=I[G];var ee=I[G][0].getParent(),re=new p(D.graphManager);re.id=$,re.paddingLeft=ee.paddingLeft||0,re.paddingRight=ee.paddingRight||0,re.paddingBottom=ee.paddingBottom||0,re.paddingTop=ee.paddingTop||0,D.idToDummyNode[$]=re;var ne=D.getGraphManager().add(D.newGraph(),re),Y=ee.getChild();Y.add(re);for(var q=0;q<I[G].length;q++){var K=I[G][q];Y.remove(K),ne.add(K)}}})},A.prototype.clearCompounds=function(){var D={},I={};this.performDFSOnCompounds();for(var U=0;U<this.compoundOrder.length;U++)I[this.compoundOrder[U].id]=this.compoundOrder[U],D[this.compoundOrder[U].id]=[].concat(this.compoundOrder[U].getChild().getNodes()),this.graphManager.remove(this.compoundOrder[U].getChild()),this.compoundOrder[U].child=null;this.graphManager.resetAllNodes(),this.tileCompoundMembers(D,I)},A.prototype.clearZeroDegreeMembers=function(){var D=this,I=this.tiledZeroDegreePack=[];Object.keys(this.memberGroups).forEach(function(U){var W=D.idToDummyNode[U];if(I[U]=D.tileNodes(D.memberGroups[U],W.paddingLeft+W.paddingRight),W.rect.width=I[U].width,W.rect.height=I[U].height,W.setCenter(I[U].centerX,I[U].centerY),W.labelMarginLeft=0,W.labelMarginTop=0,w.NODE_DIMENSIONS_INCLUDE_LABELS){var H=W.rect.width,z=W.rect.height;W.labelWidth&&(W.labelPosHorizontal=="left"?(W.rect.x-=W.labelWidth,W.setWidth(H+W.labelWidth),W.labelMarginLeft=W.labelWidth):W.labelPosHorizontal=="center"&&W.labelWidth>H?(W.rect.x-=(W.labelWidth-H)/2,W.setWidth(W.labelWidth),W.labelMarginLeft=(W.labelWidth-H)/2):W.labelPosHorizontal=="right"&&W.setWidth(H+W.labelWidth)),W.labelHeight&&(W.labelPosVertical=="top"?(W.rect.y-=W.labelHeight,W.setHeight(z+W.labelHeight),W.labelMarginTop=W.labelHeight):W.labelPosVertical=="center"&&W.labelHeight>z?(W.rect.y-=(W.labelHeight-z)/2,W.setHeight(W.labelHeight),W.labelMarginTop=(W.labelHeight-z)/2):W.labelPosVertical=="bottom"&&W.setHeight(z+W.labelHeight))}})},A.prototype.repopulateCompounds=function(){for(var D=this.compoundOrder.length-1;D>=0;D--){var I=this.compoundOrder[D],U=I.id,W=I.paddingLeft,H=I.paddingTop,z=I.labelMarginLeft,P=I.labelMarginTop;this.adjustLocations(this.tiledMemberPack[U],I.rect.x,I.rect.y,W,H,z,P)}},A.prototype.repopulateZeroDegreeMembers=function(){var D=this,I=this.tiledZeroDegreePack;Object.keys(I).forEach(function(U){var W=D.idToDummyNode[U],H=W.paddingLeft,z=W.paddingTop,P=W.labelMarginLeft,F=W.labelMarginTop;D.adjustLocations(I[U],W.rect.x,W.rect.y,H,z,P,F)})},A.prototype.getToBeTiled=function(D){var I=D.id;if(this.toBeTiled[I]!=null)return this.toBeTiled[I];var U=D.getChild();if(U==null)return this.toBeTiled[I]=!1,!1;for(var W=U.getNodes(),H=0;H<W.length;H++){var z=W[H];if(this.getNodeDegree(z)>0)return this.toBeTiled[I]=!1,!1;if(z.getChild()==null){this.toBeTiled[z.id]=!1;continue}if(!this.getToBeTiled(z))return this.toBeTiled[I]=!1,!1}return this.toBeTiled[I]=!0,!0},A.prototype.getNodeDegree=function(D){D.id;for(var I=D.getEdges(),U=0,W=0;W<I.length;W++){var H=I[W];H.getSource().id!==H.getTarget().id&&(U=U+1)}return U},A.prototype.getNodeDegreeWithChildren=function(D){var I=this.getNodeDegree(D);if(D.getChild()==null)return I;for(var U=D.getChild().getNodes(),W=0;W<U.length;W++){var H=U[W];I+=this.getNodeDegreeWithChildren(H)}return I},A.prototype.performDFSOnCompounds=function(){this.compoundOrder=[],this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes())},A.prototype.fillCompexOrderByDFS=function(D){for(var I=0;I<D.length;I++){var U=D[I];U.getChild()!=null&&this.fillCompexOrderByDFS(U.getChild().getNodes()),this.getToBeTiled(U)&&this.compoundOrder.push(U)}},A.prototype.adjustLocations=function(D,I,U,W,H,z,P){I+=W+z,U+=H+P;for(var F=I,G=0;G<D.rows.length;G++){var $=D.rows[G];I=F;for(var ee=0,re=0;re<$.length;re++){var ne=$[re];ne.rect.x=I,ne.rect.y=U,I+=ne.rect.width+D.horizontalPadding,ne.rect.height>ee&&(ee=ne.rect.height)}U+=ee+D.verticalPadding}},A.prototype.tileCompoundMembers=function(D,I){var U=this;this.tiledMemberPack=[],Object.keys(D).forEach(function(W){var H=I[W];if(U.tiledMemberPack[W]=U.tileNodes(D[W],H.paddingLeft+H.paddingRight),H.rect.width=U.tiledMemberPack[W].width,H.rect.height=U.tiledMemberPack[W].height,H.setCenter(U.tiledMemberPack[W].centerX,U.tiledMemberPack[W].centerY),H.labelMarginLeft=0,H.labelMarginTop=0,w.NODE_DIMENSIONS_INCLUDE_LABELS){var z=H.rect.width,P=H.rect.height;H.labelWidth&&(H.labelPosHorizontal=="left"?(H.rect.x-=H.labelWidth,H.setWidth(z+H.labelWidth),H.labelMarginLeft=H.labelWidth):H.labelPosHorizontal=="center"&&H.labelWidth>z?(H.rect.x-=(H.labelWidth-z)/2,H.setWidth(H.labelWidth),H.labelMarginLeft=(H.labelWidth-z)/2):H.labelPosHorizontal=="right"&&H.setWidth(z+H.labelWidth)),H.labelHeight&&(H.labelPosVertical=="top"?(H.rect.y-=H.labelHeight,H.setHeight(P+H.labelHeight),H.labelMarginTop=H.labelHeight):H.labelPosVertical=="center"&&H.labelHeight>P?(H.rect.y-=(H.labelHeight-P)/2,H.setHeight(H.labelHeight),H.labelMarginTop=(H.labelHeight-P)/2):H.labelPosVertical=="bottom"&&H.setHeight(P+H.labelHeight))}})},A.prototype.tileNodes=function(D,I){var U=this.tileNodesByFavoringDim(D,I,!0),W=this.tileNodesByFavoringDim(D,I,!1),H=this.getOrgRatio(U),z=this.getOrgRatio(W),P;return z<H?P=W:P=U,P},A.prototype.getOrgRatio=function(D){var I=D.width,U=D.height,W=I/U;return W<1&&(W=1/W),W},A.prototype.calcIdealRowWidth=function(D,I){var U=w.TILING_PADDING_VERTICAL,W=w.TILING_PADDING_HORIZONTAL,H=D.length,z=0,P=0,F=0;D.forEach(function(q){z+=q.getWidth(),P+=q.getHeight(),q.getWidth()>F&&(F=q.getWidth())});var G=z/H,$=P/H,ee=Math.pow(U-W,2)+4*(G+W)*($+U)*H,re=(W-U+Math.sqrt(ee))/(2*(G+W)),ne;I?(ne=Math.ceil(re),ne==re&&ne++):ne=Math.floor(re);var Y=ne*(G+W)-W;return F>Y&&(Y=F),Y+=W*2,Y},A.prototype.tileNodesByFavoringDim=function(D,I,U){var W=w.TILING_PADDING_VERTICAL,H=w.TILING_PADDING_HORIZONTAL,z=w.TILING_COMPARE_BY,P={rows:[],rowWidth:[],rowHeight:[],width:0,height:I,verticalPadding:W,horizontalPadding:H,centerX:0,centerY:0};z&&(P.idealRowWidth=this.calcIdealRowWidth(D,U));var F=function(K){return K.rect.width*K.rect.height},G=function(K,X){return F(X)-F(K)};D.sort(function(q,K){var X=G;return P.idealRowWidth?(X=z,X(q.id,K.id)):X(q,K)});for(var $=0,ee=0,re=0;re<D.length;re++){var ne=D[re];$+=ne.getCenterX(),ee+=ne.getCenterY()}P.centerX=$/D.length,P.centerY=ee/D.length;for(var re=0;re<D.length;re++){var ne=D[re];if(P.rows.length==0)this.insertNodeToRow(P,ne,0,I);else if(this.canAddHorizontal(P,ne.rect.width,ne.rect.height)){var Y=P.rows.length-1;P.idealRowWidth||(Y=this.getShortestRowIndex(P)),this.insertNodeToRow(P,ne,Y,I)}else this.insertNodeToRow(P,ne,P.rows.length,I);this.shiftToLastRow(P)}return P},A.prototype.insertNodeToRow=function(D,I,U,W){var H=W;if(U==D.rows.length){var z=[];D.rows.push(z),D.rowWidth.push(H),D.rowHeight.push(0)}var P=D.rowWidth[U]+I.rect.width;D.rows[U].length>0&&(P+=D.horizontalPadding),D.rowWidth[U]=P,D.width<P&&(D.width=P);var F=I.rect.height;U>0&&(F+=D.verticalPadding);var G=0;F>D.rowHeight[U]&&(G=D.rowHeight[U],D.rowHeight[U]=F,G=D.rowHeight[U]-G),D.height+=G,D.rows[U].push(I)},A.prototype.getShortestRowIndex=function(D){for(var I=-1,U=Number.MAX_VALUE,W=0;W<D.rows.length;W++)D.rowWidth[W]<U&&(I=W,U=D.rowWidth[W]);return I},A.prototype.getLongestRowIndex=function(D){for(var I=-1,U=Number.MIN_VALUE,W=0;W<D.rows.length;W++)D.rowWidth[W]>U&&(I=W,U=D.rowWidth[W]);return I},A.prototype.canAddHorizontal=function(D,I,U){if(D.idealRowWidth){var W=D.rows.length-1,H=D.rowWidth[W];return H+I+D.horizontalPadding<=D.idealRowWidth}var z=this.getShortestRowIndex(D);if(z<0)return!0;var P=D.rowWidth[z];if(P+D.horizontalPadding+I<=D.width)return!0;var F=0;D.rowHeight[z]<U&&z>0&&(F=U+D.verticalPadding-D.rowHeight[z]);var G;D.width-P>=I+D.horizontalPadding?G=(D.height+F)/(P+I+D.horizontalPadding):G=(D.height+F)/D.width,F=U+D.verticalPadding;var $;return D.width<I?$=(D.height+F)/I:$=(D.height+F)/D.width,$<1&&($=1/$),G<1&&(G=1/G),G<$},A.prototype.shiftToLastRow=function(D){var I=this.getLongestRowIndex(D),U=D.rowWidth.length-1,W=D.rows[I],H=W[W.length-1],z=H.width+D.horizontalPadding;if(D.width-D.rowWidth[U]>z&&I!=U){W.splice(-1,1),D.rows[U].push(H),D.rowWidth[I]=D.rowWidth[I]-z,D.rowWidth[U]=D.rowWidth[U]+z,D.width=D.rowWidth[instance.getLongestRowIndex(D)];for(var P=Number.MIN_VALUE,F=0;F<W.length;F++)W[F].height>P&&(P=W[F].height);I>0&&(P+=D.verticalPadding);var G=D.rowHeight[I]+D.rowHeight[U];D.rowHeight[I]=P,D.rowHeight[U]<H.height+D.verticalPadding&&(D.rowHeight[U]=H.height+D.verticalPadding);var $=D.rowHeight[I]+D.rowHeight[U];D.height+=$-G,this.shiftToLastRow(D)}},A.prototype.tilingPreLayout=function(){w.TILE&&(this.groupZeroDegreeMembers(),this.clearCompounds(),this.clearZeroDegreeMembers())},A.prototype.tilingPostLayout=function(){w.TILE&&(this.repopulateZeroDegreeMembers(),this.repopulateCompounds())},A.prototype.reduceTrees=function(){for(var D=[],I=!0,U;I;){var W=this.graphManager.getAllNodes(),H=[];I=!1;for(var z=0;z<W.length;z++)if(U=W[z],U.getEdges().length==1&&!U.getEdges()[0].isInterGraph&&U.getChild()==null){if(w.PURE_INCREMENTAL){var P=U.getEdges()[0].getOtherEnd(U),F=new R(U.getCenterX()-P.getCenterX(),U.getCenterY()-P.getCenterY());H.push([U,U.getEdges()[0],U.getOwner(),F])}else H.push([U,U.getEdges()[0],U.getOwner()]);I=!0}if(I==!0){for(var G=[],$=0;$<H.length;$++)H[$][0].getEdges().length==1&&(G.push(H[$]),H[$][0].getOwner().remove(H[$][0]));D.push(G),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()}}this.prunedNodesAll=D},A.prototype.growTree=function(D){for(var I=D.length,U=D[I-1],W,H=0;H<U.length;H++)W=U[H],this.findPlaceforPrunedNode(W),W[2].add(W[0]),W[2].add(W[1],W[1].source,W[1].target);D.splice(D.length-1,1),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()},A.prototype.findPlaceforPrunedNode=function(D){var I,U,W=D[0];if(W==D[1].source?U=D[1].target:U=D[1].source,w.PURE_INCREMENTAL)W.setCenter(U.getCenterX()+D[3].getWidth(),U.getCenterY()+D[3].getHeight());else{var H=U.startX,z=U.finishX,P=U.startY,F=U.finishY,G=0,$=0,ee=0,re=0,ne=[G,ee,$,re];if(P>0)for(var Y=H;Y<=z;Y++)ne[0]+=this.grid[Y][P-1].length+this.grid[Y][P].length-1;if(z<this.grid.length-1)for(var Y=P;Y<=F;Y++)ne[1]+=this.grid[z+1][Y].length+this.grid[z][Y].length-1;if(F<this.grid[0].length-1)for(var Y=H;Y<=z;Y++)ne[2]+=this.grid[Y][F+1].length+this.grid[Y][F].length-1;if(H>0)for(var Y=P;Y<=F;Y++)ne[3]+=this.grid[H-1][Y].length+this.grid[H][Y].length-1;for(var q=T.MAX_VALUE,K,X,J=0;J<ne.length;J++)ne[J]<q?(q=ne[J],K=1,X=J):ne[J]==q&&K++;if(K==3&&q==0)ne[0]==0&&ne[1]==0&&ne[2]==0?I=1:ne[0]==0&&ne[1]==0&&ne[3]==0?I=0:ne[0]==0&&ne[2]==0&&ne[3]==0?I=3:ne[1]==0&&ne[2]==0&&ne[3]==0&&(I=2);else if(K==2&&q==0){var ie=Math.floor(Math.random()*2);ne[0]==0&&ne[1]==0?ie==0?I=0:I=1:ne[0]==0&&ne[2]==0?ie==0?I=0:I=2:ne[0]==0&&ne[3]==0?ie==0?I=0:I=3:ne[1]==0&&ne[2]==0?ie==0?I=1:I=2:ne[1]==0&&ne[3]==0?ie==0?I=1:I=3:ie==0?I=2:I=3}else if(K==4&&q==0){var ie=Math.floor(Math.random()*4);I=ie}else I=X;I==0?W.setCenter(U.getCenterX(),U.getCenterY()-U.getHeight()/2-m.DEFAULT_EDGE_LENGTH-W.getHeight()/2):I==1?W.setCenter(U.getCenterX()+U.getWidth()/2+m.DEFAULT_EDGE_LENGTH+W.getWidth()/2,U.getCenterY()):I==2?W.setCenter(U.getCenterX(),U.getCenterY()+U.getHeight()/2+m.DEFAULT_EDGE_LENGTH+W.getHeight()/2):W.setCenter(U.getCenterX()-U.getWidth()/2-m.DEFAULT_EDGE_LENGTH-W.getWidth()/2,U.getCenterY())}},a.exports=A}),991:((a,l,u)=>{var c=u(551).FDLayoutNode,h=u(551).IMath;function g(x,w,v,m){c.call(this,x,w,v,m)}g.prototype=Object.create(c.prototype);for(var p in c)g[p]=c[p];g.prototype.calculateDisplacement=function(){var x=this.graphManager.getLayout();this.getChild()!=null&&this.fixedNodeWeight?(this.displacementX+=x.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.fixedNodeWeight,this.displacementY+=x.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.fixedNodeWeight):(this.displacementX+=x.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY+=x.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren),Math.abs(this.displacementX)>x.coolingFactor*x.maxNodeDisplacement&&(this.displacementX=x.coolingFactor*x.maxNodeDisplacement*h.sign(this.displacementX)),Math.abs(this.displacementY)>x.coolingFactor*x.maxNodeDisplacement&&(this.displacementY=x.coolingFactor*x.maxNodeDisplacement*h.sign(this.displacementY)),this.child&&this.child.getNodes().length>0&&this.propogateDisplacementToChildren(this.displacementX,this.displacementY)},g.prototype.propogateDisplacementToChildren=function(x,w){for(var v=this.getChild().getNodes(),m,y=0;y<v.length;y++)m=v[y],m.getChild()==null?(m.displacementX+=x,m.displacementY+=w):m.propogateDisplacementToChildren(x,w)},g.prototype.move=function(){var x=this.graphManager.getLayout();(this.child==null||this.child.getNodes().length==0)&&(this.moveBy(this.displacementX,this.displacementY),x.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY)),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},g.prototype.setPred1=function(x){this.pred1=x},g.prototype.getPred1=function(){return pred1},g.prototype.getPred2=function(){return pred2},g.prototype.setNext=function(x){this.next=x},g.prototype.getNext=function(){return next},g.prototype.setProcessed=function(x){this.processed=x},g.prototype.isProcessed=function(){return processed},a.exports=g}),902:((a,l,u)=>{function c(v){if(Array.isArray(v)){for(var m=0,y=Array(v.length);m<v.length;m++)y[m]=v[m];return y}else return Array.from(v)}var h=u(806),g=u(551).LinkedList,p=u(551).Matrix,x=u(551).SVD;function w(){}w.handleConstraints=function(v){var m={};m.fixedNodeConstraint=v.constraints.fixedNodeConstraint,m.alignmentConstraint=v.constraints.alignmentConstraint,m.relativePlacementConstraint=v.constraints.relativePlacementConstraint;for(var y=new Map,b=new Map,_=[],R=[],E=v.getAllNodes(),T=0,k=0;k<E.length;k++){var N=E[k];N.getChild()==null&&(b.set(N.id,T++),_.push(N.getCenterX()),R.push(N.getCenterY()),y.set(N.id,N))}m.relativePlacementConstraint&&m.relativePlacementConstraint.forEach(function(te){!te.gap&&te.gap!=0&&(te.left?te.gap=h.DEFAULT_EDGE_LENGTH+y.get(te.left).getWidth()/2+y.get(te.right).getWidth()/2:te.gap=h.DEFAULT_EDGE_LENGTH+y.get(te.top).getHeight()/2+y.get(te.bottom).getHeight()/2)});var M=function(oe,ue){return{x:oe.x-ue.x,y:oe.y-ue.y}},B=function(oe){var ue=0,se=0;return oe.forEach(function(he){ue+=_[b.get(he)],se+=R[b.get(he)]}),{x:ue/oe.size,y:se/oe.size}},A=function(oe,ue,se,he,pe){function be(Ze,qe){var pt=new Set(Ze),Qe=!0,Ke=!1,xt=void 0;try{for(var st=qe[Symbol.iterator](),vt;!(Qe=(vt=st.next()).done);Qe=!0){var yt=vt.value;pt.add(yt)}}catch(Rt){Ke=!0,xt=Rt}finally{try{!Qe&&st.return&&st.return()}finally{if(Ke)throw xt}}return pt}var Se=new Map;oe.forEach(function(Ze,qe){Se.set(qe,0)}),oe.forEach(function(Ze,qe){Ze.forEach(function(pt){Se.set(pt.id,Se.get(pt.id)+1)})});var Te=new Map,Re=new Map,ze=new g;Se.forEach(function(Ze,qe){Ze==0?(ze.push(qe),se||(ue=="horizontal"?Te.set(qe,b.has(qe)?_[b.get(qe)]:he.get(qe)):Te.set(qe,b.has(qe)?R[b.get(qe)]:he.get(qe)))):Te.set(qe,Number.NEGATIVE_INFINITY),se&&Re.set(qe,new Set([qe]))}),se&&pe.forEach(function(Ze){var qe=[];if(Ze.forEach(function(Ke){se.has(Ke)&&qe.push(Ke)}),qe.length>0){var pt=0;qe.forEach(function(Ke){ue=="horizontal"?(Te.set(Ke,b.has(Ke)?_[b.get(Ke)]:he.get(Ke)),pt+=Te.get(Ke)):(Te.set(Ke,b.has(Ke)?R[b.get(Ke)]:he.get(Ke)),pt+=Te.get(Ke))}),pt=pt/qe.length,Ze.forEach(function(Ke){se.has(Ke)||Te.set(Ke,pt)})}else{var Qe=0;Ze.forEach(function(Ke){ue=="horizontal"?Qe+=b.has(Ke)?_[b.get(Ke)]:he.get(Ke):Qe+=b.has(Ke)?R[b.get(Ke)]:he.get(Ke)}),Qe=Qe/Ze.length,Ze.forEach(function(Ke){Te.set(Ke,Qe)})}});for(var Fe=function(){var qe=ze.shift(),pt=oe.get(qe);pt.forEach(function(Qe){if(Te.get(Qe.id)<Te.get(qe)+Qe.gap)if(se&&se.has(Qe.id)){var Ke=void 0;if(ue=="horizontal"?Ke=b.has(Qe.id)?_[b.get(Qe.id)]:he.get(Qe.id):Ke=b.has(Qe.id)?R[b.get(Qe.id)]:he.get(Qe.id),Te.set(Qe.id,Ke),Ke<Te.get(qe)+Qe.gap){var xt=Te.get(qe)+Qe.gap-Ke;Re.get(qe).forEach(function(st){Te.set(st,Te.get(st)-xt)})}}else Te.set(Qe.id,Te.get(qe)+Qe.gap);Se.set(Qe.id,Se.get(Qe.id)-1),Se.get(Qe.id)==0&&ze.push(Qe.id),se&&Re.set(Qe.id,be(Re.get(qe),Re.get(Qe.id)))})};ze.length!=0;)Fe();if(se){var Ge=new Set;oe.forEach(function(Ze,qe){Ze.length==0&&Ge.add(qe)});var it=[];Re.forEach(function(Ze,qe){if(Ge.has(qe)){var pt=!1,Qe=!0,Ke=!1,xt=void 0;try{for(var st=Ze[Symbol.iterator](),vt;!(Qe=(vt=st.next()).done);Qe=!0){var yt=vt.value;se.has(yt)&&(pt=!0)}}catch(kt){Ke=!0,xt=kt}finally{try{!Qe&&st.return&&st.return()}finally{if(Ke)throw xt}}if(!pt){var Rt=!1,It=void 0;it.forEach(function(kt,Tr){kt.has([].concat(c(Ze))[0])&&(Rt=!0,It=Tr)}),Rt?Ze.forEach(function(kt){it[It].add(kt)}):it.push(new Set(Ze))}}}),it.forEach(function(Ze,qe){var pt=Number.POSITIVE_INFINITY,Qe=Number.POSITIVE_INFINITY,Ke=Number.NEGATIVE_INFINITY,xt=Number.NEGATIVE_INFINITY,st=!0,vt=!1,yt=void 0;try{for(var Rt=Ze[Symbol.iterator](),It;!(st=(It=Rt.next()).done);st=!0){var kt=It.value,Tr=void 0;ue=="horizontal"?Tr=b.has(kt)?_[b.get(kt)]:he.get(kt):Tr=b.has(kt)?R[b.get(kt)]:he.get(kt);var Pr=Te.get(kt);Tr<pt&&(pt=Tr),Tr>Ke&&(Ke=Tr),Pr<Qe&&(Qe=Pr),Pr>xt&&(xt=Pr)}}catch(Dn){vt=!0,yt=Dn}finally{try{!st&&Rt.return&&Rt.return()}finally{if(vt)throw yt}}var ur=(pt+Ke)/2-(Qe+xt)/2,At=!0,Kt=!1,Vr=void 0;try{for(var ir=Ze[Symbol.iterator](),Un;!(At=(Un=ir.next()).done);At=!0){var Nn=Un.value;Te.set(Nn,Te.get(Nn)+ur)}}catch(Dn){Kt=!0,Vr=Dn}finally{try{!At&&ir.return&&ir.return()}finally{if(Kt)throw Vr}}})}return Te},j=function(oe){var ue=0,se=0,he=0,pe=0;if(oe.forEach(function(Re){Re.left?_[b.get(Re.left)]-_[b.get(Re.right)]>=0?ue++:se++:R[b.get(Re.top)]-R[b.get(Re.bottom)]>=0?he++:pe++}),ue>se&&he>pe)for(var be=0;be<b.size;be++)_[be]=-1*_[be],R[be]=-1*R[be];else if(ue>se)for(var Se=0;Se<b.size;Se++)_[Se]=-1*_[Se];else if(he>pe)for(var Te=0;Te<b.size;Te++)R[Te]=-1*R[Te]},D=function(oe){var ue=[],se=new g,he=new Set,pe=0;return oe.forEach(function(be,Se){if(!he.has(Se)){ue[pe]=[];var Te=Se;for(se.push(Te),he.add(Te),ue[pe].push(Te);se.length!=0;){Te=se.shift();var Re=oe.get(Te);Re.forEach(function(ze){he.has(ze.id)||(se.push(ze.id),he.add(ze.id),ue[pe].push(ze.id))})}pe++}}),ue},I=function(oe){var ue=new Map;return oe.forEach(function(se,he){ue.set(he,[])}),oe.forEach(function(se,he){se.forEach(function(pe){ue.get(he).push(pe),ue.get(pe.id).push({id:he,gap:pe.gap,direction:pe.direction})})}),ue},U=function(oe){var ue=new Map;return oe.forEach(function(se,he){ue.set(he,[])}),oe.forEach(function(se,he){se.forEach(function(pe){ue.get(pe.id).push({id:he,gap:pe.gap,direction:pe.direction})})}),ue},W=[],H=[],z=!1,P=!1,F=new Set,G=new Map,$=new Map,ee=[];if(m.fixedNodeConstraint&&m.fixedNodeConstraint.forEach(function(te){F.add(te.nodeId)}),m.relativePlacementConstraint&&(m.relativePlacementConstraint.forEach(function(te){te.left?(G.has(te.left)?G.get(te.left).push({id:te.right,gap:te.gap,direction:"horizontal"}):G.set(te.left,[{id:te.right,gap:te.gap,direction:"horizontal"}]),G.has(te.right)||G.set(te.right,[])):(G.has(te.top)?G.get(te.top).push({id:te.bottom,gap:te.gap,direction:"vertical"}):G.set(te.top,[{id:te.bottom,gap:te.gap,direction:"vertical"}]),G.has(te.bottom)||G.set(te.bottom,[]))}),$=I(G),ee=D($)),h.TRANSFORM_ON_CONSTRAINT_HANDLING){if(m.fixedNodeConstraint&&m.fixedNodeConstraint.length>1)m.fixedNodeConstraint.forEach(function(te,oe){W[oe]=[te.position.x,te.position.y],H[oe]=[_[b.get(te.nodeId)],R[b.get(te.nodeId)]]}),z=!0;else if(m.alignmentConstraint)(function(){var te=0;if(m.alignmentConstraint.vertical){for(var oe=m.alignmentConstraint.vertical,ue=function(Te){var Re=new Set;oe[Te].forEach(function(Ge){Re.add(Ge)});var ze=new Set([].concat(c(Re)).filter(function(Ge){return F.has(Ge)})),Fe=void 0;ze.size>0?Fe=_[b.get(ze.values().next().value)]:Fe=B(Re).x,oe[Te].forEach(function(Ge){W[te]=[Fe,R[b.get(Ge)]],H[te]=[_[b.get(Ge)],R[b.get(Ge)]],te++})},se=0;se<oe.length;se++)ue(se);z=!0}if(m.alignmentConstraint.horizontal){for(var he=m.alignmentConstraint.horizontal,pe=function(Te){var Re=new Set;he[Te].forEach(function(Ge){Re.add(Ge)});var ze=new Set([].concat(c(Re)).filter(function(Ge){return F.has(Ge)})),Fe=void 0;ze.size>0?Fe=_[b.get(ze.values().next().value)]:Fe=B(Re).y,he[Te].forEach(function(Ge){W[te]=[_[b.get(Ge)],Fe],H[te]=[_[b.get(Ge)],R[b.get(Ge)]],te++})},be=0;be<he.length;be++)pe(be);z=!0}m.relativePlacementConstraint&&(P=!0)})();else if(m.relativePlacementConstraint){for(var re=0,ne=0,Y=0;Y<ee.length;Y++)ee[Y].length>re&&(re=ee[Y].length,ne=Y);if(re<$.size/2)j(m.relativePlacementConstraint),z=!1,P=!1;else{var q=new Map,K=new Map,X=[];ee[ne].forEach(function(te){G.get(te).forEach(function(oe){oe.direction=="horizontal"?(q.has(te)?q.get(te).push(oe):q.set(te,[oe]),q.has(oe.id)||q.set(oe.id,[]),X.push({left:te,right:oe.id})):(K.has(te)?K.get(te).push(oe):K.set(te,[oe]),K.has(oe.id)||K.set(oe.id,[]),X.push({top:te,bottom:oe.id}))})}),j(X),P=!1;var J=A(q,"horizontal"),ie=A(K,"vertical");ee[ne].forEach(function(te,oe){H[oe]=[_[b.get(te)],R[b.get(te)]],W[oe]=[],J.has(te)?W[oe][0]=J.get(te):W[oe][0]=_[b.get(te)],ie.has(te)?W[oe][1]=ie.get(te):W[oe][1]=R[b.get(te)]}),z=!0}}if(z){for(var ce=void 0,de=p.transpose(W),Le=p.transpose(H),je=0;je<de.length;je++)de[je]=p.multGamma(de[je]),Le[je]=p.multGamma(Le[je]);var _e=p.multMat(de,p.transpose(Le)),ke=x.svd(_e);ce=p.multMat(ke.V,p.transpose(ke.U));for(var Ne=0;Ne<b.size;Ne++){var Ee=[_[Ne],R[Ne]],Me=[ce[0][0],ce[1][0]],Pe=[ce[0][1],ce[1][1]];_[Ne]=p.dotProduct(Ee,Me),R[Ne]=p.dotProduct(Ee,Pe)}P&&j(m.relativePlacementConstraint)}}if(h.ENFORCE_CONSTRAINTS){if(m.fixedNodeConstraint&&m.fixedNodeConstraint.length>0){var De={x:0,y:0};m.fixedNodeConstraint.forEach(function(te,oe){var ue={x:_[b.get(te.nodeId)],y:R[b.get(te.nodeId)]},se=te.position,he=M(se,ue);De.x+=he.x,De.y+=he.y}),De.x/=m.fixedNodeConstraint.length,De.y/=m.fixedNodeConstraint.length,_.forEach(function(te,oe){_[oe]+=De.x}),R.forEach(function(te,oe){R[oe]+=De.y}),m.fixedNodeConstraint.forEach(function(te){_[b.get(te.nodeId)]=te.position.x,R[b.get(te.nodeId)]=te.position.y})}if(m.alignmentConstraint){if(m.alignmentConstraint.vertical)for(var Ue=m.alignmentConstraint.vertical,Ye=function(oe){var ue=new Set;Ue[oe].forEach(function(pe){ue.add(pe)});var se=new Set([].concat(c(ue)).filter(function(pe){return F.has(pe)})),he=void 0;se.size>0?he=_[b.get(se.values().next().value)]:he=B(ue).x,ue.forEach(function(pe){F.has(pe)||(_[b.get(pe)]=he)})},ge=0;ge<Ue.length;ge++)Ye(ge);if(m.alignmentConstraint.horizontal)for(var Ce=m.alignmentConstraint.horizontal,Ae=function(oe){var ue=new Set;Ce[oe].forEach(function(pe){ue.add(pe)});var se=new Set([].concat(c(ue)).filter(function(pe){return F.has(pe)})),he=void 0;se.size>0?he=R[b.get(se.values().next().value)]:he=B(ue).y,ue.forEach(function(pe){F.has(pe)||(R[b.get(pe)]=he)})},Be=0;Be<Ce.length;Be++)Ae(Be)}m.relativePlacementConstraint&&(function(){var te=new Map,oe=new Map,ue=new Map,se=new Map,he=new Map,pe=new Map,be=new Set,Se=new Set;if(F.forEach(function(Qt){be.add(Qt),Se.add(Qt)}),m.alignmentConstraint){if(m.alignmentConstraint.vertical)for(var Te=m.alignmentConstraint.vertical,Re=function(rt){ue.set("dummy"+rt,[]),Te[rt].forEach(function(Et){te.set(Et,"dummy"+rt),ue.get("dummy"+rt).push(Et),F.has(Et)&&be.add("dummy"+rt)}),he.set("dummy"+rt,_[b.get(Te[rt][0])])},ze=0;ze<Te.length;ze++)Re(ze);if(m.alignmentConstraint.horizontal)for(var Fe=m.alignmentConstraint.horizontal,Ge=function(rt){se.set("dummy"+rt,[]),Fe[rt].forEach(function(Et){oe.set(Et,"dummy"+rt),se.get("dummy"+rt).push(Et),F.has(Et)&&Se.add("dummy"+rt)}),pe.set("dummy"+rt,R[b.get(Fe[rt][0])])},it=0;it<Fe.length;it++)Ge(it)}var Ze=new Map,qe=new Map,pt=function(rt){G.get(rt).forEach(function(Et){var er=void 0,cr=void 0;Et.direction=="horizontal"?(er=te.get(rt)?te.get(rt):rt,te.get(Et.id)?cr={id:te.get(Et.id),gap:Et.gap,direction:Et.direction}:cr=Et,Ze.has(er)?Ze.get(er).push(cr):Ze.set(er,[cr]),Ze.has(cr.id)||Ze.set(cr.id,[])):(er=oe.get(rt)?oe.get(rt):rt,oe.get(Et.id)?cr={id:oe.get(Et.id),gap:Et.gap,direction:Et.direction}:cr=Et,qe.has(er)?qe.get(er).push(cr):qe.set(er,[cr]),qe.has(cr.id)||qe.set(cr.id,[]))})},Qe=!0,Ke=!1,xt=void 0;try{for(var st=G.keys()[Symbol.iterator](),vt;!(Qe=(vt=st.next()).done);Qe=!0){var yt=vt.value;pt(yt)}}catch(Qt){Ke=!0,xt=Qt}finally{try{!Qe&&st.return&&st.return()}finally{if(Ke)throw xt}}var Rt=I(Ze),It=I(qe),kt=D(Rt),Tr=D(It),Pr=U(Ze),ur=U(qe),At=[],Kt=[];kt.forEach(function(Qt,rt){At[rt]=[],Qt.forEach(function(Et){Pr.get(Et).length==0&&At[rt].push(Et)})}),Tr.forEach(function(Qt,rt){Kt[rt]=[],Qt.forEach(function(Et){ur.get(Et).length==0&&Kt[rt].push(Et)})});var Vr=A(Ze,"horizontal",be,he,At),ir=A(qe,"vertical",Se,pe,Kt),Un=function(rt){ue.get(rt)?ue.get(rt).forEach(function(Et){_[b.get(Et)]=Vr.get(rt)}):_[b.get(rt)]=Vr.get(rt)},Nn=!0,Dn=!1,ca=void 0;try{for(var ha=Vr.keys()[Symbol.iterator](),$a;!(Nn=($a=ha.next()).done);Nn=!0){var zt=$a.value;Un(zt)}}catch(Qt){Dn=!0,ca=Qt}finally{try{!Nn&&ha.return&&ha.return()}finally{if(Dn)throw ca}}var eo=function(rt){se.get(rt)?se.get(rt).forEach(function(Et){R[b.get(Et)]=ir.get(rt)}):R[b.get(rt)]=ir.get(rt)},un=!0,ii=!1,xn=void 0;try{for(var bi=ir.keys()[Symbol.iterator](),wi;!(un=(wi=bi.next()).done);un=!0){var zt=wi.value;eo(zt)}}catch(Qt){ii=!0,xn=Qt}finally{try{!un&&bi.return&&bi.return()}finally{if(ii)throw xn}}})()}for(var me=0;me<E.length;me++){var Z=E[me];Z.getChild()==null&&Z.setCenter(_[b.get(Z.id)],R[b.get(Z.id)])}},a.exports=w}),551:(a=>{a.exports=r})},i={};function s(a){var l=i[a];if(l!==void 0)return l.exports;var u=i[a]={exports:{}};return n[a](u,u.exports,s),u.exports}var o=s(45);return o})()})})(bc)),bc.exports}var GD=xc.exports,q1;function qD(){return q1||(q1=1,(function(t,e){(function(n,i){t.exports=i($D())})(GD,function(r){return(()=>{var n={658:(a=>{a.exports=Object.assign!=null?Object.assign.bind(Object):function(l){for(var u=arguments.length,c=Array(u>1?u-1:0),h=1;h<u;h++)c[h-1]=arguments[h];return c.forEach(function(g){Object.keys(g).forEach(function(p){return l[p]=g[p]})}),l}}),548:((a,l,u)=>{var c=(function(){function p(x,w){var v=[],m=!0,y=!1,b=void 0;try{for(var _=x[Symbol.iterator](),R;!(m=(R=_.next()).done)&&(v.push(R.value),!(w&&v.length===w));m=!0);}catch(E){y=!0,b=E}finally{try{!m&&_.return&&_.return()}finally{if(y)throw b}}return v}return function(x,w){if(Array.isArray(x))return x;if(Symbol.iterator in Object(x))return p(x,w);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),h=u(140).layoutBase.LinkedList,g={};g.getTopMostNodes=function(p){for(var x={},w=0;w<p.length;w++)x[p[w].id()]=!0;var v=p.filter(function(m,y){typeof m=="number"&&(m=y);for(var b=m.parent()[0];b!=null;){if(x[b.id()])return!1;b=b.parent()[0]}return!0});return v},g.connectComponents=function(p,x,w,v){var m=new h,y=new Set,b=[],_=void 0,R=void 0,E=void 0,T=!1,k=1,N=[],M=[],B=function(){var j=p.collection();M.push(j);var D=w[0],I=p.collection();I.merge(D).merge(D.descendants().intersection(x)),b.push(D),I.forEach(function(H){m.push(H),y.add(H),j.merge(H)});for(var U=function(){D=m.shift();var z=p.collection();D.neighborhood().nodes().forEach(function($){x.intersection(D.edgesWith($)).length>0&&z.merge($)});for(var P=0;P<z.length;P++){var F=z[P];if(_=w.intersection(F.union(F.ancestors())),_!=null&&!y.has(_[0])){var G=_.union(_.descendants());G.forEach(function($){m.push($),y.add($),j.merge($),w.has($)&&b.push($)})}}};m.length!=0;)U();if(j.forEach(function(H){x.intersection(H.connectedEdges()).forEach(function(z){j.has(z.source())&&j.has(z.target())&&j.merge(z)})}),b.length==w.length&&(T=!0),!T||T&&k>1){R=b[0],E=R.connectedEdges().length,b.forEach(function(H){H.connectedEdges().length<E&&(E=H.connectedEdges().length,R=H)}),N.push(R.id());var W=p.collection();W.merge(b[0]),b.forEach(function(H){W.merge(H)}),b=[],w=w.difference(W),k++}};do B();while(!T);return v&&N.length>0&&v.set("dummy"+(v.size+1),N),M},g.relocateComponent=function(p,x,w){if(!w.fixedNodeConstraint){var v=Number.POSITIVE_INFINITY,m=Number.NEGATIVE_INFINITY,y=Number.POSITIVE_INFINITY,b=Number.NEGATIVE_INFINITY;if(w.quality=="draft"){var _=!0,R=!1,E=void 0;try{for(var T=x.nodeIndexes[Symbol.iterator](),k;!(_=(k=T.next()).done);_=!0){var N=k.value,M=c(N,2),B=M[0],A=M[1],j=w.cy.getElementById(B);if(j){var D=j.boundingBox(),I=x.xCoords[A]-D.w/2,U=x.xCoords[A]+D.w/2,W=x.yCoords[A]-D.h/2,H=x.yCoords[A]+D.h/2;I<v&&(v=I),U>m&&(m=U),W<y&&(y=W),H>b&&(b=H)}}}catch($){R=!0,E=$}finally{try{!_&&T.return&&T.return()}finally{if(R)throw E}}var z=p.x-(m+v)/2,P=p.y-(b+y)/2;x.xCoords=x.xCoords.map(function($){return $+z}),x.yCoords=x.yCoords.map(function($){return $+P})}else{Object.keys(x).forEach(function($){var ee=x[$],re=ee.getRect().x,ne=ee.getRect().x+ee.getRect().width,Y=ee.getRect().y,q=ee.getRect().y+ee.getRect().height;re<v&&(v=re),ne>m&&(m=ne),Y<y&&(y=Y),q>b&&(b=q)});var F=p.x-(m+v)/2,G=p.y-(b+y)/2;Object.keys(x).forEach(function($){var ee=x[$];ee.setCenter(ee.getCenterX()+F,ee.getCenterY()+G)})}}},g.calcBoundingBox=function(p,x,w,v){for(var m=Number.MAX_SAFE_INTEGER,y=Number.MIN_SAFE_INTEGER,b=Number.MAX_SAFE_INTEGER,_=Number.MIN_SAFE_INTEGER,R=void 0,E=void 0,T=void 0,k=void 0,N=p.descendants().not(":parent"),M=N.length,B=0;B<M;B++){var A=N[B];R=x[v.get(A.id())]-A.width()/2,E=x[v.get(A.id())]+A.width()/2,T=w[v.get(A.id())]-A.height()/2,k=w[v.get(A.id())]+A.height()/2,m>R&&(m=R),y<E&&(y=E),b>T&&(b=T),_<k&&(_=k)}var j={};return j.topLeftX=m,j.topLeftY=b,j.width=y-m,j.height=_-b,j},g.calcParentsWithoutChildren=function(p,x){var w=p.collection();return x.nodes(":parent").forEach(function(v){var m=!1;v.children().forEach(function(y){y.css("display")!="none"&&(m=!0)}),m||w.merge(v)}),w},a.exports=g}),816:((a,l,u)=>{var c=u(548),h=u(140).CoSELayout,g=u(140).CoSENode,p=u(140).layoutBase.PointD,x=u(140).layoutBase.DimensionD,w=u(140).layoutBase.LayoutConstants,v=u(140).layoutBase.FDLayoutConstants,m=u(140).CoSEConstants,y=function(_,R){var E=_.cy,T=_.eles,k=T.nodes(),N=T.edges(),M=void 0,B=void 0,A=void 0,j={};_.randomize&&(M=R.nodeIndexes,B=R.xCoords,A=R.yCoords);var D=function($){return typeof $=="function"},I=function($,ee){return D($)?$(ee):$},U=c.calcParentsWithoutChildren(E,T),W=function G($,ee,re,ne){for(var Y=ee.length,q=0;q<Y;q++){var K=ee[q],X=null;K.intersection(U).length==0&&(X=K.children());var J=void 0,ie=K.layoutDimensions({nodeDimensionsIncludeLabels:ne.nodeDimensionsIncludeLabels});if(K.outerWidth()!=null&&K.outerHeight()!=null)if(ne.randomize)if(!K.isParent())J=$.add(new g(re.graphManager,new p(B[M.get(K.id())]-ie.w/2,A[M.get(K.id())]-ie.h/2),new x(parseFloat(ie.w),parseFloat(ie.h))));else{var ce=c.calcBoundingBox(K,B,A,M);K.intersection(U).length==0?J=$.add(new g(re.graphManager,new p(ce.topLeftX,ce.topLeftY),new x(ce.width,ce.height))):J=$.add(new g(re.graphManager,new p(ce.topLeftX,ce.topLeftY),new x(parseFloat(ie.w),parseFloat(ie.h))))}else J=$.add(new g(re.graphManager,new p(K.position("x")-ie.w/2,K.position("y")-ie.h/2),new x(parseFloat(ie.w),parseFloat(ie.h))));else J=$.add(new g(this.graphManager));if(J.id=K.data("id"),J.nodeRepulsion=I(ne.nodeRepulsion,K),J.paddingLeft=parseInt(K.css("padding")),J.paddingTop=parseInt(K.css("padding")),J.paddingRight=parseInt(K.css("padding")),J.paddingBottom=parseInt(K.css("padding")),ne.nodeDimensionsIncludeLabels&&(J.labelWidth=K.boundingBox({includeLabels:!0,includeNodes:!1,includeOverlays:!1}).w,J.labelHeight=K.boundingBox({includeLabels:!0,includeNodes:!1,includeOverlays:!1}).h,J.labelPosVertical=K.css("text-valign"),J.labelPosHorizontal=K.css("text-halign")),j[K.data("id")]=J,isNaN(J.rect.x)&&(J.rect.x=0),isNaN(J.rect.y)&&(J.rect.y=0),X!=null&&X.length>0){var de=void 0;de=re.getGraphManager().add(re.newGraph(),J),G(de,X,re,ne)}}},H=function($,ee,re){for(var ne=0,Y=0,q=0;q<re.length;q++){var K=re[q],X=j[K.data("source")],J=j[K.data("target")];if(X&&J&&X!==J&&X.getEdgesBetween(J).length==0){var ie=ee.add($.newEdge(),X,J);ie.id=K.id(),ie.idealLength=I(_.idealEdgeLength,K),ie.edgeElasticity=I(_.edgeElasticity,K),ne+=ie.idealLength,Y++}}_.idealEdgeLength!=null&&(Y>0?m.DEFAULT_EDGE_LENGTH=v.DEFAULT_EDGE_LENGTH=ne/Y:D(_.idealEdgeLength)?m.DEFAULT_EDGE_LENGTH=v.DEFAULT_EDGE_LENGTH=50:m.DEFAULT_EDGE_LENGTH=v.DEFAULT_EDGE_LENGTH=_.idealEdgeLength,m.MIN_REPULSION_DIST=v.MIN_REPULSION_DIST=v.DEFAULT_EDGE_LENGTH/10,m.DEFAULT_RADIAL_SEPARATION=v.DEFAULT_EDGE_LENGTH)},z=function($,ee){ee.fixedNodeConstraint&&($.constraints.fixedNodeConstraint=ee.fixedNodeConstraint),ee.alignmentConstraint&&($.constraints.alignmentConstraint=ee.alignmentConstraint),ee.relativePlacementConstraint&&($.constraints.relativePlacementConstraint=ee.relativePlacementConstraint)};_.nestingFactor!=null&&(m.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=v.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=_.nestingFactor),_.gravity!=null&&(m.DEFAULT_GRAVITY_STRENGTH=v.DEFAULT_GRAVITY_STRENGTH=_.gravity),_.numIter!=null&&(m.MAX_ITERATIONS=v.MAX_ITERATIONS=_.numIter),_.gravityRange!=null&&(m.DEFAULT_GRAVITY_RANGE_FACTOR=v.DEFAULT_GRAVITY_RANGE_FACTOR=_.gravityRange),_.gravityCompound!=null&&(m.DEFAULT_COMPOUND_GRAVITY_STRENGTH=v.DEFAULT_COMPOUND_GRAVITY_STRENGTH=_.gravityCompound),_.gravityRangeCompound!=null&&(m.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=v.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=_.gravityRangeCompound),_.initialEnergyOnIncremental!=null&&(m.DEFAULT_COOLING_FACTOR_INCREMENTAL=v.DEFAULT_COOLING_FACTOR_INCREMENTAL=_.initialEnergyOnIncremental),_.tilingCompareBy!=null&&(m.TILING_COMPARE_BY=_.tilingCompareBy),_.quality=="proof"?w.QUALITY=2:w.QUALITY=0,m.NODE_DIMENSIONS_INCLUDE_LABELS=v.NODE_DIMENSIONS_INCLUDE_LABELS=w.NODE_DIMENSIONS_INCLUDE_LABELS=_.nodeDimensionsIncludeLabels,m.DEFAULT_INCREMENTAL=v.DEFAULT_INCREMENTAL=w.DEFAULT_INCREMENTAL=!_.randomize,m.ANIMATE=v.ANIMATE=w.ANIMATE=_.animate,m.TILE=_.tile,m.TILING_PADDING_VERTICAL=typeof _.tilingPaddingVertical=="function"?_.tilingPaddingVertical.call():_.tilingPaddingVertical,m.TILING_PADDING_HORIZONTAL=typeof _.tilingPaddingHorizontal=="function"?_.tilingPaddingHorizontal.call():_.tilingPaddingHorizontal,m.DEFAULT_INCREMENTAL=v.DEFAULT_INCREMENTAL=w.DEFAULT_INCREMENTAL=!0,m.PURE_INCREMENTAL=!_.randomize,w.DEFAULT_UNIFORM_LEAF_NODE_SIZES=_.uniformNodeDimensions,_.step=="transformed"&&(m.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,m.ENFORCE_CONSTRAINTS=!1,m.APPLY_LAYOUT=!1),_.step=="enforced"&&(m.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,m.ENFORCE_CONSTRAINTS=!0,m.APPLY_LAYOUT=!1),_.step=="cose"&&(m.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,m.ENFORCE_CONSTRAINTS=!1,m.APPLY_LAYOUT=!0),_.step=="all"&&(_.randomize?m.TRANSFORM_ON_CONSTRAINT_HANDLING=!0:m.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,m.ENFORCE_CONSTRAINTS=!0,m.APPLY_LAYOUT=!0),_.fixedNodeConstraint||_.alignmentConstraint||_.relativePlacementConstraint?m.TREE_REDUCTION_ON_INCREMENTAL=!1:m.TREE_REDUCTION_ON_INCREMENTAL=!0;var P=new h,F=P.newGraphManager();return W(F.addRoot(),c.getTopMostNodes(k),P,_),H(P,F,N),z(P,_),P.runLayout(),j};a.exports={coseLayout:y}}),212:((a,l,u)=>{var c=(function(){function _(R,E){for(var T=0;T<E.length;T++){var k=E[T];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(R,k.key,k)}}return function(R,E,T){return E&&_(R.prototype,E),T&&_(R,T),R}})();function h(_,R){if(!(_ instanceof R))throw new TypeError("Cannot call a class as a function")}var g=u(658),p=u(548),x=u(657),w=x.spectralLayout,v=u(816),m=v.coseLayout,y=Object.freeze({quality:"default",randomize:!0,animate:!0,animationDuration:1e3,animationEasing:void 0,fit:!0,padding:30,nodeDimensionsIncludeLabels:!1,uniformNodeDimensions:!1,packComponents:!0,step:"all",samplingType:!0,sampleSize:25,nodeSeparation:75,piTol:1e-7,nodeRepulsion:function(R){return 4500},idealEdgeLength:function(R){return 50},edgeElasticity:function(R){return .45},nestingFactor:.1,gravity:.25,numIter:2500,tile:!0,tilingCompareBy:void 0,tilingPaddingVertical:10,tilingPaddingHorizontal:10,gravityRangeCompound:1.5,gravityCompound:1,gravityRange:3.8,initialEnergyOnIncremental:.3,fixedNodeConstraint:void 0,alignmentConstraint:void 0,relativePlacementConstraint:void 0,ready:function(){},stop:function(){}}),b=(function(){function _(R){h(this,_),this.options=g({},y,R)}return c(_,[{key:"run",value:function(){var E=this,T=this.options,k=T.cy,N=T.eles,M=[],B=[],A=void 0,j=[];T.fixedNodeConstraint&&(!Array.isArray(T.fixedNodeConstraint)||T.fixedNodeConstraint.length==0)&&(T.fixedNodeConstraint=void 0),T.alignmentConstraint&&(T.alignmentConstraint.vertical&&(!Array.isArray(T.alignmentConstraint.vertical)||T.alignmentConstraint.vertical.length==0)&&(T.alignmentConstraint.vertical=void 0),T.alignmentConstraint.horizontal&&(!Array.isArray(T.alignmentConstraint.horizontal)||T.alignmentConstraint.horizontal.length==0)&&(T.alignmentConstraint.horizontal=void 0)),T.relativePlacementConstraint&&(!Array.isArray(T.relativePlacementConstraint)||T.relativePlacementConstraint.length==0)&&(T.relativePlacementConstraint=void 0);var D=T.fixedNodeConstraint||T.alignmentConstraint||T.relativePlacementConstraint;D&&(T.tile=!1,T.packComponents=!1);var I=void 0,U=!1;if(k.layoutUtilities&&T.packComponents&&(I=k.layoutUtilities("get"),I||(I=k.layoutUtilities()),U=!0),N.nodes().length>0)if(U){var z=p.getTopMostNodes(T.eles.nodes());if(A=p.connectComponents(k,T.eles,z),A.forEach(function(_e){var ke=_e.boundingBox();j.push({x:ke.x1+ke.w/2,y:ke.y1+ke.h/2})}),T.randomize&&A.forEach(function(_e){T.eles=_e,M.push(w(T))}),T.quality=="default"||T.quality=="proof"){var P=k.collection();if(T.tile){var F=new Map,G=[],$=[],ee=0,re={nodeIndexes:F,xCoords:G,yCoords:$},ne=[];if(A.forEach(function(_e,ke){_e.edges().length==0&&(_e.nodes().forEach(function(Ne,Ee){P.merge(_e.nodes()[Ee]),Ne.isParent()||(re.nodeIndexes.set(_e.nodes()[Ee].id(),ee++),re.xCoords.push(_e.nodes()[0].position().x),re.yCoords.push(_e.nodes()[0].position().y))}),ne.push(ke))}),P.length>1){var Y=P.boundingBox();j.push({x:Y.x1+Y.w/2,y:Y.y1+Y.h/2}),A.push(P),M.push(re);for(var q=ne.length-1;q>=0;q--)A.splice(ne[q],1),M.splice(ne[q],1),j.splice(ne[q],1)}}A.forEach(function(_e,ke){T.eles=_e,B.push(m(T,M[ke])),p.relocateComponent(j[ke],B[ke],T)})}else A.forEach(function(_e,ke){p.relocateComponent(j[ke],M[ke],T)});var K=new Set;if(A.length>1){var X=[],J=N.filter(function(_e){return _e.css("display")=="none"});A.forEach(function(_e,ke){var Ne=void 0;if(T.quality=="draft"&&(Ne=M[ke].nodeIndexes),_e.nodes().not(J).length>0){var Ee={};Ee.edges=[],Ee.nodes=[];var Me=void 0;_e.nodes().not(J).forEach(function(Pe){if(T.quality=="draft")if(!Pe.isParent())Me=Ne.get(Pe.id()),Ee.nodes.push({x:M[ke].xCoords[Me]-Pe.boundingbox().w/2,y:M[ke].yCoords[Me]-Pe.boundingbox().h/2,width:Pe.boundingbox().w,height:Pe.boundingbox().h});else{var De=p.calcBoundingBox(Pe,M[ke].xCoords,M[ke].yCoords,Ne);Ee.nodes.push({x:De.topLeftX,y:De.topLeftY,width:De.width,height:De.height})}else B[ke][Pe.id()]&&Ee.nodes.push({x:B[ke][Pe.id()].getLeft(),y:B[ke][Pe.id()].getTop(),width:B[ke][Pe.id()].getWidth(),height:B[ke][Pe.id()].getHeight()})}),_e.edges().forEach(function(Pe){var De=Pe.source(),Ue=Pe.target();if(De.css("display")!="none"&&Ue.css("display")!="none")if(T.quality=="draft"){var Ye=Ne.get(De.id()),ge=Ne.get(Ue.id()),Ce=[],Ae=[];if(De.isParent()){var Be=p.calcBoundingBox(De,M[ke].xCoords,M[ke].yCoords,Ne);Ce.push(Be.topLeftX+Be.width/2),Ce.push(Be.topLeftY+Be.height/2)}else Ce.push(M[ke].xCoords[Ye]),Ce.push(M[ke].yCoords[Ye]);if(Ue.isParent()){var me=p.calcBoundingBox(Ue,M[ke].xCoords,M[ke].yCoords,Ne);Ae.push(me.topLeftX+me.width/2),Ae.push(me.topLeftY+me.height/2)}else Ae.push(M[ke].xCoords[ge]),Ae.push(M[ke].yCoords[ge]);Ee.edges.push({startX:Ce[0],startY:Ce[1],endX:Ae[0],endY:Ae[1]})}else B[ke][De.id()]&&B[ke][Ue.id()]&&Ee.edges.push({startX:B[ke][De.id()].getCenterX(),startY:B[ke][De.id()].getCenterY(),endX:B[ke][Ue.id()].getCenterX(),endY:B[ke][Ue.id()].getCenterY()})}),Ee.nodes.length>0&&(X.push(Ee),K.add(ke))}});var ie=I.packComponents(X,T.randomize).shifts;if(T.quality=="draft")M.forEach(function(_e,ke){var Ne=_e.xCoords.map(function(Me){return Me+ie[ke].dx}),Ee=_e.yCoords.map(function(Me){return Me+ie[ke].dy});_e.xCoords=Ne,_e.yCoords=Ee});else{var ce=0;K.forEach(function(_e){Object.keys(B[_e]).forEach(function(ke){var Ne=B[_e][ke];Ne.setCenter(Ne.getCenterX()+ie[ce].dx,Ne.getCenterY()+ie[ce].dy)}),ce++})}}}else{var W=T.eles.boundingBox();if(j.push({x:W.x1+W.w/2,y:W.y1+W.h/2}),T.randomize){var H=w(T);M.push(H)}T.quality=="default"||T.quality=="proof"?(B.push(m(T,M[0])),p.relocateComponent(j[0],B[0],T)):p.relocateComponent(j[0],M[0],T)}var de=function(ke,Ne){if(T.quality=="default"||T.quality=="proof"){typeof ke=="number"&&(ke=Ne);var Ee=void 0,Me=void 0,Pe=ke.data("id");return B.forEach(function(Ue){Pe in Ue&&(Ee={x:Ue[Pe].getRect().getCenterX(),y:Ue[Pe].getRect().getCenterY()},Me=Ue[Pe])}),T.nodeDimensionsIncludeLabels&&(Me.labelWidth&&(Me.labelPosHorizontal=="left"?Ee.x+=Me.labelWidth/2:Me.labelPosHorizontal=="right"&&(Ee.x-=Me.labelWidth/2)),Me.labelHeight&&(Me.labelPosVertical=="top"?Ee.y+=Me.labelHeight/2:Me.labelPosVertical=="bottom"&&(Ee.y-=Me.labelHeight/2))),Ee==null&&(Ee={x:ke.position("x"),y:ke.position("y")}),{x:Ee.x,y:Ee.y}}else{var De=void 0;return M.forEach(function(Ue){var Ye=Ue.nodeIndexes.get(ke.id());Ye!=null&&(De={x:Ue.xCoords[Ye],y:Ue.yCoords[Ye]})}),De==null&&(De={x:ke.position("x"),y:ke.position("y")}),{x:De.x,y:De.y}}};if(T.quality=="default"||T.quality=="proof"||T.randomize){var Le=p.calcParentsWithoutChildren(k,N),je=N.filter(function(_e){return _e.css("display")=="none"});T.eles=N.not(je),N.nodes().not(":parent").not(je).layoutPositions(E,T,de),Le.length>0&&Le.forEach(function(_e){_e.position(de(_e))})}else console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.")}}]),_})();a.exports=b}),657:((a,l,u)=>{var c=u(548),h=u(140).layoutBase.Matrix,g=u(140).layoutBase.SVD,p=function(w){var v=w.cy,m=w.eles,y=m.nodes(),b=m.nodes(":parent"),_=new Map,R=new Map,E=new Map,T=[],k=[],N=[],M=[],B=[],A=[],j=[],D=[],I=void 0,U=1e8,W=1e-9,H=w.piTol,z=w.samplingType,P=w.nodeSeparation,F=void 0,G=function(){for(var oe=0,ue=0,se=!1;ue<F;){oe=Math.floor(Math.random()*I),se=!1;for(var he=0;he<ue;he++)if(M[he]==oe){se=!0;break}if(!se)M[ue]=oe,ue++;else continue}},$=function(oe,ue,se){for(var he=[],pe=0,be=0,Se=0,Te=void 0,Re=[],ze=0,Fe=1,Ge=0;Ge<I;Ge++)Re[Ge]=U;for(he[be]=oe,Re[oe]=0;be>=pe;){Se=he[pe++];for(var it=T[Se],Ze=0;Ze<it.length;Ze++)Te=R.get(it[Ze]),Re[Te]==U&&(Re[Te]=Re[Se]+1,he[++be]=Te);A[Se][ue]=Re[Se]*P}if(se){for(var qe=0;qe<I;qe++)A[qe][ue]<B[qe]&&(B[qe]=A[qe][ue]);for(var pt=0;pt<I;pt++)B[pt]>ze&&(ze=B[pt],Fe=pt)}return Fe},ee=function(oe){var ue=void 0;if(oe){ue=Math.floor(Math.random()*I);for(var he=0;he<I;he++)B[he]=U;for(var pe=0;pe<F;pe++)M[pe]=ue,ue=$(ue,pe,oe)}else{G();for(var se=0;se<F;se++)$(M[se],se,oe)}for(var be=0;be<I;be++)for(var Se=0;Se<F;Se++)A[be][Se]*=A[be][Se];for(var Te=0;Te<F;Te++)j[Te]=[];for(var Re=0;Re<F;Re++)for(var ze=0;ze<F;ze++)j[Re][ze]=A[M[ze]][Re]},re=function(){for(var oe=g.svd(j),ue=oe.S,se=oe.U,he=oe.V,pe=ue[0]*ue[0]*ue[0],be=[],Se=0;Se<F;Se++){be[Se]=[];for(var Te=0;Te<F;Te++)be[Se][Te]=0,Se==Te&&(be[Se][Te]=ue[Se]/(ue[Se]*ue[Se]+pe/(ue[Se]*ue[Se])))}D=h.multMat(h.multMat(he,be),h.transpose(se))},ne=function(){for(var oe=void 0,ue=void 0,se=[],he=[],pe=[],be=[],Se=0;Se<I;Se++)se[Se]=Math.random(),he[Se]=Math.random();se=h.normalize(se),he=h.normalize(he);for(var Te=W,Re=W,ze=void 0;;){for(var Fe=0;Fe<I;Fe++)pe[Fe]=se[Fe];if(se=h.multGamma(h.multL(h.multGamma(pe),A,D)),oe=h.dotProduct(pe,se),se=h.normalize(se),Te=h.dotProduct(pe,se),ze=Math.abs(Te/Re),ze<=1+H&&ze>=1)break;Re=Te}for(var Ge=0;Ge<I;Ge++)pe[Ge]=se[Ge];for(Re=W;;){for(var it=0;it<I;it++)be[it]=he[it];if(be=h.minusOp(be,h.multCons(pe,h.dotProduct(pe,be))),he=h.multGamma(h.multL(h.multGamma(be),A,D)),ue=h.dotProduct(be,he),he=h.normalize(he),Te=h.dotProduct(be,he),ze=Math.abs(Te/Re),ze<=1+H&&ze>=1)break;Re=Te}for(var Ze=0;Ze<I;Ze++)be[Ze]=he[Ze];k=h.multCons(pe,Math.sqrt(Math.abs(oe))),N=h.multCons(be,Math.sqrt(Math.abs(ue)))};c.connectComponents(v,m,c.getTopMostNodes(y),_),b.forEach(function(te){c.connectComponents(v,m,c.getTopMostNodes(te.descendants().intersection(m)),_)});for(var Y=0,q=0;q<y.length;q++)y[q].isParent()||R.set(y[q].id(),Y++);var K=!0,X=!1,J=void 0;try{for(var ie=_.keys()[Symbol.iterator](),ce;!(K=(ce=ie.next()).done);K=!0){var de=ce.value;R.set(de,Y++)}}catch(te){X=!0,J=te}finally{try{!K&&ie.return&&ie.return()}finally{if(X)throw J}}for(var Le=0;Le<R.size;Le++)T[Le]=[];b.forEach(function(te){for(var oe=te.children().intersection(m);oe.nodes(":childless").length==0;)oe=oe.nodes()[0].children().intersection(m);var ue=0,se=oe.nodes(":childless")[0].connectedEdges().length;oe.nodes(":childless").forEach(function(he,pe){he.connectedEdges().length<se&&(se=he.connectedEdges().length,ue=pe)}),E.set(te.id(),oe.nodes(":childless")[ue].id())}),y.forEach(function(te){var oe=void 0;te.isParent()?oe=R.get(E.get(te.id())):oe=R.get(te.id()),te.neighborhood().nodes().forEach(function(ue){m.intersection(te.edgesWith(ue)).length>0&&(ue.isParent()?T[oe].push(E.get(ue.id())):T[oe].push(ue.id()))})});var je=function(oe){var ue=R.get(oe),se=void 0;_.get(oe).forEach(function(he){v.getElementById(he).isParent()?se=E.get(he):se=he,T[ue].push(se),T[R.get(se)].push(oe)})},_e=!0,ke=!1,Ne=void 0;try{for(var Ee=_.keys()[Symbol.iterator](),Me;!(_e=(Me=Ee.next()).done);_e=!0){var Pe=Me.value;je(Pe)}}catch(te){ke=!0,Ne=te}finally{try{!_e&&Ee.return&&Ee.return()}finally{if(ke)throw Ne}}I=R.size;var De=void 0;if(I>2){F=I<w.sampleSize?I:w.sampleSize;for(var Ue=0;Ue<I;Ue++)A[Ue]=[];for(var Ye=0;Ye<F;Ye++)D[Ye]=[];return w.quality=="draft"||w.step=="all"?(ee(z),re(),ne(),De={nodeIndexes:R,xCoords:k,yCoords:N}):(R.forEach(function(te,oe){k.push(v.getElementById(oe).position("x")),N.push(v.getElementById(oe).position("y"))}),De={nodeIndexes:R,xCoords:k,yCoords:N}),De}else{var ge=R.keys(),Ce=v.getElementById(ge.next().value),Ae=Ce.position(),Be=Ce.outerWidth();if(k.push(Ae.x),N.push(Ae.y),I==2){var me=v.getElementById(ge.next().value),Z=me.outerWidth();k.push(Ae.x+Be/2+Z/2+w.idealEdgeLength),N.push(Ae.y)}return De={nodeIndexes:R,xCoords:k,yCoords:N},De}};a.exports={spectralLayout:p}}),579:((a,l,u)=>{var c=u(212),h=function(p){p&&p("layout","fcose",c)};typeof cytoscape<"u"&&h(cytoscape),a.exports=h}),140:(a=>{a.exports=r})},i={};function s(a){var l=i[a];if(l!==void 0)return l.exports;var u=i[a]={exports:{}};return n[a](u,u.exports,s),u.exports}var o=s(579);return o})()})})(xc)),xc.exports}var YD=qD();const XD=Uc(YD);na.use(XD);const KD={function:"#10b981",method:"#10b981",constructor:"#10b981",class:"#f97316",struct:"#f97316",interface:"#3b82f6",type_alias:"#3b82f6",trait:"#3b82f6",enum:"#8b5cf6",macro:"#a855f7"},QD={typescript:"#10b981",javascript:"#10b981",rust:"#f97316",python:"#3b82f6",go:"#06b6d4"};function ZD(t){var e,r;return KD[(e=t.kind)==null?void 0:e.toLowerCase()]??QD[(r=t.lang)==null?void 0:r.toLowerCase()]??"#9ca3af"}function JD(t){return Math.round(Math.min(20+Math.sqrt(t)*6,60))}function eA({nodes:t,edges:e,externalSelectedId:r,onNodeClick:n,onNodeSelect:i}){const s=ae.useRef(null),[o,a]=ae.useState(null),l=ae.useRef(new Map),u=ae.useRef(n),c=ae.useRef(i);return ae.useEffect(()=>{u.current=n,c.current=i},[n,i]),ae.useEffect(()=>{if(!s.current)return;const h=new Map(t.map((x,w)=>[x.id,`n${w}`]));l.current=h;const g=[...t.map(x=>({group:"nodes",data:{id:h.get(x.id),label:x.name||x.id.split("/").pop()||x.id,color:ZD(x),size:JD(x.inDeg),kind:x.kind,file:x.file,inDeg:x.inDeg,outDeg:x.outDeg,raw:x}})),...e.filter(x=>h.has(x.src)&&h.has(x.tgt)).map((x,w)=>({group:"edges",data:{id:`e${w}`,source:h.get(x.src),target:h.get(x.tgt)}}))],p=na({container:s.current,elements:g,style:[{selector:"node",style:{"background-color":"data(color)",label:"data(label)","font-size":10,"font-family":"ui-monospace, SFMono-Regular, Menlo, monospace",color:"#ffffff","text-valign":"center","text-halign":"center","text-outline-color":"data(color)","text-outline-width":2,"text-max-width":"120px","text-wrap":"ellipsis",width:"data(size)",height:"data(size)","border-width":0,"overlay-padding":4}},{selector:"node:selected",style:{"border-width":3,"border-color":"#fbbf24","border-opacity":1}},{selector:"node.dimmed",style:{opacity:.15}},{selector:"node.highlighted",style:{opacity:1}},{selector:"edge",style:{width:1,"line-color":"#cbd5e1","target-arrow-color":"#94a3b8","target-arrow-shape":"triangle","arrow-scale":.7,"curve-style":"bezier",opacity:.5}},{selector:"edge.highlighted",style:{"line-color":"#fbbf24","target-arrow-color":"#fbbf24",opacity:.9,width:2}},{selector:"edge.dimmed",style:{opacity:.05}}],layout:{name:"fcose",animate:!1,quality:"default",randomize:!0,idealEdgeLength:120,nodeRepulsion:8e3,numIter:2500,nodeSeparation:60},wheelSensitivity:.3,minZoom:.1,maxZoom:4});return p.on("tap","node",x=>{var m,y;const w=x.target.data("raw");(m=u.current)==null||m.call(u,w),(y=c.current)==null||y.call(c,w),p.elements().removeClass("highlighted dimmed");const v=x.target.closedNeighborhood();p.elements().addClass("dimmed"),v.removeClass("dimmed").addClass("highlighted"),x.target.select()}),p.on("tap",x=>{var w;x.target===p&&(p.elements().removeClass("highlighted dimmed"),p.elements("node").unselect(),(w=c.current)==null||w.call(c,null))}),p.ready(()=>{p.fit(void 0,40)}),a(p),()=>{p.destroy(),a(null)}},[t,e]),ae.useEffect(()=>{if(o&&(o.elements("node").unselect(),o.elements().removeClass("highlighted dimmed"),r)){const h=l.current.get(r)??r,g=o.$id(h);if(g.length){g.select();const p=g.closedNeighborhood();o.elements().addClass("dimmed"),p.removeClass("dimmed").addClass("highlighted"),o.animate({fit:{eles:p,padding:60},duration:300})}}},[o,r]),C.jsx("div",{ref:s,className:"w-full h-full"})}const tA={function:"#10b981",method:"#10b981",constructor:"#10b981",class:"#f97316",struct:"#f97316",interface:"#3b82f6",type_alias:"#3b82f6",trait:"#3b82f6",enum:"#8b5cf6",macro:"#a855f7"},rA={typescript:"#10b981",javascript:"#10b981",rust:"#f97316",python:"#3b82f6",go:"#06b6d4"};function nA(t){var e,r;return tA[(e=t.kind)==null?void 0:e.toLowerCase()]??rA[(r=t.lang)==null?void 0:r.toLowerCase()]??"#9ca3af"}function iA({nodes:t,selectedId:e,onSelect:r}){var s;const n=[...t].sort((o,a)=>a.inDeg-o.inDeg).slice(0,40),i=((s=n[0])==null?void 0:s.inDeg)??1;return C.jsx("div",{className:"h-full flex flex-col overflow-hidden",style:{background:"#0f1419"},children:C.jsx("div",{className:"flex-1 overflow-y-auto",children:n.map((o,a)=>{const l=i>0?o.inDeg/i*100:0,u=nA(o),c=o.id===e,h=o.name||o.id.split("/").pop()||o.id,g=o.file?o.file.split("/").slice(-2).join("/"):"";return C.jsxs("button",{type:"button",onClick:()=>r==null?void 0:r(o),className:"w-full text-left px-4 py-2.5 relative transition-colors border-b",style:{borderColor:"rgba(230,237,243,0.06)",background:c?"rgba(63,185,80,0.08)":"transparent"},onMouseEnter:p=>{c||(p.currentTarget.style.background="rgba(230,237,243,0.04)")},onMouseLeave:p=>{c||(p.currentTarget.style.background="transparent")},children:[C.jsx("div",{className:"absolute inset-y-0 left-0 pointer-events-none",style:{width:`${l}%`,backgroundColor:u,opacity:c?.18:.1}}),C.jsxs("div",{className:"relative flex items-center gap-2",children:[C.jsx("span",{className:"text-[10px] tabular-nums w-5 text-right shrink-0 font-mono",style:{color:"rgba(230,237,243,0.25)"},children:a+1}),C.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:u}}),C.jsxs("span",{className:"flex-1 min-w-0 flex flex-col",children:[C.jsx("span",{className:"font-mono text-[11px] truncate font-medium",style:{color:"#e6edf3"},title:o.name||o.id,children:h}),g&&C.jsxs("span",{className:"text-[9px] truncate font-mono",style:{color:"rgba(230,237,243,0.35)"},children:[o.kind&&C.jsx("span",{style:{color:"rgba(230,237,243,0.45)",marginRight:"4px"},children:o.kind}),g]})]}),C.jsx("span",{className:"shrink-0 text-[11px] font-semibold tabular-nums ml-2 font-mono",style:{color:c?"#3fb950":"rgba(230,237,243,0.6)"},children:o.inDeg})]})]},o.id)})})})}const Ve={canvas:"#0d1117",canvas2:"#161c26",surface:"#1b222e",surface2:"#0f1419",ink:"#e6edf3",muted:"rgba(230,237,243,0.55)",faint:"rgba(230,237,243,0.24)",hairline:"rgba(230,237,243,0.07)",hairlineS:"rgba(230,237,243,0.14)",accent:"#ffda19",accentInk:"#0d1117",link:"#79c0ff",ok:"#3fb950",deny:"#f85149",blue:"#1c4053",blue2:"#182f3c"},aA={function:"#10b981",method:"#10b981",constructor:"#10b981",class:"#f97316",struct:"#f97316",interface:"#3b82f6",type_alias:"#3b82f6",trait:"#3b82f6",enum:"#8b5cf6",macro:"#a855f7"},sA={typescript:"#10b981",javascript:"#10b981",rust:"#f97316",python:"#3b82f6",go:"#06b6d4"};function oA(t){var e,r;return aA[(e=t.kind)==null?void 0:e.toLowerCase()]??sA[(r=t.lang)==null?void 0:r.toLowerCase()]??"#9ca3af"}function lA({node:t,edges:e,onClose:r}){const n=e.filter(a=>a.tgt===t.id),i=e.filter(a=>a.src===t.id),s=oA(t);function o(a){const l=a.split("/");return l[l.length-1]??a}return C.jsxs("div",{className:"w-64 shrink-0 flex flex-col border-l overflow-hidden",style:{background:Ve.canvas2,borderColor:Ve.hairline},children:[C.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-2 border-b shrink-0 min-w-0",style:{borderColor:Ve.hairline},children:[C.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:s}}),C.jsx("span",{className:"text-[11px] font-semibold truncate flex-1 font-mono",style:{color:Ve.ink},title:t.name||t.id,children:t.name||t.id.split("/").pop()}),C.jsx("button",{type:"button",onClick:r,className:"shrink-0 leading-none text-base",style:{color:Ve.faint},children:"×"})]}),C.jsxs("div",{className:"overflow-y-auto flex-1 p-3 flex flex-col gap-3 text-[11px]",children:[t.kind&&C.jsxs("div",{className:"flex items-center gap-2",children:[C.jsx("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-semibold uppercase",style:{background:Ve.surface,color:Ve.muted},children:t.kind}),C.jsx("span",{className:"capitalize font-mono",style:{color:Ve.faint},children:t.lang||""})]}),t.file&&C.jsxs("div",{children:[C.jsx("p",{className:"text-[10px] mb-0.5 font-mono uppercase tracking-wide",style:{color:Ve.faint},children:"File"}),C.jsx("p",{className:"font-mono text-[10px] break-all",style:{color:Ve.muted},children:t.file})]}),C.jsxs("div",{className:"flex gap-4",children:[C.jsxs("div",{children:[C.jsx("p",{className:"text-[10px] font-mono uppercase tracking-wide mb-0.5",style:{color:Ve.faint},children:"Callers"}),C.jsx("p",{className:"font-mono font-bold",style:{color:Ve.ink},children:t.inDeg})]}),C.jsxs("div",{children:[C.jsx("p",{className:"text-[10px] font-mono uppercase tracking-wide mb-0.5",style:{color:Ve.faint},children:"Calls"}),C.jsx("p",{className:"font-mono font-bold",style:{color:Ve.ink},children:t.outDeg})]})]}),n.length>0&&C.jsxs("div",{children:[C.jsxs("p",{className:"text-[10px] font-mono uppercase tracking-wide mb-1",style:{color:Ve.faint},children:["Called by (in view) ",C.jsx("span",{style:{color:Ve.muted},children:n.length})]}),C.jsxs("div",{className:"flex flex-col gap-0.5",children:[n.slice(0,10).map(a=>C.jsx("p",{className:"font-mono text-[10px] truncate",style:{color:Ve.muted},title:a.src,children:o(a.src)},a.src)),n.length>10&&C.jsxs("p",{className:"text-[10px] font-mono",style:{color:Ve.faint},children:["+",n.length-10," more"]})]})]}),i.length>0&&C.jsxs("div",{children:[C.jsxs("p",{className:"text-[10px] font-mono uppercase tracking-wide mb-1",style:{color:Ve.faint},children:["Calls (in view) ",C.jsx("span",{style:{color:Ve.muted},children:i.length})]}),C.jsxs("div",{className:"flex flex-col gap-0.5",children:[i.slice(0,10).map(a=>C.jsx("p",{className:"font-mono text-[10px] truncate",style:{color:Ve.muted},title:a.tgt,children:o(a.tgt)},a.tgt)),i.length>10&&C.jsxs("p",{className:"text-[10px] font-mono",style:{color:Ve.faint},children:["+",i.length-10," more"]})]})]})]})]})}function uA({graph:t}){const e=Object.entries(t.domains);return C.jsx("div",{className:"h-full overflow-y-auto p-4 flex flex-col gap-3",children:e.length===0?C.jsx("p",{className:"text-sm text-center mt-8 font-mono",style:{color:Ve.faint},children:"No domains in this graph."}):e.map(([r,n])=>{const i=Object.entries(n.requirements??{});return C.jsxs("div",{className:"rounded-xl overflow-hidden border",style:{border:`1px solid ${Ve.hairlineS}`,background:Ve.surface2},children:[C.jsxs("div",{className:"px-4 py-2 border-b flex items-center gap-2",style:{borderColor:Ve.hairline,background:Ve.canvas2},children:[C.jsx("span",{className:"text-[11px] font-semibold font-mono",style:{color:Ve.ink},children:r}),C.jsxs("span",{className:"text-[10px] font-mono",style:{color:Ve.faint},children:[i.length," reqs"]})]}),n.description&&C.jsx("p",{className:"text-[11px] px-4 pt-2 pb-1",style:{color:Ve.muted},children:n.description}),i.length>0&&C.jsx("div",{className:"divide-y",style:{borderColor:Ve.hairline},children:i.map(([s,o])=>C.jsxs("div",{className:"px-4 py-2",style:{borderColor:Ve.hairline},children:[C.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[C.jsx("span",{className:"text-[10px] font-mono",style:{color:Ve.faint},children:s}),o.status&&C.jsx("span",{className:"text-[9px] uppercase font-semibold px-1.5 py-0.5 rounded font-mono",style:{background:o.status==="active"?"rgba(63,185,80,0.15)":o.status==="deprecated"?"rgba(248,81,73,0.15)":Ve.surface,color:o.status==="active"?Ve.ok:o.status==="deprecated"?Ve.deny:Ve.muted},children:o.status})]}),C.jsx("p",{className:"text-[11px]",style:{color:Ve.ink},children:o.title})]},s))})]},r)})})}function Y1(){return C.jsxs("div",{className:"flex items-center gap-1.5",children:[C.jsx("span",{className:"w-3 h-3 rounded-full",style:{background:Ve.deny}}),C.jsx("span",{className:"w-3 h-3 rounded-full",style:{background:Ve.accent}}),C.jsx("span",{className:"w-3 h-3 rounded-full",style:{background:Ve.ok}})]})}function cA({repo:t,onClose:e,onSelectRun:r}){const[n,i]=ae.useState("graph"),[s,o]=ae.useState("code"),[a,l]=ae.useState(!0),[u,c]=ae.useState(null),[h,g]=ae.useState(null),[p,x]=ae.useState(null),[w,v]=ae.useState(!1),[m,y]=ae.useState(!1),[b,_]=ae.useState(null),[R,E]=ae.useState(null),[T,k]=ae.useState(null),[N,M]=ae.useState(!0);async function B(){y(!0),_(null);try{const{runId:H}=await lt.rerunOnboarding(t.id);r==null||r(H),e()}catch(H){_(H instanceof Error?H.message:String(H)),y(!1)}}ae.useEffect(()=>{function H(z){z.key==="Escape"&&e()}return document.addEventListener("keydown",H),()=>document.removeEventListener("keydown",H)},[e]),ae.useEffect(()=>{l(!0),lt.getRepoGraph(t.id).then(({graph:H})=>c(H)).catch(()=>c(null)).finally(()=>l(!1))},[t.id]),ae.useEffect(()=>{s!=="domain"||h!==null||(v(!0),lt.getRepoDomainGraph(t.id).then(({graph:H,coverage:z})=>{g(H),x(z)}).catch(()=>{g(null),x(null)}).finally(()=>v(!1)))},[s,h,t.id]);function A(H){E(H.id),k(H)}function j(H){k(H),H!==null&&E(H.id)}function D(H){const P=H.toLowerCase().split("/"),F=P[P.length-1]??"";return P.some(G=>G==="test"||G==="tests"||G==="spec"||G==="specs"||G==="__tests__"||G==="e2e")||F.startsWith("test_")||/_(test|spec|tests|suite)\.[^.]+$/.test(F)||/\.(test|spec)\.[^.]+$/.test(F)}const I=u?u.nodes.filter(H=>!(!H.file||H.file.startsWith("node_modules/")||N&&D(H.file))):[],U=I.length===0;function W({value:H,current:z,label:P,onChange:F}){const G=H===z;return C.jsx("button",{type:"button",onClick:()=>F(H),className:"rounded px-2.5 py-1 text-[11px] font-mono font-medium transition-colors",style:{background:G?Ve.surface:"transparent",color:G?Ve.ink:Ve.muted,boxShadow:G?"0 1px 4px rgba(0,0,0,0.4)":"none"},children:P})}return C.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"rgba(0,0,0,0.75)"},onMouseDown:H=>{H.target===H.currentTarget&&e()},children:C.jsxs("div",{className:"w-[92vw] h-[92vh] rounded-2xl flex flex-col overflow-hidden",style:{background:Ve.blue,border:`1px solid ${Ve.hairlineS}`,boxShadow:"0 40px 80px -20px rgba(0,0,0,0.8)"},children:[C.jsxs("div",{className:"flex items-center gap-3 px-5 py-3 border-b shrink-0",style:{background:Ve.blue2,borderColor:Ve.hairline},children:[C.jsx("span",{className:"text-[13px] font-semibold font-mono mr-1",style:{color:Ve.ink},children:t.name}),C.jsx("div",{className:"flex gap-0.5 rounded p-0.5",style:{background:"rgba(0,0,0,0.25)"},children:["code","domain"].map(H=>C.jsx(W,{value:H,current:s,label:H==="code"?"Code":"Domain",onChange:o},H))}),s==="code"&&C.jsx("div",{className:"flex gap-0.5 rounded p-0.5",style:{background:"rgba(0,0,0,0.25)"},children:["graph","hotspots"].map(H=>C.jsx(W,{value:H,current:n,label:H==="graph"?"Graph":"Hotspots",onChange:i},H))}),s==="code"&&C.jsx("button",{type:"button",onClick:()=>M(H=>!H),className:"flex items-center gap-1.5 px-2 py-1 rounded text-[10px] font-mono font-medium transition-colors border",style:{borderColor:N?Ve.hairline:"rgba(255,218,25,0.4)",background:N?"rgba(0,0,0,0.2)":"rgba(255,218,25,0.08)",color:N?Ve.faint:Ve.accent},children:N?"tests hidden":"tests shown"}),u&&s==="code"&&C.jsxs("span",{className:"text-[10px] font-mono px-2 py-0.5 rounded",style:{background:"rgba(0,0,0,0.2)",color:Ve.muted},children:[I.length," nodes · ",u.stats.edgeCount," edges"]}),C.jsx("button",{type:"button",onClick:e,className:"ml-auto text-xl leading-none w-7 h-7 flex items-center justify-center rounded transition-colors",style:{color:Ve.faint},onMouseEnter:H=>H.currentTarget.style.color=Ve.ink,onMouseLeave:H=>H.currentTarget.style.color=Ve.faint,children:"×"})]}),C.jsx("div",{className:"flex-1 overflow-hidden",style:{background:Ve.blue},children:a?C.jsx("div",{className:"flex items-center justify-center h-full",children:C.jsx("span",{className:"text-sm font-mono",style:{color:Ve.muted},children:"Loading…"})}):s==="domain"?w?C.jsx("div",{className:"flex items-center justify-center h-full",children:C.jsx("span",{className:"text-sm font-mono",style:{color:Ve.muted},children:"Loading domain graph…"})}):h?C.jsx(uA,{graph:h}):C.jsx("div",{className:"flex items-center justify-center h-full",children:C.jsxs("div",{className:"max-w-sm w-full mx-auto p-6 rounded-xl border flex flex-col gap-4",style:{border:`1px solid ${Ve.hairlineS}`,background:Ve.canvas2},children:[C.jsx("p",{className:"text-sm font-semibold font-mono",style:{color:Ve.ink},children:"Domain graph not yet generated"}),C.jsx("p",{className:"text-xs leading-relaxed",style:{color:Ve.muted},children:"The domain model requires full annotation coverage — every behavior-bearing node in the code graph must be linked to a requirement."}),p?C.jsxs("div",{className:"rounded-lg p-4 flex flex-col gap-2 border",style:{border:`1px solid ${Ve.hairline}`},children:[C.jsxs("div",{className:"flex justify-between items-baseline",children:[C.jsx("span",{className:"text-[11px] font-mono",style:{color:Ve.muted},children:"Annotation coverage"}),C.jsxs("span",{className:"text-[11px] font-mono font-bold",style:{color:Ve.ink},children:[(p.coverage*100).toFixed(1),"%"]})]}),C.jsx("div",{className:"w-full h-1.5 rounded-full overflow-hidden",style:{background:Ve.surface},children:C.jsx("div",{className:"h-full rounded-full",style:{width:`${Math.max(p.coverage*100,.5)}%`,background:Ve.ok}})}),C.jsxs("div",{className:"flex gap-4 mt-1 text-[10px] font-mono tabular-nums",style:{color:Ve.faint},children:[C.jsxs("span",{children:[p.resolved.toLocaleString()," resolved"]}),C.jsxs("span",{children:[p.behavior_bearing.toLocaleString()," behavior-bearing"]}),C.jsxs("span",{children:[p.total.toLocaleString()," total"]})]})]}):C.jsx("p",{className:"text-[11px] font-mono",style:{color:Ve.faint},children:"No coverage data — run onboarding first."}),C.jsx("button",{type:"button",onClick:()=>void B(),disabled:m,className:"self-start rounded-lg px-4 py-2 text-sm font-semibold disabled:opacity-50",style:{background:Ve.accent,color:Ve.accentInk},children:m?"Starting…":"Run annotation workflow →"}),b&&C.jsx("p",{className:"text-[11px] font-mono",style:{color:Ve.deny},children:b})]})}):U?C.jsx("div",{className:"flex items-center justify-center h-full",children:C.jsx("p",{className:"text-sm font-mono",style:{color:Ve.muted},children:"Code graph not yet available — run onboarding first."})}):C.jsxs("div",{className:"h-full flex p-4 gap-4",children:[C.jsxs("div",{className:"flex-1 flex flex-col gap-3 min-w-0 overflow-hidden",children:[C.jsxs("div",{className:"rounded-xl overflow-hidden flex flex-col",style:{display:n==="graph"?"flex":"none",flex:1,border:`1px solid ${Ve.hairlineS}`,background:Ve.canvas2,boxShadow:"0 20px 50px -20px rgba(0,0,0,0.6)"},children:[C.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 border-b shrink-0",style:{background:Ve.canvas,borderColor:Ve.hairline},children:[C.jsx(Y1,{}),C.jsxs("span",{className:"font-mono text-[10px] ml-1",style:{color:Ve.faint},children:["code-graph · ",C.jsx("span",{style:{color:Ve.link},children:t.name})]}),C.jsxs("span",{className:"ml-auto font-mono text-[9px] px-2 py-0.5 rounded",style:{background:Ve.surface,color:Ve.muted},children:[I.length," nodes"]})]}),C.jsx("div",{className:"flex-1 overflow-hidden",style:{background:Ve.canvas},children:C.jsx(eA,{nodes:I,edges:u.edges,externalSelectedId:R,onNodeSelect:j})})]}),C.jsxs("div",{className:"rounded-xl overflow-hidden flex flex-col",style:{display:n==="hotspots"?"flex":"none",flex:1,border:`1px solid ${Ve.hairlineS}`,background:Ve.canvas2,boxShadow:"0 20px 50px -20px rgba(0,0,0,0.6)"},children:[C.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 border-b shrink-0",style:{background:Ve.canvas,borderColor:Ve.hairline},children:[C.jsx(Y1,{}),C.jsxs("span",{className:"font-mono text-[10px] ml-1",style:{color:Ve.faint},children:["hotspots · ",C.jsx("span",{style:{color:Ve.link},children:t.name})]})]}),C.jsx("div",{className:"flex-1 overflow-hidden",style:{background:Ve.surface2},children:C.jsx(iA,{nodes:I,selectedId:(T==null?void 0:T.id)??null,onSelect:A})})]})]}),T&&C.jsx(lA,{node:T,edges:u.edges,onClose:()=>k(null)})]})})]})})}const hA=new Set(["sessionStarted","unitPlanned","unitDistributed","unitExecuting","gateDecided","unitDone","unitDenied","awaitingHuman","resumed","runCancelled","sessionFailed","sessionCompleted"]);function fA(t){return{ord:t,description:"",stage:"build",status:"pending",resolved:!1,assignedCli:null,assignedInvocation:null,routing:null,denialReason:null,skillRef:null,phaseStatus:null,role:null,gate:null,hasValidatorPin:!1,executorType:null,attempts:[],usage:[],filesRead:[],gateEvals:[],stepErrors:[],crashRedrives:0,workerSessionReuses:0,contextInjections:[],hookFires:[],validationPinAttached:!1,gateEscalated:!1,toolExecutorCmd:null,governanceArmed:!1,outputBytes:null,outputGoverned:!1,reworkAmendment:null}}function X1(t){return JSON.stringify([t.criterion,t.hasDeterministicFloor,t.deterministicPass,t.agentVerdict,t.agentReasoning,t.evaluatorPass,t.denialReason,t.combined])}function dA(t,e){var w;const r={...t.session},n=new Map;for(const v of t.units)n.set(v.ord,{ord:v.ord,description:v.description,stage:v.stage,status:v.status,resolved:!0,assignedCli:v.assigned_cli,assignedInvocation:v.assigned_invocation,routing:v.routing,denialReason:v.denial_reason,skillRef:v.skill_ref??null,phaseStatus:v.phase_status,role:v.role??null,gate:v.gate??null,hasValidatorPin:v.has_validator_pin??!1,executorType:v.tool_cmd!=null?"tool":"agent",attempts:[],usage:[],filesRead:[],gateEvals:[],stepErrors:[],crashRedrives:0,workerSessionReuses:0,contextInjections:[],hookFires:[],validationPinAttached:!1,gateEscalated:!1,toolExecutorCmd:v.tool_cmd??null,governanceArmed:!1,outputBytes:null,outputGoverned:!1,reworkAmendment:null});let i=r.status==="awaiting_human"?{ord:((w=t.units[r.unit_ix])==null?void 0:w.ord)??r.unit_ix+1,prompt:null}:null,s=null;const o=[];let a=null,l=t.session.workflow_id||null;const u=new Map,c=new Set,h=new Set,g=new Set,p=v=>{let m=n.get(v);return m===void 0&&(m=fA(v),n.set(v,m)),m};for(const v of e){const m=typeof v.ord=="number"?v.ord:void 0;switch(v.type){case"sessionStarted":r.status="planning";break;case"unitPlanned":if(m!==void 0){const y=p(m);y.description=typeof v.description=="string"?v.description:y.description;const b=(v.hasValidatorPin??v.has_validator_pin)===!0,_=v.executorType??v.executor_type,R=v.skillRef??v.skill_ref;y.resolved?(y.role===null&&typeof v.role=="string"&&(y.role=v.role),y.gate===null&&typeof v.gate=="string"&&(y.gate=v.gate),!y.hasValidatorPin&&b&&(y.hasValidatorPin=!0),y.executorType===null&&typeof _=="string"&&(y.executorType=_)):(typeof v.stage=="string"&&(y.stage=v.stage),typeof v.role=="string"&&(y.role=v.role),typeof v.gate=="string"&&(y.gate=v.gate),y.hasValidatorPin=b,typeof _=="string"&&(y.executorType=_)),!y.skillRef&&typeof R=="string"&&(y.skillRef=R)}break;case"unitDistributed":if(m!==void 0){const y=p(m);y.status==="pending"&&(y.status="distributed"),typeof v.cli=="string"&&y.assignedCli===null&&(y.assignedCli=v.cli)}break;case"unitExecuting":if(m!==void 0){const y=p(m);y.status==="pending"&&(y.status="distributed")}break;case"unitDone":m!==void 0&&(p(m).status="done");break;case"unitDenied":m!==void 0&&(p(m).status="rejected");break;case"awaitingHuman":m!==void 0&&(r.status="awaiting_human",i={ord:m,prompt:typeof v.prompt=="string"?v.prompt:null});break;case"resumed":r.status="executing",i=null;break;case"runCancelled":r.status="cancelled",i=null;break;case"sessionFailed":r.status="failed",i=null;break;case"sessionCompleted":r.status="completed",i=null;break;case"unitDispatched":if(m!==void 0&&typeof v.attempt=="number"){const y=p(m);y.attempts.includes(v.attempt)||(y.attempts.push(v.attempt),y.attempts.sort((b,_)=>b-_))}break;case"cliUsage":if(m!==void 0&&typeof v.attempt=="number"&&typeof v.inputTokens=="number"&&typeof v.outputTokens=="number"){const y=p(m),b=typeof v.costUsd=="number"?v.costUsd:null,_=y.usage.find(R=>R.attempt===v.attempt);_?(_.inputTokens=v.inputTokens,_.outputTokens=v.outputTokens,_.costUsd=b):y.usage.push({attempt:v.attempt,inputTokens:v.inputTokens,outputTokens:v.outputTokens,costUsd:b})}break;case"dataUsed":if(m!==void 0&&Array.isArray(v.files)){const y=p(m);for(const b of v.files)typeof b=="string"&&!y.filesRead.includes(b)&&y.filesRead.push(b)}break;case"gateEvaluated":if(m!==void 0){const y=p(m),b={criterion:v.criterion??null,hasDeterministicFloor:v.hasDeterministicFloor===!0,deterministicPass:v.deterministicPass===!0,agentVerdict:v.agentVerdict??null,agentReasoning:v.agentReasoning??null,evaluatorPass:typeof v.evaluatorPass=="boolean"?v.evaluatorPass:null,denialReason:v.denialReason??null,combined:v.combined===!0},_=X1(b);y.gateEvals.some(R=>X1(R)===_)||y.gateEvals.push(b)}break;case"stepFailed":if(m!==void 0&&typeof v.attempt=="number"&&typeof v.detail=="string"&&typeof v.failureKind=="string"){const y=p(m);y.stepErrors.some(b=>b.attempt===v.attempt)||y.stepErrors.push({attempt:v.attempt,detail:v.detail,failureKind:v.failureKind})}break;case"crashRecoveryRedrive":if(m!==void 0&&typeof v.attempt=="number"){let y=u.get(m);y||(y=new Set,u.set(m,y)),y.has(v.attempt)||(y.add(v.attempt),p(m).crashRedrives+=1)}break;case"workerSessionStarted":typeof v.terminalId=="string"&&(s=v.terminalId);break;case"acpSessionStarted":break;case"acpFallback":typeof v.cliKey=="string"&&typeof v.reason=="string"&&typeof v.fallbackKind=="string"&&(o.some(b=>b.cliKey===v.cliKey&&b.reason===v.reason&&b.fallbackKind===v.fallbackKind)||o.push({cliKey:v.cliKey,reason:v.reason,fallbackKind:v.fallbackKind}));break;case"workerSessionReused":if(m!==void 0&&typeof v.terminalId=="string"){const y=`${m}:${v.terminalId}`;c.has(y)||(c.add(y),p(m).workerSessionReuses+=1)}break;case"workerSessionClosed":typeof v.terminalId=="string"&&(v.reason==="run_complete"||v.reason==="error")&&(a={terminalId:v.terminalId,reason:v.reason});break;case"unitContextInjected":if(m!==void 0&&Array.isArray(v.priorUnits)&&!h.has(m)){h.add(m);const y=p(m);for(const b of v.priorUnits)if(typeof b=="object"&&b!==null){const _=b;typeof _.ord=="number"&&typeof _.label=="string"&&typeof _.outputBytes=="number"&&y.contextInjections.push({ord:_.ord,label:_.label,outputBytes:_.outputBytes})}}break;case"governanceHookFired":if(m!==void 0&&typeof v.attempt=="number"&&typeof v.toolName=="string"&&(v.decision==="allow"||v.decision==="deny")){const y=`${m}:${v.attempt}:${v.toolName}`;g.has(y)||(g.add(y),p(m).hookFires.push({toolName:v.toolName,decision:v.decision,denyingPolicy:typeof v.denyingPolicy=="string"?v.denyingPolicy:null}))}break;case"validationPinAttached":m!==void 0&&(p(m).validationPinAttached=!0);break;case"gateEscalated":m!==void 0&&(p(m).gateEscalated=!0);break;case"toolExecutorDispatched":m!==void 0&&Array.isArray(v.cmd)&&(p(m).toolExecutorCmd=v.cmd);break;case"governanceContextArmed":m!==void 0&&(p(m).governanceArmed=!0);break;case"workflowSelected":l===null&&typeof v.workflowId=="string"&&(l=v.workflowId);break;case"unitReworkAmended":if(m!==void 0&&typeof v.amendment=="string"){const y=p(m);y.reworkAmendment=v.amendment,typeof v.updatedDescription=="string"&&(y.description=v.updatedDescription)}break;case"unitOutputCaptured":if(m!==void 0&&typeof v.attempt=="number"&&typeof v.outputBytes=="number"&&typeof v.governed=="boolean"){const y=p(m);y.outputBytes=v.outputBytes,y.outputGoverned=v.governed}break}}const x=[...n.values()].sort((v,m)=>v.ord-m.ord);return{session:r,units:x,pendingGate:i,activeTerminalId:s,acpFallbacks:o,lastWorkerClose:a,selectedWorkflow:l}}function K1(t){return(t.split(/[\\/]/).pop()??t).replace(/\.(exe|cmd|bat)$/i,"").toLowerCase()}function pA(t,e){const r=t==null?void 0:t.trim();return r?K1(r.split(/\s+/)[0]??"")==="claude":e!==null&&K1(e)==="claude"}function vA(t){let e=0,r=0,n=0,i=0,s=0,o=0;const a=new Map,l=new Set,u=new Set;for(const h of t.units){const g=h.status==="distributed"||h.status==="done"||h.status==="rejected";h.usage.length===0&&h.assignedCli!==null&&g&&(pA(h.assignedInvocation,h.assignedCli)?u.add(h.assignedCli):l.add(h.assignedCli));const p=h.assignedCli??"unknown",x=h.usage.length>0?Math.min(...h.usage.map(w=>w.attempt)):0;for(const w of h.usage){s+=1,e+=w.inputTokens,r+=w.outputTokens,w.costUsd!==null&&(n+=w.costUsd,i+=1),w.attempt>x&&(o+=w.inputTokens+w.outputTokens);const v=a.get(p)??{cli:p,input:0,output:0,cost:null};v.input+=w.inputTokens,v.output+=w.outputTokens,w.costUsd!==null&&(v.cost=(v.cost??0)+w.costUsd),a.set(p,v)}}const c=e+r;return{totalInput:e,totalOutput:r,totalTokens:c,totalCost:i>0?n:null,costComplete:s>0&&i===s,reworkTokens:o,reworkPct:c>0?o/c*100:0,perCli:[...a.values()],noAdapterClis:[...l],pendingUsageClis:[...u],hasUsage:s>0}}const gA=[];function mA(t,e){const r=Sc(o=>o.byRun[t])??gA,[n,i]=ae.useState(e??null),s=Sc(o=>{const a=o.byRun[t];if(a===void 0)return 0;let l=0;for(const u of a)hA.has(u.type)&&(l+=1);return l});return ae.useEffect(()=>{let o=!1;return(async()=>{try{const{run:a}=await lt.getRun(t);o||i(a)}catch{}})(),()=>{o=!0}},[t,s]),ae.useMemo(()=>n===null||n.session.id!==t?null:dA(n,r),[n,r,t])}const Q1=2e5,Es=500;function Z_(t,e){return`${t}:u${e}`}function Op(t){switch(t.type){case"sessionStarted":return typeof t.problem=="string"?t.problem:"run started";case"unitPlanned":return typeof t.description=="string"?t.description:"unit planned";case"unitDistributed":return typeof t.cli=="string"?`assigned -> ${t.cli}`:"distributed";case"councilConvened":return Array.isArray(t.clis)?`council convened — polling ${t.clis.length} CLIs`:"council convened";case"councilDeliberated":return typeof t.agreementPct=="number"?`ballot ${String(t.round??"?")} at ${t.agreementPct}% — below ${String(t.neededPct??"?")}%, runoff round starting`:"council deliberating";case"councilVoted":return typeof t.agreementPct=="number"?`council voted — ${t.agreementPct}% agreement (${String(t.votes??"?")} votes)`:"council voted";case"unitExecuting":return"executing";case"gateDecided":return t.allow===!0?"gate: allow":"gate: deny";case"unitDone":return"unit done";case"unitDenied":return"unit denied";case"awaitingHuman":return typeof t.prompt=="string"?`awaiting human: ${t.prompt}`:"awaiting human";case"resumed":return"resumed";case"runCancelled":return"run cancelled";case"sessionFailed":return"run failed";case"sessionCompleted":return"run completed";case"stepFailed":return typeof t.detail=="string"?t.detail:"step failed";case"crashRecoveryRedrive":return typeof t.attempt=="number"?`attempt ${t.attempt}`:"crash recovery";case"workerStalled":return`no output for ${String(t.stalledSecs??"?")}s — may be waiting at an interactive prompt (open Term or inject)`;case"failureTriaged":return`triage: ${String(t.decision??"?")}${typeof t.analysis=="string"&&t.analysis?" — "+t.analysis.slice(0,120):""}`;case"workerMessageQueued":case"workerMessageInjected":return typeof t.message=="string"?`${String(t.target??"all")}: "${t.message.length>80?t.message.slice(0,80)+"…":t.message}"`:t.type;case"error":return typeof t.message=="string"?`error: ${t.message}`:"error";default:return t.type}}const Pa=$s(t=>({outputs:{},councilStatus:{},assumptions:{},logs:{},executorTypes:{},terminalIds:{},seq:0,ingest:e=>{const r=typeof e.session=="string"?e.session:void 0;r!==void 0&&t(n=>{const i=n.seq+1;if(e.type==="cliOutputDelta"&&typeof e.ord=="number"&&typeof e.chunk=="string"){const u=Z_(r,e.ord);let h=(n.outputs[u]??"")+e.chunk;return h.length>Q1&&(h=h.slice(h.length-Q1)),{seq:i,outputs:{...n.outputs,[u]:h}}}if(e.type==="heartbeat")return{seq:i};if(e.type==="assumptionRecorded"&&typeof e.ord=="number"&&typeof e.library=="string"&&typeof e.transform=="string"){const u={ord:e.ord,kind:typeof e.kind=="string"?e.kind:"external-transform",library:e.library,transform:e.transform,known:e.known===!0,detail:typeof e.detail=="string"?e.detail:""},c=n.assumptions[r]??[];return{seq:i,assumptions:{...n.assumptions,[r]:[...c,u]}}}if((e.type==="councilConvened"||e.type==="councilDeliberated"||e.type==="councilVoted")&&typeof e.ord=="number"){const u=`${r}:${e.ord}`,c=e.type==="councilConvened"?{state:"convened",...Array.isArray(e.clis)?{clis:e.clis}:{}}:e.type==="councilDeliberated"?{state:"deliberating",...typeof e.round=="number"?{round:e.round}:{},...typeof e.agreementPct=="number"?{agreementPct:e.agreementPct}:{},...typeof e.neededPct=="number"?{neededPct:e.neededPct}:{},...typeof e.votes=="number"?{votes:e.votes}:{}}:{state:"voted",...typeof e.agreementPct=="number"?{agreementPct:e.agreementPct}:{},...typeof e.votes=="number"?{votes:e.votes}:{}},h={seq:i,type:e.type,ts:Date.now(),detail:Op(e)};h.ord=e.ord,typeof e.attempt=="number"&&(h.attempt=e.attempt);const p=[...n.logs[r]??[],h];return p.length>Es&&p.splice(0,p.length-Es),{seq:i,councilStatus:{...n.councilStatus,[u]:c},logs:{...n.logs,[r]:p}}}const s=e.executorType??e.executor_type;if(e.type==="unitPlanned"&&typeof e.ord=="number"&&(s==="agent"||s==="tool")){const u=`${r}:${e.ord}`;return{seq:i,executorTypes:{...n.executorTypes,[u]:s},...(()=>{const c={seq:i,type:e.type,ts:Date.now(),detail:Op(e)};c.ord=e.ord;const g=[...n.logs[r]??[],c];return g.length>Es&&g.splice(0,g.length-Es),{logs:{...n.logs,[r]:g}}})()}}if(e.type==="workerSessionStarted"&&typeof e.terminalId=="string"&&typeof e.cliKey=="string"){const u=`${r}:${e.cliKey}`;return{seq:i,terminalIds:{...n.terminalIds,[u]:e.terminalId}}}const o={seq:i,type:e.type,ts:Date.now(),detail:Op(e)};typeof e.ord=="number"&&(o.ord=e.ord),typeof e.attempt=="number"&&(o.attempt=e.attempt);const l=[...n.logs[r]??[],o];return l.length>Es&&l.splice(0,l.length-Es),{seq:i,logs:{...n.logs,[r]:l}}})},clear:e=>t(r=>{const n={...r.outputs};for(const u of Object.keys(n))u.startsWith(`${e}:u`)&&delete n[u];const i={...r.councilStatus};for(const u of Object.keys(i))u.startsWith(`${e}:`)&&delete i[u];const s={...r.assumptions};delete s[e];const o={...r.executorTypes};for(const u of Object.keys(o))u.startsWith(`${e}:`)&&delete o[u];const a={...r.terminalIds};for(const u of Object.keys(a))u.startsWith(`${e}:`)&&delete a[u];const l={...r.logs};return delete l[e],{outputs:n,councilStatus:i,assumptions:s,executorTypes:o,terminalIds:a,logs:l}})}));function yA(t){return t.method==="council"?t.dissent>0?`council: ${t.winner} (${t.dissent} dissent, ${t.agreement_pct}% agreement)`:`council: ${t.winner} (unanimous)`:t.method==="evaluator_distinct"?`evaluator≠creator: ${t.winner} (was ${t.was})`:t.method==="tool"?"tool: direct command (no council)":`degraded: ${t.reason}`}function xA({model:t}){const e=t.units.filter(n=>n.resolved&&n.routing!=null),r=Pa(n=>n.assumptions[t.session.id])??[];return C.jsxs("div",{"data-testid":"assumptions",className:"flex flex-col gap-2 text-[11px]",children:[r.length>0&&C.jsxs("div",{className:"flex flex-col gap-1",children:[C.jsx("p",{className:"font-mono font-semibold",style:{color:"rgba(230,237,243,0.6)"},children:"external transformations"}),C.jsx("ul",{className:"flex flex-col gap-1",children:r.map((n,i)=>C.jsxs("li",{"data-testid":"assumption-transform",className:"rounded p-1.5 font-mono",style:{background:n.known?"rgba(63,185,80,0.06)":"rgba(255,218,25,0.08)",border:n.known?"1px solid rgba(63,185,80,0.2)":"1px dashed rgba(255,218,25,0.45)"},children:[C.jsxs("div",{className:"flex items-center gap-1.5",children:[C.jsxs("span",{style:{color:"#e6edf3"},children:["unit #",n.ord]}),C.jsx("span",{style:{color:"#79c0ff"},children:n.library}),!n.known&&C.jsx("span",{"data-testid":"needs-review-badge",className:"rounded px-1 text-[9px] font-semibold uppercase",style:{background:"rgba(255,218,25,0.2)",color:"#ffda19"},children:"needs review"})]}),C.jsx("p",{style:{color:"rgba(230,237,243,0.7)"},children:n.transform}),C.jsx("p",{style:{color:"rgba(230,237,243,0.45)"},children:n.detail})]},`${n.ord}:${n.library}:${i}`))})]}),e.length===0?C.jsx("p",{style:{color:"rgba(230,237,243,0.4)"},children:"No routing decisions recorded yet."}):C.jsx("ul",{className:"flex flex-col gap-1",children:e.map(n=>C.jsxs("li",{className:"rounded p-1.5 font-mono",style:{background:"#161c26",border:"1px solid rgba(230,237,243,0.07)",color:"rgba(230,237,243,0.6)"},children:[C.jsxs("span",{className:"font-medium",style:{color:"#e6edf3"},children:["unit #",n.ord]}),n.description.includes(" — ")&&C.jsx("span",{className:"ml-1",style:{color:"rgba(230,237,243,0.4)"},children:n.description.split(" — ")[0]})," ","— ",yA(n.routing)]},n.ord))})]})}const bA=new Set(["completed","cancelled","failed"]),wA=new Intl.NumberFormat("en-US");function $o(t){return wA.format(t)}function Z1(t){return t===null?"—":`$${t.toFixed(4)}`}function _A({model:t}){const e=vA(t),n=!bA.has(t.session.status)||e.noAdapterClis.length>0||e.pendingUsageClis.length>0,i={background:"#161c26",border:"1px solid rgba(230,237,243,0.07)",borderRadius:"6px",padding:"8px"};return C.jsxs("div",{"data-testid":"burn",className:"flex flex-col gap-2 text-[11px]",children:[e.hasUsage?C.jsxs(C.Fragment,{children:[C.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[C.jsxs("div",{style:i,children:[C.jsxs("p",{style:{color:"rgba(230,237,243,0.4)"},children:["tokens",n?" (partial)":""]}),C.jsx("p",{className:"font-mono text-sm",style:{color:"#e6edf3"},children:$o(e.totalTokens)}),C.jsxs("p",{className:"text-[10px]",style:{color:"rgba(230,237,243,0.35)"},children:[$o(e.totalInput)," in / ",$o(e.totalOutput)," out"]})]}),C.jsxs("div",{style:i,children:[C.jsxs("p",{style:{color:"rgba(230,237,243,0.4)"},children:["cost",e.costComplete&&!n?"":" (partial)"]}),C.jsx("p",{className:"font-mono text-sm",style:{color:"#e6edf3"},children:Z1(e.totalCost)}),e.totalCost===null&&C.jsx("p",{className:"text-[10px]",style:{color:"rgba(230,237,243,0.35)"},children:"no cost reported"})]}),C.jsxs("div",{style:i,"data-testid":"burn-rework",children:[C.jsxs("p",{style:{color:"rgba(230,237,243,0.4)"},children:["rework",n?" (prov.)":""]}),C.jsxs("p",{className:"font-mono text-sm",style:{color:"#e6edf3"},children:[n?"~":"",e.reworkPct.toFixed(0),"%"]}),C.jsxs("p",{className:"text-[10px]",style:{color:"rgba(230,237,243,0.35)"},children:[$o(e.reworkTokens)," tok"]})]})]}),n&&C.jsx("p",{className:"text-[10px]",style:{color:"rgba(230,237,243,0.35)"},"data-testid":"burn-partial",children:"Token totals and rework% are from connect onward; earlier usage may be missing."}),C.jsxs("div",{children:[C.jsx("p",{className:"mb-1",style:{color:"rgba(230,237,243,0.4)"},children:"per CLI"}),C.jsx("ul",{className:"flex flex-col gap-0.5",children:e.perCli.map(s=>C.jsxs("li",{className:"flex justify-between font-mono",style:{color:"rgba(230,237,243,0.6)"},children:[C.jsx("span",{children:s.cli}),C.jsxs("span",{children:[$o(s.input+s.output)," tok · ",Z1(s.cost)]})]},s.cli))})]})]}):C.jsxs("p",{style:{color:"rgba(230,237,243,0.4)"},"data-testid":"burn-empty",children:["Awaiting usage — token/cost burn lights up when a CLI emits ",C.jsx("code",{children:"cliUsage"})," ","(claude reports tokens + cost directly)."]}),e.noAdapterClis.length>0&&C.jsxs("p",{style:{color:"#ffda19"},"data-testid":"burn-unavailable",children:["usage unavailable for ",e.noAdapterClis.join(", ")," — no usage adapter"]}),e.pendingUsageClis.length>0&&C.jsxs("p",{style:{color:"rgba(230,237,243,0.4)"},"data-testid":"burn-pending",children:["usage not yet reported for ",e.pendingUsageClis.join(", ")]})]})}function SA({model:t}){const e=t.units.filter(r=>r.filesRead.length>0);return C.jsxs("div",{"data-testid":"data-used",className:"flex flex-col gap-2 text-[11px]",children:[e.length===0?C.jsxs("p",{style:{color:"rgba(230,237,243,0.4)"},"data-testid":"data-used-empty",children:["No files-read captured yet — populated from claude ",C.jsx("code",{children:"tool_use"})," blocks via"," ",C.jsx("code",{children:"dataUsed"}),"."]}):C.jsx("ul",{className:"flex flex-col gap-2",children:e.map(r=>C.jsxs("li",{"data-testid":"data-used-unit","data-ord":r.ord,children:[C.jsxs("p",{className:"font-semibold font-mono",style:{color:"rgba(230,237,243,0.7)"},children:["unit #",r.ord,r.assignedCli?` · ${r.assignedCli}`:""]}),C.jsx("ul",{className:"mt-0.5 flex flex-col gap-0.5",children:r.filesRead.map(n=>C.jsx("li",{className:"truncate font-mono",style:{color:"rgba(230,237,243,0.45)"},title:n,children:n},n))})]},r.ord))}),C.jsx("p",{"data-testid":"data-used-recall-disabled",className:"rounded p-1.5 font-mono",style:{border:"1px dashed rgba(230,237,243,0.12)",color:"rgba(230,237,243,0.35)"},children:"memory / knowledge recall: disabled (pending core-ts binding)"})]})}function CA({routing:t}){return t?t.method==="council"?C.jsxs("p",{className:"text-[11px] font-mono",style:{color:"rgba(230,237,243,0.45)"},"data-testid":"routing-provenance",children:[C.jsx("span",{className:"font-medium",style:{color:"rgba(230,237,243,0.6)"},children:"Council:"})," ",t.winner," won · ",t.agreement_pct,"% agreement · ",t.returned," returned · ",t.dissent," dissent"]}):t.method==="degraded"?C.jsxs("p",{className:"text-[11px] font-mono",style:{color:"#ffda19"},"data-testid":"routing-provenance",children:[C.jsx("span",{className:"font-medium",children:"Degraded:"})," ",t.reason]}):t.method==="tool"?C.jsxs("p",{className:"text-[11px] font-mono",style:{color:"rgba(230,237,243,0.4)"},"data-testid":"routing-provenance",children:[C.jsx("span",{className:"font-medium",children:"Tool:"})," direct command — no council"]}):C.jsxs("p",{className:"text-[11px] font-mono",style:{color:"#a78bfa"},"data-testid":"routing-provenance",children:[C.jsx("span",{className:"font-medium",children:"Evaluator-distinct:"})," ",t.winner," (was ",t.was,")"]}):null}function EA(t){if(!t.combined){const e=[];return t.hasDeterministicFloor&&!t.deterministicPass&&e.push("deterministic floor"),t.evaluatorPass===!1&&e.push("evaluator (2nd pass)"),e.length===0&&t.agentVerdict!==null&&e.push("agent judge"),e.length>0?e.join(" + "):"governance"}return t.evaluatorPass!==null?"evaluator (2nd pass)":t.agentVerdict!==null?"agent judge":t.hasDeterministicFloor?"deterministic floor":"ungated"}function kA({model:t}){const{units:e,session:r,pendingGate:n}=t,i=e.filter(l=>l.routing!==null||l.denialReason!==null||l.gateEvals.length>0),s=n!==null?n.ord+1:r.status==="executing"?r.unit_ix:null,o=(()=>{if(s===null)return!1;const l=r.human_confirm;return l==="all"?!0:l==="none"?!1:l.before===s})(),a={background:"#161c26",border:"1px solid rgba(230,237,243,0.07)",borderRadius:"6px",padding:"8px"};return C.jsx("div",{"data-testid":"decisions-ledger",className:"flex flex-col gap-2",children:i.length===0&&n===null?C.jsx("p",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"No governed decisions recorded yet."}):C.jsxs("ol",{className:"flex flex-col gap-2",children:[i.map(l=>C.jsxs("li",{"data-testid":"ledger-row","data-ord":l.ord,style:a,children:[C.jsxs("div",{className:"flex items-center justify-between mb-1",children:[C.jsxs("div",{className:"flex items-center gap-1",children:[C.jsxs("span",{className:"font-semibold text-[11px] font-mono",style:{color:"#e6edf3"},children:["unit #",l.ord]}),(l.role==="creator"||l.role==="evaluator")&&C.jsx("span",{"data-testid":"role-badge",className:"text-[10px] font-mono px-1 rounded",style:{background:l.role==="evaluator"?"rgba(56,139,253,0.15)":"rgba(63,185,80,0.12)",color:l.role==="evaluator"?"#58a6ff":"#3fb950"},children:l.role==="creator"?"Creator":"Evaluator"}),l.gate!=null&&l.gate!=="auto"&&C.jsx("span",{"data-testid":"gate-badge",className:"text-[10px] font-mono px-1 rounded",style:{background:"rgba(255,218,25,0.1)",color:"#ffda19"},children:typeof l.gate=="string"&&l.gate==="human_confirm"||typeof l.gate=="object"&&"human_confirm"in l.gate?"HUMAN-CONFIRM":"CONDITIONAL"}),l.attempts.length>1&&C.jsxs("span",{"data-testid":"rework-badge",className:"text-[10px] font-mono px-1 rounded",style:{background:"rgba(248,81,73,0.12)",color:"#f85149"},children:["×",l.attempts.length]})]}),C.jsx("span",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.35)"},children:l.resolved?l.stage:"resolving…"})]}),C.jsx(CA,{routing:l.routing}),l.skillRef&&C.jsxs("p",{className:"text-[11px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:["skill: ",C.jsx("span",{style:{color:"rgba(230,237,243,0.6)"},children:l.skillRef})]}),l.gateEvals.map((u,c)=>C.jsxs("div",{className:"mt-1 rounded p-1.5",style:{background:"#0f1419",border:"1px solid rgba(230,237,243,0.05)"},children:[C.jsxs("p",{className:"text-[11px] font-mono",children:[C.jsx("span",{className:"font-semibold",style:{color:u.combined?"#3fb950":"#f85149"},children:u.combined?"ALLOW":"DENY"}),C.jsxs("span",{style:{color:"rgba(230,237,243,0.45)"},children:[" · ",EA(u),u.criterion?` · ${u.criterion}`:" · (ungated)"]})]}),u.hasDeterministicFloor&&C.jsxs("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:["deterministic: ",u.deterministicPass?"pass":"fail"]}),u.agentVerdict!==null&&C.jsxs("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:["agent: ",u.agentVerdict,u.agentReasoning?` — ${u.agentReasoning}`:""]}),u.evaluatorPass!==null&&C.jsxs("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:["evaluator: ",u.evaluatorPass?"pass":"fail"]}),u.denialReason&&C.jsxs("p",{className:"text-[10px] font-mono",style:{color:"#f85149"},children:["reason: ",u.denialReason]})]},c)),l.denialReason&&l.gateEvals.length===0&&C.jsxs("p",{className:"mt-1 text-[11px] font-mono",style:{color:"#f85149"},"data-testid":"ledger-denial",children:["denied: ",l.denialReason]})]},l.ord)),n!==null&&C.jsxs("li",{"data-testid":"ledger-pending",className:"rounded p-2 text-[11px] font-mono",style:{background:"rgba(255,218,25,0.06)",border:"1px dashed rgba(255,218,25,0.35)",color:"#ffda19"},children:[C.jsx("span",{className:"font-semibold",children:"PENDING"})," · awaiting human · before unit #",n.ord,n.prompt?` — ${n.prompt}`:""]}),s!==null&&C.jsxs("li",{"data-testid":"ledger-next",className:"rounded p-2 text-[11px] font-mono",style:{border:"1px dashed rgba(230,237,243,0.12)",color:"rgba(230,237,243,0.35)"},children:[o?"next decision point · unit #":"next unit · unit #",s,o?" (human-confirm gate)":""]})]})})}function TA({decision:t}){const e={allow:{bg:"rgba(63,185,80,0.12)",color:"#3fb950"},deny:{bg:"rgba(248,81,73,0.12)",color:"#f85149"},allow_with_conditions:{bg:"rgba(255,218,25,0.12)",color:"#ffda19"}},r={allow:"ALLOW",deny:"DENY",allow_with_conditions:"ALLOW + OBLIGATIONS"},n=e[t];return C.jsx("span",{className:"inline-flex rounded px-1.5 py-0.5 text-[10px] font-semibold font-mono",style:{background:n.bg,color:n.color},children:r[t]})}function RA({claim:t}){const[e,r]=ae.useState(!1),n=new Date(t.evaluated_at*1e3).toLocaleTimeString();return C.jsxs("li",{className:"rounded p-2 text-[11px]",style:{background:"#161c26",border:"1px solid rgba(230,237,243,0.07)"},children:[C.jsxs("div",{className:"flex items-center justify-between gap-2",children:[C.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[C.jsx(TA,{decision:t.decision}),C.jsx("span",{className:"font-mono truncate",style:{color:"rgba(230,237,243,0.6)"},children:t.phase})]}),C.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[C.jsx("span",{className:"font-mono",style:{color:"rgba(230,237,243,0.35)"},children:n}),(t.criteria||t.obligations.length>0||t.policy_ids.length>0)&&C.jsx("button",{type:"button",onClick:()=>r(i=>!i),className:"text-xs",style:{color:"rgba(230,237,243,0.35)"},"aria-label":e?"Collapse":"Expand",children:e?"▲":"▼"})]})]}),e&&C.jsxs("div",{className:"mt-2 flex flex-col gap-1.5 text-[10px] font-mono",style:{color:"rgba(230,237,243,0.5)"},children:[t.criteria&&C.jsxs("p",{children:[C.jsx("span",{className:"font-semibold",style:{color:"rgba(230,237,243,0.7)"},children:"criteria: "}),t.criteria]}),t.policy_ids.length>0&&C.jsxs("div",{children:[C.jsx("p",{className:"font-semibold",style:{color:"rgba(230,237,243,0.7)"},children:"policies matched:"}),C.jsx("ul",{className:"list-inside list-disc pl-1",children:t.policy_ids.map(i=>C.jsx("li",{children:i},i))})]}),t.obligations.length>0&&C.jsxs("div",{children:[C.jsx("p",{className:"font-semibold",style:{color:"rgba(230,237,243,0.7)"},children:"obligations:"}),C.jsx("ul",{className:"list-inside list-disc pl-1",children:t.obligations.map((i,s)=>C.jsx("li",{children:i},s))})]}),C.jsxs("p",{children:["evaluator: ",C.jsx("span",{children:t.evaluator_identity})," · ","claim: ",C.jsx("span",{children:t.claim_id})]})]})]})}function LA({model:t}){const[e,r]=ae.useState([]),[n,i]=ae.useState(!0),[s,o]=ae.useState(null),a=ae.useCallback(async()=>{i(!0),o(null);try{const{claims:h}=await lt.listClaims();r(h.filter(g=>g.scope===t.session.id).sort((g,p)=>g.evaluated_at-p.evaluated_at))}catch(h){o(h instanceof Error?h.message:String(h))}finally{i(!1)}},[t.session.id]);ae.useEffect(()=>{a()},[a]);const l=C.jsx("button",{type:"button",onClick:()=>void a(),className:"self-start text-[10px] font-mono hover:underline",style:{color:"rgba(230,237,243,0.4)"},children:"Refresh"});if(n)return C.jsx("p",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Loading governance claims…"});if(s)return C.jsxs("div",{className:"flex flex-col gap-1",children:[C.jsx("p",{className:"rounded px-2 py-1 text-xs font-mono",style:{background:"rgba(248,81,73,0.1)",color:"#f85149",border:"1px solid rgba(248,81,73,0.2)"},children:s}),l]});if(e.length===0)return C.jsxs("div",{className:"flex flex-col gap-1",children:[C.jsx("p",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"No governance claims recorded for this run."}),C.jsx("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.3)"},children:"Claims appear when wicked-core runs governance decisions (core#24/#26)."}),l]});const u=e.filter(h=>h.decision==="deny").length,c=e.filter(h=>h.decision==="allow_with_conditions").length;return C.jsxs("div",{className:"flex flex-col gap-2",children:[C.jsxs("div",{className:"flex items-center justify-between",children:[C.jsxs("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:[e.length," decision",e.length!==1?"s":"",u>0&&C.jsxs("span",{className:"ml-1 font-semibold",style:{color:"#f85149"},children:["· ",u," denied"]}),c>0&&C.jsxs("span",{className:"ml-1",style:{color:"#ffda19"},children:["· ",c," with obligations"]})]}),l]}),C.jsx("ol",{className:"flex flex-col gap-1.5",children:e.map(h=>C.jsx(RA,{claim:h},h.claim_id))})]})}function J1({title:t,onClose:e,children:r,disableEscapeKey:n}){const i=ae.useId();return ae.useEffect(()=>{if(n)return;function s(o){o.key==="Escape"&&e()}return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[e,n]),C.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"rgba(0,0,0,0.6)"},children:C.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":i,className:"relative w-[90vw] h-[80vh] rounded-xl flex flex-col shadow-2xl",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.1)"},children:[C.jsxs("div",{className:"flex items-center justify-between px-4 py-3 shrink-0",style:{borderBottom:"1px solid rgba(230,237,243,0.07)"},children:[C.jsx("h2",{id:i,className:"text-sm font-semibold font-mono",style:{color:"#e6edf3"},children:t}),C.jsx("button",{type:"button",onClick:e,className:"text-lg leading-none transition-colors",style:{color:"rgba(230,237,243,0.35)"},onMouseEnter:s=>{s.currentTarget.style.color="#e6edf3"},onMouseLeave:s=>{s.currentTarget.style.color="rgba(230,237,243,0.35)"},"aria-label":"Close",children:"✕"})]}),C.jsx("div",{className:"flex-1 overflow-auto p-4",children:r})]})})}const NA={approve:{label:"Approved",color:"#3fb950"},"approve-with-steer":{label:"Approved + steered",color:"#ffda19"},reject:{label:"Rejected",color:"#f85149"},cancel:{label:"Cancelled run",color:"rgba(230,237,243,0.5)"}};function DA({runId:t}){const e=zv(r=>r.entries).filter(r=>r.runId===t);return e.length===0?C.jsx("p",{"data-testid":"steering-timeline",className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"No interventions recorded this session. Operator gate actions (approve / reject / amend) appear here as they happen."}):C.jsxs("div",{className:"flex flex-col gap-2",children:[C.jsx("p",{"data-testid":"steering-scope-note",className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.35)"},children:"Client-recorded, this session only — daemon keeps no per-action history, cleared on reload."}),C.jsx("ol",{"data-testid":"steering-timeline",className:"flex flex-col gap-2",children:e.map(r=>{const n=NA[r.action];return C.jsxs("li",{"data-testid":"steering-entry",className:"rounded p-2 text-[11px]",style:{background:"#161c26",border:"1px solid rgba(230,237,243,0.07)"},children:[C.jsxs("div",{className:"flex items-center justify-between",children:[C.jsx("span",{className:"font-semibold font-mono",style:{color:n.color},children:n.label}),C.jsx("span",{className:"font-mono",style:{color:"rgba(230,237,243,0.35)"},children:typeof r.ord=="number"?`before unit #${r.ord}`:"—"})]}),r.amend&&C.jsxs("p",{className:"mt-1 whitespace-pre-wrap rounded p-1.5 font-mono",style:{background:"#0f1419",color:"rgba(230,237,243,0.6)"},children:[C.jsx("span",{className:"font-medium",style:{color:"#e6edf3"},children:"amended instruction:"})," ",r.amend]}),C.jsxs("p",{className:"mt-1 text-[10px] font-mono",style:{color:"rgba(230,237,243,0.35)"},children:["effect: ",r.action==="approve-with-steer"?"steers the next unit":r.action==="approve"?"run advances":r.action==="reject"?"run rejected":"run cancelled"," ","— as recorded"]})]},r.seq)})})]})}var Bp={exports:{}},eb;function AA(){return eb||(eb=1,(function(t,e){(function(r,n){t.exports=n()})(globalThis,(()=>(()=>{var r={4567:function(o,a,l){var u=this&&this.__decorate||function(y,b,_,R){var E,T=arguments.length,k=T<3?b:R===null?R=Object.getOwnPropertyDescriptor(b,_):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(y,b,_,R);else for(var N=y.length-1;N>=0;N--)(E=y[N])&&(k=(T<3?E(k):T>3?E(b,_,k):E(b,_))||k);return T>3&&k&&Object.defineProperty(b,_,k),k},c=this&&this.__param||function(y,b){return function(_,R){b(_,R,y)}};Object.defineProperty(a,"__esModule",{value:!0}),a.AccessibilityManager=void 0;const h=l(9042),g=l(9924),p=l(844),x=l(4725),w=l(2585),v=l(3656);let m=a.AccessibilityManager=class extends p.Disposable{constructor(y,b,_,R){super(),this._terminal=y,this._coreBrowserService=_,this._renderService=R,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let E=0;E<this._terminal.rows;E++)this._rowElements[E]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[E]);if(this._topBoundaryFocusListener=E=>this._handleBoundaryFocus(E,0),this._bottomBoundaryFocusListener=E=>this._handleBoundaryFocus(E,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new g.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((E=>this._handleResize(E.rows)))),this.register(this._terminal.onRender((E=>this._refreshRows(E.start,E.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((E=>this._handleChar(E)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
376
+ `)))),this.register(this._terminal.onA11yTab((E=>this._handleTab(E)))),this.register(this._terminal.onKey((E=>this._handleKey(E.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,v.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,p.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(y){for(let b=0;b<y;b++)this._handleChar(" ")}_handleChar(y){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==y&&(this._charsToAnnounce+=y):this._charsToAnnounce+=y,y===`
377
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=h.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(y){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(y)||this._charsToConsume.push(y)}_refreshRows(y,b){this._liveRegionDebouncer.refresh(y,b,this._terminal.rows)}_renderRows(y,b){const _=this._terminal.buffer,R=_.lines.length.toString();for(let E=y;E<=b;E++){const T=_.lines.get(_.ydisp+E),k=[],N=(T==null?void 0:T.translateToString(!0,void 0,void 0,k))||"",M=(_.ydisp+E+1).toString(),B=this._rowElements[E];B&&(N.length===0?(B.innerText=" ",this._rowColumns.set(B,[0,1])):(B.textContent=N,this._rowColumns.set(B,k)),B.setAttribute("aria-posinset",M),B.setAttribute("aria-setsize",R))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(y,b){const _=y.target,R=this._rowElements[b===0?1:this._rowElements.length-2];if(_.getAttribute("aria-posinset")===(b===0?"1":`${this._terminal.buffer.lines.length}`)||y.relatedTarget!==R)return;let E,T;if(b===0?(E=_,T=this._rowElements.pop(),this._rowContainer.removeChild(T)):(E=this._rowElements.shift(),T=_,this._rowContainer.removeChild(E)),E.removeEventListener("focus",this._topBoundaryFocusListener),T.removeEventListener("focus",this._bottomBoundaryFocusListener),b===0){const k=this._createAccessibilityTreeNode();this._rowElements.unshift(k),this._rowContainer.insertAdjacentElement("afterbegin",k)}else{const k=this._createAccessibilityTreeNode();this._rowElements.push(k),this._rowContainer.appendChild(k)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(b===0?-1:1),this._rowElements[b===0?1:this._rowElements.length-2].focus(),y.preventDefault(),y.stopImmediatePropagation()}_handleSelectionChange(){var N;if(this._rowElements.length===0)return;const y=document.getSelection();if(!y)return;if(y.isCollapsed)return void(this._rowContainer.contains(y.anchorNode)&&this._terminal.clearSelection());if(!y.anchorNode||!y.focusNode)return void console.error("anchorNode and/or focusNode are null");let b={node:y.anchorNode,offset:y.anchorOffset},_={node:y.focusNode,offset:y.focusOffset};if((b.node.compareDocumentPosition(_.node)&Node.DOCUMENT_POSITION_PRECEDING||b.node===_.node&&b.offset>_.offset)&&([b,_]=[_,b]),b.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(b={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(b.node))return;const R=this._rowElements.slice(-1)[0];if(_.node.compareDocumentPosition(R)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(_={node:R,offset:((N=R.textContent)==null?void 0:N.length)??0}),!this._rowContainer.contains(_.node))return;const E=({node:M,offset:B})=>{const A=M instanceof Text?M.parentNode:M;let j=parseInt(A==null?void 0:A.getAttribute("aria-posinset"),10)-1;if(isNaN(j))return console.warn("row is invalid. Race condition?"),null;const D=this._rowColumns.get(A);if(!D)return console.warn("columns is null. Race condition?"),null;let I=B<D.length?D[B]:D.slice(-1)[0]+1;return I>=this._terminal.cols&&(++j,I=0),{row:j,column:I}},T=E(b),k=E(_);if(T&&k){if(T.row>k.row||T.row===k.row&&T.column>=k.column)throw new Error("invalid range");this._terminal.select(T.column,T.row,(k.row-T.row)*this._terminal.cols-T.column+k.column)}}_handleResize(y){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let b=this._rowContainer.children.length;b<this._terminal.rows;b++)this._rowElements[b]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[b]);for(;this._rowElements.length>y;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const y=this._coreBrowserService.mainDocument.createElement("div");return y.setAttribute("role","listitem"),y.tabIndex=-1,this._refreshRowDimensions(y),y}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let y=0;y<this._terminal.rows;y++)this._refreshRowDimensions(this._rowElements[y])}}_refreshRowDimensions(y){y.style.height=`${this._renderService.dimensions.css.cell.height}px`}};a.AccessibilityManager=m=u([c(1,w.IInstantiationService),c(2,x.ICoreBrowserService),c(3,x.IRenderService)],m)},3614:(o,a)=>{function l(g){return g.replace(/\r?\n/g,"\r")}function u(g,p){return p?"\x1B[200~"+g+"\x1B[201~":g}function c(g,p,x,w){g=u(g=l(g),x.decPrivateModes.bracketedPasteMode&&w.rawOptions.ignoreBracketedPasteMode!==!0),x.triggerDataEvent(g,!0),p.value=""}function h(g,p,x){const w=x.getBoundingClientRect(),v=g.clientX-w.left-10,m=g.clientY-w.top-10;p.style.width="20px",p.style.height="20px",p.style.left=`${v}px`,p.style.top=`${m}px`,p.style.zIndex="1000",p.focus()}Object.defineProperty(a,"__esModule",{value:!0}),a.rightClickHandler=a.moveTextAreaUnderMouseCursor=a.paste=a.handlePasteEvent=a.copyHandler=a.bracketTextForPaste=a.prepareTextForTerminal=void 0,a.prepareTextForTerminal=l,a.bracketTextForPaste=u,a.copyHandler=function(g,p){g.clipboardData&&g.clipboardData.setData("text/plain",p.selectionText),g.preventDefault()},a.handlePasteEvent=function(g,p,x,w){g.stopPropagation(),g.clipboardData&&c(g.clipboardData.getData("text/plain"),p,x,w)},a.paste=c,a.moveTextAreaUnderMouseCursor=h,a.rightClickHandler=function(g,p,x,w,v){h(g,p,x),v&&w.rightClickSelect(g),p.value=w.selectionText,p.select()}},7239:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ColorContrastCache=void 0;const u=l(1505);a.ColorContrastCache=class{constructor(){this._color=new u.TwoKeyMap,this._css=new u.TwoKeyMap}setCss(c,h,g){this._css.set(c,h,g)}getCss(c,h){return this._css.get(c,h)}setColor(c,h,g){this._color.set(c,h,g)}getColor(c,h){return this._color.get(c,h)}clear(){this._color.clear(),this._css.clear()}}},3656:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.addDisposableDomListener=void 0,a.addDisposableDomListener=function(l,u,c,h){l.addEventListener(u,c,h);let g=!1;return{dispose:()=>{g||(g=!0,l.removeEventListener(u,c,h))}}}},3551:function(o,a,l){var u=this&&this.__decorate||function(m,y,b,_){var R,E=arguments.length,T=E<3?y:_===null?_=Object.getOwnPropertyDescriptor(y,b):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(m,y,b,_);else for(var k=m.length-1;k>=0;k--)(R=m[k])&&(T=(E<3?R(T):E>3?R(y,b,T):R(y,b))||T);return E>3&&T&&Object.defineProperty(y,b,T),T},c=this&&this.__param||function(m,y){return function(b,_){y(b,_,m)}};Object.defineProperty(a,"__esModule",{value:!0}),a.Linkifier=void 0;const h=l(3656),g=l(8460),p=l(844),x=l(2585),w=l(4725);let v=a.Linkifier=class extends p.Disposable{get currentLink(){return this._currentLink}constructor(m,y,b,_,R){super(),this._element=m,this._mouseService=y,this._renderService=b,this._bufferService=_,this._linkProviderService=R,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new g.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new g.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,p.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,p.toDisposable)((()=>{var E;this._lastMouseEvent=void 0,(E=this._activeProviderReplies)==null||E.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,h.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,h.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,h.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,h.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(m){this._lastMouseEvent=m;const y=this._positionFromMouseEvent(m,this._element,this._mouseService);if(!y)return;this._isMouseOut=!1;const b=m.composedPath();for(let _=0;_<b.length;_++){const R=b[_];if(R.classList.contains("xterm"))break;if(R.classList.contains("xterm-hover"))return}this._lastBufferCell&&y.x===this._lastBufferCell.x&&y.y===this._lastBufferCell.y||(this._handleHover(y),this._lastBufferCell=y)}_handleHover(m){if(this._activeLine!==m.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(m,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,m)||(this._clearCurrentLink(),this._askForLink(m,!0))}_askForLink(m,y){var _,R;this._activeProviderReplies&&y||((_=this._activeProviderReplies)==null||_.forEach((E=>{E==null||E.forEach((T=>{T.link.dispose&&T.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=m.y);let b=!1;for(const[E,T]of this._linkProviderService.linkProviders.entries())y?(R=this._activeProviderReplies)!=null&&R.get(E)&&(b=this._checkLinkProviderResult(E,m,b)):T.provideLinks(m.y,(k=>{var M,B;if(this._isMouseOut)return;const N=k==null?void 0:k.map((A=>({link:A})));(M=this._activeProviderReplies)==null||M.set(E,N),b=this._checkLinkProviderResult(E,m,b),((B=this._activeProviderReplies)==null?void 0:B.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(m.y,this._activeProviderReplies)}))}_removeIntersectingLinks(m,y){const b=new Set;for(let _=0;_<y.size;_++){const R=y.get(_);if(R)for(let E=0;E<R.length;E++){const T=R[E],k=T.link.range.start.y<m?0:T.link.range.start.x,N=T.link.range.end.y>m?this._bufferService.cols:T.link.range.end.x;for(let M=k;M<=N;M++){if(b.has(M)){R.splice(E--,1);break}b.add(M)}}}}_checkLinkProviderResult(m,y,b){var E;if(!this._activeProviderReplies)return b;const _=this._activeProviderReplies.get(m);let R=!1;for(let T=0;T<m;T++)this._activeProviderReplies.has(T)&&!this._activeProviderReplies.get(T)||(R=!0);if(!R&&_){const T=_.find((k=>this._linkAtPosition(k.link,y)));T&&(b=!0,this._handleNewLink(T))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!b)for(let T=0;T<this._activeProviderReplies.size;T++){const k=(E=this._activeProviderReplies.get(T))==null?void 0:E.find((N=>this._linkAtPosition(N.link,y)));if(k){b=!0,this._handleNewLink(k);break}}return b}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(m){if(!this._currentLink)return;const y=this._positionFromMouseEvent(m,this._element,this._mouseService);y&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,y)&&this._currentLink.link.activate(m,this._currentLink.link.text)}_clearCurrentLink(m,y){this._currentLink&&this._lastMouseEvent&&(!m||!y||this._currentLink.link.range.start.y>=m&&this._currentLink.link.range.end.y<=y)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,p.disposeArray)(this._linkCacheDisposables))}_handleNewLink(m){if(!this._lastMouseEvent)return;const y=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);y&&this._linkAtPosition(m.link,y)&&(this._currentLink=m,this._currentLink.state={decorations:{underline:m.link.decorations===void 0||m.link.decorations.underline,pointerCursor:m.link.decorations===void 0||m.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,m.link,this._lastMouseEvent),m.link.decorations={},Object.defineProperties(m.link.decorations,{pointerCursor:{get:()=>{var b,_;return(_=(b=this._currentLink)==null?void 0:b.state)==null?void 0:_.decorations.pointerCursor},set:b=>{var _;(_=this._currentLink)!=null&&_.state&&this._currentLink.state.decorations.pointerCursor!==b&&(this._currentLink.state.decorations.pointerCursor=b,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",b))}},underline:{get:()=>{var b,_;return(_=(b=this._currentLink)==null?void 0:b.state)==null?void 0:_.decorations.underline},set:b=>{var _,R,E;(_=this._currentLink)!=null&&_.state&&((E=(R=this._currentLink)==null?void 0:R.state)==null?void 0:E.decorations.underline)!==b&&(this._currentLink.state.decorations.underline=b,this._currentLink.state.isHovered&&this._fireUnderlineEvent(m.link,b))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((b=>{if(!this._currentLink)return;const _=b.start===0?0:b.start+1+this._bufferService.buffer.ydisp,R=this._bufferService.buffer.ydisp+1+b.end;if(this._currentLink.link.range.start.y>=_&&this._currentLink.link.range.end.y<=R&&(this._clearCurrentLink(_,R),this._lastMouseEvent)){const E=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);E&&this._askForLink(E,!1)}}))))}_linkHover(m,y,b){var _;(_=this._currentLink)!=null&&_.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(y,!0),this._currentLink.state.decorations.pointerCursor&&m.classList.add("xterm-cursor-pointer")),y.hover&&y.hover(b,y.text)}_fireUnderlineEvent(m,y){const b=m.range,_=this._bufferService.buffer.ydisp,R=this._createLinkUnderlineEvent(b.start.x-1,b.start.y-_-1,b.end.x,b.end.y-_-1,void 0);(y?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(R)}_linkLeave(m,y,b){var _;(_=this._currentLink)!=null&&_.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(y,!1),this._currentLink.state.decorations.pointerCursor&&m.classList.remove("xterm-cursor-pointer")),y.leave&&y.leave(b,y.text)}_linkAtPosition(m,y){const b=m.range.start.y*this._bufferService.cols+m.range.start.x,_=m.range.end.y*this._bufferService.cols+m.range.end.x,R=y.y*this._bufferService.cols+y.x;return b<=R&&R<=_}_positionFromMouseEvent(m,y,b){const _=b.getCoords(m,y,this._bufferService.cols,this._bufferService.rows);if(_)return{x:_[0],y:_[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(m,y,b,_,R){return{x1:m,y1:y,x2:b,y2:_,cols:this._bufferService.cols,fg:R}}};a.Linkifier=v=u([c(1,w.IMouseService),c(2,w.IRenderService),c(3,x.IBufferService),c(4,w.ILinkProviderService)],v)},9042:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.tooMuchOutput=a.promptLabel=void 0,a.promptLabel="Terminal input",a.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(o,a,l){var u=this&&this.__decorate||function(w,v,m,y){var b,_=arguments.length,R=_<3?v:y===null?y=Object.getOwnPropertyDescriptor(v,m):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(w,v,m,y);else for(var E=w.length-1;E>=0;E--)(b=w[E])&&(R=(_<3?b(R):_>3?b(v,m,R):b(v,m))||R);return _>3&&R&&Object.defineProperty(v,m,R),R},c=this&&this.__param||function(w,v){return function(m,y){v(m,y,w)}};Object.defineProperty(a,"__esModule",{value:!0}),a.OscLinkProvider=void 0;const h=l(511),g=l(2585);let p=a.OscLinkProvider=class{constructor(w,v,m){this._bufferService=w,this._optionsService=v,this._oscLinkService=m}provideLinks(w,v){var N;const m=this._bufferService.buffer.lines.get(w-1);if(!m)return void v(void 0);const y=[],b=this._optionsService.rawOptions.linkHandler,_=new h.CellData,R=m.getTrimmedLength();let E=-1,T=-1,k=!1;for(let M=0;M<R;M++)if(T!==-1||m.hasContent(M)){if(m.loadCell(M,_),_.hasExtendedAttrs()&&_.extended.urlId){if(T===-1){T=M,E=_.extended.urlId;continue}k=_.extended.urlId!==E}else T!==-1&&(k=!0);if(k||T!==-1&&M===R-1){const B=(N=this._oscLinkService.getLinkData(E))==null?void 0:N.uri;if(B){const A={start:{x:T+1,y:w},end:{x:M+(k||M!==R-1?0:1),y:w}};let j=!1;if(!(b!=null&&b.allowNonHttpProtocols))try{const D=new URL(B);["http:","https:"].includes(D.protocol)||(j=!0)}catch{j=!0}j||y.push({text:B,range:A,activate:(D,I)=>b?b.activate(D,I,A):x(0,I),hover:(D,I)=>{var U;return(U=b==null?void 0:b.hover)==null?void 0:U.call(b,D,I,A)},leave:(D,I)=>{var U;return(U=b==null?void 0:b.leave)==null?void 0:U.call(b,D,I,A)}})}k=!1,_.hasExtendedAttrs()&&_.extended.urlId?(T=M,E=_.extended.urlId):(T=-1,E=-1)}}v(y)}};function x(w,v){if(confirm(`Do you want to navigate to ${v}?
378
+
379
+ WARNING: This link could potentially be dangerous`)){const m=window.open();if(m){try{m.opener=null}catch{}m.location.href=v}else console.warn("Opening link blocked as opener could not be cleared")}}a.OscLinkProvider=p=u([c(0,g.IBufferService),c(1,g.IOptionsService),c(2,g.IOscLinkService)],p)},6193:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.RenderDebouncer=void 0,a.RenderDebouncer=class{constructor(l,u){this._renderCallback=l,this._coreBrowserService=u,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(l){return this._refreshCallbacks.push(l),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(l,u,c){this._rowCount=c,l=l!==void 0?l:0,u=u!==void 0?u:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,l):l,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,u):u,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();const l=Math.max(this._rowStart,0),u=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(l,u),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const l of this._refreshCallbacks)l(0);this._refreshCallbacks=[]}}},3236:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Terminal=void 0;const u=l(3614),c=l(3656),h=l(3551),g=l(9042),p=l(3730),x=l(1680),w=l(3107),v=l(5744),m=l(2950),y=l(1296),b=l(428),_=l(4269),R=l(5114),E=l(8934),T=l(3230),k=l(9312),N=l(4725),M=l(6731),B=l(8055),A=l(8969),j=l(8460),D=l(844),I=l(6114),U=l(8437),W=l(2584),H=l(7399),z=l(5941),P=l(9074),F=l(2585),G=l(5435),$=l(4567),ee=l(779);class re extends A.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(Y={}){super(Y),this.browser=I,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new D.MutableDisposable),this._onCursorMove=this.register(new j.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new j.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new j.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new j.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new j.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new j.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new j.EventEmitter),this._onBlur=this.register(new j.EventEmitter),this._onA11yCharEmitter=this.register(new j.EventEmitter),this._onA11yTabEmitter=this.register(new j.EventEmitter),this._onWillOpen=this.register(new j.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(P.DecorationService),this._instantiationService.setService(F.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(ee.LinkProviderService),this._instantiationService.setService(N.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(p.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((q,K)=>this.refresh(q,K)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((q=>this._reportWindowsOptions(q)))),this.register(this._inputHandler.onColor((q=>this._handleColorEvent(q)))),this.register((0,j.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,j.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,j.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,j.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((q=>this._afterResize(q.cols,q.rows)))),this.register((0,D.toDisposable)((()=>{var q,K;this._customKeyEventHandler=void 0,(K=(q=this.element)==null?void 0:q.parentNode)==null||K.removeChild(this.element)})))}_handleColorEvent(Y){if(this._themeService)for(const q of Y){let K,X="";switch(q.index){case 256:K="foreground",X="10";break;case 257:K="background",X="11";break;case 258:K="cursor",X="12";break;default:K="ansi",X="4;"+q.index}switch(q.type){case 0:const J=B.color.toColorRGB(K==="ansi"?this._themeService.colors.ansi[q.index]:this._themeService.colors[K]);this.coreService.triggerDataEvent(`${W.C0.ESC}]${X};${(0,z.toRgbString)(J)}${W.C1_ESCAPED.ST}`);break;case 1:if(K==="ansi")this._themeService.modifyColors((ie=>ie.ansi[q.index]=B.channels.toColor(...q.color)));else{const ie=K;this._themeService.modifyColors((ce=>ce[ie]=B.channels.toColor(...q.color)))}break;case 2:this._themeService.restoreColor(q.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(Y){Y?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance($.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(Y){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(W.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var Y;return(Y=this.textarea)==null?void 0:Y.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(W.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const Y=this.buffer.ybase+this.buffer.y,q=this.buffer.lines.get(Y);if(!q)return;const K=Math.min(this.buffer.x,this.cols-1),X=this._renderService.dimensions.css.cell.height,J=q.getWidth(K),ie=this._renderService.dimensions.css.cell.width*J,ce=this.buffer.y*this._renderService.dimensions.css.cell.height,de=K*this._renderService.dimensions.css.cell.width;this.textarea.style.left=de+"px",this.textarea.style.top=ce+"px",this.textarea.style.width=ie+"px",this.textarea.style.height=X+"px",this.textarea.style.lineHeight=X+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,c.addDisposableDomListener)(this.element,"copy",(q=>{this.hasSelection()&&(0,u.copyHandler)(q,this._selectionService)})));const Y=q=>(0,u.handlePasteEvent)(q,this.textarea,this.coreService,this.optionsService);this.register((0,c.addDisposableDomListener)(this.textarea,"paste",Y)),this.register((0,c.addDisposableDomListener)(this.element,"paste",Y)),I.isFirefox?this.register((0,c.addDisposableDomListener)(this.element,"mousedown",(q=>{q.button===2&&(0,u.rightClickHandler)(q,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,c.addDisposableDomListener)(this.element,"contextmenu",(q=>{(0,u.rightClickHandler)(q,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),I.isLinux&&this.register((0,c.addDisposableDomListener)(this.element,"auxclick",(q=>{q.button===1&&(0,u.moveTextAreaUnderMouseCursor)(q,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,c.addDisposableDomListener)(this.textarea,"keyup",(Y=>this._keyUp(Y)),!0)),this.register((0,c.addDisposableDomListener)(this.textarea,"keydown",(Y=>this._keyDown(Y)),!0)),this.register((0,c.addDisposableDomListener)(this.textarea,"keypress",(Y=>this._keyPress(Y)),!0)),this.register((0,c.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,c.addDisposableDomListener)(this.textarea,"compositionupdate",(Y=>this._compositionHelper.compositionupdate(Y)))),this.register((0,c.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,c.addDisposableDomListener)(this.textarea,"input",(Y=>this._inputEvent(Y)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(Y){var K;if(!Y)throw new Error("Terminal requires a parent element.");if(Y.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((K=this.element)==null?void 0:K.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=Y.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),Y.appendChild(this.element);const q=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),q.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,c.addDisposableDomListener)(this.screenElement,"mousemove",(X=>this.updateCursorStyle(X)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),q.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",g.promptLabel),I.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(R.CoreBrowserService,this.textarea,Y.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(N.ICoreBrowserService,this._coreBrowserService),this.register((0,c.addDisposableDomListener)(this.textarea,"focus",(X=>this._handleTextAreaFocus(X)))),this.register((0,c.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(b.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(N.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(M.ThemeService),this._instantiationService.setService(N.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(_.CharacterJoinerService),this._instantiationService.setService(N.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(T.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(N.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((X=>this._onRender.fire(X)))),this.onResize((X=>this._renderService.resize(X.cols,X.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(m.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(E.MouseService),this._instantiationService.setService(N.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(h.Linkifier,this.screenElement)),this.element.appendChild(q);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(x.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((X=>this.scrollLines(X.amount,X.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(k.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(N.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((X=>this.scrollLines(X.amount,X.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((X=>this._renderService.handleSelectionChanged(X.start,X.end,X.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((X=>{this.textarea.value=X,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((X=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,c.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(w.BufferDecorationRenderer,this.screenElement)),this.register((0,c.addDisposableDomListener)(this.element,"mousedown",(X=>this._selectionService.handleMouseDown(X)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance($.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(X=>this._handleScreenReaderModeOptionChange(X)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(v.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(X=>{!this._overviewRulerRenderer&&X&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(v.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(y.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const Y=this,q=this.element;function K(ie){const ce=Y._mouseService.getMouseReportCoords(ie,Y.screenElement);if(!ce)return!1;let de,Le;switch(ie.overrideType||ie.type){case"mousemove":Le=32,ie.buttons===void 0?(de=3,ie.button!==void 0&&(de=ie.button<3?ie.button:3)):de=1&ie.buttons?0:4&ie.buttons?1:2&ie.buttons?2:3;break;case"mouseup":Le=0,de=ie.button<3?ie.button:3;break;case"mousedown":Le=1,de=ie.button<3?ie.button:3;break;case"wheel":if(Y._customWheelEventHandler&&Y._customWheelEventHandler(ie)===!1||Y.viewport.getLinesScrolled(ie)===0)return!1;Le=ie.deltaY<0?0:1,de=4;break;default:return!1}return!(Le===void 0||de===void 0||de>4)&&Y.coreMouseService.triggerMouseEvent({col:ce.col,row:ce.row,x:ce.x,y:ce.y,button:de,action:Le,ctrl:ie.ctrlKey,alt:ie.altKey,shift:ie.shiftKey})}const X={mouseup:null,wheel:null,mousedrag:null,mousemove:null},J={mouseup:ie=>(K(ie),ie.buttons||(this._document.removeEventListener("mouseup",X.mouseup),X.mousedrag&&this._document.removeEventListener("mousemove",X.mousedrag)),this.cancel(ie)),wheel:ie=>(K(ie),this.cancel(ie,!0)),mousedrag:ie=>{ie.buttons&&K(ie)},mousemove:ie=>{ie.buttons||K(ie)}};this.register(this.coreMouseService.onProtocolChange((ie=>{ie?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(ie)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&ie?X.mousemove||(q.addEventListener("mousemove",J.mousemove),X.mousemove=J.mousemove):(q.removeEventListener("mousemove",X.mousemove),X.mousemove=null),16&ie?X.wheel||(q.addEventListener("wheel",J.wheel,{passive:!1}),X.wheel=J.wheel):(q.removeEventListener("wheel",X.wheel),X.wheel=null),2&ie?X.mouseup||(X.mouseup=J.mouseup):(this._document.removeEventListener("mouseup",X.mouseup),X.mouseup=null),4&ie?X.mousedrag||(X.mousedrag=J.mousedrag):(this._document.removeEventListener("mousemove",X.mousedrag),X.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,c.addDisposableDomListener)(q,"mousedown",(ie=>{if(ie.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(ie))return K(ie),X.mouseup&&this._document.addEventListener("mouseup",X.mouseup),X.mousedrag&&this._document.addEventListener("mousemove",X.mousedrag),this.cancel(ie)}))),this.register((0,c.addDisposableDomListener)(q,"wheel",(ie=>{if(!X.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(ie)===!1)return!1;if(!this.buffer.hasScrollback){const ce=this.viewport.getLinesScrolled(ie);if(ce===0)return;const de=W.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(ie.deltaY<0?"A":"B");let Le="";for(let je=0;je<Math.abs(ce);je++)Le+=de;return this.coreService.triggerDataEvent(Le,!0),this.cancel(ie,!0)}return this.viewport.handleWheel(ie)?this.cancel(ie):void 0}}),{passive:!1})),this.register((0,c.addDisposableDomListener)(q,"touchstart",(ie=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(ie),this.cancel(ie)}),{passive:!0})),this.register((0,c.addDisposableDomListener)(q,"touchmove",(ie=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(ie)?void 0:this.cancel(ie)}),{passive:!1}))}refresh(Y,q){var K;(K=this._renderService)==null||K.refreshRows(Y,q)}updateCursorStyle(Y){var q;(q=this._selectionService)!=null&&q.shouldColumnSelect(Y)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(Y,q,K=0){var X;K===1?(super.scrollLines(Y,q,K),this.refresh(0,this.rows-1)):(X=this.viewport)==null||X.scrollLines(Y)}paste(Y){(0,u.paste)(Y,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(Y){this._customKeyEventHandler=Y}attachCustomWheelEventHandler(Y){this._customWheelEventHandler=Y}registerLinkProvider(Y){return this._linkProviderService.registerLinkProvider(Y)}registerCharacterJoiner(Y){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const q=this._characterJoinerService.register(Y);return this.refresh(0,this.rows-1),q}deregisterCharacterJoiner(Y){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(Y)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(Y){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+Y)}registerDecoration(Y){return this._decorationService.registerDecoration(Y)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(Y,q,K){this._selectionService.setSelection(Y,q,K)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var Y;(Y=this._selectionService)==null||Y.clearSelection()}selectAll(){var Y;(Y=this._selectionService)==null||Y.selectAll()}selectLines(Y,q){var K;(K=this._selectionService)==null||K.selectLines(Y,q)}_keyDown(Y){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(Y)===!1)return!1;const q=this.browser.isMac&&this.options.macOptionIsMeta&&Y.altKey;if(!q&&!this._compositionHelper.keydown(Y))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;q||Y.key!=="Dead"&&Y.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const K=(0,H.evaluateKeyboardEvent)(Y,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(Y),K.type===3||K.type===2){const X=this.rows-1;return this.scrollLines(K.type===2?-X:X),this.cancel(Y,!0)}return K.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,Y)||(K.cancel&&this.cancel(Y,!0),!K.key||!!(Y.key&&!Y.ctrlKey&&!Y.altKey&&!Y.metaKey&&Y.key.length===1&&Y.key.charCodeAt(0)>=65&&Y.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(K.key!==W.C0.ETX&&K.key!==W.C0.CR||(this.textarea.value=""),this._onKey.fire({key:K.key,domEvent:Y}),this._showCursor(),this.coreService.triggerDataEvent(K.key,!0),!this.optionsService.rawOptions.screenReaderMode||Y.altKey||Y.ctrlKey?this.cancel(Y,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(Y,q){const K=Y.isMac&&!this.options.macOptionIsMeta&&q.altKey&&!q.ctrlKey&&!q.metaKey||Y.isWindows&&q.altKey&&q.ctrlKey&&!q.metaKey||Y.isWindows&&q.getModifierState("AltGraph");return q.type==="keypress"?K:K&&(!q.keyCode||q.keyCode>47)}_keyUp(Y){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(Y)===!1||((function(q){return q.keyCode===16||q.keyCode===17||q.keyCode===18})(Y)||this.focus(),this.updateCursorStyle(Y),this._keyPressHandled=!1)}_keyPress(Y){let q;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(Y)===!1)return!1;if(this.cancel(Y),Y.charCode)q=Y.charCode;else if(Y.which===null||Y.which===void 0)q=Y.keyCode;else{if(Y.which===0||Y.charCode===0)return!1;q=Y.which}return!(!q||(Y.altKey||Y.ctrlKey||Y.metaKey)&&!this._isThirdLevelShift(this.browser,Y)||(q=String.fromCharCode(q),this._onKey.fire({key:q,domEvent:Y}),this._showCursor(),this.coreService.triggerDataEvent(q,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(Y){if(Y.data&&Y.inputType==="insertText"&&(!Y.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const q=Y.data;return this.coreService.triggerDataEvent(q,!0),this.cancel(Y),!0}return!1}resize(Y,q){Y!==this.cols||q!==this.rows?super.resize(Y,q):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(Y,q){var K,X;(K=this._charSizeService)==null||K.measure(),(X=this.viewport)==null||X.syncScrollArea(!0)}clear(){var Y;if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let q=1;q<this.rows;q++)this.buffer.lines.push(this.buffer.getBlankLine(U.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(Y=this.viewport)==null||Y.reset(),this.refresh(0,this.rows-1)}}reset(){var q,K;this.options.rows=this.rows,this.options.cols=this.cols;const Y=this._customKeyEventHandler;this._setup(),super.reset(),(q=this._selectionService)==null||q.reset(),this._decorationService.reset(),(K=this.viewport)==null||K.reset(),this._customKeyEventHandler=Y,this.refresh(0,this.rows-1)}clearTextureAtlas(){var Y;(Y=this._renderService)==null||Y.clearTextureAtlas()}_reportFocus(){var Y;(Y=this.element)!=null&&Y.classList.contains("focus")?this.coreService.triggerDataEvent(W.C0.ESC+"[I"):this.coreService.triggerDataEvent(W.C0.ESC+"[O")}_reportWindowsOptions(Y){if(this._renderService)switch(Y){case G.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const q=this._renderService.dimensions.css.canvas.width.toFixed(0),K=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${W.C0.ESC}[4;${K};${q}t`);break;case G.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const X=this._renderService.dimensions.css.cell.width.toFixed(0),J=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${W.C0.ESC}[6;${J};${X}t`)}}cancel(Y,q){if(this.options.cancelEvents||q)return Y.preventDefault(),Y.stopPropagation(),!1}}a.Terminal=re},9924:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.TimeBasedDebouncer=void 0,a.TimeBasedDebouncer=class{constructor(l,u=1e3){this._renderCallback=l,this._debounceThresholdMS=u,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(l,u,c){this._rowCount=c,l=l!==void 0?l:0,u=u!==void 0?u:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,l):l,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,u):u;const h=Date.now();if(h-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=h,this._innerRefresh();else if(!this._additionalRefreshRequested){const g=h-this._lastRefreshMs,p=this._debounceThresholdMS-g;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),p)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const l=Math.max(this._rowStart,0),u=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(l,u)}}},1680:function(o,a,l){var u=this&&this.__decorate||function(m,y,b,_){var R,E=arguments.length,T=E<3?y:_===null?_=Object.getOwnPropertyDescriptor(y,b):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(m,y,b,_);else for(var k=m.length-1;k>=0;k--)(R=m[k])&&(T=(E<3?R(T):E>3?R(y,b,T):R(y,b))||T);return E>3&&T&&Object.defineProperty(y,b,T),T},c=this&&this.__param||function(m,y){return function(b,_){y(b,_,m)}};Object.defineProperty(a,"__esModule",{value:!0}),a.Viewport=void 0;const h=l(3656),g=l(4725),p=l(8460),x=l(844),w=l(2585);let v=a.Viewport=class extends x.Disposable{constructor(m,y,b,_,R,E,T,k){super(),this._viewportElement=m,this._scrollArea=y,this._bufferService=b,this._optionsService=_,this._charSizeService=R,this._renderService=E,this._coreBrowserService=T,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new p.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,h.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((N=>this._activeBuffer=N.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((N=>this._renderDimensions=N))),this._handleThemeChange(k.colors),this.register(k.onChangeColors((N=>this._handleThemeChange(N)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(m){this._viewportElement.style.backgroundColor=m.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(m){if(m)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const y=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==y&&(this._lastRecordedBufferHeight=y,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const m=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==m&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=m),this._refreshAnimationFrame=null}syncScrollArea(m=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(m);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(m)}_handleScroll(m){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const y=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:y,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const m=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(m*(this._smoothScrollState.target-this._smoothScrollState.origin)),m<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(m,y){const b=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(y<0&&this._viewportElement.scrollTop!==0||y>0&&b<this._lastRecordedBufferHeight)||(m.cancelable&&m.preventDefault(),!1)}handleWheel(m){const y=this._getPixelsScrolled(m);return y!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+y:this._smoothScrollState.target+=y,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=y,this._bubbleScroll(m,y))}scrollLines(m){if(m!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const y=m*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+y,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:m,suppressScrollEvent:!1})}_getPixelsScrolled(m){if(m.deltaY===0||m.shiftKey)return 0;let y=this._applyScrollModifier(m.deltaY,m);return m.deltaMode===WheelEvent.DOM_DELTA_LINE?y*=this._currentRowHeight:m.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(y*=this._currentRowHeight*this._bufferService.rows),y}getBufferElements(m,y){var k;let b,_="";const R=[],E=y??this._bufferService.buffer.lines.length,T=this._bufferService.buffer.lines;for(let N=m;N<E;N++){const M=T.get(N);if(!M)continue;const B=(k=T.get(N+1))==null?void 0:k.isWrapped;if(_+=M.translateToString(!B),!B||N===T.length-1){const A=document.createElement("div");A.textContent=_,R.push(A),_.length>0&&(b=A),_=""}}return{bufferElements:R,cursorElement:b}}getLinesScrolled(m){if(m.deltaY===0||m.shiftKey)return 0;let y=this._applyScrollModifier(m.deltaY,m);return m.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(y/=this._currentRowHeight+0,this._wheelPartialScroll+=y,y=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):m.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(y*=this._bufferService.rows),y}_applyScrollModifier(m,y){const b=this._optionsService.rawOptions.fastScrollModifier;return b==="alt"&&y.altKey||b==="ctrl"&&y.ctrlKey||b==="shift"&&y.shiftKey?m*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:m*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(m){this._lastTouchY=m.touches[0].pageY}handleTouchMove(m){const y=this._lastTouchY-m.touches[0].pageY;return this._lastTouchY=m.touches[0].pageY,y!==0&&(this._viewportElement.scrollTop+=y,this._bubbleScroll(m,y))}};a.Viewport=v=u([c(2,w.IBufferService),c(3,w.IOptionsService),c(4,g.ICharSizeService),c(5,g.IRenderService),c(6,g.ICoreBrowserService),c(7,g.IThemeService)],v)},3107:function(o,a,l){var u=this&&this.__decorate||function(w,v,m,y){var b,_=arguments.length,R=_<3?v:y===null?y=Object.getOwnPropertyDescriptor(v,m):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(w,v,m,y);else for(var E=w.length-1;E>=0;E--)(b=w[E])&&(R=(_<3?b(R):_>3?b(v,m,R):b(v,m))||R);return _>3&&R&&Object.defineProperty(v,m,R),R},c=this&&this.__param||function(w,v){return function(m,y){v(m,y,w)}};Object.defineProperty(a,"__esModule",{value:!0}),a.BufferDecorationRenderer=void 0;const h=l(4725),g=l(844),p=l(2585);let x=a.BufferDecorationRenderer=class extends g.Disposable{constructor(w,v,m,y,b){super(),this._screenElement=w,this._bufferService=v,this._coreBrowserService=m,this._decorationService=y,this._renderService=b,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((_=>this._removeDecoration(_)))),this.register((0,g.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const w of this._decorationService.decorations)this._renderDecoration(w);this._dimensionsChanged=!1}_renderDecoration(w){this._refreshStyle(w),this._dimensionsChanged&&this._refreshXPosition(w)}_createElement(w){var y;const v=this._coreBrowserService.mainDocument.createElement("div");v.classList.add("xterm-decoration"),v.classList.toggle("xterm-decoration-top-layer",((y=w==null?void 0:w.options)==null?void 0:y.layer)==="top"),v.style.width=`${Math.round((w.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,v.style.height=(w.options.height||1)*this._renderService.dimensions.css.cell.height+"px",v.style.top=(w.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",v.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const m=w.options.x??0;return m&&m>this._bufferService.cols&&(v.style.display="none"),this._refreshXPosition(w,v),v}_refreshStyle(w){const v=w.marker.line-this._bufferService.buffers.active.ydisp;if(v<0||v>=this._bufferService.rows)w.element&&(w.element.style.display="none",w.onRenderEmitter.fire(w.element));else{let m=this._decorationElements.get(w);m||(m=this._createElement(w),w.element=m,this._decorationElements.set(w,m),this._container.appendChild(m),w.onDispose((()=>{this._decorationElements.delete(w),m.remove()}))),m.style.top=v*this._renderService.dimensions.css.cell.height+"px",m.style.display=this._altBufferIsActive?"none":"block",w.onRenderEmitter.fire(m)}}_refreshXPosition(w,v=w.element){if(!v)return;const m=w.options.x??0;(w.options.anchor||"left")==="right"?v.style.right=m?m*this._renderService.dimensions.css.cell.width+"px":"":v.style.left=m?m*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(w){var v;(v=this._decorationElements.get(w))==null||v.remove(),this._decorationElements.delete(w),w.dispose()}};a.BufferDecorationRenderer=x=u([c(1,p.IBufferService),c(2,h.ICoreBrowserService),c(3,p.IDecorationService),c(4,h.IRenderService)],x)},5871:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ColorZoneStore=void 0,a.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(l){if(l.options.overviewRulerOptions){for(const u of this._zones)if(u.color===l.options.overviewRulerOptions.color&&u.position===l.options.overviewRulerOptions.position){if(this._lineIntersectsZone(u,l.marker.line))return;if(this._lineAdjacentToZone(u,l.marker.line,l.options.overviewRulerOptions.position))return void this._addLineToZone(u,l.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=l.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=l.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=l.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=l.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:l.options.overviewRulerOptions.color,position:l.options.overviewRulerOptions.position,startBufferLine:l.marker.line,endBufferLine:l.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(l){this._linePadding=l}_lineIntersectsZone(l,u){return u>=l.startBufferLine&&u<=l.endBufferLine}_lineAdjacentToZone(l,u,c){return u>=l.startBufferLine-this._linePadding[c||"full"]&&u<=l.endBufferLine+this._linePadding[c||"full"]}_addLineToZone(l,u){l.startBufferLine=Math.min(l.startBufferLine,u),l.endBufferLine=Math.max(l.endBufferLine,u)}}},5744:function(o,a,l){var u=this&&this.__decorate||function(b,_,R,E){var T,k=arguments.length,N=k<3?_:E===null?E=Object.getOwnPropertyDescriptor(_,R):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(b,_,R,E);else for(var M=b.length-1;M>=0;M--)(T=b[M])&&(N=(k<3?T(N):k>3?T(_,R,N):T(_,R))||N);return k>3&&N&&Object.defineProperty(_,R,N),N},c=this&&this.__param||function(b,_){return function(R,E){_(R,E,b)}};Object.defineProperty(a,"__esModule",{value:!0}),a.OverviewRulerRenderer=void 0;const h=l(5871),g=l(4725),p=l(844),x=l(2585),w={full:0,left:0,center:0,right:0},v={full:0,left:0,center:0,right:0},m={full:0,left:0,center:0,right:0};let y=a.OverviewRulerRenderer=class extends p.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(b,_,R,E,T,k,N){var B;super(),this._viewportElement=b,this._screenElement=_,this._bufferService=R,this._decorationService=E,this._renderService=T,this._optionsService=k,this._coreBrowserService=N,this._colorZoneStore=new h.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(B=this._viewportElement.parentElement)==null||B.insertBefore(this._canvas,this._viewportElement);const M=this._canvas.getContext("2d");if(!M)throw new Error("Ctx cannot be null");this._ctx=M,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,p.toDisposable)((()=>{var A;(A=this._canvas)==null||A.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const b=Math.floor(this._canvas.width/3),_=Math.ceil(this._canvas.width/3);v.full=this._canvas.width,v.left=b,v.center=_,v.right=b,this._refreshDrawHeightConstants(),m.full=0,m.left=0,m.center=v.left,m.right=v.left+v.center}_refreshDrawHeightConstants(){w.full=Math.round(2*this._coreBrowserService.dpr);const b=this._canvas.height/this._bufferService.buffer.lines.length,_=Math.round(Math.max(Math.min(b,12),6)*this._coreBrowserService.dpr);w.left=_,w.center=_,w.right=_}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*w.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*w.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*w.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*w.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const _ of this._decorationService.decorations)this._colorZoneStore.addDecoration(_);this._ctx.lineWidth=1;const b=this._colorZoneStore.zones;for(const _ of b)_.position!=="full"&&this._renderColorZone(_);for(const _ of b)_.position==="full"&&this._renderColorZone(_);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(b){this._ctx.fillStyle=b.color,this._ctx.fillRect(m[b.position||"full"],Math.round((this._canvas.height-1)*(b.startBufferLine/this._bufferService.buffers.active.lines.length)-w[b.position||"full"]/2),v[b.position||"full"],Math.round((this._canvas.height-1)*((b.endBufferLine-b.startBufferLine)/this._bufferService.buffers.active.lines.length)+w[b.position||"full"]))}_queueRefresh(b,_){this._shouldUpdateDimensions=b||this._shouldUpdateDimensions,this._shouldUpdateAnchor=_||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};a.OverviewRulerRenderer=y=u([c(2,x.IBufferService),c(3,x.IDecorationService),c(4,g.IRenderService),c(5,x.IOptionsService),c(6,g.ICoreBrowserService)],y)},2950:function(o,a,l){var u=this&&this.__decorate||function(w,v,m,y){var b,_=arguments.length,R=_<3?v:y===null?y=Object.getOwnPropertyDescriptor(v,m):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(w,v,m,y);else for(var E=w.length-1;E>=0;E--)(b=w[E])&&(R=(_<3?b(R):_>3?b(v,m,R):b(v,m))||R);return _>3&&R&&Object.defineProperty(v,m,R),R},c=this&&this.__param||function(w,v){return function(m,y){v(m,y,w)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CompositionHelper=void 0;const h=l(4725),g=l(2585),p=l(2584);let x=a.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(w,v,m,y,b,_){this._textarea=w,this._compositionView=v,this._bufferService=m,this._optionsService=y,this._coreService=b,this._renderService=_,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(w){this._compositionView.textContent=w.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(w){if(this._isComposing||this._isSendingComposition){if(w.keyCode===229||w.keyCode===16||w.keyCode===17||w.keyCode===18)return!1;this._finalizeComposition(!1)}return w.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(w){if(this._compositionView.classList.remove("active"),this._isComposing=!1,w){const v={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let m;this._isSendingComposition=!1,v.start+=this._dataAlreadySent.length,m=this._isComposing?this._textarea.value.substring(v.start,v.end):this._textarea.value.substring(v.start),m.length>0&&this._coreService.triggerDataEvent(m,!0)}}),0)}else{this._isSendingComposition=!1;const v=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(v,!0)}}_handleAnyTextareaChanges(){const w=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const v=this._textarea.value,m=v.replace(w,"");this._dataAlreadySent=m,v.length>w.length?this._coreService.triggerDataEvent(m,!0):v.length<w.length?this._coreService.triggerDataEvent(`${p.C0.DEL}`,!0):v.length===w.length&&v!==w&&this._coreService.triggerDataEvent(v,!0)}}),0)}updateCompositionElements(w){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const v=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),m=this._renderService.dimensions.css.cell.height,y=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,b=v*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=b+"px",this._compositionView.style.top=y+"px",this._compositionView.style.height=m+"px",this._compositionView.style.lineHeight=m+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const _=this._compositionView.getBoundingClientRect();this._textarea.style.left=b+"px",this._textarea.style.top=y+"px",this._textarea.style.width=Math.max(_.width,1)+"px",this._textarea.style.height=Math.max(_.height,1)+"px",this._textarea.style.lineHeight=_.height+"px"}w||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};a.CompositionHelper=x=u([c(2,g.IBufferService),c(3,g.IOptionsService),c(4,g.ICoreService),c(5,h.IRenderService)],x)},9806:(o,a)=>{function l(u,c,h){const g=h.getBoundingClientRect(),p=u.getComputedStyle(h),x=parseInt(p.getPropertyValue("padding-left")),w=parseInt(p.getPropertyValue("padding-top"));return[c.clientX-g.left-x,c.clientY-g.top-w]}Object.defineProperty(a,"__esModule",{value:!0}),a.getCoords=a.getCoordsRelativeToElement=void 0,a.getCoordsRelativeToElement=l,a.getCoords=function(u,c,h,g,p,x,w,v,m){if(!x)return;const y=l(u,c,h);return y?(y[0]=Math.ceil((y[0]+(m?w/2:0))/w),y[1]=Math.ceil(y[1]/v),y[0]=Math.min(Math.max(y[0],1),g+(m?1:0)),y[1]=Math.min(Math.max(y[1],1),p),y):void 0}},9504:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.moveToCellSequence=void 0;const u=l(2584);function c(v,m,y,b){const _=v-h(v,y),R=m-h(m,y),E=Math.abs(_-R)-(function(T,k,N){let M=0;const B=T-h(T,N),A=k-h(k,N);for(let j=0;j<Math.abs(B-A);j++){const D=g(T,k)==="A"?-1:1,I=N.buffer.lines.get(B+D*j);I!=null&&I.isWrapped&&M++}return M})(v,m,y);return w(E,x(g(v,m),b))}function h(v,m){let y=0,b=m.buffer.lines.get(v),_=b==null?void 0:b.isWrapped;for(;_&&v>=0&&v<m.rows;)y++,b=m.buffer.lines.get(--v),_=b==null?void 0:b.isWrapped;return y}function g(v,m){return v>m?"A":"B"}function p(v,m,y,b,_,R){let E=v,T=m,k="";for(;E!==y||T!==b;)E+=_?1:-1,_&&E>R.cols-1?(k+=R.buffer.translateBufferLineToString(T,!1,v,E),E=0,v=0,T++):!_&&E<0&&(k+=R.buffer.translateBufferLineToString(T,!1,0,v+1),E=R.cols-1,v=E,T--);return k+R.buffer.translateBufferLineToString(T,!1,v,E)}function x(v,m){const y=m?"O":"[";return u.C0.ESC+y+v}function w(v,m){v=Math.floor(v);let y="";for(let b=0;b<v;b++)y+=m;return y}a.moveToCellSequence=function(v,m,y,b){const _=y.buffer.x,R=y.buffer.y;if(!y.buffer.hasScrollback)return(function(k,N,M,B,A,j){return c(N,B,A,j).length===0?"":w(p(k,N,k,N-h(N,A),!1,A).length,x("D",j))})(_,R,0,m,y,b)+c(R,m,y,b)+(function(k,N,M,B,A,j){let D;D=c(N,B,A,j).length>0?B-h(B,A):N;const I=B,U=(function(W,H,z,P,F,G){let $;return $=c(z,P,F,G).length>0?P-h(P,F):H,W<z&&$<=P||W>=z&&$<P?"C":"D"})(k,N,M,B,A,j);return w(p(k,D,M,I,U==="C",A).length,x(U,j))})(_,R,v,m,y,b);let E;if(R===m)return E=_>v?"D":"C",w(Math.abs(_-v),x(E,b));E=R>m?"D":"C";const T=Math.abs(R-m);return w((function(k,N){return N.cols-k})(R>m?v:_,y)+(T-1)*y.cols+1+((R>m?_:v)-1),x(E,b))}},1296:function(o,a,l){var u=this&&this.__decorate||function(j,D,I,U){var W,H=arguments.length,z=H<3?D:U===null?U=Object.getOwnPropertyDescriptor(D,I):U;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")z=Reflect.decorate(j,D,I,U);else for(var P=j.length-1;P>=0;P--)(W=j[P])&&(z=(H<3?W(z):H>3?W(D,I,z):W(D,I))||z);return H>3&&z&&Object.defineProperty(D,I,z),z},c=this&&this.__param||function(j,D){return function(I,U){D(I,U,j)}};Object.defineProperty(a,"__esModule",{value:!0}),a.DomRenderer=void 0;const h=l(3787),g=l(2550),p=l(2223),x=l(6171),w=l(6052),v=l(4725),m=l(8055),y=l(8460),b=l(844),_=l(2585),R="xterm-dom-renderer-owner-",E="xterm-rows",T="xterm-fg-",k="xterm-bg-",N="xterm-focus",M="xterm-selection";let B=1,A=a.DomRenderer=class extends b.Disposable{constructor(j,D,I,U,W,H,z,P,F,G,$,ee,re){super(),this._terminal=j,this._document=D,this._element=I,this._screenElement=U,this._viewportElement=W,this._helperContainer=H,this._linkifier2=z,this._charSizeService=F,this._optionsService=G,this._bufferService=$,this._coreBrowserService=ee,this._themeService=re,this._terminalClass=B++,this._rowElements=[],this._selectionRenderModel=(0,w.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new y.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(E),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(M),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,x.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((ne=>this._injectCss(ne)))),this._injectCss(this._themeService.colors),this._rowFactory=P.createInstance(h.DomRendererRowFactory,document),this._element.classList.add(R+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((ne=>this._handleLinkHover(ne)))),this.register(this._linkifier2.onHideLinkUnderline((ne=>this._handleLinkLeave(ne)))),this.register((0,b.toDisposable)((()=>{this._element.classList.remove(R+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new g.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const j=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*j,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*j),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/j),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/j),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(const I of this._rowElements)I.style.width=`${this.dimensions.css.canvas.width}px`,I.style.height=`${this.dimensions.css.cell.height}px`,I.style.lineHeight=`${this.dimensions.css.cell.height}px`,I.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const D=`${this._terminalSelector} .${E} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=D,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(j){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let D=`${this._terminalSelector} .${E} { color: ${j.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;D+=`${this._terminalSelector} .${E} .xterm-dim { color: ${m.color.multiplyOpacity(j.foreground,.5).css};}`,D+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;const I=`blink_underline_${this._terminalClass}`,U=`blink_bar_${this._terminalClass}`,W=`blink_block_${this._terminalClass}`;D+=`@keyframes ${I} { 50% { border-bottom-style: hidden; }}`,D+=`@keyframes ${U} { 50% { box-shadow: none; }}`,D+=`@keyframes ${W} { 0% { background-color: ${j.cursor.css}; color: ${j.cursorAccent.css}; } 50% { background-color: inherit; color: ${j.cursor.css}; }}`,D+=`${this._terminalSelector} .${E}.${N} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${I} 1s step-end infinite;}${this._terminalSelector} .${E}.${N} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${U} 1s step-end infinite;}${this._terminalSelector} .${E}.${N} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${W} 1s step-end infinite;}${this._terminalSelector} .${E} .xterm-cursor.xterm-cursor-block { background-color: ${j.cursor.css}; color: ${j.cursorAccent.css};}${this._terminalSelector} .${E} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${j.cursor.css} !important; color: ${j.cursorAccent.css} !important;}${this._terminalSelector} .${E} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${j.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${E} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${j.cursor.css} inset;}${this._terminalSelector} .${E} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${j.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,D+=`${this._terminalSelector} .${M} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${M} div { position: absolute; background-color: ${j.selectionBackgroundOpaque.css};}${this._terminalSelector} .${M} div { position: absolute; background-color: ${j.selectionInactiveBackgroundOpaque.css};}`;for(const[H,z]of j.ansi.entries())D+=`${this._terminalSelector} .${T}${H} { color: ${z.css}; }${this._terminalSelector} .${T}${H}.xterm-dim { color: ${m.color.multiplyOpacity(z,.5).css}; }${this._terminalSelector} .${k}${H} { background-color: ${z.css}; }`;D+=`${this._terminalSelector} .${T}${p.INVERTED_DEFAULT_COLOR} { color: ${m.color.opaque(j.background).css}; }${this._terminalSelector} .${T}${p.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${m.color.multiplyOpacity(m.color.opaque(j.background),.5).css}; }${this._terminalSelector} .${k}${p.INVERTED_DEFAULT_COLOR} { background-color: ${j.foreground.css}; }`,this._themeStyleElement.textContent=D}_setDefaultSpacing(){const j=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${j}px`,this._rowFactory.defaultSpacing=j}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(j,D){for(let I=this._rowElements.length;I<=D;I++){const U=this._document.createElement("div");this._rowContainer.appendChild(U),this._rowElements.push(U)}for(;this._rowElements.length>D;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(j,D){this._refreshRowElements(j,D),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(N),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(N),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(j,D,I){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(j,D,I),this.renderRows(0,this._bufferService.rows-1),!j||!D)return;this._selectionRenderModel.update(this._terminal,j,D,I);const U=this._selectionRenderModel.viewportStartRow,W=this._selectionRenderModel.viewportEndRow,H=this._selectionRenderModel.viewportCappedStartRow,z=this._selectionRenderModel.viewportCappedEndRow;if(H>=this._bufferService.rows||z<0)return;const P=this._document.createDocumentFragment();if(I){const F=j[0]>D[0];P.appendChild(this._createSelectionElement(H,F?D[0]:j[0],F?j[0]:D[0],z-H+1))}else{const F=U===H?j[0]:0,G=H===W?D[0]:this._bufferService.cols;P.appendChild(this._createSelectionElement(H,F,G));const $=z-H-1;if(P.appendChild(this._createSelectionElement(H+1,0,this._bufferService.cols,$)),H!==z){const ee=W===z?D[0]:this._bufferService.cols;P.appendChild(this._createSelectionElement(z,0,ee))}}this._selectionContainer.appendChild(P)}_createSelectionElement(j,D,I,U=1){const W=this._document.createElement("div"),H=D*this.dimensions.css.cell.width;let z=this.dimensions.css.cell.width*(I-D);return H+z>this.dimensions.css.canvas.width&&(z=this.dimensions.css.canvas.width-H),W.style.height=U*this.dimensions.css.cell.height+"px",W.style.top=j*this.dimensions.css.cell.height+"px",W.style.left=`${H}px`,W.style.width=`${z}px`,W}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(const j of this._rowElements)j.replaceChildren()}renderRows(j,D){const I=this._bufferService.buffer,U=I.ybase+I.y,W=Math.min(I.x,this._bufferService.cols-1),H=this._optionsService.rawOptions.cursorBlink,z=this._optionsService.rawOptions.cursorStyle,P=this._optionsService.rawOptions.cursorInactiveStyle;for(let F=j;F<=D;F++){const G=F+I.ydisp,$=this._rowElements[F],ee=I.lines.get(G);if(!$||!ee)break;$.replaceChildren(...this._rowFactory.createRow(ee,G,G===U,z,P,W,H,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${R}${this._terminalClass}`}_handleLinkHover(j){this._setCellUnderline(j.x1,j.x2,j.y1,j.y2,j.cols,!0)}_handleLinkLeave(j){this._setCellUnderline(j.x1,j.x2,j.y1,j.y2,j.cols,!1)}_setCellUnderline(j,D,I,U,W,H){I<0&&(j=0),U<0&&(D=0);const z=this._bufferService.rows-1;I=Math.max(Math.min(I,z),0),U=Math.max(Math.min(U,z),0),W=Math.min(W,this._bufferService.cols);const P=this._bufferService.buffer,F=P.ybase+P.y,G=Math.min(P.x,W-1),$=this._optionsService.rawOptions.cursorBlink,ee=this._optionsService.rawOptions.cursorStyle,re=this._optionsService.rawOptions.cursorInactiveStyle;for(let ne=I;ne<=U;++ne){const Y=ne+P.ydisp,q=this._rowElements[ne],K=P.lines.get(Y);if(!q||!K)break;q.replaceChildren(...this._rowFactory.createRow(K,Y,Y===F,ee,re,G,$,this.dimensions.css.cell.width,this._widthCache,H?ne===I?j:0:-1,H?(ne===U?D:W)-1:-1))}}};a.DomRenderer=A=u([c(7,_.IInstantiationService),c(8,v.ICharSizeService),c(9,_.IOptionsService),c(10,_.IBufferService),c(11,v.ICoreBrowserService),c(12,v.IThemeService)],A)},3787:function(o,a,l){var u=this&&this.__decorate||function(E,T,k,N){var M,B=arguments.length,A=B<3?T:N===null?N=Object.getOwnPropertyDescriptor(T,k):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(E,T,k,N);else for(var j=E.length-1;j>=0;j--)(M=E[j])&&(A=(B<3?M(A):B>3?M(T,k,A):M(T,k))||A);return B>3&&A&&Object.defineProperty(T,k,A),A},c=this&&this.__param||function(E,T){return function(k,N){T(k,N,E)}};Object.defineProperty(a,"__esModule",{value:!0}),a.DomRendererRowFactory=void 0;const h=l(2223),g=l(643),p=l(511),x=l(2585),w=l(8055),v=l(4725),m=l(4269),y=l(6171),b=l(3734);let _=a.DomRendererRowFactory=class{constructor(E,T,k,N,M,B,A){this._document=E,this._characterJoinerService=T,this._optionsService=k,this._coreBrowserService=N,this._coreService=M,this._decorationService=B,this._themeService=A,this._workCell=new p.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(E,T,k){this._selectionStart=E,this._selectionEnd=T,this._columnSelectMode=k}createRow(E,T,k,N,M,B,A,j,D,I,U){const W=[],H=this._characterJoinerService.getJoinedCharacters(T),z=this._themeService.colors;let P,F=E.getNoBgTrimmedLength();k&&F<B+1&&(F=B+1);let G=0,$="",ee=0,re=0,ne=0,Y=!1,q=0,K=!1,X=0;const J=[],ie=I!==-1&&U!==-1;for(let ce=0;ce<F;ce++){E.loadCell(ce,this._workCell);let de=this._workCell.getWidth();if(de===0)continue;let Le=!1,je=ce,_e=this._workCell;if(H.length>0&&ce===H[0][0]){Le=!0;const te=H.shift();_e=new m.JoinedCellData(this._workCell,E.translateToString(!0,te[0],te[1]),te[1]-te[0]),je=te[1]-1,de=_e.getWidth()}const ke=this._isCellInSelection(ce,T),Ne=k&&ce===B,Ee=ie&&ce>=I&&ce<=U;let Me=!1;this._decorationService.forEachDecorationAtCell(ce,T,void 0,(te=>{Me=!0}));let Pe=_e.getChars()||g.WHITESPACE_CELL_CHAR;if(Pe===" "&&(_e.isUnderline()||_e.isOverline())&&(Pe=" "),X=de*j-D.get(Pe,_e.isBold(),_e.isItalic()),P){if(G&&(ke&&K||!ke&&!K&&_e.bg===ee)&&(ke&&K&&z.selectionForeground||_e.fg===re)&&_e.extended.ext===ne&&Ee===Y&&X===q&&!Ne&&!Le&&!Me){_e.isInvisible()?$+=g.WHITESPACE_CELL_CHAR:$+=Pe,G++;continue}G&&(P.textContent=$),P=this._document.createElement("span"),G=0,$=""}else P=this._document.createElement("span");if(ee=_e.bg,re=_e.fg,ne=_e.extended.ext,Y=Ee,q=X,K=ke,Le&&B>=ce&&B<=je&&(B=ce),!this._coreService.isCursorHidden&&Ne&&this._coreService.isCursorInitialized){if(J.push("xterm-cursor"),this._coreBrowserService.isFocused)A&&J.push("xterm-cursor-blink"),J.push(N==="bar"?"xterm-cursor-bar":N==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(M)switch(M){case"outline":J.push("xterm-cursor-outline");break;case"block":J.push("xterm-cursor-block");break;case"bar":J.push("xterm-cursor-bar");break;case"underline":J.push("xterm-cursor-underline")}}if(_e.isBold()&&J.push("xterm-bold"),_e.isItalic()&&J.push("xterm-italic"),_e.isDim()&&J.push("xterm-dim"),$=_e.isInvisible()?g.WHITESPACE_CELL_CHAR:_e.getChars()||g.WHITESPACE_CELL_CHAR,_e.isUnderline()&&(J.push(`xterm-underline-${_e.extended.underlineStyle}`),$===" "&&($=" "),!_e.isUnderlineColorDefault()))if(_e.isUnderlineColorRGB())P.style.textDecorationColor=`rgb(${b.AttributeData.toColorRGB(_e.getUnderlineColor()).join(",")})`;else{let te=_e.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&_e.isBold()&&te<8&&(te+=8),P.style.textDecorationColor=z.ansi[te].css}_e.isOverline()&&(J.push("xterm-overline"),$===" "&&($=" ")),_e.isStrikethrough()&&J.push("xterm-strikethrough"),Ee&&(P.style.textDecoration="underline");let De=_e.getFgColor(),Ue=_e.getFgColorMode(),Ye=_e.getBgColor(),ge=_e.getBgColorMode();const Ce=!!_e.isInverse();if(Ce){const te=De;De=Ye,Ye=te;const oe=Ue;Ue=ge,ge=oe}let Ae,Be,me,Z=!1;switch(this._decorationService.forEachDecorationAtCell(ce,T,void 0,(te=>{te.options.layer!=="top"&&Z||(te.backgroundColorRGB&&(ge=50331648,Ye=te.backgroundColorRGB.rgba>>8&16777215,Ae=te.backgroundColorRGB),te.foregroundColorRGB&&(Ue=50331648,De=te.foregroundColorRGB.rgba>>8&16777215,Be=te.foregroundColorRGB),Z=te.options.layer==="top")})),!Z&&ke&&(Ae=this._coreBrowserService.isFocused?z.selectionBackgroundOpaque:z.selectionInactiveBackgroundOpaque,Ye=Ae.rgba>>8&16777215,ge=50331648,Z=!0,z.selectionForeground&&(Ue=50331648,De=z.selectionForeground.rgba>>8&16777215,Be=z.selectionForeground)),Z&&J.push("xterm-decoration-top"),ge){case 16777216:case 33554432:me=z.ansi[Ye],J.push(`xterm-bg-${Ye}`);break;case 50331648:me=w.channels.toColor(Ye>>16,Ye>>8&255,255&Ye),this._addStyle(P,`background-color:#${R((Ye>>>0).toString(16),"0",6)}`);break;default:Ce?(me=z.foreground,J.push(`xterm-bg-${h.INVERTED_DEFAULT_COLOR}`)):me=z.background}switch(Ae||_e.isDim()&&(Ae=w.color.multiplyOpacity(me,.5)),Ue){case 16777216:case 33554432:_e.isBold()&&De<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(De+=8),this._applyMinimumContrast(P,me,z.ansi[De],_e,Ae,void 0)||J.push(`xterm-fg-${De}`);break;case 50331648:const te=w.channels.toColor(De>>16&255,De>>8&255,255&De);this._applyMinimumContrast(P,me,te,_e,Ae,Be)||this._addStyle(P,`color:#${R(De.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(P,me,z.foreground,_e,Ae,Be)||Ce&&J.push(`xterm-fg-${h.INVERTED_DEFAULT_COLOR}`)}J.length&&(P.className=J.join(" "),J.length=0),Ne||Le||Me?P.textContent=$:G++,X!==this.defaultSpacing&&(P.style.letterSpacing=`${X}px`),W.push(P),ce=je}return P&&G&&(P.textContent=$),W}_applyMinimumContrast(E,T,k,N,M,B){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,y.treatGlyphAsBackgroundColor)(N.getCode()))return!1;const A=this._getContrastCache(N);let j;if(M||B||(j=A.getColor(T.rgba,k.rgba)),j===void 0){const D=this._optionsService.rawOptions.minimumContrastRatio/(N.isDim()?2:1);j=w.color.ensureContrastRatio(M||T,B||k,D),A.setColor((M||T).rgba,(B||k).rgba,j??null)}return!!j&&(this._addStyle(E,`color:${j.css}`),!0)}_getContrastCache(E){return E.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(E,T){E.setAttribute("style",`${E.getAttribute("style")||""}${T};`)}_isCellInSelection(E,T){const k=this._selectionStart,N=this._selectionEnd;return!(!k||!N)&&(this._columnSelectMode?k[0]<=N[0]?E>=k[0]&&T>=k[1]&&E<N[0]&&T<=N[1]:E<k[0]&&T>=k[1]&&E>=N[0]&&T<=N[1]:T>k[1]&&T<N[1]||k[1]===N[1]&&T===k[1]&&E>=k[0]&&E<N[0]||k[1]<N[1]&&T===N[1]&&E<N[0]||k[1]<N[1]&&T===k[1]&&E>=k[0])}};function R(E,T,k){for(;E.length<k;)E=T+E;return E}a.DomRendererRowFactory=_=u([c(1,v.ICharacterJoinerService),c(2,x.IOptionsService),c(3,v.ICoreBrowserService),c(4,x.ICoreService),c(5,x.IDecorationService),c(6,v.IThemeService)],_)},2550:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.WidthCache=void 0,a.WidthCache=class{constructor(l,u){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=l.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const c=l.createElement("span");c.classList.add("xterm-char-measure-element");const h=l.createElement("span");h.classList.add("xterm-char-measure-element"),h.style.fontWeight="bold";const g=l.createElement("span");g.classList.add("xterm-char-measure-element"),g.style.fontStyle="italic";const p=l.createElement("span");p.classList.add("xterm-char-measure-element"),p.style.fontWeight="bold",p.style.fontStyle="italic",this._measureElements=[c,h,g,p],this._container.appendChild(c),this._container.appendChild(h),this._container.appendChild(g),this._container.appendChild(p),u.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(l,u,c,h){l===this._font&&u===this._fontSize&&c===this._weight&&h===this._weightBold||(this._font=l,this._fontSize=u,this._weight=c,this._weightBold=h,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${c}`,this._measureElements[1].style.fontWeight=`${h}`,this._measureElements[2].style.fontWeight=`${c}`,this._measureElements[3].style.fontWeight=`${h}`,this.clear())}get(l,u,c){let h=0;if(!u&&!c&&l.length===1&&(h=l.charCodeAt(0))<256){if(this._flat[h]!==-9999)return this._flat[h];const x=this._measure(l,0);return x>0&&(this._flat[h]=x),x}let g=l;u&&(g+="B"),c&&(g+="I");let p=this._holey.get(g);if(p===void 0){let x=0;u&&(x|=1),c&&(x|=2),p=this._measure(l,x),p>0&&this._holey.set(g,p)}return p}_measure(l,u){const c=this._measureElements[u];return c.textContent=l.repeat(32),c.offsetWidth/32}}},2223:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.TEXT_BASELINE=a.DIM_OPACITY=a.INVERTED_DEFAULT_COLOR=void 0;const u=l(6114);a.INVERTED_DEFAULT_COLOR=257,a.DIM_OPACITY=.5,a.TEXT_BASELINE=u.isFirefox||u.isLegacyEdge?"bottom":"ideographic"},6171:(o,a)=>{function l(c){return 57508<=c&&c<=57558}function u(c){return c>=128512&&c<=128591||c>=127744&&c<=128511||c>=128640&&c<=128767||c>=9728&&c<=9983||c>=9984&&c<=10175||c>=65024&&c<=65039||c>=129280&&c<=129535||c>=127462&&c<=127487}Object.defineProperty(a,"__esModule",{value:!0}),a.computeNextVariantOffset=a.createRenderDimensions=a.treatGlyphAsBackgroundColor=a.allowRescaling=a.isEmoji=a.isRestrictedPowerlineGlyph=a.isPowerlineGlyph=a.throwIfFalsy=void 0,a.throwIfFalsy=function(c){if(!c)throw new Error("value must not be falsy");return c},a.isPowerlineGlyph=l,a.isRestrictedPowerlineGlyph=function(c){return 57520<=c&&c<=57527},a.isEmoji=u,a.allowRescaling=function(c,h,g,p){return h===1&&g>Math.ceil(1.5*p)&&c!==void 0&&c>255&&!u(c)&&!l(c)&&!(function(x){return 57344<=x&&x<=63743})(c)},a.treatGlyphAsBackgroundColor=function(c){return l(c)||(function(h){return 9472<=h&&h<=9631})(c)},a.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},a.computeNextVariantOffset=function(c,h,g=0){return(c-(2*Math.round(h)-g))%(2*Math.round(h))}},6052:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.createSelectionRenderModel=void 0;class l{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(c,h,g,p=!1){if(this.selectionStart=h,this.selectionEnd=g,!h||!g||h[0]===g[0]&&h[1]===g[1])return void this.clear();const x=c.buffers.active.ydisp,w=h[1]-x,v=g[1]-x,m=Math.max(w,0),y=Math.min(v,c.rows-1);m>=c.rows||y<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=p,this.viewportStartRow=w,this.viewportEndRow=v,this.viewportCappedStartRow=m,this.viewportCappedEndRow=y,this.startCol=h[0],this.endCol=g[0])}isCellSelected(c,h,g){return!!this.hasSelection&&(g-=c.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?h>=this.startCol&&g>=this.viewportCappedStartRow&&h<this.endCol&&g<=this.viewportCappedEndRow:h<this.startCol&&g>=this.viewportCappedStartRow&&h>=this.endCol&&g<=this.viewportCappedEndRow:g>this.viewportStartRow&&g<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&g===this.viewportStartRow&&h>=this.startCol&&h<this.endCol||this.viewportStartRow<this.viewportEndRow&&g===this.viewportEndRow&&h<this.endCol||this.viewportStartRow<this.viewportEndRow&&g===this.viewportStartRow&&h>=this.startCol)}}a.createSelectionRenderModel=function(){return new l}},456:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.SelectionModel=void 0,a.SelectionModel=class{constructor(l){this._bufferService=l,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const l=this.selectionStart[0]+this.selectionStartLength;return l>this._bufferService.cols?l%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(l/this._bufferService.cols)-1]:[l%this._bufferService.cols,this.selectionStart[1]+Math.floor(l/this._bufferService.cols)]:[l,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const l=this.selectionStart[0]+this.selectionStartLength;return l>this._bufferService.cols?[l%this._bufferService.cols,this.selectionStart[1]+Math.floor(l/this._bufferService.cols)]:[Math.max(l,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const l=this.selectionStart,u=this.selectionEnd;return!(!l||!u)&&(l[1]>u[1]||l[1]===u[1]&&l[0]>u[0])}handleTrim(l){return this.selectionStart&&(this.selectionStart[1]-=l),this.selectionEnd&&(this.selectionEnd[1]-=l),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(o,a,l){var u=this&&this.__decorate||function(y,b,_,R){var E,T=arguments.length,k=T<3?b:R===null?R=Object.getOwnPropertyDescriptor(b,_):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(y,b,_,R);else for(var N=y.length-1;N>=0;N--)(E=y[N])&&(k=(T<3?E(k):T>3?E(b,_,k):E(b,_))||k);return T>3&&k&&Object.defineProperty(b,_,k),k},c=this&&this.__param||function(y,b){return function(_,R){b(_,R,y)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CharSizeService=void 0;const h=l(2585),g=l(8460),p=l(844);let x=a.CharSizeService=class extends p.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(y,b,_){super(),this._optionsService=_,this.width=0,this.height=0,this._onCharSizeChange=this.register(new g.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new m(this._optionsService))}catch{this._measureStrategy=this.register(new v(y,b,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const y=this._measureStrategy.measure();y.width===this.width&&y.height===this.height||(this.width=y.width,this.height=y.height,this._onCharSizeChange.fire())}};a.CharSizeService=x=u([c(2,h.IOptionsService)],x);class w extends p.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(b,_){b!==void 0&&b>0&&_!==void 0&&_>0&&(this._result.width=b,this._result.height=_)}}class v extends w{constructor(b,_,R){super(),this._document=b,this._parentElement=_,this._optionsService=R,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class m extends w{constructor(b){super(),this._optionsService=b,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const _=this._ctx.measureText("W");if(!("width"in _&&"fontBoundingBoxAscent"in _&&"fontBoundingBoxDescent"in _))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const b=this._ctx.measureText("W");return this._validateAndSet(b.width,b.fontBoundingBoxAscent+b.fontBoundingBoxDescent),this._result}}},4269:function(o,a,l){var u=this&&this.__decorate||function(m,y,b,_){var R,E=arguments.length,T=E<3?y:_===null?_=Object.getOwnPropertyDescriptor(y,b):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(m,y,b,_);else for(var k=m.length-1;k>=0;k--)(R=m[k])&&(T=(E<3?R(T):E>3?R(y,b,T):R(y,b))||T);return E>3&&T&&Object.defineProperty(y,b,T),T},c=this&&this.__param||function(m,y){return function(b,_){y(b,_,m)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CharacterJoinerService=a.JoinedCellData=void 0;const h=l(3734),g=l(643),p=l(511),x=l(2585);class w extends h.AttributeData{constructor(y,b,_){super(),this.content=0,this.combinedData="",this.fg=y.fg,this.bg=y.bg,this.combinedData=b,this._width=_}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(y){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}a.JoinedCellData=w;let v=a.CharacterJoinerService=class J_{constructor(y){this._bufferService=y,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new p.CellData}register(y){const b={id:this._nextCharacterJoinerId++,handler:y};return this._characterJoiners.push(b),b.id}deregister(y){for(let b=0;b<this._characterJoiners.length;b++)if(this._characterJoiners[b].id===y)return this._characterJoiners.splice(b,1),!0;return!1}getJoinedCharacters(y){if(this._characterJoiners.length===0)return[];const b=this._bufferService.buffer.lines.get(y);if(!b||b.length===0)return[];const _=[],R=b.translateToString(!0);let E=0,T=0,k=0,N=b.getFg(0),M=b.getBg(0);for(let B=0;B<b.getTrimmedLength();B++)if(b.loadCell(B,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==N||this._workCell.bg!==M){if(B-E>1){const A=this._getJoinedRanges(R,k,T,b,E);for(let j=0;j<A.length;j++)_.push(A[j])}E=B,k=T,N=this._workCell.fg,M=this._workCell.bg}T+=this._workCell.getChars().length||g.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-E>1){const B=this._getJoinedRanges(R,k,T,b,E);for(let A=0;A<B.length;A++)_.push(B[A])}return _}_getJoinedRanges(y,b,_,R,E){const T=y.substring(b,_);let k=[];try{k=this._characterJoiners[0].handler(T)}catch(N){console.error(N)}for(let N=1;N<this._characterJoiners.length;N++)try{const M=this._characterJoiners[N].handler(T);for(let B=0;B<M.length;B++)J_._mergeRanges(k,M[B])}catch(M){console.error(M)}return this._stringRangesToCellRanges(k,R,E),k}_stringRangesToCellRanges(y,b,_){let R=0,E=!1,T=0,k=y[R];if(k){for(let N=_;N<this._bufferService.cols;N++){const M=b.getWidth(N),B=b.getString(N).length||g.WHITESPACE_CELL_CHAR.length;if(M!==0){if(!E&&k[0]<=T&&(k[0]=N,E=!0),k[1]<=T){if(k[1]=N,k=y[++R],!k)break;k[0]<=T?(k[0]=N,E=!0):E=!1}T+=B}}k&&(k[1]=this._bufferService.cols)}}static _mergeRanges(y,b){let _=!1;for(let R=0;R<y.length;R++){const E=y[R];if(_){if(b[1]<=E[0])return y[R-1][1]=b[1],y;if(b[1]<=E[1])return y[R-1][1]=Math.max(b[1],E[1]),y.splice(R,1),y;y.splice(R,1),R--}else{if(b[1]<=E[0])return y.splice(R,0,b),y;if(b[1]<=E[1])return E[0]=Math.min(b[0],E[0]),y;b[0]<E[1]&&(E[0]=Math.min(b[0],E[0]),_=!0)}}return _?y[y.length-1][1]=b[1]:y.push(b),y}};a.CharacterJoinerService=v=u([c(0,x.IBufferService)],v)},5114:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CoreBrowserService=void 0;const u=l(844),c=l(8460),h=l(3656);class g extends u.Disposable{constructor(w,v,m){super(),this._textarea=w,this._window=v,this.mainDocument=m,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new p(this._window),this._onDprChange=this.register(new c.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new c.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((y=>this._screenDprMonitor.setWindow(y)))),this.register((0,c.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(w){this._window!==w&&(this._window=w,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}a.CoreBrowserService=g;class p extends u.Disposable{constructor(w){super(),this._parentWindow=w,this._windowResizeListener=this.register(new u.MutableDisposable),this._onDprChange=this.register(new c.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,u.toDisposable)((()=>this.clearListener())))}setWindow(w){this._parentWindow=w,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,h.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var w;this._outerListener&&((w=this._resolutionMediaMatchList)==null||w.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.LinkProviderService=void 0;const u=l(844);class c extends u.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,u.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(g){return this.linkProviders.push(g),{dispose:()=>{const p=this.linkProviders.indexOf(g);p!==-1&&this.linkProviders.splice(p,1)}}}}a.LinkProviderService=c},8934:function(o,a,l){var u=this&&this.__decorate||function(x,w,v,m){var y,b=arguments.length,_=b<3?w:m===null?m=Object.getOwnPropertyDescriptor(w,v):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(x,w,v,m);else for(var R=x.length-1;R>=0;R--)(y=x[R])&&(_=(b<3?y(_):b>3?y(w,v,_):y(w,v))||_);return b>3&&_&&Object.defineProperty(w,v,_),_},c=this&&this.__param||function(x,w){return function(v,m){w(v,m,x)}};Object.defineProperty(a,"__esModule",{value:!0}),a.MouseService=void 0;const h=l(4725),g=l(9806);let p=a.MouseService=class{constructor(x,w){this._renderService=x,this._charSizeService=w}getCoords(x,w,v,m,y){return(0,g.getCoords)(window,x,w,v,m,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,y)}getMouseReportCoords(x,w){const v=(0,g.getCoordsRelativeToElement)(window,x,w);if(this._charSizeService.hasValidSize)return v[0]=Math.min(Math.max(v[0],0),this._renderService.dimensions.css.canvas.width-1),v[1]=Math.min(Math.max(v[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(v[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(v[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(v[0]),y:Math.floor(v[1])}}};a.MouseService=p=u([c(0,h.IRenderService),c(1,h.ICharSizeService)],p)},3230:function(o,a,l){var u=this&&this.__decorate||function(y,b,_,R){var E,T=arguments.length,k=T<3?b:R===null?R=Object.getOwnPropertyDescriptor(b,_):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(y,b,_,R);else for(var N=y.length-1;N>=0;N--)(E=y[N])&&(k=(T<3?E(k):T>3?E(b,_,k):E(b,_))||k);return T>3&&k&&Object.defineProperty(b,_,k),k},c=this&&this.__param||function(y,b){return function(_,R){b(_,R,y)}};Object.defineProperty(a,"__esModule",{value:!0}),a.RenderService=void 0;const h=l(6193),g=l(4725),p=l(8460),x=l(844),w=l(7226),v=l(2585);let m=a.RenderService=class extends x.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(y,b,_,R,E,T,k,N){super(),this._rowCount=y,this._charSizeService=R,this._renderer=this.register(new x.MutableDisposable),this._pausedResizeTask=new w.DebouncedIdleTask,this._observerDisposable=this.register(new x.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new p.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new p.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new p.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new p.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new h.RenderDebouncer(((M,B)=>this._renderRows(M,B)),k),this.register(this._renderDebouncer),this.register(k.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(T.onResize((()=>this._fullRefresh()))),this.register(T.buffers.onBufferActivate((()=>{var M;return(M=this._renderer.value)==null?void 0:M.clear()}))),this.register(_.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(E.onDecorationRegistered((()=>this._fullRefresh()))),this.register(E.onDecorationRemoved((()=>this._fullRefresh()))),this.register(_.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(T.cols,T.rows),this._fullRefresh()}))),this.register(_.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(T.buffer.y,T.buffer.y,!0)))),this.register(N.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(k.window,b),this.register(k.onWindowChange((M=>this._registerIntersectionObserver(M,b))))}_registerIntersectionObserver(y,b){if("IntersectionObserver"in y){const _=new y.IntersectionObserver((R=>this._handleIntersectionChange(R[R.length-1])),{threshold:0});_.observe(b),this._observerDisposable.value=(0,x.toDisposable)((()=>_.disconnect()))}}_handleIntersectionChange(y){this._isPaused=y.isIntersecting===void 0?y.intersectionRatio===0:!y.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(y,b,_=!1){this._isPaused?this._needsFullRefresh=!0:(_||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(y,b,this._rowCount))}_renderRows(y,b){this._renderer.value&&(y=Math.min(y,this._rowCount-1),b=Math.min(b,this._rowCount-1),this._renderer.value.renderRows(y,b),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:y,end:b}),this._onRender.fire({start:y,end:b}),this._isNextRenderRedrawOnly=!0)}resize(y,b){this._rowCount=b,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(y){this._renderer.value=y,this._renderer.value&&(this._renderer.value.onRequestRedraw((b=>this.refreshRows(b.start,b.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(y){return this._renderDebouncer.addRefreshCallback(y)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var y,b;this._renderer.value&&((b=(y=this._renderer.value).clearTextureAtlas)==null||b.call(y),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(y,b){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var _;return(_=this._renderer.value)==null?void 0:_.handleResize(y,b)})):this._renderer.value.handleResize(y,b),this._fullRefresh())}handleCharSizeChanged(){var y;(y=this._renderer.value)==null||y.handleCharSizeChanged()}handleBlur(){var y;(y=this._renderer.value)==null||y.handleBlur()}handleFocus(){var y;(y=this._renderer.value)==null||y.handleFocus()}handleSelectionChanged(y,b,_){var R;this._selectionState.start=y,this._selectionState.end=b,this._selectionState.columnSelectMode=_,(R=this._renderer.value)==null||R.handleSelectionChanged(y,b,_)}handleCursorMove(){var y;(y=this._renderer.value)==null||y.handleCursorMove()}clear(){var y;(y=this._renderer.value)==null||y.clear()}};a.RenderService=m=u([c(2,v.IOptionsService),c(3,g.ICharSizeService),c(4,v.IDecorationService),c(5,v.IBufferService),c(6,g.ICoreBrowserService),c(7,g.IThemeService)],m)},9312:function(o,a,l){var u=this&&this.__decorate||function(k,N,M,B){var A,j=arguments.length,D=j<3?N:B===null?B=Object.getOwnPropertyDescriptor(N,M):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(k,N,M,B);else for(var I=k.length-1;I>=0;I--)(A=k[I])&&(D=(j<3?A(D):j>3?A(N,M,D):A(N,M))||D);return j>3&&D&&Object.defineProperty(N,M,D),D},c=this&&this.__param||function(k,N){return function(M,B){N(M,B,k)}};Object.defineProperty(a,"__esModule",{value:!0}),a.SelectionService=void 0;const h=l(9806),g=l(9504),p=l(456),x=l(4725),w=l(8460),v=l(844),m=l(6114),y=l(4841),b=l(511),_=l(2585),R=" ",E=new RegExp(R,"g");let T=a.SelectionService=class extends v.Disposable{constructor(k,N,M,B,A,j,D,I,U){super(),this._element=k,this._screenElement=N,this._linkifier=M,this._bufferService=B,this._coreService=A,this._mouseService=j,this._optionsService=D,this._renderService=I,this._coreBrowserService=U,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new b.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new w.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new w.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new w.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new w.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=W=>this._handleMouseMove(W),this._mouseUpListener=W=>this._handleMouseUp(W),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((W=>this._handleTrim(W))),this.register(this._bufferService.buffers.onBufferActivate((W=>this._handleBufferActivate(W)))),this.enable(),this._model=new p.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,v.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const k=this._model.finalSelectionStart,N=this._model.finalSelectionEnd;return!(!k||!N||k[0]===N[0]&&k[1]===N[1])}get selectionText(){const k=this._model.finalSelectionStart,N=this._model.finalSelectionEnd;if(!k||!N)return"";const M=this._bufferService.buffer,B=[];if(this._activeSelectionMode===3){if(k[0]===N[0])return"";const A=k[0]<N[0]?k[0]:N[0],j=k[0]<N[0]?N[0]:k[0];for(let D=k[1];D<=N[1];D++){const I=M.translateBufferLineToString(D,!0,A,j);B.push(I)}}else{const A=k[1]===N[1]?N[0]:void 0;B.push(M.translateBufferLineToString(k[1],!0,k[0],A));for(let j=k[1]+1;j<=N[1]-1;j++){const D=M.lines.get(j),I=M.translateBufferLineToString(j,!0);D!=null&&D.isWrapped?B[B.length-1]+=I:B.push(I)}if(k[1]!==N[1]){const j=M.lines.get(N[1]),D=M.translateBufferLineToString(N[1],!0,0,N[0]);j&&j.isWrapped?B[B.length-1]+=D:B.push(D)}}return B.map((A=>A.replace(E," "))).join(m.isWindows?`\r
380
+ `:`
381
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(k){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),m.isLinux&&k&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(k){const N=this._getMouseBufferCoords(k),M=this._model.finalSelectionStart,B=this._model.finalSelectionEnd;return!!(M&&B&&N)&&this._areCoordsInSelection(N,M,B)}isCellInSelection(k,N){const M=this._model.finalSelectionStart,B=this._model.finalSelectionEnd;return!(!M||!B)&&this._areCoordsInSelection([k,N],M,B)}_areCoordsInSelection(k,N,M){return k[1]>N[1]&&k[1]<M[1]||N[1]===M[1]&&k[1]===N[1]&&k[0]>=N[0]&&k[0]<M[0]||N[1]<M[1]&&k[1]===M[1]&&k[0]<M[0]||N[1]<M[1]&&k[1]===N[1]&&k[0]>=N[0]}_selectWordAtCursor(k,N){var A,j;const M=(j=(A=this._linkifier.currentLink)==null?void 0:A.link)==null?void 0:j.range;if(M)return this._model.selectionStart=[M.start.x-1,M.start.y-1],this._model.selectionStartLength=(0,y.getRangeLength)(M,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const B=this._getMouseBufferCoords(k);return!!B&&(this._selectWordAt(B,N),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(k,N){this._model.clearSelection(),k=Math.max(k,0),N=Math.min(N,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,k],this._model.selectionEnd=[this._bufferService.cols,N],this.refresh(),this._onSelectionChange.fire()}_handleTrim(k){this._model.handleTrim(k)&&this.refresh()}_getMouseBufferCoords(k){const N=this._mouseService.getCoords(k,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(N)return N[0]--,N[1]--,N[1]+=this._bufferService.buffer.ydisp,N}_getMouseEventScrollAmount(k){let N=(0,h.getCoordsRelativeToElement)(this._coreBrowserService.window,k,this._screenElement)[1];const M=this._renderService.dimensions.css.canvas.height;return N>=0&&N<=M?0:(N>M&&(N-=M),N=Math.min(Math.max(N,-50),50),N/=50,N/Math.abs(N)+Math.round(14*N))}shouldForceSelection(k){return m.isMac?k.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:k.shiftKey}handleMouseDown(k){if(this._mouseDownTimeStamp=k.timeStamp,(k.button!==2||!this.hasSelection)&&k.button===0){if(!this._enabled){if(!this.shouldForceSelection(k))return;k.stopPropagation()}k.preventDefault(),this._dragScrollAmount=0,this._enabled&&k.shiftKey?this._handleIncrementalClick(k):k.detail===1?this._handleSingleClick(k):k.detail===2?this._handleDoubleClick(k):k.detail===3&&this._handleTripleClick(k),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval((()=>this._dragScroll()),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(k){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(k))}_handleSingleClick(k){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(k)?3:0,this._model.selectionStart=this._getMouseBufferCoords(k),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const N=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);N&&N.length!==this._model.selectionStart[0]&&N.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(k){this._selectWordAtCursor(k,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(k){const N=this._getMouseBufferCoords(k);N&&(this._activeSelectionMode=2,this._selectLineAt(N[1]))}shouldColumnSelect(k){return k.altKey&&!(m.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(k){if(k.stopImmediatePropagation(),!this._model.selectionStart)return;const N=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(k),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(k),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const M=this._bufferService.buffer;if(this._model.selectionEnd[1]<M.lines.length){const B=M.lines.get(this._model.selectionEnd[1]);B&&B.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}N&&N[0]===this._model.selectionEnd[0]&&N[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});const k=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(k.ydisp+this._bufferService.rows,k.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=k.ydisp),this.refresh()}}_handleMouseUp(k){const N=k.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&N<500&&k.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const M=this._mouseService.getCoords(k,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(M&&M[0]!==void 0&&M[1]!==void 0){const B=(0,g.moveToCellSequence)(M[0]-1,M[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(B,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const k=this._model.finalSelectionStart,N=this._model.finalSelectionEnd,M=!(!k||!N||k[0]===N[0]&&k[1]===N[1]);M?k&&N&&(this._oldSelectionStart&&this._oldSelectionEnd&&k[0]===this._oldSelectionStart[0]&&k[1]===this._oldSelectionStart[1]&&N[0]===this._oldSelectionEnd[0]&&N[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(k,N,M)):this._oldHasSelection&&this._fireOnSelectionChange(k,N,M)}_fireOnSelectionChange(k,N,M){this._oldSelectionStart=k,this._oldSelectionEnd=N,this._oldHasSelection=M,this._onSelectionChange.fire()}_handleBufferActivate(k){this.clearSelection(),this._trimListener.dispose(),this._trimListener=k.activeBuffer.lines.onTrim((N=>this._handleTrim(N)))}_convertViewportColToCharacterIndex(k,N){let M=N;for(let B=0;N>=B;B++){const A=k.loadCell(B,this._workCell).getChars().length;this._workCell.getWidth()===0?M--:A>1&&N!==B&&(M+=A-1)}return M}setSelection(k,N,M){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[k,N],this._model.selectionStartLength=M,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(k){this._isClickInSelection(k)||(this._selectWordAtCursor(k,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(k,N,M=!0,B=!0){if(k[0]>=this._bufferService.cols)return;const A=this._bufferService.buffer,j=A.lines.get(k[1]);if(!j)return;const D=A.translateBufferLineToString(k[1],!1);let I=this._convertViewportColToCharacterIndex(j,k[0]),U=I;const W=k[0]-I;let H=0,z=0,P=0,F=0;if(D.charAt(I)===" "){for(;I>0&&D.charAt(I-1)===" ";)I--;for(;U<D.length&&D.charAt(U+1)===" ";)U++}else{let ee=k[0],re=k[0];j.getWidth(ee)===0&&(H++,ee--),j.getWidth(re)===2&&(z++,re++);const ne=j.getString(re).length;for(ne>1&&(F+=ne-1,U+=ne-1);ee>0&&I>0&&!this._isCharWordSeparator(j.loadCell(ee-1,this._workCell));){j.loadCell(ee-1,this._workCell);const Y=this._workCell.getChars().length;this._workCell.getWidth()===0?(H++,ee--):Y>1&&(P+=Y-1,I-=Y-1),I--,ee--}for(;re<j.length&&U+1<D.length&&!this._isCharWordSeparator(j.loadCell(re+1,this._workCell));){j.loadCell(re+1,this._workCell);const Y=this._workCell.getChars().length;this._workCell.getWidth()===2?(z++,re++):Y>1&&(F+=Y-1,U+=Y-1),U++,re++}}U++;let G=I+W-H+P,$=Math.min(this._bufferService.cols,U-I+H+z-P-F);if(N||D.slice(I,U).trim()!==""){if(M&&G===0&&j.getCodePoint(0)!==32){const ee=A.lines.get(k[1]-1);if(ee&&j.isWrapped&&ee.getCodePoint(this._bufferService.cols-1)!==32){const re=this._getWordAt([this._bufferService.cols-1,k[1]-1],!1,!0,!1);if(re){const ne=this._bufferService.cols-re.start;G-=ne,$+=ne}}}if(B&&G+$===this._bufferService.cols&&j.getCodePoint(this._bufferService.cols-1)!==32){const ee=A.lines.get(k[1]+1);if(ee!=null&&ee.isWrapped&&ee.getCodePoint(0)!==32){const re=this._getWordAt([0,k[1]+1],!1,!1,!0);re&&($+=re.length)}}return{start:G,length:$}}}_selectWordAt(k,N){const M=this._getWordAt(k,N);if(M){for(;M.start<0;)M.start+=this._bufferService.cols,k[1]--;this._model.selectionStart=[M.start,k[1]],this._model.selectionStartLength=M.length}}_selectToWordAt(k){const N=this._getWordAt(k,!0);if(N){let M=k[1];for(;N.start<0;)N.start+=this._bufferService.cols,M--;if(!this._model.areSelectionValuesReversed())for(;N.start+N.length>this._bufferService.cols;)N.length-=this._bufferService.cols,M++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?N.start:N.start+N.length,M]}}_isCharWordSeparator(k){return k.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(k.getChars())>=0}_selectLineAt(k){const N=this._bufferService.buffer.getWrappedRangeForLine(k),M={start:{x:0,y:N.first},end:{x:this._bufferService.cols-1,y:N.last}};this._model.selectionStart=[0,N.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,y.getRangeLength)(M,this._bufferService.cols)}};a.SelectionService=T=u([c(3,_.IBufferService),c(4,_.ICoreService),c(5,x.IMouseService),c(6,_.IOptionsService),c(7,x.IRenderService),c(8,x.ICoreBrowserService)],T)},4725:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ILinkProviderService=a.IThemeService=a.ICharacterJoinerService=a.ISelectionService=a.IRenderService=a.IMouseService=a.ICoreBrowserService=a.ICharSizeService=void 0;const u=l(8343);a.ICharSizeService=(0,u.createDecorator)("CharSizeService"),a.ICoreBrowserService=(0,u.createDecorator)("CoreBrowserService"),a.IMouseService=(0,u.createDecorator)("MouseService"),a.IRenderService=(0,u.createDecorator)("RenderService"),a.ISelectionService=(0,u.createDecorator)("SelectionService"),a.ICharacterJoinerService=(0,u.createDecorator)("CharacterJoinerService"),a.IThemeService=(0,u.createDecorator)("ThemeService"),a.ILinkProviderService=(0,u.createDecorator)("LinkProviderService")},6731:function(o,a,l){var u=this&&this.__decorate||function(T,k,N,M){var B,A=arguments.length,j=A<3?k:M===null?M=Object.getOwnPropertyDescriptor(k,N):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(T,k,N,M);else for(var D=T.length-1;D>=0;D--)(B=T[D])&&(j=(A<3?B(j):A>3?B(k,N,j):B(k,N))||j);return A>3&&j&&Object.defineProperty(k,N,j),j},c=this&&this.__param||function(T,k){return function(N,M){k(N,M,T)}};Object.defineProperty(a,"__esModule",{value:!0}),a.ThemeService=a.DEFAULT_ANSI_COLORS=void 0;const h=l(7239),g=l(8055),p=l(8460),x=l(844),w=l(2585),v=g.css.toColor("#ffffff"),m=g.css.toColor("#000000"),y=g.css.toColor("#ffffff"),b=g.css.toColor("#000000"),_={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};a.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const T=[g.css.toColor("#2e3436"),g.css.toColor("#cc0000"),g.css.toColor("#4e9a06"),g.css.toColor("#c4a000"),g.css.toColor("#3465a4"),g.css.toColor("#75507b"),g.css.toColor("#06989a"),g.css.toColor("#d3d7cf"),g.css.toColor("#555753"),g.css.toColor("#ef2929"),g.css.toColor("#8ae234"),g.css.toColor("#fce94f"),g.css.toColor("#729fcf"),g.css.toColor("#ad7fa8"),g.css.toColor("#34e2e2"),g.css.toColor("#eeeeec")],k=[0,95,135,175,215,255];for(let N=0;N<216;N++){const M=k[N/36%6|0],B=k[N/6%6|0],A=k[N%6];T.push({css:g.channels.toCss(M,B,A),rgba:g.channels.toRgba(M,B,A)})}for(let N=0;N<24;N++){const M=8+10*N;T.push({css:g.channels.toCss(M,M,M),rgba:g.channels.toRgba(M,M,M)})}return T})());let R=a.ThemeService=class extends x.Disposable{get colors(){return this._colors}constructor(T){super(),this._optionsService=T,this._contrastCache=new h.ColorContrastCache,this._halfContrastCache=new h.ColorContrastCache,this._onChangeColors=this.register(new p.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:v,background:m,cursor:y,cursorAccent:b,selectionForeground:void 0,selectionBackgroundTransparent:_,selectionBackgroundOpaque:g.color.blend(m,_),selectionInactiveBackgroundTransparent:_,selectionInactiveBackgroundOpaque:g.color.blend(m,_),ansi:a.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",(()=>this._contrastCache.clear()))),this.register(this._optionsService.onSpecificOptionChange("theme",(()=>this._setTheme(this._optionsService.rawOptions.theme))))}_setTheme(T={}){const k=this._colors;if(k.foreground=E(T.foreground,v),k.background=E(T.background,m),k.cursor=E(T.cursor,y),k.cursorAccent=E(T.cursorAccent,b),k.selectionBackgroundTransparent=E(T.selectionBackground,_),k.selectionBackgroundOpaque=g.color.blend(k.background,k.selectionBackgroundTransparent),k.selectionInactiveBackgroundTransparent=E(T.selectionInactiveBackground,k.selectionBackgroundTransparent),k.selectionInactiveBackgroundOpaque=g.color.blend(k.background,k.selectionInactiveBackgroundTransparent),k.selectionForeground=T.selectionForeground?E(T.selectionForeground,g.NULL_COLOR):void 0,k.selectionForeground===g.NULL_COLOR&&(k.selectionForeground=void 0),g.color.isOpaque(k.selectionBackgroundTransparent)&&(k.selectionBackgroundTransparent=g.color.opacity(k.selectionBackgroundTransparent,.3)),g.color.isOpaque(k.selectionInactiveBackgroundTransparent)&&(k.selectionInactiveBackgroundTransparent=g.color.opacity(k.selectionInactiveBackgroundTransparent,.3)),k.ansi=a.DEFAULT_ANSI_COLORS.slice(),k.ansi[0]=E(T.black,a.DEFAULT_ANSI_COLORS[0]),k.ansi[1]=E(T.red,a.DEFAULT_ANSI_COLORS[1]),k.ansi[2]=E(T.green,a.DEFAULT_ANSI_COLORS[2]),k.ansi[3]=E(T.yellow,a.DEFAULT_ANSI_COLORS[3]),k.ansi[4]=E(T.blue,a.DEFAULT_ANSI_COLORS[4]),k.ansi[5]=E(T.magenta,a.DEFAULT_ANSI_COLORS[5]),k.ansi[6]=E(T.cyan,a.DEFAULT_ANSI_COLORS[6]),k.ansi[7]=E(T.white,a.DEFAULT_ANSI_COLORS[7]),k.ansi[8]=E(T.brightBlack,a.DEFAULT_ANSI_COLORS[8]),k.ansi[9]=E(T.brightRed,a.DEFAULT_ANSI_COLORS[9]),k.ansi[10]=E(T.brightGreen,a.DEFAULT_ANSI_COLORS[10]),k.ansi[11]=E(T.brightYellow,a.DEFAULT_ANSI_COLORS[11]),k.ansi[12]=E(T.brightBlue,a.DEFAULT_ANSI_COLORS[12]),k.ansi[13]=E(T.brightMagenta,a.DEFAULT_ANSI_COLORS[13]),k.ansi[14]=E(T.brightCyan,a.DEFAULT_ANSI_COLORS[14]),k.ansi[15]=E(T.brightWhite,a.DEFAULT_ANSI_COLORS[15]),T.extendedAnsi){const N=Math.min(k.ansi.length-16,T.extendedAnsi.length);for(let M=0;M<N;M++)k.ansi[M+16]=E(T.extendedAnsi[M],a.DEFAULT_ANSI_COLORS[M+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(T){this._restoreColor(T),this._onChangeColors.fire(this.colors)}_restoreColor(T){if(T!==void 0)switch(T){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[T]=this._restoreColors.ansi[T]}else for(let k=0;k<this._restoreColors.ansi.length;++k)this._colors.ansi[k]=this._restoreColors.ansi[k]}modifyColors(T){T(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function E(T,k){if(T!==void 0)try{return g.css.toColor(T)}catch{}return k}a.ThemeService=R=u([c(0,w.IOptionsService)],R)},6349:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CircularList=void 0;const u=l(8460),c=l(844);class h extends c.Disposable{constructor(p){super(),this._maxLength=p,this.onDeleteEmitter=this.register(new u.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new u.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new u.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(p){if(this._maxLength===p)return;const x=new Array(p);for(let w=0;w<Math.min(p,this.length);w++)x[w]=this._array[this._getCyclicIndex(w)];this._array=x,this._maxLength=p,this._startIndex=0}get length(){return this._length}set length(p){if(p>this._length)for(let x=this._length;x<p;x++)this._array[x]=void 0;this._length=p}get(p){return this._array[this._getCyclicIndex(p)]}set(p,x){this._array[this._getCyclicIndex(p)]=x}push(p){this._array[this._getCyclicIndex(this._length)]=p,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(p,x,...w){if(x){for(let v=p;v<this._length-x;v++)this._array[this._getCyclicIndex(v)]=this._array[this._getCyclicIndex(v+x)];this._length-=x,this.onDeleteEmitter.fire({index:p,amount:x})}for(let v=this._length-1;v>=p;v--)this._array[this._getCyclicIndex(v+w.length)]=this._array[this._getCyclicIndex(v)];for(let v=0;v<w.length;v++)this._array[this._getCyclicIndex(p+v)]=w[v];if(w.length&&this.onInsertEmitter.fire({index:p,amount:w.length}),this._length+w.length>this._maxLength){const v=this._length+w.length-this._maxLength;this._startIndex+=v,this._length=this._maxLength,this.onTrimEmitter.fire(v)}else this._length+=w.length}trimStart(p){p>this._length&&(p=this._length),this._startIndex+=p,this._length-=p,this.onTrimEmitter.fire(p)}shiftElements(p,x,w){if(!(x<=0)){if(p<0||p>=this._length)throw new Error("start argument out of range");if(p+w<0)throw new Error("Cannot shift elements in list beyond index 0");if(w>0){for(let m=x-1;m>=0;m--)this.set(p+m+w,this.get(p+m));const v=p+x+w-this._length;if(v>0)for(this._length+=v;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let v=0;v<x;v++)this.set(p+v+w,this.get(p+v))}}_getCyclicIndex(p){return(this._startIndex+p)%this._maxLength}}a.CircularList=h},1439:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.clone=void 0,a.clone=function l(u,c=5){if(typeof u!="object")return u;const h=Array.isArray(u)?[]:{};for(const g in u)h[g]=c<=1?u[g]:u[g]&&l(u[g],c-1);return h}},8055:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.contrastRatio=a.toPaddedHex=a.rgba=a.rgb=a.css=a.color=a.channels=a.NULL_COLOR=void 0;let l=0,u=0,c=0,h=0;var g,p,x,w,v;function m(b){const _=b.toString(16);return _.length<2?"0"+_:_}function y(b,_){return b<_?(_+.05)/(b+.05):(b+.05)/(_+.05)}a.NULL_COLOR={css:"#00000000",rgba:0},(function(b){b.toCss=function(_,R,E,T){return T!==void 0?`#${m(_)}${m(R)}${m(E)}${m(T)}`:`#${m(_)}${m(R)}${m(E)}`},b.toRgba=function(_,R,E,T=255){return(_<<24|R<<16|E<<8|T)>>>0},b.toColor=function(_,R,E,T){return{css:b.toCss(_,R,E,T),rgba:b.toRgba(_,R,E,T)}}})(g||(a.channels=g={})),(function(b){function _(R,E){return h=Math.round(255*E),[l,u,c]=v.toChannels(R.rgba),{css:g.toCss(l,u,c,h),rgba:g.toRgba(l,u,c,h)}}b.blend=function(R,E){if(h=(255&E.rgba)/255,h===1)return{css:E.css,rgba:E.rgba};const T=E.rgba>>24&255,k=E.rgba>>16&255,N=E.rgba>>8&255,M=R.rgba>>24&255,B=R.rgba>>16&255,A=R.rgba>>8&255;return l=M+Math.round((T-M)*h),u=B+Math.round((k-B)*h),c=A+Math.round((N-A)*h),{css:g.toCss(l,u,c),rgba:g.toRgba(l,u,c)}},b.isOpaque=function(R){return(255&R.rgba)==255},b.ensureContrastRatio=function(R,E,T){const k=v.ensureContrastRatio(R.rgba,E.rgba,T);if(k)return g.toColor(k>>24&255,k>>16&255,k>>8&255)},b.opaque=function(R){const E=(255|R.rgba)>>>0;return[l,u,c]=v.toChannels(E),{css:g.toCss(l,u,c),rgba:E}},b.opacity=_,b.multiplyOpacity=function(R,E){return h=255&R.rgba,_(R,h*E/255)},b.toColorRGB=function(R){return[R.rgba>>24&255,R.rgba>>16&255,R.rgba>>8&255]}})(p||(a.color=p={})),(function(b){let _,R;try{const E=document.createElement("canvas");E.width=1,E.height=1;const T=E.getContext("2d",{willReadFrequently:!0});T&&(_=T,_.globalCompositeOperation="copy",R=_.createLinearGradient(0,0,1,1))}catch{}b.toColor=function(E){if(E.match(/#[\da-f]{3,8}/i))switch(E.length){case 4:return l=parseInt(E.slice(1,2).repeat(2),16),u=parseInt(E.slice(2,3).repeat(2),16),c=parseInt(E.slice(3,4).repeat(2),16),g.toColor(l,u,c);case 5:return l=parseInt(E.slice(1,2).repeat(2),16),u=parseInt(E.slice(2,3).repeat(2),16),c=parseInt(E.slice(3,4).repeat(2),16),h=parseInt(E.slice(4,5).repeat(2),16),g.toColor(l,u,c,h);case 7:return{css:E,rgba:(parseInt(E.slice(1),16)<<8|255)>>>0};case 9:return{css:E,rgba:parseInt(E.slice(1),16)>>>0}}const T=E.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(T)return l=parseInt(T[1]),u=parseInt(T[2]),c=parseInt(T[3]),h=Math.round(255*(T[5]===void 0?1:parseFloat(T[5]))),g.toColor(l,u,c,h);if(!_||!R)throw new Error("css.toColor: Unsupported css format");if(_.fillStyle=R,_.fillStyle=E,typeof _.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(_.fillRect(0,0,1,1),[l,u,c,h]=_.getImageData(0,0,1,1).data,h!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:g.toRgba(l,u,c,h),css:E}}})(x||(a.css=x={})),(function(b){function _(R,E,T){const k=R/255,N=E/255,M=T/255;return .2126*(k<=.03928?k/12.92:Math.pow((k+.055)/1.055,2.4))+.7152*(N<=.03928?N/12.92:Math.pow((N+.055)/1.055,2.4))+.0722*(M<=.03928?M/12.92:Math.pow((M+.055)/1.055,2.4))}b.relativeLuminance=function(R){return _(R>>16&255,R>>8&255,255&R)},b.relativeLuminance2=_})(w||(a.rgb=w={})),(function(b){function _(E,T,k){const N=E>>24&255,M=E>>16&255,B=E>>8&255;let A=T>>24&255,j=T>>16&255,D=T>>8&255,I=y(w.relativeLuminance2(A,j,D),w.relativeLuminance2(N,M,B));for(;I<k&&(A>0||j>0||D>0);)A-=Math.max(0,Math.ceil(.1*A)),j-=Math.max(0,Math.ceil(.1*j)),D-=Math.max(0,Math.ceil(.1*D)),I=y(w.relativeLuminance2(A,j,D),w.relativeLuminance2(N,M,B));return(A<<24|j<<16|D<<8|255)>>>0}function R(E,T,k){const N=E>>24&255,M=E>>16&255,B=E>>8&255;let A=T>>24&255,j=T>>16&255,D=T>>8&255,I=y(w.relativeLuminance2(A,j,D),w.relativeLuminance2(N,M,B));for(;I<k&&(A<255||j<255||D<255);)A=Math.min(255,A+Math.ceil(.1*(255-A))),j=Math.min(255,j+Math.ceil(.1*(255-j))),D=Math.min(255,D+Math.ceil(.1*(255-D))),I=y(w.relativeLuminance2(A,j,D),w.relativeLuminance2(N,M,B));return(A<<24|j<<16|D<<8|255)>>>0}b.blend=function(E,T){if(h=(255&T)/255,h===1)return T;const k=T>>24&255,N=T>>16&255,M=T>>8&255,B=E>>24&255,A=E>>16&255,j=E>>8&255;return l=B+Math.round((k-B)*h),u=A+Math.round((N-A)*h),c=j+Math.round((M-j)*h),g.toRgba(l,u,c)},b.ensureContrastRatio=function(E,T,k){const N=w.relativeLuminance(E>>8),M=w.relativeLuminance(T>>8);if(y(N,M)<k){if(M<N){const j=_(E,T,k),D=y(N,w.relativeLuminance(j>>8));if(D<k){const I=R(E,T,k);return D>y(N,w.relativeLuminance(I>>8))?j:I}return j}const B=R(E,T,k),A=y(N,w.relativeLuminance(B>>8));if(A<k){const j=_(E,T,k);return A>y(N,w.relativeLuminance(j>>8))?B:j}return B}},b.reduceLuminance=_,b.increaseLuminance=R,b.toChannels=function(E){return[E>>24&255,E>>16&255,E>>8&255,255&E]}})(v||(a.rgba=v={})),a.toPaddedHex=m,a.contrastRatio=y},8969:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CoreTerminal=void 0;const u=l(844),c=l(2585),h=l(4348),g=l(7866),p=l(744),x=l(7302),w=l(6975),v=l(8460),m=l(1753),y=l(1480),b=l(7994),_=l(9282),R=l(5435),E=l(5981),T=l(2660);let k=!1;class N extends u.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new v.EventEmitter),this._onScroll.event((B=>{var A;(A=this._onScrollApi)==null||A.fire(B.position)}))),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(B){for(const A in B)this.optionsService.options[A]=B[A]}constructor(B){super(),this._windowsWrappingHeuristics=this.register(new u.MutableDisposable),this._onBinary=this.register(new v.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new v.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new v.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new v.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new v.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new v.EventEmitter),this._instantiationService=new h.InstantiationService,this.optionsService=this.register(new x.OptionsService(B)),this._instantiationService.setService(c.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(p.BufferService)),this._instantiationService.setService(c.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(g.LogService)),this._instantiationService.setService(c.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(w.CoreService)),this._instantiationService.setService(c.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(m.CoreMouseService)),this._instantiationService.setService(c.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(y.UnicodeService)),this._instantiationService.setService(c.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(b.CharsetService),this._instantiationService.setService(c.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(T.OscLinkService),this._instantiationService.setService(c.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new R.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,v.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,v.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,v.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,v.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((A=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((A=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new E.WriteBuffer(((A,j)=>this._inputHandler.parse(A,j)))),this.register((0,v.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(B,A){this._writeBuffer.write(B,A)}writeSync(B,A){this._logService.logLevel<=c.LogLevelEnum.WARN&&!k&&(this._logService.warn("writeSync is unreliable and will be removed soon."),k=!0),this._writeBuffer.writeSync(B,A)}input(B,A=!0){this.coreService.triggerDataEvent(B,A)}resize(B,A){isNaN(B)||isNaN(A)||(B=Math.max(B,p.MINIMUM_COLS),A=Math.max(A,p.MINIMUM_ROWS),this._bufferService.resize(B,A))}scroll(B,A=!1){this._bufferService.scroll(B,A)}scrollLines(B,A,j){this._bufferService.scrollLines(B,A,j)}scrollPages(B){this.scrollLines(B*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(B){const A=B-this._bufferService.buffer.ydisp;A!==0&&this.scrollLines(A)}registerEscHandler(B,A){return this._inputHandler.registerEscHandler(B,A)}registerDcsHandler(B,A){return this._inputHandler.registerDcsHandler(B,A)}registerCsiHandler(B,A){return this._inputHandler.registerCsiHandler(B,A)}registerOscHandler(B,A){return this._inputHandler.registerOscHandler(B,A)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let B=!1;const A=this.optionsService.rawOptions.windowsPty;A&&A.buildNumber!==void 0&&A.buildNumber!==void 0?B=A.backend==="conpty"&&A.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(B=!0),B?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const B=[];B.push(this.onLineFeed(_.updateWindowsModeWrappedState.bind(null,this._bufferService))),B.push(this.registerCsiHandler({final:"H"},(()=>((0,_.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,u.toDisposable)((()=>{for(const A of B)A.dispose()}))}}}a.CoreTerminal=N},8460:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.runAndSubscribe=a.forwardEvent=a.EventEmitter=void 0,a.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=l=>(this._listeners.push(l),{dispose:()=>{if(!this._disposed){for(let u=0;u<this._listeners.length;u++)if(this._listeners[u]===l)return void this._listeners.splice(u,1)}}})),this._event}fire(l,u){const c=[];for(let h=0;h<this._listeners.length;h++)c.push(this._listeners[h]);for(let h=0;h<c.length;h++)c[h].call(void 0,l,u)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},a.forwardEvent=function(l,u){return l((c=>u.fire(c)))},a.runAndSubscribe=function(l,u){return u(void 0),l((c=>u(c)))}},5435:function(o,a,l){var u=this&&this.__decorate||function(H,z,P,F){var G,$=arguments.length,ee=$<3?z:F===null?F=Object.getOwnPropertyDescriptor(z,P):F;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")ee=Reflect.decorate(H,z,P,F);else for(var re=H.length-1;re>=0;re--)(G=H[re])&&(ee=($<3?G(ee):$>3?G(z,P,ee):G(z,P))||ee);return $>3&&ee&&Object.defineProperty(z,P,ee),ee},c=this&&this.__param||function(H,z){return function(P,F){z(P,F,H)}};Object.defineProperty(a,"__esModule",{value:!0}),a.InputHandler=a.WindowsOptionsReportType=void 0;const h=l(2584),g=l(7116),p=l(2015),x=l(844),w=l(482),v=l(8437),m=l(8460),y=l(643),b=l(511),_=l(3734),R=l(2585),E=l(1480),T=l(6242),k=l(6351),N=l(5941),M={"(":0,")":1,"*":2,"+":3,"-":1,".":2},B=131072;function A(H,z){if(H>24)return z.setWinLines||!1;switch(H){case 1:return!!z.restoreWin;case 2:return!!z.minimizeWin;case 3:return!!z.setWinPosition;case 4:return!!z.setWinSizePixels;case 5:return!!z.raiseWin;case 6:return!!z.lowerWin;case 7:return!!z.refreshWin;case 8:return!!z.setWinSizeChars;case 9:return!!z.maximizeWin;case 10:return!!z.fullscreenWin;case 11:return!!z.getWinState;case 13:return!!z.getWinPosition;case 14:return!!z.getWinSizePixels;case 15:return!!z.getScreenSizePixels;case 16:return!!z.getCellSizePixels;case 18:return!!z.getWinSizeChars;case 19:return!!z.getScreenSizeChars;case 20:return!!z.getIconTitle;case 21:return!!z.getWinTitle;case 22:return!!z.pushTitle;case 23:return!!z.popTitle;case 24:return!!z.setWinLines}return!1}var j;(function(H){H[H.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",H[H.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(j||(a.WindowsOptionsReportType=j={}));let D=0;class I extends x.Disposable{getAttrData(){return this._curAttrData}constructor(z,P,F,G,$,ee,re,ne,Y=new p.EscapeSequenceParser){super(),this._bufferService=z,this._charsetService=P,this._coreService=F,this._logService=G,this._optionsService=$,this._oscLinkService=ee,this._coreMouseService=re,this._unicodeService=ne,this._parser=Y,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new w.StringToUtf32,this._utf8Decoder=new w.Utf8ToUtf32,this._workCell=new b.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=v.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=v.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new m.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new m.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new m.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new m.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new m.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new m.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new m.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new m.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new m.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new m.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new m.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new m.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new m.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new U(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((q=>this._activeBuffer=q.activeBuffer))),this._parser.setCsiHandlerFallback(((q,K)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(q),params:K.toArray()})})),this._parser.setEscHandlerFallback((q=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(q)})})),this._parser.setExecuteHandlerFallback((q=>{this._logService.debug("Unknown EXECUTE code: ",{code:q})})),this._parser.setOscHandlerFallback(((q,K,X)=>{this._logService.debug("Unknown OSC code: ",{identifier:q,action:K,data:X})})),this._parser.setDcsHandlerFallback(((q,K,X)=>{K==="HOOK"&&(X=X.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(q),action:K,payload:X})})),this._parser.setPrintHandler(((q,K,X)=>this.print(q,K,X))),this._parser.registerCsiHandler({final:"@"},(q=>this.insertChars(q))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(q=>this.scrollLeft(q))),this._parser.registerCsiHandler({final:"A"},(q=>this.cursorUp(q))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(q=>this.scrollRight(q))),this._parser.registerCsiHandler({final:"B"},(q=>this.cursorDown(q))),this._parser.registerCsiHandler({final:"C"},(q=>this.cursorForward(q))),this._parser.registerCsiHandler({final:"D"},(q=>this.cursorBackward(q))),this._parser.registerCsiHandler({final:"E"},(q=>this.cursorNextLine(q))),this._parser.registerCsiHandler({final:"F"},(q=>this.cursorPrecedingLine(q))),this._parser.registerCsiHandler({final:"G"},(q=>this.cursorCharAbsolute(q))),this._parser.registerCsiHandler({final:"H"},(q=>this.cursorPosition(q))),this._parser.registerCsiHandler({final:"I"},(q=>this.cursorForwardTab(q))),this._parser.registerCsiHandler({final:"J"},(q=>this.eraseInDisplay(q,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(q=>this.eraseInDisplay(q,!0))),this._parser.registerCsiHandler({final:"K"},(q=>this.eraseInLine(q,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(q=>this.eraseInLine(q,!0))),this._parser.registerCsiHandler({final:"L"},(q=>this.insertLines(q))),this._parser.registerCsiHandler({final:"M"},(q=>this.deleteLines(q))),this._parser.registerCsiHandler({final:"P"},(q=>this.deleteChars(q))),this._parser.registerCsiHandler({final:"S"},(q=>this.scrollUp(q))),this._parser.registerCsiHandler({final:"T"},(q=>this.scrollDown(q))),this._parser.registerCsiHandler({final:"X"},(q=>this.eraseChars(q))),this._parser.registerCsiHandler({final:"Z"},(q=>this.cursorBackwardTab(q))),this._parser.registerCsiHandler({final:"`"},(q=>this.charPosAbsolute(q))),this._parser.registerCsiHandler({final:"a"},(q=>this.hPositionRelative(q))),this._parser.registerCsiHandler({final:"b"},(q=>this.repeatPrecedingCharacter(q))),this._parser.registerCsiHandler({final:"c"},(q=>this.sendDeviceAttributesPrimary(q))),this._parser.registerCsiHandler({prefix:">",final:"c"},(q=>this.sendDeviceAttributesSecondary(q))),this._parser.registerCsiHandler({final:"d"},(q=>this.linePosAbsolute(q))),this._parser.registerCsiHandler({final:"e"},(q=>this.vPositionRelative(q))),this._parser.registerCsiHandler({final:"f"},(q=>this.hVPosition(q))),this._parser.registerCsiHandler({final:"g"},(q=>this.tabClear(q))),this._parser.registerCsiHandler({final:"h"},(q=>this.setMode(q))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(q=>this.setModePrivate(q))),this._parser.registerCsiHandler({final:"l"},(q=>this.resetMode(q))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(q=>this.resetModePrivate(q))),this._parser.registerCsiHandler({final:"m"},(q=>this.charAttributes(q))),this._parser.registerCsiHandler({final:"n"},(q=>this.deviceStatus(q))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(q=>this.deviceStatusPrivate(q))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(q=>this.softReset(q))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(q=>this.setCursorStyle(q))),this._parser.registerCsiHandler({final:"r"},(q=>this.setScrollRegion(q))),this._parser.registerCsiHandler({final:"s"},(q=>this.saveCursor(q))),this._parser.registerCsiHandler({final:"t"},(q=>this.windowOptions(q))),this._parser.registerCsiHandler({final:"u"},(q=>this.restoreCursor(q))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(q=>this.insertColumns(q))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(q=>this.deleteColumns(q))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(q=>this.selectProtected(q))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(q=>this.requestMode(q,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(q=>this.requestMode(q,!1))),this._parser.setExecuteHandler(h.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(h.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(h.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(h.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(h.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(h.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(h.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(h.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(h.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(h.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(h.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(h.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new T.OscHandler((q=>(this.setTitle(q),this.setIconName(q),!0)))),this._parser.registerOscHandler(1,new T.OscHandler((q=>this.setIconName(q)))),this._parser.registerOscHandler(2,new T.OscHandler((q=>this.setTitle(q)))),this._parser.registerOscHandler(4,new T.OscHandler((q=>this.setOrReportIndexedColor(q)))),this._parser.registerOscHandler(8,new T.OscHandler((q=>this.setHyperlink(q)))),this._parser.registerOscHandler(10,new T.OscHandler((q=>this.setOrReportFgColor(q)))),this._parser.registerOscHandler(11,new T.OscHandler((q=>this.setOrReportBgColor(q)))),this._parser.registerOscHandler(12,new T.OscHandler((q=>this.setOrReportCursorColor(q)))),this._parser.registerOscHandler(104,new T.OscHandler((q=>this.restoreIndexedColor(q)))),this._parser.registerOscHandler(110,new T.OscHandler((q=>this.restoreFgColor(q)))),this._parser.registerOscHandler(111,new T.OscHandler((q=>this.restoreBgColor(q)))),this._parser.registerOscHandler(112,new T.OscHandler((q=>this.restoreCursorColor(q)))),this._parser.registerEscHandler({final:"7"},(()=>this.saveCursor())),this._parser.registerEscHandler({final:"8"},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:"D"},(()=>this.index())),this._parser.registerEscHandler({final:"E"},(()=>this.nextLine())),this._parser.registerEscHandler({final:"H"},(()=>this.tabSet())),this._parser.registerEscHandler({final:"M"},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:"="},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:">"},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:"c"},(()=>this.fullReset())),this._parser.registerEscHandler({final:"n"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"o"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"|"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"}"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"~"},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:"%",final:"@"},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:"%",final:"G"},(()=>this.selectDefaultCharset()));for(const q in g.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:q},(()=>this.selectCharset("("+q))),this._parser.registerEscHandler({intermediates:")",final:q},(()=>this.selectCharset(")"+q))),this._parser.registerEscHandler({intermediates:"*",final:q},(()=>this.selectCharset("*"+q))),this._parser.registerEscHandler({intermediates:"+",final:q},(()=>this.selectCharset("+"+q))),this._parser.registerEscHandler({intermediates:"-",final:q},(()=>this.selectCharset("-"+q))),this._parser.registerEscHandler({intermediates:".",final:q},(()=>this.selectCharset("."+q))),this._parser.registerEscHandler({intermediates:"/",final:q},(()=>this.selectCharset("/"+q)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((q=>(this._logService.error("Parsing error: ",q),q))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new k.DcsHandler(((q,K)=>this.requestStatusString(q,K))))}_preserveStack(z,P,F,G){this._parseStack.paused=!0,this._parseStack.cursorStartX=z,this._parseStack.cursorStartY=P,this._parseStack.decodedLength=F,this._parseStack.position=G}_logSlowResolvingAsync(z){this._logService.logLevel<=R.LogLevelEnum.WARN&&Promise.race([z,new Promise(((P,F)=>setTimeout((()=>F("#SLOW_TIMEOUT")),5e3)))]).catch((P=>{if(P!=="#SLOW_TIMEOUT")throw P;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(z,P){let F,G=this._activeBuffer.x,$=this._activeBuffer.y,ee=0;const re=this._parseStack.paused;if(re){if(F=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,P))return this._logSlowResolvingAsync(F),F;G=this._parseStack.cursorStartX,$=this._parseStack.cursorStartY,this._parseStack.paused=!1,z.length>B&&(ee=this._parseStack.position+B)}if(this._logService.logLevel<=R.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof z=="string"?` "${z}"`:` "${Array.prototype.map.call(z,(q=>String.fromCharCode(q))).join("")}"`),typeof z=="string"?z.split("").map((q=>q.charCodeAt(0))):z),this._parseBuffer.length<z.length&&this._parseBuffer.length<B&&(this._parseBuffer=new Uint32Array(Math.min(z.length,B))),re||this._dirtyRowTracker.clearRange(),z.length>B)for(let q=ee;q<z.length;q+=B){const K=q+B<z.length?q+B:z.length,X=typeof z=="string"?this._stringDecoder.decode(z.substring(q,K),this._parseBuffer):this._utf8Decoder.decode(z.subarray(q,K),this._parseBuffer);if(F=this._parser.parse(this._parseBuffer,X))return this._preserveStack(G,$,X,q),this._logSlowResolvingAsync(F),F}else if(!re){const q=typeof z=="string"?this._stringDecoder.decode(z,this._parseBuffer):this._utf8Decoder.decode(z,this._parseBuffer);if(F=this._parser.parse(this._parseBuffer,q))return this._preserveStack(G,$,q,0),this._logSlowResolvingAsync(F),F}this._activeBuffer.x===G&&this._activeBuffer.y===$||this._onCursorMove.fire();const ne=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),Y=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);Y<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(Y,this._bufferService.rows-1),Math.min(ne,this._bufferService.rows-1))}print(z,P,F){let G,$;const ee=this._charsetService.charset,re=this._optionsService.rawOptions.screenReaderMode,ne=this._bufferService.cols,Y=this._coreService.decPrivateModes.wraparound,q=this._coreService.modes.insertMode,K=this._curAttrData;let X=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&F-P>0&&X.getWidth(this._activeBuffer.x-1)===2&&X.setCellFromCodepoint(this._activeBuffer.x-1,0,1,K);let J=this._parser.precedingJoinState;for(let ie=P;ie<F;++ie){if(G=z[ie],G<127&&ee){const je=ee[String.fromCharCode(G)];je&&(G=je.charCodeAt(0))}const ce=this._unicodeService.charProperties(G,J);$=E.UnicodeService.extractWidth(ce);const de=E.UnicodeService.extractShouldJoin(ce),Le=de?E.UnicodeService.extractWidth(J):0;if(J=ce,re&&this._onA11yChar.fire((0,w.stringFromCodePoint)(G)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+$-Le>ne){if(Y){const je=X;let _e=this._activeBuffer.x-Le;for(this._activeBuffer.x=Le,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),X=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),Le>0&&X instanceof v.BufferLine&&X.copyCellsFrom(je,_e,0,Le,!1);_e<ne;)je.setCellFromCodepoint(_e++,0,1,K)}else if(this._activeBuffer.x=ne-1,$===2)continue}if(de&&this._activeBuffer.x){const je=X.getWidth(this._activeBuffer.x-1)?1:2;X.addCodepointToCell(this._activeBuffer.x-je,G,$);for(let _e=$-Le;--_e>=0;)X.setCellFromCodepoint(this._activeBuffer.x++,0,0,K)}else if(q&&(X.insertCells(this._activeBuffer.x,$-Le,this._activeBuffer.getNullCell(K)),X.getWidth(ne-1)===2&&X.setCellFromCodepoint(ne-1,y.NULL_CELL_CODE,y.NULL_CELL_WIDTH,K)),X.setCellFromCodepoint(this._activeBuffer.x++,G,$,K),$>0)for(;--$;)X.setCellFromCodepoint(this._activeBuffer.x++,0,0,K)}this._parser.precedingJoinState=J,this._activeBuffer.x<ne&&F-P>0&&X.getWidth(this._activeBuffer.x)===0&&!X.hasContent(this._activeBuffer.x)&&X.setCellFromCodepoint(this._activeBuffer.x,0,1,K),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(z,P){return z.final!=="t"||z.prefix||z.intermediates?this._parser.registerCsiHandler(z,P):this._parser.registerCsiHandler(z,(F=>!A(F.params[0],this._optionsService.rawOptions.windowOptions)||P(F)))}registerDcsHandler(z,P){return this._parser.registerDcsHandler(z,new k.DcsHandler(P))}registerEscHandler(z,P){return this._parser.registerEscHandler(z,P)}registerOscHandler(z,P){return this._parser.registerOscHandler(z,new T.OscHandler(P))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var z;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((z=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&z.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);P.hasWidth(this._activeBuffer.x)&&!P.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const z=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-z),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(z=this._bufferService.cols-1){this._activeBuffer.x=Math.min(z,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(z,P){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=z,this._activeBuffer.y=this._activeBuffer.scrollTop+P):(this._activeBuffer.x=z,this._activeBuffer.y=P),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(z,P){this._restrictCursor(),this._setCursor(this._activeBuffer.x+z,this._activeBuffer.y+P)}cursorUp(z){const P=this._activeBuffer.y-this._activeBuffer.scrollTop;return P>=0?this._moveCursor(0,-Math.min(P,z.params[0]||1)):this._moveCursor(0,-(z.params[0]||1)),!0}cursorDown(z){const P=this._activeBuffer.scrollBottom-this._activeBuffer.y;return P>=0?this._moveCursor(0,Math.min(P,z.params[0]||1)):this._moveCursor(0,z.params[0]||1),!0}cursorForward(z){return this._moveCursor(z.params[0]||1,0),!0}cursorBackward(z){return this._moveCursor(-(z.params[0]||1),0),!0}cursorNextLine(z){return this.cursorDown(z),this._activeBuffer.x=0,!0}cursorPrecedingLine(z){return this.cursorUp(z),this._activeBuffer.x=0,!0}cursorCharAbsolute(z){return this._setCursor((z.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(z){return this._setCursor(z.length>=2?(z.params[1]||1)-1:0,(z.params[0]||1)-1),!0}charPosAbsolute(z){return this._setCursor((z.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(z){return this._moveCursor(z.params[0]||1,0),!0}linePosAbsolute(z){return this._setCursor(this._activeBuffer.x,(z.params[0]||1)-1),!0}vPositionRelative(z){return this._moveCursor(0,z.params[0]||1),!0}hVPosition(z){return this.cursorPosition(z),!0}tabClear(z){const P=z.params[0];return P===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:P===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(z){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let P=z.params[0]||1;for(;P--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(z){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let P=z.params[0]||1;for(;P--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(z){const P=z.params[0];return P===1&&(this._curAttrData.bg|=536870912),P!==2&&P!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(z,P,F,G=!1,$=!1){const ee=this._activeBuffer.lines.get(this._activeBuffer.ybase+z);ee.replaceCells(P,F,this._activeBuffer.getNullCell(this._eraseAttrData()),$),G&&(ee.isWrapped=!1)}_resetBufferLine(z,P=!1){const F=this._activeBuffer.lines.get(this._activeBuffer.ybase+z);F&&(F.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),P),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+z),F.isWrapped=!1)}eraseInDisplay(z,P=!1){let F;switch(this._restrictCursor(this._bufferService.cols),z.params[0]){case 0:for(F=this._activeBuffer.y,this._dirtyRowTracker.markDirty(F),this._eraseInBufferLine(F++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,P);F<this._bufferService.rows;F++)this._resetBufferLine(F,P);this._dirtyRowTracker.markDirty(F);break;case 1:for(F=this._activeBuffer.y,this._dirtyRowTracker.markDirty(F),this._eraseInBufferLine(F,0,this._activeBuffer.x+1,!0,P),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(F+1).isWrapped=!1);F--;)this._resetBufferLine(F,P);this._dirtyRowTracker.markDirty(0);break;case 2:for(F=this._bufferService.rows,this._dirtyRowTracker.markDirty(F-1);F--;)this._resetBufferLine(F,P);this._dirtyRowTracker.markDirty(0);break;case 3:const G=this._activeBuffer.lines.length-this._bufferService.rows;G>0&&(this._activeBuffer.lines.trimStart(G),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-G,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-G,0),this._onScroll.fire(0))}return!0}eraseInLine(z,P=!1){switch(this._restrictCursor(this._bufferService.cols),z.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,P);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,P);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,P)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(z){this._restrictCursor();let P=z.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const F=this._activeBuffer.ybase+this._activeBuffer.y,G=this._bufferService.rows-1-this._activeBuffer.scrollBottom,$=this._bufferService.rows-1+this._activeBuffer.ybase-G+1;for(;P--;)this._activeBuffer.lines.splice($-1,1),this._activeBuffer.lines.splice(F,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(z){this._restrictCursor();let P=z.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const F=this._activeBuffer.ybase+this._activeBuffer.y;let G;for(G=this._bufferService.rows-1-this._activeBuffer.scrollBottom,G=this._bufferService.rows-1+this._activeBuffer.ybase-G;P--;)this._activeBuffer.lines.splice(F,1),this._activeBuffer.lines.splice(G,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(z){this._restrictCursor();const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return P&&(P.insertCells(this._activeBuffer.x,z.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(z){this._restrictCursor();const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return P&&(P.deleteCells(this._activeBuffer.x,z.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(z){let P=z.params[0]||1;for(;P--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(z){let P=z.params[0]||1;for(;P--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(v.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(z){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=z.params[0]||1;for(let F=this._activeBuffer.scrollTop;F<=this._activeBuffer.scrollBottom;++F){const G=this._activeBuffer.lines.get(this._activeBuffer.ybase+F);G.deleteCells(0,P,this._activeBuffer.getNullCell(this._eraseAttrData())),G.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(z){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=z.params[0]||1;for(let F=this._activeBuffer.scrollTop;F<=this._activeBuffer.scrollBottom;++F){const G=this._activeBuffer.lines.get(this._activeBuffer.ybase+F);G.insertCells(0,P,this._activeBuffer.getNullCell(this._eraseAttrData())),G.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(z){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=z.params[0]||1;for(let F=this._activeBuffer.scrollTop;F<=this._activeBuffer.scrollBottom;++F){const G=this._activeBuffer.lines.get(this._activeBuffer.ybase+F);G.insertCells(this._activeBuffer.x,P,this._activeBuffer.getNullCell(this._eraseAttrData())),G.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(z){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=z.params[0]||1;for(let F=this._activeBuffer.scrollTop;F<=this._activeBuffer.scrollBottom;++F){const G=this._activeBuffer.lines.get(this._activeBuffer.ybase+F);G.deleteCells(this._activeBuffer.x,P,this._activeBuffer.getNullCell(this._eraseAttrData())),G.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(z){this._restrictCursor();const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return P&&(P.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(z.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(z){const P=this._parser.precedingJoinState;if(!P)return!0;const F=z.params[0]||1,G=E.UnicodeService.extractWidth(P),$=this._activeBuffer.x-G,ee=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString($),re=new Uint32Array(ee.length*F);let ne=0;for(let q=0;q<ee.length;){const K=ee.codePointAt(q)||0;re[ne++]=K,q+=K>65535?2:1}let Y=ne;for(let q=1;q<F;++q)re.copyWithin(Y,0,ne),Y+=ne;return this.print(re,0,Y),!0}sendDeviceAttributesPrimary(z){return z.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(h.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(h.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(z){return z.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(h.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(h.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(z.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(h.C0.ESC+"[>83;40003;0c")),!0}_is(z){return(this._optionsService.rawOptions.termName+"").indexOf(z)===0}setMode(z){for(let P=0;P<z.length;P++)switch(z.params[P]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(z){for(let P=0;P<z.length;P++)switch(z.params[P]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,g.DEFAULT_CHARSET),this._charsetService.setgCharset(1,g.DEFAULT_CHARSET),this._charsetService.setgCharset(2,g.DEFAULT_CHARSET),this._charsetService.setgCharset(3,g.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(z){for(let P=0;P<z.length;P++)switch(z.params[P]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(z){for(let P=0;P<z.length;P++)switch(z.params[P]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),z.params[P]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(z,P){const F=this._coreService.decPrivateModes,{activeProtocol:G,activeEncoding:$}=this._coreMouseService,ee=this._coreService,{buffers:re,cols:ne}=this._bufferService,{active:Y,alt:q}=re,K=this._optionsService.rawOptions,X=de=>de?1:2,J=z.params[0];return ie=J,ce=P?J===2?4:J===4?X(ee.modes.insertMode):J===12?3:J===20?X(K.convertEol):0:J===1?X(F.applicationCursorKeys):J===3?K.windowOptions.setWinLines?ne===80?2:ne===132?1:0:0:J===6?X(F.origin):J===7?X(F.wraparound):J===8?3:J===9?X(G==="X10"):J===12?X(K.cursorBlink):J===25?X(!ee.isCursorHidden):J===45?X(F.reverseWraparound):J===66?X(F.applicationKeypad):J===67?4:J===1e3?X(G==="VT200"):J===1002?X(G==="DRAG"):J===1003?X(G==="ANY"):J===1004?X(F.sendFocus):J===1005?4:J===1006?X($==="SGR"):J===1015?4:J===1016?X($==="SGR_PIXELS"):J===1048?1:J===47||J===1047||J===1049?X(Y===q):J===2004?X(F.bracketedPasteMode):0,ee.triggerDataEvent(`${h.C0.ESC}[${P?"":"?"}${ie};${ce}$y`),!0;var ie,ce}_updateAttrColor(z,P,F,G,$){return P===2?(z|=50331648,z&=-16777216,z|=_.AttributeData.fromColorRGB([F,G,$])):P===5&&(z&=-50331904,z|=33554432|255&F),z}_extractColor(z,P,F){const G=[0,0,-1,0,0,0];let $=0,ee=0;do{if(G[ee+$]=z.params[P+ee],z.hasSubParams(P+ee)){const re=z.getSubParams(P+ee);let ne=0;do G[1]===5&&($=1),G[ee+ne+1+$]=re[ne];while(++ne<re.length&&ne+ee+1+$<G.length);break}if(G[1]===5&&ee+$>=2||G[1]===2&&ee+$>=5)break;G[1]&&($=1)}while(++ee+P<z.length&&ee+$<G.length);for(let re=2;re<G.length;++re)G[re]===-1&&(G[re]=0);switch(G[0]){case 38:F.fg=this._updateAttrColor(F.fg,G[1],G[3],G[4],G[5]);break;case 48:F.bg=this._updateAttrColor(F.bg,G[1],G[3],G[4],G[5]);break;case 58:F.extended=F.extended.clone(),F.extended.underlineColor=this._updateAttrColor(F.extended.underlineColor,G[1],G[3],G[4],G[5])}return ee}_processUnderline(z,P){P.extended=P.extended.clone(),(!~z||z>5)&&(z=1),P.extended.underlineStyle=z,P.fg|=268435456,z===0&&(P.fg&=-268435457),P.updateExtended()}_processSGR0(z){z.fg=v.DEFAULT_ATTR_DATA.fg,z.bg=v.DEFAULT_ATTR_DATA.bg,z.extended=z.extended.clone(),z.extended.underlineStyle=0,z.extended.underlineColor&=-67108864,z.updateExtended()}charAttributes(z){if(z.length===1&&z.params[0]===0)return this._processSGR0(this._curAttrData),!0;const P=z.length;let F;const G=this._curAttrData;for(let $=0;$<P;$++)F=z.params[$],F>=30&&F<=37?(G.fg&=-50331904,G.fg|=16777216|F-30):F>=40&&F<=47?(G.bg&=-50331904,G.bg|=16777216|F-40):F>=90&&F<=97?(G.fg&=-50331904,G.fg|=16777224|F-90):F>=100&&F<=107?(G.bg&=-50331904,G.bg|=16777224|F-100):F===0?this._processSGR0(G):F===1?G.fg|=134217728:F===3?G.bg|=67108864:F===4?(G.fg|=268435456,this._processUnderline(z.hasSubParams($)?z.getSubParams($)[0]:1,G)):F===5?G.fg|=536870912:F===7?G.fg|=67108864:F===8?G.fg|=1073741824:F===9?G.fg|=2147483648:F===2?G.bg|=134217728:F===21?this._processUnderline(2,G):F===22?(G.fg&=-134217729,G.bg&=-134217729):F===23?G.bg&=-67108865:F===24?(G.fg&=-268435457,this._processUnderline(0,G)):F===25?G.fg&=-536870913:F===27?G.fg&=-67108865:F===28?G.fg&=-1073741825:F===29?G.fg&=2147483647:F===39?(G.fg&=-67108864,G.fg|=16777215&v.DEFAULT_ATTR_DATA.fg):F===49?(G.bg&=-67108864,G.bg|=16777215&v.DEFAULT_ATTR_DATA.bg):F===38||F===48||F===58?$+=this._extractColor(z,$,G):F===53?G.bg|=1073741824:F===55?G.bg&=-1073741825:F===59?(G.extended=G.extended.clone(),G.extended.underlineColor=-1,G.updateExtended()):F===100?(G.fg&=-67108864,G.fg|=16777215&v.DEFAULT_ATTR_DATA.fg,G.bg&=-67108864,G.bg|=16777215&v.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",F);return!0}deviceStatus(z){switch(z.params[0]){case 5:this._coreService.triggerDataEvent(`${h.C0.ESC}[0n`);break;case 6:const P=this._activeBuffer.y+1,F=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${h.C0.ESC}[${P};${F}R`)}return!0}deviceStatusPrivate(z){if(z.params[0]===6){const P=this._activeBuffer.y+1,F=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${h.C0.ESC}[?${P};${F}R`)}return!0}softReset(z){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=v.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(z){const P=z.params[0]||1;switch(P){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const F=P%2==1;return this._optionsService.options.cursorBlink=F,!0}setScrollRegion(z){const P=z.params[0]||1;let F;return(z.length<2||(F=z.params[1])>this._bufferService.rows||F===0)&&(F=this._bufferService.rows),F>P&&(this._activeBuffer.scrollTop=P-1,this._activeBuffer.scrollBottom=F-1,this._setCursor(0,0)),!0}windowOptions(z){if(!A(z.params[0],this._optionsService.rawOptions.windowOptions))return!0;const P=z.length>1?z.params[1]:0;switch(z.params[0]){case 14:P!==2&&this._onRequestWindowsOptionsReport.fire(j.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(j.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${h.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:P!==0&&P!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),P!==0&&P!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:P!==0&&P!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),P!==0&&P!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(z){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(z){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(z){return this._windowTitle=z,this._onTitleChange.fire(z),!0}setIconName(z){return this._iconName=z,!0}setOrReportIndexedColor(z){const P=[],F=z.split(";");for(;F.length>1;){const G=F.shift(),$=F.shift();if(/^\d+$/.exec(G)){const ee=parseInt(G);if(W(ee))if($==="?")P.push({type:0,index:ee});else{const re=(0,N.parseColor)($);re&&P.push({type:1,index:ee,color:re})}}}return P.length&&this._onColor.fire(P),!0}setHyperlink(z){const P=z.split(";");return!(P.length<2)&&(P[1]?this._createHyperlink(P[0],P[1]):!P[0]&&this._finishHyperlink())}_createHyperlink(z,P){this._getCurrentLinkId()&&this._finishHyperlink();const F=z.split(":");let G;const $=F.findIndex((ee=>ee.startsWith("id=")));return $!==-1&&(G=F[$].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:G,uri:P}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(z,P){const F=z.split(";");for(let G=0;G<F.length&&!(P>=this._specialColors.length);++G,++P)if(F[G]==="?")this._onColor.fire([{type:0,index:this._specialColors[P]}]);else{const $=(0,N.parseColor)(F[G]);$&&this._onColor.fire([{type:1,index:this._specialColors[P],color:$}])}return!0}setOrReportFgColor(z){return this._setOrReportSpecialColor(z,0)}setOrReportBgColor(z){return this._setOrReportSpecialColor(z,1)}setOrReportCursorColor(z){return this._setOrReportSpecialColor(z,2)}restoreIndexedColor(z){if(!z)return this._onColor.fire([{type:2}]),!0;const P=[],F=z.split(";");for(let G=0;G<F.length;++G)if(/^\d+$/.exec(F[G])){const $=parseInt(F[G]);W($)&&P.push({type:2,index:$})}return P.length&&this._onColor.fire(P),!0}restoreFgColor(z){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(z){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(z){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,g.DEFAULT_CHARSET),!0}selectCharset(z){return z.length!==2?(this.selectDefaultCharset(),!0):(z[0]==="/"||this._charsetService.setgCharset(M[z[0]],g.CHARSETS[z[1]]||g.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const z=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,z,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=v.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=v.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(z){return this._charsetService.setgLevel(z),!0}screenAlignmentPattern(){const z=new b.CellData;z.content=4194373,z.fg=this._curAttrData.fg,z.bg=this._curAttrData.bg,this._setCursor(0,0);for(let P=0;P<this._bufferService.rows;++P){const F=this._activeBuffer.ybase+this._activeBuffer.y+P,G=this._activeBuffer.lines.get(F);G&&(G.fill(z),G.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(z,P){const F=this._bufferService.buffer,G=this._optionsService.rawOptions;return($=>(this._coreService.triggerDataEvent(`${h.C0.ESC}${$}${h.C0.ESC}\\`),!0))(z==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:z==='"p'?'P1$r61;1"p':z==="r"?`P1$r${F.scrollTop+1};${F.scrollBottom+1}r`:z==="m"?"P1$r0m":z===" q"?`P1$r${{block:2,underline:4,bar:6}[G.cursorStyle]-(G.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(z,P){this._dirtyRowTracker.markRangeDirty(z,P)}}a.InputHandler=I;let U=class{constructor(H){this._bufferService=H,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(H){H<this.start?this.start=H:H>this.end&&(this.end=H)}markRangeDirty(H,z){H>z&&(D=H,H=z,z=D),H<this.start&&(this.start=H),z>this.end&&(this.end=z)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function W(H){return 0<=H&&H<256}U=u([c(0,R.IBufferService)],U)},844:(o,a)=>{function l(u){for(const c of u)c.dispose();u.length=0}Object.defineProperty(a,"__esModule",{value:!0}),a.getDisposeArrayDisposable=a.disposeArray=a.toDisposable=a.MutableDisposable=a.Disposable=void 0,a.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const u of this._disposables)u.dispose();this._disposables.length=0}register(u){return this._disposables.push(u),u}unregister(u){const c=this._disposables.indexOf(u);c!==-1&&this._disposables.splice(c,1)}},a.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(u){var c;this._isDisposed||u===this._value||((c=this._value)==null||c.dispose(),this._value=u)}clear(){this.value=void 0}dispose(){var u;this._isDisposed=!0,(u=this._value)==null||u.dispose(),this._value=void 0}},a.toDisposable=function(u){return{dispose:u}},a.disposeArray=l,a.getDisposeArrayDisposable=function(u){return{dispose:()=>l(u)}}},1505:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.FourKeyMap=a.TwoKeyMap=void 0;class l{constructor(){this._data={}}set(c,h,g){this._data[c]||(this._data[c]={}),this._data[c][h]=g}get(c,h){return this._data[c]?this._data[c][h]:void 0}clear(){this._data={}}}a.TwoKeyMap=l,a.FourKeyMap=class{constructor(){this._data=new l}set(u,c,h,g,p){this._data.get(u,c)||this._data.set(u,c,new l),this._data.get(u,c).set(h,g,p)}get(u,c,h,g){var p;return(p=this._data.get(u,c))==null?void 0:p.get(h,g)}clear(){this._data.clear()}}},6114:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.isChromeOS=a.isLinux=a.isWindows=a.isIphone=a.isIpad=a.isMac=a.getSafariVersion=a.isSafari=a.isLegacyEdge=a.isFirefox=a.isNode=void 0,a.isNode=typeof process<"u"&&"title"in process;const l=a.isNode?"node":navigator.userAgent,u=a.isNode?"node":navigator.platform;a.isFirefox=l.includes("Firefox"),a.isLegacyEdge=l.includes("Edge"),a.isSafari=/^((?!chrome|android).)*safari/i.test(l),a.getSafariVersion=function(){if(!a.isSafari)return 0;const c=l.match(/Version\/(\d+)/);return c===null||c.length<2?0:parseInt(c[1])},a.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(u),a.isIpad=u==="iPad",a.isIphone=u==="iPhone",a.isWindows=["Windows","Win16","Win32","WinCE"].includes(u),a.isLinux=u.indexOf("Linux")>=0,a.isChromeOS=/\bCrOS\b/.test(l)},6106:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.SortedList=void 0;let l=0;a.SortedList=class{constructor(u){this._getKey=u,this._array=[]}clear(){this._array.length=0}insert(u){this._array.length!==0?(l=this._search(this._getKey(u)),this._array.splice(l,0,u)):this._array.push(u)}delete(u){if(this._array.length===0)return!1;const c=this._getKey(u);if(c===void 0||(l=this._search(c),l===-1)||this._getKey(this._array[l])!==c)return!1;do if(this._array[l]===u)return this._array.splice(l,1),!0;while(++l<this._array.length&&this._getKey(this._array[l])===c);return!1}*getKeyIterator(u){if(this._array.length!==0&&(l=this._search(u),!(l<0||l>=this._array.length)&&this._getKey(this._array[l])===u))do yield this._array[l];while(++l<this._array.length&&this._getKey(this._array[l])===u)}forEachByKey(u,c){if(this._array.length!==0&&(l=this._search(u),!(l<0||l>=this._array.length)&&this._getKey(this._array[l])===u))do c(this._array[l]);while(++l<this._array.length&&this._getKey(this._array[l])===u)}values(){return[...this._array].values()}_search(u){let c=0,h=this._array.length-1;for(;h>=c;){let g=c+h>>1;const p=this._getKey(this._array[g]);if(p>u)h=g-1;else{if(!(p<u)){for(;g>0&&this._getKey(this._array[g-1])===u;)g--;return g}c=g+1}}return c}}},7226:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.DebouncedIdleTask=a.IdleTaskQueue=a.PriorityTaskQueue=void 0;const u=l(6114);class c{constructor(){this._tasks=[],this._i=0}enqueue(p){this._tasks.push(p),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(p){this._idleCallback=void 0;let x=0,w=0,v=p.timeRemaining(),m=0;for(;this._i<this._tasks.length;){if(x=Date.now(),this._tasks[this._i]()||this._i++,x=Math.max(1,Date.now()-x),w=Math.max(x,w),m=p.timeRemaining(),1.5*w>m)return v-x<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(v-x))}ms`),void this._start();v=m}this.clear()}}class h extends c{_requestCallback(p){return setTimeout((()=>p(this._createDeadline(16))))}_cancelCallback(p){clearTimeout(p)}_createDeadline(p){const x=Date.now()+p;return{timeRemaining:()=>Math.max(0,x-Date.now())}}}a.PriorityTaskQueue=h,a.IdleTaskQueue=!u.isNode&&"requestIdleCallback"in window?class extends c{_requestCallback(g){return requestIdleCallback(g)}_cancelCallback(g){cancelIdleCallback(g)}}:h,a.DebouncedIdleTask=class{constructor(){this._queue=new a.IdleTaskQueue}set(g){this._queue.clear(),this._queue.enqueue(g)}flush(){this._queue.flush()}}},9282:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.updateWindowsModeWrappedState=void 0;const u=l(643);a.updateWindowsModeWrappedState=function(c){const h=c.buffer.lines.get(c.buffer.ybase+c.buffer.y-1),g=h==null?void 0:h.get(c.cols-1),p=c.buffer.lines.get(c.buffer.ybase+c.buffer.y);p&&g&&(p.isWrapped=g[u.CHAR_DATA_CODE_INDEX]!==u.NULL_CELL_CODE&&g[u.CHAR_DATA_CODE_INDEX]!==u.WHITESPACE_CELL_CODE)}},3734:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ExtendedAttrs=a.AttributeData=void 0;class l{constructor(){this.fg=0,this.bg=0,this.extended=new u}static toColorRGB(h){return[h>>>16&255,h>>>8&255,255&h]}static fromColorRGB(h){return(255&h[0])<<16|(255&h[1])<<8|255&h[2]}clone(){const h=new l;return h.fg=this.fg,h.bg=this.bg,h.extended=this.extended.clone(),h}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}a.AttributeData=l;class u{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(h){this._ext=h}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(h){this._ext&=-469762049,this._ext|=h<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(h){this._ext&=-67108864,this._ext|=67108863&h}get urlId(){return this._urlId}set urlId(h){this._urlId=h}get underlineVariantOffset(){const h=(3758096384&this._ext)>>29;return h<0?4294967288^h:h}set underlineVariantOffset(h){this._ext&=536870911,this._ext|=h<<29&3758096384}constructor(h=0,g=0){this._ext=0,this._urlId=0,this._ext=h,this._urlId=g}clone(){return new u(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}a.ExtendedAttrs=u},9092:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Buffer=a.MAX_BUFFER_SIZE=void 0;const u=l(6349),c=l(7226),h=l(3734),g=l(8437),p=l(4634),x=l(511),w=l(643),v=l(4863),m=l(7116);a.MAX_BUFFER_SIZE=4294967295,a.Buffer=class{constructor(y,b,_){this._hasScrollback=y,this._optionsService=b,this._bufferService=_,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=g.DEFAULT_ATTR_DATA.clone(),this.savedCharset=m.DEFAULT_CHARSET,this.markers=[],this._nullCell=x.CellData.fromCharData([0,w.NULL_CELL_CHAR,w.NULL_CELL_WIDTH,w.NULL_CELL_CODE]),this._whitespaceCell=x.CellData.fromCharData([0,w.WHITESPACE_CELL_CHAR,w.WHITESPACE_CELL_WIDTH,w.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new c.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new u.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(y){return y?(this._nullCell.fg=y.fg,this._nullCell.bg=y.bg,this._nullCell.extended=y.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new h.ExtendedAttrs),this._nullCell}getWhitespaceCell(y){return y?(this._whitespaceCell.fg=y.fg,this._whitespaceCell.bg=y.bg,this._whitespaceCell.extended=y.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new h.ExtendedAttrs),this._whitespaceCell}getBlankLine(y,b){return new g.BufferLine(this._bufferService.cols,this.getNullCell(y),b)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const y=this.ybase+this.y-this.ydisp;return y>=0&&y<this._rows}_getCorrectBufferLength(y){if(!this._hasScrollback)return y;const b=y+this._optionsService.rawOptions.scrollback;return b>a.MAX_BUFFER_SIZE?a.MAX_BUFFER_SIZE:b}fillViewportRows(y){if(this.lines.length===0){y===void 0&&(y=g.DEFAULT_ATTR_DATA);let b=this._rows;for(;b--;)this.lines.push(this.getBlankLine(y))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new u.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(y,b){const _=this.getNullCell(g.DEFAULT_ATTR_DATA);let R=0;const E=this._getCorrectBufferLength(b);if(E>this.lines.maxLength&&(this.lines.maxLength=E),this.lines.length>0){if(this._cols<y)for(let k=0;k<this.lines.length;k++)R+=+this.lines.get(k).resize(y,_);let T=0;if(this._rows<b)for(let k=this._rows;k<b;k++)this.lines.length<b+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new g.BufferLine(y,_)):this.ybase>0&&this.lines.length<=this.ybase+this.y+T+1?(this.ybase--,T++,this.ydisp>0&&this.ydisp--):this.lines.push(new g.BufferLine(y,_)));else for(let k=this._rows;k>b;k--)this.lines.length>b+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(E<this.lines.maxLength){const k=this.lines.length-E;k>0&&(this.lines.trimStart(k),this.ybase=Math.max(this.ybase-k,0),this.ydisp=Math.max(this.ydisp-k,0),this.savedY=Math.max(this.savedY-k,0)),this.lines.maxLength=E}this.x=Math.min(this.x,y-1),this.y=Math.min(this.y,b-1),T&&(this.y+=T),this.savedX=Math.min(this.savedX,y-1),this.scrollTop=0}if(this.scrollBottom=b-1,this._isReflowEnabled&&(this._reflow(y,b),this._cols>y))for(let T=0;T<this.lines.length;T++)R+=+this.lines.get(T).resize(y,_);this._cols=y,this._rows=b,this._memoryCleanupQueue.clear(),R>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let y=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,y=!1);let b=0;for(;this._memoryCleanupPosition<this.lines.length;)if(b+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),b>100)return!0;return y}get _isReflowEnabled(){const y=this._optionsService.rawOptions.windowsPty;return y&&y.buildNumber?this._hasScrollback&&y.backend==="conpty"&&y.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(y,b){this._cols!==y&&(y>this._cols?this._reflowLarger(y,b):this._reflowSmaller(y,b))}_reflowLarger(y,b){const _=(0,p.reflowLargerGetLinesToRemove)(this.lines,this._cols,y,this.ybase+this.y,this.getNullCell(g.DEFAULT_ATTR_DATA));if(_.length>0){const R=(0,p.reflowLargerCreateNewLayout)(this.lines,_);(0,p.reflowLargerApplyNewLayout)(this.lines,R.layout),this._reflowLargerAdjustViewport(y,b,R.countRemoved)}}_reflowLargerAdjustViewport(y,b,_){const R=this.getNullCell(g.DEFAULT_ATTR_DATA);let E=_;for(;E-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<b&&this.lines.push(new g.BufferLine(y,R))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-_,0)}_reflowSmaller(y,b){const _=this.getNullCell(g.DEFAULT_ATTR_DATA),R=[];let E=0;for(let T=this.lines.length-1;T>=0;T--){let k=this.lines.get(T);if(!k||!k.isWrapped&&k.getTrimmedLength()<=y)continue;const N=[k];for(;k.isWrapped&&T>0;)k=this.lines.get(--T),N.unshift(k);const M=this.ybase+this.y;if(M>=T&&M<T+N.length)continue;const B=N[N.length-1].getTrimmedLength(),A=(0,p.reflowSmallerGetNewLineLengths)(N,this._cols,y),j=A.length-N.length;let D;D=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+j):Math.max(0,this.lines.length-this.lines.maxLength+j);const I=[];for(let F=0;F<j;F++){const G=this.getBlankLine(g.DEFAULT_ATTR_DATA,!0);I.push(G)}I.length>0&&(R.push({start:T+N.length+E,newLines:I}),E+=I.length),N.push(...I);let U=A.length-1,W=A[U];W===0&&(U--,W=A[U]);let H=N.length-j-1,z=B;for(;H>=0;){const F=Math.min(z,W);if(N[U]===void 0)break;if(N[U].copyCellsFrom(N[H],z-F,W-F,F,!0),W-=F,W===0&&(U--,W=A[U]),z-=F,z===0){H--;const G=Math.max(H,0);z=(0,p.getWrappedLineTrimmedLength)(N,G,this._cols)}}for(let F=0;F<N.length;F++)A[F]<y&&N[F].setCell(A[F],_);let P=j-D;for(;P-- >0;)this.ybase===0?this.y<b-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+E)-b&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+j,this.ybase+b-1)}if(R.length>0){const T=[],k=[];for(let U=0;U<this.lines.length;U++)k.push(this.lines.get(U));const N=this.lines.length;let M=N-1,B=0,A=R[B];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+E);let j=0;for(let U=Math.min(this.lines.maxLength-1,N+E-1);U>=0;U--)if(A&&A.start>M+j){for(let W=A.newLines.length-1;W>=0;W--)this.lines.set(U--,A.newLines[W]);U++,T.push({index:M+1,amount:A.newLines.length}),j+=A.newLines.length,A=R[++B]}else this.lines.set(U,k[M--]);let D=0;for(let U=T.length-1;U>=0;U--)T[U].index+=D,this.lines.onInsertEmitter.fire(T[U]),D+=T[U].amount;const I=Math.max(0,N+E-this.lines.maxLength);I>0&&this.lines.onTrimEmitter.fire(I)}}translateBufferLineToString(y,b,_=0,R){const E=this.lines.get(y);return E?E.translateToString(b,_,R):""}getWrappedRangeForLine(y){let b=y,_=y;for(;b>0&&this.lines.get(b).isWrapped;)b--;for(;_+1<this.lines.length&&this.lines.get(_+1).isWrapped;)_++;return{first:b,last:_}}setupTabStops(y){for(y!=null?this.tabs[y]||(y=this.prevStop(y)):(this.tabs={},y=0);y<this._cols;y+=this._optionsService.rawOptions.tabStopWidth)this.tabs[y]=!0}prevStop(y){for(y==null&&(y=this.x);!this.tabs[--y]&&y>0;);return y>=this._cols?this._cols-1:y<0?0:y}nextStop(y){for(y==null&&(y=this.x);!this.tabs[++y]&&y<this._cols;);return y>=this._cols?this._cols-1:y<0?0:y}clearMarkers(y){this._isClearing=!0;for(let b=0;b<this.markers.length;b++)this.markers[b].line===y&&(this.markers[b].dispose(),this.markers.splice(b--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let y=0;y<this.markers.length;y++)this.markers[y].dispose(),this.markers.splice(y--,1);this._isClearing=!1}addMarker(y){const b=new v.Marker(y);return this.markers.push(b),b.register(this.lines.onTrim((_=>{b.line-=_,b.line<0&&b.dispose()}))),b.register(this.lines.onInsert((_=>{b.line>=_.index&&(b.line+=_.amount)}))),b.register(this.lines.onDelete((_=>{b.line>=_.index&&b.line<_.index+_.amount&&b.dispose(),b.line>_.index&&(b.line-=_.amount)}))),b.register(b.onDispose((()=>this._removeMarker(b)))),b}_removeMarker(y){this._isClearing||this.markers.splice(this.markers.indexOf(y),1)}}},8437:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferLine=a.DEFAULT_ATTR_DATA=void 0;const u=l(3734),c=l(511),h=l(643),g=l(482);a.DEFAULT_ATTR_DATA=Object.freeze(new u.AttributeData);let p=0;class x{constructor(v,m,y=!1){this.isWrapped=y,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*v);const b=m||c.CellData.fromCharData([0,h.NULL_CELL_CHAR,h.NULL_CELL_WIDTH,h.NULL_CELL_CODE]);for(let _=0;_<v;++_)this.setCell(_,b);this.length=v}get(v){const m=this._data[3*v+0],y=2097151&m;return[this._data[3*v+1],2097152&m?this._combined[v]:y?(0,g.stringFromCodePoint)(y):"",m>>22,2097152&m?this._combined[v].charCodeAt(this._combined[v].length-1):y]}set(v,m){this._data[3*v+1]=m[h.CHAR_DATA_ATTR_INDEX],m[h.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[v]=m[1],this._data[3*v+0]=2097152|v|m[h.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*v+0]=m[h.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|m[h.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(v){return this._data[3*v+0]>>22}hasWidth(v){return 12582912&this._data[3*v+0]}getFg(v){return this._data[3*v+1]}getBg(v){return this._data[3*v+2]}hasContent(v){return 4194303&this._data[3*v+0]}getCodePoint(v){const m=this._data[3*v+0];return 2097152&m?this._combined[v].charCodeAt(this._combined[v].length-1):2097151&m}isCombined(v){return 2097152&this._data[3*v+0]}getString(v){const m=this._data[3*v+0];return 2097152&m?this._combined[v]:2097151&m?(0,g.stringFromCodePoint)(2097151&m):""}isProtected(v){return 536870912&this._data[3*v+2]}loadCell(v,m){return p=3*v,m.content=this._data[p+0],m.fg=this._data[p+1],m.bg=this._data[p+2],2097152&m.content&&(m.combinedData=this._combined[v]),268435456&m.bg&&(m.extended=this._extendedAttrs[v]),m}setCell(v,m){2097152&m.content&&(this._combined[v]=m.combinedData),268435456&m.bg&&(this._extendedAttrs[v]=m.extended),this._data[3*v+0]=m.content,this._data[3*v+1]=m.fg,this._data[3*v+2]=m.bg}setCellFromCodepoint(v,m,y,b){268435456&b.bg&&(this._extendedAttrs[v]=b.extended),this._data[3*v+0]=m|y<<22,this._data[3*v+1]=b.fg,this._data[3*v+2]=b.bg}addCodepointToCell(v,m,y){let b=this._data[3*v+0];2097152&b?this._combined[v]+=(0,g.stringFromCodePoint)(m):2097151&b?(this._combined[v]=(0,g.stringFromCodePoint)(2097151&b)+(0,g.stringFromCodePoint)(m),b&=-2097152,b|=2097152):b=m|4194304,y&&(b&=-12582913,b|=y<<22),this._data[3*v+0]=b}insertCells(v,m,y){if((v%=this.length)&&this.getWidth(v-1)===2&&this.setCellFromCodepoint(v-1,0,1,y),m<this.length-v){const b=new c.CellData;for(let _=this.length-v-m-1;_>=0;--_)this.setCell(v+m+_,this.loadCell(v+_,b));for(let _=0;_<m;++_)this.setCell(v+_,y)}else for(let b=v;b<this.length;++b)this.setCell(b,y);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,y)}deleteCells(v,m,y){if(v%=this.length,m<this.length-v){const b=new c.CellData;for(let _=0;_<this.length-v-m;++_)this.setCell(v+_,this.loadCell(v+m+_,b));for(let _=this.length-m;_<this.length;++_)this.setCell(_,y)}else for(let b=v;b<this.length;++b)this.setCell(b,y);v&&this.getWidth(v-1)===2&&this.setCellFromCodepoint(v-1,0,1,y),this.getWidth(v)!==0||this.hasContent(v)||this.setCellFromCodepoint(v,0,1,y)}replaceCells(v,m,y,b=!1){if(b)for(v&&this.getWidth(v-1)===2&&!this.isProtected(v-1)&&this.setCellFromCodepoint(v-1,0,1,y),m<this.length&&this.getWidth(m-1)===2&&!this.isProtected(m)&&this.setCellFromCodepoint(m,0,1,y);v<m&&v<this.length;)this.isProtected(v)||this.setCell(v,y),v++;else for(v&&this.getWidth(v-1)===2&&this.setCellFromCodepoint(v-1,0,1,y),m<this.length&&this.getWidth(m-1)===2&&this.setCellFromCodepoint(m,0,1,y);v<m&&v<this.length;)this.setCell(v++,y)}resize(v,m){if(v===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const y=3*v;if(v>this.length){if(this._data.buffer.byteLength>=4*y)this._data=new Uint32Array(this._data.buffer,0,y);else{const b=new Uint32Array(y);b.set(this._data),this._data=b}for(let b=this.length;b<v;++b)this.setCell(b,m)}else{this._data=this._data.subarray(0,y);const b=Object.keys(this._combined);for(let R=0;R<b.length;R++){const E=parseInt(b[R],10);E>=v&&delete this._combined[E]}const _=Object.keys(this._extendedAttrs);for(let R=0;R<_.length;R++){const E=parseInt(_[R],10);E>=v&&delete this._extendedAttrs[E]}}return this.length=v,4*y*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const v=new Uint32Array(this._data.length);return v.set(this._data),this._data=v,1}return 0}fill(v,m=!1){if(m)for(let y=0;y<this.length;++y)this.isProtected(y)||this.setCell(y,v);else{this._combined={},this._extendedAttrs={};for(let y=0;y<this.length;++y)this.setCell(y,v)}}copyFrom(v){this.length!==v.length?this._data=new Uint32Array(v._data):this._data.set(v._data),this.length=v.length,this._combined={};for(const m in v._combined)this._combined[m]=v._combined[m];this._extendedAttrs={};for(const m in v._extendedAttrs)this._extendedAttrs[m]=v._extendedAttrs[m];this.isWrapped=v.isWrapped}clone(){const v=new x(0);v._data=new Uint32Array(this._data),v.length=this.length;for(const m in this._combined)v._combined[m]=this._combined[m];for(const m in this._extendedAttrs)v._extendedAttrs[m]=this._extendedAttrs[m];return v.isWrapped=this.isWrapped,v}getTrimmedLength(){for(let v=this.length-1;v>=0;--v)if(4194303&this._data[3*v+0])return v+(this._data[3*v+0]>>22);return 0}getNoBgTrimmedLength(){for(let v=this.length-1;v>=0;--v)if(4194303&this._data[3*v+0]||50331648&this._data[3*v+2])return v+(this._data[3*v+0]>>22);return 0}copyCellsFrom(v,m,y,b,_){const R=v._data;if(_)for(let T=b-1;T>=0;T--){for(let k=0;k<3;k++)this._data[3*(y+T)+k]=R[3*(m+T)+k];268435456&R[3*(m+T)+2]&&(this._extendedAttrs[y+T]=v._extendedAttrs[m+T])}else for(let T=0;T<b;T++){for(let k=0;k<3;k++)this._data[3*(y+T)+k]=R[3*(m+T)+k];268435456&R[3*(m+T)+2]&&(this._extendedAttrs[y+T]=v._extendedAttrs[m+T])}const E=Object.keys(v._combined);for(let T=0;T<E.length;T++){const k=parseInt(E[T],10);k>=m&&(this._combined[k-m+y]=v._combined[k])}}translateToString(v,m,y,b){m=m??0,y=y??this.length,v&&(y=Math.min(y,this.getTrimmedLength())),b&&(b.length=0);let _="";for(;m<y;){const R=this._data[3*m+0],E=2097151&R,T=2097152&R?this._combined[m]:E?(0,g.stringFromCodePoint)(E):h.WHITESPACE_CELL_CHAR;if(_+=T,b)for(let k=0;k<T.length;++k)b.push(m);m+=R>>22||1}return b&&b.push(m),_}}a.BufferLine=x},4841:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.getRangeLength=void 0,a.getRangeLength=function(l,u){if(l.start.y>l.end.y)throw new Error(`Buffer range end (${l.end.x}, ${l.end.y}) cannot be before start (${l.start.x}, ${l.start.y})`);return u*(l.end.y-l.start.y)+(l.end.x-l.start.x+1)}},4634:(o,a)=>{function l(u,c,h){if(c===u.length-1)return u[c].getTrimmedLength();const g=!u[c].hasContent(h-1)&&u[c].getWidth(h-1)===1,p=u[c+1].getWidth(0)===2;return g&&p?h-1:h}Object.defineProperty(a,"__esModule",{value:!0}),a.getWrappedLineTrimmedLength=a.reflowSmallerGetNewLineLengths=a.reflowLargerApplyNewLayout=a.reflowLargerCreateNewLayout=a.reflowLargerGetLinesToRemove=void 0,a.reflowLargerGetLinesToRemove=function(u,c,h,g,p){const x=[];for(let w=0;w<u.length-1;w++){let v=w,m=u.get(++v);if(!m.isWrapped)continue;const y=[u.get(w)];for(;v<u.length&&m.isWrapped;)y.push(m),m=u.get(++v);if(g>=w&&g<v){w+=y.length-1;continue}let b=0,_=l(y,b,c),R=1,E=0;for(;R<y.length;){const k=l(y,R,c),N=k-E,M=h-_,B=Math.min(N,M);y[b].copyCellsFrom(y[R],E,_,B,!1),_+=B,_===h&&(b++,_=0),E+=B,E===k&&(R++,E=0),_===0&&b!==0&&y[b-1].getWidth(h-1)===2&&(y[b].copyCellsFrom(y[b-1],h-1,_++,1,!1),y[b-1].setCell(h-1,p))}y[b].replaceCells(_,h,p);let T=0;for(let k=y.length-1;k>0&&(k>b||y[k].getTrimmedLength()===0);k--)T++;T>0&&(x.push(w+y.length-T),x.push(T)),w+=y.length-1}return x},a.reflowLargerCreateNewLayout=function(u,c){const h=[];let g=0,p=c[g],x=0;for(let w=0;w<u.length;w++)if(p===w){const v=c[++g];u.onDeleteEmitter.fire({index:w-x,amount:v}),w+=v-1,x+=v,p=c[++g]}else h.push(w);return{layout:h,countRemoved:x}},a.reflowLargerApplyNewLayout=function(u,c){const h=[];for(let g=0;g<c.length;g++)h.push(u.get(c[g]));for(let g=0;g<h.length;g++)u.set(g,h[g]);u.length=c.length},a.reflowSmallerGetNewLineLengths=function(u,c,h){const g=[],p=u.map(((m,y)=>l(u,y,c))).reduce(((m,y)=>m+y));let x=0,w=0,v=0;for(;v<p;){if(p-v<h){g.push(p-v);break}x+=h;const m=l(u,w,c);x>m&&(x-=m,w++);const y=u[w].getWidth(x-1)===2;y&&x--;const b=y?h-1:h;g.push(b),v+=b}return g},a.getWrappedLineTrimmedLength=l},5295:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferSet=void 0;const u=l(8460),c=l(844),h=l(9092);class g extends c.Disposable{constructor(x,w){super(),this._optionsService=x,this._bufferService=w,this._onBufferActivate=this.register(new u.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",(()=>this.setupTabStops())))}reset(){this._normal=new h.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new h.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(x){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(x),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(x,w){this._normal.resize(x,w),this._alt.resize(x,w),this.setupTabStops(x)}setupTabStops(x){this._normal.setupTabStops(x),this._alt.setupTabStops(x)}}a.BufferSet=g},511:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CellData=void 0;const u=l(482),c=l(643),h=l(3734);class g extends h.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new h.ExtendedAttrs,this.combinedData=""}static fromCharData(x){const w=new g;return w.setFromCharData(x),w}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,u.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(x){this.fg=x[c.CHAR_DATA_ATTR_INDEX],this.bg=0;let w=!1;if(x[c.CHAR_DATA_CHAR_INDEX].length>2)w=!0;else if(x[c.CHAR_DATA_CHAR_INDEX].length===2){const v=x[c.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=v&&v<=56319){const m=x[c.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=m&&m<=57343?this.content=1024*(v-55296)+m-56320+65536|x[c.CHAR_DATA_WIDTH_INDEX]<<22:w=!0}else w=!0}else this.content=x[c.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|x[c.CHAR_DATA_WIDTH_INDEX]<<22;w&&(this.combinedData=x[c.CHAR_DATA_CHAR_INDEX],this.content=2097152|x[c.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}a.CellData=g},643:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.WHITESPACE_CELL_CODE=a.WHITESPACE_CELL_WIDTH=a.WHITESPACE_CELL_CHAR=a.NULL_CELL_CODE=a.NULL_CELL_WIDTH=a.NULL_CELL_CHAR=a.CHAR_DATA_CODE_INDEX=a.CHAR_DATA_WIDTH_INDEX=a.CHAR_DATA_CHAR_INDEX=a.CHAR_DATA_ATTR_INDEX=a.DEFAULT_EXT=a.DEFAULT_ATTR=a.DEFAULT_COLOR=void 0,a.DEFAULT_COLOR=0,a.DEFAULT_ATTR=256|a.DEFAULT_COLOR<<9,a.DEFAULT_EXT=0,a.CHAR_DATA_ATTR_INDEX=0,a.CHAR_DATA_CHAR_INDEX=1,a.CHAR_DATA_WIDTH_INDEX=2,a.CHAR_DATA_CODE_INDEX=3,a.NULL_CELL_CHAR="",a.NULL_CELL_WIDTH=1,a.NULL_CELL_CODE=0,a.WHITESPACE_CELL_CHAR=" ",a.WHITESPACE_CELL_WIDTH=1,a.WHITESPACE_CELL_CODE=32},4863:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Marker=void 0;const u=l(8460),c=l(844);class h{get id(){return this._id}constructor(p){this.line=p,this.isDisposed=!1,this._disposables=[],this._id=h._nextId++,this._onDispose=this.register(new u.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,c.disposeArray)(this._disposables),this._disposables.length=0)}register(p){return this._disposables.push(p),p}}a.Marker=h,h._nextId=1},7116:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.DEFAULT_CHARSET=a.CHARSETS=void 0,a.CHARSETS={},a.DEFAULT_CHARSET=a.CHARSETS.B,a.CHARSETS[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},a.CHARSETS.A={"#":"£"},a.CHARSETS.B=void 0,a.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},a.CHARSETS.C=a.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},a.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},a.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},a.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},a.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},a.CHARSETS.E=a.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},a.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},a.CHARSETS.H=a.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},a.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(o,a)=>{var l,u,c;Object.defineProperty(a,"__esModule",{value:!0}),a.C1_ESCAPED=a.C1=a.C0=void 0,(function(h){h.NUL="\0",h.SOH="",h.STX="",h.ETX="",h.EOT="",h.ENQ="",h.ACK="",h.BEL="\x07",h.BS="\b",h.HT=" ",h.LF=`
382
+ `,h.VT="\v",h.FF="\f",h.CR="\r",h.SO="",h.SI="",h.DLE="",h.DC1="",h.DC2="",h.DC3="",h.DC4="",h.NAK="",h.SYN="",h.ETB="",h.CAN="",h.EM="",h.SUB="",h.ESC="\x1B",h.FS="",h.GS="",h.RS="",h.US="",h.SP=" ",h.DEL=""})(l||(a.C0=l={})),(function(h){h.PAD="€",h.HOP="",h.BPH="‚",h.NBH="ƒ",h.IND="„",h.NEL="…",h.SSA="†",h.ESA="‡",h.HTS="ˆ",h.HTJ="‰",h.VTS="Š",h.PLD="‹",h.PLU="Œ",h.RI="",h.SS2="Ž",h.SS3="",h.DCS="",h.PU1="‘",h.PU2="’",h.STS="“",h.CCH="”",h.MW="•",h.SPA="–",h.EPA="—",h.SOS="˜",h.SGCI="™",h.SCI="š",h.CSI="›",h.ST="œ",h.OSC="",h.PM="ž",h.APC="Ÿ"})(u||(a.C1=u={})),(function(h){h.ST=`${l.ESC}\\`})(c||(a.C1_ESCAPED=c={}))},7399:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.evaluateKeyboardEvent=void 0;const u=l(2584),c={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};a.evaluateKeyboardEvent=function(h,g,p,x){const w={type:0,cancel:!1,key:void 0},v=(h.shiftKey?1:0)|(h.altKey?2:0)|(h.ctrlKey?4:0)|(h.metaKey?8:0);switch(h.keyCode){case 0:h.key==="UIKeyInputUpArrow"?w.key=g?u.C0.ESC+"OA":u.C0.ESC+"[A":h.key==="UIKeyInputLeftArrow"?w.key=g?u.C0.ESC+"OD":u.C0.ESC+"[D":h.key==="UIKeyInputRightArrow"?w.key=g?u.C0.ESC+"OC":u.C0.ESC+"[C":h.key==="UIKeyInputDownArrow"&&(w.key=g?u.C0.ESC+"OB":u.C0.ESC+"[B");break;case 8:w.key=h.ctrlKey?"\b":u.C0.DEL,h.altKey&&(w.key=u.C0.ESC+w.key);break;case 9:if(h.shiftKey){w.key=u.C0.ESC+"[Z";break}w.key=u.C0.HT,w.cancel=!0;break;case 13:w.key=h.altKey?u.C0.ESC+u.C0.CR:u.C0.CR,w.cancel=!0;break;case 27:w.key=u.C0.ESC,h.altKey&&(w.key=u.C0.ESC+u.C0.ESC),w.cancel=!0;break;case 37:if(h.metaKey)break;v?(w.key=u.C0.ESC+"[1;"+(v+1)+"D",w.key===u.C0.ESC+"[1;3D"&&(w.key=u.C0.ESC+(p?"b":"[1;5D"))):w.key=g?u.C0.ESC+"OD":u.C0.ESC+"[D";break;case 39:if(h.metaKey)break;v?(w.key=u.C0.ESC+"[1;"+(v+1)+"C",w.key===u.C0.ESC+"[1;3C"&&(w.key=u.C0.ESC+(p?"f":"[1;5C"))):w.key=g?u.C0.ESC+"OC":u.C0.ESC+"[C";break;case 38:if(h.metaKey)break;v?(w.key=u.C0.ESC+"[1;"+(v+1)+"A",p||w.key!==u.C0.ESC+"[1;3A"||(w.key=u.C0.ESC+"[1;5A")):w.key=g?u.C0.ESC+"OA":u.C0.ESC+"[A";break;case 40:if(h.metaKey)break;v?(w.key=u.C0.ESC+"[1;"+(v+1)+"B",p||w.key!==u.C0.ESC+"[1;3B"||(w.key=u.C0.ESC+"[1;5B")):w.key=g?u.C0.ESC+"OB":u.C0.ESC+"[B";break;case 45:h.shiftKey||h.ctrlKey||(w.key=u.C0.ESC+"[2~");break;case 46:w.key=v?u.C0.ESC+"[3;"+(v+1)+"~":u.C0.ESC+"[3~";break;case 36:w.key=v?u.C0.ESC+"[1;"+(v+1)+"H":g?u.C0.ESC+"OH":u.C0.ESC+"[H";break;case 35:w.key=v?u.C0.ESC+"[1;"+(v+1)+"F":g?u.C0.ESC+"OF":u.C0.ESC+"[F";break;case 33:h.shiftKey?w.type=2:h.ctrlKey?w.key=u.C0.ESC+"[5;"+(v+1)+"~":w.key=u.C0.ESC+"[5~";break;case 34:h.shiftKey?w.type=3:h.ctrlKey?w.key=u.C0.ESC+"[6;"+(v+1)+"~":w.key=u.C0.ESC+"[6~";break;case 112:w.key=v?u.C0.ESC+"[1;"+(v+1)+"P":u.C0.ESC+"OP";break;case 113:w.key=v?u.C0.ESC+"[1;"+(v+1)+"Q":u.C0.ESC+"OQ";break;case 114:w.key=v?u.C0.ESC+"[1;"+(v+1)+"R":u.C0.ESC+"OR";break;case 115:w.key=v?u.C0.ESC+"[1;"+(v+1)+"S":u.C0.ESC+"OS";break;case 116:w.key=v?u.C0.ESC+"[15;"+(v+1)+"~":u.C0.ESC+"[15~";break;case 117:w.key=v?u.C0.ESC+"[17;"+(v+1)+"~":u.C0.ESC+"[17~";break;case 118:w.key=v?u.C0.ESC+"[18;"+(v+1)+"~":u.C0.ESC+"[18~";break;case 119:w.key=v?u.C0.ESC+"[19;"+(v+1)+"~":u.C0.ESC+"[19~";break;case 120:w.key=v?u.C0.ESC+"[20;"+(v+1)+"~":u.C0.ESC+"[20~";break;case 121:w.key=v?u.C0.ESC+"[21;"+(v+1)+"~":u.C0.ESC+"[21~";break;case 122:w.key=v?u.C0.ESC+"[23;"+(v+1)+"~":u.C0.ESC+"[23~";break;case 123:w.key=v?u.C0.ESC+"[24;"+(v+1)+"~":u.C0.ESC+"[24~";break;default:if(!h.ctrlKey||h.shiftKey||h.altKey||h.metaKey)if(p&&!x||!h.altKey||h.metaKey)!p||h.altKey||h.ctrlKey||h.shiftKey||!h.metaKey?h.key&&!h.ctrlKey&&!h.altKey&&!h.metaKey&&h.keyCode>=48&&h.key.length===1?w.key=h.key:h.key&&h.ctrlKey&&(h.key==="_"&&(w.key=u.C0.US),h.key==="@"&&(w.key=u.C0.NUL)):h.keyCode===65&&(w.type=1);else{const m=c[h.keyCode],y=m==null?void 0:m[h.shiftKey?1:0];if(y)w.key=u.C0.ESC+y;else if(h.keyCode>=65&&h.keyCode<=90){const b=h.ctrlKey?h.keyCode-64:h.keyCode+32;let _=String.fromCharCode(b);h.shiftKey&&(_=_.toUpperCase()),w.key=u.C0.ESC+_}else if(h.keyCode===32)w.key=u.C0.ESC+(h.ctrlKey?u.C0.NUL:" ");else if(h.key==="Dead"&&h.code.startsWith("Key")){let b=h.code.slice(3,4);h.shiftKey||(b=b.toLowerCase()),w.key=u.C0.ESC+b,w.cancel=!0}}else h.keyCode>=65&&h.keyCode<=90?w.key=String.fromCharCode(h.keyCode-64):h.keyCode===32?w.key=u.C0.NUL:h.keyCode>=51&&h.keyCode<=55?w.key=String.fromCharCode(h.keyCode-51+27):h.keyCode===56?w.key=u.C0.DEL:h.keyCode===219?w.key=u.C0.ESC:h.keyCode===220?w.key=u.C0.FS:h.keyCode===221&&(w.key=u.C0.GS)}return w}},482:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Utf8ToUtf32=a.StringToUtf32=a.utf32ToString=a.stringFromCodePoint=void 0,a.stringFromCodePoint=function(l){return l>65535?(l-=65536,String.fromCharCode(55296+(l>>10))+String.fromCharCode(l%1024+56320)):String.fromCharCode(l)},a.utf32ToString=function(l,u=0,c=l.length){let h="";for(let g=u;g<c;++g){let p=l[g];p>65535?(p-=65536,h+=String.fromCharCode(55296+(p>>10))+String.fromCharCode(p%1024+56320)):h+=String.fromCharCode(p)}return h},a.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(l,u){const c=l.length;if(!c)return 0;let h=0,g=0;if(this._interim){const p=l.charCodeAt(g++);56320<=p&&p<=57343?u[h++]=1024*(this._interim-55296)+p-56320+65536:(u[h++]=this._interim,u[h++]=p),this._interim=0}for(let p=g;p<c;++p){const x=l.charCodeAt(p);if(55296<=x&&x<=56319){if(++p>=c)return this._interim=x,h;const w=l.charCodeAt(p);56320<=w&&w<=57343?u[h++]=1024*(x-55296)+w-56320+65536:(u[h++]=x,u[h++]=w)}else x!==65279&&(u[h++]=x)}return h}},a.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(l,u){const c=l.length;if(!c)return 0;let h,g,p,x,w=0,v=0,m=0;if(this.interim[0]){let _=!1,R=this.interim[0];R&=(224&R)==192?31:(240&R)==224?15:7;let E,T=0;for(;(E=63&this.interim[++T])&&T<4;)R<<=6,R|=E;const k=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,N=k-T;for(;m<N;){if(m>=c)return 0;if(E=l[m++],(192&E)!=128){m--,_=!0;break}this.interim[T++]=E,R<<=6,R|=63&E}_||(k===2?R<128?m--:u[w++]=R:k===3?R<2048||R>=55296&&R<=57343||R===65279||(u[w++]=R):R<65536||R>1114111||(u[w++]=R)),this.interim.fill(0)}const y=c-4;let b=m;for(;b<c;){for(;!(!(b<y)||128&(h=l[b])||128&(g=l[b+1])||128&(p=l[b+2])||128&(x=l[b+3]));)u[w++]=h,u[w++]=g,u[w++]=p,u[w++]=x,b+=4;if(h=l[b++],h<128)u[w++]=h;else if((224&h)==192){if(b>=c)return this.interim[0]=h,w;if(g=l[b++],(192&g)!=128){b--;continue}if(v=(31&h)<<6|63&g,v<128){b--;continue}u[w++]=v}else if((240&h)==224){if(b>=c)return this.interim[0]=h,w;if(g=l[b++],(192&g)!=128){b--;continue}if(b>=c)return this.interim[0]=h,this.interim[1]=g,w;if(p=l[b++],(192&p)!=128){b--;continue}if(v=(15&h)<<12|(63&g)<<6|63&p,v<2048||v>=55296&&v<=57343||v===65279)continue;u[w++]=v}else if((248&h)==240){if(b>=c)return this.interim[0]=h,w;if(g=l[b++],(192&g)!=128){b--;continue}if(b>=c)return this.interim[0]=h,this.interim[1]=g,w;if(p=l[b++],(192&p)!=128){b--;continue}if(b>=c)return this.interim[0]=h,this.interim[1]=g,this.interim[2]=p,w;if(x=l[b++],(192&x)!=128){b--;continue}if(v=(7&h)<<18|(63&g)<<12|(63&p)<<6|63&x,v<65536||v>1114111)continue;u[w++]=v}}return w}}},225:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.UnicodeV6=void 0;const u=l(1480),c=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],h=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let g;a.UnicodeV6=class{constructor(){if(this.version="6",!g){g=new Uint8Array(65536),g.fill(1),g[0]=0,g.fill(0,1,32),g.fill(0,127,160),g.fill(2,4352,4448),g[9001]=2,g[9002]=2,g.fill(2,11904,42192),g[12351]=1,g.fill(2,44032,55204),g.fill(2,63744,64256),g.fill(2,65040,65050),g.fill(2,65072,65136),g.fill(2,65280,65377),g.fill(2,65504,65511);for(let p=0;p<c.length;++p)g.fill(0,c[p][0],c[p][1]+1)}}wcwidth(p){return p<32?0:p<127?1:p<65536?g[p]:(function(x,w){let v,m=0,y=w.length-1;if(x<w[0][0]||x>w[y][1])return!1;for(;y>=m;)if(v=m+y>>1,x>w[v][1])m=v+1;else{if(!(x<w[v][0]))return!0;y=v-1}return!1})(p,h)?0:p>=131072&&p<=196605||p>=196608&&p<=262141?2:1}charProperties(p,x){let w=this.wcwidth(p),v=w===0&&x!==0;if(v){const m=u.UnicodeService.extractWidth(x);m===0?v=!1:m>w&&(w=m)}return u.UnicodeService.createPropertyValue(0,w,v)}}},5981:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.WriteBuffer=void 0;const u=l(8460),c=l(844);class h extends c.Disposable{constructor(p){super(),this._action=p,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new u.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(p,x){if(x!==void 0&&this._syncCalls>x)return void(this._syncCalls=0);if(this._pendingData+=p.length,this._writeBuffer.push(p),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let w;for(this._isSyncWriting=!0;w=this._writeBuffer.shift();){this._action(w);const v=this._callbacks.shift();v&&v()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(p,x){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=p.length,this._writeBuffer.push(p),this._callbacks.push(x),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=p.length,this._writeBuffer.push(p),this._callbacks.push(x)}_innerWrite(p=0,x=!0){const w=p||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const v=this._writeBuffer[this._bufferOffset],m=this._action(v,x);if(m){const b=_=>Date.now()-w>=12?setTimeout((()=>this._innerWrite(0,_))):this._innerWrite(w,_);return void m.catch((_=>(queueMicrotask((()=>{throw _})),Promise.resolve(!1)))).then(b)}const y=this._callbacks[this._bufferOffset];if(y&&y(),this._bufferOffset++,this._pendingData-=v.length,Date.now()-w>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}a.WriteBuffer=h},5941:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.toRgbString=a.parseColor=void 0;const l=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,u=/^[\da-f]+$/;function c(h,g){const p=h.toString(16),x=p.length<2?"0"+p:p;switch(g){case 4:return p[0];case 8:return x;case 12:return(x+x).slice(0,3);default:return x+x}}a.parseColor=function(h){if(!h)return;let g=h.toLowerCase();if(g.indexOf("rgb:")===0){g=g.slice(4);const p=l.exec(g);if(p){const x=p[1]?15:p[4]?255:p[7]?4095:65535;return[Math.round(parseInt(p[1]||p[4]||p[7]||p[10],16)/x*255),Math.round(parseInt(p[2]||p[5]||p[8]||p[11],16)/x*255),Math.round(parseInt(p[3]||p[6]||p[9]||p[12],16)/x*255)]}}else if(g.indexOf("#")===0&&(g=g.slice(1),u.exec(g)&&[3,6,9,12].includes(g.length))){const p=g.length/3,x=[0,0,0];for(let w=0;w<3;++w){const v=parseInt(g.slice(p*w,p*w+p),16);x[w]=p===1?v<<4:p===2?v:p===3?v>>4:v>>8}return x}},a.toRgbString=function(h,g=16){const[p,x,w]=h;return`rgb:${c(p,g)}/${c(x,g)}/${c(w,g)}`}},5770:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.PAYLOAD_LIMIT=void 0,a.PAYLOAD_LIMIT=1e7},6351:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.DcsHandler=a.DcsParser=void 0;const u=l(482),c=l(8742),h=l(5770),g=[];a.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=g,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=g}registerHandler(x,w){this._handlers[x]===void 0&&(this._handlers[x]=[]);const v=this._handlers[x];return v.push(w),{dispose:()=>{const m=v.indexOf(w);m!==-1&&v.splice(m,1)}}}clearHandler(x){this._handlers[x]&&delete this._handlers[x]}setHandlerFallback(x){this._handlerFb=x}reset(){if(this._active.length)for(let x=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;x>=0;--x)this._active[x].unhook(!1);this._stack.paused=!1,this._active=g,this._ident=0}hook(x,w){if(this.reset(),this._ident=x,this._active=this._handlers[x]||g,this._active.length)for(let v=this._active.length-1;v>=0;v--)this._active[v].hook(w);else this._handlerFb(this._ident,"HOOK",w)}put(x,w,v){if(this._active.length)for(let m=this._active.length-1;m>=0;m--)this._active[m].put(x,w,v);else this._handlerFb(this._ident,"PUT",(0,u.utf32ToString)(x,w,v))}unhook(x,w=!0){if(this._active.length){let v=!1,m=this._active.length-1,y=!1;if(this._stack.paused&&(m=this._stack.loopPosition-1,v=w,y=this._stack.fallThrough,this._stack.paused=!1),!y&&v===!1){for(;m>=0&&(v=this._active[m].unhook(x),v!==!0);m--)if(v instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=m,this._stack.fallThrough=!1,v;m--}for(;m>=0;m--)if(v=this._active[m].unhook(!1),v instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=m,this._stack.fallThrough=!0,v}else this._handlerFb(this._ident,"UNHOOK",x);this._active=g,this._ident=0}};const p=new c.Params;p.addParam(0),a.DcsHandler=class{constructor(x){this._handler=x,this._data="",this._params=p,this._hitLimit=!1}hook(x){this._params=x.length>1||x.params[0]?x.clone():p,this._data="",this._hitLimit=!1}put(x,w,v){this._hitLimit||(this._data+=(0,u.utf32ToString)(x,w,v),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(x){let w=!1;if(this._hitLimit)w=!1;else if(x&&(w=this._handler(this._data,this._params),w instanceof Promise))return w.then((v=>(this._params=p,this._data="",this._hitLimit=!1,v)));return this._params=p,this._data="",this._hitLimit=!1,w}}},2015:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.EscapeSequenceParser=a.VT500_TRANSITION_TABLE=a.TransitionTable=void 0;const u=l(844),c=l(8742),h=l(6242),g=l(6351);class p{constructor(m){this.table=new Uint8Array(m)}setDefault(m,y){this.table.fill(m<<4|y)}add(m,y,b,_){this.table[y<<8|m]=b<<4|_}addMany(m,y,b,_){for(let R=0;R<m.length;R++)this.table[y<<8|m[R]]=b<<4|_}}a.TransitionTable=p;const x=160;a.VT500_TRANSITION_TABLE=(function(){const v=new p(4095),m=Array.apply(null,Array(256)).map(((T,k)=>k)),y=(T,k)=>m.slice(T,k),b=y(32,127),_=y(0,24);_.push(25),_.push.apply(_,y(28,32));const R=y(0,14);let E;for(E in v.setDefault(1,0),v.addMany(b,0,2,0),R)v.addMany([24,26,153,154],E,3,0),v.addMany(y(128,144),E,3,0),v.addMany(y(144,152),E,3,0),v.add(156,E,0,0),v.add(27,E,11,1),v.add(157,E,4,8),v.addMany([152,158,159],E,0,7),v.add(155,E,11,3),v.add(144,E,11,9);return v.addMany(_,0,3,0),v.addMany(_,1,3,1),v.add(127,1,0,1),v.addMany(_,8,0,8),v.addMany(_,3,3,3),v.add(127,3,0,3),v.addMany(_,4,3,4),v.add(127,4,0,4),v.addMany(_,6,3,6),v.addMany(_,5,3,5),v.add(127,5,0,5),v.addMany(_,2,3,2),v.add(127,2,0,2),v.add(93,1,4,8),v.addMany(b,8,5,8),v.add(127,8,5,8),v.addMany([156,27,24,26,7],8,6,0),v.addMany(y(28,32),8,0,8),v.addMany([88,94,95],1,0,7),v.addMany(b,7,0,7),v.addMany(_,7,0,7),v.add(156,7,0,0),v.add(127,7,0,7),v.add(91,1,11,3),v.addMany(y(64,127),3,7,0),v.addMany(y(48,60),3,8,4),v.addMany([60,61,62,63],3,9,4),v.addMany(y(48,60),4,8,4),v.addMany(y(64,127),4,7,0),v.addMany([60,61,62,63],4,0,6),v.addMany(y(32,64),6,0,6),v.add(127,6,0,6),v.addMany(y(64,127),6,0,0),v.addMany(y(32,48),3,9,5),v.addMany(y(32,48),5,9,5),v.addMany(y(48,64),5,0,6),v.addMany(y(64,127),5,7,0),v.addMany(y(32,48),4,9,5),v.addMany(y(32,48),1,9,2),v.addMany(y(32,48),2,9,2),v.addMany(y(48,127),2,10,0),v.addMany(y(48,80),1,10,0),v.addMany(y(81,88),1,10,0),v.addMany([89,90,92],1,10,0),v.addMany(y(96,127),1,10,0),v.add(80,1,11,9),v.addMany(_,9,0,9),v.add(127,9,0,9),v.addMany(y(28,32),9,0,9),v.addMany(y(32,48),9,9,12),v.addMany(y(48,60),9,8,10),v.addMany([60,61,62,63],9,9,10),v.addMany(_,11,0,11),v.addMany(y(32,128),11,0,11),v.addMany(y(28,32),11,0,11),v.addMany(_,10,0,10),v.add(127,10,0,10),v.addMany(y(28,32),10,0,10),v.addMany(y(48,60),10,8,10),v.addMany([60,61,62,63],10,0,11),v.addMany(y(32,48),10,9,12),v.addMany(_,12,0,12),v.add(127,12,0,12),v.addMany(y(28,32),12,0,12),v.addMany(y(32,48),12,9,12),v.addMany(y(48,64),12,0,11),v.addMany(y(64,127),12,12,13),v.addMany(y(64,127),10,12,13),v.addMany(y(64,127),9,12,13),v.addMany(_,13,13,13),v.addMany(b,13,13,13),v.add(127,13,0,13),v.addMany([27,156,24,26],13,14,0),v.add(x,0,2,0),v.add(x,8,5,8),v.add(x,6,0,6),v.add(x,11,0,11),v.add(x,13,13,13),v})();class w extends u.Disposable{constructor(m=a.VT500_TRANSITION_TABLE){super(),this._transitions=m,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new c.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(y,b,_)=>{},this._executeHandlerFb=y=>{},this._csiHandlerFb=(y,b)=>{},this._escHandlerFb=y=>{},this._errorHandlerFb=y=>y,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,u.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new h.OscParser),this._dcsParser=this.register(new g.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(m,y=[64,126]){let b=0;if(m.prefix){if(m.prefix.length>1)throw new Error("only one byte as prefix supported");if(b=m.prefix.charCodeAt(0),b&&60>b||b>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(m.intermediates){if(m.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let R=0;R<m.intermediates.length;++R){const E=m.intermediates.charCodeAt(R);if(32>E||E>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");b<<=8,b|=E}}if(m.final.length!==1)throw new Error("final must be a single byte");const _=m.final.charCodeAt(0);if(y[0]>_||_>y[1])throw new Error(`final must be in range ${y[0]} .. ${y[1]}`);return b<<=8,b|=_,b}identToString(m){const y=[];for(;m;)y.push(String.fromCharCode(255&m)),m>>=8;return y.reverse().join("")}setPrintHandler(m){this._printHandler=m}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(m,y){const b=this._identifier(m,[48,126]);this._escHandlers[b]===void 0&&(this._escHandlers[b]=[]);const _=this._escHandlers[b];return _.push(y),{dispose:()=>{const R=_.indexOf(y);R!==-1&&_.splice(R,1)}}}clearEscHandler(m){this._escHandlers[this._identifier(m,[48,126])]&&delete this._escHandlers[this._identifier(m,[48,126])]}setEscHandlerFallback(m){this._escHandlerFb=m}setExecuteHandler(m,y){this._executeHandlers[m.charCodeAt(0)]=y}clearExecuteHandler(m){this._executeHandlers[m.charCodeAt(0)]&&delete this._executeHandlers[m.charCodeAt(0)]}setExecuteHandlerFallback(m){this._executeHandlerFb=m}registerCsiHandler(m,y){const b=this._identifier(m);this._csiHandlers[b]===void 0&&(this._csiHandlers[b]=[]);const _=this._csiHandlers[b];return _.push(y),{dispose:()=>{const R=_.indexOf(y);R!==-1&&_.splice(R,1)}}}clearCsiHandler(m){this._csiHandlers[this._identifier(m)]&&delete this._csiHandlers[this._identifier(m)]}setCsiHandlerFallback(m){this._csiHandlerFb=m}registerDcsHandler(m,y){return this._dcsParser.registerHandler(this._identifier(m),y)}clearDcsHandler(m){this._dcsParser.clearHandler(this._identifier(m))}setDcsHandlerFallback(m){this._dcsParser.setHandlerFallback(m)}registerOscHandler(m,y){return this._oscParser.registerHandler(m,y)}clearOscHandler(m){this._oscParser.clearHandler(m)}setOscHandlerFallback(m){this._oscParser.setHandlerFallback(m)}setErrorHandler(m){this._errorHandler=m}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(m,y,b,_,R){this._parseStack.state=m,this._parseStack.handlers=y,this._parseStack.handlerPos=b,this._parseStack.transition=_,this._parseStack.chunkPos=R}parse(m,y,b){let _,R=0,E=0,T=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,T=this._parseStack.chunkPos+1;else{if(b===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const k=this._parseStack.handlers;let N=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(b===!1&&N>-1){for(;N>=0&&(_=k[N](this._params),_!==!0);N--)if(_ instanceof Promise)return this._parseStack.handlerPos=N,_}this._parseStack.handlers=[];break;case 4:if(b===!1&&N>-1){for(;N>=0&&(_=k[N](),_!==!0);N--)if(_ instanceof Promise)return this._parseStack.handlerPos=N,_}this._parseStack.handlers=[];break;case 6:if(R=m[this._parseStack.chunkPos],_=this._dcsParser.unhook(R!==24&&R!==26,b),_)return _;R===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(R=m[this._parseStack.chunkPos],_=this._oscParser.end(R!==24&&R!==26,b),_)return _;R===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,T=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let k=T;k<y;++k){switch(R=m[k],E=this._transitions.table[this.currentState<<8|(R<160?R:x)],E>>4){case 2:for(let j=k+1;;++j){if(j>=y||(R=m[j])<32||R>126&&R<x){this._printHandler(m,k,j),k=j-1;break}if(++j>=y||(R=m[j])<32||R>126&&R<x){this._printHandler(m,k,j),k=j-1;break}if(++j>=y||(R=m[j])<32||R>126&&R<x){this._printHandler(m,k,j),k=j-1;break}if(++j>=y||(R=m[j])<32||R>126&&R<x){this._printHandler(m,k,j),k=j-1;break}}break;case 3:this._executeHandlers[R]?this._executeHandlers[R]():this._executeHandlerFb(R),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:k,code:R,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const N=this._csiHandlers[this._collect<<8|R];let M=N?N.length-1:-1;for(;M>=0&&(_=N[M](this._params),_!==!0);M--)if(_ instanceof Promise)return this._preserveStack(3,N,M,E,k),_;M<0&&this._csiHandlerFb(this._collect<<8|R,this._params),this.precedingJoinState=0;break;case 8:do switch(R){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(R-48)}while(++k<y&&(R=m[k])>47&&R<60);k--;break;case 9:this._collect<<=8,this._collect|=R;break;case 10:const B=this._escHandlers[this._collect<<8|R];let A=B?B.length-1:-1;for(;A>=0&&(_=B[A](),_!==!0);A--)if(_ instanceof Promise)return this._preserveStack(4,B,A,E,k),_;A<0&&this._escHandlerFb(this._collect<<8|R),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|R,this._params);break;case 13:for(let j=k+1;;++j)if(j>=y||(R=m[j])===24||R===26||R===27||R>127&&R<x){this._dcsParser.put(m,k,j),k=j-1;break}break;case 14:if(_=this._dcsParser.unhook(R!==24&&R!==26),_)return this._preserveStack(6,[],0,E,k),_;R===27&&(E|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let j=k+1;;j++)if(j>=y||(R=m[j])<32||R>127&&R<x){this._oscParser.put(m,k,j),k=j-1;break}break;case 6:if(_=this._oscParser.end(R!==24&&R!==26),_)return this._preserveStack(5,[],0,E,k),_;R===27&&(E|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&E}}}a.EscapeSequenceParser=w},6242:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.OscHandler=a.OscParser=void 0;const u=l(5770),c=l(482),h=[];a.OscParser=class{constructor(){this._state=0,this._active=h,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(g,p){this._handlers[g]===void 0&&(this._handlers[g]=[]);const x=this._handlers[g];return x.push(p),{dispose:()=>{const w=x.indexOf(p);w!==-1&&x.splice(w,1)}}}clearHandler(g){this._handlers[g]&&delete this._handlers[g]}setHandlerFallback(g){this._handlerFb=g}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=h}reset(){if(this._state===2)for(let g=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;g>=0;--g)this._active[g].end(!1);this._stack.paused=!1,this._active=h,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||h,this._active.length)for(let g=this._active.length-1;g>=0;g--)this._active[g].start();else this._handlerFb(this._id,"START")}_put(g,p,x){if(this._active.length)for(let w=this._active.length-1;w>=0;w--)this._active[w].put(g,p,x);else this._handlerFb(this._id,"PUT",(0,c.utf32ToString)(g,p,x))}start(){this.reset(),this._state=1}put(g,p,x){if(this._state!==3){if(this._state===1)for(;p<x;){const w=g[p++];if(w===59){this._state=2,this._start();break}if(w<48||57<w)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+w-48}this._state===2&&x-p>0&&this._put(g,p,x)}}end(g,p=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let x=!1,w=this._active.length-1,v=!1;if(this._stack.paused&&(w=this._stack.loopPosition-1,x=p,v=this._stack.fallThrough,this._stack.paused=!1),!v&&x===!1){for(;w>=0&&(x=this._active[w].end(g),x!==!0);w--)if(x instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=w,this._stack.fallThrough=!1,x;w--}for(;w>=0;w--)if(x=this._active[w].end(!1),x instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=w,this._stack.fallThrough=!0,x}else this._handlerFb(this._id,"END",g);this._active=h,this._id=-1,this._state=0}}},a.OscHandler=class{constructor(g){this._handler=g,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(g,p,x){this._hitLimit||(this._data+=(0,c.utf32ToString)(g,p,x),this._data.length>u.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(g){let p=!1;if(this._hitLimit)p=!1;else if(g&&(p=this._handler(this._data),p instanceof Promise))return p.then((x=>(this._data="",this._hitLimit=!1,x)));return this._data="",this._hitLimit=!1,p}}},8742:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Params=void 0;const l=2147483647;class u{static fromArray(h){const g=new u;if(!h.length)return g;for(let p=Array.isArray(h[0])?1:0;p<h.length;++p){const x=h[p];if(Array.isArray(x))for(let w=0;w<x.length;++w)g.addSubParam(x[w]);else g.addParam(x)}return g}constructor(h=32,g=32){if(this.maxLength=h,this.maxSubParamsLength=g,g>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(h),this.length=0,this._subParams=new Int32Array(g),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(h),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const h=new u(this.maxLength,this.maxSubParamsLength);return h.params.set(this.params),h.length=this.length,h._subParams.set(this._subParams),h._subParamsLength=this._subParamsLength,h._subParamsIdx.set(this._subParamsIdx),h._rejectDigits=this._rejectDigits,h._rejectSubDigits=this._rejectSubDigits,h._digitIsSub=this._digitIsSub,h}toArray(){const h=[];for(let g=0;g<this.length;++g){h.push(this.params[g]);const p=this._subParamsIdx[g]>>8,x=255&this._subParamsIdx[g];x-p>0&&h.push(Array.prototype.slice.call(this._subParams,p,x))}return h}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(h){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(h<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=h>l?l:h}}addSubParam(h){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(h<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=h>l?l:h,this._subParamsIdx[this.length-1]++}}hasSubParams(h){return(255&this._subParamsIdx[h])-(this._subParamsIdx[h]>>8)>0}getSubParams(h){const g=this._subParamsIdx[h]>>8,p=255&this._subParamsIdx[h];return p-g>0?this._subParams.subarray(g,p):null}getSubParamsAll(){const h={};for(let g=0;g<this.length;++g){const p=this._subParamsIdx[g]>>8,x=255&this._subParamsIdx[g];x-p>0&&(h[g]=this._subParams.slice(p,x))}return h}addDigit(h){let g;if(this._rejectDigits||!(g=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const p=this._digitIsSub?this._subParams:this.params,x=p[g-1];p[g-1]=~x?Math.min(10*x+h,l):h}}a.Params=u},5741:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.AddonManager=void 0,a.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let l=this._addons.length-1;l>=0;l--)this._addons[l].instance.dispose()}loadAddon(l,u){const c={instance:u,dispose:u.dispose,isDisposed:!1};this._addons.push(c),u.dispose=()=>this._wrappedAddonDispose(c),u.activate(l)}_wrappedAddonDispose(l){if(l.isDisposed)return;let u=-1;for(let c=0;c<this._addons.length;c++)if(this._addons[c]===l){u=c;break}if(u===-1)throw new Error("Could not dispose an addon that has not been loaded");l.isDisposed=!0,l.dispose.apply(l.instance),this._addons.splice(u,1)}}},8771:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferApiView=void 0;const u=l(3785),c=l(511);a.BufferApiView=class{constructor(h,g){this._buffer=h,this.type=g}init(h){return this._buffer=h,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(h){const g=this._buffer.lines.get(h);if(g)return new u.BufferLineApiView(g)}getNullCell(){return new c.CellData}}},3785:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferLineApiView=void 0;const u=l(511);a.BufferLineApiView=class{constructor(c){this._line=c}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(c,h){if(!(c<0||c>=this._line.length))return h?(this._line.loadCell(c,h),h):this._line.loadCell(c,new u.CellData)}translateToString(c,h,g){return this._line.translateToString(c,h,g)}}},8285:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferNamespaceApi=void 0;const u=l(8771),c=l(8460),h=l(844);class g extends h.Disposable{constructor(x){super(),this._core=x,this._onBufferChange=this.register(new c.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new u.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new u.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}a.BufferNamespaceApi=g},7975:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ParserApi=void 0,a.ParserApi=class{constructor(l){this._core=l}registerCsiHandler(l,u){return this._core.registerCsiHandler(l,(c=>u(c.toArray())))}addCsiHandler(l,u){return this.registerCsiHandler(l,u)}registerDcsHandler(l,u){return this._core.registerDcsHandler(l,((c,h)=>u(c,h.toArray())))}addDcsHandler(l,u){return this.registerDcsHandler(l,u)}registerEscHandler(l,u){return this._core.registerEscHandler(l,u)}addEscHandler(l,u){return this.registerEscHandler(l,u)}registerOscHandler(l,u){return this._core.registerOscHandler(l,u)}addOscHandler(l,u){return this.registerOscHandler(l,u)}}},7090:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.UnicodeApi=void 0,a.UnicodeApi=class{constructor(l){this._core=l}register(l){this._core.unicodeService.register(l)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(l){this._core.unicodeService.activeVersion=l}}},744:function(o,a,l){var u=this&&this.__decorate||function(v,m,y,b){var _,R=arguments.length,E=R<3?m:b===null?b=Object.getOwnPropertyDescriptor(m,y):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(v,m,y,b);else for(var T=v.length-1;T>=0;T--)(_=v[T])&&(E=(R<3?_(E):R>3?_(m,y,E):_(m,y))||E);return R>3&&E&&Object.defineProperty(m,y,E),E},c=this&&this.__param||function(v,m){return function(y,b){m(y,b,v)}};Object.defineProperty(a,"__esModule",{value:!0}),a.BufferService=a.MINIMUM_ROWS=a.MINIMUM_COLS=void 0;const h=l(8460),g=l(844),p=l(5295),x=l(2585);a.MINIMUM_COLS=2,a.MINIMUM_ROWS=1;let w=a.BufferService=class extends g.Disposable{get buffer(){return this.buffers.active}constructor(v){super(),this.isUserScrolling=!1,this._onResize=this.register(new h.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new h.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(v.rawOptions.cols||0,a.MINIMUM_COLS),this.rows=Math.max(v.rawOptions.rows||0,a.MINIMUM_ROWS),this.buffers=this.register(new p.BufferSet(v,this))}resize(v,m){this.cols=v,this.rows=m,this.buffers.resize(v,m),this._onResize.fire({cols:v,rows:m})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(v,m=!1){const y=this.buffer;let b;b=this._cachedBlankLine,b&&b.length===this.cols&&b.getFg(0)===v.fg&&b.getBg(0)===v.bg||(b=y.getBlankLine(v,m),this._cachedBlankLine=b),b.isWrapped=m;const _=y.ybase+y.scrollTop,R=y.ybase+y.scrollBottom;if(y.scrollTop===0){const E=y.lines.isFull;R===y.lines.length-1?E?y.lines.recycle().copyFrom(b):y.lines.push(b.clone()):y.lines.splice(R+1,0,b.clone()),E?this.isUserScrolling&&(y.ydisp=Math.max(y.ydisp-1,0)):(y.ybase++,this.isUserScrolling||y.ydisp++)}else{const E=R-_+1;y.lines.shiftElements(_+1,E-1,-1),y.lines.set(R,b.clone())}this.isUserScrolling||(y.ydisp=y.ybase),this._onScroll.fire(y.ydisp)}scrollLines(v,m,y){const b=this.buffer;if(v<0){if(b.ydisp===0)return;this.isUserScrolling=!0}else v+b.ydisp>=b.ybase&&(this.isUserScrolling=!1);const _=b.ydisp;b.ydisp=Math.max(Math.min(b.ydisp+v,b.ybase),0),_!==b.ydisp&&(m||this._onScroll.fire(b.ydisp))}};a.BufferService=w=u([c(0,x.IOptionsService)],w)},7994:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CharsetService=void 0,a.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(l){this.glevel=l,this.charset=this._charsets[l]}setgCharset(l,u){this._charsets[l]=u,this.glevel===l&&(this.charset=u)}}},1753:function(o,a,l){var u=this&&this.__decorate||function(b,_,R,E){var T,k=arguments.length,N=k<3?_:E===null?E=Object.getOwnPropertyDescriptor(_,R):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(b,_,R,E);else for(var M=b.length-1;M>=0;M--)(T=b[M])&&(N=(k<3?T(N):k>3?T(_,R,N):T(_,R))||N);return k>3&&N&&Object.defineProperty(_,R,N),N},c=this&&this.__param||function(b,_){return function(R,E){_(R,E,b)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CoreMouseService=void 0;const h=l(2585),g=l(8460),p=l(844),x={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:b=>b.button!==4&&b.action===1&&(b.ctrl=!1,b.alt=!1,b.shift=!1,!0)},VT200:{events:19,restrict:b=>b.action!==32},DRAG:{events:23,restrict:b=>b.action!==32||b.button!==3},ANY:{events:31,restrict:b=>!0}};function w(b,_){let R=(b.ctrl?16:0)|(b.shift?4:0)|(b.alt?8:0);return b.button===4?(R|=64,R|=b.action):(R|=3&b.button,4&b.button&&(R|=64),8&b.button&&(R|=128),b.action===32?R|=32:b.action!==0||_||(R|=3)),R}const v=String.fromCharCode,m={DEFAULT:b=>{const _=[w(b,!1)+32,b.col+32,b.row+32];return _[0]>255||_[1]>255||_[2]>255?"":`\x1B[M${v(_[0])}${v(_[1])}${v(_[2])}`},SGR:b=>{const _=b.action===0&&b.button!==4?"m":"M";return`\x1B[<${w(b,!0)};${b.col};${b.row}${_}`},SGR_PIXELS:b=>{const _=b.action===0&&b.button!==4?"m":"M";return`\x1B[<${w(b,!0)};${b.x};${b.y}${_}`}};let y=a.CoreMouseService=class extends p.Disposable{constructor(b,_){super(),this._bufferService=b,this._coreService=_,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new g.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const R of Object.keys(x))this.addProtocol(R,x[R]);for(const R of Object.keys(m))this.addEncoding(R,m[R]);this.reset()}addProtocol(b,_){this._protocols[b]=_}addEncoding(b,_){this._encodings[b]=_}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(b){if(!this._protocols[b])throw new Error(`unknown protocol "${b}"`);this._activeProtocol=b,this._onProtocolChange.fire(this._protocols[b].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(b){if(!this._encodings[b])throw new Error(`unknown encoding "${b}"`);this._activeEncoding=b}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(b){if(b.col<0||b.col>=this._bufferService.cols||b.row<0||b.row>=this._bufferService.rows||b.button===4&&b.action===32||b.button===3&&b.action!==32||b.button!==4&&(b.action===2||b.action===3)||(b.col++,b.row++,b.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,b,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(b))return!1;const _=this._encodings[this._activeEncoding](b);return _&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(_):this._coreService.triggerDataEvent(_,!0)),this._lastEvent=b,!0}explainEvents(b){return{down:!!(1&b),up:!!(2&b),drag:!!(4&b),move:!!(8&b),wheel:!!(16&b)}}_equalEvents(b,_,R){if(R){if(b.x!==_.x||b.y!==_.y)return!1}else if(b.col!==_.col||b.row!==_.row)return!1;return b.button===_.button&&b.action===_.action&&b.ctrl===_.ctrl&&b.alt===_.alt&&b.shift===_.shift}};a.CoreMouseService=y=u([c(0,h.IBufferService),c(1,h.ICoreService)],y)},6975:function(o,a,l){var u=this&&this.__decorate||function(y,b,_,R){var E,T=arguments.length,k=T<3?b:R===null?R=Object.getOwnPropertyDescriptor(b,_):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(y,b,_,R);else for(var N=y.length-1;N>=0;N--)(E=y[N])&&(k=(T<3?E(k):T>3?E(b,_,k):E(b,_))||k);return T>3&&k&&Object.defineProperty(b,_,k),k},c=this&&this.__param||function(y,b){return function(_,R){b(_,R,y)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CoreService=void 0;const h=l(1439),g=l(8460),p=l(844),x=l(2585),w=Object.freeze({insertMode:!1}),v=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let m=a.CoreService=class extends p.Disposable{constructor(y,b,_){super(),this._bufferService=y,this._logService=b,this._optionsService=_,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new g.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new g.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new g.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new g.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,h.clone)(w),this.decPrivateModes=(0,h.clone)(v)}reset(){this.modes=(0,h.clone)(w),this.decPrivateModes=(0,h.clone)(v)}triggerDataEvent(y,b=!1){if(this._optionsService.rawOptions.disableStdin)return;const _=this._bufferService.buffer;b&&this._optionsService.rawOptions.scrollOnUserInput&&_.ybase!==_.ydisp&&this._onRequestScrollToBottom.fire(),b&&this._onUserInput.fire(),this._logService.debug(`sending data "${y}"`,(()=>y.split("").map((R=>R.charCodeAt(0))))),this._onData.fire(y)}triggerBinaryEvent(y){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${y}"`,(()=>y.split("").map((b=>b.charCodeAt(0))))),this._onBinary.fire(y))}};a.CoreService=m=u([c(0,x.IBufferService),c(1,x.ILogService),c(2,x.IOptionsService)],m)},9074:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.DecorationService=void 0;const u=l(8055),c=l(8460),h=l(844),g=l(6106);let p=0,x=0;class w extends h.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new g.SortedList((y=>y==null?void 0:y.marker.line)),this._onDecorationRegistered=this.register(new c.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new c.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,h.toDisposable)((()=>this.reset())))}registerDecoration(y){if(y.marker.isDisposed)return;const b=new v(y);if(b){const _=b.marker.onDispose((()=>b.dispose()));b.onDispose((()=>{b&&(this._decorations.delete(b)&&this._onDecorationRemoved.fire(b),_.dispose())})),this._decorations.insert(b),this._onDecorationRegistered.fire(b)}return b}reset(){for(const y of this._decorations.values())y.dispose();this._decorations.clear()}*getDecorationsAtCell(y,b,_){let R=0,E=0;for(const T of this._decorations.getKeyIterator(b))R=T.options.x??0,E=R+(T.options.width??1),y>=R&&y<E&&(!_||(T.options.layer??"bottom")===_)&&(yield T)}forEachDecorationAtCell(y,b,_,R){this._decorations.forEachByKey(b,(E=>{p=E.options.x??0,x=p+(E.options.width??1),y>=p&&y<x&&(!_||(E.options.layer??"bottom")===_)&&R(E)}))}}a.DecorationService=w;class v extends h.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=u.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=u.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(y){super(),this.options=y,this.onRenderEmitter=this.register(new c.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new c.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=y.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.InstantiationService=a.ServiceCollection=void 0;const u=l(2585),c=l(8343);class h{constructor(...p){this._entries=new Map;for(const[x,w]of p)this.set(x,w)}set(p,x){const w=this._entries.get(p);return this._entries.set(p,x),w}forEach(p){for(const[x,w]of this._entries.entries())p(x,w)}has(p){return this._entries.has(p)}get(p){return this._entries.get(p)}}a.ServiceCollection=h,a.InstantiationService=class{constructor(){this._services=new h,this._services.set(u.IInstantiationService,this)}setService(g,p){this._services.set(g,p)}getService(g){return this._services.get(g)}createInstance(g,...p){const x=(0,c.getServiceDependencies)(g).sort(((m,y)=>m.index-y.index)),w=[];for(const m of x){const y=this._services.get(m.id);if(!y)throw new Error(`[createInstance] ${g.name} depends on UNKNOWN service ${m.id}.`);w.push(y)}const v=x.length>0?x[0].index:p.length;if(p.length!==v)throw new Error(`[createInstance] First service dependency of ${g.name} at position ${v+1} conflicts with ${p.length} static arguments`);return new g(...p,...w)}}},7866:function(o,a,l){var u=this&&this.__decorate||function(v,m,y,b){var _,R=arguments.length,E=R<3?m:b===null?b=Object.getOwnPropertyDescriptor(m,y):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(v,m,y,b);else for(var T=v.length-1;T>=0;T--)(_=v[T])&&(E=(R<3?_(E):R>3?_(m,y,E):_(m,y))||E);return R>3&&E&&Object.defineProperty(m,y,E),E},c=this&&this.__param||function(v,m){return function(y,b){m(y,b,v)}};Object.defineProperty(a,"__esModule",{value:!0}),a.traceCall=a.setTraceLogger=a.LogService=void 0;const h=l(844),g=l(2585),p={trace:g.LogLevelEnum.TRACE,debug:g.LogLevelEnum.DEBUG,info:g.LogLevelEnum.INFO,warn:g.LogLevelEnum.WARN,error:g.LogLevelEnum.ERROR,off:g.LogLevelEnum.OFF};let x,w=a.LogService=class extends h.Disposable{get logLevel(){return this._logLevel}constructor(v){super(),this._optionsService=v,this._logLevel=g.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),x=this}_updateLogLevel(){this._logLevel=p[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(v){for(let m=0;m<v.length;m++)typeof v[m]=="function"&&(v[m]=v[m]())}_log(v,m,y){this._evalLazyOptionalParams(y),v.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+m,...y)}trace(v,...m){var y;this._logLevel<=g.LogLevelEnum.TRACE&&this._log(((y=this._optionsService.options.logger)==null?void 0:y.trace.bind(this._optionsService.options.logger))??console.log,v,m)}debug(v,...m){var y;this._logLevel<=g.LogLevelEnum.DEBUG&&this._log(((y=this._optionsService.options.logger)==null?void 0:y.debug.bind(this._optionsService.options.logger))??console.log,v,m)}info(v,...m){var y;this._logLevel<=g.LogLevelEnum.INFO&&this._log(((y=this._optionsService.options.logger)==null?void 0:y.info.bind(this._optionsService.options.logger))??console.info,v,m)}warn(v,...m){var y;this._logLevel<=g.LogLevelEnum.WARN&&this._log(((y=this._optionsService.options.logger)==null?void 0:y.warn.bind(this._optionsService.options.logger))??console.warn,v,m)}error(v,...m){var y;this._logLevel<=g.LogLevelEnum.ERROR&&this._log(((y=this._optionsService.options.logger)==null?void 0:y.error.bind(this._optionsService.options.logger))??console.error,v,m)}};a.LogService=w=u([c(0,g.IOptionsService)],w),a.setTraceLogger=function(v){x=v},a.traceCall=function(v,m,y){if(typeof y.value!="function")throw new Error("not supported");const b=y.value;y.value=function(..._){if(x.logLevel!==g.LogLevelEnum.TRACE)return b.apply(this,_);x.trace(`GlyphRenderer#${b.name}(${_.map((E=>JSON.stringify(E))).join(", ")})`);const R=b.apply(this,_);return x.trace(`GlyphRenderer#${b.name} return`,R),R}}},7302:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.OptionsService=a.DEFAULT_OPTIONS=void 0;const u=l(8460),c=l(844),h=l(6114);a.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:h.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const g=["normal","bold","100","200","300","400","500","600","700","800","900"];class p extends c.Disposable{constructor(w){super(),this._onOptionChange=this.register(new u.EventEmitter),this.onOptionChange=this._onOptionChange.event;const v={...a.DEFAULT_OPTIONS};for(const m in w)if(m in v)try{const y=w[m];v[m]=this._sanitizeAndValidateOption(m,y)}catch(y){console.error(y)}this.rawOptions=v,this.options={...v},this._setupOptions(),this.register((0,c.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(w,v){return this.onOptionChange((m=>{m===w&&v(this.rawOptions[w])}))}onMultipleOptionChange(w,v){return this.onOptionChange((m=>{w.indexOf(m)!==-1&&v()}))}_setupOptions(){const w=m=>{if(!(m in a.DEFAULT_OPTIONS))throw new Error(`No option with key "${m}"`);return this.rawOptions[m]},v=(m,y)=>{if(!(m in a.DEFAULT_OPTIONS))throw new Error(`No option with key "${m}"`);y=this._sanitizeAndValidateOption(m,y),this.rawOptions[m]!==y&&(this.rawOptions[m]=y,this._onOptionChange.fire(m))};for(const m in this.rawOptions){const y={get:w.bind(this,m),set:v.bind(this,m)};Object.defineProperty(this.options,m,y)}}_sanitizeAndValidateOption(w,v){switch(w){case"cursorStyle":if(v||(v=a.DEFAULT_OPTIONS[w]),!(function(m){return m==="block"||m==="underline"||m==="bar"})(v))throw new Error(`"${v}" is not a valid value for ${w}`);break;case"wordSeparator":v||(v=a.DEFAULT_OPTIONS[w]);break;case"fontWeight":case"fontWeightBold":if(typeof v=="number"&&1<=v&&v<=1e3)break;v=g.includes(v)?v:a.DEFAULT_OPTIONS[w];break;case"cursorWidth":v=Math.floor(v);case"lineHeight":case"tabStopWidth":if(v<1)throw new Error(`${w} cannot be less than 1, value: ${v}`);break;case"minimumContrastRatio":v=Math.max(1,Math.min(21,Math.round(10*v)/10));break;case"scrollback":if((v=Math.min(v,4294967295))<0)throw new Error(`${w} cannot be less than 0, value: ${v}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(v<=0)throw new Error(`${w} cannot be less than or equal to 0, value: ${v}`);break;case"rows":case"cols":if(!v&&v!==0)throw new Error(`${w} must be numeric, value: ${v}`);break;case"windowsPty":v=v??{}}return v}}a.OptionsService=p},2660:function(o,a,l){var u=this&&this.__decorate||function(p,x,w,v){var m,y=arguments.length,b=y<3?x:v===null?v=Object.getOwnPropertyDescriptor(x,w):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(p,x,w,v);else for(var _=p.length-1;_>=0;_--)(m=p[_])&&(b=(y<3?m(b):y>3?m(x,w,b):m(x,w))||b);return y>3&&b&&Object.defineProperty(x,w,b),b},c=this&&this.__param||function(p,x){return function(w,v){x(w,v,p)}};Object.defineProperty(a,"__esModule",{value:!0}),a.OscLinkService=void 0;const h=l(2585);let g=a.OscLinkService=class{constructor(p){this._bufferService=p,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(p){const x=this._bufferService.buffer;if(p.id===void 0){const _=x.addMarker(x.ybase+x.y),R={data:p,id:this._nextId++,lines:[_]};return _.onDispose((()=>this._removeMarkerFromLink(R,_))),this._dataByLinkId.set(R.id,R),R.id}const w=p,v=this._getEntryIdKey(w),m=this._entriesWithId.get(v);if(m)return this.addLineToLink(m.id,x.ybase+x.y),m.id;const y=x.addMarker(x.ybase+x.y),b={id:this._nextId++,key:this._getEntryIdKey(w),data:w,lines:[y]};return y.onDispose((()=>this._removeMarkerFromLink(b,y))),this._entriesWithId.set(b.key,b),this._dataByLinkId.set(b.id,b),b.id}addLineToLink(p,x){const w=this._dataByLinkId.get(p);if(w&&w.lines.every((v=>v.line!==x))){const v=this._bufferService.buffer.addMarker(x);w.lines.push(v),v.onDispose((()=>this._removeMarkerFromLink(w,v)))}}getLinkData(p){var x;return(x=this._dataByLinkId.get(p))==null?void 0:x.data}_getEntryIdKey(p){return`${p.id};;${p.uri}`}_removeMarkerFromLink(p,x){const w=p.lines.indexOf(x);w!==-1&&(p.lines.splice(w,1),p.lines.length===0&&(p.data.id!==void 0&&this._entriesWithId.delete(p.key),this._dataByLinkId.delete(p.id)))}};a.OscLinkService=g=u([c(0,h.IBufferService)],g)},8343:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.createDecorator=a.getServiceDependencies=a.serviceRegistry=void 0;const l="di$target",u="di$dependencies";a.serviceRegistry=new Map,a.getServiceDependencies=function(c){return c[u]||[]},a.createDecorator=function(c){if(a.serviceRegistry.has(c))return a.serviceRegistry.get(c);const h=function(g,p,x){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(w,v,m){v[l]===v?v[u].push({id:w,index:m}):(v[u]=[{id:w,index:m}],v[l]=v)})(h,g,x)};return h.toString=()=>c,a.serviceRegistry.set(c,h),h}},2585:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.IDecorationService=a.IUnicodeService=a.IOscLinkService=a.IOptionsService=a.ILogService=a.LogLevelEnum=a.IInstantiationService=a.ICharsetService=a.ICoreService=a.ICoreMouseService=a.IBufferService=void 0;const u=l(8343);var c;a.IBufferService=(0,u.createDecorator)("BufferService"),a.ICoreMouseService=(0,u.createDecorator)("CoreMouseService"),a.ICoreService=(0,u.createDecorator)("CoreService"),a.ICharsetService=(0,u.createDecorator)("CharsetService"),a.IInstantiationService=(0,u.createDecorator)("InstantiationService"),(function(h){h[h.TRACE=0]="TRACE",h[h.DEBUG=1]="DEBUG",h[h.INFO=2]="INFO",h[h.WARN=3]="WARN",h[h.ERROR=4]="ERROR",h[h.OFF=5]="OFF"})(c||(a.LogLevelEnum=c={})),a.ILogService=(0,u.createDecorator)("LogService"),a.IOptionsService=(0,u.createDecorator)("OptionsService"),a.IOscLinkService=(0,u.createDecorator)("OscLinkService"),a.IUnicodeService=(0,u.createDecorator)("UnicodeService"),a.IDecorationService=(0,u.createDecorator)("DecorationService")},1480:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.UnicodeService=void 0;const u=l(8460),c=l(225);class h{static extractShouldJoin(p){return(1&p)!=0}static extractWidth(p){return p>>1&3}static extractCharKind(p){return p>>3}static createPropertyValue(p,x,w=!1){return(16777215&p)<<3|(3&x)<<1|(w?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new u.EventEmitter,this.onChange=this._onChange.event;const p=new c.UnicodeV6;this.register(p),this._active=p.version,this._activeProvider=p}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(p){if(!this._providers[p])throw new Error(`unknown Unicode version "${p}"`);this._active=p,this._activeProvider=this._providers[p],this._onChange.fire(p)}register(p){this._providers[p.version]=p}wcwidth(p){return this._activeProvider.wcwidth(p)}getStringCellWidth(p){let x=0,w=0;const v=p.length;for(let m=0;m<v;++m){let y=p.charCodeAt(m);if(55296<=y&&y<=56319){if(++m>=v)return x+this.wcwidth(y);const R=p.charCodeAt(m);56320<=R&&R<=57343?y=1024*(y-55296)+R-56320+65536:x+=this.wcwidth(R)}const b=this.charProperties(y,w);let _=h.extractWidth(b);h.extractShouldJoin(b)&&(_-=h.extractWidth(w)),x+=_,w=b}return x}charProperties(p,x){return this._activeProvider.charProperties(p,x)}}a.UnicodeService=h}},n={};function i(o){var a=n[o];if(a!==void 0)return a.exports;var l=n[o]={exports:{}};return r[o].call(l.exports,l,l.exports,i),l.exports}var s={};return(()=>{var o=s;Object.defineProperty(o,"__esModule",{value:!0}),o.Terminal=void 0;const a=i(9042),l=i(3236),u=i(844),c=i(5741),h=i(8285),g=i(7975),p=i(7090),x=["cols","rows"];class w extends u.Disposable{constructor(m){super(),this._core=this.register(new l.Terminal(m)),this._addonManager=this.register(new c.AddonManager),this._publicOptions={...this._core.options};const y=_=>this._core.options[_],b=(_,R)=>{this._checkReadonlyOptions(_),this._core.options[_]=R};for(const _ in this._core.options){const R={get:y.bind(this,_),set:b.bind(this,_)};Object.defineProperty(this._publicOptions,_,R)}}_checkReadonlyOptions(m){if(x.includes(m))throw new Error(`Option "${m}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new g.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new p.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new h.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const m=this._core.coreService.decPrivateModes;let y="none";switch(this._core.coreMouseService.activeProtocol){case"X10":y="x10";break;case"VT200":y="vt200";break;case"DRAG":y="drag";break;case"ANY":y="any"}return{applicationCursorKeysMode:m.applicationCursorKeys,applicationKeypadMode:m.applicationKeypad,bracketedPasteMode:m.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:y,originMode:m.origin,reverseWraparoundMode:m.reverseWraparound,sendFocusMode:m.sendFocus,wraparoundMode:m.wraparound}}get options(){return this._publicOptions}set options(m){for(const y in m)this._publicOptions[y]=m[y]}blur(){this._core.blur()}focus(){this._core.focus()}input(m,y=!0){this._core.input(m,y)}resize(m,y){this._verifyIntegers(m,y),this._core.resize(m,y)}open(m){this._core.open(m)}attachCustomKeyEventHandler(m){this._core.attachCustomKeyEventHandler(m)}attachCustomWheelEventHandler(m){this._core.attachCustomWheelEventHandler(m)}registerLinkProvider(m){return this._core.registerLinkProvider(m)}registerCharacterJoiner(m){return this._checkProposedApi(),this._core.registerCharacterJoiner(m)}deregisterCharacterJoiner(m){this._checkProposedApi(),this._core.deregisterCharacterJoiner(m)}registerMarker(m=0){return this._verifyIntegers(m),this._core.registerMarker(m)}registerDecoration(m){return this._checkProposedApi(),this._verifyPositiveIntegers(m.x??0,m.width??0,m.height??0),this._core.registerDecoration(m)}hasSelection(){return this._core.hasSelection()}select(m,y,b){this._verifyIntegers(m,y,b),this._core.select(m,y,b)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(m,y){this._verifyIntegers(m,y),this._core.selectLines(m,y)}dispose(){super.dispose()}scrollLines(m){this._verifyIntegers(m),this._core.scrollLines(m)}scrollPages(m){this._verifyIntegers(m),this._core.scrollPages(m)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(m){this._verifyIntegers(m),this._core.scrollToLine(m)}clear(){this._core.clear()}write(m,y){this._core.write(m,y)}writeln(m,y){this._core.write(m),this._core.write(`\r
383
+ `,y)}paste(m){this._core.paste(m)}refresh(m,y){this._verifyIntegers(m,y),this._core.refresh(m,y)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(m){this._addonManager.loadAddon(this,m)}static get strings(){return a}_verifyIntegers(...m){for(const y of m)if(y===1/0||isNaN(y)||y%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...m){for(const y of m)if(y&&(y===1/0||isNaN(y)||y%1!=0||y<0))throw new Error("This API only accepts positive integers")}}o.Terminal=w})(),s})()))})(Bp)),Bp.exports}var eS=AA(),Fp={exports:{}},tb;function MA(){return tb||(tb=1,(function(t,e){(function(r,n){t.exports=n()})(self,(()=>(()=>{var r={};return(()=>{var n=r;Object.defineProperty(n,"__esModule",{value:!0}),n.FitAddon=void 0,n.FitAddon=class{activate(i){this._terminal=i}dispose(){}fit(){const i=this.proposeDimensions();if(!i||!this._terminal||isNaN(i.cols)||isNaN(i.rows))return;const s=this._terminal._core;this._terminal.rows===i.rows&&this._terminal.cols===i.cols||(s._renderService.clear(),this._terminal.resize(i.cols,i.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const i=this._terminal._core,s=i._renderService.dimensions;if(s.css.cell.width===0||s.css.cell.height===0)return;const o=this._terminal.options.scrollback===0?0:i.viewport.scrollBarWidth,a=window.getComputedStyle(this._terminal.element.parentElement),l=parseInt(a.getPropertyValue("height")),u=Math.max(0,parseInt(a.getPropertyValue("width"))),c=window.getComputedStyle(this._terminal.element),h=l-(parseInt(c.getPropertyValue("padding-top"))+parseInt(c.getPropertyValue("padding-bottom"))),g=u-(parseInt(c.getPropertyValue("padding-right"))+parseInt(c.getPropertyValue("padding-left")))-o;return{cols:Math.max(2,Math.floor(g/s.css.cell.width)),rows:Math.max(1,Math.floor(h/s.css.cell.height))}}}})(),r})()))})(Fp)),Fp.exports}var tS=MA();function PA({cwd:t,cmd:e,governed:r=!0}){const n=ae.useRef(null),i=ae.useRef({cwd:t,cmd:e,governed:r});return i.current={cwd:t,cmd:e,governed:r},ae.useEffect(()=>{const s=n.current;if(!s)return;let o=!1,a,l;const u=new eS.Terminal({convertEol:!1,cursorBlink:!0,fontSize:12,fontFamily:'"JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace',theme:{background:"#0d1117",foreground:"#e6edf3",cursor:"#ffda19",cursorAccent:"#0d1117"}}),c=new tS.FitAddon;u.loadAddon(c);const h=u.onData(x=>{a&&a.readyState===WebSocket.OPEN&&a.send(x)}),g=typeof ResizeObserver<"u"?new ResizeObserver(()=>{try{c.fit()}catch{}l&&lt.resizeTerminal(l,u.cols,u.rows).catch(()=>{})}):void 0,p=requestAnimationFrame(()=>{if(!o){u.open(s);try{c.fit()}catch{}g==null||g.observe(s),(async()=>{const x=i.current;let w;try{const m={cwd:x.cwd,cols:u.cols,rows:u.rows,governed:x.governed};x.cmd!==void 0&&(m.cmd=x.cmd),w=(await lt.openTerminal(m)).id}catch(m){const y=m instanceof Error?m.message:String(m);u.write(`\r
384
+ \x1B[31m[failed to open terminal: ${y}]\x1B[0m\r
385
+ `);return}if(o){lt.closeTerminal(w).catch(()=>{});return}l=w;const v=new WebSocket(tw(w));v.binaryType="arraybuffer",v.onmessage=m=>{typeof m.data=="string"?u.write(m.data):u.write(new Uint8Array(m.data))},a=v})()}});return()=>{o=!0,cancelAnimationFrame(p),g==null||g.disconnect(),h.dispose();try{a==null||a.close()}catch{}l&&lt.closeTerminal(l).catch(()=>{}),u.dispose()}},[]),C.jsxs("div",{"data-testid":"terminal",className:"flex flex-col gap-1",children:[C.jsxs("div",{className:"flex items-center justify-between text-[11px]",children:[C.jsx("span",{className:"font-semibold font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Terminal"}),C.jsx("span",{"data-testid":"terminal-governed",style:{color:r?"rgba(230,237,243,0.35)":"#ffda19",fontWeight:r?void 0:600},children:r?"governed":"ungoverned operator shell"})]}),C.jsx("div",{ref:n,"data-testid":"terminal-host",className:"h-64 w-full overflow-hidden rounded p-1",style:{background:"#0d1117"}})]})}function Go({label:t,value:e,mono:r}){return C.jsxs("div",{className:"flex gap-2 text-[11px]",children:[C.jsx("span",{className:"w-20 shrink-0 font-mono",style:{color:"rgba(230,237,243,0.4)"},children:t}),C.jsx("span",{className:r?"font-mono break-all":"",style:{color:"rgba(230,237,243,0.7)"},children:e})]})}function IA({model:t}){const{session:e}=t;return C.jsxs("div",{"data-testid":"what-where",className:"flex flex-col gap-1.5",children:[C.jsx(Go,{label:"intent",value:e.problem}),C.jsx(Go,{label:"repo",value:e.repo_ref??"—",mono:!0}),C.jsx(Go,{label:"worktree",value:e.workdir??"—",mono:!0}),C.jsx(Go,{label:"roster",value:e.clis.length>0?e.clis.join(", "):"—",mono:!0}),C.jsx(Go,{label:"entity",value:e.entity_mode}),C.jsxs("div",{className:"mt-1 rounded p-1.5 text-[10px] font-mono",style:{border:"1px dashed rgba(230,237,243,0.12)",color:"rgba(230,237,243,0.35)"},children:["diff: not exposed on the run DTO (",C.jsx("code",{children:"work_output"})," pending daemon surface)"]})]})}const OA=[{id:"whatwhere",label:"What / Where"},{id:"decisions",label:"Decisions"},{id:"governance",label:"Governance"},{id:"burn",label:"Burn"},{id:"data",label:"Data"},{id:"steering",label:"Steering"},{id:"assumptions",label:"Assumptions"},{id:"files",label:"Files"}],BA=new Set(["Write","Edit","MultiEdit","NotebookEdit"]),FA=new Set(["DeleteFile","Remove"]);function jp({path:t,opKind:e}){const[r,n]=ae.useState(!1),i=ae.useRef(null);ae.useEffect(()=>()=>{i.current!==null&&clearTimeout(i.current)},[]);const s=t.replace(/\\/g,"/").split("/"),o=s.pop()??t,a=s.length>0?`${s.join("/")}/`:"",l=e==="delete"?"−":e==="write"?"±":"~",u=e==="delete"?"#f85149":e==="write"?"#ffda19":"rgba(230,237,243,0.25)",c=e==="delete"?"#f85149":"#e6edf3";function h(){navigator.clipboard.writeText(t).then(()=>{n(!0),i.current!==null&&clearTimeout(i.current),i.current=setTimeout(()=>{n(!1),i.current=null},1500)}).catch(()=>{})}return C.jsxs("li",{title:r?"Copied!":t,className:"flex items-start gap-1.5 min-w-0",children:[C.jsx("span",{className:"shrink-0 mt-0.5 text-[9px] font-mono select-none",style:{color:u},children:l}),C.jsxs("button",{type:"button",onClick:h,className:"min-w-0 leading-5 font-mono text-[10px] break-all text-left transition-opacity hover:opacity-70",title:r?"Copied!":`Click to copy: ${t}`,style:{background:"none",border:"none",padding:0,cursor:"pointer"},children:[a&&C.jsx("span",{style:{color:"rgba(230,237,243,0.3)"},children:a}),C.jsx("span",{style:{color:c},children:o}),r&&C.jsx("span",{className:"ml-1 text-[9px]",style:{color:"#3fb950"},children:"✓"})]})]})}function jA({model:t}){const e=new Set,r=new Set;for(const p of t.units)for(const x of p.hookFires)BA.has(x.toolName)&&e.add(p.ord),FA.has(x.toolName)&&r.add(p.ord);const n=new Set,i=new Set,s=new Set;for(const p of t.units)for(const x of p.filesRead)s.add(x),r.has(p.ord)?i.add(x):e.has(p.ord)&&n.add(x);for(const p of i)n.delete(p);const o=new Set;for(const p of s)!n.has(p)&&!i.has(p)&&o.add(p);const a=n.size>0||i.size>0,l=s.size>0,u=!["completed","cancelled","failed"].includes(t.session.status);if(!l)return C.jsx("p",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.35)"},children:u?"No files changed yet.":"No files changed."});const c=[...n].sort(),h=[...i].sort(),g=[...o].sort();return C.jsxs("div",{className:"flex flex-col gap-4",children:[(a||u)&&C.jsxs("div",{children:[C.jsx("p",{className:"text-[10px] font-mono mb-2 uppercase tracking-wider",style:{color:"rgba(230,237,243,0.3)"},children:"Modified / Created"}),a?C.jsxs("ul",{className:"flex flex-col gap-1",children:[c.map(p=>C.jsx(jp,{path:p,opKind:"write"},p)),h.map(p=>C.jsx(jp,{path:p,opKind:"delete"},p))]}):C.jsx("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.3)"},children:"No files changed yet."})]}),g.length>0&&C.jsxs("div",{children:[C.jsx("p",{className:"text-[10px] font-mono mb-2 uppercase tracking-wider",style:{color:"rgba(230,237,243,0.3)"},children:"Referenced"}),C.jsx("ul",{className:"flex flex-col gap-1",children:g.map(p=>C.jsx(jp,{path:p},p))})]}),C.jsxs("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.2)"},children:[s.size," file",s.size!==1?"s":""," total"]})]})}const zA=new Set(["executing","distributing","planning"]);function HA({view:t}){const[e,r]=ae.useState(!1),[n,i]=ae.useState("whatwhere"),[s,o]=ae.useState(!1),[a,l]=ae.useState(!1),[u,c]=ae.useState(""),[h,g]=ae.useState(!1),[p,x]=ae.useState(null),w=ae.useRef(null),v=ae.useRef(!1),{session:m}=t,y=mA(m.id,t),b=zA.has(m.status),_=y?new Set(y.units.flatMap(E=>E.filesRead)).size:null;function R(E){i(T=>T===E?null:E)}return e?C.jsxs("div",{className:"flex flex-col items-center w-10 shrink-0 py-3 gap-2",style:{background:"#0c1015",borderLeft:"1px solid rgba(230,237,243,0.07)"},children:[C.jsx("button",{type:"button",onClick:()=>r(!1),className:"text-sm leading-none",style:{color:"rgba(230,237,243,0.4)"},"aria-label":"Expand insights panel",children:"‹"}),C.jsx("button",{type:"button",onClick:()=>o(!0),title:"Terminal","aria-label":"Open terminal",className:"w-7 h-7 flex items-center justify-center rounded text-sm",style:{color:"rgba(230,237,243,0.4)"},children:"⬛"}),C.jsx("button",{type:"button",onClick:()=>l(!0),title:"Coverage","aria-label":"Open coverage",className:"w-7 h-7 flex items-center justify-center rounded text-sm font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"%"})]}):C.jsxs("div",{className:"flex flex-col w-72 shrink-0 overflow-hidden",style:{background:"#0c1015",borderLeft:"1px solid rgba(230,237,243,0.07)"},children:[C.jsxs("div",{className:"flex items-center gap-1 px-3 py-2 border-b shrink-0",style:{background:"#090d12",borderColor:"rgba(230,237,243,0.07)"},children:[C.jsxs("button",{type:"button",onClick:()=>r(!0),className:"flex items-center gap-1.5 flex-1 min-w-0 text-left","aria-label":"Collapse insights panel",children:[C.jsx("span",{className:"text-sm leading-none shrink-0",style:{color:"rgba(230,237,243,0.35)"},children:"›"}),C.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-widest font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Insights"})]}),C.jsx("button",{type:"button",onClick:()=>o(!0),title:"Terminal","aria-label":"Open terminal",className:"rounded px-2 py-0.5 text-[11px] font-mono",style:{color:"rgba(230,237,243,0.45)"},children:"Term"}),C.jsx("button",{type:"button",onClick:()=>l(!0),title:"Coverage","aria-label":"Open coverage report",className:"rounded px-2 py-0.5 text-[11px] font-mono",style:{color:"rgba(230,237,243,0.45)"},children:"Cov"})]}),C.jsx("div",{className:"flex-1 overflow-y-auto",children:OA.map(({id:E,label:T})=>C.jsxs("div",{style:{borderBottom:"1px solid rgba(230,237,243,0.06)"},children:[C.jsxs("button",{type:"button",onClick:()=>R(E),className:"w-full flex items-center justify-between px-4 py-2.5 text-left transition-colors",style:{color:n===E?"#e6edf3":"rgba(230,237,243,0.55)"},onMouseEnter:k=>{k.currentTarget.style.background="rgba(230,237,243,0.04)"},onMouseLeave:k=>{k.currentTarget.style.background="transparent"},"aria-expanded":n===E,children:[C.jsxs("div",{className:"flex items-center gap-1.5",children:[C.jsx("span",{className:"text-xs font-medium font-mono",children:T}),E==="files"&&_!==null&&_>0&&C.jsx("span",{className:"text-[9px] font-mono px-1 py-0.5 rounded",style:{background:"rgba(121,192,255,0.12)",color:"#79c0ff"},children:_})]}),C.jsx("span",{className:"text-xs",style:{color:"rgba(230,237,243,0.3)"},children:n===E?"▲":"▼"})]}),n===E&&y&&C.jsxs("div",{className:"px-4 py-3",style:{background:"#0a0d12"},children:[E==="decisions"&&C.jsx(kA,{model:y}),E==="governance"&&C.jsx(LA,{model:y}),E==="burn"&&C.jsx(_A,{model:y}),E==="data"&&C.jsx(SA,{model:y}),E==="steering"&&C.jsx(DA,{runId:y.session.id}),E==="whatwhere"&&C.jsx(IA,{model:y}),E==="assumptions"&&C.jsx(xA,{model:y}),E==="files"&&C.jsx(jA,{model:y})]}),n===E&&!y&&C.jsx("div",{className:"px-4 py-3",children:C.jsx("p",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.35)"},children:"Loading…"})})]},E))}),b&&C.jsxs("div",{className:"shrink-0 px-3 py-2 flex flex-col gap-1.5",style:{borderTop:"1px solid rgba(230,237,243,0.07)",background:"#090d12"},children:[C.jsx("p",{className:"text-[9px] font-mono uppercase tracking-widest",style:{color:"rgba(230,237,243,0.3)"},children:"Steer"}),C.jsxs("form",{onSubmit:E=>{E.preventDefault();const T=u.trim();!T||v.current||(v.current=!0,g(!0),x(null),lt.injectMessage(m.id,T,"all").then(()=>{c("")}).catch(k=>{const N=k instanceof Error?k.message:String(k);x(N||"Failed to send instruction — please try again.")}).finally(()=>{v.current=!1,g(!1)}))},className:"flex flex-col gap-1",children:[C.jsxs("div",{className:"flex gap-1.5",children:[C.jsx("textarea",{ref:w,value:u,onChange:E=>{c(E.target.value),x(null)},onKeyDown:E=>{var T;E.key==="Enter"&&!E.shiftKey&&!E.nativeEvent.isComposing&&(E.preventDefault(),(T=E.currentTarget.form)==null||T.requestSubmit())},"aria-label":"Steering instruction",rows:2,placeholder:"Send instruction to agents…",disabled:h,className:"flex-1 resize-none rounded text-[11px] font-mono px-2 py-1.5 leading-relaxed",style:{background:"rgba(230,237,243,0.05)",border:"1px solid rgba(230,237,243,0.1)",color:"#e6edf3",outline:"none",minHeight:0}}),C.jsx("button",{type:"submit","aria-label":h?"Sending…":"Send steering instruction",disabled:h||!u.trim(),className:"shrink-0 self-end rounded px-2 py-1 text-[11px] font-mono font-medium transition-opacity disabled:opacity-30",style:{background:"rgba(121,192,255,0.15)",color:"#79c0ff",border:"1px solid rgba(121,192,255,0.2)"},children:h?"…":"↑"})]}),p&&C.jsx("p",{className:"text-[10px] font-mono",style:{color:"#f85149"},children:p})]})]}),s&&C.jsx(J1,{title:"Operator shell",onClose:()=>o(!1),disableEscapeKey:!0,children:C.jsx(PA,{cwd:m.workdir??".",governed:!0})}),a&&C.jsx(J1,{title:"Coverage report",onClose:()=>l(!1),children:C.jsx(iw,{})})]})}const rS={critical:"#f85149",error:"#f97316",warn:"#ffda19",info:"rgba(230,237,243,0.5)"},UA={id:"",rule_type:"pattern",statement:"",severity:"warn",confidence:.9,targets:{},provenance:{source:"manual",source_kinds:["policy"]}};function WA({rule:t,onEdit:e}){var r,n,i;return C.jsxs("tr",{className:"text-[11px]",style:{borderBottom:"1px solid rgba(230,237,243,0.06)"},children:[C.jsx("td",{className:"px-3 py-2 font-mono",style:{color:"rgba(230,237,243,0.7)"},children:t.id}),C.jsx("td",{className:"px-3 py-2",style:{color:"rgba(230,237,243,0.45)"},children:t.rule_type}),C.jsx("td",{className:"px-3 py-2",children:C.jsx("span",{className:"inline-flex rounded px-1.5 py-0.5 text-[10px] font-semibold font-mono",style:{background:"rgba(230,237,243,0.06)",color:rS[t.severity]??"rgba(230,237,243,0.5)"},children:t.severity})}),C.jsx("td",{className:"px-3 py-2 truncate max-w-xs",style:{color:"rgba(230,237,243,0.6)"},children:t.statement}),C.jsx("td",{className:"px-3 py-2 text-[10px]",style:{color:"rgba(230,237,243,0.35)"},children:[(r=t.targets)==null?void 0:r.language,(n=t.targets)==null?void 0:n.layer,(i=t.targets)==null?void 0:i.framework].filter(Boolean).join(" / ")||"—"}),C.jsx("td",{className:"px-3 py-2",children:C.jsx("button",{type:"button",onClick:()=>e(t),className:"text-[10px] hover:underline",style:{color:"#79c0ff"},children:"Edit"})})]})}function VA(){const[t,e]=ae.useState([]),[r,n]=ae.useState(!0),[i,s]=ae.useState(null),[o,a]=ae.useState(""),[l,u]=ae.useState(null),[c,h]=ae.useState("idle"),[g,p]=ae.useState(null),[x,w]=ae.useState({}),[v,m]=ae.useState(null),[y,b]=ae.useState(!1),[_,R]=ae.useState(null),E=ae.useCallback(async()=>{n(!0),s(null);try{const{rules:A}=await lt.listConformanceRules();e(A)}catch(A){s(A instanceof Error?A.message:String(A))}finally{n(!1)}},[]);ae.useEffect(()=>{E()},[E]);const T=A=>{a(JSON.stringify(A??UA,null,2)),u(null),h("idle"),p(null)},k=A=>{a(A);try{JSON.parse(A),u(null)}catch(j){u(j instanceof Error?j.message:String(j))}},N=async()=>{if(l)return;let A;try{A=JSON.parse(o)}catch(j){u(j instanceof Error?j.message:String(j));return}h("saving"),p(null);try{await lt.upsertConformanceRule(A),h("ok"),await E()}catch(j){h("error"),p(j instanceof Error?j.message:String(j))}},M=async()=>{b(!0),R(null);try{const{rules:A}=await lt.recallRulesPreview(x);m(A)}catch(A){R(A instanceof Error?A.message:String(A)),m(null)}finally{b(!1)}},B=(A,j)=>C.jsx("input",{type:"text","aria-label":A,placeholder:j,value:x[A]??"",onChange:D=>w(I=>({...I,[A]:D.target.value||void 0})),className:"rounded px-2 py-0.5 text-[10px] focus:outline-none w-24",style:{background:"#161c26",border:"1px solid rgba(230,237,243,0.1)",color:"#e6edf3"}});return C.jsxs("div",{className:"flex flex-col gap-4",children:[C.jsxs("div",{className:"flex items-center gap-3",children:[C.jsx("h2",{className:"text-sm font-semibold",style:{color:"#e6edf3"},children:"Conformance rules"}),C.jsx("button",{type:"button",onClick:()=>void E(),className:"text-[10px] hover:underline",style:{color:"rgba(230,237,243,0.4)"},children:"Refresh"}),C.jsx("button",{type:"button",onClick:()=>T(),className:"ml-auto rounded px-2 py-1 text-[11px] font-semibold",style:{background:"#ffda19",color:"#0d1117"},children:"+ New rule"})]}),i&&C.jsx("p",{className:"rounded px-2 py-1 text-xs",style:{background:"rgba(248,81,73,0.08)",color:"#f85149"},children:i}),r?C.jsx("p",{className:"text-xs",style:{color:"rgba(230,237,243,0.4)"},children:"Loading rules…"}):C.jsx("div",{className:"overflow-x-auto rounded",style:{border:"1px solid rgba(230,237,243,0.08)"},children:C.jsxs("table",{className:"w-full text-[11px]",children:[C.jsx("thead",{children:C.jsxs("tr",{className:"text-[10px] uppercase tracking-wider",style:{borderBottom:"1px solid rgba(230,237,243,0.08)",background:"#0f1419",color:"rgba(230,237,243,0.4)"},children:[C.jsx("th",{className:"px-3 py-2 text-left",children:"ID"}),C.jsx("th",{className:"px-3 py-2 text-left",children:"Type"}),C.jsx("th",{className:"px-3 py-2 text-left",children:"Severity"}),C.jsx("th",{className:"px-3 py-2 text-left",children:"Statement"}),C.jsx("th",{className:"px-3 py-2 text-left",children:"Targets"}),C.jsx("th",{className:"px-3 py-2"})]})}),C.jsx("tbody",{children:t.length===0?C.jsx("tr",{children:C.jsx("td",{colSpan:6,className:"px-3 py-4 text-center text-xs",style:{color:"rgba(230,237,243,0.35)"},children:"No conformance rules registered."})}):t.map(A=>C.jsx(WA,{rule:A,onEdit:T},A.id))})]})}),o!==""&&C.jsxs("div",{className:"flex flex-col gap-2 rounded p-3",style:{border:"1px solid rgba(255,218,25,0.25)",background:"rgba(255,218,25,0.04)"},children:[C.jsxs("div",{className:"flex items-center gap-2",children:[C.jsx("span",{className:"text-[11px] font-semibold",style:{color:"#ffda19"},children:"Rule JSON"}),C.jsx("button",{type:"button",onClick:()=>{a(""),h("idle")},className:"ml-auto text-[10px] hover:underline",style:{color:"rgba(230,237,243,0.4)"},children:"Cancel"})]}),C.jsx("textarea",{"aria-label":"Conformance rule JSON editor",value:o,onChange:A=>k(A.target.value),spellCheck:!1,className:"rounded p-2 font-mono text-[10px] focus:outline-none min-h-[200px] resize-y",style:{background:"#0d1117",color:"#e6edf3",border:"1px solid rgba(230,237,243,0.1)"}}),l&&C.jsx("p",{className:"text-[10px]",style:{color:"#f85149"},children:l}),C.jsxs("div",{className:"flex items-center gap-2",children:[C.jsx("button",{type:"button",onClick:()=>void N(),disabled:!!l||c==="saving",className:"rounded px-3 py-1 text-[11px] font-semibold disabled:opacity-50",style:{background:"#3fb950",color:"#0d1117"},children:c==="saving"?"Saving…":"Save rule"}),c==="ok"&&C.jsx("span",{className:"text-[10px]",style:{color:"#3fb950"},children:"Saved."}),c==="error"&&C.jsx("span",{className:"text-[10px]",style:{color:"#f85149"},children:g})]})]}),C.jsxs("div",{className:"flex flex-col gap-2 rounded p-3",style:{border:"1px solid rgba(230,237,243,0.08)",background:"#0f1419"},children:[C.jsx("p",{className:"text-[11px] font-semibold",style:{color:"rgba(230,237,243,0.7)"},children:"Preview — which rules apply?"}),C.jsxs("div",{className:"flex flex-wrap gap-2 items-center",children:[B("language","language"),B("layer","layer"),B("framework","framework"),B("severity","severity"),B("rule_type","type"),C.jsx("button",{type:"button",onClick:()=>void M(),disabled:y,className:"rounded px-2 py-0.5 text-[10px] font-semibold disabled:opacity-50",style:{background:"#1b222e",color:"#e6edf3",border:"1px solid rgba(230,237,243,0.1)"},children:y?"Loading…":"Preview"})]}),_&&C.jsx("p",{className:"text-[10px]",style:{color:"#f85149"},children:_}),v!==null&&(v.length===0?C.jsx("p",{className:"text-[10px]",style:{color:"rgba(230,237,243,0.4)"},children:"No rules match this query."}):C.jsx("ul",{className:"flex flex-col gap-0.5",children:v.map(A=>C.jsxs("li",{className:"flex items-center gap-2 text-[10px]",children:[C.jsx("span",{className:"inline-flex rounded px-1 text-[9px] font-semibold font-mono",style:{background:"rgba(230,237,243,0.06)",color:rS[A.severity]??"rgba(230,237,243,0.5)"},children:A.severity}),C.jsx("span",{className:"font-mono",style:{color:"rgba(230,237,243,0.6)"},children:A.id}),C.jsx("span",{className:"truncate",style:{color:"rgba(230,237,243,0.45)"},children:A.statement})]},A.id))}))]})]})}const $A={planning:{label:"Planning",className:"text-wk-muted",color:"rgba(230,237,243,0.55)"},distributing:{label:"Distributing",className:"text-wk-link",color:"#79c0ff"},executing:{label:"Executing",className:"text-wk-link",color:"#79c0ff"},awaiting_human:{label:"Awaiting human",className:"text-wk-accent",color:"#ffda19"},completed:{label:"Completed",className:"text-wk-ok",color:"#3fb950"},cancelled:{label:"Cancelled",className:"text-wk-muted",color:"rgba(230,237,243,0.4)"},failed:{label:"Failed",className:"text-wk-deny",color:"#f85149"}};function rb({runId:t,ord:e,prompt:r,onResolved:n}){const i=Jn(m=>m.clearGate),s=zv(m=>m.record),[o,a]=ae.useState(""),[l,u]=ae.useState(!1),[c,h]=ae.useState(null);async function g(m,y){u(!0),h(null);try{await m(),s({runId:t,action:y.kind,...typeof e=="number"?{ord:e}:{},...y.amend!==void 0?{amend:y.amend}:{}}),i(t),n==null||n()}catch(b){h(b instanceof Error?b.message:String(b))}finally{u(!1)}}const p=()=>g(()=>lt.confirmGate(t,{approve:!0}),{kind:"approve"}),x=()=>{const m=o.trim();if(!m)return Promise.resolve();const y={approve:!0,amend:m};return g(()=>lt.confirmGate(t,y),{kind:"approve-with-steer",amend:m})},w=()=>g(()=>lt.confirmGate(t,{approve:!1}),{kind:"reject"}),v=()=>g(()=>lt.cancelRun(t),{kind:"cancel"});return C.jsxs("div",{className:"rounded-xl p-4",style:{background:"#161c26",border:"1px solid rgba(255,218,25,0.3)",boxShadow:"0 0 0 1px rgba(255,218,25,0.08)"},"data-testid":"steering-gate","data-run-id":t,children:[C.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[C.jsx("span",{className:"w-2 h-2 rounded-full animate-pulse",style:{background:"#ffda19"}}),C.jsx("p",{className:"font-semibold text-sm font-mono",style:{color:"#ffda19"},children:"Awaiting human decision"})]}),C.jsxs("p",{className:"text-xs font-mono mb-3",style:{color:"rgba(230,237,243,0.4)"},children:["run ",t.slice(0,8),typeof e=="number"?` · before unit #${e}`:""]}),C.jsx("p",{className:"text-xs mb-4 whitespace-pre-wrap leading-relaxed font-mono",style:{color:"rgba(230,237,243,0.75)"},"data-testid":"steering-prompt",children:r??"Prompt unavailable (daemon restarted) — you can still approve, reject, or cancel."}),C.jsx("textarea",{"data-testid":"steering-amend",className:"w-full rounded-lg p-2 text-xs mb-3 resize-none font-mono",style:{background:"#0f1419",border:"1px solid rgba(230,237,243,0.14)",color:"#e6edf3",outline:"none"},rows:2,placeholder:"Optional steer / amend — sent with Approve with steer to guide the next unit",value:o,onChange:m=>a(m.target.value),disabled:l}),c&&C.jsx("p",{className:"text-xs mb-3 font-mono",style:{color:"#f85149"},"data-testid":"steering-error",children:c}),C.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[C.jsx("button",{"data-testid":"steering-approve",onClick:()=>void p(),disabled:l,className:"rounded-lg px-3 py-2 text-xs font-semibold font-mono disabled:opacity-50 transition-opacity",style:{background:"#3fb950",color:"#0d1117"},children:"Approve"}),C.jsx("button",{"data-testid":"steering-approve-steer",onClick:()=>void x(),disabled:l||!o.trim(),className:"rounded-lg px-3 py-2 text-xs font-semibold font-mono disabled:opacity-50 transition-opacity",style:{background:"#ffda19",color:"#0d1117"},children:"Approve with steer"}),C.jsx("button",{"data-testid":"steering-reject",onClick:()=>void w(),disabled:l,className:"rounded-lg px-3 py-2 text-xs font-semibold font-mono disabled:opacity-50 transition-opacity",style:{background:"rgba(248,81,73,0.15)",border:"1px solid rgba(248,81,73,0.3)",color:"#f85149"},children:"Reject"}),C.jsx("button",{"data-testid":"steering-cancel",onClick:()=>void v(),disabled:l,className:"rounded-lg px-3 py-2 text-xs font-mono disabled:opacity-50 transition-opacity",style:{background:"rgba(230,237,243,0.06)",border:"1px solid rgba(230,237,243,0.1)",color:"rgba(230,237,243,0.55)"},children:"Cancel run"})]})]})}const nS={feature:"Feature (6 phases)",bug:"Bug (4 phases)",migration:"Migration (5 phases)"};function GA(t,e){const r=e.find(n=>n.id===t);return r?`${t.charAt(0).toUpperCase()}${t.slice(1)} (${r.phases.length} phases)`:nS[t]??t}function ks({children:t}){return C.jsx("p",{className:"text-[10px] uppercase tracking-widest font-semibold mb-2",style:{color:"rgba(230,237,243,0.35)"},children:t})}function qo(){return C.jsx("div",{style:{height:"1px",background:"rgba(230,237,243,0.07)"}})}function qA({roster:t,selectedClis:e,onToggleCli:r,confirmMode:n,onConfirmModeChange:i,beforeOrd:s,onBeforeOrdChange:o,entityMode:a,onEntityModeChange:l,workflows:u,workflow:c,onWorkflowChange:h,repos:g,repoRefs:p,onRepoRefsChange:x,attachedFiles:w,onFilesChange:v}){const m=ae.useRef(null);function y(_){const R=Array.from(_.target.files??[]);v([...w,...R]),_.target.value=""}function b(_){v(w.filter((R,E)=>E!==_))}return C.jsxs("div",{role:"dialog","aria-label":"Launch options",className:"flex flex-col text-xs font-mono overflow-y-auto rounded-2xl",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.15)",boxShadow:"0 16px 48px rgba(0,0,0,0.55)",width:"300px",maxHeight:"460px"},children:[C.jsxs("div",{className:"px-4 py-3",children:[C.jsx(ks,{children:"Upload files"}),C.jsx("button",{type:"button",onClick:()=>{var _;return(_=m.current)==null?void 0:_.click()},className:"rounded-lg px-3 py-1.5 font-semibold transition-opacity hover:opacity-80",style:{background:"rgba(230,237,243,0.07)",color:"#e6edf3",border:"1px solid rgba(230,237,243,0.1)"},children:"Choose file(s)…"}),C.jsx("input",{ref:m,type:"file",multiple:!0,className:"hidden",onChange:y,"aria-label":"Upload files for knowledge context"}),w.length>0&&C.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:w.map((_,R)=>C.jsxs("span",{className:"flex items-center gap-1 rounded-full px-2.5 py-0.5 text-[11px]",style:{background:"rgba(121,192,255,0.1)",color:"#79c0ff",border:"1px solid rgba(121,192,255,0.2)"},children:[_.name,C.jsx("button",{type:"button",onClick:()=>b(R),"aria-label":`Remove ${_.name}`,className:"opacity-60 hover:opacity-100 leading-none",children:"×"})]},R))})]}),C.jsx(qo,{}),C.jsxs("div",{className:"px-4 py-3",children:[C.jsx(ks,{children:"CLIs on/off"}),t.length===0?C.jsx("span",{style:{color:"rgba(230,237,243,0.3)"},children:"No roster loaded"}):C.jsx("div",{className:"flex flex-wrap gap-x-4 gap-y-1.5",children:t.map(_=>C.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer",style:{color:"rgba(230,237,243,0.65)"},children:[C.jsx("input",{type:"checkbox",checked:e.has(_.key),onChange:()=>r(_.key),"data-testid":`launch-seat-${_.key}`}),C.jsx("span",{children:_.key})]},_.key))})]}),C.jsx(qo,{}),C.jsxs("div",{className:"px-4 py-3",children:[C.jsx(ks,{children:"Set gate"}),C.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[C.jsxs("select",{"data-testid":"launch-confirm",className:"rounded-lg px-2 py-1",style:{background:"#0d1117",border:"1px solid rgba(230,237,243,0.14)",color:"#e6edf3"},value:n,onChange:_=>i(_.target.value),children:[C.jsx("option",{value:"none",children:"None"}),C.jsx("option",{value:"all",children:"Every unit"}),C.jsx("option",{value:"before",children:"Before unit #"})]}),n==="before"&&C.jsx("input",{type:"number",min:1,value:s,onChange:_=>o(Math.max(1,Number(_.target.value)||1)),className:"w-14 rounded-lg px-2 py-1",style:{background:"#0d1117",border:"1px solid rgba(230,237,243,0.14)",color:"#e6edf3"}})]})]}),C.jsx(qo,{}),C.jsxs("div",{className:"px-4 py-3",children:[C.jsx(ks,{children:"Set mode"}),C.jsx("div",{className:"flex items-center gap-1.5",children:["shared","isolated"].map(_=>C.jsx("button",{type:"button","data-testid":`launch-entity-${_}`,onClick:()=>l(_),className:"rounded-lg px-3 py-1 capitalize font-medium transition-colors",style:a===_?{background:"rgba(230,237,243,0.12)",color:"#e6edf3"}:{color:"rgba(230,237,243,0.4)"},children:_},_))})]}),C.jsx(qo,{}),C.jsxs("div",{className:"px-4 py-3",children:[C.jsx(ks,{children:"Choose workflow"}),C.jsxs("select",{"data-testid":"launch-workflow",className:"rounded-lg px-2 py-1 w-full",style:{background:"#0d1117",border:"1px solid rgba(230,237,243,0.14)",color:"#e6edf3"},value:c,onChange:_=>h(_.target.value),children:[C.jsx("option",{value:"",children:"(free-text)"}),(u.length>0?u.map(_=>_.id):Object.keys(nS)).map(_=>C.jsx("option",{value:_,children:GA(_,u)},_))]})]}),C.jsx(qo,{}),C.jsxs("div",{className:"px-4 py-3",children:[C.jsx(ks,{children:"Add repos"}),g.length===0?C.jsx("p",{className:"text-[11px] font-mono italic",style:{color:"rgba(230,237,243,0.3)"},children:"No repos registered."}):C.jsx("div",{className:"flex flex-col gap-1.5 max-h-36 overflow-y-auto pr-1",children:g.map(_=>{const R=p.includes(_.id);return C.jsxs("label",{className:"flex items-center gap-2 cursor-pointer rounded px-1 py-0.5 hover:bg-[rgba(230,237,243,0.04)]",children:[C.jsx("input",{type:"checkbox","data-testid":`launch-repo-${_.id}`,checked:R,onChange:()=>{x(R?p.filter(E=>E!==_.id):[...p,_.id])},className:"accent-[#ffda19] w-3.5 h-3.5 shrink-0"}),C.jsx("span",{className:"text-[11px] font-mono truncate",style:{color:"#e6edf3"},children:_.name})]},_.id)})})]})]})}const YA=new Set(["executing","distributing","planning"]);function XA(t){const e=t.toLowerCase();return/\b(bug|fix|broken|error|crash|issue)\b/.test(e)?"bug":/\b(feature|implement|add|create)\b/.test(e)&&!/\b(bug|fix|broken|error|crash|issue)\b/.test(e)?"feature":/\b(migrate|upgrade|migration|move)\b/.test(e)?"migration":null}function KA({label:t,onClear:e}){return C.jsxs("span",{className:"flex items-center gap-1 rounded-full px-2.5 py-0.5 text-[11px] font-mono",style:{background:"rgba(230,237,243,0.07)",color:"rgba(230,237,243,0.6)",border:"1px solid rgba(230,237,243,0.1)"},children:[t,C.jsx("button",{type:"button",onClick:e,"aria-label":`Clear ${t}`,className:"opacity-60 hover:opacity-100 leading-none ml-0.5",children:"×"})]})}const QA=new Set(["chat","onboarding","survey-repo","repo-graph","domain-graph-slice","memories"]);function iS({runId:t,runStatus:e,onLaunched:r,embedded:n,workflowOverride:i,mode:s,injectTarget:o,onClearInjectTarget:a}){const l=Jn(se=>se.clearGate),[u,c]=ae.useState(""),[h,g]=ae.useState(!1),[p,x]=ae.useState(null),w=ae.useRef(null),[v,m]=ae.useState(""),[y,b]=ae.useState(!1),[_,R]=ae.useState(null),E=ae.useRef(!1),[T,k]=ae.useState(""),[N,M]=ae.useState(""),[B,A]=ae.useState([]),[j,D]=ae.useState([]),I=ae.useMemo(()=>j.filter(se=>!se.is_system&&!QA.has(se.id)),[j]),[U,W]=ae.useState(new Set),[H,z]=ae.useState([]),[P,F]=ae.useState([]),[G,$]=ae.useState("shared"),[ee,re]=ae.useState("none"),[ne,Y]=ae.useState(1),[q,K]=ae.useState([]),[X,J]=ae.useState(!1),[ie,ce]=ae.useState(0),[de,Le]=ae.useState(null),[je,_e]=ae.useState(null),[ke,Ne]=ae.useState(!1),[Ee,Me]=ae.useState(!1),Pe=ae.useRef(null),De=ae.useRef(null),Ue=ae.useRef(null);ae.useEffect(()=>{lt.getRoster().then(({roster:se})=>{A(se);try{const he=localStorage.getItem("wicked_default_clis");if(he){W(new Set(JSON.parse(he)));return}}catch{}W(new Set(se.filter(he=>he.enabled_for_council).map(he=>he.key)))}).catch(()=>{}),lt.listRepos().then(({repos:se})=>z(se)).catch(()=>{}),lt.listWorkflows().then(({workflows:se})=>D(se)).catch(()=>{})},[]),ae.useEffect(()=>(X?(ce(0),De.current=setInterval(()=>ce(se=>se+1),1e3)):(De.current!==null&&(clearInterval(De.current),De.current=null),ce(0)),()=>{De.current!==null&&(clearInterval(De.current),De.current=null)}),[X]),ae.useEffect(()=>{const se=Ue.current;if(!se)return;se.style.height="auto";const he=100;se.style.height=`${Math.min(se.scrollHeight,he)}px`},[T]),ae.useEffect(()=>{if(!T.trim()||N||i){_e(null);return}_e(XA(T))},[T,N,i]),ae.useEffect(()=>{if(!Ee)return;function se(he){Pe.current&&!Pe.current.contains(he.target)&&Me(!1)}return document.addEventListener("click",se),()=>document.removeEventListener("click",se)},[Ee]),ae.useEffect(()=>{if(!Ee)return;function se(he){he.key==="Escape"&&Me(!1)}return document.addEventListener("keydown",se),()=>document.removeEventListener("keydown",se)},[Ee]);function Ye(se){W(he=>{const pe=new Set(he);return pe.has(se)?pe.delete(se):pe.add(se),pe})}function ge(){W(new Set(B.filter(se=>se.enabled_for_council).map(se=>se.key)))}async function Ce(){if(!T.trim()||U.size===0||X)return;J(!0),Le(null);const se={problem:T.trim()},he=B.filter(Se=>U.has(Se.key));he.length>0&&(se.clisJson=JSON.stringify(he)),se.entityMode=G,s==="ask"?se.humanConfirm="all":s!=="autonomous"&&(ee==="all"?se.humanConfirm="all":ee==="before"&&(se.humanConfirm=`before:${ne}`));const pe=P[0];pe&&(se.repoRef=pe);const be=(i==null?void 0:i.trim())||N;be&&(se.workflow=be);try{const{runId:Se}=await lt.launchRun(se);k(""),r(Se)}catch(Se){Le(Se instanceof Error?Se.message:String(Se))}finally{J(!1)}}async function Ae(){const se=u.trim();if(!(!se||!t)){g(!0),x(null);try{await lt.confirmGate(t,{approve:!0,amend:se}),c(""),l(t)}catch(he){x(he instanceof Error?he.message:String(he))}finally{g(!1)}}}async function Be(){const se=v.trim();if(!se||!t||E.current)return;E.current=!0,b(!0),R(null);const he=(o==null?void 0:o.trim())||"all";try{await lt.injectMessage(t,se,he),m("")}catch(pe){R(pe instanceof Error?pe.message:String(pe))}finally{E.current=!1,b(!1)}}if(t){if(e==="awaiting_human"){const se=u.trim().length>0&&!h;return C.jsxs("div",{className:"px-5 py-4 flex flex-col gap-2 shrink-0",style:{borderTop:"1px solid rgba(230,237,243,0.07)",background:"#161c26"},children:[p&&C.jsx("p",{className:"text-[11px] font-mono",style:{color:"#f85149"},children:p}),C.jsxs("div",{className:"flex items-end gap-3 rounded-2xl px-4 py-3",style:{background:"#1b222e",border:"1px solid rgba(255,218,25,0.25)"},children:[C.jsx("textarea",{ref:w,className:"flex-1 resize-none text-base outline-none border-0 bg-transparent leading-6",style:{minHeight:"28px",color:"#e6edf3",fontFamily:"inherit"},placeholder:"Send steering guidance… (approves gate)",value:u,onChange:he=>c(he.target.value),onKeyDown:he=>{he.key==="Enter"&&(he.metaKey||he.ctrlKey)&&(he.preventDefault(),Ae())},disabled:h,rows:1}),C.jsx("button",{type:"button",onClick:()=>void Ae(),disabled:!se,className:"shrink-0 rounded-xl px-4 py-2 text-sm font-semibold transition-opacity disabled:opacity-40",style:{background:"#ffda19",color:"#0d1117"},children:h?"…":"Steer →"})]}),C.jsx("p",{className:"text-[10px] font-mono text-center",style:{color:"rgba(230,237,243,0.3)"},children:"Approve + steer · Cmd+Enter · Use the gate panel above to approve/reject without steering"})]})}if(e&&YA.has(e)){const se=v.trim().length>0&&!y,he=(o==null?void 0:o.trim())||"all",pe=he!=="all",be=pe?he:"all agents";return C.jsxs("div",{className:"px-5 py-4 flex flex-col gap-2 shrink-0",style:{borderTop:"1px solid rgba(230,237,243,0.07)",background:"#161c26"},children:[_&&C.jsx("p",{className:"text-[11px] font-mono",style:{color:"#f85149"},children:_}),C.jsxs("div",{className:"flex items-end gap-3 rounded-2xl px-4 py-3",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.12)"},children:[C.jsx("textarea",{className:"flex-1 resize-none text-base outline-none border-0 bg-transparent leading-6",style:{minHeight:"28px",color:"#e6edf3",fontFamily:"inherit"},placeholder:`Send message to ${be}…`,value:v,onChange:Se=>m(Se.target.value),onKeyDown:Se=>{Se.key==="Enter"&&(Se.metaKey||Se.ctrlKey)&&(Se.preventDefault(),Be())},disabled:y,rows:1}),C.jsx("button",{type:"button",onClick:()=>void Be(),disabled:!se,className:"shrink-0 rounded-xl px-4 py-2 text-sm font-semibold transition-opacity disabled:opacity-40",style:{background:"#ffda19",color:"#0d1117"},children:y?"…":"Send →"})]}),C.jsxs("div",{className:"flex items-center gap-2",children:[C.jsx("p",{className:"text-[10px] font-mono flex-1",style:{color:"rgba(230,237,243,0.3)"},children:"Cmd+Enter · Click an agent to target it"}),pe&&C.jsxs("span",{className:"flex items-center gap-1 rounded-full px-2.5 py-0.5 text-[10px] font-mono",style:{background:"rgba(139,92,246,0.15)",color:"#c4b5fd",border:"1px solid rgba(139,92,246,0.25)"},children:["→ ",he,a&&C.jsx("button",{type:"button",onClick:a,"aria-label":"Clear target, broadcast to all",className:"opacity-60 hover:opacity-100 leading-none ml-0.5",children:"×"})]})]})]})}return C.jsx("div",{className:"px-5 py-4 shrink-0",style:{borderTop:"1px solid rgba(230,237,243,0.07)",background:"#161c26"},children:C.jsx("div",{className:"rounded-2xl px-5 py-4",style:{border:"1px solid rgba(230,237,243,0.1)",background:"#1b222e"},children:C.jsx("p",{className:"text-sm italic font-mono",style:{color:"rgba(230,237,243,0.35)"},children:"Steer at the next gate."})})})}const me=T.trim().length>0&&U.size>0&&!X,Z=je!==null&&!ke&&!N&&!i,te=new Set(B.filter(se=>se.enabled_for_council).map(se=>se.key)),oe=U.size!==te.size||[...U].some(se=>!te.has(se)),ue=[];q.length>0&&ue.push({label:`${q.length} file${q.length!==1?"s":""} attached`,onClear:()=>K([])}),ee!=="none"&&ue.push({label:ee==="all"?"Gate: every unit":`Gate: before #${ne}`,onClear:()=>re("none")}),G==="isolated"&&ue.push({label:"Mode: isolated",onClear:()=>$("shared")}),N&&ue.push({label:`Workflow: ${N}`,onClear:()=>{M(""),Ne(!0)}});for(const se of P){const he=H.find(pe=>pe.id===se);ue.push({label:`Repo: ${(he==null?void 0:he.name)??se}`,onClear:()=>F(pe=>pe.filter(be=>be!==se))})}return oe&&B.length>0&&ue.push({label:`CLIs: ${[...U].join(", ")}`,onClear:ge}),C.jsxs("div",{className:`flex flex-col gap-3 ${n?"":"px-5 py-4 shrink-0"}`,style:n?{}:{borderTop:"1px solid rgba(230,237,243,0.07)",background:"#161c26"},children:[Z&&C.jsxs("div",{className:"flex items-center gap-2 text-xs rounded-xl px-4 py-2 font-mono",style:{background:"#161c26",border:"1px solid rgba(230,237,243,0.1)",color:"rgba(230,237,243,0.7)"},children:[C.jsxs("span",{children:["Detected: ",C.jsx("strong",{style:{color:"#ffda19"},children:je})," workflow"]}),C.jsx("button",{type:"button",onClick:()=>{M(je),Ne(!0)},className:"rounded-lg px-3 py-1 font-semibold text-xs",style:{background:"#ffda19",color:"#0d1117"},children:"Apply"}),C.jsx("button",{type:"button",onClick:()=>Ne(!0),className:"ml-auto",style:{color:"rgba(230,237,243,0.35)"},children:"✕"})]}),C.jsxs("div",{className:"flex items-end gap-2 rounded-2xl px-4 py-3 transition-all",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.14)"},children:[C.jsxs("div",{className:"relative shrink-0",ref:Pe,children:[Ee&&C.jsx("div",{style:{position:"absolute",bottom:"calc(100% + 10px)",left:0,zIndex:50},children:C.jsx(qA,{roster:B,selectedClis:U,onToggleCli:Ye,confirmMode:ee,onConfirmModeChange:re,beforeOrd:ne,onBeforeOrdChange:Y,entityMode:G,onEntityModeChange:$,workflows:I,workflow:N,onWorkflowChange:se=>{M(se),Ne(!0)},repos:H,repoRefs:P,onRepoRefsChange:F,attachedFiles:q,onFilesChange:K})}),C.jsx("button",{type:"button","aria-label":"Open launch options","aria-expanded":Ee,"aria-haspopup":"dialog",onClick:()=>Me(se=>!se),className:"w-7 h-7 rounded-full flex items-center justify-center text-base font-light transition-all",style:Ee?{background:"rgba(255,218,25,0.15)",color:"#ffda19",border:"1px solid rgba(255,218,25,0.3)"}:{background:"rgba(230,237,243,0.06)",color:"rgba(230,237,243,0.4)",border:"1px solid rgba(230,237,243,0.08)"},children:"+"})]}),C.jsx("textarea",{ref:Ue,"data-testid":"launch-problem",className:"flex-1 resize-none text-base outline-none border-0 bg-transparent leading-6",style:{minHeight:"28px",color:"#e6edf3",fontFamily:"inherit"},placeholder:"What do you need built?",value:T,onChange:se=>{k(se.target.value),Ne(!1)},onKeyDown:se=>{se.key==="Enter"&&(se.metaKey||se.ctrlKey)&&(se.preventDefault(),Ce())},disabled:X,rows:1}),C.jsx("button",{type:"button","data-testid":"launch-submit",onClick:()=>void Ce(),disabled:!me,"aria-label":"Send",className:"shrink-0 rounded-xl px-5 py-2.5 text-sm font-semibold font-mono disabled:opacity-40 disabled:cursor-not-allowed transition-opacity",style:{background:"#ffda19",color:"#0d1117"},children:X?`${ie}s`:"Send"})]}),ue.length>0&&C.jsx("div",{className:"flex flex-wrap gap-1.5 px-1",children:ue.map((se,he)=>C.jsx(KA,{label:se.label,onClear:se.onClear},he))}),de&&C.jsx("p",{className:"text-xs px-1 font-mono",style:{color:"#f85149"},"data-testid":"launch-error",children:de}),X&&ie>=5&&C.jsx("p",{className:"text-xs text-center font-mono",style:{color:"rgba(230,237,243,0.35)"},children:"Creating run… council distribution happens off-thread once launched."})]})}function ZA({terminalId:t,cliKey:e,onClose:r}){const n=ae.useRef(null),i=ae.useRef(t);return i.current=t,ae.useEffect(()=>{const s=n.current;if(!s)return;let o=!1;const a=new eS.Terminal({convertEol:!1,cursorBlink:!1,disableStdin:!0,fontSize:12,fontFamily:'"JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace',theme:{background:"#0d1117",foreground:"#e6edf3",cursor:"#ffda19",cursorAccent:"#0d1117"}}),l=new tS.FitAddon;a.loadAddon(l),a.open(s);try{l.fit()}catch{}const u=new WebSocket(tw(i.current));u.binaryType="arraybuffer",u.onmessage=h=>{typeof h.data=="string"?a.write(h.data):a.write(new Uint8Array(h.data))},u.onerror=()=>{o||a.write(`\r
386
+ \x1B[31m[terminal connection error]\x1B[0m\r
387
+ `)},u.onclose=()=>{o||a.write(`\r
388
+ \x1B[90m[agent session ended]\x1B[0m\r
389
+ `)};const c=typeof ResizeObserver<"u"?new ResizeObserver(()=>{try{l.fit()}catch{}}):void 0;return c==null||c.observe(s),()=>{o=!0,c==null||c.disconnect();try{u.close()}catch{}a.dispose()}},[t]),C.jsxs("div",{className:"flex flex-col rounded-xl overflow-hidden",style:{background:"#0d1117",border:"1px solid rgba(230,237,243,0.08)"},children:[C.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 shrink-0",style:{background:"#161c26",borderBottom:"1px solid rgba(230,237,243,0.06)"},children:[C.jsxs("span",{className:"text-[11px] font-mono font-semibold",style:{color:"rgba(230,237,243,0.5)"},children:[e," ",C.jsx("span",{style:{color:"rgba(230,237,243,0.3)",fontWeight:400},children:"· observer"})]}),C.jsx("button",{type:"button",onClick:r,"aria-label":`Close ${e} terminal`,className:"text-[13px] leading-none opacity-50 hover:opacity-100 transition-opacity",style:{background:"transparent",border:"none",color:"#e6edf3",cursor:"pointer"},children:"×"})]}),C.jsx("div",{ref:n,className:"h-56 w-full overflow-hidden p-1"})]})}function JA(t,e){const r={};return(t[t.length-1]===""?[...t,""]:t).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const eM=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,tM=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,rM={};function nb(t,e){return(rM.jsx?tM:eM).test(t)}const nM=/[ \t\n\f\r]/g;function iM(t){return typeof t=="object"?t.type==="text"?ib(t.value):!1:ib(t)}function ib(t){return t.replace(nM,"")===""}class Ml{constructor(e,r,n){this.normal=r,this.property=e,n&&(this.space=n)}}Ml.prototype.normal={};Ml.prototype.property={};Ml.prototype.space=void 0;function aS(t,e){const r={},n={};for(const i of t)Object.assign(r,i.property),Object.assign(n,i.normal);return new Ml(r,n,e)}function Rv(t){return t.toLowerCase()}class ln{constructor(e,r){this.attribute=r,this.property=e}}ln.prototype.attribute="";ln.prototype.booleanish=!1;ln.prototype.boolean=!1;ln.prototype.commaOrSpaceSeparated=!1;ln.prototype.commaSeparated=!1;ln.prototype.defined=!1;ln.prototype.mustUseProperty=!1;ln.prototype.number=!1;ln.prototype.overloadedBoolean=!1;ln.prototype.property="";ln.prototype.spaceSeparated=!1;ln.prototype.space=void 0;let aM=0;const mt=Va(),fr=Va(),Lv=Va(),We=Va(),Ht=Va(),Ia=Va(),vn=Va();function Va(){return 2**++aM}const Nv=Object.freeze(Object.defineProperty({__proto__:null,boolean:mt,booleanish:fr,commaOrSpaceSeparated:vn,commaSeparated:Ia,number:We,overloadedBoolean:Lv,spaceSeparated:Ht},Symbol.toStringTag,{value:"Module"})),zp=Object.keys(Nv);class vg extends ln{constructor(e,r,n,i){let s=-1;if(super(e,r),ab(this,"space",i),typeof n=="number")for(;++s<zp.length;){const o=zp[s];ab(this,zp[s],(n&Nv[o])===Nv[o])}}}vg.prototype.defined=!0;function ab(t,e,r){r&&(t[e]=r)}function Zs(t){const e={},r={};for(const[n,i]of Object.entries(t.properties)){const s=new vg(n,t.transform(t.attributes||{},n),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(n)&&(s.mustUseProperty=!0),e[n]=s,r[Rv(n)]=n,r[Rv(s.attribute)]=n}return new Ml(e,r,t.space)}const sS=Zs({properties:{ariaActiveDescendant:null,ariaAtomic:fr,ariaAutoComplete:null,ariaBusy:fr,ariaChecked:fr,ariaColCount:We,ariaColIndex:We,ariaColSpan:We,ariaControls:Ht,ariaCurrent:null,ariaDescribedBy:Ht,ariaDetails:null,ariaDisabled:fr,ariaDropEffect:Ht,ariaErrorMessage:null,ariaExpanded:fr,ariaFlowTo:Ht,ariaGrabbed:fr,ariaHasPopup:null,ariaHidden:fr,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ht,ariaLevel:We,ariaLive:null,ariaModal:fr,ariaMultiLine:fr,ariaMultiSelectable:fr,ariaOrientation:null,ariaOwns:Ht,ariaPlaceholder:null,ariaPosInSet:We,ariaPressed:fr,ariaReadOnly:fr,ariaRelevant:null,ariaRequired:fr,ariaRoleDescription:Ht,ariaRowCount:We,ariaRowIndex:We,ariaRowSpan:We,ariaSelected:fr,ariaSetSize:We,ariaSort:null,ariaValueMax:We,ariaValueMin:We,ariaValueNow:We,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function oS(t,e){return e in t?t[e]:e}function lS(t,e){return oS(t,e.toLowerCase())}const sM=Zs({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ia,acceptCharset:Ht,accessKey:Ht,action:null,allow:null,allowFullScreen:mt,allowPaymentRequest:mt,allowUserMedia:mt,alpha:mt,alt:null,as:null,async:mt,autoCapitalize:null,autoComplete:Ht,autoFocus:mt,autoPlay:mt,blocking:Ht,capture:null,charSet:null,checked:mt,cite:null,className:Ht,closedBy:null,colorSpace:null,cols:We,colSpan:We,command:null,commandFor:null,content:null,contentEditable:fr,controls:mt,controlsList:Ht,coords:We|Ia,crossOrigin:null,data:null,dateTime:null,decoding:null,default:mt,defer:mt,dir:null,dirName:null,disabled:mt,download:Lv,draggable:fr,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:mt,formTarget:null,headers:Ht,height:We,hidden:Lv,high:We,href:null,hrefLang:null,htmlFor:Ht,httpEquiv:Ht,id:null,imageSizes:null,imageSrcSet:null,inert:mt,inputMode:null,integrity:null,is:null,isMap:mt,itemId:null,itemProp:Ht,itemRef:Ht,itemScope:mt,itemType:Ht,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:mt,low:We,manifest:null,max:null,maxLength:We,media:null,method:null,min:null,minLength:We,multiple:mt,muted:mt,name:null,nonce:null,noModule:mt,noValidate:mt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:mt,optimum:We,pattern:null,ping:Ht,placeholder:null,playsInline:mt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:mt,referrerPolicy:null,rel:Ht,required:mt,reversed:mt,rows:We,rowSpan:We,sandbox:Ht,scope:null,scoped:mt,seamless:mt,selected:mt,shadowRootClonable:mt,shadowRootCustomElementRegistry:mt,shadowRootDelegatesFocus:mt,shadowRootMode:null,shadowRootSerializable:mt,shape:null,size:We,sizes:null,slot:null,span:We,spellCheck:fr,src:null,srcDoc:null,srcLang:null,srcSet:null,start:We,step:null,style:null,tabIndex:We,target:null,title:null,translate:null,type:null,typeMustMatch:mt,useMap:null,value:fr,width:We,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ht,axis:null,background:null,bgColor:null,border:We,borderColor:null,bottomMargin:We,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:mt,declare:mt,event:null,face:null,frame:null,frameBorder:null,hSpace:We,leftMargin:We,link:null,longDesc:null,lowSrc:null,marginHeight:We,marginWidth:We,noResize:mt,noHref:mt,noShade:mt,noWrap:mt,object:null,profile:null,prompt:null,rev:null,rightMargin:We,rules:null,scheme:null,scrolling:fr,standby:null,summary:null,text:null,topMargin:We,valueType:null,version:null,vAlign:null,vLink:null,vSpace:We,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:mt,disablePictureInPicture:mt,disableRemotePlayback:mt,exportParts:Ia,part:Ht,prefix:null,property:null,results:We,security:null,unselectable:null},space:"html",transform:lS}),oM=Zs({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",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",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",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",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",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",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:vn,accentHeight:We,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:We,amplitude:We,arabicForm:null,ascent:We,attributeName:null,attributeType:null,azimuth:We,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:We,by:null,calcMode:null,capHeight:We,className:Ht,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:We,diffuseConstant:We,direction:null,display:null,dur:null,divisor:We,dominantBaseline:null,download:mt,dx:null,dy:null,edgeMode:null,editable:null,elevation:We,enableBackground:null,end:null,event:null,exponent:We,externalResourcesRequired:null,fill:null,fillOpacity:We,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Ia,g2:Ia,glyphName:Ia,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:We,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:We,horizOriginX:We,horizOriginY:We,id:null,ideographic:We,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:We,k:We,k1:We,k2:We,k3:We,k4:We,kernelMatrix:vn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:We,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:We,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:We,overlineThickness:We,paintOrder:null,panose1:null,path:null,pathLength:We,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ht,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:We,pointsAtY:We,pointsAtZ:We,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:vn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:vn,rev:vn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:vn,requiredFeatures:vn,requiredFonts:vn,requiredFormats:vn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:We,specularExponent:We,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:We,strikethroughThickness:We,string:null,stroke:null,strokeDashArray:vn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:We,strokeOpacity:We,strokeWidth:null,style:null,surfaceScale:We,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:vn,tabIndex:We,tableValues:null,target:null,targetX:We,targetY:We,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:vn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:We,underlineThickness:We,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:We,values:null,vAlphabetic:We,vMathematical:We,vectorEffect:null,vHanging:We,vIdeographic:We,version:null,vertAdvY:We,vertOriginX:We,vertOriginY:We,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:We,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:oS}),uS=Zs({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()}}),cS=Zs({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:lS}),hS=Zs({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),lM={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},uM=/[A-Z]/g,sb=/-[a-z]/g,cM=/^data[-\w.:]+$/i;function hM(t,e){const r=Rv(e);let n=e,i=ln;if(r in t.normal)return t.property[t.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&cM.test(e)){if(e.charAt(4)==="-"){const s=e.slice(5).replace(sb,dM);n="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=e.slice(4);if(!sb.test(s)){let o=s.replace(uM,fM);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}i=vg}return new i(n,e)}function fM(t){return"-"+t.toLowerCase()}function dM(t){return t.charAt(1).toUpperCase()}const pM=aS([sS,sM,uS,cS,hS],"html"),gg=aS([sS,oM,uS,cS,hS],"svg");function vM(t){return t.join(" ").trim()}var Ts={},Hp,ob;function gM(){if(ob)return Hp;ob=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,r=/^\s*/,n=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,a=/^\s+|\s+$/g,l=`
390
+ `,u="/",c="*",h="",g="comment",p="declaration";function x(v,m){if(typeof v!="string")throw new TypeError("First argument must be a string");if(!v)return[];m=m||{};var y=1,b=1;function _(D){var I=D.match(e);I&&(y+=I.length);var U=D.lastIndexOf(l);b=~U?D.length-U:b+D.length}function R(){var D={line:y,column:b};return function(I){return I.position=new E(D),N(),I}}function E(D){this.start=D,this.end={line:y,column:b},this.source=m.source}E.prototype.content=v;function T(D){var I=new Error(m.source+":"+y+":"+b+": "+D);if(I.reason=D,I.filename=m.source,I.line=y,I.column=b,I.source=v,!m.silent)throw I}function k(D){var I=D.exec(v);if(I){var U=I[0];return _(U),v=v.slice(U.length),I}}function N(){k(r)}function M(D){var I;for(D=D||[];I=B();)I!==!1&&D.push(I);return D}function B(){var D=R();if(!(u!=v.charAt(0)||c!=v.charAt(1))){for(var I=2;h!=v.charAt(I)&&(c!=v.charAt(I)||u!=v.charAt(I+1));)++I;if(I+=2,h===v.charAt(I-1))return T("End of comment missing");var U=v.slice(2,I-2);return b+=2,_(U),v=v.slice(I),b+=2,D({type:g,comment:U})}}function A(){var D=R(),I=k(n);if(I){if(B(),!k(i))return T("property missing ':'");var U=k(s),W=D({type:p,property:w(I[0].replace(t,h)),value:U?w(U[0].replace(t,h)):h});return k(o),W}}function j(){var D=[];M(D);for(var I;I=A();)I!==!1&&(D.push(I),M(D));return D}return N(),j()}function w(v){return v?v.replace(a,h):h}return Hp=x,Hp}var lb;function mM(){if(lb)return Ts;lb=1;var t=Ts&&Ts.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Ts,"__esModule",{value:!0}),Ts.default=r;const e=t(gM());function r(n,i){let s=null;if(!n||typeof n!="string")return s;const o=(0,e.default)(n),a=typeof i=="function";return o.forEach(l=>{if(l.type!=="declaration")return;const{property:u,value:c}=l;a?i(u,c,l):c&&(s=s||{},s[u]=c)}),s}return Ts}var Yo={},ub;function yM(){if(ub)return Yo;ub=1,Object.defineProperty(Yo,"__esModule",{value:!0}),Yo.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,r=/^[^-]+$/,n=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,s=function(u){return!u||r.test(u)||t.test(u)},o=function(u,c){return c.toUpperCase()},a=function(u,c){return"".concat(c,"-")},l=function(u,c){return c===void 0&&(c={}),s(u)?u:(u=u.toLowerCase(),c.reactCompat?u=u.replace(i,a):u=u.replace(n,a),u.replace(e,o))};return Yo.camelCase=l,Yo}var Xo,cb;function xM(){if(cb)return Xo;cb=1;var t=Xo&&Xo.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},e=t(mM()),r=yM();function n(i,s){var o={};return!i||typeof i!="string"||(0,e.default)(i,function(a,l){a&&l&&(o[(0,r.camelCase)(a,s)]=l)}),o}return n.default=n,Xo=n,Xo}var bM=xM();const wM=Uc(bM),fS=dS("end"),mg=dS("start");function dS(t){return e;function e(r){const n=r&&r.position&&r.position[t]||{};if(typeof n.line=="number"&&n.line>0&&typeof n.column=="number"&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset=="number"&&n.offset>-1?n.offset:void 0}}}function _M(t){const e=mg(t),r=fS(t);if(e&&r)return{start:e,end:r}}function al(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?hb(t.position):"start"in t||"end"in t?hb(t):"line"in t||"column"in t?Dv(t):""}function Dv(t){return fb(t&&t.line)+":"+fb(t&&t.column)}function hb(t){return Dv(t&&t.start)+"-"+Dv(t&&t.end)}function fb(t){return t&&typeof t=="number"?t:1}class Wr extends Error{constructor(e,r,n){super(),typeof r=="string"&&(n=r,r=void 0);let i="",s={},o=!1;if(r&&("line"in r&&"column"in r?s={place:r}:"start"in r&&"end"in r?s={place:r}:"type"in r?s={ancestors:[r],place:r.position}:s={...r}),typeof e=="string"?i=e:!s.cause&&e&&(o=!0,i=e.message,s.cause=e),!s.ruleId&&!s.source&&typeof n=="string"){const l=n.indexOf(":");l===-1?s.ruleId=n:(s.source=n.slice(0,l),s.ruleId=n.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=al(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Wr.prototype.file="";Wr.prototype.name="";Wr.prototype.reason="";Wr.prototype.message="";Wr.prototype.stack="";Wr.prototype.column=void 0;Wr.prototype.line=void 0;Wr.prototype.ancestors=void 0;Wr.prototype.cause=void 0;Wr.prototype.fatal=void 0;Wr.prototype.place=void 0;Wr.prototype.ruleId=void 0;Wr.prototype.source=void 0;const yg={}.hasOwnProperty,SM=new Map,CM=/[A-Z]/g,EM=new Set(["table","tbody","thead","tfoot","tr"]),kM=new Set(["td","th"]),pS="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function TM(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=e.filePath||void 0;let n;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");n=IM(r,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");n=PM(r,e.jsx,e.jsxs)}const i={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:n,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?gg:pM,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},s=vS(i,t,void 0);return s&&typeof s!="string"?s:i.create(t,i.Fragment,{children:s||void 0},void 0)}function vS(t,e,r){if(e.type==="element")return RM(t,e,r);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return LM(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return DM(t,e,r);if(e.type==="mdxjsEsm")return NM(t,e);if(e.type==="root")return AM(t,e,r);if(e.type==="text")return MM(t,e)}function RM(t,e,r){const n=t.schema;let i=n;e.tagName.toLowerCase()==="svg"&&n.space==="html"&&(i=gg,t.schema=i),t.ancestors.push(e);const s=mS(t,e.tagName,!1),o=OM(t,e);let a=bg(t,e);return EM.has(e.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!iM(l):!0})),gS(t,o,s,e),xg(o,a),t.ancestors.pop(),t.schema=n,t.create(e,s,o,r)}function LM(t,e){if(e.data&&e.data.estree&&t.evaluater){const n=e.data.estree.body[0];return n.type,t.evaluater.evaluateExpression(n.expression)}xl(t,e.position)}function NM(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);xl(t,e.position)}function DM(t,e,r){const n=t.schema;let i=n;e.name==="svg"&&n.space==="html"&&(i=gg,t.schema=i),t.ancestors.push(e);const s=e.name===null?t.Fragment:mS(t,e.name,!0),o=BM(t,e),a=bg(t,e);return gS(t,o,s,e),xg(o,a),t.ancestors.pop(),t.schema=n,t.create(e,s,o,r)}function AM(t,e,r){const n={};return xg(n,bg(t,e)),t.create(e,t.Fragment,n,r)}function MM(t,e){return e.value}function gS(t,e,r,n){typeof r!="string"&&r!==t.Fragment&&t.passNode&&(e.node=n)}function xg(t,e){if(e.length>0){const r=e.length>1?e:e[0];r&&(t.children=r)}}function PM(t,e,r){return n;function n(i,s,o,a){const u=Array.isArray(o.children)?r:e;return a?u(s,o,a):u(s,o)}}function IM(t,e){return r;function r(n,i,s,o){const a=Array.isArray(s.children),l=mg(n);return e(i,s,o,a,{columnNumber:l?l.column-1:void 0,fileName:t,lineNumber:l?l.line:void 0},void 0)}}function OM(t,e){const r={};let n,i;for(i in e.properties)if(i!=="children"&&yg.call(e.properties,i)){const s=FM(t,i,e.properties[i]);if(s){const[o,a]=s;t.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&kM.has(e.tagName)?n=a:r[o]=a}}if(n){const s=r.style||(r.style={});s[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=n}return r}function BM(t,e){const r={};for(const n of e.attributes)if(n.type==="mdxJsxExpressionAttribute")if(n.data&&n.data.estree&&t.evaluater){const s=n.data.estree.body[0];s.type;const o=s.expression;o.type;const a=o.properties[0];a.type,Object.assign(r,t.evaluater.evaluateExpression(a.argument))}else xl(t,e.position);else{const i=n.name;let s;if(n.value&&typeof n.value=="object")if(n.value.data&&n.value.data.estree&&t.evaluater){const a=n.value.data.estree.body[0];a.type,s=t.evaluater.evaluateExpression(a.expression)}else xl(t,e.position);else s=n.value===null?!0:n.value;r[i]=s}return r}function bg(t,e){const r=[];let n=-1;const i=t.passKeys?new Map:SM;for(;++n<e.children.length;){const s=e.children[n];let o;if(t.passKeys){const l=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(l){const u=i.get(l)||0;o=l+"-"+u,i.set(l,u+1)}}const a=vS(t,s,o);a!==void 0&&r.push(a)}return r}function FM(t,e,r){const n=hM(t.schema,e);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=n.commaSeparated?JA(r):vM(r)),n.property==="style"){let i=typeof r=="object"?r:jM(t,String(r));return t.stylePropertyNameCase==="css"&&(i=zM(i)),["style",i]}return[t.elementAttributeNameCase==="react"&&n.space?lM[n.property]||n.property:n.attribute,r]}}function jM(t,e){try{return wM(e,{reactCompat:!0})}catch(r){if(t.ignoreInvalidStyle)return{};const n=r,i=new Wr("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:n,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=t.filePath||void 0,i.url=pS+"#cannot-parse-style-attribute",i}}function mS(t,e,r){let n;if(!r)n={type:"Literal",value:e};else if(e.includes(".")){const i=e.split(".");let s=-1,o;for(;++s<i.length;){const a=nb(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};o=o?{type:"MemberExpression",object:o,property:a,computed:!!(s&&a.type==="Literal"),optional:!1}:a}n=o}else n=nb(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(n.type==="Literal"){const i=n.value;return yg.call(t.components,i)?t.components[i]:i}if(t.evaluater)return t.evaluater.evaluateExpression(n);xl(t)}function xl(t,e){const r=new Wr("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:e,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=t.filePath||void 0,r.url=pS+"#cannot-handle-mdx-estrees-without-createevaluater",r}function zM(t){const e={};let r;for(r in t)yg.call(t,r)&&(e[HM(r)]=t[r]);return e}function HM(t){let e=t.replace(CM,UM);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function UM(t){return"-"+t.toLowerCase()}const Up={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},WM={};function wg(t,e){const r=WM,n=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,i=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return yS(t,n,i)}function yS(t,e,r){if(VM(t)){if("value"in t)return t.type==="html"&&!r?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return db(t.children,e,r)}return Array.isArray(t)?db(t,e,r):""}function db(t,e,r){const n=[];let i=-1;for(;++i<t.length;)n[i]=yS(t[i],e,r);return n.join("")}function VM(t){return!!(t&&typeof t=="object")}const pb=document.createElement("i");function _g(t){const e="&"+t+";";pb.innerHTML=e;const r=pb.textContent;return r.charCodeAt(r.length-1)===59&&t!=="semi"||r===e?!1:r}function yn(t,e,r,n){const i=t.length;let s=0,o;if(e<0?e=-e>i?0:i+e:e=e>i?i:e,r=r>0?r:0,n.length<1e4)o=Array.from(n),o.unshift(e,r),t.splice(...o);else for(r&&t.splice(e,r);s<n.length;)o=n.slice(s,s+1e4),o.unshift(e,0),t.splice(...o),s+=1e4,e+=1e4}function Rn(t,e){return t.length>0?(yn(t,t.length,0,e),t):e}const vb={}.hasOwnProperty;function xS(t){const e={};let r=-1;for(;++r<t.length;)$M(e,t[r]);return e}function $M(t,e){let r;for(r in e){const i=(vb.call(t,r)?t[r]:void 0)||(t[r]={}),s=e[r];let o;if(s)for(o in s){vb.call(i,o)||(i[o]=[]);const a=s[o];GM(i[o],Array.isArray(a)?a:a?[a]:[])}}}function GM(t,e){let r=-1;const n=[];for(;++r<e.length;)(e[r].add==="after"?t:n).push(e[r]);yn(t,0,0,n)}function bS(t,e){const r=Number.parseInt(t,e);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function zn(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Xr=ua(/[A-Za-z]/),jr=ua(/[\dA-Za-z]/),qM=ua(/[#-'*+\--9=?A-Z^-~]/);function Fc(t){return t!==null&&(t<32||t===127)}const Av=ua(/\d/),YM=ua(/[\dA-Fa-f]/),XM=ua(/[!-/:-@[-`{-~]/);function ft(t){return t!==null&&t<-2}function Wt(t){return t!==null&&(t<0||t===32)}function Ct(t){return t===-2||t===-1||t===32}const oh=ua(new RegExp("\\p{P}|\\p{S}","u")),Ha=ua(/\s/);function ua(t){return e;function e(r){return r!==null&&r>-1&&t.test(String.fromCharCode(r))}}function Js(t){const e=[];let r=-1,n=0,i=0;for(;++r<t.length;){const s=t.charCodeAt(r);let o="";if(s===37&&jr(t.charCodeAt(r+1))&&jr(t.charCodeAt(r+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(o=String.fromCharCode(s));else if(s>55295&&s<57344){const a=t.charCodeAt(r+1);s<56320&&a>56319&&a<57344?(o=String.fromCharCode(s,a),i=1):o="�"}else o=String.fromCharCode(s);o&&(e.push(t.slice(n,r),encodeURIComponent(o)),n=r+i+1,o=""),i&&(r+=i,i=0)}return e.join("")+t.slice(n)}function Tt(t,e,r,n){const i=n?n-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(l){return Ct(l)?(t.enter(r),a(l)):e(l)}function a(l){return Ct(l)&&s++<i?(t.consume(l),a):(t.exit(r),e(l))}}const KM={tokenize:QM};function QM(t){const e=t.attempt(this.parser.constructs.contentInitial,n,i);let r;return e;function n(a){if(a===null){t.consume(a);return}return t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),Tt(t,e,"linePrefix")}function i(a){return t.enter("paragraph"),s(a)}function s(a){const l=t.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=l),r=l,o(a)}function o(a){if(a===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(a);return}return ft(a)?(t.consume(a),t.exit("chunkText"),s):(t.consume(a),o)}}const ZM={tokenize:JM},gb={tokenize:eP};function JM(t){const e=this,r=[];let n=0,i,s,o;return a;function a(b){if(n<r.length){const _=r[n];return e.containerState=_[1],t.attempt(_[0].continuation,l,u)(b)}return u(b)}function l(b){if(n++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,i&&y();const _=e.events.length;let R=_,E;for(;R--;)if(e.events[R][0]==="exit"&&e.events[R][1].type==="chunkFlow"){E=e.events[R][1].end;break}m(n);let T=_;for(;T<e.events.length;)e.events[T][1].end={...E},T++;return yn(e.events,R+1,0,e.events.slice(_)),e.events.length=T,u(b)}return a(b)}function u(b){if(n===r.length){if(!i)return g(b);if(i.currentConstruct&&i.currentConstruct.concrete)return x(b);e.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(gb,c,h)(b)}function c(b){return i&&y(),m(n),g(b)}function h(b){return e.parser.lazy[e.now().line]=n!==r.length,o=e.now().offset,x(b)}function g(b){return e.containerState={},t.attempt(gb,p,x)(b)}function p(b){return n++,r.push([e.currentConstruct,e.containerState]),g(b)}function x(b){if(b===null){i&&y(),m(0),t.consume(b);return}return i=i||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),w(b)}function w(b){if(b===null){v(t.exit("chunkFlow"),!0),m(0),t.consume(b);return}return ft(b)?(t.consume(b),v(t.exit("chunkFlow")),n=0,e.interrupt=void 0,a):(t.consume(b),w)}function v(b,_){const R=e.sliceStream(b);if(_&&R.push(null),b.previous=s,s&&(s.next=b),s=b,i.defineSkip(b.start),i.write(R),e.parser.lazy[b.start.line]){let E=i.events.length;for(;E--;)if(i.events[E][1].start.offset<o&&(!i.events[E][1].end||i.events[E][1].end.offset>o))return;const T=e.events.length;let k=T,N,M;for(;k--;)if(e.events[k][0]==="exit"&&e.events[k][1].type==="chunkFlow"){if(N){M=e.events[k][1].end;break}N=!0}for(m(n),E=T;E<e.events.length;)e.events[E][1].end={...M},E++;yn(e.events,k+1,0,e.events.slice(T)),e.events.length=E}}function m(b){let _=r.length;for(;_-- >b;){const R=r[_];e.containerState=R[1],R[0].exit.call(e,t)}r.length=b}function y(){i.write([null]),s=void 0,i=void 0,e.containerState._closeFlow=void 0}}function eP(t,e,r){return Tt(t,t.attempt(this.parser.constructs.document,e,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Vs(t){if(t===null||Wt(t)||Ha(t))return 1;if(oh(t))return 2}function lh(t,e,r){const n=[];let i=-1;for(;++i<t.length;){const s=t[i].resolveAll;s&&!n.includes(s)&&(e=s(e,r),n.push(s))}return e}const Mv={name:"attention",resolveAll:tP,tokenize:rP};function tP(t,e){let r=-1,n,i,s,o,a,l,u,c;for(;++r<t.length;)if(t[r][0]==="enter"&&t[r][1].type==="attentionSequence"&&t[r][1]._close){for(n=r;n--;)if(t[n][0]==="exit"&&t[n][1].type==="attentionSequence"&&t[n][1]._open&&e.sliceSerialize(t[n][1]).charCodeAt(0)===e.sliceSerialize(t[r][1]).charCodeAt(0)){if((t[n][1]._close||t[r][1]._open)&&(t[r][1].end.offset-t[r][1].start.offset)%3&&!((t[n][1].end.offset-t[n][1].start.offset+t[r][1].end.offset-t[r][1].start.offset)%3))continue;l=t[n][1].end.offset-t[n][1].start.offset>1&&t[r][1].end.offset-t[r][1].start.offset>1?2:1;const h={...t[n][1].end},g={...t[r][1].start};mb(h,-l),mb(g,l),o={type:l>1?"strongSequence":"emphasisSequence",start:h,end:{...t[n][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...t[r][1].start},end:g},s={type:l>1?"strongText":"emphasisText",start:{...t[n][1].end},end:{...t[r][1].start}},i={type:l>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},t[n][1].end={...o.start},t[r][1].start={...a.end},u=[],t[n][1].end.offset-t[n][1].start.offset&&(u=Rn(u,[["enter",t[n][1],e],["exit",t[n][1],e]])),u=Rn(u,[["enter",i,e],["enter",o,e],["exit",o,e],["enter",s,e]]),u=Rn(u,lh(e.parser.constructs.insideSpan.null,t.slice(n+1,r),e)),u=Rn(u,[["exit",s,e],["enter",a,e],["exit",a,e],["exit",i,e]]),t[r][1].end.offset-t[r][1].start.offset?(c=2,u=Rn(u,[["enter",t[r][1],e],["exit",t[r][1],e]])):c=0,yn(t,n-1,r-n+3,u),r=n+u.length-c-2;break}}for(r=-1;++r<t.length;)t[r][1].type==="attentionSequence"&&(t[r][1].type="data");return t}function rP(t,e){const r=this.parser.constructs.attentionMarkers.null,n=this.previous,i=Vs(n);let s;return o;function o(l){return s=l,t.enter("attentionSequence"),a(l)}function a(l){if(l===s)return t.consume(l),a;const u=t.exit("attentionSequence"),c=Vs(l),h=!c||c===2&&i||r.includes(l),g=!i||i===2&&c||r.includes(n);return u._open=!!(s===42?h:h&&(i||!g)),u._close=!!(s===42?g:g&&(c||!h)),e(l)}}function mb(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const nP={name:"autolink",tokenize:iP};function iP(t,e,r){let n=0;return i;function i(p){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(p),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),s}function s(p){return Xr(p)?(t.consume(p),o):p===64?r(p):u(p)}function o(p){return p===43||p===45||p===46||jr(p)?(n=1,a(p)):u(p)}function a(p){return p===58?(t.consume(p),n=0,l):(p===43||p===45||p===46||jr(p))&&n++<32?(t.consume(p),a):(n=0,u(p))}function l(p){return p===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(p),t.exit("autolinkMarker"),t.exit("autolink"),e):p===null||p===32||p===60||Fc(p)?r(p):(t.consume(p),l)}function u(p){return p===64?(t.consume(p),c):qM(p)?(t.consume(p),u):r(p)}function c(p){return jr(p)?h(p):r(p)}function h(p){return p===46?(t.consume(p),n=0,c):p===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(p),t.exit("autolinkMarker"),t.exit("autolink"),e):g(p)}function g(p){if((p===45||jr(p))&&n++<63){const x=p===45?g:h;return t.consume(p),x}return r(p)}}const Pl={partial:!0,tokenize:aP};function aP(t,e,r){return n;function n(s){return Ct(s)?Tt(t,i,"linePrefix")(s):i(s)}function i(s){return s===null||ft(s)?e(s):r(s)}}const wS={continuation:{tokenize:oP},exit:lP,name:"blockQuote",tokenize:sP};function sP(t,e,r){const n=this;return i;function i(o){if(o===62){const a=n.containerState;return a.open||(t.enter("blockQuote",{_container:!0}),a.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(o),t.exit("blockQuoteMarker"),s}return r(o)}function s(o){return Ct(o)?(t.enter("blockQuotePrefixWhitespace"),t.consume(o),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(o))}}function oP(t,e,r){const n=this;return i;function i(o){return Ct(o)?Tt(t,s,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return t.attempt(wS,e,r)(o)}}function lP(t){t.exit("blockQuote")}const _S={name:"characterEscape",tokenize:uP};function uP(t,e,r){return n;function n(s){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(s),t.exit("escapeMarker"),i}function i(s){return XM(s)?(t.enter("characterEscapeValue"),t.consume(s),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):r(s)}}const SS={name:"characterReference",tokenize:cP};function cP(t,e,r){const n=this;let i=0,s,o;return a;function a(h){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(h),t.exit("characterReferenceMarker"),l}function l(h){return h===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(h),t.exit("characterReferenceMarkerNumeric"),u):(t.enter("characterReferenceValue"),s=31,o=jr,c(h))}function u(h){return h===88||h===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(h),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),s=6,o=YM,c):(t.enter("characterReferenceValue"),s=7,o=Av,c(h))}function c(h){if(h===59&&i){const g=t.exit("characterReferenceValue");return o===jr&&!_g(n.sliceSerialize(g))?r(h):(t.enter("characterReferenceMarker"),t.consume(h),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return o(h)&&i++<s?(t.consume(h),c):r(h)}}const yb={partial:!0,tokenize:fP},xb={concrete:!0,name:"codeFenced",tokenize:hP};function hP(t,e,r){const n=this,i={partial:!0,tokenize:R};let s=0,o=0,a;return l;function l(E){return u(E)}function u(E){const T=n.events[n.events.length-1];return s=T&&T[1].type==="linePrefix"?T[2].sliceSerialize(T[1],!0).length:0,a=E,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),c(E)}function c(E){return E===a?(o++,t.consume(E),c):o<3?r(E):(t.exit("codeFencedFenceSequence"),Ct(E)?Tt(t,h,"whitespace")(E):h(E))}function h(E){return E===null||ft(E)?(t.exit("codeFencedFence"),n.interrupt?e(E):t.check(yb,w,_)(E)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),g(E))}function g(E){return E===null||ft(E)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),h(E)):Ct(E)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),Tt(t,p,"whitespace")(E)):E===96&&E===a?r(E):(t.consume(E),g)}function p(E){return E===null||ft(E)?h(E):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),x(E))}function x(E){return E===null||ft(E)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),h(E)):E===96&&E===a?r(E):(t.consume(E),x)}function w(E){return t.attempt(i,_,v)(E)}function v(E){return t.enter("lineEnding"),t.consume(E),t.exit("lineEnding"),m}function m(E){return s>0&&Ct(E)?Tt(t,y,"linePrefix",s+1)(E):y(E)}function y(E){return E===null||ft(E)?t.check(yb,w,_)(E):(t.enter("codeFlowValue"),b(E))}function b(E){return E===null||ft(E)?(t.exit("codeFlowValue"),y(E)):(t.consume(E),b)}function _(E){return t.exit("codeFenced"),e(E)}function R(E,T,k){let N=0;return M;function M(I){return E.enter("lineEnding"),E.consume(I),E.exit("lineEnding"),B}function B(I){return E.enter("codeFencedFence"),Ct(I)?Tt(E,A,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):A(I)}function A(I){return I===a?(E.enter("codeFencedFenceSequence"),j(I)):k(I)}function j(I){return I===a?(N++,E.consume(I),j):N>=o?(E.exit("codeFencedFenceSequence"),Ct(I)?Tt(E,D,"whitespace")(I):D(I)):k(I)}function D(I){return I===null||ft(I)?(E.exit("codeFencedFence"),T(I)):k(I)}}}function fP(t,e,r){const n=this;return i;function i(o){return o===null?r(o):(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s)}function s(o){return n.parser.lazy[n.now().line]?r(o):e(o)}}const Wp={name:"codeIndented",tokenize:pP},dP={partial:!0,tokenize:vP};function pP(t,e,r){const n=this;return i;function i(u){return t.enter("codeIndented"),Tt(t,s,"linePrefix",5)(u)}function s(u){const c=n.events[n.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?o(u):r(u)}function o(u){return u===null?l(u):ft(u)?t.attempt(dP,o,l)(u):(t.enter("codeFlowValue"),a(u))}function a(u){return u===null||ft(u)?(t.exit("codeFlowValue"),o(u)):(t.consume(u),a)}function l(u){return t.exit("codeIndented"),e(u)}}function vP(t,e,r){const n=this;return i;function i(o){return n.parser.lazy[n.now().line]?r(o):ft(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i):Tt(t,s,"linePrefix",5)(o)}function s(o){const a=n.events[n.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(o):ft(o)?i(o):r(o)}}const gP={name:"codeText",previous:yP,resolve:mP,tokenize:xP};function mP(t){let e=t.length-4,r=3,n,i;if((t[r][1].type==="lineEnding"||t[r][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(n=r;++n<e;)if(t[n][1].type==="codeTextData"){t[r][1].type="codeTextPadding",t[e][1].type="codeTextPadding",r+=2,e-=2;break}}for(n=r-1,e++;++n<=e;)i===void 0?n!==e&&t[n][1].type!=="lineEnding"&&(i=n):(n===e||t[n][1].type==="lineEnding")&&(t[i][1].type="codeTextData",n!==i+2&&(t[i][1].end=t[n-1][1].end,t.splice(i+2,n-i-2),e-=n-i-2,n=i+2),i=void 0);return t}function yP(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function xP(t,e,r){let n=0,i,s;return o;function o(h){return t.enter("codeText"),t.enter("codeTextSequence"),a(h)}function a(h){return h===96?(t.consume(h),n++,a):(t.exit("codeTextSequence"),l(h))}function l(h){return h===null?r(h):h===32?(t.enter("space"),t.consume(h),t.exit("space"),l):h===96?(s=t.enter("codeTextSequence"),i=0,c(h)):ft(h)?(t.enter("lineEnding"),t.consume(h),t.exit("lineEnding"),l):(t.enter("codeTextData"),u(h))}function u(h){return h===null||h===32||h===96||ft(h)?(t.exit("codeTextData"),l(h)):(t.consume(h),u)}function c(h){return h===96?(t.consume(h),i++,c):i===n?(t.exit("codeTextSequence"),t.exit("codeText"),e(h)):(s.type="codeTextData",u(h))}}class bP{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,r){const n=r??Number.POSITIVE_INFINITY;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,r,n){const i=r||0;this.setCursor(Math.trunc(e));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return n&&Ko(this.left,n),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),Ko(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Ko(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const r=this.left.splice(e,Number.POSITIVE_INFINITY);Ko(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);Ko(this.left,r.reverse())}}}function Ko(t,e){let r=0;if(e.length<1e4)t.push(...e);else for(;r<e.length;)t.push(...e.slice(r,r+1e4)),r+=1e4}function CS(t){const e={};let r=-1,n,i,s,o,a,l,u;const c=new bP(t);for(;++r<c.length;){for(;r in e;)r=e[r];if(n=c.get(r),r&&n[1].type==="chunkFlow"&&c.get(r-1)[1].type==="listItemPrefix"&&(l=n[1]._tokenizer.events,s=0,s<l.length&&l[s][1].type==="lineEndingBlank"&&(s+=2),s<l.length&&l[s][1].type==="content"))for(;++s<l.length&&l[s][1].type!=="content";)l[s][1].type==="chunkText"&&(l[s][1]._isInFirstContentOfListItem=!0,s++);if(n[0]==="enter")n[1].contentType&&(Object.assign(e,wP(c,r)),r=e[r],u=!0);else if(n[1]._container){for(s=r,i=void 0;s--;)if(o=c.get(s),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(c.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=s);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;i&&(n[1].end={...c.get(i)[1].start},a=c.slice(i,r),a.unshift(n),c.splice(i,r-i+1,a))}}return yn(t,0,Number.POSITIVE_INFINITY,c.slice(0)),!u}function wP(t,e){const r=t.get(e)[1],n=t.get(e)[2];let i=e-1;const s=[];let o=r._tokenizer;o||(o=n.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const a=o.events,l=[],u={};let c,h,g=-1,p=r,x=0,w=0;const v=[w];for(;p;){for(;t.get(++i)[1]!==p;);s.push(i),p._tokenizer||(c=n.sliceStream(p),p.next||c.push(null),h&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(c),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),h=p,p=p.next}for(p=r;++g<a.length;)a[g][0]==="exit"&&a[g-1][0]==="enter"&&a[g][1].type===a[g-1][1].type&&a[g][1].start.line!==a[g][1].end.line&&(w=g+1,v.push(w),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):v.pop(),g=v.length;g--;){const m=a.slice(v[g],v[g+1]),y=s.pop();l.push([y,y+m.length-1]),t.splice(y,2,m)}for(l.reverse(),g=-1;++g<l.length;)u[x+l[g][0]]=x+l[g][1],x+=l[g][1]-l[g][0]-1;return u}const _P={resolve:CP,tokenize:EP},SP={partial:!0,tokenize:kP};function CP(t){return CS(t),t}function EP(t,e){let r;return n;function n(a){return t.enter("content"),r=t.enter("chunkContent",{contentType:"content"}),i(a)}function i(a){return a===null?s(a):ft(a)?t.check(SP,o,s)(a):(t.consume(a),i)}function s(a){return t.exit("chunkContent"),t.exit("content"),e(a)}function o(a){return t.consume(a),t.exit("chunkContent"),r.next=t.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,i}}function kP(t,e,r){const n=this;return i;function i(o){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),Tt(t,s,"linePrefix")}function s(o){if(o===null||ft(o))return r(o);const a=n.events[n.events.length-1];return!n.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(o):t.interrupt(n.parser.constructs.flow,r,e)(o)}}function ES(t,e,r,n,i,s,o,a,l){const u=l||Number.POSITIVE_INFINITY;let c=0;return h;function h(m){return m===60?(t.enter(n),t.enter(i),t.enter(s),t.consume(m),t.exit(s),g):m===null||m===32||m===41||Fc(m)?r(m):(t.enter(n),t.enter(o),t.enter(a),t.enter("chunkString",{contentType:"string"}),w(m))}function g(m){return m===62?(t.enter(s),t.consume(m),t.exit(s),t.exit(i),t.exit(n),e):(t.enter(a),t.enter("chunkString",{contentType:"string"}),p(m))}function p(m){return m===62?(t.exit("chunkString"),t.exit(a),g(m)):m===null||m===60||ft(m)?r(m):(t.consume(m),m===92?x:p)}function x(m){return m===60||m===62||m===92?(t.consume(m),p):p(m)}function w(m){return!c&&(m===null||m===41||Wt(m))?(t.exit("chunkString"),t.exit(a),t.exit(o),t.exit(n),e(m)):c<u&&m===40?(t.consume(m),c++,w):m===41?(t.consume(m),c--,w):m===null||m===32||m===40||Fc(m)?r(m):(t.consume(m),m===92?v:w)}function v(m){return m===40||m===41||m===92?(t.consume(m),w):w(m)}}function kS(t,e,r,n,i,s){const o=this;let a=0,l;return u;function u(p){return t.enter(n),t.enter(i),t.consume(p),t.exit(i),t.enter(s),c}function c(p){return a>999||p===null||p===91||p===93&&!l||p===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?r(p):p===93?(t.exit(s),t.enter(i),t.consume(p),t.exit(i),t.exit(n),e):ft(p)?(t.enter("lineEnding"),t.consume(p),t.exit("lineEnding"),c):(t.enter("chunkString",{contentType:"string"}),h(p))}function h(p){return p===null||p===91||p===93||ft(p)||a++>999?(t.exit("chunkString"),c(p)):(t.consume(p),l||(l=!Ct(p)),p===92?g:h)}function g(p){return p===91||p===92||p===93?(t.consume(p),a++,h):h(p)}}function TS(t,e,r,n,i,s){let o;return a;function a(g){return g===34||g===39||g===40?(t.enter(n),t.enter(i),t.consume(g),t.exit(i),o=g===40?41:g,l):r(g)}function l(g){return g===o?(t.enter(i),t.consume(g),t.exit(i),t.exit(n),e):(t.enter(s),u(g))}function u(g){return g===o?(t.exit(s),l(o)):g===null?r(g):ft(g)?(t.enter("lineEnding"),t.consume(g),t.exit("lineEnding"),Tt(t,u,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),c(g))}function c(g){return g===o||g===null||ft(g)?(t.exit("chunkString"),u(g)):(t.consume(g),g===92?h:c)}function h(g){return g===o||g===92?(t.consume(g),c):c(g)}}function sl(t,e){let r;return n;function n(i){return ft(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),r=!0,n):Ct(i)?Tt(t,n,r?"linePrefix":"lineSuffix")(i):e(i)}}const TP={name:"definition",tokenize:LP},RP={partial:!0,tokenize:NP};function LP(t,e,r){const n=this;let i;return s;function s(p){return t.enter("definition"),o(p)}function o(p){return kS.call(n,t,a,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function a(p){return i=zn(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),p===58?(t.enter("definitionMarker"),t.consume(p),t.exit("definitionMarker"),l):r(p)}function l(p){return Wt(p)?sl(t,u)(p):u(p)}function u(p){return ES(t,c,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function c(p){return t.attempt(RP,h,h)(p)}function h(p){return Ct(p)?Tt(t,g,"whitespace")(p):g(p)}function g(p){return p===null||ft(p)?(t.exit("definition"),n.parser.defined.push(i),e(p)):r(p)}}function NP(t,e,r){return n;function n(a){return Wt(a)?sl(t,i)(a):r(a)}function i(a){return TS(t,s,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return Ct(a)?Tt(t,o,"whitespace")(a):o(a)}function o(a){return a===null||ft(a)?e(a):r(a)}}const DP={name:"hardBreakEscape",tokenize:AP};function AP(t,e,r){return n;function n(s){return t.enter("hardBreakEscape"),t.consume(s),i}function i(s){return ft(s)?(t.exit("hardBreakEscape"),e(s)):r(s)}}const MP={name:"headingAtx",resolve:PP,tokenize:IP};function PP(t,e){let r=t.length-2,n=3,i,s;return t[n][1].type==="whitespace"&&(n+=2),r-2>n&&t[r][1].type==="whitespace"&&(r-=2),t[r][1].type==="atxHeadingSequence"&&(n===r-1||r-4>n&&t[r-2][1].type==="whitespace")&&(r-=n+1===r?2:4),r>n&&(i={type:"atxHeadingText",start:t[n][1].start,end:t[r][1].end},s={type:"chunkText",start:t[n][1].start,end:t[r][1].end,contentType:"text"},yn(t,n,r-n+1,[["enter",i,e],["enter",s,e],["exit",s,e],["exit",i,e]])),t}function IP(t,e,r){let n=0;return i;function i(c){return t.enter("atxHeading"),s(c)}function s(c){return t.enter("atxHeadingSequence"),o(c)}function o(c){return c===35&&n++<6?(t.consume(c),o):c===null||Wt(c)?(t.exit("atxHeadingSequence"),a(c)):r(c)}function a(c){return c===35?(t.enter("atxHeadingSequence"),l(c)):c===null||ft(c)?(t.exit("atxHeading"),e(c)):Ct(c)?Tt(t,a,"whitespace")(c):(t.enter("atxHeadingText"),u(c))}function l(c){return c===35?(t.consume(c),l):(t.exit("atxHeadingSequence"),a(c))}function u(c){return c===null||c===35||Wt(c)?(t.exit("atxHeadingText"),a(c)):(t.consume(c),u)}}const OP=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],bb=["pre","script","style","textarea"],BP={concrete:!0,name:"htmlFlow",resolveTo:zP,tokenize:HP},FP={partial:!0,tokenize:WP},jP={partial:!0,tokenize:UP};function zP(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function HP(t,e,r){const n=this;let i,s,o,a,l;return u;function u($){return c($)}function c($){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume($),h}function h($){return $===33?(t.consume($),g):$===47?(t.consume($),s=!0,w):$===63?(t.consume($),i=3,n.interrupt?e:P):Xr($)?(t.consume($),o=String.fromCharCode($),v):r($)}function g($){return $===45?(t.consume($),i=2,p):$===91?(t.consume($),i=5,a=0,x):Xr($)?(t.consume($),i=4,n.interrupt?e:P):r($)}function p($){return $===45?(t.consume($),n.interrupt?e:P):r($)}function x($){const ee="CDATA[";return $===ee.charCodeAt(a++)?(t.consume($),a===ee.length?n.interrupt?e:A:x):r($)}function w($){return Xr($)?(t.consume($),o=String.fromCharCode($),v):r($)}function v($){if($===null||$===47||$===62||Wt($)){const ee=$===47,re=o.toLowerCase();return!ee&&!s&&bb.includes(re)?(i=1,n.interrupt?e($):A($)):OP.includes(o.toLowerCase())?(i=6,ee?(t.consume($),m):n.interrupt?e($):A($)):(i=7,n.interrupt&&!n.parser.lazy[n.now().line]?r($):s?y($):b($))}return $===45||jr($)?(t.consume($),o+=String.fromCharCode($),v):r($)}function m($){return $===62?(t.consume($),n.interrupt?e:A):r($)}function y($){return Ct($)?(t.consume($),y):M($)}function b($){return $===47?(t.consume($),M):$===58||$===95||Xr($)?(t.consume($),_):Ct($)?(t.consume($),b):M($)}function _($){return $===45||$===46||$===58||$===95||jr($)?(t.consume($),_):R($)}function R($){return $===61?(t.consume($),E):Ct($)?(t.consume($),R):b($)}function E($){return $===null||$===60||$===61||$===62||$===96?r($):$===34||$===39?(t.consume($),l=$,T):Ct($)?(t.consume($),E):k($)}function T($){return $===l?(t.consume($),l=null,N):$===null||ft($)?r($):(t.consume($),T)}function k($){return $===null||$===34||$===39||$===47||$===60||$===61||$===62||$===96||Wt($)?R($):(t.consume($),k)}function N($){return $===47||$===62||Ct($)?b($):r($)}function M($){return $===62?(t.consume($),B):r($)}function B($){return $===null||ft($)?A($):Ct($)?(t.consume($),B):r($)}function A($){return $===45&&i===2?(t.consume($),U):$===60&&i===1?(t.consume($),W):$===62&&i===4?(t.consume($),F):$===63&&i===3?(t.consume($),P):$===93&&i===5?(t.consume($),z):ft($)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(FP,G,j)($)):$===null||ft($)?(t.exit("htmlFlowData"),j($)):(t.consume($),A)}function j($){return t.check(jP,D,G)($)}function D($){return t.enter("lineEnding"),t.consume($),t.exit("lineEnding"),I}function I($){return $===null||ft($)?j($):(t.enter("htmlFlowData"),A($))}function U($){return $===45?(t.consume($),P):A($)}function W($){return $===47?(t.consume($),o="",H):A($)}function H($){if($===62){const ee=o.toLowerCase();return bb.includes(ee)?(t.consume($),F):A($)}return Xr($)&&o.length<8?(t.consume($),o+=String.fromCharCode($),H):A($)}function z($){return $===93?(t.consume($),P):A($)}function P($){return $===62?(t.consume($),F):$===45&&i===2?(t.consume($),P):A($)}function F($){return $===null||ft($)?(t.exit("htmlFlowData"),G($)):(t.consume($),F)}function G($){return t.exit("htmlFlow"),e($)}}function UP(t,e,r){const n=this;return i;function i(o){return ft(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s):r(o)}function s(o){return n.parser.lazy[n.now().line]?r(o):e(o)}}function WP(t,e,r){return n;function n(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(Pl,e,r)}}const VP={name:"htmlText",tokenize:$P};function $P(t,e,r){const n=this;let i,s,o;return a;function a(P){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(P),l}function l(P){return P===33?(t.consume(P),u):P===47?(t.consume(P),R):P===63?(t.consume(P),b):Xr(P)?(t.consume(P),k):r(P)}function u(P){return P===45?(t.consume(P),c):P===91?(t.consume(P),s=0,x):Xr(P)?(t.consume(P),y):r(P)}function c(P){return P===45?(t.consume(P),p):r(P)}function h(P){return P===null?r(P):P===45?(t.consume(P),g):ft(P)?(o=h,W(P)):(t.consume(P),h)}function g(P){return P===45?(t.consume(P),p):h(P)}function p(P){return P===62?U(P):P===45?g(P):h(P)}function x(P){const F="CDATA[";return P===F.charCodeAt(s++)?(t.consume(P),s===F.length?w:x):r(P)}function w(P){return P===null?r(P):P===93?(t.consume(P),v):ft(P)?(o=w,W(P)):(t.consume(P),w)}function v(P){return P===93?(t.consume(P),m):w(P)}function m(P){return P===62?U(P):P===93?(t.consume(P),m):w(P)}function y(P){return P===null||P===62?U(P):ft(P)?(o=y,W(P)):(t.consume(P),y)}function b(P){return P===null?r(P):P===63?(t.consume(P),_):ft(P)?(o=b,W(P)):(t.consume(P),b)}function _(P){return P===62?U(P):b(P)}function R(P){return Xr(P)?(t.consume(P),E):r(P)}function E(P){return P===45||jr(P)?(t.consume(P),E):T(P)}function T(P){return ft(P)?(o=T,W(P)):Ct(P)?(t.consume(P),T):U(P)}function k(P){return P===45||jr(P)?(t.consume(P),k):P===47||P===62||Wt(P)?N(P):r(P)}function N(P){return P===47?(t.consume(P),U):P===58||P===95||Xr(P)?(t.consume(P),M):ft(P)?(o=N,W(P)):Ct(P)?(t.consume(P),N):U(P)}function M(P){return P===45||P===46||P===58||P===95||jr(P)?(t.consume(P),M):B(P)}function B(P){return P===61?(t.consume(P),A):ft(P)?(o=B,W(P)):Ct(P)?(t.consume(P),B):N(P)}function A(P){return P===null||P===60||P===61||P===62||P===96?r(P):P===34||P===39?(t.consume(P),i=P,j):ft(P)?(o=A,W(P)):Ct(P)?(t.consume(P),A):(t.consume(P),D)}function j(P){return P===i?(t.consume(P),i=void 0,I):P===null?r(P):ft(P)?(o=j,W(P)):(t.consume(P),j)}function D(P){return P===null||P===34||P===39||P===60||P===61||P===96?r(P):P===47||P===62||Wt(P)?N(P):(t.consume(P),D)}function I(P){return P===47||P===62||Wt(P)?N(P):r(P)}function U(P){return P===62?(t.consume(P),t.exit("htmlTextData"),t.exit("htmlText"),e):r(P)}function W(P){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(P),t.exit("lineEnding"),H}function H(P){return Ct(P)?Tt(t,z,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):z(P)}function z(P){return t.enter("htmlTextData"),o(P)}}const Sg={name:"labelEnd",resolveAll:XP,resolveTo:KP,tokenize:QP},GP={tokenize:ZP},qP={tokenize:JP},YP={tokenize:e5};function XP(t){let e=-1;const r=[];for(;++e<t.length;){const n=t[e][1];if(r.push(t[e]),n.type==="labelImage"||n.type==="labelLink"||n.type==="labelEnd"){const i=n.type==="labelImage"?4:2;n.type="data",e+=i}}return t.length!==r.length&&yn(t,0,t.length,r),t}function KP(t,e){let r=t.length,n=0,i,s,o,a;for(;r--;)if(i=t[r][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;t[r][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(t[r][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=r,i.type!=="labelLink")){n=2;break}}else i.type==="labelEnd"&&(o=r);const l={type:t[s][1].type==="labelLink"?"link":"image",start:{...t[s][1].start},end:{...t[t.length-1][1].end}},u={type:"label",start:{...t[s][1].start},end:{...t[o][1].end}},c={type:"labelText",start:{...t[s+n+2][1].end},end:{...t[o-2][1].start}};return a=[["enter",l,e],["enter",u,e]],a=Rn(a,t.slice(s+1,s+n+3)),a=Rn(a,[["enter",c,e]]),a=Rn(a,lh(e.parser.constructs.insideSpan.null,t.slice(s+n+4,o-3),e)),a=Rn(a,[["exit",c,e],t[o-2],t[o-1],["exit",u,e]]),a=Rn(a,t.slice(o+1)),a=Rn(a,[["exit",l,e]]),yn(t,s,t.length,a),t}function QP(t,e,r){const n=this;let i=n.events.length,s,o;for(;i--;)if((n.events[i][1].type==="labelImage"||n.events[i][1].type==="labelLink")&&!n.events[i][1]._balanced){s=n.events[i][1];break}return a;function a(g){return s?s._inactive?h(g):(o=n.parser.defined.includes(zn(n.sliceSerialize({start:s.end,end:n.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(g),t.exit("labelMarker"),t.exit("labelEnd"),l):r(g)}function l(g){return g===40?t.attempt(GP,c,o?c:h)(g):g===91?t.attempt(qP,c,o?u:h)(g):o?c(g):h(g)}function u(g){return t.attempt(YP,c,h)(g)}function c(g){return e(g)}function h(g){return s._balanced=!0,r(g)}}function ZP(t,e,r){return n;function n(h){return t.enter("resource"),t.enter("resourceMarker"),t.consume(h),t.exit("resourceMarker"),i}function i(h){return Wt(h)?sl(t,s)(h):s(h)}function s(h){return h===41?c(h):ES(t,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function o(h){return Wt(h)?sl(t,l)(h):c(h)}function a(h){return r(h)}function l(h){return h===34||h===39||h===40?TS(t,u,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):c(h)}function u(h){return Wt(h)?sl(t,c)(h):c(h)}function c(h){return h===41?(t.enter("resourceMarker"),t.consume(h),t.exit("resourceMarker"),t.exit("resource"),e):r(h)}}function JP(t,e,r){const n=this;return i;function i(a){return kS.call(n,t,s,o,"reference","referenceMarker","referenceString")(a)}function s(a){return n.parser.defined.includes(zn(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?e(a):r(a)}function o(a){return r(a)}}function e5(t,e,r){return n;function n(s){return t.enter("reference"),t.enter("referenceMarker"),t.consume(s),t.exit("referenceMarker"),i}function i(s){return s===93?(t.enter("referenceMarker"),t.consume(s),t.exit("referenceMarker"),t.exit("reference"),e):r(s)}}const t5={name:"labelStartImage",resolveAll:Sg.resolveAll,tokenize:r5};function r5(t,e,r){const n=this;return i;function i(a){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(a),t.exit("labelImageMarker"),s}function s(a){return a===91?(t.enter("labelMarker"),t.consume(a),t.exit("labelMarker"),t.exit("labelImage"),o):r(a)}function o(a){return a===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(a):e(a)}}const n5={name:"labelStartLink",resolveAll:Sg.resolveAll,tokenize:i5};function i5(t,e,r){const n=this;return i;function i(o){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(o),t.exit("labelMarker"),t.exit("labelLink"),s}function s(o){return o===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(o):e(o)}}const Vp={name:"lineEnding",tokenize:a5};function a5(t,e){return r;function r(n){return t.enter("lineEnding"),t.consume(n),t.exit("lineEnding"),Tt(t,e,"linePrefix")}}const _c={name:"thematicBreak",tokenize:s5};function s5(t,e,r){let n=0,i;return s;function s(u){return t.enter("thematicBreak"),o(u)}function o(u){return i=u,a(u)}function a(u){return u===i?(t.enter("thematicBreakSequence"),l(u)):n>=3&&(u===null||ft(u))?(t.exit("thematicBreak"),e(u)):r(u)}function l(u){return u===i?(t.consume(u),n++,l):(t.exit("thematicBreakSequence"),Ct(u)?Tt(t,a,"whitespace")(u):a(u))}}const an={continuation:{tokenize:c5},exit:f5,name:"list",tokenize:u5},o5={partial:!0,tokenize:d5},l5={partial:!0,tokenize:h5};function u5(t,e,r){const n=this,i=n.events[n.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return a;function a(p){const x=n.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(x==="listUnordered"?!n.containerState.marker||p===n.containerState.marker:Av(p)){if(n.containerState.type||(n.containerState.type=x,t.enter(x,{_container:!0})),x==="listUnordered")return t.enter("listItemPrefix"),p===42||p===45?t.check(_c,r,u)(p):u(p);if(!n.interrupt||p===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(p)}return r(p)}function l(p){return Av(p)&&++o<10?(t.consume(p),l):(!n.interrupt||o<2)&&(n.containerState.marker?p===n.containerState.marker:p===41||p===46)?(t.exit("listItemValue"),u(p)):r(p)}function u(p){return t.enter("listItemMarker"),t.consume(p),t.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||p,t.check(Pl,n.interrupt?r:c,t.attempt(o5,g,h))}function c(p){return n.containerState.initialBlankLine=!0,s++,g(p)}function h(p){return Ct(p)?(t.enter("listItemPrefixWhitespace"),t.consume(p),t.exit("listItemPrefixWhitespace"),g):r(p)}function g(p){return n.containerState.size=s+n.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(p)}}function c5(t,e,r){const n=this;return n.containerState._closeFlow=void 0,t.check(Pl,i,s);function i(a){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,Tt(t,e,"listItemIndent",n.containerState.size+1)(a)}function s(a){return n.containerState.furtherBlankLines||!Ct(a)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,o(a)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,t.attempt(l5,e,o)(a))}function o(a){return n.containerState._closeFlow=!0,n.interrupt=void 0,Tt(t,t.attempt(an,e,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function h5(t,e,r){const n=this;return Tt(t,i,"listItemIndent",n.containerState.size+1);function i(s){const o=n.events[n.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===n.containerState.size?e(s):r(s)}}function f5(t){t.exit(this.containerState.type)}function d5(t,e,r){const n=this;return Tt(t,i,"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const o=n.events[n.events.length-1];return!Ct(s)&&o&&o[1].type==="listItemPrefixWhitespace"?e(s):r(s)}}const wb={name:"setextUnderline",resolveTo:p5,tokenize:v5};function p5(t,e){let r=t.length,n,i,s;for(;r--;)if(t[r][0]==="enter"){if(t[r][1].type==="content"){n=r;break}t[r][1].type==="paragraph"&&(i=r)}else t[r][1].type==="content"&&t.splice(r,1),!s&&t[r][1].type==="definition"&&(s=r);const o={type:"setextHeading",start:{...t[n][1].start},end:{...t[t.length-1][1].end}};return t[i][1].type="setextHeadingText",s?(t.splice(i,0,["enter",o,e]),t.splice(s+1,0,["exit",t[n][1],e]),t[n][1].end={...t[s][1].end}):t[n][1]=o,t.push(["exit",o,e]),t}function v5(t,e,r){const n=this;let i;return s;function s(u){let c=n.events.length,h;for(;c--;)if(n.events[c][1].type!=="lineEnding"&&n.events[c][1].type!=="linePrefix"&&n.events[c][1].type!=="content"){h=n.events[c][1].type==="paragraph";break}return!n.parser.lazy[n.now().line]&&(n.interrupt||h)?(t.enter("setextHeadingLine"),i=u,o(u)):r(u)}function o(u){return t.enter("setextHeadingLineSequence"),a(u)}function a(u){return u===i?(t.consume(u),a):(t.exit("setextHeadingLineSequence"),Ct(u)?Tt(t,l,"lineSuffix")(u):l(u))}function l(u){return u===null||ft(u)?(t.exit("setextHeadingLine"),e(u)):r(u)}}const g5={tokenize:m5};function m5(t){const e=this,r=t.attempt(Pl,n,t.attempt(this.parser.constructs.flowInitial,i,Tt(t,t.attempt(this.parser.constructs.flow,i,t.attempt(_P,i)),"linePrefix")));return r;function n(s){if(s===null){t.consume(s);return}return t.enter("lineEndingBlank"),t.consume(s),t.exit("lineEndingBlank"),e.currentConstruct=void 0,r}function i(s){if(s===null){t.consume(s);return}return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),e.currentConstruct=void 0,r}}const y5={resolveAll:LS()},x5=RS("string"),b5=RS("text");function RS(t){return{resolveAll:LS(t==="text"?w5:void 0),tokenize:e};function e(r){const n=this,i=this.parser.constructs[t],s=r.attempt(i,o,a);return o;function o(c){return u(c)?s(c):a(c)}function a(c){if(c===null){r.consume(c);return}return r.enter("data"),r.consume(c),l}function l(c){return u(c)?(r.exit("data"),s(c)):(r.consume(c),l)}function u(c){if(c===null)return!0;const h=i[c];let g=-1;if(h)for(;++g<h.length;){const p=h[g];if(!p.previous||p.previous.call(n,n.previous))return!0}return!1}}}function LS(t){return e;function e(r,n){let i=-1,s;for(;++i<=r.length;)s===void 0?r[i]&&r[i][1].type==="data"&&(s=i,i++):(!r[i]||r[i][1].type!=="data")&&(i!==s+2&&(r[s][1].end=r[i-1][1].end,r.splice(s+2,i-s-2),i=s+2),s=void 0);return t?t(r,n):r}}function w5(t,e){let r=0;for(;++r<=t.length;)if((r===t.length||t[r][1].type==="lineEnding")&&t[r-1][1].type==="data"){const n=t[r-1][1],i=e.sliceStream(n);let s=i.length,o=-1,a=0,l;for(;s--;){const u=i[s];if(typeof u=="string"){for(o=u.length;u.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(u===-2)l=!0,a++;else if(u!==-1){s++;break}}if(e._contentTypeTextTrailing&&r===t.length&&(a=0),a){const u={type:r===t.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?o:n.start._bufferIndex+o,_index:n.start._index+s,line:n.end.line,column:n.end.column-a,offset:n.end.offset-a},end:{...n.end}};n.end={...u.start},n.start.offset===n.end.offset?Object.assign(n,u):(t.splice(r,0,["enter",u,e],["exit",u,e]),r+=2)}r++}return t}const _5={42:an,43:an,45:an,48:an,49:an,50:an,51:an,52:an,53:an,54:an,55:an,56:an,57:an,62:wS},S5={91:TP},C5={[-2]:Wp,[-1]:Wp,32:Wp},E5={35:MP,42:_c,45:[wb,_c],60:BP,61:wb,95:_c,96:xb,126:xb},k5={38:SS,92:_S},T5={[-5]:Vp,[-4]:Vp,[-3]:Vp,33:t5,38:SS,42:Mv,60:[nP,VP],91:n5,92:[DP,_S],93:Sg,95:Mv,96:gP},R5={null:[Mv,y5]},L5={null:[42,95]},N5={null:[]},D5=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:L5,contentInitial:S5,disable:N5,document:_5,flow:E5,flowInitial:C5,insideSpan:R5,string:k5,text:T5},Symbol.toStringTag,{value:"Module"}));function A5(t,e,r){let n={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const i={},s=[];let o=[],a=[];const l={attempt:T(R),check:T(E),consume:y,enter:b,exit:_,interrupt:T(E,{interrupt:!0})},u={code:null,containerState:{},defineSkip:w,events:[],now:x,parser:t,previous:null,sliceSerialize:g,sliceStream:p,write:h};let c=e.tokenize.call(u,l);return e.resolveAll&&s.push(e),u;function h(B){return o=Rn(o,B),v(),o[o.length-1]!==null?[]:(k(e,0),u.events=lh(s,u.events,u),u.events)}function g(B,A){return P5(p(B),A)}function p(B){return M5(o,B)}function x(){const{_bufferIndex:B,_index:A,line:j,column:D,offset:I}=n;return{_bufferIndex:B,_index:A,line:j,column:D,offset:I}}function w(B){i[B.line]=B.column,M()}function v(){let B;for(;n._index<o.length;){const A=o[n._index];if(typeof A=="string")for(B=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===B&&n._bufferIndex<A.length;)m(A.charCodeAt(n._bufferIndex));else m(A)}}function m(B){c=c(B)}function y(B){ft(B)?(n.line++,n.column=1,n.offset+=B===-3?2:1,M()):B!==-1&&(n.column++,n.offset++),n._bufferIndex<0?n._index++:(n._bufferIndex++,n._bufferIndex===o[n._index].length&&(n._bufferIndex=-1,n._index++)),u.previous=B}function b(B,A){const j=A||{};return j.type=B,j.start=x(),u.events.push(["enter",j,u]),a.push(j),j}function _(B){const A=a.pop();return A.end=x(),u.events.push(["exit",A,u]),A}function R(B,A){k(B,A.from)}function E(B,A){A.restore()}function T(B,A){return j;function j(D,I,U){let W,H,z,P;return Array.isArray(D)?G(D):"tokenize"in D?G([D]):F(D);function F(ne){return Y;function Y(q){const K=q!==null&&ne[q],X=q!==null&&ne.null,J=[...Array.isArray(K)?K:K?[K]:[],...Array.isArray(X)?X:X?[X]:[]];return G(J)(q)}}function G(ne){return W=ne,H=0,ne.length===0?U:$(ne[H])}function $(ne){return Y;function Y(q){return P=N(),z=ne,ne.partial||(u.currentConstruct=ne),ne.name&&u.parser.constructs.disable.null.includes(ne.name)?re():ne.tokenize.call(A?Object.assign(Object.create(u),A):u,l,ee,re)(q)}}function ee(ne){return B(z,P),I}function re(ne){return P.restore(),++H<W.length?$(W[H]):U}}}function k(B,A){B.resolveAll&&!s.includes(B)&&s.push(B),B.resolve&&yn(u.events,A,u.events.length-A,B.resolve(u.events.slice(A),u)),B.resolveTo&&(u.events=B.resolveTo(u.events,u))}function N(){const B=x(),A=u.previous,j=u.currentConstruct,D=u.events.length,I=Array.from(a);return{from:D,restore:U};function U(){n=B,u.previous=A,u.currentConstruct=j,u.events.length=D,a=I,M()}}function M(){n.line in i&&n.column<2&&(n.column=i[n.line],n.offset+=i[n.line]-1)}}function M5(t,e){const r=e.start._index,n=e.start._bufferIndex,i=e.end._index,s=e.end._bufferIndex;let o;if(r===i)o=[t[r].slice(n,s)];else{if(o=t.slice(r,i),n>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(n):o.shift()}s>0&&o.push(t[i].slice(0,s))}return o}function P5(t,e){let r=-1;const n=[];let i;for(;++r<t.length;){const s=t[r];let o;if(typeof s=="string")o=s;else switch(s){case-5:{o="\r";break}case-4:{o=`
391
+ `;break}case-3:{o=`\r
392
+ `;break}case-2:{o=e?" ":" ";break}case-1:{if(!e&&i)continue;o=" ";break}default:o=String.fromCharCode(s)}i=s===-2,n.push(o)}return n.join("")}function I5(t){const n={constructs:xS([D5,...(t||{}).extensions||[]]),content:i(KM),defined:[],document:i(ZM),flow:i(g5),lazy:{},string:i(x5),text:i(b5)};return n;function i(s){return o;function o(a){return A5(n,s,a)}}}function O5(t){for(;!CS(t););return t}const _b=/[\0\t\n\r]/g;function B5(){let t=1,e="",r=!0,n;return i;function i(s,o,a){const l=[];let u,c,h,g,p;for(s=e+(typeof s=="string"?s.toString():new TextDecoder(o||void 0).decode(s)),h=0,e="",r&&(s.charCodeAt(0)===65279&&h++,r=void 0);h<s.length;){if(_b.lastIndex=h,u=_b.exec(s),g=u&&u.index!==void 0?u.index:s.length,p=s.charCodeAt(g),!u){e=s.slice(h);break}if(p===10&&h===g&&n)l.push(-3),n=void 0;else switch(n&&(l.push(-5),n=void 0),h<g&&(l.push(s.slice(h,g)),t+=g-h),p){case 0:{l.push(65533),t++;break}case 9:{for(c=Math.ceil(t/4)*4,l.push(-2);t++<c;)l.push(-1);break}case 10:{l.push(-4),t=1;break}default:n=!0,t=1}h=g+1}return a&&(n&&l.push(-5),e&&l.push(e),l.push(null)),l}}const F5=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function j5(t){return t.replace(F5,z5)}function z5(t,e,r){if(e)return e;if(r.charCodeAt(0)===35){const i=r.charCodeAt(1),s=i===120||i===88;return bS(r.slice(s?2:1),s?16:10)}return _g(r)||t}const NS={}.hasOwnProperty;function H5(t,e,r){return e&&typeof e=="object"&&(r=e,e=void 0),U5(r)(O5(I5(r).document().write(B5()(t,e,!0))))}function U5(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(Ne),autolinkProtocol:N,autolinkEmail:N,atxHeading:s(Le),blockQuote:s(X),characterEscape:N,characterReference:N,codeFenced:s(J),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(J,o),codeText:s(ie,o),codeTextData:N,data:N,codeFlowValue:N,definition:s(ce),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(de),hardBreakEscape:s(je),hardBreakTrailing:s(je),htmlFlow:s(_e,o),htmlFlowData:N,htmlText:s(_e,o),htmlTextData:N,image:s(ke),label:o,link:s(Ne),listItem:s(Me),listItemValue:g,listOrdered:s(Ee,h),listUnordered:s(Ee),paragraph:s(Pe),reference:$,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(Le),strong:s(De),thematicBreak:s(Ye)},exit:{atxHeading:l(),atxHeadingSequence:R,autolink:l(),autolinkEmail:K,autolinkProtocol:q,blockQuote:l(),characterEscapeValue:M,characterReferenceMarkerHexadecimal:re,characterReferenceMarkerNumeric:re,characterReferenceValue:ne,characterReference:Y,codeFenced:l(v),codeFencedFence:w,codeFencedFenceInfo:p,codeFencedFenceMeta:x,codeFlowValue:M,codeIndented:l(m),codeText:l(I),codeTextData:M,data:M,definition:l(),definitionDestinationString:_,definitionLabelString:y,definitionTitleString:b,emphasis:l(),hardBreakEscape:l(A),hardBreakTrailing:l(A),htmlFlow:l(j),htmlFlowData:M,htmlText:l(D),htmlTextData:M,image:l(W),label:z,labelText:H,lineEnding:B,link:l(U),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:ee,resourceDestinationString:P,resourceTitleString:F,resource:G,setextHeading:l(k),setextHeadingLineSequence:T,setextHeadingText:E,strong:l(),thematicBreak:l()}};DS(e,(t||{}).mdastExtensions||[]);const r={};return n;function n(ge){let Ce={type:"root",children:[]};const Ae={stack:[Ce],tokenStack:[],config:e,enter:a,exit:u,buffer:o,resume:c,data:r},Be=[];let me=-1;for(;++me<ge.length;)if(ge[me][1].type==="listOrdered"||ge[me][1].type==="listUnordered")if(ge[me][0]==="enter")Be.push(me);else{const Z=Be.pop();me=i(ge,Z,me)}for(me=-1;++me<ge.length;){const Z=e[ge[me][0]];NS.call(Z,ge[me][1].type)&&Z[ge[me][1].type].call(Object.assign({sliceSerialize:ge[me][2].sliceSerialize},Ae),ge[me][1])}if(Ae.tokenStack.length>0){const Z=Ae.tokenStack[Ae.tokenStack.length-1];(Z[1]||Sb).call(Ae,void 0,Z[0])}for(Ce.position={start:Wi(ge.length>0?ge[0][1].start:{line:1,column:1,offset:0}),end:Wi(ge.length>0?ge[ge.length-2][1].end:{line:1,column:1,offset:0})},me=-1;++me<e.transforms.length;)Ce=e.transforms[me](Ce)||Ce;return Ce}function i(ge,Ce,Ae){let Be=Ce-1,me=-1,Z=!1,te,oe,ue,se;for(;++Be<=Ae;){const he=ge[Be];switch(he[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{he[0]==="enter"?me++:me--,se=void 0;break}case"lineEndingBlank":{he[0]==="enter"&&(te&&!se&&!me&&!ue&&(ue=Be),se=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:se=void 0}if(!me&&he[0]==="enter"&&he[1].type==="listItemPrefix"||me===-1&&he[0]==="exit"&&(he[1].type==="listUnordered"||he[1].type==="listOrdered")){if(te){let pe=Be;for(oe=void 0;pe--;){const be=ge[pe];if(be[1].type==="lineEnding"||be[1].type==="lineEndingBlank"){if(be[0]==="exit")continue;oe&&(ge[oe][1].type="lineEndingBlank",Z=!0),be[1].type="lineEnding",oe=pe}else if(!(be[1].type==="linePrefix"||be[1].type==="blockQuotePrefix"||be[1].type==="blockQuotePrefixWhitespace"||be[1].type==="blockQuoteMarker"||be[1].type==="listItemIndent"))break}ue&&(!oe||ue<oe)&&(te._spread=!0),te.end=Object.assign({},oe?ge[oe][1].start:he[1].end),ge.splice(oe||Be,0,["exit",te,he[2]]),Be++,Ae++}if(he[1].type==="listItemPrefix"){const pe={type:"listItem",_spread:!1,start:Object.assign({},he[1].start),end:void 0};te=pe,ge.splice(Be,0,["enter",pe,he[2]]),Be++,Ae++,ue=void 0,se=!0}}}return ge[Ce][1]._spread=Z,Ae}function s(ge,Ce){return Ae;function Ae(Be){a.call(this,ge(Be),Be),Ce&&Ce.call(this,Be)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(ge,Ce,Ae){this.stack[this.stack.length-1].children.push(ge),this.stack.push(ge),this.tokenStack.push([Ce,Ae||void 0]),ge.position={start:Wi(Ce.start),end:void 0}}function l(ge){return Ce;function Ce(Ae){ge&&ge.call(this,Ae),u.call(this,Ae)}}function u(ge,Ce){const Ae=this.stack.pop(),Be=this.tokenStack.pop();if(Be)Be[0].type!==ge.type&&(Ce?Ce.call(this,ge,Be[0]):(Be[1]||Sb).call(this,ge,Be[0]));else throw new Error("Cannot close `"+ge.type+"` ("+al({start:ge.start,end:ge.end})+"): it’s not open");Ae.position.end=Wi(ge.end)}function c(){return wg(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function g(ge){if(this.data.expectingFirstListItemValue){const Ce=this.stack[this.stack.length-2];Ce.start=Number.parseInt(this.sliceSerialize(ge),10),this.data.expectingFirstListItemValue=void 0}}function p(){const ge=this.resume(),Ce=this.stack[this.stack.length-1];Ce.lang=ge}function x(){const ge=this.resume(),Ce=this.stack[this.stack.length-1];Ce.meta=ge}function w(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const ge=this.resume(),Ce=this.stack[this.stack.length-1];Ce.value=ge.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function m(){const ge=this.resume(),Ce=this.stack[this.stack.length-1];Ce.value=ge.replace(/(\r?\n|\r)$/g,"")}function y(ge){const Ce=this.resume(),Ae=this.stack[this.stack.length-1];Ae.label=Ce,Ae.identifier=zn(this.sliceSerialize(ge)).toLowerCase()}function b(){const ge=this.resume(),Ce=this.stack[this.stack.length-1];Ce.title=ge}function _(){const ge=this.resume(),Ce=this.stack[this.stack.length-1];Ce.url=ge}function R(ge){const Ce=this.stack[this.stack.length-1];if(!Ce.depth){const Ae=this.sliceSerialize(ge).length;Ce.depth=Ae}}function E(){this.data.setextHeadingSlurpLineEnding=!0}function T(ge){const Ce=this.stack[this.stack.length-1];Ce.depth=this.sliceSerialize(ge).codePointAt(0)===61?1:2}function k(){this.data.setextHeadingSlurpLineEnding=void 0}function N(ge){const Ae=this.stack[this.stack.length-1].children;let Be=Ae[Ae.length-1];(!Be||Be.type!=="text")&&(Be=Ue(),Be.position={start:Wi(ge.start),end:void 0},Ae.push(Be)),this.stack.push(Be)}function M(ge){const Ce=this.stack.pop();Ce.value+=this.sliceSerialize(ge),Ce.position.end=Wi(ge.end)}function B(ge){const Ce=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ae=Ce.children[Ce.children.length-1];Ae.position.end=Wi(ge.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(Ce.type)&&(N.call(this,ge),M.call(this,ge))}function A(){this.data.atHardBreak=!0}function j(){const ge=this.resume(),Ce=this.stack[this.stack.length-1];Ce.value=ge}function D(){const ge=this.resume(),Ce=this.stack[this.stack.length-1];Ce.value=ge}function I(){const ge=this.resume(),Ce=this.stack[this.stack.length-1];Ce.value=ge}function U(){const ge=this.stack[this.stack.length-1];if(this.data.inReference){const Ce=this.data.referenceType||"shortcut";ge.type+="Reference",ge.referenceType=Ce,delete ge.url,delete ge.title}else delete ge.identifier,delete ge.label;this.data.referenceType=void 0}function W(){const ge=this.stack[this.stack.length-1];if(this.data.inReference){const Ce=this.data.referenceType||"shortcut";ge.type+="Reference",ge.referenceType=Ce,delete ge.url,delete ge.title}else delete ge.identifier,delete ge.label;this.data.referenceType=void 0}function H(ge){const Ce=this.sliceSerialize(ge),Ae=this.stack[this.stack.length-2];Ae.label=j5(Ce),Ae.identifier=zn(Ce).toLowerCase()}function z(){const ge=this.stack[this.stack.length-1],Ce=this.resume(),Ae=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ae.type==="link"){const Be=ge.children;Ae.children=Be}else Ae.alt=Ce}function P(){const ge=this.resume(),Ce=this.stack[this.stack.length-1];Ce.url=ge}function F(){const ge=this.resume(),Ce=this.stack[this.stack.length-1];Ce.title=ge}function G(){this.data.inReference=void 0}function $(){this.data.referenceType="collapsed"}function ee(ge){const Ce=this.resume(),Ae=this.stack[this.stack.length-1];Ae.label=Ce,Ae.identifier=zn(this.sliceSerialize(ge)).toLowerCase(),this.data.referenceType="full"}function re(ge){this.data.characterReferenceType=ge.type}function ne(ge){const Ce=this.sliceSerialize(ge),Ae=this.data.characterReferenceType;let Be;Ae?(Be=bS(Ce,Ae==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Be=_g(Ce);const me=this.stack[this.stack.length-1];me.value+=Be}function Y(ge){const Ce=this.stack.pop();Ce.position.end=Wi(ge.end)}function q(ge){M.call(this,ge);const Ce=this.stack[this.stack.length-1];Ce.url=this.sliceSerialize(ge)}function K(ge){M.call(this,ge);const Ce=this.stack[this.stack.length-1];Ce.url="mailto:"+this.sliceSerialize(ge)}function X(){return{type:"blockquote",children:[]}}function J(){return{type:"code",lang:null,meta:null,value:""}}function ie(){return{type:"inlineCode",value:""}}function ce(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function de(){return{type:"emphasis",children:[]}}function Le(){return{type:"heading",depth:0,children:[]}}function je(){return{type:"break"}}function _e(){return{type:"html",value:""}}function ke(){return{type:"image",title:null,url:"",alt:null}}function Ne(){return{type:"link",title:null,url:"",children:[]}}function Ee(ge){return{type:"list",ordered:ge.type==="listOrdered",start:null,spread:ge._spread,children:[]}}function Me(ge){return{type:"listItem",spread:ge._spread,checked:null,children:[]}}function Pe(){return{type:"paragraph",children:[]}}function De(){return{type:"strong",children:[]}}function Ue(){return{type:"text",value:""}}function Ye(){return{type:"thematicBreak"}}}function Wi(t){return{line:t.line,column:t.column,offset:t.offset}}function DS(t,e){let r=-1;for(;++r<e.length;){const n=e[r];Array.isArray(n)?DS(t,n):W5(t,n)}}function W5(t,e){let r;for(r in e)if(NS.call(e,r))switch(r){case"canContainEols":{const n=e[r];n&&t[r].push(...n);break}case"transforms":{const n=e[r];n&&t[r].push(...n);break}case"enter":case"exit":{const n=e[r];n&&Object.assign(t[r],n);break}}}function Sb(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+al({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+al({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+al({start:e.start,end:e.end})+") is still open")}function V5(t){const e=this;e.parser=r;function r(n){return H5(n,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function $5(t,e){const r={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,r),t.applyData(e,r)}function G5(t,e){const r={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,r),[t.applyData(e,r),{type:"text",value:`
393
+ `}]}function q5(t,e){const r=e.value?e.value+`
394
+ `:"",n={},i=e.lang?e.lang.split(/\s+/):[];i.length>0&&(n.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:n,children:[{type:"text",value:r}]};return e.meta&&(s.data={meta:e.meta}),t.patch(e,s),s=t.applyData(e,s),s={type:"element",tagName:"pre",properties:{},children:[s]},t.patch(e,s),s}function Y5(t,e){const r={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function X5(t,e){const r={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function K5(t,e){const r=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=String(e.identifier).toUpperCase(),i=Js(n.toLowerCase()),s=t.footnoteOrder.indexOf(n);let o,a=t.footnoteCounts.get(n);a===void 0?(a=0,t.footnoteOrder.push(n),o=t.footnoteOrder.length):o=s+1,a+=1,t.footnoteCounts.set(n,a);const l={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+i,id:r+"fnref-"+i+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};t.patch(e,l);const u={type:"element",tagName:"sup",properties:{},children:[l]};return t.patch(e,u),t.applyData(e,u)}function Q5(t,e){const r={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function Z5(t,e){if(t.options.allowDangerousHtml){const r={type:"raw",value:e.value};return t.patch(e,r),t.applyData(e,r)}}function AS(t,e){const r=e.referenceType;let n="]";if(r==="collapsed"?n+="[]":r==="full"&&(n+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+n}];const i=t.all(e),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const o=i[i.length-1];return o&&o.type==="text"?o.value+=n:i.push({type:"text",value:n}),i}function J5(t,e){const r=String(e.identifier).toUpperCase(),n=t.definitionById.get(r);if(!n)return AS(t,e);const i={src:Js(n.url||""),alt:e.alt};n.title!==null&&n.title!==void 0&&(i.title=n.title);const s={type:"element",tagName:"img",properties:i,children:[]};return t.patch(e,s),t.applyData(e,s)}function e4(t,e){const r={src:Js(e.url)};e.alt!==null&&e.alt!==void 0&&(r.alt=e.alt),e.title!==null&&e.title!==void 0&&(r.title=e.title);const n={type:"element",tagName:"img",properties:r,children:[]};return t.patch(e,n),t.applyData(e,n)}function t4(t,e){const r={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,r);const n={type:"element",tagName:"code",properties:{},children:[r]};return t.patch(e,n),t.applyData(e,n)}function r4(t,e){const r=String(e.identifier).toUpperCase(),n=t.definitionById.get(r);if(!n)return AS(t,e);const i={href:Js(n.url||"")};n.title!==null&&n.title!==void 0&&(i.title=n.title);const s={type:"element",tagName:"a",properties:i,children:t.all(e)};return t.patch(e,s),t.applyData(e,s)}function n4(t,e){const r={href:Js(e.url)};e.title!==null&&e.title!==void 0&&(r.title=e.title);const n={type:"element",tagName:"a",properties:r,children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function i4(t,e,r){const n=t.all(e),i=r?a4(r):MS(e),s={},o=[];if(typeof e.checked=="boolean"){const c=n[0];let h;c&&c.type==="element"&&c.tagName==="p"?h=c:(h={type:"element",tagName:"p",properties:{},children:[]},n.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let a=-1;for(;++a<n.length;){const c=n[a];(i||a!==0||c.type!=="element"||c.tagName!=="p")&&o.push({type:"text",value:`
395
+ `}),c.type==="element"&&c.tagName==="p"&&!i?o.push(...c.children):o.push(c)}const l=n[n.length-1];l&&(i||l.type!=="element"||l.tagName!=="p")&&o.push({type:"text",value:`
396
+ `});const u={type:"element",tagName:"li",properties:s,children:o};return t.patch(e,u),t.applyData(e,u)}function a4(t){let e=!1;if(t.type==="list"){e=t.spread||!1;const r=t.children;let n=-1;for(;!e&&++n<r.length;)e=MS(r[n])}return e}function MS(t){const e=t.spread;return e??t.children.length>1}function s4(t,e){const r={},n=t.all(e);let i=-1;for(typeof e.start=="number"&&e.start!==1&&(r.start=e.start);++i<n.length;){const o=n[i];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const s={type:"element",tagName:e.ordered?"ol":"ul",properties:r,children:t.wrap(n,!0)};return t.patch(e,s),t.applyData(e,s)}function o4(t,e){const r={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function l4(t,e){const r={type:"root",children:t.wrap(t.all(e))};return t.patch(e,r),t.applyData(e,r)}function u4(t,e){const r={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function c4(t,e){const r=t.all(e),n=r.shift(),i=[];if(n){const o={type:"element",tagName:"thead",properties:{},children:t.wrap([n],!0)};t.patch(e.children[0],o),i.push(o)}if(r.length>0){const o={type:"element",tagName:"tbody",properties:{},children:t.wrap(r,!0)},a=mg(e.children[1]),l=fS(e.children[e.children.length-1]);a&&l&&(o.position={start:a,end:l}),i.push(o)}const s={type:"element",tagName:"table",properties:{},children:t.wrap(i,!0)};return t.patch(e,s),t.applyData(e,s)}function h4(t,e,r){const n=r?r.children:void 0,s=(n?n.indexOf(e):1)===0?"th":"td",o=r&&r.type==="table"?r.align:void 0,a=o?o.length:e.children.length;let l=-1;const u=[];for(;++l<a;){const h=e.children[l],g={},p=o?o[l]:void 0;p&&(g.align=p);let x={type:"element",tagName:s,properties:g,children:[]};h&&(x.children=t.all(h),t.patch(h,x),x=t.applyData(h,x)),u.push(x)}const c={type:"element",tagName:"tr",properties:{},children:t.wrap(u,!0)};return t.patch(e,c),t.applyData(e,c)}function f4(t,e){const r={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}const Cb=9,Eb=32;function d4(t){const e=String(t),r=/\r?\n|\r/g;let n=r.exec(e),i=0;const s=[];for(;n;)s.push(kb(e.slice(i,n.index),i>0,!0),n[0]),i=n.index+n[0].length,n=r.exec(e);return s.push(kb(e.slice(i),i>0,!1)),s.join("")}function kb(t,e,r){let n=0,i=t.length;if(e){let s=t.codePointAt(n);for(;s===Cb||s===Eb;)n++,s=t.codePointAt(n)}if(r){let s=t.codePointAt(i-1);for(;s===Cb||s===Eb;)i--,s=t.codePointAt(i-1)}return i>n?t.slice(n,i):""}function p4(t,e){const r={type:"text",value:d4(String(e.value))};return t.patch(e,r),t.applyData(e,r)}function v4(t,e){const r={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,r),t.applyData(e,r)}const g4={blockquote:$5,break:G5,code:q5,delete:Y5,emphasis:X5,footnoteReference:K5,heading:Q5,html:Z5,imageReference:J5,image:e4,inlineCode:t4,linkReference:r4,link:n4,listItem:i4,list:s4,paragraph:o4,root:l4,strong:u4,table:c4,tableCell:f4,tableRow:h4,text:p4,thematicBreak:v4,toml:rc,yaml:rc,definition:rc,footnoteDefinition:rc};function rc(){}const PS=-1,uh=0,ol=1,jc=2,Cg=3,Eg=4,kg=5,Tg=6,IS=7,OS=8,BS=typeof self=="object"?self:globalThis,Tb=(t,e)=>{switch(t){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+t)}return new BS[t](e)},m4=(t,e)=>{const r=(i,s)=>(t.set(s,i),i),n=i=>{if(t.has(i))return t.get(i);const[s,o]=e[i];switch(s){case uh:case PS:return r(o,i);case ol:{const a=r([],i);for(const l of o)a.push(n(l));return a}case jc:{const a=r({},i);for(const[l,u]of o)a[n(l)]=n(u);return a}case Cg:return r(new Date(o),i);case Eg:{const{source:a,flags:l}=o;return r(new RegExp(a,l),i)}case kg:{const a=r(new Map,i);for(const[l,u]of o)a.set(n(l),n(u));return a}case Tg:{const a=r(new Set,i);for(const l of o)a.add(n(l));return a}case IS:{const{name:a,message:l}=o;return r(typeof BS[a]=="function"?Tb(a,l):new Error(l),i)}case OS:return r(BigInt(o),i);case"BigInt":return r(Object(BigInt(o)),i);case"ArrayBuffer":return r(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:a}=new Uint8Array(o);return r(new DataView(a),o)}}return r(Tb(s,o),i)};return n},Rb=t=>m4(new Map,t)(0),Na="",{toString:y4}={},{keys:x4}=Object,Qo=t=>{const e=typeof t;if(e!=="object"||!t)return[uh,e];const r=y4.call(t).slice(8,-1);switch(r){case"Array":return[ol,Na];case"Object":return[jc,Na];case"Date":return[Cg,Na];case"RegExp":return[Eg,Na];case"Map":return[kg,Na];case"Set":return[Tg,Na];case"DataView":return[ol,r]}return r.includes("Array")?[ol,r]:t instanceof Error?[IS,t.name||"Error"]:[jc,r]},nc=([t,e])=>t===uh&&(e==="function"||e==="symbol"),b4=(t,e,r,n)=>{const i=(o,a)=>{const l=n.push(o)-1;return r.set(a,l),l},s=o=>{if(r.has(o))return r.get(o);let[a,l]=Qo(o);switch(a){case uh:{let c=o;switch(l){case"bigint":a=OS,c=o.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+l);c=null;break;case"undefined":return i([PS],o)}return i([a,c],o)}case ol:{if(l){let g=o;return l==="DataView"?g=new Uint8Array(o.buffer):l==="ArrayBuffer"&&(g=new Uint8Array(o)),i([l,[...g]],o)}const c=[],h=i([a,c],o);for(const g of o)c.push(s(g));return h}case jc:{if(l)switch(l){case"BigInt":return i([l,o.toString()],o);case"Boolean":case"Number":case"String":return i([l,o.valueOf()],o)}if(e&&"toJSON"in o)return s(o.toJSON());const c=[],h=i([a,c],o);for(const g of x4(o))(t||!nc(Qo(o[g])))&&c.push([s(g),s(o[g])]);return h}case Cg:return i([a,isNaN(o.getTime())?Na:o.toISOString()],o);case Eg:{const{source:c,flags:h}=o;return i([a,{source:c,flags:h}],o)}case kg:{const c=[],h=i([a,c],o);for(const[g,p]of o)(t||!(nc(Qo(g))||nc(Qo(p))))&&c.push([s(g),s(p)]);return h}case Tg:{const c=[],h=i([a,c],o);for(const g of o)(t||!nc(Qo(g)))&&c.push(s(g));return h}}const{message:u}=o;return i([a,{name:l,message:u}],o)};return s},Lb=(t,{json:e,lossy:r}={})=>{const n=[];return b4(!(e||r),!!e,new Map,n)(t),n},zc=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?Rb(Lb(t,e)):structuredClone(t):(t,e)=>Rb(Lb(t,e));function w4(t,e){const r=[{type:"text",value:"↩"}];return e>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),r}function _4(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function S4(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=t.options.footnoteBackContent||w4,n=t.options.footnoteBackLabel||_4,i=t.options.footnoteLabel||"Footnotes",s=t.options.footnoteLabelTagName||"h2",o=t.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let l=-1;for(;++l<t.footnoteOrder.length;){const u=t.footnoteById.get(t.footnoteOrder[l]);if(!u)continue;const c=t.all(u),h=String(u.identifier).toUpperCase(),g=Js(h.toLowerCase());let p=0;const x=[],w=t.footnoteCounts.get(h);for(;w!==void 0&&++p<=w;){x.length>0&&x.push({type:"text",value:" "});let y=typeof r=="string"?r:r(l,p);typeof y=="string"&&(y={type:"text",value:y}),x.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+g+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof n=="string"?n:n(l,p),className:["data-footnote-backref"]},children:Array.isArray(y)?y:[y]})}const v=c[c.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const y=v.children[v.children.length-1];y&&y.type==="text"?y.value+=" ":v.children.push({type:"text",value:" "}),v.children.push(...x)}else c.push(...x);const m={type:"element",tagName:"li",properties:{id:e+"fn-"+g},children:t.wrap(c,!0)};t.patch(u,m),a.push(m)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...zc(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
397
+ `},{type:"element",tagName:"ol",properties:{},children:t.wrap(a,!0)},{type:"text",value:`
398
+ `}]}}const ch=(function(t){if(t==null)return T4;if(typeof t=="function")return hh(t);if(typeof t=="object")return Array.isArray(t)?C4(t):E4(t);if(typeof t=="string")return k4(t);throw new Error("Expected function, string, or object as test")});function C4(t){const e=[];let r=-1;for(;++r<t.length;)e[r]=ch(t[r]);return hh(n);function n(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function E4(t){const e=t;return hh(r);function r(n){const i=n;let s;for(s in t)if(i[s]!==e[s])return!1;return!0}}function k4(t){return hh(e);function e(r){return r&&r.type===t}}function hh(t){return e;function e(r,n,i){return!!(R4(r)&&t.call(this,r,typeof n=="number"?n:void 0,i||void 0))}}function T4(){return!0}function R4(t){return t!==null&&typeof t=="object"&&"type"in t}const FS=[],L4=!0,Pv=!1,N4="skip";function jS(t,e,r,n){let i;typeof e=="function"&&typeof r!="function"?(n=r,r=e):i=e;const s=ch(i),o=n?-1:1;a(t,void 0,[])();function a(l,u,c){const h=l&&typeof l=="object"?l:{};if(typeof h.type=="string"){const p=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(g,"name",{value:"node ("+(l.type+(p?"<"+p+">":""))+")"})}return g;function g(){let p=FS,x,w,v;if((!e||s(l,u,c[c.length-1]||void 0))&&(p=D4(r(l,c)),p[0]===Pv))return p;if("children"in l&&l.children){const m=l;if(m.children&&p[0]!==N4)for(w=(n?m.children.length:-1)+o,v=c.concat(m);w>-1&&w<m.children.length;){const y=m.children[w];if(x=a(y,w,v)(),x[0]===Pv)return x;w=typeof x[1]=="number"?x[1]:w+o}}return p}}}function D4(t){return Array.isArray(t)?t:typeof t=="number"?[L4,t]:t==null?FS:[t]}function Rg(t,e,r,n){let i,s,o;typeof e=="function"&&typeof r!="function"?(s=void 0,o=e,i=r):(s=e,o=r,i=n),jS(t,s,a,i);function a(l,u){const c=u[u.length-1],h=c?c.children.indexOf(l):void 0;return o(l,h,c)}}const Iv={}.hasOwnProperty,A4={};function M4(t,e){const r=e||A4,n=new Map,i=new Map,s=new Map,o={...g4,...r.handlers},a={all:u,applyData:I4,definitionById:n,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:o,one:l,options:r,patch:P4,wrap:B4};return Rg(t,function(c){if(c.type==="definition"||c.type==="footnoteDefinition"){const h=c.type==="definition"?n:i,g=String(c.identifier).toUpperCase();h.has(g)||h.set(g,c)}}),a;function l(c,h){const g=c.type,p=a.handlers[g];if(Iv.call(a.handlers,g)&&p)return p(a,c,h);if(a.options.passThrough&&a.options.passThrough.includes(g)){if("children"in c){const{children:w,...v}=c,m=zc(v);return m.children=a.all(c),m}return zc(c)}return(a.options.unknownHandler||O4)(a,c,h)}function u(c){const h=[];if("children"in c){const g=c.children;let p=-1;for(;++p<g.length;){const x=a.one(g[p],c);if(x){if(p&&g[p-1].type==="break"&&(!Array.isArray(x)&&x.type==="text"&&(x.value=Nb(x.value)),!Array.isArray(x)&&x.type==="element")){const w=x.children[0];w&&w.type==="text"&&(w.value=Nb(w.value))}Array.isArray(x)?h.push(...x):h.push(x)}}}return h}}function P4(t,e){t.position&&(e.position=_M(t))}function I4(t,e){let r=e;if(t&&t.data){const n=t.data.hName,i=t.data.hChildren,s=t.data.hProperties;if(typeof n=="string")if(r.type==="element")r.tagName=n;else{const o="children"in r?r.children:[r];r={type:"element",tagName:n,properties:{},children:o}}r.type==="element"&&s&&Object.assign(r.properties,zc(s)),"children"in r&&r.children&&i!==null&&i!==void 0&&(r.children=i)}return r}function O4(t,e){const r=e.data||{},n="value"in e&&!(Iv.call(r,"hProperties")||Iv.call(r,"hChildren"))?{type:"text",value:e.value}:{type:"element",tagName:"div",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function B4(t,e){const r=[];let n=-1;for(e&&r.push({type:"text",value:`
399
+ `});++n<t.length;)n&&r.push({type:"text",value:`
400
+ `}),r.push(t[n]);return e&&t.length>0&&r.push({type:"text",value:`
401
+ `}),r}function Nb(t){let e=0,r=t.charCodeAt(e);for(;r===9||r===32;)e++,r=t.charCodeAt(e);return t.slice(e)}function Db(t,e){const r=M4(t,e),n=r.one(t,void 0),i=S4(r),s=Array.isArray(n)?{type:"root",children:n}:n||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
402
+ `},i),s}function F4(t,e){return t&&"run"in t?async function(r,n){const i=Db(r,{file:n,...e});await t.run(i,n)}:function(r,n){return Db(r,{file:n,...t||e})}}function Ab(t){if(t)throw t}var $p,Mb;function j4(){if(Mb)return $p;Mb=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,r=Object.defineProperty,n=Object.getOwnPropertyDescriptor,i=function(u){return typeof Array.isArray=="function"?Array.isArray(u):e.call(u)==="[object Array]"},s=function(u){if(!u||e.call(u)!=="[object Object]")return!1;var c=t.call(u,"constructor"),h=u.constructor&&u.constructor.prototype&&t.call(u.constructor.prototype,"isPrototypeOf");if(u.constructor&&!c&&!h)return!1;var g;for(g in u);return typeof g>"u"||t.call(u,g)},o=function(u,c){r&&c.name==="__proto__"?r(u,c.name,{enumerable:!0,configurable:!0,value:c.newValue,writable:!0}):u[c.name]=c.newValue},a=function(u,c){if(c==="__proto__")if(t.call(u,c)){if(n)return n(u,c).value}else return;return u[c]};return $p=function l(){var u,c,h,g,p,x,w=arguments[0],v=1,m=arguments.length,y=!1;for(typeof w=="boolean"&&(y=w,w=arguments[1]||{},v=2),(w==null||typeof w!="object"&&typeof w!="function")&&(w={});v<m;++v)if(u=arguments[v],u!=null)for(c in u)h=a(w,c),g=a(u,c),w!==g&&(y&&g&&(s(g)||(p=i(g)))?(p?(p=!1,x=h&&i(h)?h:[]):x=h&&s(h)?h:{},o(w,{name:c,newValue:l(y,x,g)})):typeof g<"u"&&o(w,{name:c,newValue:g}));return w},$p}var z4=j4();const Gp=Uc(z4);function Ov(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function H4(){const t=[],e={run:r,use:n};return e;function r(...i){let s=-1;const o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);a(null,...i);function a(l,...u){const c=t[++s];let h=-1;if(l){o(l);return}for(;++h<i.length;)(u[h]===null||u[h]===void 0)&&(u[h]=i[h]);i=u,c?U4(c,a)(...u):o(null,...u)}}function n(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return t.push(i),e}}function U4(t,e){let r;return n;function n(...o){const a=t.length>o.length;let l;a&&o.push(i);try{l=t.apply(this,o)}catch(u){const c=u;if(a&&r)throw c;return i(c)}a||(l&&l.then&&typeof l.then=="function"?l.then(s,i):l instanceof Error?i(l):s(l))}function i(o,...a){r||(r=!0,e(o,...a))}function s(o){i(null,o)}}const Kn={basename:W4,dirname:V4,extname:$4,join:G4,sep:"/"};function W4(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');Il(t);let r=0,n=-1,i=t.length,s;if(e===void 0||e.length===0||e.length>t.length){for(;i--;)if(t.codePointAt(i)===47){if(s){r=i+1;break}}else n<0&&(s=!0,n=i+1);return n<0?"":t.slice(r,n)}if(e===t)return"";let o=-1,a=e.length-1;for(;i--;)if(t.codePointAt(i)===47){if(s){r=i+1;break}}else o<0&&(s=!0,o=i+1),a>-1&&(t.codePointAt(i)===e.codePointAt(a--)?a<0&&(n=i):(a=-1,n=o));return r===n?n=o:n<0&&(n=t.length),t.slice(r,n)}function V4(t){if(Il(t),t.length===0)return".";let e=-1,r=t.length,n;for(;--r;)if(t.codePointAt(r)===47){if(n){e=r;break}}else n||(n=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function $4(t){Il(t);let e=t.length,r=-1,n=0,i=-1,s=0,o;for(;e--;){const a=t.codePointAt(e);if(a===47){if(o){n=e+1;break}continue}r<0&&(o=!0,r=e+1),a===46?i<0?i=e:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||r<0||s===0||s===1&&i===r-1&&i===n+1?"":t.slice(i,r)}function G4(...t){let e=-1,r;for(;++e<t.length;)Il(t[e]),t[e]&&(r=r===void 0?t[e]:r+"/"+t[e]);return r===void 0?".":q4(r)}function q4(t){Il(t);const e=t.codePointAt(0)===47;let r=Y4(t,!e);return r.length===0&&!e&&(r="."),r.length>0&&t.codePointAt(t.length-1)===47&&(r+="/"),e?"/"+r:r}function Y4(t,e){let r="",n=0,i=-1,s=0,o=-1,a,l;for(;++o<=t.length;){if(o<t.length)a=t.codePointAt(o);else{if(a===47)break;a=47}if(a===47){if(!(i===o-1||s===1))if(i!==o-1&&s===2){if(r.length<2||n!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(l=r.lastIndexOf("/"),l!==r.length-1){l<0?(r="",n=0):(r=r.slice(0,l),n=r.length-1-r.lastIndexOf("/")),i=o,s=0;continue}}else if(r.length>0){r="",n=0,i=o,s=0;continue}}e&&(r=r.length>0?r+"/..":"..",n=2)}else r.length>0?r+="/"+t.slice(i+1,o):r=t.slice(i+1,o),n=o-i-1;i=o,s=0}else a===46&&s>-1?s++:s=-1}return r}function Il(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const X4={cwd:K4};function K4(){return"/"}function Bv(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function Q4(t){if(typeof t=="string")t=new URL(t);else if(!Bv(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return Z4(t)}function Z4(t){if(t.hostname!==""){const n=new TypeError('File URL host must be "localhost" or empty on darwin');throw n.code="ERR_INVALID_FILE_URL_HOST",n}const e=t.pathname;let r=-1;for(;++r<e.length;)if(e.codePointAt(r)===37&&e.codePointAt(r+1)===50){const n=e.codePointAt(r+2);if(n===70||n===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(e)}const qp=["history","path","basename","stem","extname","dirname"];class zS{constructor(e){let r;e?Bv(e)?r={path:e}:typeof e=="string"||J4(e)?r={value:e}:r=e:r={},this.cwd="cwd"in r?"":X4.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<qp.length;){const s=qp[n];s in r&&r[s]!==void 0&&r[s]!==null&&(this[s]=s==="history"?[...r[s]]:r[s])}let i;for(i in r)qp.includes(i)||(this[i]=r[i])}get basename(){return typeof this.path=="string"?Kn.basename(this.path):void 0}set basename(e){Xp(e,"basename"),Yp(e,"basename"),this.path=Kn.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?Kn.dirname(this.path):void 0}set dirname(e){Pb(this.basename,"dirname"),this.path=Kn.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?Kn.extname(this.path):void 0}set extname(e){if(Yp(e,"extname"),Pb(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Kn.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){Bv(e)&&(e=Q4(e)),Xp(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?Kn.basename(this.path,this.extname):void 0}set stem(e){Xp(e,"stem"),Yp(e,"stem"),this.path=Kn.join(this.dirname||"",e+(this.extname||""))}fail(e,r,n){const i=this.message(e,r,n);throw i.fatal=!0,i}info(e,r,n){const i=this.message(e,r,n);return i.fatal=void 0,i}message(e,r,n){const i=new Wr(e,r,n);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function Yp(t,e){if(t&&t.includes(Kn.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+Kn.sep+"`")}function Xp(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function Pb(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function J4(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const eI=(function(t){const n=this.constructor.prototype,i=n[t],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,n),s}),tI={}.hasOwnProperty;class Lg extends eI{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=H4()}copy(){const e=new Lg;let r=-1;for(;++r<this.attachers.length;){const n=this.attachers[r];e.use(...n)}return e.data(Gp(!0,{},this.namespace)),e}data(e,r){return typeof e=="string"?arguments.length===2?(Zp("data",this.frozen),this.namespace[e]=r,this):tI.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Zp("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);const i=r.call(e,...n);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const r=ic(e),n=this.parser||this.Parser;return Kp("parse",n),n(String(r),r)}process(e,r){const n=this;return this.freeze(),Kp("process",this.parser||this.Parser),Qp("process",this.compiler||this.Compiler),r?i(void 0,r):new Promise(i);function i(s,o){const a=ic(e),l=n.parse(a);n.run(l,a,function(c,h,g){if(c||!h||!g)return u(c);const p=h,x=n.stringify(p,g);iI(x)?g.value=x:g.result=x,u(c,g)});function u(c,h){c||!h?o(c):s?s(h):r(void 0,h)}}}processSync(e){let r=!1,n;return this.freeze(),Kp("processSync",this.parser||this.Parser),Qp("processSync",this.compiler||this.Compiler),this.process(e,i),Ob("processSync","process",r),n;function i(s,o){r=!0,Ab(s),n=o}}run(e,r,n){Ib(e),this.freeze();const i=this.transformers;return!n&&typeof r=="function"&&(n=r,r=void 0),n?s(void 0,n):new Promise(s);function s(o,a){const l=ic(r);i.run(e,l,u);function u(c,h,g){const p=h||e;c?a(c):o?o(p):n(void 0,p,g)}}}runSync(e,r){let n=!1,i;return this.run(e,r,s),Ob("runSync","run",n),i;function s(o,a){Ab(o),i=a,n=!0}}stringify(e,r){this.freeze();const n=ic(r),i=this.compiler||this.Compiler;return Qp("stringify",i),Ib(e),i(e,n)}use(e,...r){const n=this.attachers,i=this.namespace;if(Zp("use",this.frozen),e!=null)if(typeof e=="function")l(e,r);else if(typeof e=="object")Array.isArray(e)?a(e):o(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function s(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[c,...h]=u;l(c,h)}else o(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function o(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(u.plugins),u.settings&&(i.settings=Gp(!0,i.settings,u.settings))}function a(u){let c=-1;if(u!=null)if(Array.isArray(u))for(;++c<u.length;){const h=u[c];s(h)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,c){let h=-1,g=-1;for(;++h<n.length;)if(n[h][0]===u){g=h;break}if(g===-1)n.push([u,...c]);else if(c.length>0){let[p,...x]=c;const w=n[g][1];Ov(w)&&Ov(p)&&(p=Gp(!0,w,p)),n[g]=[u,p,...x]}}}}const rI=new Lg().freeze();function Kp(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function Qp(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Zp(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Ib(t){if(!Ov(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function Ob(t,e,r){if(!r)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function ic(t){return nI(t)?t:new zS(t)}function nI(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function iI(t){return typeof t=="string"||aI(t)}function aI(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const sI="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Bb=[],Fb={allowDangerousHtml:!0},oI=/^(https?|ircs?|mailto|xmpp)$/i,lI=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function uI(t){const e=cI(t),r=hI(t);return fI(e.runSync(e.parse(r),r),t)}function cI(t){const e=t.rehypePlugins||Bb,r=t.remarkPlugins||Bb,n=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...Fb}:Fb;return rI().use(V5).use(r).use(F4,n).use(e)}function hI(t){const e=t.children||"",r=new zS;return typeof e=="string"&&(r.value=e),r}function fI(t,e){const r=e.allowedElements,n=e.allowElement,i=e.components,s=e.disallowedElements,o=e.skipHtml,a=e.unwrapDisallowed,l=e.urlTransform||dI;for(const c of lI)Object.hasOwn(e,c.from)&&(""+c.from+(c.to?"use `"+c.to+"` instead":"remove it")+sI+c.id,void 0);return Rg(t,u),TM(t,{Fragment:C.Fragment,components:i,ignoreInvalidStyle:!0,jsx:C.jsx,jsxs:C.jsxs,passKeys:!0,passNode:!0});function u(c,h,g){if(c.type==="raw"&&g&&typeof h=="number")return o?g.children.splice(h,1):g.children[h]={type:"text",value:c.value},h;if(c.type==="element"){let p;for(p in Up)if(Object.hasOwn(Up,p)&&Object.hasOwn(c.properties,p)){const x=c.properties[p],w=Up[p];(w===null||w.includes(c.tagName))&&(c.properties[p]=l(String(x||""),p,c))}}if(c.type==="element"){let p=r?!r.includes(c.tagName):s?s.includes(c.tagName):!1;if(!p&&n&&typeof h=="number"&&(p=!n(c,h,g)),p&&g&&typeof h=="number")return a&&c.children?g.children.splice(h,1,...c.children):g.children.splice(h,1),h}}}function dI(t){const e=t.indexOf(":"),r=t.indexOf("?"),n=t.indexOf("#"),i=t.indexOf("/");return e===-1||i!==-1&&e>i||r!==-1&&e>r||n!==-1&&e>n||oI.test(t.slice(0,e))?t:""}function jb(t,e){const r=String(t);if(typeof e!="string")throw new TypeError("Expected character");let n=0,i=r.indexOf(e);for(;i!==-1;)n++,i=r.indexOf(e,i+e.length);return n}function pI(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function vI(t,e,r){const i=ch((r||{}).ignore||[]),s=gI(e);let o=-1;for(;++o<s.length;)jS(t,"text",a);function a(u,c){let h=-1,g;for(;++h<c.length;){const p=c[h],x=g?g.children:void 0;if(i(p,x?x.indexOf(p):void 0,g))return;g=p}if(g)return l(u,c)}function l(u,c){const h=c[c.length-1],g=s[o][0],p=s[o][1];let x=0;const v=h.children.indexOf(u);let m=!1,y=[];g.lastIndex=0;let b=g.exec(u.value);for(;b;){const _=b.index,R={index:b.index,input:b.input,stack:[...c,u]};let E=p(...b,R);if(typeof E=="string"&&(E=E.length>0?{type:"text",value:E}:void 0),E===!1?g.lastIndex=_+1:(x!==_&&y.push({type:"text",value:u.value.slice(x,_)}),Array.isArray(E)?y.push(...E):E&&y.push(E),x=_+b[0].length,m=!0),!g.global)break;b=g.exec(u.value)}return m?(x<u.value.length&&y.push({type:"text",value:u.value.slice(x)}),h.children.splice(v,1,...y)):y=[u],v+y.length}}function gI(t){const e=[];if(!Array.isArray(t))throw new TypeError("Expected find and replace tuple or list of tuples");const r=!t[0]||Array.isArray(t[0])?t:[t];let n=-1;for(;++n<r.length;){const i=r[n];e.push([mI(i[0]),yI(i[1])])}return e}function mI(t){return typeof t=="string"?new RegExp(pI(t),"g"):t}function yI(t){return typeof t=="function"?t:function(){return t}}const Jp="phrasing",ev=["autolink","link","image","label"];function xI(){return{transforms:[kI],enter:{literalAutolink:wI,literalAutolinkEmail:tv,literalAutolinkHttp:tv,literalAutolinkWww:tv},exit:{literalAutolink:EI,literalAutolinkEmail:CI,literalAutolinkHttp:_I,literalAutolinkWww:SI}}}function bI(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Jp,notInConstruct:ev},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Jp,notInConstruct:ev},{character:":",before:"[ps]",after:"\\/",inConstruct:Jp,notInConstruct:ev}]}}function wI(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function tv(t){this.config.enter.autolinkProtocol.call(this,t)}function _I(t){this.config.exit.autolinkProtocol.call(this,t)}function SI(t){this.config.exit.data.call(this,t);const e=this.stack[this.stack.length-1];e.type,e.url="http://"+this.sliceSerialize(t)}function CI(t){this.config.exit.autolinkEmail.call(this,t)}function EI(t){this.exit(t)}function kI(t){vI(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,TI],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),RI]],{ignore:["link","linkReference"]})}function TI(t,e,r,n,i){let s="";if(!HS(i)||(/^w/i.test(e)&&(r=e+r,e="",s="http://"),!LI(r)))return!1;const o=NI(r+n);if(!o[0])return!1;const a={type:"link",title:null,url:s+e+o[0],children:[{type:"text",value:e+o[0]}]};return o[1]?[a,{type:"text",value:o[1]}]:a}function RI(t,e,r,n){return!HS(n,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+r,children:[{type:"text",value:e+"@"+r}]}}function LI(t){const e=t.split(".");return!(e.length<2||e[e.length-1]&&(/_/.test(e[e.length-1])||!/[a-zA-Z\d]/.test(e[e.length-1]))||e[e.length-2]&&(/_/.test(e[e.length-2])||!/[a-zA-Z\d]/.test(e[e.length-2])))}function NI(t){const e=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let r=e[0],n=r.indexOf(")");const i=jb(t,"(");let s=jb(t,")");for(;n!==-1&&i>s;)t+=r.slice(0,n+1),r=r.slice(n+1),n=r.indexOf(")"),s++;return[t,r]}function HS(t,e){const r=t.input.charCodeAt(t.index-1);return(t.index===0||Ha(r)||oh(r))&&(!e||r!==47)}US.peek=jI;function DI(){this.buffer()}function AI(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function MI(){this.buffer()}function PI(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function II(t){const e=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=zn(this.sliceSerialize(t)).toLowerCase(),r.label=e}function OI(t){this.exit(t)}function BI(t){const e=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=zn(this.sliceSerialize(t)).toLowerCase(),r.label=e}function FI(t){this.exit(t)}function jI(){return"["}function US(t,e,r,n){const i=r.createTracker(n);let s=i.move("[^");const o=r.enter("footnoteReference"),a=r.enter("reference");return s+=i.move(r.safe(r.associationId(t),{after:"]",before:s})),a(),o(),s+=i.move("]"),s}function zI(){return{enter:{gfmFootnoteCallString:DI,gfmFootnoteCall:AI,gfmFootnoteDefinitionLabelString:MI,gfmFootnoteDefinition:PI},exit:{gfmFootnoteCallString:II,gfmFootnoteCall:OI,gfmFootnoteDefinitionLabelString:BI,gfmFootnoteDefinition:FI}}}function HI(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:r,footnoteReference:US},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(n,i,s,o){const a=s.createTracker(o);let l=a.move("[^");const u=s.enter("footnoteDefinition"),c=s.enter("label");return l+=a.move(s.safe(s.associationId(n),{before:l,after:"]"})),c(),l+=a.move("]:"),n.children&&n.children.length>0&&(a.shift(4),l+=a.move((e?`
403
+ `:" ")+s.indentLines(s.containerFlow(n,a.current()),e?WS:UI))),u(),l}}function UI(t,e,r){return e===0?t:WS(t,e,r)}function WS(t,e,r){return(r?"":" ")+t}const WI=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];VS.peek=YI;function VI(){return{canContainEols:["delete"],enter:{strikethrough:GI},exit:{strikethrough:qI}}}function $I(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:WI}],handlers:{delete:VS}}}function GI(t){this.enter({type:"delete",children:[]},t)}function qI(t){this.exit(t)}function VS(t,e,r,n){const i=r.createTracker(n),s=r.enter("strikethrough");let o=i.move("~~");return o+=r.containerPhrasing(t,{...i.current(),before:o,after:"~"}),o+=i.move("~~"),s(),o}function YI(){return"~"}function XI(t){return t.length}function KI(t,e){const r=e||{},n=(r.align||[]).concat(),i=r.stringLength||XI,s=[],o=[],a=[],l=[];let u=0,c=-1;for(;++c<t.length;){const w=[],v=[];let m=-1;for(t[c].length>u&&(u=t[c].length);++m<t[c].length;){const y=QI(t[c][m]);if(r.alignDelimiters!==!1){const b=i(y);v[m]=b,(l[m]===void 0||b>l[m])&&(l[m]=b)}w.push(y)}o[c]=w,a[c]=v}let h=-1;if(typeof n=="object"&&"length"in n)for(;++h<u;)s[h]=zb(n[h]);else{const w=zb(n);for(;++h<u;)s[h]=w}h=-1;const g=[],p=[];for(;++h<u;){const w=s[h];let v="",m="";w===99?(v=":",m=":"):w===108?v=":":w===114&&(m=":");let y=r.alignDelimiters===!1?1:Math.max(1,l[h]-v.length-m.length);const b=v+"-".repeat(y)+m;r.alignDelimiters!==!1&&(y=v.length+y+m.length,y>l[h]&&(l[h]=y),p[h]=y),g[h]=b}o.splice(1,0,g),a.splice(1,0,p),c=-1;const x=[];for(;++c<o.length;){const w=o[c],v=a[c];h=-1;const m=[];for(;++h<u;){const y=w[h]||"";let b="",_="";if(r.alignDelimiters!==!1){const R=l[h]-(v[h]||0),E=s[h];E===114?b=" ".repeat(R):E===99?R%2?(b=" ".repeat(R/2+.5),_=" ".repeat(R/2-.5)):(b=" ".repeat(R/2),_=b):_=" ".repeat(R)}r.delimiterStart!==!1&&!h&&m.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&y==="")&&(r.delimiterStart!==!1||h)&&m.push(" "),r.alignDelimiters!==!1&&m.push(b),m.push(y),r.alignDelimiters!==!1&&m.push(_),r.padding!==!1&&m.push(" "),(r.delimiterEnd!==!1||h!==u-1)&&m.push("|")}x.push(r.delimiterEnd===!1?m.join("").replace(/ +$/,""):m.join(""))}return x.join(`
404
+ `)}function QI(t){return t==null?"":String(t)}function zb(t){const e=typeof t=="string"?t.codePointAt(0):0;return e===67||e===99?99:e===76||e===108?108:e===82||e===114?114:0}function ZI(t,e,r,n){const i=r.enter("blockquote"),s=r.createTracker(n);s.move("> "),s.shift(2);const o=r.indentLines(r.containerFlow(t,s.current()),JI);return i(),o}function JI(t,e,r){return">"+(r?"":" ")+t}function eO(t,e){return Hb(t,e.inConstruct,!0)&&!Hb(t,e.notInConstruct,!1)}function Hb(t,e,r){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return r;let n=-1;for(;++n<e.length;)if(t.includes(e[n]))return!0;return!1}function Ub(t,e,r,n){let i=-1;for(;++i<r.unsafe.length;)if(r.unsafe[i].character===`
405
+ `&&eO(r.stack,r.unsafe[i]))return/[ \t]/.test(n.before)?"":" ";return`\\
406
+ `}function tO(t,e){const r=String(t);let n=r.indexOf(e),i=n,s=0,o=0;if(typeof e!="string")throw new TypeError("Expected substring");for(;n!==-1;)n===i?++s>o&&(o=s):s=1,i=n+e.length,n=r.indexOf(e,i);return o}function rO(t,e){return!!(e.options.fences===!1&&t.value&&!t.lang&&/[^ \r\n]/.test(t.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(t.value))}function nO(t){const e=t.options.fence||"`";if(e!=="`"&&e!=="~")throw new Error("Cannot serialize code with `"+e+"` for `options.fence`, expected `` ` `` or `~`");return e}function iO(t,e,r,n){const i=nO(r),s=t.value||"",o=i==="`"?"GraveAccent":"Tilde";if(rO(t,r)){const h=r.enter("codeIndented"),g=r.indentLines(s,aO);return h(),g}const a=r.createTracker(n),l=i.repeat(Math.max(tO(s,i)+1,3)),u=r.enter("codeFenced");let c=a.move(l);if(t.lang){const h=r.enter(`codeFencedLang${o}`);c+=a.move(r.safe(t.lang,{before:c,after:" ",encode:["`"],...a.current()})),h()}if(t.lang&&t.meta){const h=r.enter(`codeFencedMeta${o}`);c+=a.move(" "),c+=a.move(r.safe(t.meta,{before:c,after:`
407
+ `,encode:["`"],...a.current()})),h()}return c+=a.move(`
408
+ `),s&&(c+=a.move(s+`
409
+ `)),c+=a.move(l),u(),c}function aO(t,e,r){return(r?"":" ")+t}function Ng(t){const e=t.options.quote||'"';if(e!=='"'&&e!=="'")throw new Error("Cannot serialize title with `"+e+"` for `options.quote`, expected `\"`, or `'`");return e}function sO(t,e,r,n){const i=Ng(r),s=i==='"'?"Quote":"Apostrophe",o=r.enter("definition");let a=r.enter("label");const l=r.createTracker(n);let u=l.move("[");return u+=l.move(r.safe(r.associationId(t),{before:u,after:"]",...l.current()})),u+=l.move("]: "),a(),!t.url||/[\0- \u007F]/.test(t.url)?(a=r.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(r.safe(t.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(a=r.enter("destinationRaw"),u+=l.move(r.safe(t.url,{before:u,after:t.title?" ":`
410
+ `,...l.current()}))),a(),t.title&&(a=r.enter(`title${s}`),u+=l.move(" "+i),u+=l.move(r.safe(t.title,{before:u,after:i,...l.current()})),u+=l.move(i),a()),o(),u}function oO(t){const e=t.options.emphasis||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize emphasis with `"+e+"` for `options.emphasis`, expected `*`, or `_`");return e}function bl(t){return"&#x"+t.toString(16).toUpperCase()+";"}function Hc(t,e,r){const n=Vs(t),i=Vs(e);return n===void 0?i===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:n===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}$S.peek=lO;function $S(t,e,r,n){const i=oO(r),s=r.enter("emphasis"),o=r.createTracker(n),a=o.move(i);let l=o.move(r.containerPhrasing(t,{after:i,before:a,...o.current()}));const u=l.charCodeAt(0),c=Hc(n.before.charCodeAt(n.before.length-1),u,i);c.inside&&(l=bl(u)+l.slice(1));const h=l.charCodeAt(l.length-1),g=Hc(n.after.charCodeAt(0),h,i);g.inside&&(l=l.slice(0,-1)+bl(h));const p=o.move(i);return s(),r.attentionEncodeSurroundingInfo={after:g.outside,before:c.outside},a+l+p}function lO(t,e,r){return r.options.emphasis||"*"}function uO(t,e){let r=!1;return Rg(t,function(n){if("value"in n&&/\r?\n|\r/.test(n.value)||n.type==="break")return r=!0,Pv}),!!((!t.depth||t.depth<3)&&wg(t)&&(e.options.setext||r))}function cO(t,e,r,n){const i=Math.max(Math.min(6,t.depth||1),1),s=r.createTracker(n);if(uO(t,r)){const c=r.enter("headingSetext"),h=r.enter("phrasing"),g=r.containerPhrasing(t,{...s.current(),before:`
411
+ `,after:`
412
+ `});return h(),c(),g+`
413
+ `+(i===1?"=":"-").repeat(g.length-(Math.max(g.lastIndexOf("\r"),g.lastIndexOf(`
414
+ `))+1))}const o="#".repeat(i),a=r.enter("headingAtx"),l=r.enter("phrasing");s.move(o+" ");let u=r.containerPhrasing(t,{before:"# ",after:`
415
+ `,...s.current()});return/^[\t ]/.test(u)&&(u=bl(u.charCodeAt(0))+u.slice(1)),u=u?o+" "+u:o,r.options.closeAtx&&(u+=" "+o),l(),a(),u}GS.peek=hO;function GS(t){return t.value||""}function hO(){return"<"}qS.peek=fO;function qS(t,e,r,n){const i=Ng(r),s=i==='"'?"Quote":"Apostrophe",o=r.enter("image");let a=r.enter("label");const l=r.createTracker(n);let u=l.move("![");return u+=l.move(r.safe(t.alt,{before:u,after:"]",...l.current()})),u+=l.move("]("),a(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(a=r.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(r.safe(t.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(a=r.enter("destinationRaw"),u+=l.move(r.safe(t.url,{before:u,after:t.title?" ":")",...l.current()}))),a(),t.title&&(a=r.enter(`title${s}`),u+=l.move(" "+i),u+=l.move(r.safe(t.title,{before:u,after:i,...l.current()})),u+=l.move(i),a()),u+=l.move(")"),o(),u}function fO(){return"!"}YS.peek=dO;function YS(t,e,r,n){const i=t.referenceType,s=r.enter("imageReference");let o=r.enter("label");const a=r.createTracker(n);let l=a.move("![");const u=r.safe(t.alt,{before:l,after:"]",...a.current()});l+=a.move(u+"]["),o();const c=r.stack;r.stack=[],o=r.enter("reference");const h=r.safe(r.associationId(t),{before:l,after:"]",...a.current()});return o(),r.stack=c,s(),i==="full"||!u||u!==h?l+=a.move(h+"]"):i==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function dO(){return"!"}XS.peek=pO;function XS(t,e,r){let n=t.value||"",i="`",s=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(n);)i+="`";for(/[^ \r\n]/.test(n)&&(/^[ \r\n]/.test(n)&&/[ \r\n]$/.test(n)||/^`|`$/.test(n))&&(n=" "+n+" ");++s<r.unsafe.length;){const o=r.unsafe[s],a=r.compilePattern(o);let l;if(o.atBreak)for(;l=a.exec(n);){let u=l.index;n.charCodeAt(u)===10&&n.charCodeAt(u-1)===13&&u--,n=n.slice(0,u)+" "+n.slice(l.index+1)}}return i+n+i}function pO(){return"`"}function KS(t,e){const r=wg(t);return!!(!e.options.resourceLink&&t.url&&!t.title&&t.children&&t.children.length===1&&t.children[0].type==="text"&&(r===t.url||"mailto:"+r===t.url)&&/^[a-z][a-z+.-]+:/i.test(t.url)&&!/[\0- <>\u007F]/.test(t.url))}QS.peek=vO;function QS(t,e,r,n){const i=Ng(r),s=i==='"'?"Quote":"Apostrophe",o=r.createTracker(n);let a,l;if(KS(t,r)){const c=r.stack;r.stack=[],a=r.enter("autolink");let h=o.move("<");return h+=o.move(r.containerPhrasing(t,{before:h,after:">",...o.current()})),h+=o.move(">"),a(),r.stack=c,h}a=r.enter("link"),l=r.enter("label");let u=o.move("[");return u+=o.move(r.containerPhrasing(t,{before:u,after:"](",...o.current()})),u+=o.move("]("),l(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(l=r.enter("destinationLiteral"),u+=o.move("<"),u+=o.move(r.safe(t.url,{before:u,after:">",...o.current()})),u+=o.move(">")):(l=r.enter("destinationRaw"),u+=o.move(r.safe(t.url,{before:u,after:t.title?" ":")",...o.current()}))),l(),t.title&&(l=r.enter(`title${s}`),u+=o.move(" "+i),u+=o.move(r.safe(t.title,{before:u,after:i,...o.current()})),u+=o.move(i),l()),u+=o.move(")"),a(),u}function vO(t,e,r){return KS(t,r)?"<":"["}ZS.peek=gO;function ZS(t,e,r,n){const i=t.referenceType,s=r.enter("linkReference");let o=r.enter("label");const a=r.createTracker(n);let l=a.move("[");const u=r.containerPhrasing(t,{before:l,after:"]",...a.current()});l+=a.move(u+"]["),o();const c=r.stack;r.stack=[],o=r.enter("reference");const h=r.safe(r.associationId(t),{before:l,after:"]",...a.current()});return o(),r.stack=c,s(),i==="full"||!u||u!==h?l+=a.move(h+"]"):i==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function gO(){return"["}function Dg(t){const e=t.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}function mO(t){const e=Dg(t),r=t.options.bulletOther;if(!r)return e==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+r+"`) to be different");return r}function yO(t){const e=t.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOrdered`, expected `.` or `)`");return e}function JS(t){const e=t.options.rule||"*";if(e!=="*"&&e!=="-"&&e!=="_")throw new Error("Cannot serialize rules with `"+e+"` for `options.rule`, expected `*`, `-`, or `_`");return e}function xO(t,e,r,n){const i=r.enter("list"),s=r.bulletCurrent;let o=t.ordered?yO(r):Dg(r);const a=t.ordered?o==="."?")":".":mO(r);let l=e&&r.bulletLastUsed?o===r.bulletLastUsed:!1;if(!t.ordered){const c=t.children?t.children[0]:void 0;if((o==="*"||o==="-")&&c&&(!c.children||!c.children[0])&&r.stack[r.stack.length-1]==="list"&&r.stack[r.stack.length-2]==="listItem"&&r.stack[r.stack.length-3]==="list"&&r.stack[r.stack.length-4]==="listItem"&&r.indexStack[r.indexStack.length-1]===0&&r.indexStack[r.indexStack.length-2]===0&&r.indexStack[r.indexStack.length-3]===0&&(l=!0),JS(r)===o&&c){let h=-1;for(;++h<t.children.length;){const g=t.children[h];if(g&&g.type==="listItem"&&g.children&&g.children[0]&&g.children[0].type==="thematicBreak"){l=!0;break}}}}l&&(o=a),r.bulletCurrent=o;const u=r.containerFlow(t,n);return r.bulletLastUsed=o,r.bulletCurrent=s,i(),u}function bO(t){const e=t.options.listItemIndent||"one";if(e!=="tab"&&e!=="one"&&e!=="mixed")throw new Error("Cannot serialize items with `"+e+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return e}function wO(t,e,r,n){const i=bO(r);let s=r.bulletCurrent||Dg(r);e&&e.type==="list"&&e.ordered&&(s=(typeof e.start=="number"&&e.start>-1?e.start:1)+(r.options.incrementListMarker===!1?0:e.children.indexOf(t))+s);let o=s.length+1;(i==="tab"||i==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(o=Math.ceil(o/4)*4);const a=r.createTracker(n);a.move(s+" ".repeat(o-s.length)),a.shift(o);const l=r.enter("listItem"),u=r.indentLines(r.containerFlow(t,a.current()),c);return l(),u;function c(h,g,p){return g?(p?"":" ".repeat(o))+h:(p?s:s+" ".repeat(o-s.length))+h}}function _O(t,e,r,n){const i=r.enter("paragraph"),s=r.enter("phrasing"),o=r.containerPhrasing(t,n);return s(),i(),o}const SO=ch(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function CO(t,e,r,n){return(t.children.some(function(o){return SO(o)})?r.containerPhrasing:r.containerFlow).call(r,t,n)}function EO(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}e2.peek=kO;function e2(t,e,r,n){const i=EO(r),s=r.enter("strong"),o=r.createTracker(n),a=o.move(i+i);let l=o.move(r.containerPhrasing(t,{after:i,before:a,...o.current()}));const u=l.charCodeAt(0),c=Hc(n.before.charCodeAt(n.before.length-1),u,i);c.inside&&(l=bl(u)+l.slice(1));const h=l.charCodeAt(l.length-1),g=Hc(n.after.charCodeAt(0),h,i);g.inside&&(l=l.slice(0,-1)+bl(h));const p=o.move(i+i);return s(),r.attentionEncodeSurroundingInfo={after:g.outside,before:c.outside},a+l+p}function kO(t,e,r){return r.options.strong||"*"}function TO(t,e,r,n){return r.safe(t.value,n)}function RO(t){const e=t.options.ruleRepetition||3;if(e<3)throw new Error("Cannot serialize rules with repetition `"+e+"` for `options.ruleRepetition`, expected `3` or more");return e}function LO(t,e,r){const n=(JS(r)+(r.options.ruleSpaces?" ":"")).repeat(RO(r));return r.options.ruleSpaces?n.slice(0,-1):n}const t2={blockquote:ZI,break:Ub,code:iO,definition:sO,emphasis:$S,hardBreak:Ub,heading:cO,html:GS,image:qS,imageReference:YS,inlineCode:XS,link:QS,linkReference:ZS,list:xO,listItem:wO,paragraph:_O,root:CO,strong:e2,text:TO,thematicBreak:LO};function NO(){return{enter:{table:DO,tableData:Wb,tableHeader:Wb,tableRow:MO},exit:{codeText:PO,table:AO,tableData:rv,tableHeader:rv,tableRow:rv}}}function DO(t){const e=t._align;this.enter({type:"table",align:e.map(function(r){return r==="none"?null:r}),children:[]},t),this.data.inTable=!0}function AO(t){this.exit(t),this.data.inTable=void 0}function MO(t){this.enter({type:"tableRow",children:[]},t)}function rv(t){this.exit(t)}function Wb(t){this.enter({type:"tableCell",children:[]},t)}function PO(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,IO));const r=this.stack[this.stack.length-1];r.type,r.value=e,this.exit(t)}function IO(t,e){return e==="|"?e:t}function OO(t){const e=t||{},r=e.tableCellPadding,n=e.tablePipeAlign,i=e.stringLength,s=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
416
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:g,table:o,tableCell:l,tableRow:a}};function o(p,x,w,v){return u(c(p,w,v),p.align)}function a(p,x,w,v){const m=h(p,w,v),y=u([m]);return y.slice(0,y.indexOf(`
417
+ `))}function l(p,x,w,v){const m=w.enter("tableCell"),y=w.enter("phrasing"),b=w.containerPhrasing(p,{...v,before:s,after:s});return y(),m(),b}function u(p,x){return KI(p,{align:x,alignDelimiters:n,padding:r,stringLength:i})}function c(p,x,w){const v=p.children;let m=-1;const y=[],b=x.enter("table");for(;++m<v.length;)y[m]=h(v[m],x,w);return b(),y}function h(p,x,w){const v=p.children;let m=-1;const y=[],b=x.enter("tableRow");for(;++m<v.length;)y[m]=l(v[m],p,x,w);return b(),y}function g(p,x,w){let v=t2.inlineCode(p,x,w);return w.stack.includes("tableCell")&&(v=v.replace(/\|/g,"\\$&")),v}}function BO(){return{exit:{taskListCheckValueChecked:Vb,taskListCheckValueUnchecked:Vb,paragraph:jO}}}function FO(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:zO}}}function Vb(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function jO(t){const e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const n=r.children[0];if(n&&n.type==="text"){const i=e.children;let s=-1,o;for(;++s<i.length;){const a=i[s];if(a.type==="paragraph"){o=a;break}}o===r&&(n.value=n.value.slice(1),n.value.length===0?r.children.shift():r.position&&n.position&&typeof n.position.start.offset=="number"&&(n.position.start.column++,n.position.start.offset++,r.position.start=Object.assign({},n.position.start)))}}this.exit(t)}function zO(t,e,r,n){const i=t.children[0],s=typeof t.checked=="boolean"&&i&&i.type==="paragraph",o="["+(t.checked?"x":" ")+"] ",a=r.createTracker(n);s&&a.move(o);let l=t2.listItem(t,e,r,{...n,...a.current()});return s&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),l;function u(c){return c+o}}function HO(){return[xI(),zI(),VI(),NO(),BO()]}function UO(t){return{extensions:[bI(),HI(t),$I(),OO(t),FO()]}}const WO={tokenize:XO,partial:!0},r2={tokenize:KO,partial:!0},n2={tokenize:QO,partial:!0},i2={tokenize:ZO,partial:!0},VO={tokenize:JO,partial:!0},a2={name:"wwwAutolink",tokenize:qO,previous:o2},s2={name:"protocolAutolink",tokenize:YO,previous:l2},xi={name:"emailAutolink",tokenize:GO,previous:u2},ni={};function $O(){return{text:ni}}let ka=48;for(;ka<123;)ni[ka]=xi,ka++,ka===58?ka=65:ka===91&&(ka=97);ni[43]=xi;ni[45]=xi;ni[46]=xi;ni[95]=xi;ni[72]=[xi,s2];ni[104]=[xi,s2];ni[87]=[xi,a2];ni[119]=[xi,a2];function GO(t,e,r){const n=this;let i,s;return o;function o(h){return!Fv(h)||!u2.call(n,n.previous)||Ag(n.events)?r(h):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),a(h))}function a(h){return Fv(h)?(t.consume(h),a):h===64?(t.consume(h),l):r(h)}function l(h){return h===46?t.check(VO,c,u)(h):h===45||h===95||jr(h)?(s=!0,t.consume(h),l):c(h)}function u(h){return t.consume(h),i=!0,l}function c(h){return s&&i&&Xr(n.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(h)):r(h)}}function qO(t,e,r){const n=this;return i;function i(o){return o!==87&&o!==119||!o2.call(n,n.previous)||Ag(n.events)?r(o):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(WO,t.attempt(r2,t.attempt(n2,s),r),r)(o))}function s(o){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(o)}}function YO(t,e,r){const n=this;let i="",s=!1;return o;function o(h){return(h===72||h===104)&&l2.call(n,n.previous)&&!Ag(n.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),i+=String.fromCodePoint(h),t.consume(h),a):r(h)}function a(h){if(Xr(h)&&i.length<5)return i+=String.fromCodePoint(h),t.consume(h),a;if(h===58){const g=i.toLowerCase();if(g==="http"||g==="https")return t.consume(h),l}return r(h)}function l(h){return h===47?(t.consume(h),s?u:(s=!0,l)):r(h)}function u(h){return h===null||Fc(h)||Wt(h)||Ha(h)||oh(h)?r(h):t.attempt(r2,t.attempt(n2,c),r)(h)}function c(h){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(h)}}function XO(t,e,r){let n=0;return i;function i(o){return(o===87||o===119)&&n<3?(n++,t.consume(o),i):o===46&&n===3?(t.consume(o),s):r(o)}function s(o){return o===null?r(o):e(o)}}function KO(t,e,r){let n,i,s;return o;function o(u){return u===46||u===95?t.check(i2,l,a)(u):u===null||Wt(u)||Ha(u)||u!==45&&oh(u)?l(u):(s=!0,t.consume(u),o)}function a(u){return u===95?n=!0:(i=n,n=void 0),t.consume(u),o}function l(u){return i||n||!s?r(u):e(u)}}function QO(t,e){let r=0,n=0;return i;function i(o){return o===40?(r++,t.consume(o),i):o===41&&n<r?s(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?t.check(i2,e,s)(o):o===null||Wt(o)||Ha(o)?e(o):(t.consume(o),i)}function s(o){return o===41&&n++,t.consume(o),i}}function ZO(t,e,r){return n;function n(a){return a===33||a===34||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===63||a===95||a===126?(t.consume(a),n):a===38?(t.consume(a),s):a===93?(t.consume(a),i):a===60||a===null||Wt(a)||Ha(a)?e(a):r(a)}function i(a){return a===null||a===40||a===91||Wt(a)||Ha(a)?e(a):n(a)}function s(a){return Xr(a)?o(a):r(a)}function o(a){return a===59?(t.consume(a),n):Xr(a)?(t.consume(a),o):r(a)}}function JO(t,e,r){return n;function n(s){return t.consume(s),i}function i(s){return jr(s)?r(s):e(s)}}function o2(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||Wt(t)}function l2(t){return!Xr(t)}function u2(t){return!(t===47||Fv(t))}function Fv(t){return t===43||t===45||t===46||t===95||jr(t)}function Ag(t){let e=t.length,r=!1;for(;e--;){const n=t[e][1];if((n.type==="labelLink"||n.type==="labelImage")&&!n._balanced){r=!0;break}if(n._gfmAutolinkLiteralWalkedInto){r=!1;break}}return t.length>0&&!r&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const eB={tokenize:lB,partial:!0};function tB(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:aB,continuation:{tokenize:sB},exit:oB}},text:{91:{name:"gfmFootnoteCall",tokenize:iB},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:rB,resolveTo:nB}}}}function rB(t,e,r){const n=this;let i=n.events.length;const s=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let o;for(;i--;){const l=n.events[i][1];if(l.type==="labelImage"){o=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return a;function a(l){if(!o||!o._balanced)return r(l);const u=zn(n.sliceSerialize({start:o.end,end:n.now()}));return u.codePointAt(0)!==94||!s.includes(u.slice(1))?r(l):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(l),t.exit("gfmFootnoteCallLabelMarker"),e(l))}}function nB(t,e){let r=t.length;for(;r--;)if(t[r][1].type==="labelImage"&&t[r][0]==="enter"){t[r][1];break}t[r+1][1].type="data",t[r+3][1].type="gfmFootnoteCallLabelMarker";const n={type:"gfmFootnoteCall",start:Object.assign({},t[r+3][1].start),end:Object.assign({},t[t.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},t[r+3][1].end),end:Object.assign({},t[r+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},t[t.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},a=[t[r+1],t[r+2],["enter",n,e],t[r+3],t[r+4],["enter",i,e],["exit",i,e],["enter",s,e],["enter",o,e],["exit",o,e],["exit",s,e],t[t.length-2],t[t.length-1],["exit",n,e]];return t.splice(r,t.length-r+1,...a),t}function iB(t,e,r){const n=this,i=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let s=0,o;return a;function a(h){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(h),t.exit("gfmFootnoteCallLabelMarker"),l}function l(h){return h!==94?r(h):(t.enter("gfmFootnoteCallMarker"),t.consume(h),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",u)}function u(h){if(s>999||h===93&&!o||h===null||h===91||Wt(h))return r(h);if(h===93){t.exit("chunkString");const g=t.exit("gfmFootnoteCallString");return i.includes(zn(n.sliceSerialize(g)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(h),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):r(h)}return Wt(h)||(o=!0),s++,t.consume(h),h===92?c:u}function c(h){return h===91||h===92||h===93?(t.consume(h),s++,u):u(h)}}function aB(t,e,r){const n=this,i=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let s,o=0,a;return l;function l(x){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(x),t.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(x){return x===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(x),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",c):r(x)}function c(x){if(o>999||x===93&&!a||x===null||x===91||Wt(x))return r(x);if(x===93){t.exit("chunkString");const w=t.exit("gfmFootnoteDefinitionLabelString");return s=zn(n.sliceSerialize(w)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(x),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),g}return Wt(x)||(a=!0),o++,t.consume(x),x===92?h:c}function h(x){return x===91||x===92||x===93?(t.consume(x),o++,c):c(x)}function g(x){return x===58?(t.enter("definitionMarker"),t.consume(x),t.exit("definitionMarker"),i.includes(s)||i.push(s),Tt(t,p,"gfmFootnoteDefinitionWhitespace")):r(x)}function p(x){return e(x)}}function sB(t,e,r){return t.check(Pl,e,t.attempt(eB,e,r))}function oB(t){t.exit("gfmFootnoteDefinition")}function lB(t,e,r){const n=this;return Tt(t,i,"gfmFootnoteDefinitionIndent",5);function i(s){const o=n.events[n.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?e(s):r(s)}}function uB(t){let r=(t||{}).singleTilde;const n={name:"strikethrough",tokenize:s,resolveAll:i};return r==null&&(r=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function i(o,a){let l=-1;for(;++l<o.length;)if(o[l][0]==="enter"&&o[l][1].type==="strikethroughSequenceTemporary"&&o[l][1]._close){let u=l;for(;u--;)if(o[u][0]==="exit"&&o[u][1].type==="strikethroughSequenceTemporary"&&o[u][1]._open&&o[l][1].end.offset-o[l][1].start.offset===o[u][1].end.offset-o[u][1].start.offset){o[l][1].type="strikethroughSequence",o[u][1].type="strikethroughSequence";const c={type:"strikethrough",start:Object.assign({},o[u][1].start),end:Object.assign({},o[l][1].end)},h={type:"strikethroughText",start:Object.assign({},o[u][1].end),end:Object.assign({},o[l][1].start)},g=[["enter",c,a],["enter",o[u][1],a],["exit",o[u][1],a],["enter",h,a]],p=a.parser.constructs.insideSpan.null;p&&yn(g,g.length,0,lh(p,o.slice(u+1,l),a)),yn(g,g.length,0,[["exit",h,a],["enter",o[l][1],a],["exit",o[l][1],a],["exit",c,a]]),yn(o,u-1,l-u+3,g),l=u+g.length-2;break}}for(l=-1;++l<o.length;)o[l][1].type==="strikethroughSequenceTemporary"&&(o[l][1].type="data");return o}function s(o,a,l){const u=this.previous,c=this.events;let h=0;return g;function g(x){return u===126&&c[c.length-1][1].type!=="characterEscape"?l(x):(o.enter("strikethroughSequenceTemporary"),p(x))}function p(x){const w=Vs(u);if(x===126)return h>1?l(x):(o.consume(x),h++,p);if(h<2&&!r)return l(x);const v=o.exit("strikethroughSequenceTemporary"),m=Vs(x);return v._open=!m||m===2&&!!w,v._close=!w||w===2&&!!m,a(x)}}}class cB{constructor(){this.map=[]}add(e,r,n){hB(this,e,r,n)}consume(e){if(this.map.sort(function(s,o){return s[0]-o[0]}),this.map.length===0)return;let r=this.map.length;const n=[];for(;r>0;)r-=1,n.push(e.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),e.length=this.map[r][0];n.push(e.slice()),e.length=0;let i=n.pop();for(;i;){for(const s of i)e.push(s);i=n.pop()}this.map.length=0}}function hB(t,e,r,n){let i=0;if(!(r===0&&n.length===0)){for(;i<t.map.length;){if(t.map[i][0]===e){t.map[i][1]+=r,t.map[i][2].push(...n);return}i+=1}t.map.push([e,r,n])}}function fB(t,e){let r=!1;const n=[];for(;e<t.length;){const i=t[e];if(r){if(i[0]==="enter")i[1].type==="tableContent"&&n.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){const s=n.length-1;n[s]=n[s]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(r=!0);e+=1}return n}function dB(){return{flow:{null:{name:"table",tokenize:pB,resolveAll:vB}}}}function pB(t,e,r){const n=this;let i=0,s=0,o;return a;function a(M){let B=n.events.length-1;for(;B>-1;){const D=n.events[B][1].type;if(D==="lineEnding"||D==="linePrefix")B--;else break}const A=B>-1?n.events[B][1].type:null,j=A==="tableHead"||A==="tableRow"?E:l;return j===E&&n.parser.lazy[n.now().line]?r(M):j(M)}function l(M){return t.enter("tableHead"),t.enter("tableRow"),u(M)}function u(M){return M===124||(o=!0,s+=1),c(M)}function c(M){return M===null?r(M):ft(M)?s>1?(s=0,n.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(M),t.exit("lineEnding"),p):r(M):Ct(M)?Tt(t,c,"whitespace")(M):(s+=1,o&&(o=!1,i+=1),M===124?(t.enter("tableCellDivider"),t.consume(M),t.exit("tableCellDivider"),o=!0,c):(t.enter("data"),h(M)))}function h(M){return M===null||M===124||Wt(M)?(t.exit("data"),c(M)):(t.consume(M),M===92?g:h)}function g(M){return M===92||M===124?(t.consume(M),h):h(M)}function p(M){return n.interrupt=!1,n.parser.lazy[n.now().line]?r(M):(t.enter("tableDelimiterRow"),o=!1,Ct(M)?Tt(t,x,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):x(M))}function x(M){return M===45||M===58?v(M):M===124?(o=!0,t.enter("tableCellDivider"),t.consume(M),t.exit("tableCellDivider"),w):R(M)}function w(M){return Ct(M)?Tt(t,v,"whitespace")(M):v(M)}function v(M){return M===58?(s+=1,o=!0,t.enter("tableDelimiterMarker"),t.consume(M),t.exit("tableDelimiterMarker"),m):M===45?(s+=1,m(M)):M===null||ft(M)?_(M):R(M)}function m(M){return M===45?(t.enter("tableDelimiterFiller"),y(M)):R(M)}function y(M){return M===45?(t.consume(M),y):M===58?(o=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(M),t.exit("tableDelimiterMarker"),b):(t.exit("tableDelimiterFiller"),b(M))}function b(M){return Ct(M)?Tt(t,_,"whitespace")(M):_(M)}function _(M){return M===124?x(M):M===null||ft(M)?!o||i!==s?R(M):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(M)):R(M)}function R(M){return r(M)}function E(M){return t.enter("tableRow"),T(M)}function T(M){return M===124?(t.enter("tableCellDivider"),t.consume(M),t.exit("tableCellDivider"),T):M===null||ft(M)?(t.exit("tableRow"),e(M)):Ct(M)?Tt(t,T,"whitespace")(M):(t.enter("data"),k(M))}function k(M){return M===null||M===124||Wt(M)?(t.exit("data"),T(M)):(t.consume(M),M===92?N:k)}function N(M){return M===92||M===124?(t.consume(M),k):k(M)}}function vB(t,e){let r=-1,n=!0,i=0,s=[0,0,0,0],o=[0,0,0,0],a=!1,l=0,u,c,h;const g=new cB;for(;++r<t.length;){const p=t[r],x=p[1];p[0]==="enter"?x.type==="tableHead"?(a=!1,l!==0&&($b(g,e,l,u,c),c=void 0,l=0),u={type:"table",start:Object.assign({},x.start),end:Object.assign({},x.end)},g.add(r,0,[["enter",u,e]])):x.type==="tableRow"||x.type==="tableDelimiterRow"?(n=!0,h=void 0,s=[0,0,0,0],o=[0,r+1,0,0],a&&(a=!1,c={type:"tableBody",start:Object.assign({},x.start),end:Object.assign({},x.end)},g.add(r,0,[["enter",c,e]])),i=x.type==="tableDelimiterRow"?2:c?3:1):i&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")?(n=!1,o[2]===0&&(s[1]!==0&&(o[0]=o[1],h=ac(g,e,s,i,void 0,h),s=[0,0,0,0]),o[2]=r)):x.type==="tableCellDivider"&&(n?n=!1:(s[1]!==0&&(o[0]=o[1],h=ac(g,e,s,i,void 0,h)),s=o,o=[s[1],r,0,0])):x.type==="tableHead"?(a=!0,l=r):x.type==="tableRow"||x.type==="tableDelimiterRow"?(l=r,s[1]!==0?(o[0]=o[1],h=ac(g,e,s,i,r,h)):o[1]!==0&&(h=ac(g,e,o,i,r,h)),i=0):i&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")&&(o[3]=r)}for(l!==0&&$b(g,e,l,u,c),g.consume(e.events),r=-1;++r<e.events.length;){const p=e.events[r];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=fB(e.events,r))}return t}function ac(t,e,r,n,i,s){const o=n===1?"tableHeader":n===2?"tableDelimiter":"tableData",a="tableContent";r[0]!==0&&(s.end=Object.assign({},Ns(e.events,r[0])),t.add(r[0],0,[["exit",s,e]]));const l=Ns(e.events,r[1]);if(s={type:o,start:Object.assign({},l),end:Object.assign({},l)},t.add(r[1],0,[["enter",s,e]]),r[2]!==0){const u=Ns(e.events,r[2]),c=Ns(e.events,r[3]),h={type:a,start:Object.assign({},u),end:Object.assign({},c)};if(t.add(r[2],0,[["enter",h,e]]),n!==2){const g=e.events[r[2]],p=e.events[r[3]];if(g[1].end=Object.assign({},p[1].end),g[1].type="chunkText",g[1].contentType="text",r[3]>r[2]+1){const x=r[2]+1,w=r[3]-r[2]-1;t.add(x,w,[])}}t.add(r[3]+1,0,[["exit",h,e]])}return i!==void 0&&(s.end=Object.assign({},Ns(e.events,i)),t.add(i,0,[["exit",s,e]]),s=void 0),s}function $b(t,e,r,n,i){const s=[],o=Ns(e.events,r);i&&(i.end=Object.assign({},o),s.push(["exit",i,e])),n.end=Object.assign({},o),s.push(["exit",n,e]),t.add(r+1,0,s)}function Ns(t,e){const r=t[e],n=r[0]==="enter"?"start":"end";return r[1][n]}const gB={name:"tasklistCheck",tokenize:yB};function mB(){return{text:{91:gB}}}function yB(t,e,r){const n=this;return i;function i(l){return n.previous!==null||!n._gfmTasklistFirstContentOfListItem?r(l):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(l),t.exit("taskListCheckMarker"),s)}function s(l){return Wt(l)?(t.enter("taskListCheckValueUnchecked"),t.consume(l),t.exit("taskListCheckValueUnchecked"),o):l===88||l===120?(t.enter("taskListCheckValueChecked"),t.consume(l),t.exit("taskListCheckValueChecked"),o):r(l)}function o(l){return l===93?(t.enter("taskListCheckMarker"),t.consume(l),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),a):r(l)}function a(l){return ft(l)?e(l):Ct(l)?t.check({tokenize:xB},e,r)(l):r(l)}}function xB(t,e,r){return Tt(t,n,"whitespace");function n(i){return i===null?r(i):e(i)}}function bB(t){return xS([$O(),tB(),uB(t),dB(),mB()])}const wB={};function _B(t){const e=this,r=t||wB,n=e.data(),i=n.micromarkExtensions||(n.micromarkExtensions=[]),s=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),o=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);i.push(bB(r)),s.push(HO()),o.push(UO(r))}const SB={h1:({children:t})=>C.jsx("h1",{className:"text-lg font-bold mt-4 mb-2",style:{color:"#e6edf3"},children:t}),h2:({children:t})=>C.jsx("h2",{className:"text-base font-bold mt-3 mb-1.5",style:{color:"#e6edf3"},children:t}),h3:({children:t})=>C.jsx("h3",{className:"text-sm font-semibold mt-2 mb-1",style:{color:"#e6edf3"},children:t}),p:({children:t})=>C.jsx("p",{className:"mb-2 last:mb-0 leading-relaxed",children:t}),a:({href:t,children:e})=>C.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"underline",style:{color:"#79c0ff"},children:e}),img:({alt:t})=>C.jsxs("span",{className:"text-xs font-mono rounded px-1",style:{background:"rgba(230,237,243,0.08)",color:"rgba(230,237,243,0.4)"},children:["[image",t?`: ${t}`:"","]"]}),code:({className:t,children:e})=>!!(t!=null&&t.startsWith("language-"))||typeof e=="string"&&e.includes(`
418
+ `)?C.jsx("code",{className:`block overflow-auto rounded-lg px-4 py-3 text-xs leading-5 font-mono my-2 ${t??""}`,style:{background:"#0d1117",color:"#e6edf3"},children:e}):C.jsx("code",{className:"rounded px-1.5 py-0.5 text-xs font-mono",style:{background:"rgba(230,237,243,0.1)",color:"#e6edf3"},children:e}),pre:({children:t})=>C.jsx("pre",{className:"my-2",children:t}),blockquote:({children:t})=>C.jsx("blockquote",{className:"pl-3 my-2 italic text-sm",style:{borderLeft:"3px solid rgba(230,237,243,0.2)",color:"rgba(230,237,243,0.6)"},children:t}),ul:({children:t})=>C.jsx("ul",{className:"list-disc pl-5 mb-2 space-y-0.5",children:t}),ol:({children:t})=>C.jsx("ol",{className:"list-decimal pl-5 mb-2 space-y-0.5",children:t}),li:({children:t})=>C.jsx("li",{className:"text-sm leading-relaxed",children:t}),table:({children:t})=>C.jsx("div",{className:"overflow-x-auto my-2",children:C.jsx("table",{className:"text-xs w-full border-collapse font-mono",children:t})}),thead:({children:t})=>C.jsx("thead",{style:{borderBottom:"1px solid rgba(230,237,243,0.12)"},children:t}),tbody:({children:t})=>C.jsx("tbody",{children:t}),tr:({children:t})=>C.jsx("tr",{style:{borderBottom:"1px solid rgba(230,237,243,0.06)"},children:t}),th:({children:t})=>C.jsx("th",{className:"text-left px-3 py-1.5 font-semibold",style:{color:"rgba(230,237,243,0.7)"},children:t}),td:({children:t})=>C.jsx("td",{className:"px-3 py-1.5",style:{color:"#e6edf3"},children:t}),hr:()=>C.jsx("hr",{className:"my-3",style:{borderColor:"rgba(230,237,243,0.1)"}}),strong:({children:t})=>C.jsx("strong",{className:"font-semibold",style:{color:"#e6edf3"},children:t}),em:({children:t})=>C.jsx("em",{style:{color:"rgba(230,237,243,0.8)"},children:t})};function CB({children:t,className:e}){return C.jsx("div",{className:`text-sm leading-relaxed ${e??""}`,style:{color:"#e6edf3"},children:C.jsx(uI,{remarkPlugins:[_B],components:SB,children:t})})}const EB={ask:"Ask",balanced:"Balanced",autonomous:"Autonomous"},kB={claude:{bg:"rgba(139,92,246,0.25)",fg:"#c4b5fd"},codex:{bg:"rgba(59,130,246,0.25)",fg:"#93c5fd"},antigravity:{bg:"rgba(34,197,94,0.2)",fg:"#86efac"},cursor:{bg:"rgba(20,184,166,0.2)",fg:"#5eead4"}},TB={bg:"rgba(230,237,243,0.1)",fg:"rgba(230,237,243,0.55)"};function RB(t){var r,n;const e=t.split(/[-_]/);return e.length>1?((((r=e[0])==null?void 0:r[0])??"")+(((n=e[1])==null?void 0:n[0])??"")).toUpperCase():t.slice(0,2).toUpperCase()}function LB({runId:t,ord:e}){var i,s;const r=Pa(o=>o.councilStatus[`${t}:${e}`]),n=r?r.state==="convened"?`Council convened — polling ${((i=r.clis)==null?void 0:i.length)??"?"} CLI${(((s=r.clis)==null?void 0:s.length)??0)===1?"":"s"}…`:r.state==="deliberating"?`Ballot ${r.round??"?"}: ${r.agreementPct??"?"}% — below the ${r.neededPct??75}% bar, runoff in progress…`:`Council voted — ${r.agreementPct??"?"}% agreement (${r.votes??"?"} votes)`:"Council deliberating…";return C.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono rounded-lg px-3 py-2",style:{background:"rgba(139,92,246,0.08)",border:"1px solid rgba(139,92,246,0.18)",color:"#a78bfa"},children:[C.jsx("span",{className:`inline-block w-1.5 h-1.5 rounded-full ${(r==null?void 0:r.state)==="voted"?"":"animate-pulse"}`,style:{background:"#a78bfa"}}),C.jsx("span",{children:n})]})}function NB({runId:t,ord:e}){const r=Pa(i=>i.outputs[Z_(t,e)]);if(!r)return null;const n=r.length>800?"…"+r.slice(r.length-800):r;return C.jsx("pre",{className:"mt-2 max-h-48 overflow-auto rounded-lg p-2 text-[10px] leading-snug whitespace-pre-wrap font-mono",style:{background:"rgba(13,17,23,0.6)",color:"rgba(230,237,243,0.65)",border:"1px solid rgba(230,237,243,0.06)"},children:n})}function DB({reason:t}){const[e,r]=ae.useState(!1),[n,i]=ae.useState(!1),s="degraded-routing-detail";return e?C.jsx(C.Fragment,{}):C.jsxs("div",{className:"self-start max-w-[85%] rounded-xl px-4 py-2.5 text-xs font-mono flex flex-col gap-1.5",style:{background:"rgba(255,218,25,0.08)",border:"1px solid rgba(255,218,25,0.2)",color:"#ffda19"},children:[C.jsxs("div",{className:"flex items-center gap-2",children:[C.jsx("span",{className:"shrink-0","aria-hidden":"true",children:"⚠"}),C.jsxs("span",{className:"flex-1",children:["Degraded routing: ",t]}),C.jsx("button",{type:"button",onClick:()=>i(o=>!o),className:"shrink-0 text-[10px] transition-opacity hover:opacity-70",style:{color:"rgba(255,218,25,0.6)"},"aria-expanded":n,"aria-controls":s,"aria-label":n?"Hide explanation":"Show explanation",children:n?"▲":"▼"}),C.jsx("button",{type:"button",onClick:()=>r(!0),className:"shrink-0 transition-opacity hover:opacity-70",style:{color:"rgba(255,218,25,0.5)"},"aria-label":"Dismiss degraded routing warning",children:C.jsx("span",{"aria-hidden":"true",children:"✕"})})]}),n&&C.jsxs("p",{id:s,className:"text-[10px] leading-relaxed pl-5",style:{color:"rgba(255,218,25,0.6)"},children:["The multi-model council could not reach a quorum vote. The unit proceeded using a fallback routing strategy. Open the ",C.jsx("strong",{children:"Decisions"})," section in the Insights panel on the right to see each reviewer's verdict."]})]})}function AB({cli:t}){const{bg:e,fg:r}=kB[t.toLowerCase()]??TB;return C.jsx("span",{"aria-hidden":"true",className:"shrink-0 w-7 h-7 rounded-full flex items-center justify-center text-[10px] font-bold font-mono select-none",style:{background:e,color:r},children:RB(t)})}const MB={recon:{bg:"rgba(139,92,246,0.15)",color:"#a78bfa"},build:{bg:"rgba(63,185,80,0.12)",color:"#3fb950"},review:{bg:"rgba(121,192,255,0.12)",color:"#79c0ff"},test:{bg:"rgba(255,218,25,0.12)",color:"#ffda19"}},PB={pending:"queued",distributed:"dispatched",done:"done",rejected:"rejected"};function IB(t,e,r){return e.startsWith(`${t}:`)?e.slice(t.length+1):`u${r}`}const OB=new Set(["sessionStarted","sessionCompleted","sessionFailed","awaitingHuman","gateDecided","resumed","runCancelled","workerMessageQueued","workerMessageInjected"]),BB=new Set(["stepFailed","crashRecoveryRedrive","workerStalled","failureTriaged"]);function FB(t,e){switch(t){case"sessionStarted":return"Run started";case"sessionCompleted":return"✓ Run completed";case"sessionFailed":return"✗ Run failed";case"awaitingHuman":return"Waiting for your input…";case"gateDecided":return e.includes("allow")?"Gate: allow":"Gate: deny";case"resumed":return"Run resumed";case"runCancelled":return"Run cancelled";case"workerMessageQueued":return`Message queued for next turn — ${e}`;case"workerMessageInjected":return`Message delivered — ${e}`;default:return e}}function jB(t){switch(t){case"completed":return"#3fb950";case"failed":return"#f85149";case"cancelled":return"rgba(230,237,243,0.25)";case"awaiting_human":return"#ffda19";default:return"#79c0ff"}}function zB(){return C.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[C.jsx("circle",{cx:"8",cy:"8",r:"6.75",stroke:"currentColor",strokeWidth:"1.5"}),C.jsx("rect",{x:"5.25",y:"5.25",width:"5.5",height:"5.5",rx:"0.75",fill:"currentColor"})]})}function HB(){return C.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[C.jsx("path",{d:"M8 2v7.25m0 0L5.25 6.5M8 9.25l2.75-2.75",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),C.jsx("path",{d:"M2.75 11v1.25c0 .69.56 1.25 1.25 1.25h8c.69 0 1.25-.56 1.25-1.25V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}function UB({runId:t,disabled:e}){const[r,n]=ae.useState(!1),[i,s]=ae.useState(null);async function o(){n(!0),s(null);try{await oE(t)}catch(u){s(u instanceof Error?u.message:String(u))}finally{n(!1)}}const a=e||r,l=e?"Export evidence — available once the run finishes":i??(r?"Exporting evidence…":"Export evidence");return C.jsxs(C.Fragment,{children:[i&&C.jsxs("span",{role:"alert",className:"text-[11px] font-mono shrink-0 max-w-[14rem] truncate",style:{color:"#f85149"},children:["Export failed: ",i]}),C.jsx("button",{type:"button",onClick:()=>void o(),disabled:a,title:l,"aria-label":"Export evidence","aria-busy":r,className:"flex items-center justify-center w-6 h-6 rounded shrink-0 transition-opacity disabled:cursor-not-allowed",style:{color:i?"#f85149":"#79c0ff",opacity:a?.3:.65},onMouseEnter:u=>{a||(u.currentTarget.style.opacity="1")},onMouseLeave:u=>{a||(u.currentTarget.style.opacity="0.65")},children:C.jsx(HB,{})})]})}function WB({detail:t,onStop:e,canStop:r}){return C.jsxs("div",{className:"self-start max-w-[85%] rounded-xl px-4 py-3 flex flex-col gap-2 font-mono text-xs",style:{background:"rgba(248,81,73,0.07)",border:"1px solid rgba(248,81,73,0.25)",color:"#f85149"},children:[C.jsxs("div",{className:"flex items-center gap-2 font-semibold text-[11px] uppercase tracking-wide",children:[C.jsx("span",{children:"⚠"}),C.jsx("span",{children:"Step failure"})]}),t&&C.jsx("pre",{className:"text-[11px] leading-relaxed whitespace-pre-wrap break-words m-0 overflow-hidden",style:{color:"rgba(230,237,243,0.6)",fontFamily:"inherit"},children:t.length>200?`${t.slice(0,200)}…`:t}),C.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[C.jsx("button",{type:"button",title:"Reassign not yet available",disabled:!0,className:"rounded px-3 py-1 text-[11px] font-semibold opacity-30 cursor-not-allowed",style:{background:"rgba(230,237,243,0.08)",color:"#e6edf3"},children:"Reassign"}),C.jsx("button",{type:"button",onClick:r?e:void 0,disabled:!r,className:"rounded px-3 py-1 text-[11px] font-semibold transition-opacity hover:opacity-100 opacity-80 disabled:opacity-30 disabled:cursor-not-allowed",style:{background:"rgba(248,81,73,0.15)",color:"#f85149",border:"1px solid rgba(248,81,73,0.3)"},children:"Stop run"})]})]})}function VB({attempt:t}){return C.jsxs("div",{className:"self-start max-w-[85%] rounded-xl px-4 py-3 flex flex-col gap-1 font-mono text-xs",style:{background:"rgba(255,218,25,0.06)",border:"1px solid rgba(255,218,25,0.2)",color:"#ffda19"},children:[C.jsxs("div",{className:"flex items-center gap-2 font-semibold text-[11px] uppercase tracking-wide",children:[C.jsx("span",{children:"↺"}),C.jsxs("span",{children:["Crash recovery — attempt ",t]})]}),C.jsx("p",{className:"text-[11px]",style:{color:"rgba(230,237,243,0.5)"},children:"The engine restarted and is re-dispatching this unit automatically."})]})}function c2({mode:t,onChange:e,readOnly:r=!1}){const n=["ask","balanced","autonomous"];function i(s,o){var l,u;if(r)return;let a=o;if(s.key==="ArrowRight"||s.key==="ArrowDown")a=(o+1)%n.length;else if(s.key==="ArrowLeft"||s.key==="ArrowUp")a=(o-1+n.length)%n.length;else return;s.preventDefault(),e(n[a]),(u=(l=s.currentTarget.parentElement)==null?void 0:l.children[a])==null||u.focus()}return C.jsx("div",{role:"radiogroup","aria-label":"Run mode","aria-disabled":r||void 0,title:r?"Run mode (read-only — run is complete)":void 0,className:"flex items-center rounded-lg overflow-hidden shrink-0",style:{background:"rgba(230,237,243,0.06)",border:"1px solid rgba(230,237,243,0.1)",opacity:r?.6:1},children:n.map((s,o)=>C.jsx("button",{type:"button",role:"radio","aria-checked":t===s,"aria-disabled":r,tabIndex:r?-1:t===s?0:-1,onClick:r?void 0:()=>e(s),onKeyDown:r?void 0:a=>i(a,o),disabled:r,className:"px-3 py-1 text-[11px] font-mono font-medium transition-colors disabled:cursor-default",style:t===s?{background:"rgba(255,218,25,0.15)",color:r?"rgba(255,218,25,0.7)":"#ffda19"}:{background:"transparent",color:"rgba(230,237,243,0.35)"},children:EB[s]},s))})}function $B({view:t,mode:e,onModeChange:r,onLaunched:n,onNavigateBack:i,onRefresh:s,onKill:o}){const{session:a,units:l}=t,u=Jn(A=>A.gates[a.id]),c=Pa(A=>A.logs[a.id])??[],h=Pa(A=>A.executorTypes),[g,p]=ae.useState("all"),x=Pa(A=>A.terminalIds),[w,v]=ae.useState(null),[m,y]=ae.useState({}),b=ae.useRef(new Set),_=ae.useRef(null);ae.useEffect(()=>{var A;(A=_.current)==null||A.scrollIntoView({behavior:"smooth"})},[l.length,c.length]),ae.useEffect(()=>{for(const A of l)A.status==="done"&&!b.current.has(A.ord)&&(b.current.add(A.ord),y(j=>({...j,[A.ord]:{text:null,loading:!0,visible:!0}})),lt.getUnitOutput(a.id,IB(a.id,A.id,A.ord)).then(({output:j})=>{y(D=>({...D,[A.ord]:{text:j??"(no transcript captured)",loading:!1,visible:!0}}))}).catch(()=>{y(j=>({...j,[A.ord]:{text:"(transcript unavailable)",loading:!1,visible:!0}}))}))},[l,a.id]);function R(A){y(j=>{const D=j[A];return D?{...j,[A]:{...D,visible:!D.visible}}:j})}const E=$A[a.status]??{label:a.status,color:"rgba(230,237,243,0.5)"},T=["completed","cancelled","failed"].includes(a.status),k=c.filter(A=>OB.has(A.type)||BB.has(A.type)),N=jB(a.status),M=["executing","distributing","planning","awaiting_human"].includes(a.status);function B(){o==null||o(a.id)}return C.jsxs("div",{className:"flex flex-col h-full",children:[C.jsxs("div",{className:"flex items-center gap-3 px-6 py-4 shrink-0",style:{borderBottom:"1px solid rgba(230,237,243,0.07)",background:"#1b222e"},children:[C.jsx("button",{type:"button",onClick:i,"aria-label":"Back to run list",className:"w-8 h-8 flex items-center justify-center rounded-lg transition-colors shrink-0",style:{color:"rgba(230,237,243,0.4)"},onMouseEnter:A=>{A.currentTarget.style.background="rgba(230,237,243,0.06)",A.currentTarget.style.color="#e6edf3"},onMouseLeave:A=>{A.currentTarget.style.background="transparent",A.currentTarget.style.color="rgba(230,237,243,0.4)"},children:"←"}),C.jsx("span",{className:`w-2.5 h-2.5 rounded-full shrink-0 ${M?"animate-pulse":""}`,style:{background:N}}),C.jsx("p",{className:"flex-1 text-base font-semibold truncate",style:{color:"#e6edf3"},title:a.problem,children:a.problem}),C.jsx("span",{className:"text-xs font-medium shrink-0 font-mono",style:{color:E.color},children:E.label}),C.jsx(c2,{mode:e,onChange:r,readOnly:T}),C.jsx(UB,{runId:a.id,disabled:!T}),!T&&o&&C.jsx("button",{type:"button",onClick:()=>void o(a.id),title:"Kill run (Ctrl+K)","aria-label":"Kill run",className:"flex items-center justify-center w-6 h-6 rounded shrink-0 transition-opacity disabled:opacity-30",style:{color:"#f85149",opacity:.65},onMouseEnter:A=>{A.currentTarget.style.opacity="1"},onMouseLeave:A=>{A.currentTarget.style.opacity="0.65"},children:C.jsx(zB,{})})]}),C.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-6 flex flex-col gap-6 max-w-3xl w-full mx-auto",children:[C.jsx("div",{className:"flex justify-end",children:C.jsx("div",{className:"max-w-[72%] rounded-2xl text-base px-5 py-3.5 leading-relaxed",style:{background:"#224a5e",color:"#e6edf3",border:"1px solid rgba(230,237,243,0.12)"},children:a.problem})}),[...l].sort((A,j)=>A.ord-j.ord).flatMap(A=>{const j=m[A.ord],D=MB[A.stage]??{bg:"rgba(230,237,243,0.08)",color:"rgba(230,237,243,0.5)"},I=a.status==="awaiting_human"&&(u==null?void 0:u.ord)===A.ord,U=C.jsxs("div",{className:"flex flex-col gap-2",children:[A.routing!==null&&A.routing.method==="council"&&C.jsxs("div",{className:"self-start max-w-[85%] rounded-xl px-4 py-2 text-xs flex items-center gap-2 font-mono",style:{background:"rgba(139,92,246,0.1)",border:"1px solid rgba(139,92,246,0.2)",color:"#a78bfa"},children:[C.jsx("span",{className:"shrink-0",children:"⚖"}),C.jsxs("span",{children:[C.jsxs("span",{className:"font-semibold",children:["Council → ",A.assigned_cli??"?"]}),C.jsxs("span",{className:"ml-2",style:{color:"rgba(167,139,250,0.6)"},children:[A.routing.returned," polled · ",A.routing.agreement_pct,"% agree · ",A.routing.dissent," dissent"]})]})]}),A.routing!==null&&A.routing.method==="evaluator_distinct"&&C.jsxs("div",{className:"self-start max-w-[85%] rounded-xl px-4 py-2 text-xs flex items-center gap-2 font-mono",style:{background:"rgba(139,92,246,0.1)",border:"1px solid rgba(139,92,246,0.2)",color:"#a78bfa"},children:[C.jsx("span",{className:"shrink-0",children:"⚖"}),C.jsxs("span",{children:[C.jsxs("span",{className:"font-semibold",children:["Evaluator-distinct → ",A.assigned_cli??"?"]}),C.jsxs("span",{className:"ml-2",style:{color:"rgba(167,139,250,0.6)"},children:["(was: ",A.routing.was,")"]})]})]}),A.routing!==null&&A.routing.method==="degraded"&&C.jsx(DB,{reason:A.routing.reason}),C.jsxs("div",{className:"self-start max-w-[85%] flex flex-col gap-2",children:[C.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[A.assigned_cli?C.jsxs("div",{className:"flex items-center gap-1",children:[C.jsxs("button",{type:"button",onClick:()=>p(A.assigned_cli),title:`Target ${A.assigned_cli}`,"aria-label":`Send message to ${A.assigned_cli} only`,className:"flex items-center gap-2 rounded-lg p-0 pr-1 transition-opacity hover:opacity-80",style:{background:"transparent",border:"none",cursor:"pointer"},children:[C.jsx(AB,{cli:A.assigned_cli}),C.jsxs("span",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.55)"},children:[A.assigned_cli,C.jsxs("span",{style:{color:"rgba(230,237,243,0.3)"},children:[" · unit ",A.ord]})]})]}),x[`${a.id}:${A.assigned_cli}`]&&C.jsx("button",{type:"button","aria-pressed":(w==null?void 0:w.cliKey)===A.assigned_cli,"aria-label":(w==null?void 0:w.cliKey)===A.assigned_cli?`Close ${A.assigned_cli} terminal`:`Open ${A.assigned_cli} terminal`,title:(w==null?void 0:w.cliKey)===A.assigned_cli?`Close ${A.assigned_cli} terminal`:`Open ${A.assigned_cli} terminal`,onClick:()=>{const W=A.assigned_cli,H=x[`${a.id}:${W}`];v((w==null?void 0:w.cliKey)===W?null:{cliKey:W,terminalId:H})},className:"text-xs rounded px-1 py-0.5 transition-opacity hover:opacity-80",style:{background:"rgba(230,237,243,0.06)",border:"none",cursor:"pointer",color:"rgba(230,237,243,0.55)",fontFamily:"monospace"},children:"⌨"})]}):C.jsxs("div",{className:"flex items-center gap-2",children:[C.jsx("span",{className:"w-7 h-7 rounded-full shrink-0",style:{background:"rgba(230,237,243,0.06)"}}),C.jsxs("span",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.55)"},children:["agent",C.jsxs("span",{style:{color:"rgba(230,237,243,0.3)"},children:[" · unit ",A.ord]})]})]}),C.jsx("span",{className:"rounded-full px-2 py-0.5 text-[11px] font-semibold uppercase tracking-wide font-mono",style:{background:D.bg,color:D.color},children:A.stage}),A.has_validator_pin&&C.jsx("span",{role:"img","aria-label":"Governance floor armed",style:{color:"#ffda19",fontSize:"12px"},children:"🔒"}),C.jsx("span",{className:"text-xs font-mono truncate max-w-xs",style:{color:"rgba(230,237,243,0.35)"},title:A.description,children:A.description})]}),C.jsxs("div",{className:"rounded-2xl px-5 py-4",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.08)"},children:[A.status==="distributed"&&!T&&C.jsxs("div",{children:[C.jsxs("div",{className:"flex items-center gap-2 text-sm font-mono",style:{color:"rgba(230,237,243,0.5)"},children:[C.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full animate-pulse",style:{background:"#79c0ff"}}),C.jsx("span",{children:"Working…"})]}),C.jsx(NB,{runId:a.id,ord:A.ord})]}),A.status==="distributed"&&T&&C.jsxs("div",{className:"flex items-center gap-2 text-sm font-mono",style:{color:"rgba(230,237,243,0.35)"},children:[C.jsx("span",{children:"—"}),C.jsx("span",{children:"Not started"})]}),A.status==="done"&&C.jsxs("div",{className:"flex items-center gap-2 text-sm font-mono",style:{color:"#3fb950"},children:[C.jsx("span",{children:"✓"}),C.jsx("span",{className:"font-medium",children:PB[A.status]})]}),A.status==="rejected"&&C.jsxs("div",{className:"text-sm font-medium font-mono",style:{color:"#f85149"},children:["Rejected",A.denial_reason?`: ${A.denial_reason}`:""]}),A.status==="pending"&&(()=>{const W=h[`${a.id}:${A.ord}`];return(W?W==="agent":!0)?C.jsx(LB,{runId:a.id,ord:A.ord}):C.jsxs("div",{className:"flex items-center gap-2 text-sm font-mono",style:{color:"rgba(230,237,243,0.3)"},children:[C.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full",style:{background:"rgba(230,237,243,0.2)"}}),C.jsx("span",{children:"Queued"})]})})(),A.status==="done"&&C.jsxs("div",{className:"mt-3",children:[C.jsx("button",{type:"button",onClick:()=>R(A.ord),className:"text-xs font-medium font-mono hover:underline",style:{color:"#79c0ff"},children:j!=null&&j.visible?"▾ Hide transcript":"▸ View transcript"}),(j==null?void 0:j.visible)&&C.jsx("div",{className:"mt-2.5 max-h-96 overflow-auto rounded-xl p-4",style:{background:"#0d1117"},children:j.loading?C.jsx("span",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.5)"},children:"Loading…"}):C.jsx(CB,{className:"whitespace-pre-wrap",children:j.text??""})})]})]})]})]},A.id);return I?[C.jsx("div",{className:"self-center w-full max-w-lg",children:C.jsx(rb,{runId:a.id,...u?{ord:u.ord,prompt:u.prompt}:{},onResolved:s})},`gate-before-${A.id}`),U]:[U]}),k.map(A=>A.type==="stepFailed"?C.jsx("div",{className:"flex flex-col gap-2",children:C.jsx(WB,{detail:A.detail,onStop:B,canStop:o!==void 0&&!T})},A.seq):A.type==="crashRecoveryRedrive"?C.jsx("div",{className:"flex flex-col gap-2",children:C.jsx(VB,{attempt:A.attempt??1})},A.seq):C.jsx("div",{className:"flex justify-center",children:C.jsx("span",{className:"text-xs rounded-full px-3 py-1 font-mono",style:{color:"rgba(230,237,243,0.4)",background:"#161c26",border:"1px solid rgba(230,237,243,0.07)"},children:FB(A.type,A.detail)})},A.seq)),a.status==="awaiting_human"&&!l.some(A=>(u==null?void 0:u.ord)===A.ord)&&C.jsx("div",{className:"self-center w-full max-w-lg",children:C.jsx(rb,{runId:a.id,...u?{ord:u.ord,prompt:u.prompt}:{},onResolved:s})}),C.jsx("div",{ref:_})]}),w&&C.jsx("div",{className:"px-4 pb-3 shrink-0",children:C.jsx(ZA,{terminalId:w.terminalId,cliKey:w.cliKey,onClose:()=>v(null)})}),C.jsx(iS,{runId:T?null:a.id,runStatus:T?null:a.status,mode:e,onLaunched:n,injectTarget:g,onClearInjectTarget:()=>p("all")})]})}function GB({chatMode:t,mode:e,onModeChange:r,onLaunched:n}){const i=t?"What do you want to explore?":"What do you need built?",s=t?"Ask about your repos, get answers, run searches, analyse patterns — without kicking off a full build.":"Describe your goal. The council elects a CLI, decomposes the plan, and executes it — you approve each gate.";return C.jsx("div",{className:"flex flex-col h-full items-center justify-center",children:C.jsxs("div",{className:"w-full max-w-2xl px-8 flex flex-col gap-5",children:[C.jsxs("div",{className:"flex flex-col gap-2 text-center",children:[C.jsx("h1",{className:"text-3xl font-bold tracking-tight",style:{color:"#e6edf3"},children:i}),C.jsx("p",{className:"text-base leading-relaxed",style:{color:"rgba(230,237,243,0.5)"},children:s})]}),C.jsx("div",{className:"flex justify-center",children:C.jsx(c2,{mode:e,onChange:r})}),C.jsx(iS,{embedded:!0,mode:e,onLaunched:n,...t?{workflowOverride:"chat"}:{}})]})})}function qB({view:t,chatMode:e,onLaunched:r,onNavigateBack:n,onRefresh:i,onKill:s}){const[o,a]=ae.useState("balanced");if(t){let l=function(h){a(h),c||lt.injectMessage(u.session.id,`mode:${h}`,"all").catch(()=>{})};const u=t,c=["completed","cancelled","failed"].includes(u.session.status);return C.jsx($B,{view:u,mode:o,onModeChange:l,onLaunched:r,onNavigateBack:n,onRefresh:i,...s!==void 0?{onKill:s}:{}},u.session.id)}return C.jsx(GB,{chatMode:e??!1,mode:o,onModeChange:a,onLaunched:r})}function YB(t){return t==="auto"?"Auto":t&&typeof t=="object"&&"human_confirm"in t?t.human_confirm.unconditional?"Human (always)":"Human":"Human if not PASS"}const XB={recon:"#79c0ff",build:"#3fb950",review:"#a78bfa",test:"#ffda19"};function h2(t){return XB[t]??"rgba(230,237,243,0.3)"}function KB({phase:t}){const e=t.executor,r=h2(t.kind);return C.jsxs("div",{className:"rounded px-3 py-2 text-[11px] flex flex-col gap-1",style:{border:"1px solid rgba(230,237,243,0.08)",background:"#1b222e"},children:[C.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[C.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:r},title:t.kind}),C.jsx("span",{className:"font-semibold",style:{color:"#e6edf3"},children:t.id}),C.jsx("span",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:t.kind}),t.role!=="neutral"&&C.jsx("span",{className:"rounded px-1.5 py-0.5 text-[10px] font-semibold font-mono",style:{background:t.role==="creator"?"rgba(121,192,255,0.1)":"rgba(167,139,250,0.1)",color:t.role==="creator"?"#79c0ff":"#a78bfa"},children:t.role}),e&&e.type==="tool"&&C.jsxs("span",{className:"rounded px-1.5 py-0.5 text-[10px] font-semibold font-mono",style:{background:"rgba(255,218,25,0.08)",color:"#ffda19"},children:["tool: ",e.cmd.join(" ")]})]}),C.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-0.5 text-[10px]",style:{color:"rgba(230,237,243,0.45)"},children:[C.jsxs("span",{children:[C.jsx("span",{className:"font-medium",style:{color:"rgba(230,237,243,0.6)"},children:"gate:"})," ",t.gate_type?`${t.gate_type} / `:"",YB(t.gate)]}),t.depends_on.length>0&&C.jsxs("span",{children:[C.jsx("span",{className:"font-medium",style:{color:"rgba(230,237,243,0.6)"},children:"after:"})," ",t.depends_on.join(", ")]}),t.skill_ref&&C.jsxs("span",{children:[C.jsx("span",{className:"font-medium",style:{color:"rgba(230,237,243,0.6)"},children:"skill:"})," ",C.jsx("span",{className:"font-mono",children:t.skill_ref})]})]})]})}function Gb(){return{_key:Math.random().toString(36).slice(2),id:"",kind:"build",execMode:"agent",cmd:"",script:"",scriptLang:"bash",scriptPath:"",gate:"auto",role:"neutral",dependsOn:[],executesCode:!1,verifiedEvidence:!1}}function QB(t){return t==="human"?{human_confirm:{unconditional:!1}}:t==="human_if"?{human_confirm_if:"verdict_not_pass"}:"auto"}async function ZB(t){if(t.execMode==="agent")return{type:"agent"};if(t.execMode==="command")return{type:"tool",cmd:t.cmd.trim().split(/\s+/).filter(Boolean)};const e=t.id.trim()||`script-${t._key}`,{path:r}=await lt.saveScript(e,t.script,t.scriptLang);return{type:"tool",cmd:[t.scriptLang==="python"?"python3":t.scriptLang==="sh"?"sh":"bash",r]}}async function qb(t,e){const r=await Promise.all(e.map(async(n,i)=>({id:n.id||`phase-${i+1}`,kind:n.kind,gate_type:n.gate==="auto"?null:"execution",gate:QB(n.gate),executes_code:n.executesCode,verified_evidence:n.verifiedEvidence,required_deliverables:[],depends_on:n.dependsOn,role:n.role,skill_ref:null,allowed_skills:[],validator_pin:null,executor:await ZB(n)})));return{id:t,phases:r}}const tl={background:"#0f1419",border:"1px solid rgba(230,237,243,0.1)",color:"#e6edf3"};function sc({active:t,onClick:e,children:r}){return C.jsx("button",{type:"button",onClick:e,className:"rounded px-2.5 py-1 text-[11px] font-medium capitalize transition-colors",style:t?{background:"#1b222e",color:"#e6edf3",border:"1px solid rgba(230,237,243,0.2)"}:{background:"transparent",color:"rgba(230,237,243,0.4)",border:"1px solid transparent"},children:r})}function JB({phase:t,index:e,total:r,allIds:n,onChange:i,onRemove:s,onMoveUp:o,onMoveDown:a}){const l=(c,h)=>i({...t,[c]:h}),u=n.slice(0,e);return C.jsxs("div",{className:"rounded p-3 flex flex-col gap-2",style:{border:"1px solid rgba(230,237,243,0.08)",background:"#1b222e"},children:[C.jsxs("div",{className:"flex items-center gap-2",children:[C.jsx("span",{className:"h-2.5 w-2.5 rounded-full",style:{backgroundColor:h2(t.kind)}}),C.jsxs("span",{className:"text-[11px] font-semibold",style:{color:"rgba(230,237,243,0.7)"},children:["Phase ",e+1]}),C.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[C.jsx("button",{type:"button",onClick:o,disabled:e===0,className:"px-1 text-[10px] disabled:opacity-30",style:{color:"rgba(230,237,243,0.4)"},children:"▲"}),C.jsx("button",{type:"button",onClick:a,disabled:e===r-1,className:"px-1 text-[10px] disabled:opacity-30",style:{color:"rgba(230,237,243,0.4)"},children:"▼"}),C.jsx("button",{type:"button",onClick:s,className:"px-1 text-[10px]",style:{color:"#f85149"},children:"✕"})]})]}),C.jsxs("div",{className:"flex gap-2",children:[C.jsx("input",{className:"flex-1 rounded px-2 py-1 text-xs focus:outline-none",placeholder:"phase-id (e.g. build)",value:t.id,onChange:c=>l("id",c.target.value),style:tl}),C.jsx("select",{className:"rounded px-2 py-1 text-xs focus:outline-none",value:t.kind,onChange:c=>l("kind",c.target.value),style:tl,children:["recon","build","review","test"].map(c=>C.jsx("option",{value:c,children:c},c))})]}),C.jsxs("div",{className:"flex flex-col gap-1.5",children:[C.jsx("div",{className:"flex gap-1",children:["agent","command","script"].map(c=>C.jsx(sc,{active:t.execMode===c,onClick:()=>l("execMode",c),children:c==="agent"?"Agent":c==="command"?"Command":"Script"},c))}),t.execMode==="command"&&C.jsx("input",{className:"rounded px-2 py-1 text-xs font-mono focus:outline-none",placeholder:"e.g. wicked-estate index or npm run build",value:t.cmd,onChange:c=>l("cmd",c.target.value),style:tl}),t.execMode==="script"&&C.jsxs("div",{className:"flex flex-col gap-1",children:[C.jsxs("div",{className:"flex gap-1 items-center",children:[C.jsx("span",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Language:"}),["bash","sh","python"].map(c=>C.jsx(sc,{active:t.scriptLang===c,onClick:()=>l("scriptLang",c),children:c},c))]}),C.jsx("textarea",{className:"rounded px-2 py-1.5 text-xs font-mono resize-y focus:outline-none",rows:6,placeholder:t.scriptLang==="python"?`# python script
419
+ print("hello")`:`# bash script
420
+ echo "hello"`,value:t.script,onChange:c=>l("script",c.target.value),style:{...tl,background:"#0d1117"}}),C.jsxs("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.3)"},children:["Saved to"," ",C.jsxs("span",{style:{color:"rgba(230,237,243,0.5)"},children:["~/.wicked/scripts/",t.id||"script",".",t.scriptLang==="python"?"py":"sh"]})]})]})]}),C.jsxs("div",{className:"flex gap-2 flex-wrap",children:[C.jsxs("div",{className:"flex flex-col gap-0.5",children:[C.jsx("span",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Gate"}),C.jsx("div",{className:"flex gap-1",children:[["auto","Auto"],["human","Human"],["human_if","Human if fails"]].map(([c,h])=>C.jsx(sc,{active:t.gate===c,onClick:()=>l("gate",c),children:h},c))})]}),C.jsxs("div",{className:"flex flex-col gap-0.5",children:[C.jsx("span",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Role"}),C.jsx("div",{className:"flex gap-1",children:["neutral","creator","evaluator"].map(c=>C.jsx(sc,{active:t.role===c,onClick:()=>l("role",c),children:c},c))})]})]}),u.length>0&&C.jsxs("div",{className:"flex flex-col gap-0.5",children:[C.jsx("span",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Depends on"}),C.jsx("div",{className:"flex flex-wrap gap-1.5",children:u.map(c=>C.jsxs("label",{className:"flex items-center gap-1 text-[10px] cursor-pointer",style:{color:"rgba(230,237,243,0.55)"},children:[C.jsx("input",{type:"checkbox",checked:t.dependsOn.includes(c),onChange:h=>l("dependsOn",h.target.checked?[...t.dependsOn,c]:t.dependsOn.filter(g=>g!==c))}),C.jsx("span",{className:"font-mono",children:c})]},c))})]}),C.jsxs("div",{className:"flex gap-3 text-[10px]",style:{color:"rgba(230,237,243,0.45)"},children:[C.jsxs("label",{className:"flex items-center gap-1 cursor-pointer",children:[C.jsx("input",{type:"checkbox",checked:t.executesCode,onChange:c=>l("executesCode",c.target.checked)}),"executes code"]}),C.jsxs("label",{className:"flex items-center gap-1 cursor-pointer",children:[C.jsx("input",{type:"checkbox",checked:t.verifiedEvidence,onChange:c=>l("verifiedEvidence",c.target.checked)}),"verified evidence"]})]})]})}function eF({initial:t,onSaved:e,onCancel:r}){const[n,i]=ae.useState((t==null?void 0:t.id)??""),[s,o]=ae.useState(()=>t?t.phases.map(N=>{const M=N.executor,B=(M==null?void 0:M.type)==="tool"?"command":"agent";return{_key:Math.random().toString(36).slice(2),id:N.id,kind:N.kind,execMode:B,cmd:(M==null?void 0:M.type)==="tool"?M.cmd.join(" "):"",script:"",scriptLang:"bash",scriptPath:"",gate:N.gate==="auto"?"auto":typeof N.gate=="object"&&N.gate!==null&&"human_confirm_if"in N.gate?"human_if":"human",role:N.role,dependsOn:N.depends_on,executesCode:N.executes_code,verifiedEvidence:N.verified_evidence}}):[Gb()]),[a,l]=ae.useState(!1),[u,c]=ae.useState(null),[h,g]=ae.useState(!1),[p,x]=ae.useState(""),w=s.map(N=>N.id).filter(Boolean);function v(N,M){o(B=>B.map((A,j)=>j===N?M:A))}function m(N){o(M=>M.filter((B,A)=>A!==N))}function y(){o(N=>[...N,Gb()])}function b(N){N!==0&&o(M=>{const B=[...M];return[B[N-1],B[N]]=[B[N],B[N-1]],B})}function _(N){o(M=>{if(N>=M.length-1)return M;const B=[...M];return[B[N],B[N+1]]=[B[N+1],B[N]],B})}async function R(){try{const N=await qb(n,s);x(JSON.stringify(N,null,2)),g(!0)}catch(N){c(N instanceof Error?N.message:String(N))}}async function E(){if(!n.trim()){c("Workflow ID is required");return}if(s.length===0){c("At least one phase is required");return}l(!0),c(null);try{const N=await qb(n.trim(),s);await lt.createWorkflow(N),e(N)}catch(N){c(N instanceof Error?N.message:String(N))}finally{l(!1)}}const T=ae.useRef(null);function k(N){var A;const M=(A=N.target.files)==null?void 0:A[0];if(!M)return;const B=new FileReader;B.onload=j=>{var D;try{const I=JSON.parse((D=j.target)==null?void 0:D.result);i(I.id??""),o(I.phases.map(U=>{const W=U.executor;return{_key:Math.random().toString(36).slice(2),id:U.id,kind:U.kind,execMode:(W==null?void 0:W.type)==="tool"?"command":"agent",cmd:(W==null?void 0:W.type)==="tool"?W.cmd.join(" "):"",script:"",scriptLang:"bash",scriptPath:"",gate:U.gate==="auto"?"auto":typeof U.gate=="object"&&U.gate!==null&&"human_confirm_if"in U.gate?"human_if":"human",role:U.role,dependsOn:U.depends_on,executesCode:U.executes_code,verifiedEvidence:U.verified_evidence}})),c(null)}catch{c("Could not parse workflow JSON")}},B.readAsText(M),N.target.value=""}return C.jsxs("div",{className:"flex flex-col gap-3 min-w-0",children:[C.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[C.jsx("input",{className:"flex-1 rounded px-2 py-1 text-xs font-semibold focus:outline-none",placeholder:"workflow-id (e.g. my-deploy)",value:n,onChange:N=>i(N.target.value),style:tl}),C.jsx("input",{ref:T,type:"file",accept:".json",className:"hidden",onChange:k}),C.jsx("button",{type:"button",onClick:()=>{var N;return(N=T.current)==null?void 0:N.click()},className:"rounded px-2 py-1 text-[11px]",style:{border:"1px solid rgba(230,237,243,0.1)",color:"rgba(230,237,243,0.6)"},children:"Upload JSON"}),C.jsx("button",{type:"button",onClick:()=>void R(),className:"rounded px-2 py-1 text-[11px]",style:{border:"1px solid rgba(230,237,243,0.1)",color:"rgba(230,237,243,0.6)"},children:"Preview JSON"}),C.jsx("button",{type:"button",onClick:r,className:"text-[11px] px-1 hover:underline",style:{color:"rgba(230,237,243,0.4)"},children:"Cancel"})]}),h&&C.jsxs("div",{className:"relative",children:[C.jsx("pre",{className:"rounded text-[10px] p-3 overflow-auto max-h-48 font-mono",style:{background:"#0d1117",color:"#3fb950"},children:p}),C.jsx("button",{type:"button",onClick:()=>g(!1),className:"absolute top-1 right-1 text-[10px]",style:{color:"rgba(230,237,243,0.4)"},children:"✕"})]}),C.jsx("div",{className:"flex flex-col gap-2",children:s.map((N,M)=>C.jsx(JB,{phase:N,index:M,total:s.length,allIds:w,onChange:B=>v(M,B),onRemove:()=>m(M),onMoveUp:()=>b(M),onMoveDown:()=>_(M)},N._key))}),C.jsx("button",{type:"button",onClick:y,className:"self-start rounded px-3 py-1 text-[11px] transition-colors",style:{border:"1px dashed rgba(230,237,243,0.15)",color:"rgba(230,237,243,0.45)"},children:"+ Add phase"}),u&&C.jsx("p",{className:"text-[11px]",style:{color:"#f85149"},children:u}),C.jsx("button",{type:"button",onClick:()=>void E(),disabled:a,className:"self-start rounded px-4 py-1.5 text-[11px] font-semibold disabled:opacity-50",style:{background:"#3fb950",color:"#0d1117"},children:a?"Saving…":"Save workflow"})]})}function tF(){const[t,e]=ae.useState([]),[r,n]=ae.useState(null),[i,s]=ae.useState(!0),[o,a]=ae.useState(null),[l,u]=ae.useState(!1),[c,h]=ae.useState(void 0),g=ae.useRef(null);g.current=r;const p=ae.useCallback(async()=>{var m;s(!0),a(null);try{const{workflows:y}=await lt.listWorkflows();e(y),y.length>0&&!g.current&&n(((m=y[0])==null?void 0:m.id)??null)}catch(y){a(y instanceof Error?y.message:String(y))}finally{s(!1)}},[]);ae.useEffect(()=>{p()},[p]);function x(m){h(m),u(!0)}function w(m){e(y=>y.findIndex(_=>_.id===m.id)>=0?y.map(_=>_.id===m.id?m:_):[...y,m]),n(m.id),u(!1)}const v=t.find(m=>m.id===r)??null;return C.jsxs("div",{className:"flex flex-col gap-4",children:[C.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[C.jsx("h2",{className:"text-sm font-semibold flex-1",style:{color:"#e6edf3"},children:"Workflows"}),!l&&C.jsxs(C.Fragment,{children:[C.jsx("button",{type:"button",onClick:()=>x(),className:"rounded px-3 py-1 text-[11px] font-semibold",style:{background:"#3fb950",color:"#0d1117"},children:"New workflow"}),C.jsx("button",{type:"button",onClick:()=>void p(),className:"text-[10px] hover:underline",style:{color:"rgba(230,237,243,0.4)"},children:"Refresh"})]})]}),i&&C.jsx("p",{className:"text-xs",style:{color:"rgba(230,237,243,0.4)"},children:"Loading workflows…"}),o&&C.jsx("p",{className:"rounded px-2 py-1 text-xs",style:{background:"rgba(248,81,73,0.08)",color:"#f85149"},children:o}),C.jsxs("div",{className:"flex gap-4",children:[!l&&C.jsx("div",{className:"flex flex-col gap-1.5 w-40 shrink-0",children:t.map(m=>C.jsxs("button",{type:"button",onClick:()=>n(m.id),className:"w-full text-left rounded px-3 py-2 text-[11px] transition-colors",style:m.id===r?{border:"1px solid rgba(121,192,255,0.4)",background:"rgba(121,192,255,0.08)",color:"#79c0ff"}:{border:"1px solid rgba(230,237,243,0.08)",background:"#1b222e",color:"rgba(230,237,243,0.7)"},children:[C.jsx("div",{className:"font-semibold",children:m.id}),C.jsxs("div",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.35)"},children:[m.phases.length," phases"]})]},m.id))}),C.jsx("div",{className:"flex-1 min-w-0",children:l?C.jsx(eF,{...c!==void 0?{initial:c}:{},onSaved:w,onCancel:()=>u(!1)}):v?C.jsxs("div",{className:"flex flex-col gap-2",children:[C.jsxs("div",{className:"flex items-center gap-2",children:[C.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider font-mono",style:{color:"rgba(230,237,243,0.4)"},children:v.id}),C.jsxs("span",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.35)"},children:["— ",v.phases.length," phases"]}),C.jsx("button",{type:"button",onClick:()=>x(v),className:"ml-auto text-[10px] hover:underline",style:{color:"#79c0ff"},children:"Edit"}),C.jsx("button",{type:"button",onClick:()=>x({...v,id:`${v.id}-copy`}),className:"text-[10px] hover:underline",style:{color:"rgba(230,237,243,0.4)"},children:"Duplicate"})]}),v.phases.map(m=>C.jsx(KB,{phase:m},m.id))]}):null})]}),!l&&C.jsxs("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.25)"},children:["Workflows saved to ",C.jsx("span",{style:{color:"rgba(230,237,243,0.4)"},children:"~/.wicked/workflows/"})," and registered immediately. Scripts saved to ",C.jsx("span",{style:{color:"rgba(230,237,243,0.4)"},children:"~/.wicked/scripts/"}),"."]})]})}const f2=t=>["completed","failed","cancelled"].includes(t),nv=t=>!f2(t),iv=t=>t==="completed",Yb=t=>t==="failed"||t==="cancelled",Xb=[{id:"all",label:"All"},{id:"active",label:"Active"},{id:"completed",label:"Completed"},{id:"failed",label:"Failed"}];function rF({runs:t,selectedRunId:e,onSelect:r,navigate:n}){const[i,s]=ae.useState(""),[o,a]=ae.useState("all"),l=ae.useRef([]),{range:u,setRange:c,filter:h}=Hv("30d"),g=ae.useMemo(()=>t.filter(E=>!!E.session.workflow_id&&E.session.workflow_id!=="chat"),[t]),p=ae.useMemo(()=>h(g),[g,h]),x=i.toLowerCase(),w=ae.useMemo(()=>i?p.filter(E=>E.session.problem.toLowerCase().includes(x)):p,[p,i,x]),v=ae.useMemo(()=>{const E=p.length,T=p.filter(D=>nv(D.session.status)).length,k=p.filter(D=>iv(D.session.status)).length,N=p.filter(D=>f2(D.session.status)).length,M=N>0?`${Math.round(k/N*100)}%`:"—",B=new Map;for(const D of p){const I=D.session.workflow_id;I&&I!=="chat"&&!I.startsWith("wf-")&&B.set(I,(B.get(I)??0)+1)}let A="—",j=0;return B.forEach((D,I)=>{D>j&&(j=D,A=I)}),{total:E,active:T,successRate:M,topWorkflow:A}},[p]),m={all:w.length,active:w.filter(E=>nv(E.session.status)).length,completed:w.filter(E=>iv(E.session.status)).length,failed:w.filter(E=>Yb(E.session.status)).length},y=w.filter(E=>nv(E.session.status)),b=w.filter(E=>iv(E.session.status)),_=w.filter(E=>Yb(E.session.status)),R=o==="all"?w:o==="active"?y:o==="completed"?b:_;return C.jsxs("div",{className:"flex flex-col h-full",style:{color:"#e6edf3"},children:[C.jsxs("div",{className:"px-8 pt-8 pb-4 flex items-center gap-4",children:[C.jsx("h1",{className:"text-xl font-semibold font-mono",children:"Work"}),C.jsx("div",{className:"flex-1"}),C.jsx(Uv,{value:u,onChange:c}),C.jsx("input",{type:"text",placeholder:"Search work…",value:i,onChange:E=>s(E.target.value),className:"rounded-xl px-4 py-2 text-sm font-mono outline-none",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.12)",color:"#e6edf3",width:"240px"}}),C.jsx("button",{type:"button",onClick:()=>n("/runs/new"),className:"rounded-lg px-4 py-2 text-sm font-semibold font-mono shrink-0",style:{background:"#ffda19",color:"#0d1117"},children:"Do Work"})]}),C.jsx("div",{className:"px-8 pb-4 grid gap-3",style:{gridTemplateColumns:"repeat(4, 1fr)"},children:[{label:"Total Runs",value:String(v.total),accent:void 0},{label:"Active",value:String(v.active),accent:"#79c0ff"},{label:"Success Rate",value:v.successRate,accent:"#3fb950"},{label:"Top Workflow",value:v.topWorkflow,accent:void 0}].map(E=>C.jsxs("div",{className:"rounded-xl px-4 py-3",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.07)"},children:[C.jsx("p",{className:"text-[10px] font-mono uppercase tracking-widest",style:{color:"rgba(230,237,243,0.4)",margin:0},children:E.label}),C.jsx("p",{className:"text-xl font-semibold font-mono mt-1 truncate",style:{color:E.accent??"#e6edf3",margin:"4px 0 0"},children:E.value})]},E.label))}),C.jsx("div",{role:"tablist","aria-label":"Filter by status",className:"px-8 pb-3 flex items-center gap-2",onKeyDown:E=>{var M;const T=Xb.map(B=>B.id),k=T.indexOf(o);let N=null;E.key==="ArrowRight"||E.key==="ArrowDown"?(E.preventDefault(),N=(k+1)%T.length):(E.key==="ArrowLeft"||E.key==="ArrowUp")&&(E.preventDefault(),N=(k-1+T.length)%T.length),N!==null&&(a(T[N]),(M=l.current[N])==null||M.focus())},children:Xb.map((E,T)=>C.jsxs("button",{ref:k=>{l.current[T]=k},id:`work-tab-${E.id}`,type:"button",role:"tab","aria-selected":o===E.id,"aria-controls":`work-panel-${E.id}`,tabIndex:o===E.id?0:-1,onClick:()=>a(E.id),className:"rounded-full px-3 py-1 text-xs font-mono",style:o===E.id?{background:"rgba(230,237,243,0.1)",color:"#e6edf3"}:{color:"rgba(230,237,243,0.4)"},children:[E.label," ",m[E.id]]},E.id))}),C.jsx("div",{id:`work-panel-${o}`,role:"tabpanel","aria-labelledby":`work-tab-${o}`,className:"flex-1 overflow-y-auto px-5 pb-8 flex flex-col",children:o==="all"?C.jsxs(C.Fragment,{children:[y.length>0&&C.jsxs(C.Fragment,{children:[C.jsx(av,{pulse:!0,children:"Active"}),y.map(E=>C.jsx($i,{view:E,selectedRunId:e,onSelect:r},E.session.id))]}),b.length>0&&C.jsxs(C.Fragment,{children:[C.jsx(av,{children:"Completed"}),b.map(E=>C.jsx($i,{view:E,selectedRunId:e,onSelect:r},E.session.id))]}),_.length>0&&C.jsxs(C.Fragment,{children:[C.jsx(av,{children:"Failed"}),_.map(E=>C.jsx($i,{view:E,selectedRunId:e,onSelect:r},E.session.id))]}),w.length===0&&C.jsx(Kb,{query:i})]}):C.jsx(C.Fragment,{children:R.length===0?C.jsx(Kb,{query:i,tab:o}):R.map(E=>C.jsx($i,{view:E,selectedRunId:e,onSelect:r},E.session.id))})})]})}function av({children:t,pulse:e}){return C.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 text-[10px] uppercase tracking-widest font-semibold font-mono",style:{color:"rgba(230,237,243,0.4)"},children:[e&&C.jsx("span",{className:"w-1.5 h-1.5 rounded-full animate-pulse shrink-0",style:{background:"#79c0ff"}}),t]})}function Kb({query:t,tab:e}){const r=t?`No runs match "${t}".`:e?`No ${e} runs yet.`:"No work sessions yet.";return C.jsx("p",{className:"px-3 py-6 text-sm font-mono italic",style:{color:"rgba(230,237,243,0.35)"},children:r})}const d2="wicked_default_clis";function nF({label:t,description:e,children:r}){return C.jsxs("div",{className:"flex items-start justify-between gap-6 py-4 border-b last:border-b-0",style:{borderColor:"rgba(230,237,243,0.07)"},children:[C.jsxs("div",{className:"flex-1 min-w-0",children:[C.jsx("p",{className:"text-sm font-medium",style:{color:"#e6edf3"},children:t}),C.jsx("p",{className:"text-xs mt-0.5",style:{color:"rgba(230,237,243,0.45)"},children:e})]}),C.jsx("div",{className:"shrink-0",children:r})]})}function iF(t){try{const e=localStorage.getItem(d2);if(e)return new Set(JSON.parse(e))}catch{}return new Set(t.filter(e=>e.enabled_for_council).map(e=>e.key))}function aF(){const[t,e]=ae.useState(null),[r,n]=ae.useState({}),[i,s]=ae.useState(!1),[o,a]=ae.useState(!1),[l,u]=ae.useState(null),c=ae.useRef(null),[h,g]=ae.useState([]),[p,x]=ae.useState(new Set),[w,v]=ae.useState(!1),m=ae.useRef(null);ae.useEffect(()=>{lt.getSettings().then(({settings:k})=>e(k)).catch(k=>u(String(k))),lt.getRoster().then(({roster:k})=>{g(k),x(iF(k))}).catch(()=>{})},[]),ae.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]);function y(k){x(N=>{const M=new Set(N);return M.has(k)?M.delete(k):M.add(k),M})}function b(){u(null);try{localStorage.setItem(d2,JSON.stringify([...p]))}catch(k){u(String(k));return}v(!0),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>v(!1),2500)}ae.useEffect(()=>()=>{c.current&&clearTimeout(c.current)},[]);function _(k,N){n(M=>({...M,[k]:N})),a(!1)}async function R(){if(Object.keys(r).length!==0){s(!0),u(null);try{const{settings:k}=await lt.updateSettings(r);e(k),n({}),a(!0),c.current&&clearTimeout(c.current),c.current=setTimeout(()=>a(!1),2500)}catch(k){u(String(k))}finally{s(!1)}}}const E={graphNodeLimit:150,...t,...r},T=Object.keys(r).length>0;return C.jsxs("div",{className:"max-w-2xl mx-auto",children:[C.jsxs("div",{className:"mb-6",children:[C.jsx("h1",{className:"text-lg font-semibold",style:{color:"#e6edf3"},children:"System"}),C.jsxs("p",{className:"text-sm mt-1",style:{color:"rgba(230,237,243,0.45)"},children:["Runtime tunables persisted to"," ",C.jsx("code",{className:"font-mono text-xs rounded px-1 py-0.5",style:{background:"rgba(230,237,243,0.06)",color:"rgba(230,237,243,0.7)"},children:"~/.config/wicked-core/settings.json"}),"."]})]}),l&&C.jsx("div",{className:"mb-4 px-3 py-2 rounded text-xs",style:{background:"rgba(248,81,73,0.08)",border:"1px solid rgba(248,81,73,0.3)",color:"#f85149"},children:l}),C.jsxs("section",{className:"rounded-xl px-5 mb-6",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.07)"},children:[C.jsx("h2",{className:"text-xs font-semibold uppercase tracking-wide pt-4 pb-2 font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Code Graph"}),C.jsx(nF,{label:"Graph node limit",description:"Maximum number of symbols returned by wicked-estate graph-view per repo. Higher values show more of the graph but take longer to render. Requires reopening the graph modal to take effect.",children:C.jsx("input",{type:"number",min:20,max:500,step:10,value:E.graphNodeLimit,onChange:k=>{const N=Number(k.target.value);Number.isNaN(N)||_("graphNodeLimit",Math.max(20,Math.min(500,N)))},className:"w-24 rounded px-2 py-1 text-sm text-right tabular-nums focus:outline-none",style:{background:"#161c26",border:"1px solid rgba(230,237,243,0.12)",color:"#e6edf3"}})})]}),C.jsxs("div",{className:"flex items-center gap-3 mb-8",children:[C.jsx("button",{type:"button",onClick:R,disabled:!T||i,className:"px-4 py-2 rounded-lg text-sm font-medium transition-colors disabled:opacity-40",style:T&&!i?{background:"#3fb950",color:"#0d1117"}:{background:"rgba(230,237,243,0.06)",color:"rgba(230,237,243,0.35)",cursor:"not-allowed"},children:i?"Saving…":"Save"}),o&&C.jsx("span",{className:"text-xs font-medium",style:{color:"#3fb950"},children:"Saved"})]}),C.jsxs("section",{className:"rounded-xl px-5 mb-6",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.07)"},children:[C.jsx("h2",{className:"text-xs font-semibold uppercase tracking-wide pt-4 pb-2 font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Default CLIs"}),C.jsx("p",{className:"text-xs mb-4",style:{color:"rgba(230,237,243,0.4)"},children:"Which CLIs are pre-selected when you open the launch form. Changes take effect on the next new session."}),h.length===0?C.jsx("p",{className:"text-xs italic pb-4 font-mono",style:{color:"rgba(230,237,243,0.3)"},children:"Loading roster…"}):C.jsx("div",{className:"flex flex-col gap-2 pb-4",children:h.map(k=>C.jsxs("label",{className:"flex items-center gap-3 cursor-pointer group",children:[C.jsx("input",{type:"checkbox",checked:p.has(k.key),onChange:()=>y(k.key),className:"accent-[#ffda19] w-3.5 h-3.5 shrink-0"}),C.jsx("span",{className:"text-sm font-mono flex-1",style:{color:"#e6edf3"},children:k.display_name}),C.jsx("span",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.3)"},children:k.key})]},k.key))}),h.length>0&&C.jsxs("div",{className:"flex items-center gap-3 pb-4 pt-2 border-t",style:{borderColor:"rgba(230,237,243,0.07)"},children:[C.jsx("button",{type:"button",onClick:b,className:"px-4 py-2 rounded-lg text-sm font-medium",style:{background:"#ffda19",color:"#0d1117"},children:"Save CLI defaults"}),w&&C.jsx("span",{className:"text-xs font-medium",style:{color:"#3fb950"},children:"Saved"})]})]})]})}function sF(t){const e=Wv(n=>n.setStatus),r=ae.useRef(t);r.current=t,ae.useEffect(()=>{let n=!1,i=null;function s(){if(n)return;const o=new WebSocket(`${ew()}/ws`);i=o,o.onopen=()=>{i===o&&e("connected")},o.onmessage=a=>{if(i===o)try{const l=JSON.parse(String(a.data));l!==null&&typeof l=="object"&&typeof l.type=="string"&&r.current(l)}catch{}},o.onclose=()=>{i===o&&e("disconnected"),n||setTimeout(s,3e3)},o.onerror=()=>{o.close()}}return s(),()=>{n=!0,i&&i.readyState!==WebSocket.CLOSED&&i.readyState!==WebSocket.CLOSING&&i.close(),i=null}},[e])}const oF=["runs","coverage","workflows","domain","policies","rules","repos","system","chats","work","repo-detail"];function Qb(t){try{return decodeURIComponent(t)}catch{return t}}function lF(t){const[,e="",r=""]=t.split("/");return e==="repo-detail"&&r?{panel:"repo-detail",runId:null,showLaunch:!1,repoId:Qb(r),showRegisterRepo:!1,chatMode:!1}:e==="repo-detail"?{panel:"repos",runId:null,showLaunch:!1,repoId:null,showRegisterRepo:!1,chatMode:!1}:e==="repos"&&r==="new"?{panel:"repos",runId:null,showLaunch:!1,repoId:null,showRegisterRepo:!0,chatMode:!1}:e==="chat"&&r==="new"?{panel:"runs",runId:null,showLaunch:!0,repoId:null,showRegisterRepo:!1,chatMode:!0}:oF.includes(e)&&e!=="runs"?{panel:e,runId:null,showLaunch:!1,repoId:null,showRegisterRepo:!1,chatMode:!1}:r==="new"?{panel:"runs",runId:null,showLaunch:!0,repoId:null,showRegisterRepo:!1,chatMode:!1}:r?{panel:"runs",runId:Qb(r),showLaunch:!1,repoId:null,showRegisterRepo:!1,chatMode:!1}:{panel:"runs",runId:null,showLaunch:!1,repoId:null,showRegisterRepo:!1,chatMode:!1}}function uF(){const[t,e]=ae.useState(()=>window.location.pathname);ae.useEffect(()=>{const i=()=>e(window.location.pathname);return window.addEventListener("popstate",i),()=>window.removeEventListener("popstate",i)},[]);const r=ae.useCallback(i=>{history.pushState(null,"",i),e(i)},[]),n=ae.useCallback(i=>i==="runs"?"/":`/${i}`,[]);return{...lF(t),navigate:r,panelPath:n}}function cF(){const t=Wv(u=>u.status),e=Jn(u=>u.setGate),r=Jn(u=>u.reconcile),[n,i]=ae.useState([]),[s,o]=ae.useState(0),a=ae.useRef(null),l=ae.useCallback(()=>{a.current!==null&&clearTimeout(a.current),a.current=setTimeout(()=>{a.current=null,o(u=>u+1)},400)},[]);return ae.useEffect(()=>()=>{a.current!==null&&clearTimeout(a.current)},[]),ae.useEffect(()=>{if(t!=="connected")return;let u=!1;return(async()=>{let c;try{({runs:c}=await lt.listRuns())}catch{return}if(u)return;i(c);const h=c.filter(g=>g.session.status==="awaiting_human").map(g=>g.session.id);r(h);for(const g of h)if(!Jn.getState().gates[g])try{const p=await lt.getGate(g);if(u)return;e({runId:p.runId,ord:p.ord,prompt:p.prompt,lifecycle:p.lifecycle,receivedAt:Date.parse(p.receivedAt)||Date.now()})}catch{}})(),()=>{u=!0}},[t,s,e,r]),{runs:n,refresh:l}}const hF=new Set(["sessionStarted","unitPlanned","unitDistributed","unitExecuting","gateDecided","unitDone","unitDenied","awaitingHuman","resumed","runCancelled","sessionFailed","sessionCompleted"]);function fF(t,e,r){ae.useEffect(()=>{if(!t)return;function n(i){var s,o,a;if((i.ctrlKey||i.metaKey)&&i.key==="k"&&t){const l=((o=(s=i.target)==null?void 0:s.tagName)==null?void 0:o.toLowerCase())??"",u=((a=i.target)==null?void 0:a.isContentEditable)??!1;if(l==="input"||l==="textarea"||l==="select"||u)return;const c=e.find(g=>g.session.id===t);if(!c)return;["completed","cancelled","failed"].includes(c.session.status)||(i.preventDefault(),r(t))}}return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t,e,r])}function dF(){const{panel:t,runId:e,repoId:r,showLaunch:n,showRegisterRepo:i,chatMode:s,navigate:o}=uF(),{runs:a,refresh:l}=cF(),u=Jn(N=>N.ingest),c=oc(N=>N.ingest),h=Pa(N=>N.ingest),g=Sc(N=>N.ingest),p=ae.useCallback(()=>{l()},[l]),x=ae.useCallback(()=>{l()},[l]),w=ae.useCallback(N=>{u(N),c(N),h(N),g(N),hF.has(N.type)&&l()},[u,c,h,g,l]);sF(w);const v=ae.useCallback(N=>o(`/runs/${encodeURIComponent(N)}`),[o]),m=ae.useCallback(N=>{l(),o(`/runs/${encodeURIComponent(N)}`)},[o,l]),y=ae.useCallback(()=>o("/"),[o]),b=ae.useCallback(async N=>{try{await lt.cancelRun(N),l()}catch{}},[l]);fF(e,a,b);const _=a.find(N=>N.session.id===e)??null,[R,E]=ae.useState(null),T=ae.useCallback(()=>{r&&lt.listRepos().then(({repos:N})=>{const M=N.find(B=>B.id===r);M&&E(M)})},[r]);function k(){return t==="coverage"?C.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:C.jsx(iw,{})}):t==="workflows"?C.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:C.jsx(tF,{})}):t==="domain"?C.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:C.jsx(PE,{})}):t==="policies"?C.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:C.jsx(tk,{})}):t==="rules"?C.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:C.jsx(VA,{})}):t==="repos"?C.jsx("div",{className:"flex-1 overflow-hidden",children:C.jsx(ik,{onSelectRun:v,autoShowRegister:i,navigate:o})}):t==="repo-detail"&&r?C.jsx("div",{className:"flex-1 overflow-y-auto",children:C.jsx(sk,{repoId:r,onSelectRun:v,navigate:o,onOpenGraph:T})}):t==="chats"?C.jsx("div",{className:"flex-1 overflow-y-auto",children:C.jsx(kE,{runs:a,onSelect:v,navigate:o})}):t==="work"?C.jsx("div",{className:"flex-1 overflow-y-auto",children:C.jsx(rF,{runs:a,selectedRunId:e,onSelect:v,navigate:o})}):t==="system"?C.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:C.jsx(aF,{})}):t==="runs"&&!e&&!_&&!n?C.jsx("div",{className:"flex-1 overflow-y-auto",children:C.jsx(CE,{runs:a,onSelectRun:v,onApproveGate:p,onRejectGate:x,navigate:o})}):C.jsx("div",{className:"flex-1 overflow-hidden",children:C.jsx(qB,{view:_,chatMode:s,onLaunched:m,onNavigateBack:y,onRefresh:l,onKill:b})})}return C.jsxs("div",{className:"flex h-screen overflow-hidden bg-wk-canvas",children:[C.jsx(XE,{runs:a,selectedRunId:e,onSelectRun:v,navigate:o}),C.jsx("div",{className:"flex flex-1 overflow-hidden",children:k()}),_!==null&&C.jsx(HA,{view:_}),C.jsx(IE,{onSelect:v}),R!==null&&C.jsx(cA,{repo:R,onClose:()=>E(null),onSelectRun:v})]})}class pF extends ae.Component{constructor(){super(...arguments);r0(this,"state",{error:null})}static getDerivedStateFromError(r){return{error:r}}componentDidCatch(r,n){console.error("[ErrorBoundary]",r,n.componentStack)}render(){return this.state.error?this.props.fallback?this.props.fallback:C.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 p-8 font-mono",style:{color:"rgba(230,237,243,0.5)"},children:[C.jsx("p",{className:"text-sm font-semibold",style:{color:"#f85149"},children:"Something went wrong"}),C.jsx("p",{className:"text-xs text-center max-w-sm",style:{color:"rgba(230,237,243,0.4)"},children:this.state.error.message||"An unexpected error occurred."}),C.jsx("button",{type:"button",onClick:()=>window.location.reload(),className:"text-xs px-4 py-1.5 rounded-lg transition-opacity hover:opacity-80",style:{background:"rgba(230,237,243,0.08)",color:"#e6edf3"},children:"Reload"})]}):this.props.children}}const p2=document.getElementById("root");if(!p2)throw new Error("Root element not found");sE.createRoot(p2).render(C.jsx(ae.StrictMode,{children:C.jsx(pF,{children:C.jsx(dF,{})})}));