wicked-crew 0.2.1 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/evidence.d.ts +97 -0
- package/dist/api/evidence.d.ts.map +1 -0
- package/dist/api/evidence.js +144 -0
- package/dist/api/evidence.js.map +1 -0
- package/dist/api/routes.d.ts.map +1 -1
- package/dist/api/routes.js +379 -12
- package/dist/api/routes.js.map +1 -1
- package/dist/api/server.d.ts.map +1 -1
- package/dist/api/server.js +7 -2
- package/dist/api/server.js.map +1 -1
- package/dist/cli/index.js +31 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/core/adapter.d.ts +62 -2
- package/dist/core/adapter.d.ts.map +1 -1
- package/dist/core/adapter.js +514 -3
- package/dist/core/adapter.js.map +1 -1
- package/dist/core/bridge-path.d.ts +34 -0
- package/dist/core/bridge-path.d.ts.map +1 -0
- package/dist/core/bridge-path.js +67 -0
- package/dist/core/bridge-path.js.map +1 -0
- package/dist/core/types.d.ts +154 -5
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js +3 -1
- package/dist/core/types.js.map +1 -1
- package/dist/studio/assets/index-BCcaLGxk.js +420 -0
- package/dist/studio/assets/index-vsyAOtPq.css +32 -0
- package/dist/studio/index.html +5 -2
- package/package.json +7 -3
- package/dist/studio/assets/index-CYdz3nG5.js +0 -50
- package/dist/studio/assets/index-O14t6s9U.css +0 -32
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
var QC=Object.defineProperty;var ZC=(t,e,r)=>e in t?QC(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var r0=(t,e,r)=>ZC(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 JC(){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"),h=Symbol.for("react.lazy"),c=Symbol.iterator;function v(F){return F===null||typeof F!="object"?null:(F=c&&F[c]||F["@@iterator"],typeof F=="function"?F:null)}var d={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,w={};function g(F,G,$){this.props=F,this.context=G,this.refs=w,this.updater=$||d}g.prototype.isReactComponent={},g.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")},g.prototype.forceUpdate=function(F){this.updater.enqueueForceUpdate(this,F,"forceUpdate")};function m(){}m.prototype=g.prototype;function y(F,G,$){this.props=F,this.context=G,this.refs=w,this.updater=$||d}var b=y.prototype=new m;b.constructor=y,x(b,g.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=v(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=g,_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:h,_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=JC()),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 eE(){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 h,c={},v=null,d=null;u!==void 0&&(v=""+u),l.key!==void 0&&(v=""+l.key),l.ref!==void 0&&(d=l.ref);for(h in l)n.call(l,h)&&!s.hasOwnProperty(h)&&(c[h]=l[h]);if(a&&a.defaultProps)for(h in l=a.defaultProps,l)c[h]===void 0&&(c[h]=l[h]);return{$$typeof:e,type:a,key:v,ref:d,props:c,_owner:i.current}}return Oo.Fragment=r,Oo.jsx=o,Oo.jsxs=o,Oo}var s0;function tE(){return s0||(s0=1,qf.exports=eE()),qf.exports}var S=tE(),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 rE(){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=[],h=1,c=null,v=3,d=!1,x=!1,w=!1,g=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),d=!0;var P=v;try{for(b(z),c=r(l);c!==null&&(!(c.expirationTime>z)||H&&!B());){var F=c.callback;if(typeof F=="function"){c.callback=null,v=c.priorityLevel;var G=F(c.expirationTime<=z);z=t.unstable_now(),typeof G=="function"?c.callback=G:c===r(l)&&n(l),b(z)}else n(l);c=r(l)}if(c!==null)var $=!0;else{var ee=r(u);ee!==null&&W(_,ee.startTime-z),$=!1}return $}finally{c=null,v=P,d=!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(){g(A,0)};function U(H){T=H,E||(E=!0,j())}function W(H,z){k=g(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||d||(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 v},t.unstable_getFirstCallbackNode=function(){return r(l)},t.unstable_next=function(H){switch(v){case 1:case 2:case 3:var z=3;break;default:z=v}var P=v;v=z;try{return H()}finally{v=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=v;v=H;try{return z()}finally{v=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:h++,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||d||(x=!0,U(R))),H},t.unstable_shouldYield=B,t.unstable_wrapCallback=function(H){var z=v;return function(){var P=v;v=z;try{return H.apply(this,arguments)}finally{v=P}}}})(Qf)),Qf}var l0;function nE(){return l0||(l0=1,Kf.exports=rE()),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 iE(){if(u0)return nn;u0=1;var t=jv(),e=nE();function r(f){for(var p="https://reactjs.org/docs/error-decoder.html?invariant="+f,C=1;C<arguments.length;C++)p+="&args[]="+encodeURIComponent(arguments[C]);return"Minified React error #"+f+"; visit "+p+" 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,p){o(f,p),o(f+"Capture",p)}function o(f,p){for(i[f]=p,f=0;f<p.length;f++)n.add(p[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]*$/,h={},c={};function v(f){return l.call(c,f)?!0:l.call(h,f)?!1:u.test(f)?c[f]=!0:(h[f]=!0,!1)}function d(f,p,C,L){if(C!==null&&C.type===0)return!1;switch(typeof p){case"function":case"symbol":return!0;case"boolean":return L?!1:C!==null?!C.acceptsBooleans:(f=f.toLowerCase().slice(0,5),f!=="data-"&&f!=="aria-");default:return!1}}function x(f,p,C,L){if(p===null||typeof p>"u"||d(f,p,C,L))return!0;if(L)return!1;if(C!==null)switch(C.type){case 3:return!p;case 4:return p===!1;case 5:return isNaN(p);case 6:return isNaN(p)||1>p}return!1}function w(f,p,C,L,O,V,Q){this.acceptsBooleans=p===2||p===3||p===4,this.attributeName=L,this.attributeNamespace=O,this.mustUseProperty=C,this.propertyName=f,this.type=p,this.sanitizeURL=V,this.removeEmptyString=Q}var g={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(f){g[f]=new w(f,0,!1,f,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(f){var p=f[0];g[p]=new w(p,1,!1,f[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(f){g[f]=new w(f,2,!1,f.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(f){g[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){g[f]=new w(f,3,!1,f.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(f){g[f]=new w(f,3,!0,f,null,!1,!1)}),["capture","download"].forEach(function(f){g[f]=new w(f,4,!1,f,null,!1,!1)}),["cols","rows","size","span"].forEach(function(f){g[f]=new w(f,6,!1,f,null,!1,!1)}),["rowSpan","start"].forEach(function(f){g[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 p=f.replace(m,y);g[p]=new w(p,1,!1,f,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(f){var p=f.replace(m,y);g[p]=new w(p,1,!1,f,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(f){var p=f.replace(m,y);g[p]=new w(p,1,!1,f,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(f){g[f]=new w(f,1,!1,f.toLowerCase(),null,!1,!1)}),g.xlinkHref=new w("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(f){g[f]=new w(f,1,!1,f.toLowerCase(),null,!0,!0)});function b(f,p,C,L){var O=g.hasOwnProperty(p)?g[p]:null;(O!==null?O.type!==0:L||!(2<p.length)||p[0]!=="o"&&p[0]!=="O"||p[1]!=="n"&&p[1]!=="N")&&(x(p,C,O,L)&&(C=null),L||O===null?v(p)&&(C===null?f.removeAttribute(p):f.setAttribute(p,""+C)):O.mustUseProperty?f[O.propertyName]=C===null?O.type===3?!1:"":C:(p=O.attributeName,L=O.attributeNamespace,C===null?f.removeAttribute(p):(O=O.type,C=O===3||O===4&&C===!0?"":""+C,L?f.setAttributeNS(L,p,C):f.setAttribute(p,C))))}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(C){var p=C.stack.trim().match(/\n( *(at )?)/);F=p&&p[1]||""}return`
|
|
34
|
+
`+F+f}var $=!1;function ee(f,p){if(!f||$)return"";$=!0;var C=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(p)if(p=function(){throw Error()},Object.defineProperty(p.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(p,[])}catch(we){var L=we}Reflect.construct(f,[],p)}else{try{p.call()}catch(we){L=we}f.call(p.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=C}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 p=f.render;return f=f.displayName,f||(f=p.displayName||p.name||"",f=f!==""?"ForwardRef("+f+")":"ForwardRef"),f;case I:return p=f.displayName||null,p!==null?p:ne(f.type)||"Memo";case U:p=f._payload,f=f._init;try{return ne(f(p))}catch{}}return null}function Y(f){var p=f.type;switch(f.tag){case 24:return"Cache";case 9:return(p.displayName||"Context")+".Consumer";case 10:return(p._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return f=p.render,f=f.displayName||f.name||"",p.displayName||(f!==""?"ForwardRef("+f+")":"ForwardRef");case 7:return"Fragment";case 5:return p;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ne(p);case 8:return p===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 p=="function")return p.displayName||p.name||null;if(typeof p=="string")return p}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 p=f.type;return(f=f.nodeName)&&f.toLowerCase()==="input"&&(p==="checkbox"||p==="radio")}function X(f){var p=K(f)?"checked":"value",C=Object.getOwnPropertyDescriptor(f.constructor.prototype,p),L=""+f[p];if(!f.hasOwnProperty(p)&&typeof C<"u"&&typeof C.get=="function"&&typeof C.set=="function"){var O=C.get,V=C.set;return Object.defineProperty(f,p,{configurable:!0,get:function(){return O.call(this)},set:function(Q){L=""+Q,V.call(this,Q)}}),Object.defineProperty(f,p,{enumerable:C.enumerable}),{getValue:function(){return L},setValue:function(Q){L=""+Q},stopTracking:function(){f._valueTracker=null,delete f[p]}}}}function J(f){f._valueTracker||(f._valueTracker=X(f))}function ie(f){if(!f)return!1;var p=f._valueTracker;if(!p)return!0;var C=p.getValue(),L="";return f&&(L=K(f)?f.checked?"true":"false":f.value),f=L,f!==C?(p.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,p){var C=p.checked;return P({},p,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:C??f._wrapperState.initialChecked})}function Le(f,p){var C=p.defaultValue==null?"":p.defaultValue,L=p.checked!=null?p.checked:p.defaultChecked;C=q(p.value!=null?p.value:C),f._wrapperState={initialChecked:L,initialValue:C,controlled:p.type==="checkbox"||p.type==="radio"?p.checked!=null:p.value!=null}}function ze(f,p){p=p.checked,p!=null&&b(f,"checked",p,!1)}function _e(f,p){ze(f,p);var C=q(p.value),L=p.type;if(C!=null)L==="number"?(C===0&&f.value===""||f.value!=C)&&(f.value=""+C):f.value!==""+C&&(f.value=""+C);else if(L==="submit"||L==="reset"){f.removeAttribute("value");return}p.hasOwnProperty("value")?Ne(f,p.type,C):p.hasOwnProperty("defaultValue")&&Ne(f,p.type,q(p.defaultValue)),p.checked==null&&p.defaultChecked!=null&&(f.defaultChecked=!!p.defaultChecked)}function ke(f,p,C){if(p.hasOwnProperty("value")||p.hasOwnProperty("defaultValue")){var L=p.type;if(!(L!=="submit"&&L!=="reset"||p.value!==void 0&&p.value!==null))return;p=""+f._wrapperState.initialValue,C||p===f.value||(f.value=p),f.defaultValue=p}C=f.name,C!==""&&(f.name=""),f.defaultChecked=!!f._wrapperState.initialChecked,C!==""&&(f.name=C)}function Ne(f,p,C){(p!=="number"||ce(f.ownerDocument)!==f)&&(C==null?f.defaultValue=""+f._wrapperState.initialValue:f.defaultValue!==""+C&&(f.defaultValue=""+C))}var Ee=Array.isArray;function Me(f,p,C,L){if(f=f.options,p){p={};for(var O=0;O<C.length;O++)p["$"+C[O]]=!0;for(C=0;C<f.length;C++)O=p.hasOwnProperty("$"+f[C].value),f[C].selected!==O&&(f[C].selected=O),O&&L&&(f[C].defaultSelected=!0)}else{for(C=""+q(C),p=null,O=0;O<f.length;O++){if(f[O].value===C){f[O].selected=!0,L&&(f[O].defaultSelected=!0);return}p!==null||f[O].disabled||(p=f[O])}p!==null&&(p.selected=!0)}}function Pe(f,p){if(p.dangerouslySetInnerHTML!=null)throw Error(r(91));return P({},p,{value:void 0,defaultValue:void 0,children:""+f._wrapperState.initialValue})}function De(f,p){var C=p.value;if(C==null){if(C=p.children,p=p.defaultValue,C!=null){if(p!=null)throw Error(r(92));if(Ee(C)){if(1<C.length)throw Error(r(93));C=C[0]}p=C}p==null&&(p=""),C=p}f._wrapperState={initialValue:q(C)}}function We(f,p){var C=q(p.value),L=q(p.defaultValue);C!=null&&(C=""+C,C!==f.value&&(f.value=C),p.defaultValue==null&&f.defaultValue!==C&&(f.defaultValue=C)),L!=null&&(f.defaultValue=""+L)}function Ye(f){var p=f.textContent;p===f._wrapperState.initialValue&&p!==""&&p!==null&&(f.value=p)}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,p){return f==null||f==="http://www.w3.org/1999/xhtml"?ge(p):f==="http://www.w3.org/2000/svg"&&p==="foreignObject"?"http://www.w3.org/1999/xhtml":f}var Ae,Fe=(function(f){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(p,C,L,O){MSApp.execUnsafeLocalFunction(function(){return f(p,C,L,O)})}:f})(function(f,p){if(f.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in f)f.innerHTML=p;else{for(Ae=Ae||document.createElement("div"),Ae.innerHTML="<svg>"+p.valueOf().toString()+"</svg>",p=Ae.firstChild;f.firstChild;)f.removeChild(f.firstChild);for(;p.firstChild;)f.appendChild(p.firstChild)}});function me(f,p){if(p){var C=f.firstChild;if(C&&C===f.lastChild&&C.nodeType===3){C.nodeValue=p;return}}f.textContent=p}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(p){p=p+f.charAt(0).toUpperCase()+f.substring(1),Z[p]=Z[f]})});function oe(f,p,C){return p==null||typeof p=="boolean"||p===""?"":C||typeof p!="number"||p===0||Z.hasOwnProperty(f)&&Z[f]?(""+p).trim():p+"px"}function ue(f,p){f=f.style;for(var C in p)if(p.hasOwnProperty(C)){var L=C.indexOf("--")===0,O=oe(C,p[C],L);C==="float"&&(C="cssFloat"),L?f.setProperty(C,O):f[C]=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,p){if(p){if(se[f]&&(p.children!=null||p.dangerouslySetInnerHTML!=null))throw Error(r(137,f));if(p.dangerouslySetInnerHTML!=null){if(p.children!=null)throw Error(r(60));if(typeof p.dangerouslySetInnerHTML!="object"||!("__html"in p.dangerouslySetInnerHTML))throw Error(r(61))}if(p.style!=null&&typeof p.style!="object")throw Error(r(62))}}function pe(f,p){if(f.indexOf("-")===-1)return typeof p.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,He=null;function je(f){if(f=wo(f)){if(typeof Te!="function")throw Error(r(280));var p=f.stateNode;p&&(p=Zl(p),Te(f.stateNode,f.type,p))}}function Ge(f){Re?He?He.push(f):He=[f]:Re=f}function it(){if(Re){var f=Re,p=He;if(He=Re=null,je(f),p)for(f=0;f<p.length;f++)je(p[f])}}function Ze(f,p){return f(p)}function qe(){}var pt=!1;function Qe(f,p,C){if(pt)return f(p,C);pt=!0;try{return Ze(f,p,C)}finally{pt=!1,(Re!==null||He!==null)&&(qe(),it())}}function Ke(f,p){var C=f.stateNode;if(C===null)return null;var L=Zl(C);if(L===null)return null;C=L[p];e:switch(p){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(C&&typeof C!="function")throw Error(r(231,p,typeof C));return C}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,p,C,L,O,V,Q,le,fe){var we=Array.prototype.slice.call(arguments,3);try{p.apply(C,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,p,C,L,O,V,Q,le,fe){yt=!1,Rt=null,vt.apply(Tr,arguments)}function ur(f,p,C,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 p=f,C=f;if(f.alternate)for(;p.return;)p=p.return;else{f=p;do p=f,(p.flags&4098)!==0&&(C=p.return),f=p.return;while(f)}return p.tag===3?C:null}function Kt(f){if(f.tag===13){var p=f.memoizedState;if(p===null&&(f=f.alternate,f!==null&&(p=f.memoizedState)),p!==null)return p.dehydrated}return null}function Vr(f){if(At(f)!==f)throw Error(r(188))}function ir(f){var p=f.alternate;if(!p){if(p=At(f),p===null)throw Error(r(188));return p!==f?null:f}for(var C=f,L=p;;){var O=C.return;if(O===null)break;var V=O.alternate;if(V===null){if(L=O.return,L!==null){C=L;continue}break}if(O.child===V.child){for(V=O.child;V;){if(V===C)return Vr(O),f;if(V===L)return Vr(O),p;V=V.sibling}throw Error(r(188))}if(C.return!==L.return)C=O,L=V;else{for(var Q=!1,le=O.child;le;){if(le===C){Q=!0,C=O,L=V;break}if(le===L){Q=!0,L=O,C=V;break}le=le.sibling}if(!Q){for(le=V.child;le;){if(le===C){Q=!0,C=V,L=O;break}if(le===L){Q=!0,L=V,C=O;break}le=le.sibling}if(!Q)throw Error(r(189))}}if(C.alternate!==L)throw Error(r(190))}if(C.tag!==3)throw Error(r(188));return C.stateNode.current===C?f:p}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 p=Nn(f);if(p!==null)return p;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,p){var C=f.pendingLanes;if(C===0)return 0;var L=0,O=f.suspendedLanes,V=f.pingedLanes,Q=C&268435455;if(Q!==0){var le=Q&~O;le!==0?L=ro(le):(V&=Q,V!==0&&(L=ro(V)))}else Q=C&~O,Q!==0?L=ro(Q):V!==0&&(L=ro(V));if(L===0)return 0;if(p!==0&&p!==L&&(p&O)===0&&(O=L&-L,V=p&-p,O>=V||O===16&&(V&4194240)!==0))return p;if((L&4)!==0&&(L|=C&16),p=f.entangledLanes,p!==0)for(f=f.entanglements,p&=L;0<p;)C=31-er(p),O=1<<C,L|=f[C],p&=~O;return L}function g2(f,p){switch(f){case 1:case 2:case 4:return p+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 p+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 m2(f,p){for(var C=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&C)===0||(le&L)!==0)&&(O[Q]=g2(le,p)):fe<=p&&(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 p=[],C=0;31>C;C++)p.push(f);return p}function no(f,p,C){f.pendingLanes|=p,p!==536870912&&(f.suspendedLanes=0,f.pingedLanes=0),f=f.eventTimes,p=31-er(p),f[p]=C}function y2(f,p){var C=f.pendingLanes&~p;f.pendingLanes=p,f.suspendedLanes=0,f.pingedLanes=0,f.expiredLanes&=p,f.mutableReadLanes&=p,f.entangledLanes&=p,p=f.entanglements;var L=f.eventTimes;for(f=f.expirationTimes;0<C;){var O=31-er(C),V=1<<O;p[O]=0,L[O]=-1,f[O]=-1,C&=~V}}function vh(f,p){var C=f.entangledLanes|=p;for(f=f.entanglements;C;){var L=31-er(C),O=1<<L;O&p|f[L]&p&&(f[L]|=p),C&=~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=[],x2="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,p){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(p.pointerId);break;case"gotpointercapture":case"lostpointercapture":ao.delete(p.pointerId)}}function so(f,p,C,L,O,V){return f===null||f.nativeEvent!==V?(f={blockedOn:p,domEventName:C,eventSystemFlags:L,nativeEvent:V,targetContainers:[O]},p!==null&&(p=wo(p),p!==null&&gh(p)),f):(f.eventSystemFlags|=L,p=f.targetContainers,O!==null&&p.indexOf(O)===-1&&p.push(O),f)}function b2(f,p,C,L,O){switch(p){case"focusin":return _i=so(_i,f,p,C,L,O),!0;case"dragenter":return Si=so(Si,f,p,C,L,O),!0;case"mouseover":return Ci=so(Ci,f,p,C,L,O),!0;case"pointerover":var V=O.pointerId;return io.set(V,so(io.get(V)||null,f,p,C,L,O)),!0;case"gotpointercapture":return V=O.pointerId,ao.set(V,so(ao.get(V)||null,f,p,C,L,O)),!0}return!1}function zg(f){var p=fa(f.target);if(p!==null){var C=At(p);if(C!==null){if(p=C.tag,p===13){if(p=Kt(C),p!==null){f.blockedOn=p,Fg(f.priority,function(){Og(C)});return}}else if(p===3&&C.stateNode.current.memoizedState.isDehydrated){f.blockedOn=C.tag===3?C.stateNode.containerInfo:null;return}}}f.blockedOn=null}function Fl(f){if(f.blockedOn!==null)return!1;for(var p=f.targetContainers;0<p.length;){var C=xh(f.domEventName,f.eventSystemFlags,p[0],f.nativeEvent);if(C===null){C=f.nativeEvent;var L=new C.constructor(C.type,C);be=L,C.target.dispatchEvent(L),be=null}else return p=wo(C),p!==null&&gh(p),f.blockedOn=C,!1;p.shift()}return!0}function Hg(f,p,C){Fl(f)&&C.delete(p)}function w2(){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,p){f.blockedOn===p&&(f.blockedOn=null,mh||(mh=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,w2)))}function lo(f){function p(O){return oo(O,f)}if(0<Bl.length){oo(Bl[0],f);for(var C=1;C<Bl.length;C++){var L=Bl[C];L.blockedOn===f&&(L.blockedOn=null)}}for(_i!==null&&oo(_i,f),Si!==null&&oo(Si,f),Ci!==null&&oo(Ci,f),io.forEach(p),ao.forEach(p),C=0;C<Ei.length;C++)L=Ei[C],L.blockedOn===f&&(L.blockedOn=null);for(;0<Ei.length&&(C=Ei[0],C.blockedOn===null);)zg(C),C.blockedOn===null&&Ei.shift()}var qa=_.ReactCurrentBatchConfig,jl=!0;function _2(f,p,C,L){var O=Ft,V=qa.transition;qa.transition=null;try{Ft=1,yh(f,p,C,L)}finally{Ft=O,qa.transition=V}}function S2(f,p,C,L){var O=Ft,V=qa.transition;qa.transition=null;try{Ft=4,yh(f,p,C,L)}finally{Ft=O,qa.transition=V}}function yh(f,p,C,L){if(jl){var O=xh(f,p,C,L);if(O===null)Oh(f,p,L,zl,C),jg(f,L);else if(b2(O,f,p,C,L))L.stopPropagation();else if(jg(f,L),p&4&&-1<x2.indexOf(f)){for(;O!==null;){var V=wo(O);if(V!==null&&Ig(V),V=xh(f,p,C,L),V===null&&Oh(f,p,L,zl,C),V===O)break;O=V}O!==null&&L.stopPropagation()}else Oh(f,p,L,null,C)}}var zl=null;function xh(f,p,C,L){if(zl=null,f=Se(L),f=fa(f),f!==null)if(p=At(f),p===null)f=null;else if(C=p.tag,C===13){if(f=Kt(p),f!==null)return f;f=null}else if(C===3){if(p.stateNode.current.memoizedState.isDehydrated)return p.tag===3?p.stateNode.containerInfo:null;f=null}else p!==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,p=bh,C=p.length,L,O="value"in ki?ki.value:ki.textContent,V=O.length;for(f=0;f<C&&p[f]===O[f];f++);var Q=C-f;for(L=1;L<=Q&&p[C-L]===O[V-L];L++);return Hl=O.slice(f,1<L?1-L:void 0)}function Ul(f){var p=f.keyCode;return"charCode"in f?(f=f.charCode,f===0&&p===13&&(f=13)):f=p,f===10&&(f=13),32<=f||f===13?f:0}function Wl(){return!0}function Vg(){return!1}function hn(f){function p(C,L,O,V,Q){this._reactName=C,this._targetInst=O,this.type=L,this.nativeEvent=V,this.target=Q,this.currentTarget=null;for(var le in f)f.hasOwnProperty(le)&&(C=f[le],this[le]=C?C(V):V[le]);return this.isDefaultPrevented=(V.defaultPrevented!=null?V.defaultPrevented:V.returnValue===!1)?Wl:Vg,this.isPropagationStopped=Vg,this}return P(p.prototype,{preventDefault:function(){this.defaultPrevented=!0;var C=this.nativeEvent;C&&(C.preventDefault?C.preventDefault():typeof C.returnValue!="unknown"&&(C.returnValue=!1),this.isDefaultPrevented=Wl)},stopPropagation:function(){var C=this.nativeEvent;C&&(C.stopPropagation?C.stopPropagation():typeof C.cancelBubble!="unknown"&&(C.cancelBubble=!0),this.isPropagationStopped=Wl)},persist:function(){},isPersistent:Wl}),p}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}),C2=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),E2=P({},Vl,{dataTransfer:0}),k2=hn(E2),T2=P({},uo,{relatedTarget:0}),Ch=hn(T2),R2=P({},Ya,{animationName:0,elapsedTime:0,pseudoElement:0}),L2=hn(R2),N2=P({},Ya,{clipboardData:function(f){return"clipboardData"in f?f.clipboardData:window.clipboardData}}),D2=hn(N2),A2=P({},Ya,{data:0}),Gg=hn(A2),M2={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},P2={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"},I2={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function O2(f){var p=this.nativeEvent;return p.getModifierState?p.getModifierState(f):(f=I2[f])?!!p[f]:!1}function Eh(){return O2}var B2=P({},uo,{key:function(f){if(f.key){var p=M2[f.key]||f.key;if(p!=="Unidentified")return p}return f.type==="keypress"?(f=Ul(f),f===13?"Enter":String.fromCharCode(f)):f.type==="keydown"||f.type==="keyup"?P2[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}}),F2=hn(B2),j2=P({},Vl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),qg=hn(j2),z2=P({},uo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Eh}),H2=hn(z2),U2=P({},Ya,{propertyName:0,elapsedTime:0,pseudoElement:0}),W2=hn(U2),V2=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}),$2=hn(V2),G2=[9,13,27,32],kh=a&&"CompositionEvent"in window,ho=null;a&&"documentMode"in document&&(ho=document.documentMode);var q2=a&&"TextEvent"in window&&!ho,Yg=a&&(!kh||ho&&8<ho&&11>=ho),Xg=" ",Kg=!1;function Qg(f,p){switch(f){case"keyup":return G2.indexOf(p.keyCode)!==-1;case"keydown":return p.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 Y2(f,p){switch(f){case"compositionend":return Zg(p);case"keypress":return p.which!==32?null:(Kg=!0,Xg);case"textInput":return f=p.data,f===Xg&&Kg?null:f;default:return null}}function X2(f,p){if(Xa)return f==="compositionend"||!kh&&Qg(f,p)?(f=Wg(),Hl=bh=ki=null,Xa=!1,f):null;switch(f){case"paste":return null;case"keypress":if(!(p.ctrlKey||p.altKey||p.metaKey)||p.ctrlKey&&p.altKey){if(p.char&&1<p.char.length)return p.char;if(p.which)return String.fromCharCode(p.which)}return null;case"compositionend":return Yg&&p.locale!=="ko"?null:p.data;default:return null}}var K2={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 p=f&&f.nodeName&&f.nodeName.toLowerCase();return p==="input"?!!K2[f.type]:p==="textarea"}function em(f,p,C,L){Ge(L),p=Xl(p,"onChange"),0<p.length&&(C=new wh("onChange","change",null,C,L),f.push({event:C,listeners:p}))}var fo=null,po=null;function Q2(f){ym(f,0)}function $l(f){var p=es(f);if(ie(p))return f}function Z2(f,p){if(f==="change")return p}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 p=[];em(p,po,f,Se(f)),Qe(Q2,p)}}function J2(f,p,C){f==="focusin"?(nm(),fo=p,po=C,fo.attachEvent("onpropertychange",im)):f==="focusout"&&nm()}function eC(f){if(f==="selectionchange"||f==="keyup"||f==="keydown")return $l(po)}function tC(f,p){if(f==="click")return $l(p)}function rC(f,p){if(f==="input"||f==="change")return $l(p)}function nC(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}var An=typeof Object.is=="function"?Object.is:nC;function vo(f,p){if(An(f,p))return!0;if(typeof f!="object"||f===null||typeof p!="object"||p===null)return!1;var C=Object.keys(f),L=Object.keys(p);if(C.length!==L.length)return!1;for(L=0;L<C.length;L++){var O=C[L];if(!l.call(p,O)||!An(f[O],p[O]))return!1}return!0}function am(f){for(;f&&f.firstChild;)f=f.firstChild;return f}function sm(f,p){var C=am(f);f=0;for(var L;C;){if(C.nodeType===3){if(L=f+C.textContent.length,f<=p&&L>=p)return{node:C,offset:p-f};f=L}e:{for(;C;){if(C.nextSibling){C=C.nextSibling;break e}C=C.parentNode}C=void 0}C=am(C)}}function om(f,p){return f&&p?f===p?!0:f&&f.nodeType===3?!1:p&&p.nodeType===3?om(f,p.parentNode):"contains"in f?f.contains(p):f.compareDocumentPosition?!!(f.compareDocumentPosition(p)&16):!1:!1}function lm(){for(var f=window,p=ce();p instanceof f.HTMLIFrameElement;){try{var C=typeof p.contentWindow.location.href=="string"}catch{C=!1}if(C)f=p.contentWindow;else break;p=ce(f.document)}return p}function Lh(f){var p=f&&f.nodeName&&f.nodeName.toLowerCase();return p&&(p==="input"&&(f.type==="text"||f.type==="search"||f.type==="tel"||f.type==="url"||f.type==="password")||p==="textarea"||f.contentEditable==="true")}function iC(f){var p=lm(),C=f.focusedElem,L=f.selectionRange;if(p!==C&&C&&C.ownerDocument&&om(C.ownerDocument.documentElement,C)){if(L!==null&&Lh(C)){if(p=L.start,f=L.end,f===void 0&&(f=p),"selectionStart"in C)C.selectionStart=p,C.selectionEnd=Math.min(f,C.value.length);else if(f=(p=C.ownerDocument||document)&&p.defaultView||window,f.getSelection){f=f.getSelection();var O=C.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(C,V);var Q=sm(C,L);O&&Q&&(f.rangeCount!==1||f.anchorNode!==O.node||f.anchorOffset!==O.offset||f.focusNode!==Q.node||f.focusOffset!==Q.offset)&&(p=p.createRange(),p.setStart(O.node,O.offset),f.removeAllRanges(),V>L?(f.addRange(p),f.extend(Q.node,Q.offset)):(p.setEnd(Q.node,Q.offset),f.addRange(p)))}}for(p=[],f=C;f=f.parentNode;)f.nodeType===1&&p.push({element:f,left:f.scrollLeft,top:f.scrollTop});for(typeof C.focus=="function"&&C.focus(),C=0;C<p.length;C++)f=p[C],f.element.scrollLeft=f.left,f.element.scrollTop=f.top}}var aC=a&&"documentMode"in document&&11>=document.documentMode,Ka=null,Nh=null,go=null,Dh=!1;function um(f,p,C){var L=C.window===C?C.document:C.nodeType===9?C:C.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&&(p=new wh("onSelect","select",null,p,C),f.push({event:p,listeners:L}),p.target=Ka)))}function Gl(f,p){var C={};return C[f.toLowerCase()]=p.toLowerCase(),C["Webkit"+f]="webkit"+p,C["Moz"+f]="moz"+p,C}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 p=Qa[f],C;for(C in p)if(p.hasOwnProperty(C)&&C in cm)return Ah[f]=p[C];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,p){vm.set(f,p),s(p,[f])}for(var Mh=0;Mh<gm.length;Mh++){var Ph=gm[Mh],sC=Ph.toLowerCase(),oC=Ph[0].toUpperCase()+Ph.slice(1);Ti(sC,"on"+oC)}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(" "),lC=new Set("cancel close invalid load scroll toggle".split(" ").concat(mo));function mm(f,p,C){var L=f.type||"unknown-event";f.currentTarget=C,ur(L,p,void 0,f),f.currentTarget=null}function ym(f,p){p=(p&4)!==0;for(var C=0;C<f.length;C++){var L=f[C],O=L.event;L=L.listeners;e:{var V=void 0;if(p)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,p){var C=p[Uh];C===void 0&&(C=p[Uh]=new Set);var L=f+"__bubble";C.has(L)||(xm(p,f,2,!1),C.add(L))}function Ih(f,p,C){var L=0;p&&(L|=4),xm(C,f,L,p)}var Yl="_reactListening"+Math.random().toString(36).slice(2);function yo(f){if(!f[Yl]){f[Yl]=!0,n.forEach(function(C){C!=="selectionchange"&&(lC.has(C)||Ih(C,!1,f),Ih(C,!0,f))});var p=f.nodeType===9?f:f.ownerDocument;p===null||p[Yl]||(p[Yl]=!0,Ih("selectionchange",!1,p))}}function xm(f,p,C,L){switch(Ug(p)){case 1:var O=_2;break;case 4:O=S2;break;default:O=yh}C=O.bind(null,p,C,f),O=void 0,!xt||p!=="touchstart"&&p!=="touchmove"&&p!=="wheel"||(O=!0),L?O!==void 0?f.addEventListener(p,C,{capture:!0,passive:O}):f.addEventListener(p,C,!0):O!==void 0?f.addEventListener(p,C,{passive:O}):f.addEventListener(p,C,!1)}function Oh(f,p,C,L,O){var V=L;if((p&1)===0&&(p&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(C),Ue=[];e:{var Ie=vm.get(f);if(Ie!==void 0){var Je=wh,nt=f;switch(f){case"keypress":if(Ul(C)===0)break e;case"keydown":case"keyup":Je=F2;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(C.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=k2;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Je=H2;break;case hm:case fm:case dm:Je=L2;break;case pm:Je=W2;break;case"scroll":Je=C2;break;case"wheel":Je=$2;break;case"copy":case"cut":case"paste":Je=D2;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Je=qg}var at=(p&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,C,Oe),Ue.push({event:Ie,listeners:at}))}}if((p&7)===0){e:{if(Ie=f==="mouseover"||f==="pointerover",Je=f==="mouseout"||f==="pointerout",Ie&&C!==be&&(nt=C.relatedTarget||C.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=C.relatedTarget||C.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,C,Oe),Ie.target=or,Ie.relatedTarget=xe,$e=null,fa(Oe)===we&&(at=new at(ye,ve+"enter",nt,C,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(Ue,Ie,Je,at,!1),nt!==null&&or!==null&&bm(Ue,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=Z2;else if(Jg(Ie))if(tm)ot=rC;else{ot=eC;var ct=J2}else(Je=Ie.nodeName)&&Je.toLowerCase()==="input"&&(Ie.type==="checkbox"||Ie.type==="radio")&&(ot=tC);if(ot&&(ot=ot(f,we))){em(Ue,ot,C,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(Ue,C,Oe);break;case"selectionchange":if(aC)break;case"keydown":case"keyup":um(Ue,C,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,C)&&(gt="onCompositionEnd"):f==="keydown"&&C.keyCode===229&&(gt="onCompositionStart");gt&&(Yg&&C.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,C,Oe),Ue.push({event:gt,listeners:ct}),ht?gt.data=ht:(ht=Zg(C),ht!==null&&(gt.data=ht)))),(ht=q2?Y2(f,C):X2(f,C))&&(we=Xl(we,"onBeforeInput"),0<we.length&&(Oe=new Gg("onBeforeInput","beforeinput",null,C,Oe),Ue.push({event:Oe,listeners:we}),Oe.data=ht))}ym(Ue,p)})}function xo(f,p,C){return{instance:f,listener:p,currentTarget:C}}function Xl(f,p){for(var C=p+"Capture",L=[];f!==null;){var O=f,V=O.stateNode;O.tag===5&&V!==null&&(O=V,V=Ke(f,C),V!=null&&L.unshift(xo(f,V,O)),V=Ke(f,p),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,p,C,L,O){for(var V=p._reactName,Q=[];C!==null&&C!==L;){var le=C,fe=le.alternate,we=le.stateNode;if(fe!==null&&fe===L)break;le.tag===5&&we!==null&&(le=we,O?(fe=Ke(C,V),fe!=null&&Q.unshift(xo(C,fe,le))):O||(fe=Ke(C,V),fe!=null&&Q.push(xo(C,fe,le)))),C=C.return}Q.length!==0&&f.push({event:p,listeners:Q})}var uC=/\r\n?/g,cC=/\u0000|\uFFFD/g;function wm(f){return(typeof f=="string"?f:""+f).replace(uC,`
|
|
38
|
+
`).replace(cC,"")}function Kl(f,p,C){if(p=wm(p),wm(f)!==p&&C)throw Error(r(425))}function Ql(){}var Bh=null,Fh=null;function jh(f,p){return f==="textarea"||f==="noscript"||typeof p.children=="string"||typeof p.children=="number"||typeof p.dangerouslySetInnerHTML=="object"&&p.dangerouslySetInnerHTML!==null&&p.dangerouslySetInnerHTML.__html!=null}var zh=typeof setTimeout=="function"?setTimeout:void 0,hC=typeof clearTimeout=="function"?clearTimeout:void 0,_m=typeof Promise=="function"?Promise:void 0,fC=typeof queueMicrotask=="function"?queueMicrotask:typeof _m<"u"?function(f){return _m.resolve(null).then(f).catch(dC)}:zh;function dC(f){setTimeout(function(){throw f})}function Hh(f,p){var C=p,L=0;do{var O=C.nextSibling;if(f.removeChild(C),O&&O.nodeType===8)if(C=O.data,C==="/$"){if(L===0){f.removeChild(O),lo(p);return}L--}else C!=="$"&&C!=="$?"&&C!=="$!"||L++;C=O}while(C);lo(p)}function Ri(f){for(;f!=null;f=f.nextSibling){var p=f.nodeType;if(p===1||p===3)break;if(p===8){if(p=f.data,p==="$"||p==="$!"||p==="$?")break;if(p==="/$")return null}}return f}function Sm(f){f=f.previousSibling;for(var p=0;f;){if(f.nodeType===8){var C=f.data;if(C==="$"||C==="$!"||C==="$?"){if(p===0)return f;p--}else C==="/$"&&p++}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,pC="__reactListeners$"+Ja,vC="__reactHandles$"+Ja;function fa(f){var p=f[Wn];if(p)return p;for(var C=f.parentNode;C;){if(p=C[ai]||C[Wn]){if(C=p.alternate,p.child!==null||C!==null&&C.child!==null)for(f=Sm(f);f!==null;){if(C=f[Wn])return C;f=Sm(f)}return p}f=C,C=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,p){ts++,Wh[ts]=f.current,f.current=p}var Ni={},Ir=Li(Ni),Zr=Li(!1),da=Ni;function rs(f,p){var C=f.type.contextTypes;if(!C)return Ni;var L=f.stateNode;if(L&&L.__reactInternalMemoizedUnmaskedChildContext===p)return L.__reactInternalMemoizedMaskedChildContext;var O={},V;for(V in C)O[V]=p[V];return L&&(f=f.stateNode,f.__reactInternalMemoizedUnmaskedChildContext=p,f.__reactInternalMemoizedMaskedChildContext=O),O}function Jr(f){return f=f.childContextTypes,f!=null}function Jl(){Yt(Zr),Yt(Ir)}function Cm(f,p,C){if(Ir.current!==Ni)throw Error(r(168));Vt(Ir,p),Vt(Zr,C)}function Em(f,p,C){var L=f.stateNode;if(p=p.childContextTypes,typeof L.getChildContext!="function")return C;L=L.getChildContext();for(var O in L)if(!(O in p))throw Error(r(108,Y(f)||"Unknown",O));return P({},C,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,p,C){var L=f.stateNode;if(!L)throw Error(r(169));C?(f=Em(f,p,da),L.__reactInternalMemoizedMergedChildContext=f,Yt(Zr),Yt(Ir),Vt(Ir,f)):Yt(Zr),Vt(Zr,C)}var si=null,tu=!1,Vh=!1;function Tm(f){si===null?si=[f]:si.push(f)}function gC(f){tu=!0,Tm(f)}function Di(){if(!Vh&&si!==null){Vh=!0;var f=0,p=Ft;try{var C=si;for(Ft=1;f<C.length;f++){var L=C[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=p,Vh=!1}}return null}var ns=[],is=0,ru=null,nu=0,bn=[],wn=0,pa=null,oi=1,li="";function va(f,p){ns[is++]=nu,ns[is++]=ru,ru=f,nu=p}function Rm(f,p,C){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),C+=1;var V=32-er(p)+O;if(30<V){var Q=O-O%5;V=(L&(1<<Q)-1).toString(32),L>>=Q,O-=Q,oi=1<<32-er(p)+O|C<<O|L,li=V+f}else oi=1<<V|C<<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,p){var C=En(5,null,null,0);C.elementType="DELETED",C.stateNode=p,C.return=f,p=f.deletions,p===null?(f.deletions=[C],f.flags|=16):p.push(C)}function Nm(f,p){switch(f.tag){case 5:var C=f.type;return p=p.nodeType!==1||C.toLowerCase()!==p.nodeName.toLowerCase()?null:p,p!==null?(f.stateNode=p,fn=f,dn=Ri(p.firstChild),!0):!1;case 6:return p=f.pendingProps===""||p.nodeType!==3?null:p,p!==null?(f.stateNode=p,fn=f,dn=null,!0):!1;case 13:return p=p.nodeType!==8?null:p,p!==null?(C=pa!==null?{id:oi,overflow:li}:null,f.memoizedState={dehydrated:p,treeContext:C,retryLane:1073741824},C=En(18,null,null,0),C.stateNode=p,C.return=f,f.child=C,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 p=dn;if(p){var C=p;if(!Nm(f,p)){if(qh(f))throw Error(r(418));p=Ri(C.nextSibling);var L=fn;p&&Nm(f,p)?Lm(L,C):(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 p;if((p=f.tag!==3)&&!(p=f.tag!==5)&&(p=f.type,p=p!=="head"&&p!=="body"&&!jh(f.type,f.memoizedProps)),p&&(p=dn)){if(qh(f))throw Am(),Error(r(418));for(;p;)Lm(f,p),p=Ri(p.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,p=0;f;){if(f.nodeType===8){var C=f.data;if(C==="/$"){if(p===0){dn=Ri(f.nextSibling);break e}p--}else C!=="$"&&C!=="$!"&&C!=="$?"||p++}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 mC=_.ReactCurrentBatchConfig;function _o(f,p,C){if(f=C.ref,f!==null&&typeof f!="function"&&typeof f!="object"){if(C._owner){if(C=C._owner,C){if(C.tag!==1)throw Error(r(309));var L=C.stateNode}if(!L)throw Error(r(147,f));var O=L,V=""+f;return p!==null&&p.ref!==null&&typeof p.ref=="function"&&p.ref._stringRef===V?p.ref:(p=function(Q){var le=O.refs;Q===null?delete le[V]:le[V]=Q},p._stringRef=V,p)}if(typeof f!="string")throw Error(r(284));if(!C._owner)throw Error(r(290,f))}return f}function au(f,p){throw f=Object.prototype.toString.call(p),Error(r(31,f==="[object Object]"?"object with keys {"+Object.keys(p).join(", ")+"}":f))}function Mm(f){var p=f._init;return p(f._payload)}function Pm(f){function p(ye,ve){if(f){var xe=ye.deletions;xe===null?(ye.deletions=[ve],ye.flags|=16):xe.push(ve)}}function C(ye,ve){if(!f)return null;for(;ve!==null;)p(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 Ue(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 Ue(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&><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&&p(ye,ht),ve=V(Mt,ve,gt),ct===null?ot=Mt:ct.sibling=Mt,ct=Mt,ht=Sr}if(gt===xe.length)return C(ye,ht),Zt&&va(ye,gt),ot;if(ht===null){for(;gt<xe.length;gt++)ht=Ue(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 p(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&&p(ye,ht),ve=V(zi,ve,gt),ct===null?ot=zi:ct.sibling=zi,ct=zi,ht=Sr}if(Mt.done)return C(ye,ht),Zt&&va(ye,gt),ot;if(ht===null){for(;!Mt.done;gt++,Mt=xe.next())Mt=Ue(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(KC){return p(ye,KC)}),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){C(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){C(ye,ct.sibling),ve=O(ct,xe.props),ve.ref=_o(ye,ct,xe),ve.return=ye,ye=ve;break e}C(ye,ct);break}else p(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){C(ye,ve.sibling),ve=O(ve,xe.children||[]),ve.return=ye,ye=ve;break e}else{C(ye,ve);break}else p(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?(C(ye,ve.sibling),ve=O(ve,xe),ve.return=ye,ye=ve):(C(ye,ve),ve=Hf(xe,ye.mode,$e),ve.return=ye,ye=ve),Q(ye)):C(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 p=su.current;Yt(su),f._currentValue=p}function Jh(f,p,C){for(;f!==null;){var L=f.alternate;if((f.childLanes&p)!==p?(f.childLanes|=p,L!==null&&(L.childLanes|=p)):L!==null&&(L.childLanes&p)!==p&&(L.childLanes|=p),f===C)break;f=f.return}}function ls(f,p){ou=f,Kh=os=null,f=f.dependencies,f!==null&&f.firstContext!==null&&((f.lanes&p)!==0&&(en=!0),f.firstContext=null)}function _n(f){var p=f._currentValue;if(Kh!==f)if(f={context:f,memoizedValue:p,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 p}var ga=null;function ef(f){ga===null?ga=[f]:ga.push(f)}function Om(f,p,C,L){var O=p.interleaved;return O===null?(C.next=C,ef(p)):(C.next=O.next,O.next=C),p.interleaved=C,ui(f,L)}function ui(f,p){f.lanes|=p;var C=f.alternate;for(C!==null&&(C.lanes|=p),C=f,f=f.return;f!==null;)f.childLanes|=p,C=f.alternate,C!==null&&(C.childLanes|=p),C=f,f=f.return;return C.tag===3?C.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,p){f=f.updateQueue,p.updateQueue===f&&(p.updateQueue={baseState:f.baseState,firstBaseUpdate:f.firstBaseUpdate,lastBaseUpdate:f.lastBaseUpdate,shared:f.shared,effects:f.effects})}function ci(f,p){return{eventTime:f,lane:p,tag:0,payload:null,callback:null,next:null}}function Mi(f,p,C){var L=f.updateQueue;if(L===null)return null;if(L=L.shared,(Lt&2)!==0){var O=L.pending;return O===null?p.next=p:(p.next=O.next,O.next=p),L.pending=p,ui(f,C)}return O=L.interleaved,O===null?(p.next=p,ef(L)):(p.next=O.next,O.next=p),L.interleaved=p,ui(f,C)}function lu(f,p,C){if(p=p.updateQueue,p!==null&&(p=p.shared,(C&4194240)!==0)){var L=p.lanes;L&=f.pendingLanes,C|=L,p.lanes=C,vh(f,C)}}function Fm(f,p){var C=f.updateQueue,L=f.alternate;if(L!==null&&(L=L.updateQueue,C===L)){var O=null,V=null;if(C=C.firstBaseUpdate,C!==null){do{var Q={eventTime:C.eventTime,lane:C.lane,tag:C.tag,payload:C.payload,callback:C.callback,next:null};V===null?O=V=Q:V=V.next=Q,C=C.next}while(C!==null);V===null?O=V=p:V=V.next=p}else O=V=p;C={baseState:L.baseState,firstBaseUpdate:O,lastBaseUpdate:V,shared:L.shared,effects:L.effects},f.updateQueue=C;return}f=C.lastBaseUpdate,f===null?C.firstBaseUpdate=p:f.next=p,C.lastBaseUpdate=p}function uu(f,p,C,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 Ue=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=p,Je=C,at.tag){case 1:if(nt=at.payload,typeof nt=="function"){Ue=nt.call(Je,Ue,Ie);break e}Ue=nt;break e;case 3:nt.flags=nt.flags&-65537|128;case 0:if(nt=at.payload,Ie=typeof nt=="function"?nt.call(Je,Ue,Ie):nt,Ie==null)break e;Ue=P({},Ue,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=Ue):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=Ue),O.baseState=fe,O.firstBaseUpdate=we,O.lastBaseUpdate=Oe,p=O.shared.interleaved,p!==null){O=p;do Q|=O.lane,O=O.next;while(O!==p)}else V===null&&(O.shared.lanes=0);xa|=Q,f.lanes=Q,f.memoizedState=Ue}}function jm(f,p,C){if(f=p.effects,p.effects=null,f!==null)for(p=0;p<f.length;p++){var L=f[p],O=L.callback;if(O!==null){if(L.callback=null,L=C,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,p){switch(Vt(Eo,p),Vt(Co,f),Vt(Vn,So),f=p.nodeType,f){case 9:case 11:p=(p=p.documentElement)?p.namespaceURI:Ce(null,"");break;default:f=f===8?p.parentNode:p,p=f.namespaceURI||null,f=f.tagName,p=Ce(p,f)}Yt(Vn),Vt(Vn,p)}function us(){Yt(Vn),Yt(Co),Yt(Eo)}function zm(f){ma(Eo.current);var p=ma(Vn.current),C=Ce(p,f.type);p!==C&&(Vt(Co,f),Vt(Vn,C))}function nf(f){Co.current===f&&(Yt(Vn),Yt(Co))}var tr=Li(0);function cu(f){for(var p=f;p!==null;){if(p.tag===13){var C=p.memoizedState;if(C!==null&&(C=C.dehydrated,C===null||C.data==="$?"||C.data==="$!"))return p}else if(p.tag===19&&p.memoizedProps.revealOrder!==void 0){if((p.flags&128)!==0)return p}else if(p.child!==null){p.child.return=p,p=p.child;continue}if(p===f)break;for(;p.sibling===null;){if(p.return===null||p.return===f)return null;p=p.return}p.sibling.return=p.return,p=p.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,yC=0;function Or(){throw Error(r(321))}function lf(f,p){if(p===null)return!1;for(var C=0;C<p.length&&C<f.length;C++)if(!An(f[C],p[C]))return!1;return!0}function uf(f,p,C,L,O,V){if(ya=V,rr=p,p.memoizedState=null,p.updateQueue=null,p.lanes=0,hu.current=f===null||f.memoizedState===null?_C:SC,f=C(L,O),ko){V=0;do{if(ko=!1,To=0,25<=V)throw Error(r(301));V+=1,wr=vr=null,p.updateQueue=null,hu.current=CC,f=C(L,O)}while(ko)}if(hu.current=vu,p=vr!==null&&vr.next!==null,ya=0,wr=vr=rr=null,fu=!1,p)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 p=wr===null?rr.memoizedState:wr.next;if(p!==null)wr=p,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,p){return typeof p=="function"?p(f):p}function hf(f){var p=Sn(),C=p.queue;if(C===null)throw Error(r(311));C.lastRenderedReducer=f;var L=vr,O=L.baseQueue,V=C.pending;if(V!==null){if(O!==null){var Q=O.next;O.next=V.next,V.next=Q}L.baseQueue=O=V,C.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 Ue={lane:Oe,action:we.action,hasEagerState:we.hasEagerState,eagerState:we.eagerState,next:null};fe===null?(le=fe=Ue,Q=L):fe=fe.next=Ue,rr.lanes|=Oe,xa|=Oe}we=we.next}while(we!==null&&we!==V);fe===null?Q=L:fe.next=le,An(L,p.memoizedState)||(en=!0),p.memoizedState=L,p.baseState=Q,p.baseQueue=fe,C.lastRenderedState=L}if(f=C.interleaved,f!==null){O=f;do V=O.lane,rr.lanes|=V,xa|=V,O=O.next;while(O!==f)}else O===null&&(C.lanes=0);return[p.memoizedState,C.dispatch]}function ff(f){var p=Sn(),C=p.queue;if(C===null)throw Error(r(311));C.lastRenderedReducer=f;var L=C.dispatch,O=C.pending,V=p.memoizedState;if(O!==null){C.pending=null;var Q=O=O.next;do V=f(V,Q.action),Q=Q.next;while(Q!==O);An(V,p.memoizedState)||(en=!0),p.memoizedState=V,p.baseQueue===null&&(p.baseState=V),C.lastRenderedState=V}return[V,L]}function Hm(){}function Um(f,p){var C=rr,L=Sn(),O=p(),V=!An(L.memoizedState,O);if(V&&(L.memoizedState=O,en=!0),L=L.queue,df($m.bind(null,C,L,f),[f]),L.getSnapshot!==p||V||wr!==null&&wr.memoizedState.tag&1){if(C.flags|=2048,Lo(9,Vm.bind(null,C,L,O,p),void 0,null),_r===null)throw Error(r(349));(ya&30)!==0||Wm(C,p,O)}return O}function Wm(f,p,C){f.flags|=16384,f={getSnapshot:p,value:C},p=rr.updateQueue,p===null?(p={lastEffect:null,stores:null},rr.updateQueue=p,p.stores=[f]):(C=p.stores,C===null?p.stores=[f]:C.push(f))}function Vm(f,p,C,L){p.value=C,p.getSnapshot=L,Gm(p)&&qm(f)}function $m(f,p,C){return C(function(){Gm(p)&&qm(f)})}function Gm(f){var p=f.getSnapshot;f=f.value;try{var C=p();return!An(f,C)}catch{return!0}}function qm(f){var p=ui(f,1);p!==null&&Bn(p,f,1,-1)}function Ym(f){var p=$n();return typeof f=="function"&&(f=f()),p.memoizedState=p.baseState=f,f={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ro,lastRenderedState:f},p.queue=f,f=f.dispatch=wC.bind(null,rr,f),[p.memoizedState,f]}function Lo(f,p,C,L){return f={tag:f,create:p,destroy:C,deps:L,next:null},p=rr.updateQueue,p===null?(p={lastEffect:null,stores:null},rr.updateQueue=p,p.lastEffect=f.next=f):(C=p.lastEffect,C===null?p.lastEffect=f.next=f:(L=C.next,C.next=f,f.next=L,p.lastEffect=f)),f}function Xm(){return Sn().memoizedState}function du(f,p,C,L){var O=$n();rr.flags|=f,O.memoizedState=Lo(1|p,C,void 0,L===void 0?null:L)}function pu(f,p,C,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(p,C,V,L);return}}rr.flags|=f,O.memoizedState=Lo(1|p,C,V,L)}function Km(f,p){return du(8390656,8,f,p)}function df(f,p){return pu(2048,8,f,p)}function Qm(f,p){return pu(4,2,f,p)}function Zm(f,p){return pu(4,4,f,p)}function Jm(f,p){if(typeof p=="function")return f=f(),p(f),function(){p(null)};if(p!=null)return f=f(),p.current=f,function(){p.current=null}}function ey(f,p,C){return C=C!=null?C.concat([f]):null,pu(4,4,Jm.bind(null,p,f),C)}function pf(){}function ty(f,p){var C=Sn();p=p===void 0?null:p;var L=C.memoizedState;return L!==null&&p!==null&&lf(p,L[1])?L[0]:(C.memoizedState=[f,p],f)}function ry(f,p){var C=Sn();p=p===void 0?null:p;var L=C.memoizedState;return L!==null&&p!==null&&lf(p,L[1])?L[0]:(f=f(),C.memoizedState=[f,p],f)}function ny(f,p,C){return(ya&21)===0?(f.baseState&&(f.baseState=!1,en=!0),f.memoizedState=C):(An(C,p)||(C=Mg(),rr.lanes|=C,xa|=C,f.baseState=!0),p)}function xC(f,p){var C=Ft;Ft=C!==0&&4>C?C:4,f(!0);var L=of.transition;of.transition={};try{f(!1),p()}finally{Ft=C,of.transition=L}}function iy(){return Sn().memoizedState}function bC(f,p,C){var L=Bi(f);if(C={lane:L,action:C,hasEagerState:!1,eagerState:null,next:null},ay(f))sy(p,C);else if(C=Om(f,p,C,L),C!==null){var O=Gr();Bn(C,f,L,O),oy(C,p,L)}}function wC(f,p,C){var L=Bi(f),O={lane:L,action:C,hasEagerState:!1,eagerState:null,next:null};if(ay(f))sy(p,O);else{var V=f.alternate;if(f.lanes===0&&(V===null||V.lanes===0)&&(V=p.lastRenderedReducer,V!==null))try{var Q=p.lastRenderedState,le=V(Q,C);if(O.hasEagerState=!0,O.eagerState=le,An(le,Q)){var fe=p.interleaved;fe===null?(O.next=O,ef(p)):(O.next=fe.next,fe.next=O),p.interleaved=O;return}}catch{}finally{}C=Om(f,p,O,L),C!==null&&(O=Gr(),Bn(C,f,L,O),oy(C,p,L))}}function ay(f){var p=f.alternate;return f===rr||p!==null&&p===rr}function sy(f,p){ko=fu=!0;var C=f.pending;C===null?p.next=p:(p.next=C.next,C.next=p),f.pending=p}function oy(f,p,C){if((C&4194240)!==0){var L=p.lanes;L&=f.pendingLanes,C|=L,p.lanes=C,vh(f,C)}}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},_C={readContext:_n,useCallback:function(f,p){return $n().memoizedState=[f,p===void 0?null:p],f},useContext:_n,useEffect:Km,useImperativeHandle:function(f,p,C){return C=C!=null?C.concat([f]):null,du(4194308,4,Jm.bind(null,p,f),C)},useLayoutEffect:function(f,p){return du(4194308,4,f,p)},useInsertionEffect:function(f,p){return du(4,2,f,p)},useMemo:function(f,p){var C=$n();return p=p===void 0?null:p,f=f(),C.memoizedState=[f,p],f},useReducer:function(f,p,C){var L=$n();return p=C!==void 0?C(p):p,L.memoizedState=L.baseState=p,f={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:f,lastRenderedState:p},L.queue=f,f=f.dispatch=bC.bind(null,rr,f),[L.memoizedState,f]},useRef:function(f){var p=$n();return f={current:f},p.memoizedState=f},useState:Ym,useDebugValue:pf,useDeferredValue:function(f){return $n().memoizedState=f},useTransition:function(){var f=Ym(!1),p=f[0];return f=xC.bind(null,f[1]),$n().memoizedState=f,[p,f]},useMutableSource:function(){},useSyncExternalStore:function(f,p,C){var L=rr,O=$n();if(Zt){if(C===void 0)throw Error(r(407));C=C()}else{if(C=p(),_r===null)throw Error(r(349));(ya&30)!==0||Wm(L,p,C)}O.memoizedState=C;var V={value:C,getSnapshot:p};return O.queue=V,Km($m.bind(null,L,V,f),[f]),L.flags|=2048,Lo(9,Vm.bind(null,L,V,C,p),void 0,null),C},useId:function(){var f=$n(),p=_r.identifierPrefix;if(Zt){var C=li,L=oi;C=(L&~(1<<32-er(L)-1)).toString(32)+C,p=":"+p+"R"+C,C=To++,0<C&&(p+="H"+C.toString(32)),p+=":"}else C=yC++,p=":"+p+"r"+C.toString(32)+":";return f.memoizedState=p},unstable_isNewReconciler:!1},SC={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 p=Sn();return ny(p,vr.memoizedState,f)},useTransition:function(){var f=hf(Ro)[0],p=Sn().memoizedState;return[f,p]},useMutableSource:Hm,useSyncExternalStore:Um,useId:iy,unstable_isNewReconciler:!1},CC={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 p=Sn();return vr===null?p.memoizedState=f:ny(p,vr.memoizedState,f)},useTransition:function(){var f=ff(Ro)[0],p=Sn().memoizedState;return[f,p]},useMutableSource:Hm,useSyncExternalStore:Um,useId:iy,unstable_isNewReconciler:!1};function Pn(f,p){if(f&&f.defaultProps){p=P({},p),f=f.defaultProps;for(var C in f)p[C]===void 0&&(p[C]=f[C]);return p}return p}function vf(f,p,C,L){p=f.memoizedState,C=C(L,p),C=C==null?p:P({},p,C),f.memoizedState=C,f.lanes===0&&(f.updateQueue.baseState=C)}var gu={isMounted:function(f){return(f=f._reactInternals)?At(f)===f:!1},enqueueSetState:function(f,p,C){f=f._reactInternals;var L=Gr(),O=Bi(f),V=ci(L,O);V.payload=p,C!=null&&(V.callback=C),p=Mi(f,V,O),p!==null&&(Bn(p,f,O,L),lu(p,f,O))},enqueueReplaceState:function(f,p,C){f=f._reactInternals;var L=Gr(),O=Bi(f),V=ci(L,O);V.tag=1,V.payload=p,C!=null&&(V.callback=C),p=Mi(f,V,O),p!==null&&(Bn(p,f,O,L),lu(p,f,O))},enqueueForceUpdate:function(f,p){f=f._reactInternals;var C=Gr(),L=Bi(f),O=ci(C,L);O.tag=2,p!=null&&(O.callback=p),p=Mi(f,O,L),p!==null&&(Bn(p,f,L,C),lu(p,f,L))}};function ly(f,p,C,L,O,V,Q){return f=f.stateNode,typeof f.shouldComponentUpdate=="function"?f.shouldComponentUpdate(L,V,Q):p.prototype&&p.prototype.isPureReactComponent?!vo(C,L)||!vo(O,V):!0}function uy(f,p,C){var L=!1,O=Ni,V=p.contextType;return typeof V=="object"&&V!==null?V=_n(V):(O=Jr(p)?da:Ir.current,L=p.contextTypes,V=(L=L!=null)?rs(f,O):Ni),p=new p(C,V),f.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=gu,f.stateNode=p,p._reactInternals=f,L&&(f=f.stateNode,f.__reactInternalMemoizedUnmaskedChildContext=O,f.__reactInternalMemoizedMaskedChildContext=V),p}function cy(f,p,C,L){f=p.state,typeof p.componentWillReceiveProps=="function"&&p.componentWillReceiveProps(C,L),typeof p.UNSAFE_componentWillReceiveProps=="function"&&p.UNSAFE_componentWillReceiveProps(C,L),p.state!==f&&gu.enqueueReplaceState(p,p.state,null)}function gf(f,p,C,L){var O=f.stateNode;O.props=C,O.state=f.memoizedState,O.refs={},tf(f);var V=p.contextType;typeof V=="object"&&V!==null?O.context=_n(V):(V=Jr(p)?da:Ir.current,O.context=rs(f,V)),O.state=f.memoizedState,V=p.getDerivedStateFromProps,typeof V=="function"&&(vf(f,p,V,C),O.state=f.memoizedState),typeof p.getDerivedStateFromProps=="function"||typeof O.getSnapshotBeforeUpdate=="function"||typeof O.UNSAFE_componentWillMount!="function"&&typeof O.componentWillMount!="function"||(p=O.state,typeof O.componentWillMount=="function"&&O.componentWillMount(),typeof O.UNSAFE_componentWillMount=="function"&&O.UNSAFE_componentWillMount(),p!==O.state&&gu.enqueueReplaceState(O,O.state,null),uu(f,C,O,L),O.state=f.memoizedState),typeof O.componentDidMount=="function"&&(f.flags|=4194308)}function cs(f,p){try{var C="",L=p;do C+=re(L),L=L.return;while(L);var O=C}catch(V){O=`
|
|
39
|
+
Error generating stack: `+V.message+`
|
|
40
|
+
`+V.stack}return{value:f,source:p,stack:O,digest:null}}function mf(f,p,C){return{value:f,source:null,stack:C??null,digest:p??null}}function yf(f,p){try{console.error(p.value)}catch(C){setTimeout(function(){throw C})}}var EC=typeof WeakMap=="function"?WeakMap:Map;function hy(f,p,C){C=ci(-1,C),C.tag=3,C.payload={element:null};var L=p.value;return C.callback=function(){Su||(Su=!0,Mf=L),yf(f,p)},C}function fy(f,p,C){C=ci(-1,C),C.tag=3;var L=f.type.getDerivedStateFromError;if(typeof L=="function"){var O=p.value;C.payload=function(){return L(O)},C.callback=function(){yf(f,p)}}var V=f.stateNode;return V!==null&&typeof V.componentDidCatch=="function"&&(C.callback=function(){yf(f,p),typeof L!="function"&&(Ii===null?Ii=new Set([this]):Ii.add(this));var Q=p.stack;this.componentDidCatch(p.value,{componentStack:Q!==null?Q:""})}),C}function dy(f,p,C){var L=f.pingCache;if(L===null){L=f.pingCache=new EC;var O=new Set;L.set(p,O)}else O=L.get(p),O===void 0&&(O=new Set,L.set(p,O));O.has(C)||(O.add(C),f=jC.bind(null,f,p,C),p.then(f,f))}function py(f){do{var p;if((p=f.tag===13)&&(p=f.memoizedState,p=p!==null?p.dehydrated!==null:!0),p)return f;f=f.return}while(f!==null);return null}function vy(f,p,C,L,O){return(f.mode&1)===0?(f===p?f.flags|=65536:(f.flags|=128,C.flags|=131072,C.flags&=-52805,C.tag===1&&(C.alternate===null?C.tag=17:(p=ci(-1,1),p.tag=2,Mi(C,p,1))),C.lanes|=1),f):(f.flags|=65536,f.lanes=O,f)}var kC=_.ReactCurrentOwner,en=!1;function $r(f,p,C,L){p.child=f===null?Im(p,null,C,L):ss(p,f.child,C,L)}function gy(f,p,C,L,O){C=C.render;var V=p.ref;return ls(p,O),L=uf(f,p,C,L,V,O),C=cf(),f!==null&&!en?(p.updateQueue=f.updateQueue,p.flags&=-2053,f.lanes&=~O,hi(f,p,O)):(Zt&&C&&$h(p),p.flags|=1,$r(f,p,L,O),p.child)}function my(f,p,C,L,O){if(f===null){var V=C.type;return typeof V=="function"&&!zf(V)&&V.defaultProps===void 0&&C.compare===null&&C.defaultProps===void 0?(p.tag=15,p.type=V,yy(f,p,V,L,O)):(f=Lu(C.type,null,L,p,p.mode,O),f.ref=p.ref,f.return=p,p.child=f)}if(V=f.child,(f.lanes&O)===0){var Q=V.memoizedProps;if(C=C.compare,C=C!==null?C:vo,C(Q,L)&&f.ref===p.ref)return hi(f,p,O)}return p.flags|=1,f=ji(V,L),f.ref=p.ref,f.return=p,p.child=f}function yy(f,p,C,L,O){if(f!==null){var V=f.memoizedProps;if(vo(V,L)&&f.ref===p.ref)if(en=!1,p.pendingProps=L=V,(f.lanes&O)!==0)(f.flags&131072)!==0&&(en=!0);else return p.lanes=f.lanes,hi(f,p,O)}return xf(f,p,C,L,O)}function xy(f,p,C){var L=p.pendingProps,O=L.children,V=f!==null?f.memoizedState:null;if(L.mode==="hidden")if((p.mode&1)===0)p.memoizedState={baseLanes:0,cachePool:null,transitions:null},Vt(fs,pn),pn|=C;else{if((C&1073741824)===0)return f=V!==null?V.baseLanes|C:C,p.lanes=p.childLanes=1073741824,p.memoizedState={baseLanes:f,cachePool:null,transitions:null},p.updateQueue=null,Vt(fs,pn),pn|=f,null;p.memoizedState={baseLanes:0,cachePool:null,transitions:null},L=V!==null?V.baseLanes:C,Vt(fs,pn),pn|=L}else V!==null?(L=V.baseLanes|C,p.memoizedState=null):L=C,Vt(fs,pn),pn|=L;return $r(f,p,O,C),p.child}function by(f,p){var C=p.ref;(f===null&&C!==null||f!==null&&f.ref!==C)&&(p.flags|=512,p.flags|=2097152)}function xf(f,p,C,L,O){var V=Jr(C)?da:Ir.current;return V=rs(p,V),ls(p,O),C=uf(f,p,C,L,V,O),L=cf(),f!==null&&!en?(p.updateQueue=f.updateQueue,p.flags&=-2053,f.lanes&=~O,hi(f,p,O)):(Zt&&L&&$h(p),p.flags|=1,$r(f,p,C,O),p.child)}function wy(f,p,C,L,O){if(Jr(C)){var V=!0;eu(p)}else V=!1;if(ls(p,O),p.stateNode===null)yu(f,p),uy(p,C,L),gf(p,C,L,O),L=!0;else if(f===null){var Q=p.stateNode,le=p.memoizedProps;Q.props=le;var fe=Q.context,we=C.contextType;typeof we=="object"&&we!==null?we=_n(we):(we=Jr(C)?da:Ir.current,we=rs(p,we));var Oe=C.getDerivedStateFromProps,Ue=typeof Oe=="function"||typeof Q.getSnapshotBeforeUpdate=="function";Ue||typeof Q.UNSAFE_componentWillReceiveProps!="function"&&typeof Q.componentWillReceiveProps!="function"||(le!==L||fe!==we)&&cy(p,Q,L,we),Ai=!1;var Ie=p.memoizedState;Q.state=Ie,uu(p,L,Q,O),fe=p.memoizedState,le!==L||Ie!==fe||Zr.current||Ai?(typeof Oe=="function"&&(vf(p,C,Oe,L),fe=p.memoizedState),(le=Ai||ly(p,C,le,L,Ie,fe,we))?(Ue||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"&&(p.flags|=4194308)):(typeof Q.componentDidMount=="function"&&(p.flags|=4194308),p.memoizedProps=L,p.memoizedState=fe),Q.props=L,Q.state=fe,Q.context=we,L=le):(typeof Q.componentDidMount=="function"&&(p.flags|=4194308),L=!1)}else{Q=p.stateNode,Bm(f,p),le=p.memoizedProps,we=p.type===p.elementType?le:Pn(p.type,le),Q.props=we,Ue=p.pendingProps,Ie=Q.context,fe=C.contextType,typeof fe=="object"&&fe!==null?fe=_n(fe):(fe=Jr(C)?da:Ir.current,fe=rs(p,fe));var Je=C.getDerivedStateFromProps;(Oe=typeof Je=="function"||typeof Q.getSnapshotBeforeUpdate=="function")||typeof Q.UNSAFE_componentWillReceiveProps!="function"&&typeof Q.componentWillReceiveProps!="function"||(le!==Ue||Ie!==fe)&&cy(p,Q,L,fe),Ai=!1,Ie=p.memoizedState,Q.state=Ie,uu(p,L,Q,O);var nt=p.memoizedState;le!==Ue||Ie!==nt||Zr.current||Ai?(typeof Je=="function"&&(vf(p,C,Je,L),nt=p.memoizedState),(we=Ai||ly(p,C,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"&&(p.flags|=4),typeof Q.getSnapshotBeforeUpdate=="function"&&(p.flags|=1024)):(typeof Q.componentDidUpdate!="function"||le===f.memoizedProps&&Ie===f.memoizedState||(p.flags|=4),typeof Q.getSnapshotBeforeUpdate!="function"||le===f.memoizedProps&&Ie===f.memoizedState||(p.flags|=1024),p.memoizedProps=L,p.memoizedState=nt),Q.props=L,Q.state=nt,Q.context=fe,L=we):(typeof Q.componentDidUpdate!="function"||le===f.memoizedProps&&Ie===f.memoizedState||(p.flags|=4),typeof Q.getSnapshotBeforeUpdate!="function"||le===f.memoizedProps&&Ie===f.memoizedState||(p.flags|=1024),L=!1)}return bf(f,p,C,L,V,O)}function bf(f,p,C,L,O,V){by(f,p);var Q=(p.flags&128)!==0;if(!L&&!Q)return O&&km(p,C,!1),hi(f,p,V);L=p.stateNode,kC.current=p;var le=Q&&typeof C.getDerivedStateFromError!="function"?null:L.render();return p.flags|=1,f!==null&&Q?(p.child=ss(p,f.child,null,V),p.child=ss(p,null,le,V)):$r(f,p,le,V),p.memoizedState=L.state,O&&km(p,C,!0),p.child}function _y(f){var p=f.stateNode;p.pendingContext?Cm(f,p.pendingContext,p.pendingContext!==p.context):p.context&&Cm(f,p.context,!1),rf(f,p.containerInfo)}function Sy(f,p,C,L,O){return as(),Xh(O),p.flags|=256,$r(f,p,C,L),p.child}var wf={dehydrated:null,treeContext:null,retryLane:0};function _f(f){return{baseLanes:f,cachePool:null,transitions:null}}function Cy(f,p,C){var L=p.pendingProps,O=tr.current,V=!1,Q=(p.flags&128)!==0,le;if((le=Q)||(le=f!==null&&f.memoizedState===null?!1:(O&2)!==0),le?(V=!0,p.flags&=-129):(f===null||f.memoizedState!==null)&&(O|=1),Vt(tr,O&1),f===null)return Yh(p),f=p.memoizedState,f!==null&&(f=f.dehydrated,f!==null)?((p.mode&1)===0?p.lanes=1:f.data==="$!"?p.lanes=8:p.lanes=1073741824,null):(Q=L.children,f=L.fallback,V?(L=p.mode,V=p.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,C,null),V.return=p,f.return=p,V.sibling=f,p.child=V,p.child.memoizedState=_f(C),p.memoizedState=wf,f):Sf(p,Q));if(O=f.memoizedState,O!==null&&(le=O.dehydrated,le!==null))return TC(f,p,Q,L,le,O,C);if(V){V=L.fallback,Q=p.mode,O=f.child,le=O.sibling;var fe={mode:"hidden",children:L.children};return(Q&1)===0&&p.child!==O?(L=p.child,L.childLanes=0,L.pendingProps=fe,p.deletions=null):(L=ji(O,fe),L.subtreeFlags=O.subtreeFlags&14680064),le!==null?V=ji(le,V):(V=Sa(V,Q,C,null),V.flags|=2),V.return=p,L.return=p,L.sibling=V,p.child=L,L=V,V=p.child,Q=f.child.memoizedState,Q=Q===null?_f(C):{baseLanes:Q.baseLanes|C,cachePool:null,transitions:Q.transitions},V.memoizedState=Q,V.childLanes=f.childLanes&~C,p.memoizedState=wf,L}return V=f.child,f=V.sibling,L=ji(V,{mode:"visible",children:L.children}),(p.mode&1)===0&&(L.lanes=C),L.return=p,L.sibling=null,f!==null&&(C=p.deletions,C===null?(p.deletions=[f],p.flags|=16):C.push(f)),p.child=L,p.memoizedState=null,L}function Sf(f,p){return p=Nu({mode:"visible",children:p},f.mode,0,null),p.return=f,f.child=p}function mu(f,p,C,L){return L!==null&&Xh(L),ss(p,f.child,null,C),f=Sf(p,p.pendingProps.children),f.flags|=2,p.memoizedState=null,f}function TC(f,p,C,L,O,V,Q){if(C)return p.flags&256?(p.flags&=-257,L=mf(Error(r(422))),mu(f,p,Q,L)):p.memoizedState!==null?(p.child=f.child,p.flags|=128,null):(V=L.fallback,O=p.mode,L=Nu({mode:"visible",children:L.children},O,0,null),V=Sa(V,O,Q,null),V.flags|=2,L.return=p,V.return=p,L.sibling=V,p.child=L,(p.mode&1)!==0&&ss(p,f.child,null,Q),p.child.memoizedState=_f(Q),p.memoizedState=wf,V);if((p.mode&1)===0)return mu(f,p,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,p,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,p,Q,L)}return O.data==="$?"?(p.flags|=128,p.child=f.child,p=zC.bind(null,f),O._reactRetry=p,null):(f=V.treeContext,dn=Ri(O.nextSibling),fn=p,Zt=!0,Mn=null,f!==null&&(bn[wn++]=oi,bn[wn++]=li,bn[wn++]=pa,oi=f.id,li=f.overflow,pa=p),p=Sf(p,L.children),p.flags|=4096,p)}function Ey(f,p,C){f.lanes|=p;var L=f.alternate;L!==null&&(L.lanes|=p),Jh(f.return,p,C)}function Cf(f,p,C,L,O){var V=f.memoizedState;V===null?f.memoizedState={isBackwards:p,rendering:null,renderingStartTime:0,last:L,tail:C,tailMode:O}:(V.isBackwards=p,V.rendering=null,V.renderingStartTime=0,V.last=L,V.tail=C,V.tailMode=O)}function ky(f,p,C){var L=p.pendingProps,O=L.revealOrder,V=L.tail;if($r(f,p,L.children,C),L=tr.current,(L&2)!==0)L=L&1|2,p.flags|=128;else{if(f!==null&&(f.flags&128)!==0)e:for(f=p.child;f!==null;){if(f.tag===13)f.memoizedState!==null&&Ey(f,C,p);else if(f.tag===19)Ey(f,C,p);else if(f.child!==null){f.child.return=f,f=f.child;continue}if(f===p)break e;for(;f.sibling===null;){if(f.return===null||f.return===p)break e;f=f.return}f.sibling.return=f.return,f=f.sibling}L&=1}if(Vt(tr,L),(p.mode&1)===0)p.memoizedState=null;else switch(O){case"forwards":for(C=p.child,O=null;C!==null;)f=C.alternate,f!==null&&cu(f)===null&&(O=C),C=C.sibling;C=O,C===null?(O=p.child,p.child=null):(O=C.sibling,C.sibling=null),Cf(p,!1,O,C,V);break;case"backwards":for(C=null,O=p.child,p.child=null;O!==null;){if(f=O.alternate,f!==null&&cu(f)===null){p.child=O;break}f=O.sibling,O.sibling=C,C=O,O=f}Cf(p,!0,C,null,V);break;case"together":Cf(p,!1,null,null,void 0);break;default:p.memoizedState=null}return p.child}function yu(f,p){(p.mode&1)===0&&f!==null&&(f.alternate=null,p.alternate=null,p.flags|=2)}function hi(f,p,C){if(f!==null&&(p.dependencies=f.dependencies),xa|=p.lanes,(C&p.childLanes)===0)return null;if(f!==null&&p.child!==f.child)throw Error(r(153));if(p.child!==null){for(f=p.child,C=ji(f,f.pendingProps),p.child=C,C.return=p;f.sibling!==null;)f=f.sibling,C=C.sibling=ji(f,f.pendingProps),C.return=p;C.sibling=null}return p.child}function RC(f,p,C){switch(p.tag){case 3:_y(p),as();break;case 5:zm(p);break;case 1:Jr(p.type)&&eu(p);break;case 4:rf(p,p.stateNode.containerInfo);break;case 10:var L=p.type._context,O=p.memoizedProps.value;Vt(su,L._currentValue),L._currentValue=O;break;case 13:if(L=p.memoizedState,L!==null)return L.dehydrated!==null?(Vt(tr,tr.current&1),p.flags|=128,null):(C&p.child.childLanes)!==0?Cy(f,p,C):(Vt(tr,tr.current&1),f=hi(f,p,C),f!==null?f.sibling:null);Vt(tr,tr.current&1);break;case 19:if(L=(C&p.childLanes)!==0,(f.flags&128)!==0){if(L)return ky(f,p,C);p.flags|=128}if(O=p.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 p.lanes=0,xy(f,p,C)}return hi(f,p,C)}var Ty,Ef,Ry,Ly;Ty=function(f,p){for(var C=p.child;C!==null;){if(C.tag===5||C.tag===6)f.appendChild(C.stateNode);else if(C.tag!==4&&C.child!==null){C.child.return=C,C=C.child;continue}if(C===p)break;for(;C.sibling===null;){if(C.return===null||C.return===p)return;C=C.return}C.sibling.return=C.return,C=C.sibling}},Ef=function(){},Ry=function(f,p,C,L){var O=f.memoizedProps;if(O!==L){f=p.stateNode,ma(Vn.current);var V=null;switch(C){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(C,L);var Q;C=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)&&(C||(C={}),C[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)||(C||(C={}),C[Q]="");for(Q in fe)fe.hasOwnProperty(Q)&&le[Q]!==fe[Q]&&(C||(C={}),C[Q]=fe[Q])}else C||(V||(V=[]),V.push(we,C)),C=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))}C&&(V=V||[]).push("style",C);var we=V;(p.updateQueue=we)&&(p.flags|=4)}},Ly=function(f,p,C,L){C!==L&&(p.flags|=4)};function No(f,p){if(!Zt)switch(f.tailMode){case"hidden":p=f.tail;for(var C=null;p!==null;)p.alternate!==null&&(C=p),p=p.sibling;C===null?f.tail=null:C.sibling=null;break;case"collapsed":C=f.tail;for(var L=null;C!==null;)C.alternate!==null&&(L=C),C=C.sibling;L===null?p||f.tail===null?f.tail=null:f.tail.sibling=null:L.sibling=null}}function Br(f){var p=f.alternate!==null&&f.alternate.child===f.child,C=0,L=0;if(p)for(var O=f.child;O!==null;)C|=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;)C|=O.lanes|O.childLanes,L|=O.subtreeFlags,L|=O.flags,O.return=f,O=O.sibling;return f.subtreeFlags|=L,f.childLanes=C,p}function LC(f,p,C){var L=p.pendingProps;switch(Gh(p),p.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Br(p),null;case 1:return Jr(p.type)&&Jl(),Br(p),null;case 3:return L=p.stateNode,us(),Yt(Zr),Yt(Ir),sf(),L.pendingContext&&(L.context=L.pendingContext,L.pendingContext=null),(f===null||f.child===null)&&(iu(p)?p.flags|=4:f===null||f.memoizedState.isDehydrated&&(p.flags&256)===0||(p.flags|=1024,Mn!==null&&(Of(Mn),Mn=null))),Ef(f,p),Br(p),null;case 5:nf(p);var O=ma(Eo.current);if(C=p.type,f!==null&&p.stateNode!=null)Ry(f,p,C,L,O),f.ref!==p.ref&&(p.flags|=512,p.flags|=2097152);else{if(!L){if(p.stateNode===null)throw Error(r(166));return Br(p),null}if(f=ma(Vn.current),iu(p)){L=p.stateNode,C=p.type;var V=p.memoizedProps;switch(L[Wn]=p,L[bo]=V,f=(p.mode&1)!==0,C){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(C,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(C){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,p.updateQueue=L,L!==null&&(p.flags|=4)}else{Q=O.nodeType===9?O:O.ownerDocument,f==="http://www.w3.org/1999/xhtml"&&(f=ge(C)),f==="http://www.w3.org/1999/xhtml"?C==="script"?(f=Q.createElement("div"),f.innerHTML="<script><\/script>",f=f.removeChild(f.firstChild)):typeof L.is=="string"?f=Q.createElement(C,{is:L.is}):(f=Q.createElement(C),C==="select"&&(Q=f,L.multiple?Q.multiple=!0:L.size&&(Q.size=L.size))):f=Q.createElementNS(f,C),f[Wn]=p,f[bo]=L,Ty(f,p,!1,!1),p.stateNode=f;e:{switch(Q=pe(C,L),C){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(C,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&&Fe(f,fe)):V==="children"?typeof fe=="string"?(C!=="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(C){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(C){case"button":case"input":case"select":case"textarea":L=!!L.autoFocus;break e;case"img":L=!0;break e;default:L=!1}}L&&(p.flags|=4)}p.ref!==null&&(p.flags|=512,p.flags|=2097152)}return Br(p),null;case 6:if(f&&p.stateNode!=null)Ly(f,p,f.memoizedProps,L);else{if(typeof L!="string"&&p.stateNode===null)throw Error(r(166));if(C=ma(Eo.current),ma(Vn.current),iu(p)){if(L=p.stateNode,C=p.memoizedProps,L[Wn]=p,(V=L.nodeValue!==C)&&(f=fn,f!==null))switch(f.tag){case 3:Kl(L.nodeValue,C,(f.mode&1)!==0);break;case 5:f.memoizedProps.suppressHydrationWarning!==!0&&Kl(L.nodeValue,C,(f.mode&1)!==0)}V&&(p.flags|=4)}else L=(C.nodeType===9?C:C.ownerDocument).createTextNode(L),L[Wn]=p,p.stateNode=L}return Br(p),null;case 13:if(Yt(tr),L=p.memoizedState,f===null||f.memoizedState!==null&&f.memoizedState.dehydrated!==null){if(Zt&&dn!==null&&(p.mode&1)!==0&&(p.flags&128)===0)Am(),as(),p.flags|=98560,V=!1;else if(V=iu(p),L!==null&&L.dehydrated!==null){if(f===null){if(!V)throw Error(r(318));if(V=p.memoizedState,V=V!==null?V.dehydrated:null,!V)throw Error(r(317));V[Wn]=p}else as(),(p.flags&128)===0&&(p.memoizedState=null),p.flags|=4;Br(p),V=!1}else Mn!==null&&(Of(Mn),Mn=null),V=!0;if(!V)return p.flags&65536?p:null}return(p.flags&128)!==0?(p.lanes=C,p):(L=L!==null,L!==(f!==null&&f.memoizedState!==null)&&L&&(p.child.flags|=8192,(p.mode&1)!==0&&(f===null||(tr.current&1)!==0?gr===0&&(gr=3):jf())),p.updateQueue!==null&&(p.flags|=4),Br(p),null);case 4:return us(),Ef(f,p),f===null&&yo(p.stateNode.containerInfo),Br(p),null;case 10:return Zh(p.type._context),Br(p),null;case 17:return Jr(p.type)&&Jl(),Br(p),null;case 19:if(Yt(tr),V=p.memoizedState,V===null)return Br(p),null;if(L=(p.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=p.child;f!==null;){if(Q=cu(f),Q!==null){for(p.flags|=128,No(V,!1),L=Q.updateQueue,L!==null&&(p.updateQueue=L,p.flags|=4),p.subtreeFlags=0,L=C,C=p.child;C!==null;)V=C,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}),C=C.sibling;return Vt(tr,tr.current&1|2),p.child}f=f.sibling}V.tail!==null&&zt()>ds&&(p.flags|=128,L=!0,No(V,!1),p.lanes=4194304)}else{if(!L)if(f=cu(Q),f!==null){if(p.flags|=128,L=!0,C=f.updateQueue,C!==null&&(p.updateQueue=C,p.flags|=4),No(V,!0),V.tail===null&&V.tailMode==="hidden"&&!Q.alternate&&!Zt)return Br(p),null}else 2*zt()-V.renderingStartTime>ds&&C!==1073741824&&(p.flags|=128,L=!0,No(V,!1),p.lanes=4194304);V.isBackwards?(Q.sibling=p.child,p.child=Q):(C=V.last,C!==null?C.sibling=Q:p.child=Q,V.last=Q)}return V.tail!==null?(p=V.tail,V.rendering=p,V.tail=p.sibling,V.renderingStartTime=zt(),p.sibling=null,C=tr.current,Vt(tr,L?C&1|2:C&1),p):(Br(p),null);case 22:case 23:return Ff(),L=p.memoizedState!==null,f!==null&&f.memoizedState!==null!==L&&(p.flags|=8192),L&&(p.mode&1)!==0?(pn&1073741824)!==0&&(Br(p),p.subtreeFlags&6&&(p.flags|=8192)):Br(p),null;case 24:return null;case 25:return null}throw Error(r(156,p.tag))}function NC(f,p){switch(Gh(p),p.tag){case 1:return Jr(p.type)&&Jl(),f=p.flags,f&65536?(p.flags=f&-65537|128,p):null;case 3:return us(),Yt(Zr),Yt(Ir),sf(),f=p.flags,(f&65536)!==0&&(f&128)===0?(p.flags=f&-65537|128,p):null;case 5:return nf(p),null;case 13:if(Yt(tr),f=p.memoizedState,f!==null&&f.dehydrated!==null){if(p.alternate===null)throw Error(r(340));as()}return f=p.flags,f&65536?(p.flags=f&-65537|128,p):null;case 19:return Yt(tr),null;case 4:return us(),null;case 10:return Zh(p.type._context),null;case 22:case 23:return Ff(),null;case 24:return null;default:return null}}var xu=!1,Fr=!1,DC=typeof WeakSet=="function"?WeakSet:Set,et=null;function hs(f,p){var C=f.ref;if(C!==null)if(typeof C=="function")try{C(null)}catch(L){ar(f,p,L)}else C.current=null}function kf(f,p,C){try{C()}catch(L){ar(f,p,L)}}var Ny=!1;function AC(f,p){if(Bh=jl,f=lm(),Lh(f)){if("selectionStart"in f)var C={start:f.selectionStart,end:f.selectionEnd};else e:{C=(C=f.ownerDocument)&&C.defaultView||window;var L=C.getSelection&&C.getSelection();if(L&&L.rangeCount!==0){C=L.anchorNode;var O=L.anchorOffset,V=L.focusNode;L=L.focusOffset;try{C.nodeType,V.nodeType}catch{C=null;break e}var Q=0,le=-1,fe=-1,we=0,Oe=0,Ue=f,Ie=null;t:for(;;){for(var Je;Ue!==C||O!==0&&Ue.nodeType!==3||(le=Q+O),Ue!==V||L!==0&&Ue.nodeType!==3||(fe=Q+L),Ue.nodeType===3&&(Q+=Ue.nodeValue.length),(Je=Ue.firstChild)!==null;)Ie=Ue,Ue=Je;for(;;){if(Ue===f)break t;if(Ie===C&&++we===O&&(le=Q),Ie===V&&++Oe===L&&(fe=Q),(Je=Ue.nextSibling)!==null)break;Ue=Ie,Ie=Ue.parentNode}Ue=Je}C=le===-1||fe===-1?null:{start:le,end:fe}}else C=null}C=C||{start:0,end:0}}else C=null;for(Fh={focusedElem:f,selectionRange:C},jl=!1,et=p;et!==null;)if(p=et,f=p.child,(p.subtreeFlags&1028)!==0&&f!==null)f.return=p,et=f;else for(;et!==null;){p=et;try{var nt=p.alternate;if((p.flags&1024)!==0)switch(p.tag){case 0:case 11:case 15:break;case 1:if(nt!==null){var at=nt.memoizedProps,or=nt.memoizedState,ye=p.stateNode,ve=ye.getSnapshotBeforeUpdate(p.elementType===p.type?at:Pn(p.type,at),or);ye.__reactInternalSnapshotBeforeUpdate=ve}break;case 3:var xe=p.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(p,p.return,$e)}if(f=p.sibling,f!==null){f.return=p.return,et=f;break}et=p.return}return nt=Ny,Ny=!1,nt}function Do(f,p,C){var L=p.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(p,C,V)}O=O.next}while(O!==L)}}function bu(f,p){if(p=p.updateQueue,p=p!==null?p.lastEffect:null,p!==null){var C=p=p.next;do{if((C.tag&f)===f){var L=C.create;C.destroy=L()}C=C.next}while(C!==p)}}function Tf(f){var p=f.ref;if(p!==null){var C=f.stateNode;switch(f.tag){case 5:f=C;break;default:f=C}typeof p=="function"?p(f):p.current=f}}function Dy(f){var p=f.alternate;p!==null&&(f.alternate=null,Dy(p)),f.child=null,f.deletions=null,f.sibling=null,f.tag===5&&(p=f.stateNode,p!==null&&(delete p[Wn],delete p[bo],delete p[Uh],delete p[pC],delete p[vC])),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,p,C){var L=f.tag;if(L===5||L===6)f=f.stateNode,p?C.nodeType===8?C.parentNode.insertBefore(f,p):C.insertBefore(f,p):(C.nodeType===8?(p=C.parentNode,p.insertBefore(f,C)):(p=C,p.appendChild(f)),C=C._reactRootContainer,C!=null||p.onclick!==null||(p.onclick=Ql));else if(L!==4&&(f=f.child,f!==null))for(Rf(f,p,C),f=f.sibling;f!==null;)Rf(f,p,C),f=f.sibling}function Lf(f,p,C){var L=f.tag;if(L===5||L===6)f=f.stateNode,p?C.insertBefore(f,p):C.appendChild(f);else if(L!==4&&(f=f.child,f!==null))for(Lf(f,p,C),f=f.sibling;f!==null;)Lf(f,p,C),f=f.sibling}var Rr=null,In=!1;function Pi(f,p,C){for(C=C.child;C!==null;)Py(f,p,C),C=C.sibling}function Py(f,p,C){if(rt&&typeof rt.onCommitFiberUnmount=="function")try{rt.onCommitFiberUnmount(Qt,C)}catch{}switch(C.tag){case 5:Fr||hs(C,p);case 6:var L=Rr,O=In;Rr=null,Pi(f,p,C),Rr=L,In=O,Rr!==null&&(In?(f=Rr,C=C.stateNode,f.nodeType===8?f.parentNode.removeChild(C):f.removeChild(C)):Rr.removeChild(C.stateNode));break;case 18:Rr!==null&&(In?(f=Rr,C=C.stateNode,f.nodeType===8?Hh(f.parentNode,C):f.nodeType===1&&Hh(f,C),lo(f)):Hh(Rr,C.stateNode));break;case 4:L=Rr,O=In,Rr=C.stateNode.containerInfo,In=!0,Pi(f,p,C),Rr=L,In=O;break;case 0:case 11:case 14:case 15:if(!Fr&&(L=C.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(C,p,Q),O=O.next}while(O!==L)}Pi(f,p,C);break;case 1:if(!Fr&&(hs(C,p),L=C.stateNode,typeof L.componentWillUnmount=="function"))try{L.props=C.memoizedProps,L.state=C.memoizedState,L.componentWillUnmount()}catch(le){ar(C,p,le)}Pi(f,p,C);break;case 21:Pi(f,p,C);break;case 22:C.mode&1?(Fr=(L=Fr)||C.memoizedState!==null,Pi(f,p,C),Fr=L):Pi(f,p,C);break;default:Pi(f,p,C)}}function Iy(f){var p=f.updateQueue;if(p!==null){f.updateQueue=null;var C=f.stateNode;C===null&&(C=f.stateNode=new DC),p.forEach(function(L){var O=HC.bind(null,f,L);C.has(L)||(C.add(L),L.then(O,O))})}}function On(f,p){var C=p.deletions;if(C!==null)for(var L=0;L<C.length;L++){var O=C[L];try{var V=f,Q=p,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,p,we)}}if(p.subtreeFlags&12854)for(p=p.child;p!==null;)Oy(p,f),p=p.sibling}function Oy(f,p){var C=f.alternate,L=f.flags;switch(f.tag){case 0:case 11:case 14:case 15:if(On(p,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(p,f),Gn(f),L&512&&C!==null&&hs(C,C.return);break;case 5:if(On(p,f),Gn(f),L&512&&C!==null&&hs(C,C.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=C!==null?C.memoizedProps:V,le=f.type,fe=f.updateQueue;if(f.updateQueue=null,fe!==null)try{le==="input"&&V.type==="radio"&&V.name!=null&&ze(O,V),pe(le,Q);var we=pe(le,V);for(Q=0;Q<fe.length;Q+=2){var Oe=fe[Q],Ue=fe[Q+1];Oe==="style"?ue(O,Ue):Oe==="dangerouslySetInnerHTML"?Fe(O,Ue):Oe==="children"?me(O,Ue):b(O,Oe,Ue,we)}switch(le){case"input":_e(O,V);break;case"textarea":We(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(p,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(p,f),Gn(f),L&4&&C!==null&&C.memoizedState.isDehydrated)try{lo(p.containerInfo)}catch(at){ar(f,f.return,at)}break;case 4:On(p,f),Gn(f);break;case 13:On(p,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=C!==null&&C.memoizedState!==null,f.mode&1?(Fr=(we=Fr)||Oe,On(p,f),Fr=we):On(p,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(Ue=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,C=Ie.return;try{p=L,nt.props=p.memoizedProps,nt.state=p.memoizedState,nt.componentWillUnmount()}catch(at){ar(L,C,at)}}break;case 5:hs(Ie,Ie.return);break;case 22:if(Ie.memoizedState!==null){jy(Ue);continue}}Je!==null?(Je.return=Ie,et=Je):jy(Ue)}Oe=Oe.sibling}e:for(Oe=null,Ue=f;;){if(Ue.tag===5){if(Oe===null){Oe=Ue;try{O=Ue.stateNode,we?(V=O.style,typeof V.setProperty=="function"?V.setProperty("display","none","important"):V.display="none"):(le=Ue.stateNode,fe=Ue.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(Ue.tag===6){if(Oe===null)try{Ue.stateNode.nodeValue=we?"":Ue.memoizedProps}catch(at){ar(f,f.return,at)}}else if((Ue.tag!==22&&Ue.tag!==23||Ue.memoizedState===null||Ue===f)&&Ue.child!==null){Ue.child.return=Ue,Ue=Ue.child;continue}if(Ue===f)break e;for(;Ue.sibling===null;){if(Ue.return===null||Ue.return===f)break e;Oe===Ue&&(Oe=null),Ue=Ue.return}Oe===Ue&&(Oe=null),Ue.sibling.return=Ue.return,Ue=Ue.sibling}}break;case 19:On(p,f),Gn(f),L&4&&Iy(f);break;case 21:break;default:On(p,f),Gn(f)}}function Gn(f){var p=f.flags;if(p&2){try{e:{for(var C=f.return;C!==null;){if(Ay(C)){var L=C;break e}C=C.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}p&4096&&(f.flags&=-4097)}function MC(f,p,C){et=f,By(f)}function By(f,p,C){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 p=et;if((p.flags&8772)!==0){var C=p.alternate;try{if((p.flags&8772)!==0)switch(p.tag){case 0:case 11:case 15:Fr||bu(5,p);break;case 1:var L=p.stateNode;if(p.flags&4&&!Fr)if(C===null)L.componentDidMount();else{var O=p.elementType===p.type?C.memoizedProps:Pn(p.type,C.memoizedProps);L.componentDidUpdate(O,C.memoizedState,L.__reactInternalSnapshotBeforeUpdate)}var V=p.updateQueue;V!==null&&jm(p,V,L);break;case 3:var Q=p.updateQueue;if(Q!==null){if(C=null,p.child!==null)switch(p.child.tag){case 5:C=p.child.stateNode;break;case 1:C=p.child.stateNode}jm(p,Q,C)}break;case 5:var le=p.stateNode;if(C===null&&p.flags&4){C=le;var fe=p.memoizedProps;switch(p.type){case"button":case"input":case"select":case"textarea":fe.autoFocus&&C.focus();break;case"img":fe.src&&(C.src=fe.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(p.memoizedState===null){var we=p.alternate;if(we!==null){var Oe=we.memoizedState;if(Oe!==null){var Ue=Oe.dehydrated;Ue!==null&&lo(Ue)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}Fr||p.flags&512&&Tf(p)}catch(Ie){ar(p,p.return,Ie)}}if(p===f){et=null;break}if(C=p.sibling,C!==null){C.return=p.return,et=C;break}et=p.return}}function jy(f){for(;et!==null;){var p=et;if(p===f){et=null;break}var C=p.sibling;if(C!==null){C.return=p.return,et=C;break}et=p.return}}function zy(f){for(;et!==null;){var p=et;try{switch(p.tag){case 0:case 11:case 15:var C=p.return;try{bu(4,p)}catch(fe){ar(p,C,fe)}break;case 1:var L=p.stateNode;if(typeof L.componentDidMount=="function"){var O=p.return;try{L.componentDidMount()}catch(fe){ar(p,O,fe)}}var V=p.return;try{Tf(p)}catch(fe){ar(p,V,fe)}break;case 5:var Q=p.return;try{Tf(p)}catch(fe){ar(p,Q,fe)}}}catch(fe){ar(p,p.return,fe)}if(p===f){et=null;break}var le=p.sibling;if(le!==null){le.return=p.return,et=le;break}et=p.return}}var PC=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:mC.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,p,C,L){if(50<Po)throw Po=0,Pf=null,Error(r(185));no(f,C,L),((Lt&2)===0||f!==_r)&&(f===_r&&((Lt&2)===0&&(_u|=C),gr===4&&Fi(f,Lr)),rn(f,L),C===1&&Lt===0&&(p.mode&1)===0&&(ds=zt()+500,tu&&Di()))}function rn(f,p){var C=f.callbackNode;m2(f,p);var L=Ol(f,f===_r?Lr:0);if(L===0)C!==null&&ca(C),f.callbackNode=null,f.callbackPriority=0;else if(p=L&-L,f.callbackPriority!==p){if(C!=null&&ca(C),p===1)f.tag===0?gC(Uy.bind(null,f)):Tm(Uy.bind(null,f)),fC(function(){(Lt&6)===0&&Di()}),C=null;else{switch(Pg(L)){case 1:C=un;break;case 4:C=ii;break;case 16:C=xn;break;case 536870912:C=wi;break;default:C=xn}C=Ky(C,Hy.bind(null,f))}f.callbackPriority=p,f.callbackNode=C}}function Hy(f,p){if(ku=-1,Tu=0,(Lt&6)!==0)throw Error(r(327));var C=f.callbackNode;if(ps()&&f.callbackNode!==C)return null;var L=Ol(f,f===_r?Lr:0);if(L===0)return null;if((L&30)!==0||(L&f.expiredLanes)!==0||p)p=Ru(f,L);else{p=L;var O=Lt;Lt|=2;var V=Vy();(_r!==f||Lr!==p)&&(fi=null,ds=zt()+500,wa(f,p));do try{BC();break}catch(le){Wy(f,le)}while(!0);Qh(),wu.current=V,Lt=O,hr!==null?p=0:(_r=null,Lr=0,p=gr)}if(p!==0){if(p===2&&(O=dh(f),O!==0&&(L=O,p=If(f,O))),p===1)throw C=Ao,wa(f,0),Fi(f,L),rn(f,zt()),C;if(p===6)Fi(f,L);else{if(O=f.current.alternate,(L&30)===0&&!IC(O)&&(p=Ru(f,L),p===2&&(V=dh(f),V!==0&&(L=V,p=If(f,V))),p===1))throw C=Ao,wa(f,0),Fi(f,L),rn(f,zt()),C;switch(f.finishedWork=O,f.finishedLanes=L,p){case 0:case 1:throw Error(r(345));case 2:_a(f,tn,fi);break;case 3:if(Fi(f,L),(L&130023424)===L&&(p=Af+500-zt(),10<p)){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),p);break}_a(f,tn,fi);break;case 4:if(Fi(f,L),(L&4194240)===L)break;for(p=f.eventTimes,O=-1;0<L;){var Q=31-er(L);V=1<<Q,Q=p[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*PC(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===C?Hy.bind(null,f):null}function If(f,p){var C=Mo;return f.current.memoizedState.isDehydrated&&(wa(f,p).flags|=256),f=Ru(f,p),f!==2&&(p=tn,tn=C,p!==null&&Of(p)),f}function Of(f){tn===null?tn=f:tn.push.apply(tn,f)}function IC(f){for(var p=f;;){if(p.flags&16384){var C=p.updateQueue;if(C!==null&&(C=C.stores,C!==null))for(var L=0;L<C.length;L++){var O=C[L],V=O.getSnapshot;O=O.value;try{if(!An(V(),O))return!1}catch{return!1}}}if(C=p.child,p.subtreeFlags&16384&&C!==null)C.return=p,p=C;else{if(p===f)break;for(;p.sibling===null;){if(p.return===null||p.return===f)return!0;p=p.return}p.sibling.return=p.return,p=p.sibling}}return!0}function Fi(f,p){for(p&=~Df,p&=~_u,f.suspendedLanes|=p,f.pingedLanes&=~p,f=f.expirationTimes;0<p;){var C=31-er(p),L=1<<C;f[C]=-1,p&=~L}}function Uy(f){if((Lt&6)!==0)throw Error(r(327));ps();var p=Ol(f,0);if((p&1)===0)return rn(f,zt()),null;var C=Ru(f,p);if(f.tag!==0&&C===2){var L=dh(f);L!==0&&(p=L,C=If(f,L))}if(C===1)throw C=Ao,wa(f,0),Fi(f,p),rn(f,zt()),C;if(C===6)throw Error(r(345));return f.finishedWork=f.current.alternate,f.finishedLanes=p,_a(f,tn,fi),rn(f,zt()),null}function Bf(f,p){var C=Lt;Lt|=1;try{return f(p)}finally{Lt=C,Lt===0&&(ds=zt()+500,tu&&Di())}}function ba(f){Oi!==null&&Oi.tag===0&&(Lt&6)===0&&ps();var p=Lt;Lt|=1;var C=Cn.transition,L=Ft;try{if(Cn.transition=null,Ft=1,f)return f()}finally{Ft=L,Cn.transition=C,Lt=p,(Lt&6)===0&&Di()}}function Ff(){pn=fs.current,Yt(fs)}function wa(f,p){f.finishedWork=null,f.finishedLanes=0;var C=f.timeoutHandle;if(C!==-1&&(f.timeoutHandle=-1,hC(C)),hr!==null)for(C=hr.return;C!==null;){var L=C;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()}C=C.return}if(_r=f,hr=f=ji(f.current,null),Lr=pn=p,gr=0,Ao=null,Df=_u=xa=0,tn=Mo=null,ga!==null){for(p=0;p<ga.length;p++)if(C=ga[p],L=C.interleaved,L!==null){C.interleaved=null;var O=L.next,V=C.pending;if(V!==null){var Q=V.next;V.next=O,L.next=Q}C.pending=L}ga=null}return f}function Wy(f,p){do{var C=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,C===null||C.return===null){gr=1,Ao=p,hr=null;break}e:{var V=f,Q=C.return,le=C,fe=p;if(p=Lr,le.flags|=32768,fe!==null&&typeof fe=="object"&&typeof fe.then=="function"){var we=fe,Oe=le,Ue=Oe.tag;if((Oe.mode&1)===0&&(Ue===0||Ue===11||Ue===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,p),Je.mode&1&&dy(V,we,p),p=Je,fe=we;var nt=p.updateQueue;if(nt===null){var at=new Set;at.add(fe),p.updateQueue=at}else nt.add(fe);break e}else{if((p&1)===0){dy(V,we,p),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,p),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,p&=-p,V.lanes|=p;var ye=hy(V,fe,p);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,p&=-p,V.lanes|=p;var $e=fy(V,le,p);Fm(V,$e);break e}}V=V.return}while(V!==null)}Gy(C)}catch(ot){p=ot,hr===C&&C!==null&&(hr=C=C.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,p){var C=Lt;Lt|=2;var L=Vy();(_r!==f||Lr!==p)&&(fi=null,wa(f,p));do try{OC();break}catch(O){Wy(f,O)}while(!0);if(Qh(),Lt=C,wu.current=L,hr!==null)throw Error(r(261));return _r=null,Lr=0,gr}function OC(){for(;hr!==null;)$y(hr)}function BC(){for(;hr!==null&&!ha();)$y(hr)}function $y(f){var p=Xy(f.alternate,f,pn);f.memoizedProps=f.pendingProps,p===null?Gy(f):hr=p,Nf.current=null}function Gy(f){var p=f;do{var C=p.alternate;if(f=p.return,(p.flags&32768)===0){if(C=LC(C,p,pn),C!==null){hr=C;return}}else{if(C=NC(C,p),C!==null){C.flags&=32767,hr=C;return}if(f!==null)f.flags|=32768,f.subtreeFlags=0,f.deletions=null;else{gr=6,hr=null;return}}if(p=p.sibling,p!==null){hr=p;return}hr=p=f}while(p!==null);gr===0&&(gr=5)}function _a(f,p,C){var L=Ft,O=Cn.transition;try{Cn.transition=null,Ft=1,FC(f,p,C,L)}finally{Cn.transition=O,Ft=L}return null}function FC(f,p,C,L){do ps();while(Oi!==null);if((Lt&6)!==0)throw Error(r(327));C=f.finishedWork;var O=f.finishedLanes;if(C===null)return null;if(f.finishedWork=null,f.finishedLanes=0,C===f.current)throw Error(r(177));f.callbackNode=null,f.callbackPriority=0;var V=C.lanes|C.childLanes;if(y2(f,V),f===_r&&(hr=_r=null,Lr=0),(C.subtreeFlags&2064)===0&&(C.flags&2064)===0||Cu||(Cu=!0,Ky(xn,function(){return ps(),null})),V=(C.flags&15990)!==0,(C.subtreeFlags&15990)!==0||V){V=Cn.transition,Cn.transition=null;var Q=Ft;Ft=1;var le=Lt;Lt|=4,Nf.current=null,AC(f,C),Oy(C,f),iC(Fh),jl=!!Bh,Fh=Bh=null,f.current=C,MC(C),$a(),Lt=le,Ft=Q,Cn.transition=V}else f.current=C;if(Cu&&(Cu=!1,Oi=f,Eu=O),V=f.pendingLanes,V===0&&(Ii=null),Et(C.stateNode),rn(f,zt()),p!==null)for(L=f.onRecoverableError,C=0;C<p.length;C++)O=p[C],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),p=Cn.transition,C=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 Ue=Oe.child;if(Ue!==null)Ue.return=Oe,et=Ue;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=C,Cn.transition=p}}return!1}function qy(f,p,C){p=cs(C,p),p=hy(f,p,1),f=Mi(f,p,1),p=Gr(),f!==null&&(no(f,1,p),rn(f,p))}function ar(f,p,C){if(f.tag===3)qy(f,f,C);else for(;p!==null;){if(p.tag===3){qy(p,f,C);break}else if(p.tag===1){var L=p.stateNode;if(typeof p.type.getDerivedStateFromError=="function"||typeof L.componentDidCatch=="function"&&(Ii===null||!Ii.has(L))){f=cs(C,f),f=fy(p,f,1),p=Mi(p,f,1),f=Gr(),p!==null&&(no(p,1,f),rn(p,f));break}}p=p.return}}function jC(f,p,C){var L=f.pingCache;L!==null&&L.delete(p),p=Gr(),f.pingedLanes|=f.suspendedLanes&C,_r===f&&(Lr&C)===C&&(gr===4||gr===3&&(Lr&130023424)===Lr&&500>zt()-Af?wa(f,0):Df|=C),rn(f,p)}function Yy(f,p){p===0&&((f.mode&1)===0?p=1:(p=Ga,Ga<<=1,(Ga&130023424)===0&&(Ga=4194304)));var C=Gr();f=ui(f,p),f!==null&&(no(f,p,C),rn(f,C))}function zC(f){var p=f.memoizedState,C=0;p!==null&&(C=p.retryLane),Yy(f,C)}function HC(f,p){var C=0;switch(f.tag){case 13:var L=f.stateNode,O=f.memoizedState;O!==null&&(C=O.retryLane);break;case 19:L=f.stateNode;break;default:throw Error(r(314))}L!==null&&L.delete(p),Yy(f,C)}var Xy;Xy=function(f,p,C){if(f!==null)if(f.memoizedProps!==p.pendingProps||Zr.current)en=!0;else{if((f.lanes&C)===0&&(p.flags&128)===0)return en=!1,RC(f,p,C);en=(f.flags&131072)!==0}else en=!1,Zt&&(p.flags&1048576)!==0&&Rm(p,nu,p.index);switch(p.lanes=0,p.tag){case 2:var L=p.type;yu(f,p),f=p.pendingProps;var O=rs(p,Ir.current);ls(p,C),O=uf(null,p,L,f,O,C);var V=cf();return p.flags|=1,typeof O=="object"&&O!==null&&typeof O.render=="function"&&O.$$typeof===void 0?(p.tag=1,p.memoizedState=null,p.updateQueue=null,Jr(L)?(V=!0,eu(p)):V=!1,p.memoizedState=O.state!==null&&O.state!==void 0?O.state:null,tf(p),O.updater=gu,p.stateNode=O,O._reactInternals=p,gf(p,L,f,C),p=bf(null,p,L,!0,V,C)):(p.tag=0,Zt&&V&&$h(p),$r(null,p,O,C),p=p.child),p;case 16:L=p.elementType;e:{switch(yu(f,p),f=p.pendingProps,O=L._init,L=O(L._payload),p.type=L,O=p.tag=WC(L),f=Pn(L,f),O){case 0:p=xf(null,p,L,f,C);break e;case 1:p=wy(null,p,L,f,C);break e;case 11:p=gy(null,p,L,f,C);break e;case 14:p=my(null,p,L,Pn(L.type,f),C);break e}throw Error(r(306,L,""))}return p;case 0:return L=p.type,O=p.pendingProps,O=p.elementType===L?O:Pn(L,O),xf(f,p,L,O,C);case 1:return L=p.type,O=p.pendingProps,O=p.elementType===L?O:Pn(L,O),wy(f,p,L,O,C);case 3:e:{if(_y(p),f===null)throw Error(r(387));L=p.pendingProps,V=p.memoizedState,O=V.element,Bm(f,p),uu(p,L,null,C);var Q=p.memoizedState;if(L=Q.element,V.isDehydrated)if(V={element:L,isDehydrated:!1,cache:Q.cache,pendingSuspenseBoundaries:Q.pendingSuspenseBoundaries,transitions:Q.transitions},p.updateQueue.baseState=V,p.memoizedState=V,p.flags&256){O=cs(Error(r(423)),p),p=Sy(f,p,L,C,O);break e}else if(L!==O){O=cs(Error(r(424)),p),p=Sy(f,p,L,C,O);break e}else for(dn=Ri(p.stateNode.containerInfo.firstChild),fn=p,Zt=!0,Mn=null,C=Im(p,null,L,C),p.child=C;C;)C.flags=C.flags&-3|4096,C=C.sibling;else{if(as(),L===O){p=hi(f,p,C);break e}$r(f,p,L,C)}p=p.child}return p;case 5:return zm(p),f===null&&Yh(p),L=p.type,O=p.pendingProps,V=f!==null?f.memoizedProps:null,Q=O.children,jh(L,O)?Q=null:V!==null&&jh(L,V)&&(p.flags|=32),by(f,p),$r(f,p,Q,C),p.child;case 6:return f===null&&Yh(p),null;case 13:return Cy(f,p,C);case 4:return rf(p,p.stateNode.containerInfo),L=p.pendingProps,f===null?p.child=ss(p,null,L,C):$r(f,p,L,C),p.child;case 11:return L=p.type,O=p.pendingProps,O=p.elementType===L?O:Pn(L,O),gy(f,p,L,O,C);case 7:return $r(f,p,p.pendingProps,C),p.child;case 8:return $r(f,p,p.pendingProps.children,C),p.child;case 12:return $r(f,p,p.pendingProps.children,C),p.child;case 10:e:{if(L=p.type._context,O=p.pendingProps,V=p.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){p=hi(f,p,C);break e}}else for(V=p.child,V!==null&&(V.return=p);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,C&-C),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|=C,fe=V.alternate,fe!==null&&(fe.lanes|=C),Jh(V.return,C,p),le.lanes|=C;break}fe=fe.next}}else if(V.tag===10)Q=V.type===p.type?null:V.child;else if(V.tag===18){if(Q=V.return,Q===null)throw Error(r(341));Q.lanes|=C,le=Q.alternate,le!==null&&(le.lanes|=C),Jh(Q,C,p),Q=V.sibling}else Q=V.child;if(Q!==null)Q.return=V;else for(Q=V;Q!==null;){if(Q===p){Q=null;break}if(V=Q.sibling,V!==null){V.return=Q.return,Q=V;break}Q=Q.return}V=Q}$r(f,p,O.children,C),p=p.child}return p;case 9:return O=p.type,L=p.pendingProps.children,ls(p,C),O=_n(O),L=L(O),p.flags|=1,$r(f,p,L,C),p.child;case 14:return L=p.type,O=Pn(L,p.pendingProps),O=Pn(L.type,O),my(f,p,L,O,C);case 15:return yy(f,p,p.type,p.pendingProps,C);case 17:return L=p.type,O=p.pendingProps,O=p.elementType===L?O:Pn(L,O),yu(f,p),p.tag=1,Jr(L)?(f=!0,eu(p)):f=!1,ls(p,C),uy(p,L,O),gf(p,L,O,C),bf(null,p,L,!0,f,C);case 19:return ky(f,p,C);case 22:return xy(f,p,C)}throw Error(r(156,p.tag))};function Ky(f,p){return Dn(f,p)}function UC(f,p,C,L){this.tag=f,this.key=C,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=p,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,p,C,L){return new UC(f,p,C,L)}function zf(f){return f=f.prototype,!(!f||!f.isReactComponent)}function WC(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,p){var C=f.alternate;return C===null?(C=En(f.tag,p,f.key,f.mode),C.elementType=f.elementType,C.type=f.type,C.stateNode=f.stateNode,C.alternate=f,f.alternate=C):(C.pendingProps=p,C.type=f.type,C.flags=0,C.subtreeFlags=0,C.deletions=null),C.flags=f.flags&14680064,C.childLanes=f.childLanes,C.lanes=f.lanes,C.child=f.child,C.memoizedProps=f.memoizedProps,C.memoizedState=f.memoizedState,C.updateQueue=f.updateQueue,p=f.dependencies,C.dependencies=p===null?null:{lanes:p.lanes,firstContext:p.firstContext},C.sibling=f.sibling,C.index=f.index,C.ref=f.ref,C}function Lu(f,p,C,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(C.children,O,V,p);case k:Q=8,O|=8;break;case N:return f=En(12,C,p,O|2),f.elementType=N,f.lanes=V,f;case j:return f=En(13,C,p,O),f.elementType=j,f.lanes=V,f;case D:return f=En(19,C,p,O),f.elementType=D,f.lanes=V,f;case W:return Nu(C,O,V,p);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 p=En(Q,C,p,O),p.elementType=f,p.type=L,p.lanes=V,p}function Sa(f,p,C,L){return f=En(7,f,L,p),f.lanes=C,f}function Nu(f,p,C,L){return f=En(22,f,L,p),f.elementType=W,f.lanes=C,f.stateNode={isHidden:!1},f}function Hf(f,p,C){return f=En(6,f,null,p),f.lanes=C,f}function Uf(f,p,C){return p=En(4,f.children!==null?f.children:[],f.key,p),p.lanes=C,p.stateNode={containerInfo:f.containerInfo,pendingChildren:null,implementation:f.implementation},p}function VC(f,p,C,L,O){this.tag=p,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,p,C,L,O,V,Q,le,fe){return f=new VC(f,p,C,le,fe),p===1?(p=1,V===!0&&(p|=8)):p=0,V=En(3,null,null,p),f.current=V,V.stateNode=f,V.memoizedState={element:L,isDehydrated:C,cache:null,transitions:null,pendingSuspenseBoundaries:null},tf(V),f}function $C(f,p,C){var L=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:E,key:L==null?null:""+L,children:f,containerInfo:p,implementation:C}}function Qy(f){if(!f)return Ni;f=f._reactInternals;e:{if(At(f)!==f||f.tag!==1)throw Error(r(170));var p=f;do{switch(p.tag){case 3:p=p.stateNode.context;break e;case 1:if(Jr(p.type)){p=p.stateNode.__reactInternalMemoizedMergedChildContext;break e}}p=p.return}while(p!==null);throw Error(r(171))}if(f.tag===1){var C=f.type;if(Jr(C))return Em(f,C,p)}return p}function Zy(f,p,C,L,O,V,Q,le,fe){return f=Wf(C,L,!0,f,O,V,Q,le,fe),f.context=Qy(null),C=f.current,L=Gr(),O=Bi(C),V=ci(L,O),V.callback=p??null,Mi(C,V,O),f.current.lanes=O,no(f,O,L),rn(f,L),f}function Du(f,p,C,L){var O=p.current,V=Gr(),Q=Bi(O);return C=Qy(C),p.context===null?p.context=C:p.pendingContext=C,p=ci(V,Q),p.payload={element:f},L=L===void 0?null:L,L!==null&&(p.callback=L),f=Mi(O,p,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,p){if(f=f.memoizedState,f!==null&&f.dehydrated!==null){var C=f.retryLane;f.retryLane=C!==0&&C<p?C:p}}function Vf(f,p){Jy(f,p),(f=f.alternate)&&Jy(f,p)}function GC(){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 p=this._internalRoot;if(p===null)throw Error(r(409));Du(f,p,null,null)},Mu.prototype.unmount=$f.prototype.unmount=function(){var f=this._internalRoot;if(f!==null){this._internalRoot=null;var p=f.containerInfo;ba(function(){Du(null,f,null,null)}),p[ai]=null}};function Mu(f){this._internalRoot=f}Mu.prototype.unstable_scheduleHydration=function(f){if(f){var p=Bg();f={blockedOn:null,target:f,priority:p};for(var C=0;C<Ei.length&&p!==0&&p<Ei[C].priority;C++);Ei.splice(C,0,f),C===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 qC(f,p,C,L,O){if(O){if(typeof L=="function"){var V=L;L=function(){var we=Au(Q);V.call(we)}}var Q=Zy(p,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(p,fe,C,L)}),fe}function Iu(f,p,C,L,O){var V=C._reactRootContainer;if(V){var Q=V;if(typeof O=="function"){var le=O;O=function(){var fe=Au(Q);le.call(fe)}}Du(p,Q,f,O)}else Q=qC(C,p,f,O,L);return Au(Q)}Ig=function(f){switch(f.tag){case 3:var p=f.stateNode;if(p.current.memoizedState.isDehydrated){var C=ro(p.pendingLanes);C!==0&&(vh(p,C|1),rn(p,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 p=ui(f,134217728);if(p!==null){var C=Gr();Bn(p,f,134217728,C)}Vf(f,134217728)}},Og=function(f){if(f.tag===13){var p=Bi(f),C=ui(f,p);if(C!==null){var L=Gr();Bn(C,f,p,L)}Vf(f,p)}},Bg=function(){return Ft},Fg=function(f,p){var C=Ft;try{return Ft=f,p()}finally{Ft=C}},Te=function(f,p,C){switch(p){case"input":if(_e(f,C),p=C.name,C.type==="radio"&&p!=null){for(C=f;C.parentNode;)C=C.parentNode;for(C=C.querySelectorAll("input[name="+JSON.stringify(""+p)+'][type="radio"]'),p=0;p<C.length;p++){var L=C[p];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":We(f,C);break;case"select":p=C.value,p!=null&&Me(f,!!C.multiple,p,!1)}},Ze=Bf,qe=ba;var YC={usingClientEntryPoint:!1,Events:[wo,es,Zl,Ge,it,Bf]},Io={findFiberByHostInstance:fa,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},XC={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||GC,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(XC),rt=Ou}catch{}}return nn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=YC,nn.createPortal=function(f,p){var C=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Gf(p))throw Error(r(200));return $C(f,p,null,C)},nn.createRoot=function(f,p){if(!Gf(f))throw Error(r(299));var C=!1,L="",O=e0;return p!=null&&(p.unstable_strictMode===!0&&(C=!0),p.identifierPrefix!==void 0&&(L=p.identifierPrefix),p.onRecoverableError!==void 0&&(O=p.onRecoverableError)),p=Wf(f,1,!1,null,null,C,!1,L,O),f[ai]=p.current,yo(f.nodeType===8?f.parentNode:f),new $f(p)},nn.findDOMNode=function(f){if(f==null)return null;if(f.nodeType===1)return f;var p=f._reactInternals;if(p===void 0)throw typeof f.render=="function"?Error(r(188)):(f=Object.keys(f).join(","),Error(r(268,f)));return f=Un(p),f=f===null?null:f.stateNode,f},nn.flushSync=function(f){return ba(f)},nn.hydrate=function(f,p,C){if(!Pu(p))throw Error(r(200));return Iu(null,f,p,!0,C)},nn.hydrateRoot=function(f,p,C){if(!Gf(f))throw Error(r(405));var L=C!=null&&C.hydratedSources||null,O=!1,V="",Q=e0;if(C!=null&&(C.unstable_strictMode===!0&&(O=!0),C.identifierPrefix!==void 0&&(V=C.identifierPrefix),C.onRecoverableError!==void 0&&(Q=C.onRecoverableError)),p=Zy(p,null,f,1,C??null,O,!1,V,Q),f[ai]=p.current,yo(f),L)for(f=0;f<L.length;f++)C=L[f],O=C._getVersion,O=O(C._source),p.mutableSourceEagerHydrationData==null?p.mutableSourceEagerHydrationData=[C,O]:p.mutableSourceEagerHydrationData.push(C,O);return new Mu(p)},nn.render=function(f,p,C){if(!Pu(p))throw Error(r(200));return Iu(null,f,p,!1,C)},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,p,C,L){if(!Pu(C))throw Error(r(200));if(f==null||f._reactInternals===void 0)throw Error(r(38));return Iu(f,p,C,!1,L)},nn.version="18.3.1-next-f1338f8080-20240426",nn}var c0;function aE(){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=iE(),Xf.exports}var h0;function sE(){if(h0)return Fu;h0=1;var t=aE();return Fu.createRoot=t.createRoot,Fu.hydrateRoot=t.hydrateRoot,Fu}var oE=sE();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 lE(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,h)=>{const c=typeof u=="function"?u(e):u;if(!Object.is(c,e)){const v=e;e=h??(typeof c!="object"||c===null)?c:Object.assign({},e,c),r.forEach(d=>d(e,v))}},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},uE=(t=>t?f0(t):f0),cE=t=>t;function hE(t,e=cE){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=uE(t),r=n=>hE(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,fE=new Set(["cliOutputDelta","heartbeat"]),Sc=$s(t=>({byRun:{},ingest:e=>{const r=typeof e.session=="string"?e.session:void 0;r!==void 0&&(fE.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()}]}})})),dE=[{value:"30d",label:"30d"},{value:"60d",label:"60d"},{value:"90d",label:"90d"}];function pE(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=>pE(i,e),[e]);return{range:e,setRange:r,filter:n}}const vE={fontFamily:"monospace"};function Uv({value:t,onChange:e}){return S.jsx("div",{role:"group","aria-label":"Time range",style:{display:"flex",gap:"4px"},children:dE.map(({value:r,label:n})=>S.jsx("button",{type:"button","aria-pressed":t===r,onClick:()=>e(r),style:{padding:"3px 8px",borderRadius:"5px",fontSize:"10px",fontWeight:600,...vE,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"]),gE=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},mE={pending:"rgba(230,237,243,0.18)",distributed:"#79c0ff",done:"#3fb950",rejected:"#f85149"},yE={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 xE(t){return t<.01?"<$0.01":`$${t.toFixed(2)}`}function bE(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 wE({runId:t,ord:e,prompt:r,sessionLbl:n,onApprove:i,onReject:s}){const[o,a]=ae.useState(""),[l,u]=ae.useState(!1),[h,c]=ae.useState(!1),v=ae.useCallback(async x=>{u(!0);try{await x()}catch{}finally{u(!1)}},[]),d=rw.awaitingHuman??nw;return S.jsxs("div",{style:{background:"#161c26",border:`1px solid ${d.borderColor}`,borderRadius:"10px",padding:"14px 16px"},children:[S.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"4px"},children:[S.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"7px"},children:[S.jsx("span",{style:{color:d.textColor,fontSize:"13px"},children:d.icon}),S.jsx("span",{style:{fontSize:"12px",fontWeight:600,color:d.textColor,...wt},children:d.label})]}),S.jsx("span",{style:{fontSize:"10px",color:"rgba(230,237,243,0.4)",...wt,flexShrink:0,marginLeft:"8px"},children:n})]}),S.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&&S.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}),h&&S.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}),S.jsxs("div",{style:{display:"flex",gap:"6px",flexWrap:"wrap"},children:[S.jsx("button",{type:"button",disabled:l,onClick:()=>void v(()=>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"}),S.jsx("button",{type:"button",disabled:l,onClick:()=>{h?o.trim()&&v(()=>i(t,o.trim())):c(!0)},style:{background:h&&o.trim()?"#ffda19":"rgba(255,218,25,0.12)",color:h&&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:h&&o.trim()?"Send steer":"Approve + steer"}),S.jsx("button",{type:"button",disabled:l,onClick:()=>void v(()=>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 _E({type:t,sessionId:e,sessionLbl:r,ord:n,detail:i}){const s=rw[t]??nw;return S.jsxs("div",{style:{background:s.badgeColor,border:`1px solid ${s.borderColor}`,borderRadius:"8px",padding:"8px 12px",display:"flex",alignItems:"flex-start",gap:"8px"},children:[S.jsx("span",{style:{color:s.textColor,fontSize:"12px",lineHeight:"18px",flexShrink:0},children:s.icon}),S.jsxs("div",{style:{flex:1,minWidth:0},children:[S.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:"8px"},children:[S.jsxs("span",{style:{fontSize:"11px",fontWeight:600,color:s.textColor,...wt},children:[s.label,typeof n=="number"?` · unit #${n}`:""]}),S.jsx("span",{style:{fontSize:"10px",color:"rgba(230,237,243,0.3)",...wt,flexShrink:0},children:e.slice(0,6)})]}),i&&S.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&&S.jsx("p",{style:{fontSize:"10px",color:"rgba(230,237,243,0.3)",...wt,margin:"2px 0 0"},children:r})]})]})}function SE({view:t,onSelect:e}){const{session:r,units:n}=t,i=sv(t),s=r.id,o=r.status==="awaiting_human";return S.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:[S.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)"}}),S.jsxs("div",{style:{flex:1,minWidth:0},children:[S.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"6px",gap:"8px"},children:[S.jsx("span",{style:{fontSize:"11px",fontWeight:600,color:"#e6edf3",...wt,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i}),S.jsxs("span",{style:{fontSize:"10px",color:"rgba(230,237,243,0.35)",...wt,flexShrink:0},children:[s.slice(0,6)," · Open chat →"]})]}),S.jsx("div",{style:{display:"flex",gap:"4px",flexWrap:"wrap"},children:n.length===0?S.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)":mE[a.status]??"rgba(230,237,243,0.18)",h=yE[a.status]===!0&&!l;return S.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:h?"pulse 1.5s ease-in-out infinite":"none"}},a.ord)})})]})]})}function CE({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),h=ae.useRef(null);ae.useEffect(()=>()=>{h.current&&clearTimeout(h.current)},[]);const c=ae.useCallback(async()=>{var d;const v=e.trim();if(!(!v||t.length===0)){o(!0);try{if(n==="__all__"){const w=(await Promise.allSettled(t.map(g=>lt.injectMessage(g.session.id,v,"all")))).filter(g=>g.status==="rejected").length;if(w>0)throw new Error(`${w} inject(s) failed`)}else await lt.injectMessage(n,v,"all");r(""),l(!0),h.current=setTimeout(()=>l(!1),2500),(d=u.current)==null||d.focus()}finally{o(!1)}}},[e,n,t]);return S.jsxs("div",{children:[S.jsx("p",{style:{...Ta,marginBottom:"10px"},children:"Send to agents"}),S.jsx("div",{style:{...Rs,padding:"14px 16px"},children:t.length===0?S.jsx("p",{style:{fontSize:"11px",color:"rgba(230,237,243,0.3)",...wt},children:"No active sessions"}):S.jsxs(S.Fragment,{children:[S.jsx("div",{style:{display:"flex",gap:"8px",marginBottom:"8px",flexWrap:"wrap"},children:S.jsxs("select",{value:n,onChange:v=>i(v.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:[S.jsx("option",{value:"__all__",children:"All active agents"}),t.map(v=>S.jsxs("option",{value:v.session.id,children:[ll(v.session.problem||v.session.id,30)," (",v.session.id.slice(0,6),")"]},v.session.id))]})}),S.jsx("textarea",{ref:u,value:e,onChange:v=>r(v.target.value),onKeyDown:v=>{v.key==="Enter"&&(v.ctrlKey||v.metaKey)&&c()},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"}}),S.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[S.jsx("button",{type:"button",disabled:s||!e.trim(),onClick:()=>void c(),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&&S.jsx("span",{style:{fontSize:"11px",color:"#3fb950",...wt},children:"✓ Injected"}),S.jsx("span",{style:{fontSize:"10px",color:"rgba(230,237,243,0.25)",...wt},children:"Ctrl+Enter"})]})]})})]})}function EE({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:h,filter:c}=Hv("30d"),v=ae.useMemo(()=>c(t),[t,c]),d=ae.useMemo(()=>v.filter(k=>ju.has(k.session.status)),[v]),x=ae.useMemo(()=>{let k=0,N=0,M=0,B=!1;for(const A of d){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,d]),w=ae.useMemo(()=>v.reduce((k,N)=>k+N.units.filter(M=>M.status==="distributed").length,0),[v]),g=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 d){const M=N.session.id,B=sv(N),j=(s[M]??[]).slice(-30);for(const D of j){if(D.type==="awaitingHuman"||!gE.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,d]),b=ae.useMemo(()=>Object.values(o).sort((k,N)=>N.receivedAt-k.receivedAt),[o]),_=ae.useMemo(()=>v.filter(k=>!k.session.workflow_id||k.session.workflow_id==="chat").slice().reverse(),[v]),R=ae.useMemo(()=>v.filter(k=>!!k.session.workflow_id&&k.session.workflow_id!=="chat"),[v]),E=ae.useMemo(()=>R.filter(k=>ju.has(k.session.status)),[R]),T=ae.useMemo(()=>v.filter(k=>k.session.status==="completed").slice(-5).reverse(),[v]);return S.jsxs("div",{style:{color:"#e6edf3",...wt},children:[S.jsx("style",{children:`
|
|
41
|
+
@keyframes pulse {
|
|
42
|
+
0%, 100% { opacity: 1; }
|
|
43
|
+
50% { opacity: 0.4; }
|
|
44
|
+
}
|
|
45
|
+
`}),S.jsxs("div",{style:{maxWidth:"1100px",margin:"0 auto",padding:"28px 32px"},children:[S.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"24px",gap:"16px",flexWrap:"wrap"},children:[S.jsxs("div",{children:[S.jsx("h1",{style:{fontSize:"20px",fontWeight:600,color:"#e6edf3",margin:0,...wt},children:"wicked-crew studio"}),S.jsx("p",{style:{fontSize:"11px",color:"rgba(230,237,243,0.38)",margin:"4px 0 0",...wt},children:"cross-session control"})]}),S.jsxs("div",{style:{display:"flex",gap:"20px",flexWrap:"wrap",alignItems:"center"},children:[S.jsx(Uv,{value:u,onChange:h}),S.jsx(zu,{label:"Active sessions",value:String(d.length),color:"#79c0ff"}),S.jsx(zu,{label:"Units in-flight",value:String(w),color:"#79c0ff"}),S.jsx(zu,{label:"Cost",value:x.totalCost!==null?xE(x.totalCost):"—",color:x.totalCost!==null?"#3fb950":"rgba(230,237,243,0.3)"}),S.jsx(zu,{label:"Tokens",value:x.totalTokens>0?bE(x.totalTokens):"—",color:x.totalTokens>0?"#e6edf3":"rgba(230,237,243,0.3)"})]})]}),b.length>0&&S.jsxs("div",{style:{marginBottom:"24px"},children:[S.jsx("p",{style:{...Ta,marginBottom:"10px"},children:"Gate inbox"}),S.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 S.jsx(wE,{runId:k.runId,ord:k.ord,prompt:k.prompt,sessionLbl:M,onApprove:g,onReject:m},`gate-${k.runId}-${k.ord??"x"}`)})})]}),S.jsxs("div",{style:{display:"grid",gridTemplateColumns:"2fr 1fr 1.5fr",gap:"16px",marginBottom:"28px",alignItems:"start"},children:[S.jsxs("div",{style:{...Rs,padding:"16px 20px"},children:[S.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"12px"},children:[S.jsx("p",{style:Ta,children:"Runs"}),S.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?S.jsx("p",{style:{fontSize:"11px",color:"rgba(230,237,243,0.3)",...wt,fontStyle:"italic"},children:"No work sessions yet"}):S.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=>S.jsx(SE,{view:k,onSelect:e},k.session.id))}),R.length>5&&S.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 →"})]}),S.jsxs("div",{style:{...Rs,padding:"16px 20px"},children:[S.jsx("p",{style:{...Ta,marginBottom:"12px"},children:"Campaigns"}),S.jsxs("div",{"data-testid":"campaign-dag-stub",style:{border:"1px dashed rgba(230,237,243,0.15)",borderRadius:"8px",padding:"12px",background:"#161c26"},children:[S.jsx("p",{style:{fontSize:"11px",fontWeight:600,color:"rgba(230,237,243,0.55)",...wt,margin:"0 0 4px"},children:"Campaign DAG"}),S.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)."})]})]}),S.jsxs("div",{style:{...Rs,padding:"16px 20px"},children:[S.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"12px"},children:[S.jsx("p",{style:Ta,children:"Chats"}),S.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?S.jsx("p",{style:{fontSize:"11px",color:"rgba(230,237,243,0.3)",...wt,fontStyle:"italic"},children:"No chats yet"}):S.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:_.slice(0,4).map(k=>S.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:[S.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)"}}),S.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&&S.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&&d.length>0&&S.jsxs("div",{style:{marginBottom:"28px"},children:[S.jsx("p",{style:{...Ta,marginBottom:"10px"},children:"Agent activity"}),S.jsxs("div",{style:{...Rs,padding:"14px",maxHeight:"220px",overflowY:"auto",display:"flex",flexDirection:"column",gap:"8px"},children:[y.slice(0,5).map(k=>S.jsx(_E,{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&&S.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&&S.jsxs("div",{style:{marginBottom:"28px"},children:[S.jsx("p",{style:{...Ta,marginBottom:"10px"},children:"Sessions review"}),S.jsx("div",{style:{...Rs,padding:"4px 0",display:"flex",flexDirection:"column"},children:T.map((k,N)=>S.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:[S.jsx("span",{style:{width:"7px",height:"7px",borderRadius:"50%",flexShrink:0,background:"#3fb950"}}),S.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)}),S.jsx("span",{style:{fontSize:"10px",color:"rgba(230,237,243,0.3)",...wt,flexShrink:0},children:k.session.id.slice(0,8)}),S.jsx("span",{style:{fontSize:"10px",color:"rgba(121,192,255,0.5)",...wt,flexShrink:0},children:"→"})]},k.session.id))})]}),S.jsx(CE,{activeRuns:d})]})]})}function zu({label:t,value:e,color:r}){return S.jsxs("div",{style:{textAlign:"right"},children:[S.jsx("p",{style:{fontSize:"10px",color:"rgba(230,237,243,0.38)",...wt,margin:0},children:t}),S.jsx("p",{style:{fontSize:"16px",fontWeight:600,color:r,...wt,margin:"2px 0 0"},children:e})]})}const kE=t=>["completed","failed","cancelled"].includes(t);function TE({runs:t,onSelect:e,navigate:r}){const[n,i]=ae.useState(""),{range:s,setRange:o,filter:a}=Hv("30d"),l=ae.useMemo(()=>t.filter(d=>!d.session.workflow_id||d.session.workflow_id==="chat"),[t]),u=ae.useMemo(()=>a(l),[l,a]),h=ae.useMemo(()=>u.filter(d=>!kE(d.session.status)),[u]),c=ae.useMemo(()=>{if(u.length===0)return"—";const x=u.reduce((w,g)=>w+g.units.length,0)/u.length;return x%1===0?String(x):x.toFixed(1)},[u]),v=ae.useMemo(()=>n?u.filter(d=>d.session.problem.toLowerCase().includes(n.toLowerCase())):u,[u,n]);return S.jsxs("div",{className:"flex flex-col gap-6",style:{color:"#e6edf3"},children:[S.jsxs("div",{className:"px-8 pt-8 pb-4 flex items-center justify-between gap-4",children:[S.jsx("h1",{className:"text-2xl font-semibold font-mono",children:"Chats"}),S.jsxs("div",{className:"flex items-center gap-3",children:[S.jsx(Uv,{value:s,onChange:o}),S.jsx("input",{type:"text",placeholder:"Search chats…",value:n,onChange:d=>i(d.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"}}),S.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"})]})]}),S.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(h.length),accent:"#79c0ff"},{label:"Avg Units",value:c,accent:"#a78bfa"}].map(d=>S.jsxs("div",{className:"rounded-2xl px-6 py-4",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.07)"},children:[S.jsx("p",{className:"text-xs font-mono uppercase tracking-widest",style:{color:"rgba(230,237,243,0.4)"},children:d.label}),S.jsx("p",{className:"text-3xl font-semibold mt-1",style:{color:d.accent??"#e6edf3"},children:d.value})]},d.label))}),S.jsx("div",{className:"px-8 pb-8 flex flex-col gap-2",children:v.length===0?S.jsxs("div",{className:"rounded-2xl p-10 text-center",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.07)"},children:[S.jsx("p",{className:"text-base font-mono font-semibold mb-3",children:"No chat sessions yet"}),S.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."}),S.jsx("p",{className:"mt-5",children:S.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"})})]}):v.map(d=>S.jsxs("button",{type:"button",onClick:()=>e(d.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:[S.jsx("p",{className:"text-sm font-mono truncate",children:d.session.problem}),S.jsxs("p",{className:"text-xs mt-1 font-mono",style:{color:"rgba(230,237,243,0.35)"},children:[d.session.id.slice(0,8)," · ",d.session.status]})]},d.session.id))})]})}function Ds(t){return`${(t*100).toFixed(1)}%`}function RE({coverage:t,threshold:e}){const r=t>=e;return S.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 LE({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 S.jsx("div",{className:"grid grid-cols-3 gap-2 sm:grid-cols-5",children:e.map(({label:r,value:n})=>S.jsxs("div",{className:"rounded p-2 text-center",style:{border:"1px solid rgba(230,237,243,0.07)",background:"#1b222e"},children:[S.jsx("p",{className:"text-[11px]",style:{color:"rgba(230,237,243,0.4)"},children:r}),S.jsx("p",{className:"text-sm font-semibold",style:{color:"#e6edf3"},children:n})]},r))})}function NE({apps:t}){return t.length===0?S.jsx("p",{className:"text-xs",style:{color:"rgba(230,237,243,0.4)"},children:"No per-app data."}):S.jsxs("table",{className:"w-full text-[11px]",children:[S.jsx("thead",{children:S.jsxs("tr",{className:"border-b text-left",style:{borderColor:"rgba(230,237,243,0.08)",color:"rgba(230,237,243,0.4)"},children:[S.jsx("th",{className:"py-1 pr-3 font-medium",children:"App"}),S.jsx("th",{className:"py-1 pr-3 font-medium text-right",children:"Behavior-bearing"}),S.jsx("th",{className:"py-1 pr-3 font-medium text-right",children:"Resolved"}),S.jsx("th",{className:"py-1 pr-3 font-medium text-right",children:"Risk"}),S.jsx("th",{className:"py-1 pr-3 font-medium text-right",children:"Unaccounted"}),S.jsx("th",{className:"py-1 font-medium text-right",children:"Coverage"})]})}),S.jsx("tbody",{children:t.map(e=>S.jsxs("tr",{className:"border-b",style:{borderColor:"rgba(230,237,243,0.06)"},children:[S.jsx("td",{className:"py-1 pr-3 font-mono",style:{color:"rgba(230,237,243,0.7)"},children:e.app}),S.jsx("td",{className:"py-1 pr-3 text-right",style:{color:"rgba(230,237,243,0.6)"},children:e.behavior_bearing}),S.jsx("td",{className:"py-1 pr-3 text-right",style:{color:"#3fb950"},children:e.resolved}),S.jsx("td",{className:"py-1 pr-3 text-right",style:{color:"#ffda19"},children:e.risk_flagged}),S.jsx("td",{className:"py-1 pr-3 text-right",style:{color:"#f85149"},children:e.unaccounted}),S.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 S.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 DE({nodes:t}){const[e,r]=ae.useState(""),[n,i]=ae.useState("file"),[s,o]=ae.useState("asc"),[a,l]=ae.useState(""),[u,h]=ae.useState(""),c=ae.useMemo(()=>[...new Set(t.map(g=>g.kind??"").filter(Boolean))].sort(),[t]),v=ae.useMemo(()=>[...new Set(t.map(g=>g.app??"").filter(Boolean))].sort(),[t]),d=ae.useCallback(g=>{g===n?o(m=>m==="asc"?"desc":"asc"):(i(g),o("asc"))},[n]),x=ae.useMemo(()=>{let g=t;if(e){const m=e.toLowerCase();g=g.filter(y=>(y.name??"").toLowerCase().includes(m)||(y.file??"").toLowerCase().includes(m)||(y.symbol_id??"").toLowerCase().includes(m))}return a&&(g=g.filter(m=>m.kind===a)),u&&(g=g.filter(m=>m.app===u)),[...g].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?S.jsx("p",{className:"text-xs",style:{color:"#3fb950"},children:"No unaccounted nodes — gate is satisfied."}):S.jsxs("div",{className:"flex flex-col gap-2",children:[S.jsxs("div",{className:"flex flex-wrap gap-2",children:[S.jsx("input",{type:"text","aria-label":"Search by name, file, or symbol id",placeholder:"Search name / file / id…",value:e,onChange:g=>r(g.target.value),className:"rounded px-2 py-1 text-[11px] w-48 focus:outline-none",style:w}),S.jsxs("select",{"aria-label":"Filter by kind",value:a,onChange:g=>l(g.target.value),className:"rounded px-2 py-1 text-[11px] focus:outline-none",style:w,children:[S.jsx("option",{value:"",children:"All kinds"}),c.map(g=>S.jsx("option",{value:g,children:g},g))]}),S.jsxs("select",{"aria-label":"Filter by app",value:u,onChange:g=>h(g.target.value),className:"rounded px-2 py-1 text-[11px] focus:outline-none",style:w,children:[S.jsx("option",{value:"",children:"All apps"}),v.map(g=>S.jsx("option",{value:g,children:g},g))]}),S.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":""]})]}),S.jsxs("table",{className:"w-full text-[11px]",children:[S.jsx("thead",{children:S.jsxs("tr",{className:"border-b",style:{borderColor:"rgba(230,237,243,0.08)"},children:[S.jsx("th",{className:"py-1 pr-3",children:S.jsx(Hu,{col:"name",active:n,dir:s,onSort:d,children:"Name"})}),S.jsx("th",{className:"py-1 pr-3",children:S.jsx(Hu,{col:"kind",active:n,dir:s,onSort:d,children:"Kind"})}),S.jsx("th",{className:"py-1 pr-3",children:S.jsx(Hu,{col:"app",active:n,dir:s,onSort:d,children:"App"})}),S.jsx("th",{className:"py-1",children:S.jsx(Hu,{col:"file",active:n,dir:s,onSort:d,children:"File"})})]})}),S.jsx("tbody",{children:x.map(g=>S.jsxs("tr",{className:"border-b",style:{borderColor:"rgba(230,237,243,0.06)"},children:[S.jsx("td",{className:"py-1 pr-3 font-mono",style:{color:"rgba(230,237,243,0.7)"},children:g.name??g.symbol_id}),S.jsx("td",{className:"py-1 pr-3",style:{color:"rgba(230,237,243,0.45)"},children:g.kind??"—"}),S.jsx("td",{className:"py-1 pr-3",style:{color:"rgba(230,237,243,0.45)"},children:g.app??"—"}),S.jsx("td",{className:"py-1",style:{color:"rgba(230,237,243,0.35)"},title:g.file,children:S.jsx("div",{className:"truncate max-w-xs",children:g.file??"—"})})]},g.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]),S.jsxs("div",{className:"flex flex-col gap-4",children:[S.jsxs("div",{className:"flex items-center justify-between",children:[S.jsx("h2",{className:"text-sm font-semibold",style:{color:"#e6edf3"},children:"Coverage gate"}),S.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&&S.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&&S.jsxs("p",{className:"text-xs",style:{color:"rgba(230,237,243,0.4)"},children:["No coverage data — run"," ",S.jsx("code",{className:"font-mono",style:{color:"rgba(230,237,243,0.6)"},children:"wicked-core rules ingest"})," ","to populate."]}),t&&S.jsxs(S.Fragment,{children:[S.jsxs("div",{className:"flex items-center gap-3",children:[S.jsx("span",{className:"text-2xl font-bold",style:{color:"#e6edf3"},children:Ds(t.coverage)}),S.jsx(RE,{coverage:t.coverage,threshold:t.resolve_threshold})]}),S.jsx(LE,{report:t}),t.per_app.length>0&&S.jsxs("section",{className:"flex flex-col gap-1",children:[S.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wider font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Per-app"}),S.jsx(NE,{apps:t.per_app})]}),S.jsxs("section",{className:"flex flex-col gap-2",children:[S.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,")"]}),S.jsx(DE,{nodes:t.unaccounted_nodes})]})]})]})}function AE(t){if(!t)return null;const r={active:"#3fb950",proposed:"#ffda19",deprecated:"#f85149"}[t]??"rgba(230,237,243,0.5)";return S.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 ME({id:t,req:e}){var i,s,o,a,l;const[r,n]=ae.useState(!1);return S.jsxs("div",{className:"rounded",style:{border:"1px solid rgba(230,237,243,0.07)"},children:[S.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:[S.jsx("span",{className:"mt-0.5 shrink-0 text-[10px]",style:{color:"rgba(230,237,243,0.25)"},children:r?"▾":"▸"}),S.jsxs("div",{className:"flex-1 min-w-0",children:[S.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[S.jsx("span",{className:"font-mono text-[10px]",style:{color:"rgba(230,237,243,0.35)"},children:t}),S.jsx("span",{className:"text-[11px] font-medium truncate",style:{color:"#e6edf3"},children:e.title}),AE(e.status),e.disposition&&S.jsx("span",{className:"text-[10px] italic",style:{color:"rgba(230,237,243,0.4)"},children:e.disposition})]}),!r&&e.description&&S.jsx("p",{className:"text-[10px] truncate mt-0.5",style:{color:"rgba(230,237,243,0.4)"},children:e.description})]}),S.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&&S.jsxs("div",{className:"px-4 pb-3 flex flex-col gap-2 text-[10px]",style:{background:"#0f1419"},children:[e.description&&S.jsx("p",{style:{color:"rgba(230,237,243,0.55)"},children:e.description}),(((o=e.business_rules)==null?void 0:o.length)??0)>0&&S.jsxs("div",{children:[S.jsx("p",{className:"font-semibold uppercase tracking-wider mb-1 font-mono",style:{color:"rgba(230,237,243,0.35)"},children:"Business rules"}),S.jsx("ul",{className:"flex flex-col gap-0.5",children:(e.business_rules??[]).map(u=>S.jsxs("li",{className:"flex items-start gap-1.5",children:[S.jsx("span",{className:"font-mono shrink-0",style:{color:"rgba(230,237,243,0.25)"},children:u.id}),S.jsx("span",{style:{color:"rgba(230,237,243,0.65)"},children:u.statement}),S.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&&S.jsxs("div",{children:[S.jsx("p",{className:"font-semibold uppercase tracking-wider mb-1 font-mono",style:{color:"rgba(230,237,243,0.35)"},children:"Validations"}),S.jsx("ul",{className:"flex flex-col gap-0.5",children:(e.validations??[]).map(u=>S.jsxs("li",{className:"flex items-start gap-1.5",children:[S.jsx("span",{className:"font-mono shrink-0",style:{color:"rgba(230,237,243,0.25)"},children:u.id}),S.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&&S.jsxs("div",{children:[S.jsx("p",{className:"font-semibold uppercase tracking-wider mb-1 font-mono",style:{color:"rgba(248,81,73,0.6)"},children:"Error paths"}),S.jsx("ul",{className:"flex flex-col gap-0.5",children:(e.error_paths??[]).map(u=>S.jsxs("li",{className:"flex items-start gap-1.5",children:[S.jsx("span",{className:"font-mono shrink-0",style:{color:"rgba(230,237,243,0.25)"},children:u.id}),S.jsx("span",{style:{color:"#f85149"},children:u.statement})]},u.id))})]})]})]})}function PE({name:t,domain:e}){const[r,n]=ae.useState(!0),i=Object.keys(e.requirements??{}),s=Object.keys(e.entities??{});return S.jsxs("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid rgba(230,237,243,0.08)"},children:[S.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:[S.jsx("span",{className:"text-[10px]",style:{color:"rgba(230,237,243,0.35)"},children:r?"▾":"▸"}),S.jsx("span",{className:"font-semibold text-[12px]",style:{color:"#e6edf3"},children:t}),S.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&&S.jsxs("span",{className:"ml-auto text-[10px] font-mono",style:{color:"rgba(230,237,243,0.25)"},children:["cluster ",e.cluster_id]})]}),r&&S.jsxs("div",{className:"p-3 flex flex-col gap-2",style:{background:"#161c26"},children:[e.description&&S.jsx("p",{className:"text-[10px] italic",style:{color:"rgba(230,237,243,0.4)"},children:e.description}),i.length>0&&S.jsx("div",{className:"flex flex-col gap-1",children:i.map(o=>S.jsx(ME,{id:o,req:e.requirements[o]},o))}),s.length>0&&S.jsxs("div",{children:[S.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider mb-1 font-mono",style:{color:"rgba(230,237,243,0.35)"},children:"Entities"}),S.jsx("div",{className:"flex flex-wrap gap-1",children:s.map(o=>{var a;return S.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 IE(){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:c}=await lt.getDomainGraph();e(c)}catch(c){s(c instanceof Error?c.message:String(c))}finally{n(!1)}},[]);if(ae.useEffect(()=>{l()},[l]),r)return S.jsx("p",{className:"text-xs",style:{color:"rgba(230,237,243,0.4)"},children:"Loading domain model…"});if(i)return S.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 S.jsxs("div",{className:"flex flex-col gap-2",children:[S.jsx("p",{className:"text-sm",style:{color:"rgba(230,237,243,0.5)"},children:"No domain model found."}),S.jsxs("p",{className:"text-[10px]",style:{color:"rgba(230,237,243,0.4)"},children:["Run"," ",S.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"," ",S.jsx("span",{className:"font-mono",style:{color:"rgba(230,237,243,0.5)"},children:".wicked-estate/requirements/requirements_graph.json"}),"."]})]});const u=o.toLowerCase(),h=Object.keys(t.domains??{}).filter(c=>{var d;if(!u)return!0;const v=t.domains[c];return c.toLowerCase().includes(u)||(d=v.description)!=null&&d.toLowerCase().includes(u)?!0:Object.entries(v.requirements??{}).some(([x,w])=>{var g,m;return x.toLowerCase().includes(u)||((g=w.title)==null?void 0:g.toLowerCase().includes(u))||((m=w.description)==null?void 0:m.toLowerCase().includes(u))})});return S.jsxs("div",{className:"flex flex-col gap-4",children:[S.jsxs("div",{className:"flex items-center gap-3",children:[S.jsx("h2",{className:"text-sm font-semibold",style:{color:"#e6edf3"},children:"Domain Model"}),S.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"]}),S.jsx("input",{"aria-label":"Search domains and requirements",type:"search",placeholder:"Search…",value:o,onChange:c=>a(c.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"}}),S.jsx("button",{type:"button",onClick:()=>void l(),className:"text-[10px] hover:underline",style:{color:"rgba(230,237,243,0.4)"},children:"Refresh"})]}),h.length===0?S.jsx("p",{className:"text-xs",style:{color:"rgba(230,237,243,0.4)"},children:"No domains match your search."}):S.jsx("div",{className:"flex flex-col gap-3",children:h.map(c=>S.jsx(PE,{name:c,domain:t.domains[c]},c))}),t.metadata.source&&S.jsxs("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.25)"},children:["Source: ",S.jsx("span",{children:t.metadata.source})]})]})}function OE({onSelect:t}){const e=Jn(n=>n.gates),r=Object.values(e);return r.length===0?S.jsx(S.Fragment,{}):S.jsx("div",{className:"fixed bottom-4 right-4 flex flex-col gap-2 z-50","data-testid":"gate-notification",children:r.map(n=>S.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:[S.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[S.jsx("span",{className:"w-1.5 h-1.5 rounded-full animate-pulse",style:{background:"#ffda19"}}),S.jsx("p",{className:"text-xs font-semibold",style:{color:"#ffda19"},children:"Run awaiting human"})]}),S.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&&S.jsx("p",{className:"mt-1 text-xs line-clamp-2",style:{color:"rgba(230,237,243,0.6)"},children:n.prompt}),S.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 BE(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 FE(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 jE(){return S.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:S.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 zE({navigate:t,collapsed:e=!1}){const r=oc(h=>h.notifications),n=oc(h=>h.markRead),i=oc(h=>h.markAllRead),[s,o]=ae.useState(!1),a=ae.useRef(null),l=r.filter(h=>!h.read).length;ae.useEffect(()=>{if(!s)return;function h(c){a.current&&!a.current.contains(c.target)&&o(!1)}return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]);function u(h,c){n(h),o(!1),t(`/runs/${encodeURIComponent(c)}`)}return S.jsxs("div",{ref:a,style:{position:"relative"},children:[S.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(h=>!h),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:[S.jsx(jE,{}),!e&&S.jsx("span",{style:{fontSize:"11px",fontFamily:"monospace",color:gn.faint},children:"Notifications"}),l>0&&S.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&&S.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:[S.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 14px 8px",borderBottom:"1px solid rgba(230,237,243,0.08)"},children:[S.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&&S.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?S.jsx("p",{style:{padding:"16px 14px",fontSize:"11px",fontFamily:"monospace",color:gn.faint,margin:0},children:"No notifications"}):S.jsx("ul",{style:{listStyle:"none",margin:0,padding:0},children:r.map(h=>S.jsx("li",{children:S.jsxs("button",{type:"button",role:"menuitem",onClick:()=>u(h.id,h.runId),className:"focus-visible:outline focus-visible:outline-2 focus-visible:outline-[#79c0ff]",style:{width:"100%",textAlign:"left",background:h.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:c=>{c.currentTarget.style.background=gn.hover},onMouseLeave:c=>{c.currentTarget.style.background=h.read?"transparent":"rgba(255,218,25,0.04)"},children:[S.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"3px"},children:[S.jsxs("span",{style:{fontSize:"10px",fontWeight:600,fontFamily:"monospace",color:v0(h.kind),display:"flex",alignItems:"center",gap:"4px"},children:[!h.read&&S.jsx("span",{style:{width:"5px",height:"5px",borderRadius:"50%",background:v0(h.kind),display:"inline-block",flexShrink:0}}),BE(h.kind)]}),S.jsx("span",{style:{fontSize:"9px",fontFamily:"monospace",color:"rgba(230,237,243,0.3)",whiteSpace:"nowrap",marginLeft:"8px"},children:FE(h.ts)})]}),S.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:h.message}),S.jsxs("span",{style:{fontSize:"10px",fontFamily:"monospace",color:gn.link},children:[h.runId.slice(0,8)," → Review"]})]})},h.id))})]})]})}function HE(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 S.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:[S.jsxs("div",{className:"flex items-center gap-2",children:[S.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}),S.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${l?"animate-pulse":""}`,style:{background:HE(n.status)}})]}),S.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 UE=[{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 WE({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]),S.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:UE.map(n=>S.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 VE({size:t=28,className:e=""}){return S.jsxs("svg",{width:t,height:t,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:[S.jsx("rect",{width:"32",height:"32",rx:"7",fill:"#ffda19"}),S.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 $E(){return S.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:S.jsx("path",{d:"M13 2 3 14h9l-1 8 10-12h-9l1-8z"})})}function GE(){return S.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:S.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 qE(){return S.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:S.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 YE(){return S.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5","aria-hidden":!0,children:[S.jsx("circle",{cx:"10",cy:"10",r:"7"}),S.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 S.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&&S.jsx("span",{children:e})]})}function rd({label:t,asLink:e,onClick:r,withSearch:n,searchActive:i,onToggleSearch:s}){const o=S.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-widest font-mono select-none",style:{color:e?lr.link:lr.muted},children:[t,e&&S.jsx("span",{className:"ml-1 opacity-70",children:"›"})]});return S.jsxs("div",{className:"flex items-center px-3 pt-3 pb-1",children:[e&&r?S.jsx("button",{type:"button",onClick:r,className:"transition-opacity hover:opacity-80",style:{background:"transparent"},children:o}):o,n&&S.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:S.jsx(YE,{})})]})}function XE(){const t=Wv(h=>h.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(h=>i(h)).catch(()=>o(!0)))},[e]),ae.useEffect(()=>{if(!e)return;function h(c){a.current&&!a.current.contains(c.target)&&r(!1)}return document.addEventListener("click",h),()=>document.removeEventListener("click",h)},[e]);const l=t==="connected"?"#3fb950":t==="connecting"?"#ffda19":"#f85149",u=t==="connected"?"Connected":t==="connecting"?"Connecting":"Disconnected";return S.jsxs("div",{ref:a,style:{position:"relative"},children:[S.jsxs("button",{type:"button",onClick:()=>r(h=>!h),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:[S.jsx("span",{style:{width:"7px",height:"7px",borderRadius:"50%",background:l,flexShrink:0,boxShadow:t==="connected"?`0 0 5px ${l}`:"none"}}),S.jsx("span",{style:{fontSize:"10px",fontFamily:"monospace",color:l,whiteSpace:"nowrap"},children:u}),S.jsx("span",{style:{fontSize:"9px",color:"rgba(230,237,243,0.35)",marginLeft:"1px"},children:"▾"})]}),e&&S.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:[S.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"}),S.jsx(Bo,{label:"WebSocket",ok:t==="connected",detail:u}),s?S.jsx(Bo,{label:"API server",ok:!1,detail:"unreachable"}):n?S.jsxs(S.Fragment,{children:[S.jsx(Bo,{label:"API server",ok:n.status==="ok",detail:n.status}),S.jsx(Bo,{label:"wicked-core",ok:!0,detail:n.version})]}):S.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 S.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"5px"},children:[S.jsx("span",{style:{width:"12px",fontSize:"11px",color:i,fontFamily:"monospace",flexShrink:0},children:n}),S.jsx("span",{style:{fontSize:"11px",color:"#e6edf3",fontFamily:"monospace",flex:1},children:t}),S.jsx("span",{style:{fontSize:"10px",color:"rgba(230,237,243,0.45)",fontFamily:"monospace"},children:r})]})}function KE({runs:t,selectedRunId:e,onSelectRun:r,navigate:n}){const[i,s]=ae.useState(!1),[o,a]=ae.useState(!1),[l,u]=ae.useState(!1),[h,c]=ae.useState(!1),[v,d]=ae.useState(""),[x,w]=ae.useState([]),g=!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=v.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 S.jsxs("div",{className:`flex flex-col shrink-0 transition-all duration-200 ${g?"w-[280px]":"w-14"}`,style:{background:lr.bg,borderRight:`1px solid ${lr.border}`},onMouseEnter:()=>{i&&a(!0)},onMouseLeave:()=>a(!1),children:[S.jsxs("div",{className:"flex items-center gap-2 px-4 pt-5 pb-3 shrink-0",children:[S.jsx("button",{type:"button",onClick:()=>n("/"),className:"shrink-0","aria-label":"Home",children:S.jsx(VE,{size:26})}),g&&S.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"}),S.jsx("button",{type:"button",onClick:()=>s(T=>!T),"aria-label":i?"Expand sidebar":"Collapse sidebar",className:`text-xs font-mono shrink-0 leading-none ${g?"ml-auto":""}`,style:{color:lr.faint},children:i?"»":"«"})]}),g&&S.jsx("div",{className:"px-4 pt-1 pb-3",children:S.jsx(XE,{})}),S.jsx("div",{className:g?"px-4 pb-2":"flex justify-center pb-2",children:S.jsx(zE,{navigate:n,collapsed:!g})}),S.jsxs("div",{className:`flex flex-col ${g?"px-5 pt-1 pb-1 gap-1":"px-2 items-center gap-2 mt-1"}`,children:[S.jsx(td,{icon:S.jsx($E,{}),label:"Do Work",testId:"new-run",onClick:()=>n("/runs/new"),collapsed:!g}),S.jsx(td,{icon:S.jsx(GE,{}),label:"New Chat",onClick:()=>n("/chat/new"),collapsed:!g}),S.jsx(td,{icon:S.jsx(qE,{}),label:"New Repository",onClick:()=>n("/repos/new"),collapsed:!g})]}),S.jsx("div",{className:"flex-1 overflow-y-auto flex flex-col min-h-0 mt-2",children:g?S.jsxs(S.Fragment,{children:[h&&S.jsx("div",{className:"px-4 pb-2",children:S.jsx("input",{type:"text",value:v,onChange:T=>d(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}})}),S.jsx(rd,{label:"Repositories",withSearch:!0,searchActive:h,onToggleSearch:()=>{c(T=>!T),h&&d("")}}),S.jsx(nd,{empty:"No repositories yet",viewAllPath:"/repos",navigate:n,children:_.slice(0,vs).map(T=>S.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:[S.jsx("div",{className:"flex items-center gap-2",children:S.jsx("span",{className:"flex-1 truncate text-xs leading-tight font-mono",style:{color:"rgba(230,237,243,0.7)"},children:T.name})}),S.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&&S.jsx(id,{onClick:()=>n("/repos")}),S.jsx(rd,{label:"Chats"}),S.jsx(nd,{empty:"No chats yet",viewAllPath:"/chats",navigate:n,children:R.slice(0,vs).map(T=>S.jsx($i,{view:T,selectedRunId:e,onSelect:r},T.session.id))}),R.length>vs&&S.jsx(id,{onClick:()=>n("/chats")}),S.jsx(rd,{label:"Work"}),S.jsx(nd,{empty:"No work yet",viewAllPath:"/work",navigate:n,children:E.slice(0,vs).map(T=>S.jsx($i,{view:T,selectedRunId:e,onSelect:r},T.session.id))}),E.length>vs&&S.jsx(id,{onClick:()=>n("/work")})]}):S.jsx("div",{className:"px-2 flex flex-col gap-0.5 mt-1",children:t.map(T=>S.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:S.jsx(QE,{status:T.session.status})},T.session.id))})}),S.jsx("div",{className:`px-2 pb-3 shrink-0 ${g?"":"flex flex-col items-center gap-1"}`,children:S.jsxs("div",{className:"relative",children:[S.jsxs("button",{type:"button",onClick:()=>u(T=>!T),onMouseDown:T=>T.stopPropagation(),"aria-label":"Settings",className:`rounded transition-colors ${g?"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:[S.jsx("span",{children:"⚙"}),g&&S.jsxs(S.Fragment,{children:[S.jsx("span",{children:"Settings"}),S.jsx("span",{className:"ml-auto text-[10px] font-mono",style:{color:"rgba(230,237,243,0.25)"},children:"v0.2.1"})]})]}),l&&S.jsx(WE,{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 S.jsx("div",{className:"px-2 flex flex-col gap-0.5",children:i.length===0?S.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 S.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 QE({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 S.jsx("span",{className:`w-2.5 h-2.5 rounded-full ${r?"animate-pulse":""}`,style:{background:e}})}const ZE={deny:"#f85149",allow_with_conditions:"#ffda19",allow:"#3fb950"},JE={high:"#f85149",medium:"#ffda19",low:"rgba(230,237,243,0.4)"},ek={id:"",kind:"output",applies_to:[],effect:"deny",trigger:{contains:""},obligations:[],criteria:"",severity:"high",rule:""};function tk({policy:t,onEdit:e}){return S.jsxs("tr",{className:"text-[11px]",style:{borderBottom:"1px solid rgba(230,237,243,0.06)"},children:[S.jsx("td",{className:"px-3 py-2 font-mono",style:{color:"rgba(230,237,243,0.7)"},children:t.id}),S.jsx("td",{className:"px-3 py-2",style:{color:"rgba(230,237,243,0.45)"},children:t.kind}),S.jsx("td",{className:"px-3 py-2",children:S.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:ZE[t.effect]??"rgba(230,237,243,0.5)"},children:t.effect})}),S.jsx("td",{className:"px-3 py-2 text-[11px] font-semibold",style:{color:JE[t.severity]??"rgba(230,237,243,0.5)"},children:t.severity}),S.jsx("td",{className:"px-3 py-2 truncate max-w-xs",style:{color:"rgba(230,237,243,0.5)"},children:t.rule}),S.jsx("td",{className:"px-3 py-2",children:S.jsx("button",{type:"button",onClick:()=>e(t),className:"text-[10px] hover:underline",style:{color:"#79c0ff"},children:"Edit"})})]})}function rk(){const[t,e]=ae.useState([]),[r,n]=ae.useState(!0),[i,s]=ae.useState(null),[o,a]=ae.useState(""),[l,u]=ae.useState("idle"),[h,c]=ae.useState(null),[v,d]=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??ek,null,2)),d(null),u("idle"),c(null)},g=y=>{a(y);try{JSON.parse(y),d(null)}catch(b){d(b instanceof Error?b.message:String(b))}},m=async()=>{if(v)return;let y;try{y=JSON.parse(o)}catch(b){d(b instanceof Error?b.message:String(b));return}u("saving"),c(null);try{await lt.upsertPolicy(y),u("ok"),await x()}catch(b){u("error"),c(b instanceof Error?b.message:String(b))}};return S.jsxs("div",{className:"flex flex-col gap-4",children:[S.jsxs("div",{className:"flex items-center gap-3",children:[S.jsx("h2",{className:"text-sm font-semibold",style:{color:"#e6edf3"},children:"Policies"}),S.jsx("button",{type:"button",onClick:()=>void x(),className:"text-[10px] hover:underline",style:{color:"rgba(230,237,243,0.4)"},children:"Refresh"}),S.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&&S.jsx("p",{className:"rounded px-2 py-1 text-xs",style:{background:"rgba(248,81,73,0.08)",color:"#f85149"},children:i}),r?S.jsx("p",{className:"text-xs",style:{color:"rgba(230,237,243,0.4)"},children:"Loading policies…"}):S.jsx("div",{className:"overflow-x-auto rounded",style:{border:"1px solid rgba(230,237,243,0.08)"},children:S.jsxs("table",{className:"w-full text-[11px]",children:[S.jsx("thead",{children:S.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:[S.jsx("th",{className:"px-3 py-2 text-left",children:"ID"}),S.jsx("th",{className:"px-3 py-2 text-left",children:"Kind"}),S.jsx("th",{className:"px-3 py-2 text-left",children:"Effect"}),S.jsx("th",{className:"px-3 py-2 text-left",children:"Severity"}),S.jsx("th",{className:"px-3 py-2 text-left",children:"Rule"}),S.jsx("th",{className:"px-3 py-2"})]})}),S.jsx("tbody",{children:t.length===0?S.jsx("tr",{children:S.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=>S.jsx(tk,{policy:y,onEdit:w},y.id))})]})}),o!==""&&S.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:[S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("span",{className:"text-[11px] font-semibold",style:{color:"#ffda19"},children:"Policy JSON"}),S.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"})]}),S.jsx("textarea",{"aria-label":"Policy JSON editor",value:o,onChange:y=>g(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)"}}),v&&S.jsx("p",{className:"text-[10px]",style:{color:"#f85149"},children:v}),S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("button",{type:"button",onClick:()=>void m(),disabled:!!v||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"&&S.jsx("span",{className:"text-[10px]",style:{color:"#3fb950"},children:"Saved."}),l==="error"&&S.jsx("span",{className:"text-[10px]",style:{color:"#f85149"},children:h})]})]})]})}const nk=new Set(["completed","cancelled","failed"]);function ik(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 S.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:[S.jsx("p",{className:"text-[10px] font-mono uppercase tracking-widest",style:{color:"rgba(230,237,243,0.4)"},children:t}),S.jsx("p",{className:"text-3xl font-mono font-bold",style:{color:"#e6edf3"},children:e}),r&&S.jsx("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.35)"},children:r})]})}function ak({onSelectRun:t,autoShowRegister:e,navigate:r}){const[n,i]=ae.useState([]),[s,o]=ae.useState([]),[a,l]=ae.useState(!0),[u,h]=ae.useState(null),[c,v]=ae.useState(""),[d,x]=ae.useState(0),[w,g]=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=>h(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){g(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{g(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=>!nk.has(Y.session.status)),re=c.trim()===""?n:n.filter(Y=>Y.name.toLowerCase().includes(c.trim().toLowerCase()));function ne(Y){return ee.filter(q=>q.session.repo_ref===Y).length}return S.jsxs("div",{className:"h-full overflow-y-auto",children:[S.jsxs("div",{className:"px-8 pt-8 pb-4",children:[S.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[S.jsx("h1",{className:"text-base font-bold font-mono flex-1",style:{color:"#e6edf3",letterSpacing:"-0.01em"},children:"Repositories"}),S.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:c,onChange:Y=>v(Y.target.value)}),S.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&&S.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:[S.jsx("div",{role:"group","aria-label":"Repository source",className:"flex gap-1",children:["local","remote"].map(Y=>S.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))}),S.jsx("input",{style:Uu,placeholder:"Repo name",value:T,onChange:Y=>{k(Y.target.value),z.current=!!Y.target.value.trim()}}),R==="local"?S.jsx("input",{style:Uu,placeholder:"Absolute path to git repo",value:N,onChange:Y=>{M(Y.target.value),P(Y.target.value)}}):S.jsxs(S.Fragment,{children:[S.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)}}),S.jsxs("div",{className:"flex flex-col gap-1",children:[S.jsx("label",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Clone to (optional)"}),S.jsx("input",{style:Uu,placeholder:`~/.wicked/repos/${T||"<name>"}`,value:j,onChange:Y=>D(Y.target.value)})]})]}),S.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&&S.jsx("p",{className:"text-[11px] font-mono",style:{color:"#f85149"},children:I}),S.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"})]})]}),S.jsxs("div",{className:"px-8 pb-10",children:[!a&&!u&&S.jsxs("div",{className:"grid grid-cols-3 gap-4 mb-6",children:[S.jsx(ad,{label:"Total Repos",value:n.length,hint:"registered with wicked-crew"}),S.jsx(ad,{label:"Active Runs",value:ee.length,hint:ee.length===1?"1 run in progress":`${ee.length} runs in progress`}),S.jsx(ad,{label:"Tracked",value:d,hint:"onboarded and graph-indexed"})]}),a?S.jsx("p",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Loading repositories…"}):u?S.jsx("p",{className:"text-xs font-mono",style:{color:"#f85149"},children:u}):n.length===0?S.jsx("div",{className:"flex flex-col items-center justify-center py-24 text-center",children:S.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:[S.jsx("p",{className:"text-2xl font-mono font-bold",style:{color:"rgba(230,237,243,0.15)"},children:"No repositories"}),S.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."}),S.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?S.jsxs("p",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.4)"},children:["No repos match “",c,"”."]}):S.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 S.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:[S.jsxs("div",{className:"flex items-start justify-between gap-2",children:[S.jsxs("div",{className:"flex-1 min-w-0",children:[S.jsx("p",{className:"text-sm font-bold font-mono truncate",style:{color:"#e6edf3"},children:Y.name}),S.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})]}),S.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[q>0&&S.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"]}),S.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})]})]}),S.jsx("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.3)"},children:ik(Y.registered_at)}),X&&S.jsx("p",{className:"text-[11px] font-mono",style:{color:"#f85149"},children:X}),S.jsxs("div",{className:"flex items-center justify-between mt-auto",onClick:J=>J.stopPropagation(),onKeyDown:J=>J.stopPropagation(),role:"presentation",children:[S.jsx("button",{type:"button",onClick:()=>r("/repo-detail/"+encodeURIComponent(Y.id)),className:"text-xs font-mono hover:underline",style:{color:"#79c0ff"},children:"View →"}),S.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 sk=new Set(["completed","failed","cancelled"]);function ok({repoId:t,onSelectRun:e,navigate:r,onOpenGraph:n}){const[i,s]=ae.useState(null),[o,a]=ae.useState([]),[l,u]=ae.useState(null),[h,c]=ae.useState(null),[v,d]=ae.useState(null),[x,w]=ae.useState(!0),[g,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),c(null),d(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||c(U)}).catch(()=>{}),lt.getRepoContributors(t).then(({contributors:U})=>{I||d(U)}).catch(()=>{}),()=>{I=!0}},[t]),x)return S.jsx("div",{className:"p-8 font-mono text-sm",style:{color:"rgba(230,237,243,0.4)"},children:"Loading…"});if(g)return S.jsx("div",{className:"p-8 font-mono text-sm",style:{color:"#f85149"},children:g});if(!i)return S.jsx("div",{className:"p-8 font-mono text-sm",style:{color:"#f85149"},children:"Repo not found."});const k=o.filter(I=>!sk.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 S.jsxs("div",{className:"flex flex-col gap-6 p-8",style:{color:"#e6edf3"},children:[S.jsxs("div",{className:"flex flex-col gap-3",children:[S.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"}),S.jsxs("div",{className:"flex items-start gap-4 flex-wrap",children:[S.jsxs("div",{className:"flex-1 min-w-0",children:[S.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[S.jsx("h1",{className:"text-2xl font-semibold font-mono",children:i.name}),S.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"}),S.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&&S.jsx("p",{className:"text-[11px] font-mono mt-1",style:{color:"#f85149"},children:E}),S.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)?S.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}):S.jsx("span",{className:"text-[11px] font-mono mt-0.5 block truncate",style:{color:"#79c0ff"},title:i.git_url,children:i.git_url}))]}),S.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})]})]}),S.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=>S.jsxs("div",{className:"rounded-2xl px-6 py-4",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.07)"},children:[S.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest font-mono",style:{color:"rgba(230,237,243,0.4)"},children:I.label}),S.jsx("p",{className:"text-3xl font-semibold mt-1",style:{color:I.accent??"#e6edf3"},children:I.value})]},I.label))}),k.length>0&&S.jsx(gs,{title:"Active Now",children:S.jsx("div",{className:"flex flex-col gap-1",children:k.map(I=>S.jsx($i,{view:I,selectedRunId:null,onSelect:e},I.session.id))})}),S.jsxs("div",{className:"grid gap-6 grid-cols-1 md:grid-cols-2",children:[S.jsxs("div",{className:"flex flex-col gap-6",children:[o.length>0&&S.jsxs(gs,{title:"Work & Chats",children:[S.jsx("div",{className:"flex flex-col gap-1",children:A.map(I=>S.jsx($i,{view:I,selectedRunId:null,onSelect:e},I.session.id))}),o.length>10&&S.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`})]}),S.jsx(gs,{title:"Code Hotspots",children:B.length===0?S.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."}):S.jsxs("div",{className:"flex flex-col gap-2",children:[B.map((I,U)=>S.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:[S.jsx("span",{className:"text-[10px] font-mono w-4 text-right shrink-0",style:{color:"rgba(230,237,243,0.3)"},children:U+1}),S.jsx("span",{className:"flex-1 text-xs font-mono truncate",style:{color:"rgba(230,237,243,0.75)"},title:I.file,children:I.file}),S.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"]}),S.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)),S.jsx("button",{type:"button",onClick:n,className:"mt-2 self-start text-xs font-mono hover:underline",style:{color:"#79c0ff"},children:"Open full graph →"})]})})]}),S.jsxs("div",{className:"flex flex-col gap-6",children:[S.jsx(gs,{title:"Code Graph",children:j?S.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=>S.jsxs("div",{className:"flex items-center justify-between",children:[S.jsx("span",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.5)"},children:I.label}),S.jsx("span",{className:"text-sm font-semibold font-mono",style:{color:"#e6edf3"},children:I.value.toLocaleString()})]},I.label)),S.jsx("button",{type:"button",onClick:n,className:"mt-2 self-start text-xs font-mono hover:underline",style:{color:"#79c0ff"},children:"Browse full graph →"})]}):S.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."})}),S.jsx(gs,{title:"Git History",children:h===null?S.jsx(lk,{count:6,widths:["w-14","w-16","flex-1","w-12"]}):h.length===0?S.jsx("p",{className:"text-sm font-mono italic",style:{color:"rgba(230,237,243,0.35)"},children:"No commits yet."}):S.jsx("div",{className:"flex flex-col gap-2",children:h.map(I=>S.jsxs("div",{className:"flex items-start gap-2 min-w-0",children:[i.git_url&&/^https:\/\//i.test(i.git_url)?S.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}):S.jsx("span",{className:"shrink-0 text-[10px] font-mono",style:{color:"#79c0ff",marginTop:"1px"},children:I.shortSha}),S.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}),S.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}),S.jsx("span",{className:"shrink-0 text-[9px] font-mono",style:{color:"rgba(230,237,243,0.3)"},children:I.date})]},I.sha))})}),S.jsx(gs,{title:"Contributors",children:v===null?S.jsx(uk,{count:4}):v.length===0?S.jsx("p",{className:"text-sm font-mono italic",style:{color:"rgba(230,237,243,0.35)"},children:"No contributors found."}):S.jsx("div",{className:"flex flex-col gap-2",children:v.map((I,U)=>{const W=I.name.split(" ").map(H=>H[0]??"").join("").slice(0,2).toUpperCase();return S.jsxs("div",{className:"flex items-center gap-2",children:[S.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}),S.jsx("span",{className:"flex-1 text-xs font-mono truncate",style:{color:"rgba(230,237,243,0.8)"},children:I.name}),S.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 S.jsx("span",{className:`inline-block rounded animate-pulse ${t}`,style:{background:aw}})}function lk({count:t,widths:e}){return S.jsx("div",{className:"flex flex-col gap-2.5",children:Array.from({length:t},(r,n)=>S.jsx("div",{className:"flex items-center gap-2 min-w-0",style:{opacity:Math.max(.15,1-n*.12)},children:e.map((i,s)=>S.jsx(ov,{className:`h-2.5 ${i}`},s))},n))})}function uk({count:t}){return S.jsx("div",{className:"flex flex-col gap-2.5",children:Array.from({length:t},(e,r)=>S.jsxs("div",{className:"flex items-center gap-2",style:{opacity:Math.max(.15,1-r*.18)},children:[S.jsx("span",{className:"shrink-0 w-6 h-6 rounded-full animate-pulse",style:{background:aw}}),S.jsx(ov,{className:"h-2.5 w-28"}),S.jsx(ov,{className:"h-2 w-14 ml-auto"})]},r))})}function gs({title:t,children:e}){return S.jsxs("div",{className:"rounded-2xl p-6",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.07)"},children:[S.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 ck(t){if(Array.isArray(t))return t}function hk(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 fk(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&&fk(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 dk(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function pk(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(h){u=!0,i=h}finally{try{if(!l&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw i}}return a}}function vk(){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 gk(){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 ck(t)||pk(t,e)||Vv(t,e)||vk()}function Cc(t){return hk(t)||dk(t)||Vv(t)||gk()}function mk(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=mk(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 yk=xr(""),lw=xr({}),xk=xr(function(){}),bk=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)==yk},nr=function(e){return e!=null&&xr(e)===xk},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},wk=function(e){return e!=null&&xr(e)===lw},Xe=function(e){return e!=null&&xr(e)===xr(1)&&!isNaN(e)},_k=function(e){return Xe(e)&&Math.floor(e)===e},Ec=function(e){if(bk!=="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"},Sk=function(e){return wl(e)==="event"},Qi=function(e){return e==null?!0:!!(e===""||e.match(/^\s+$/))},Ck=function(e){return typeof HTMLElement>"u"?!1:e instanceof HTMLElement},Ek=function(e){return Dt(e)&&Xe(e.x1)&&Xe(e.x2)&&Xe(e.y1)&&Xe(e.y2)},kk=function(e){return wk(e)&&nr(e.then)},Tk=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+)?))",Rk="rgb[a]?\\(("+yr+"[%]?)\\s*,\\s*("+yr+"[%]?)\\s*,\\s*("+yr+"[%]?)(?:\\s*,\\s*("+yr+"))?\\)",Lk="rgb[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="hsl[a]?\\((?:"+yr+")\\s*,\\s*(?:"+yr+"[%])\\s*,\\s*(?:"+yr+"[%])(?:\\s*,\\s*(?:"+yr+"))?\\)",Ak="\\#[0-9a-fA-F]{3}",Mk="\\#[0-9a-fA-F]{6}",fw=function(e,r){return e<r?-1:e>r?1:0},Pk=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},Ik=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]}},Ok=function(e){var r,n,i,s,o,a,l,u;function h(x,w,g){return g<0&&(g+=1),g>1&&(g-=1),g<1/6?x+(w-x)*6*g:g<1/2?w:g<2/3?x+(w-x)*(2/3-g)*6:x}var c=new RegExp("^"+Nk+"$").exec(e);if(c){if(n=parseInt(c[1]),n<0?n=(360- -1*n%360)%360:n>360&&(n=n%360),n/=360,i=parseFloat(c[2]),i<0||i>100||(i=i/100,s=parseFloat(c[3]),s<0||s>100)||(s=s/100,o=c[4],o!==void 0&&(o=parseFloat(o),o<0||o>1)))return;if(i===0)a=l=u=Math.round(s*255);else{var v=s<.5?s*(1+i):s+i-s*i,d=2*s-v;a=Math.round(255*h(d,v,n+1/3)),l=Math.round(255*h(d,v,n)),u=Math.round(255*h(d,v,n-1/3))}r=[a,l,u,o]}return r},Bk=function(e){var r,n=new RegExp("^"+Rk+"$").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},Fk=function(e){return jk[e.toLowerCase()]},dw=function(e){return(Ut(e)?e:null)||Fk(e)||Ik(e)||Bk(e)||Ok(e)},jk={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 zk(){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=zk(),e=typeof self=="object"&&self&&self.Object===Object&&self,r=t||e||Function("return this")();return ld=r,ld}var ud,_0;function Hk(){if(_0)return ud;_0=1;var t=Vc(),e=function(){return t.Date.now()};return ud=e,ud}var cd,S0;function Uk(){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 Wk(){if(C0)return hd;C0=1;var t=Uk(),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 Vk(){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 h=n.call(o);return u&&(a?o[i]=l:delete o[i]),h}return dd=s,dd}var pd,T0;function $k(){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=Vk(),r=$k(),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 Gk(){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=Gk(),r="[object Symbol]";function n(i){return typeof i=="symbol"||e(i)&&t(i)==r}return md=n,md}var yd,D0;function qk(){if(D0)return yd;D0=1;var t=Wk(),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 h=typeof u.valueOf=="function"?u.valueOf():u;u=e(h)?h+"":h}if(typeof u!="string")return u===0?u:+u;u=t(u);var c=s.test(u);return c||o.test(u)?a(u.slice(2),c?2:8):i.test(u)?n:+u}return yd=l,yd}var xd,A0;function Yk(){if(A0)return xd;A0=1;var t=Cl(),e=Hk(),r=qk(),n="Expected a function",i=Math.max,s=Math.min;function o(a,l,u){var h,c,v,d,x,w,g=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,v=y?i(r(u.maxWait)||0,l):v,b="trailing"in u?!!u.trailing:b);function _(j){var D=h,I=c;return h=c=void 0,g=j,d=a.apply(I,D),d}function R(j){return g=j,x=setTimeout(k,l),m?_(j):d}function E(j){var D=j-w,I=j-g,U=l-D;return y?s(U,v-I):U}function T(j){var D=j-w,I=j-g;return w===void 0||D>=l||D<0||y&&I>=v}function k(){var j=e();if(T(j))return N(j);x=setTimeout(k,E(j))}function N(j){return x=void 0,b&&h?_(j):(h=c=void 0,d)}function M(){x!==void 0&&clearTimeout(x),g=0,h=w=c=x=void 0}function B(){return x===void 0?d:N(e())}function A(){var j=e(),D=T(j);if(h=arguments,c=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)),d}return A.cancel=M,A.flush=B,A}return xd=o,xd}var Xk=Yk(),kl=Sl(Xk),bd=mr?mr.performance:null,mw=bd&&bd.now?function(){return bd.now()}:function(){return Date.now()},Kk=(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 Kk(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},Qk=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 Zk(arguments)},Zk=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 Jk(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 e3=function(e,r,n,i,s,o){return{x:(e-n)*s+n,y:(r-i)*o+i}};function t3(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=Jk(t.x,t.y,n,i,r),l=e3(a.x,a.y,n,i,s,o);return{x:l.x,y:l.y}}var P0=!0,r3=console.warn!=null,n3=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()&&(r3?console.warn(e):(console.log(e),n3&&console.trace()))},i3=function(e){return dt({},e)},Zn=function(e){return e==null?e:Ut(e)?e.slice():Dt(e)?i3(e):e},a3=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},s3={},Cw=function(){return s3},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)},o3=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},l3=(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:l3,u3="undefined",c3=(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))!==u3?Set:c3,$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 h=0,c=u.length;h<c;h++){var v=u[h];!v||v===""||s.classes.add(v)}this.createEmitter(),(n===void 0||n)&&this.restore();var d=r.style||r.css;d&&(Bt("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(d))},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=[],h=[],c={},v={},d={},x=0,w,g=this.byGroup(),m=g.nodes,y=g.edges,b=0;b<l.length;b++){var _=l[b],R=_.id();_.isNode()&&(u.unshift(_),e.bfs&&(d[R]=!0,h.push(_)),v[R]=0)}for(var E=function(){var j=e.bfs?u.shift():u.pop(),D=j.id();if(e.dfs){if(d[D])return 0;d[D]=!0,h.push(j)}var I=v[D],U=c[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&&!d[re]&&(ee=ee[0],u.push(ee),e.bfs&&(d[re]=!0,h.push(ee)),c[re]=$,v[re]=v[D]+1)}},T;u.length!==0&&(T=E(),!(T!==0&&T===1)););for(var k=a.collection(),N=0;N<h.length;N++){var M=h[N],B=c[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:{}},h3=lc.exports,B0;function f3(){return B0||(B0=1,(function(t,e){(function(){var r,n,i,s,o,a,l,u,h,c,v,d,x,w,g;i=Math.floor,c=Math.min,n=function(m,y){return m<y?-1:m>y?1:0},h=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,g(m,0,y)):_=b,_},u=function(m,y,b){var _;return b==null&&(b=n),_=m[0],m[0]=y,g(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],g(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(g(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),g(m,_,b)},v=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()},d=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&&(h(E,_,0,null,b),E.pop(),R=E[E.length-1]);return E}for(s(m,b),A=[],k=0,B=c(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},g=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=v,m.nsmallest=d;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(h3)})(lc)),lc.exports}var wd,F0;function d3(){return F0||(F0=1,wd=f3()),wd}var p3=d3(),Tl=Sl(p3),v3=Ar({root:null,weight:function(e){return 1},directed:!1}),g3={dijkstra:function(e){if(!Dt(e)){var r=arguments;e={root:r[0],weight:r[1],directed:r[2]}}var n=v3(e),i=n.root,s=n.weight,o=n.directed,a=this,l=s,u=ut(i)?this.filter(i)[0]:i[0],h={},c={},v={},d=this.byGroup(),x=d.nodes,w=d.edges;w.unmergeBy(function(I){return I.isLoop()});for(var g=function(U){return h[U.id()]},m=function(U,W){h[U.id()]=W,y.updateItem(U)},y=new Tl(function(I,U){return g(I)-g(U)}),b=0;b<x.length;b++){var _=x[b];h[_.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=g(E),k=E.id();if(v[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<g(B)&&(m(B,D),c[A]={node:E,edge:j.edge})}}return{distanceTo:function(U){var W=ut(U)?x.filter(U)[0]:U[0];return v[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);c[P];){var F=c[P];H.unshift(F.edge),H.unshift(F.node),z=F.node,P=z.id()}return a.spawn(H)}}}},m3={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 h=i.sort(function(b,_){return e(b)-e(_)}),c=0;c<h.length;c++){var v=h[c],d=v.source()[0],x=v.target()[0],w=l(d),g=l(x),m=o[w],y=o[g];w!==g&&(a.merge(v),m.merge(y),o.splice(g,1))}return a}},y3=Ar({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),x3={aStar:function(e){var r=this.cy(),n=y3(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(),h=s.id(),c={},v={},d={},x=new Tl(function(P,F){return v[P.id()]-v[F.id()]}),w=new Gs,g={},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),c[u]=0,v[u]=o(i);for(var T=0;x.size()>0;){if(R(),T++,_===h){for(var k=[],N=s,M=h,B=m[M];k.unshift(N),B!=null&&k.unshift(B),N=g[M],N!=null;)M=N.id(),B=m[M];return{found:!0,distance:c[_],path:this.spawn(k),steps:T}}d[_]=!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)&&!d[H]){var z=c[_]+l(D);if(!E(H)){c[H]=z,v[H]=z+o(W),y(W,H),g[H]=b,m[H]=D;continue}z<c[H]&&(c[H]=z,v[H]=z+o(W),g[H]=b,m[H]=D)}}}}return{found:!1,distance:void 0,path:void 0,steps:T}}},b3=Ar({weight:function(e){return 1},directed:!1}),w3={floydWarshall:function(e){for(var r=this.cy(),n=b3(e),i=n.weight,s=n.directed,o=i,a=this.byGroup(),l=a.nodes,u=a.edges,h=l.length,c=h*h,v=function($){return l.indexOf($)},d=function($){return l[$]},x=new Array(c),w=0;w<c;w++){var g=w%h,m=(w-g)/h;m===g?x[w]=0:x[w]=1/0}for(var y=new Array(c),b=new Array(c),_=0;_<u.length;_++){var R=u[_],E=R.source()[0],T=R.target()[0];if(E!==T){var k=v(E),N=v(T),M=k*h+N,B=o(R);if(x[M]>B&&(x[M]=B,y[M]=N,b[M]=R),!s){var A=N*h+k;!s&&x[A]>B&&(x[A]=B,y[A]=k,b[A]=R)}}}for(var j=0;j<h;j++)for(var D=0;D<h;D++)for(var I=D*h+j,U=0;U<h;U++){var W=D*h+U,H=j*h+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 v(z($))},F={distance:function($,ee){var re=P($),ne=P(ee);return x[re*h+ne]},path:function($,ee){var re=P($),ne=P(ee),Y=d(re);if(re===ne)return Y.collection();if(y[re*h+ne]==null)return r.collection();var q=r.collection(),K=re,X;for(q.merge(Y);re!==ne;)K=re,re=y[re*h+ne],X=b[K*h+re],q.merge(X),q.merge(d(re));return q}};return F}},_3=Ar({weight:function(e){return 1},directed:!1,root:null}),S3={bellmanFord:function(e){var r=this,n=_3(e),i=n.weight,s=n.directed,o=n.root,a=i,l=this,u=this.cy(),h=this.byGroup(),c=h.edges,v=h.nodes,d=v.length,x=new pi,w=!1,g=[];o=u.collection(o)[0],c.unmergeBy(function(_e){return _e.isLoop()});for(var m=c.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),We=De.edge,Ye=De.pred;if(Me.unshift(Pe[0]),Pe.same(Ne)&&Me.length>0)break;We!=null&&Me.unshift(We),Pe=Ye}return l.spawn(Me)},E=0;E<d;E++){var T=v[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 We=Me.dist+De;We<Pe.dist&&!Ee.same(Me.edge)&&(Pe.dist=We,Pe.pred=ke,Pe.edge=Ee,N=!0)},B=1;B<d;B++){N=!1;for(var A=0;A<m;A++){var j=c[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=c[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 ze=J.map(function(_e){return _e.id()}).join(",");z.indexOf(ze)===-1&&(g.push(l.spawn(J)),z.push(ze))}}else break}return{distanceTo:_,pathTo:R,hasNegativeWeightCycle:w,negativeWeightCycles:g}}},C3=Math.sqrt(2),E3=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,h=u.length-1;h>=0;h--){var c=u[h],v=c[1],d=c[2];(r[v]===a&&r[d]===l||r[v]===l&&r[d]===a)&&u.splice(h,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 g=0;g<r.length;g++)r[g]===l&&(r[g]=a);return u},_d=function(e,r,n,i){for(;n>i;){var s=Math.floor(Math.random()*r.length);r=E3(s,e,r),n--}return r},k3={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/C3);if(s<2){Jt("At least 2 nodes are required for Karger-Stein algorithm");return}for(var u=[],h=0;h<o;h++){var c=i[h];u.push([h,n.indexOf(c.source()),n.indexOf(c.target())])}for(var v=1/0,d=[],x=new Array(s),w=new Array(s),g=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,g);var E=_d(w,_,l,2),T=_d(g,R,l,2);E.length<=T.length&&E.length<v?(v=E.length,d=E,m(w,x)):T.length<=E.length&&T.length<v&&(v=T.length,d=T,m(g,x))}for(var k=this.spawn(d.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,T3=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]}},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.min(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=-1/0,s=r;s<n;s++){var o=e[s];isFinite(o)&&(i=Math.max(o,i))}return i},N3=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},D3=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(v,d){return v-d});var h=e.length,c=Math.floor(h/2);return h%2!==0?e[c+1+a]:(e[c-1+a]+e[c+a])/2},A3=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},M3=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)}},P3=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}}},I3=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},O3=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},B3=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)},F3=(Sd=Math.hypot)!==null&&Sd!==void 0?Sd:function(t,e){return Math.sqrt(t*t+e*e)};function j3(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=F3(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 h=u.length,c=[],v=0;v<h;v++){var d=u[v],x=u[(v+1)%h],w=n(x,d),g=o({x:w.y,y:-w.x});c.push(g)}for(var m=c.map(function(T,k){var N=r(u[k],i(T,e)),M=r(u[(k+1)%h],i(T,e));return{p1:N,p2:M}}),y=[],b=0;b<h;b++){var _=m[(b-1+h)%h],R=m[b],E=l(_.p1,_.p2,R.p1,R.p2);y.push(E)}return y}function z3(t,e,r,n,i,s){var o=X3(t,e,r,n,i),a=j3(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,h=s/2,c=o/2;u=Math.min(u,h,c);var v=u!==h,d=u!==c,x;if(v){var w=n-h+u-a,g=i-c-a,m=n+h-u+a,y=g;if(x=Yi(e,r,n,i,w,g,m,y,!1),x.length>0)return x}if(d){var b=n+h+a,_=i-c+u-a,R=b,E=i+c-u+a;if(x=Yi(e,r,n,i,b,_,R,E,!1),x.length>0)return x}if(v){var T=n-h+u-a,k=i+c+a,N=n+h-u+a,M=k;if(x=Yi(e,r,n,i,T,k,N,M,!1),x.length>0)return x}if(d){var B=n-h-a,A=i-c+u-a,j=B,D=i+c-u+a;if(x=Yi(e,r,n,i,B,A,j,D,!1),x.length>0)return x}var I;{var U=n-h+u,W=i-c+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+h-u,z=i-c+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+h-u,F=i+c-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-h+u,$=i+c-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[]},H3=function(e,r,n,i,s,o,a){var l=a,u=Math.min(n,s),h=Math.max(n,s),c=Math.min(i,o),v=Math.max(i,o);return u-l<=e&&e<=h+l&&c-l<=r&&r<=v+l},U3=function(e,r,n,i,s,o,a,l,u){var h={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<h.x1||e>h.x2||r<h.y1||r>h.y2)},W3=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]},V3=function(e,r,n,i,s){var o=1e-5;e===0&&(e=o),r/=e,n/=e,i/=e;var a,l,u,h,c,v,d,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,d=r/3,a>0){c=u+Math.sqrt(a),c=c<0?-Math.pow(-c,1/3):Math.pow(c,1/3),v=u-Math.sqrt(a),v=v<0?-Math.pow(-v,1/3):Math.pow(v,1/3),s[0]=-d+c+v,d+=(c+v)/2,s[4]=s[2]=-d,d=Math.sqrt(3)*(-v+c)/2,s[3]=d,s[5]=-d;return}if(s[5]=s[3]=0,a===0){x=u<0?-Math.pow(-u,1/3):Math.pow(u,1/3),s[0]=-d+2*x,s[4]=s[2]=-(x+d);return}l=-l,h=l*l*l,h=Math.acos(u/Math.sqrt(h)),x=2*Math.sqrt(l),s[0]=-d+x*Math.cos(h/3),s[2]=-d+x*Math.cos((h+2*Math.PI)/3),s[4]=-d+x*Math.cos((h+4*Math.PI)/3)},$3=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,h=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,c=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,v=1*n*s-n*n+n*e-s*e+i*o-i*i+i*r-o*r,d=[];V3(u,h,c,v,d);for(var x=1e-7,w=[],g=0;g<6;g+=2)Math.abs(d[g+1])<x&&d[g]>=0&&d[g]<=1&&w.push(d[g]);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},G3=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],h=a[0]*a[0]+a[1]*a[1],c=a[0]*l[0]+a[1]*l[1],v=c*c/u;return c<0?h:v>u?(e-s)*(e-s)+(r-o)*(r-o):h-v},sn=function(e,r,n){for(var i,s,o,a,l,u=0,h=0;h<n.length/2;h++)if(i=n[h*2],s=n[h*2+1],h+1<n.length/2?(o=n[(h+1)*2],a=n[(h+1)*2+1]):(o=n[(h+1-n.length/2)*2],a=n[(h+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 h=new Array(n.length),c;l[0]!=null?(c=Math.atan(l[1]/l[0]),l[0]<0?c=c+Math.PI/2:c=-c-Math.PI/2):c=l;for(var v=Math.cos(-c),d=Math.sin(-c),x=0;x<h.length/2;x++)h[x*2]=o/2*(n[x*2]*v-n[x*2+1]*d),h[x*2+1]=a/2*(n[x*2+1]*v+n[x*2]*d),h[x*2]+=i,h[x*2+1]+=s;var w;if(u>0){var g=Lc(h,-u);w=Rc(g)}else w=h;return sn(e,r,w)},q3=function(e,r,n,i,s,o,a,l){for(var u=new Array(n.length*2),h=0;h<l.length;h++){var c=l[h];u[h*4+0]=c.startX,u[h*4+1]=c.startY,u[h*4+2]=c.stopX,u[h*4+3]=c.stopY;var v=Math.pow(c.cx-e,2)+Math.pow(c.cy-r,2);if(v<=Math.pow(c.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,h,c=0;c<e.length/4;c++){n=e[c*4],i=e[c*4+1],s=e[c*4+2],o=e[c*4+3],c<e.length/4-1?(a=e[(c+1)*4],l=e[(c+1)*4+1],u=e[(c+1)*4+2],h=e[(c+1)*4+3]):(a=e[0],l=e[1],u=e[2],h=e[3]);var v=Yi(n,i,s,o,a,l,u,h,!0);r[c*2]=v[0],r[c*2+1]=v[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,h=-(o-i),c=Math.sqrt(u*u+h*h),v=u/c,d=h/c;n[l*4]=i+v*r,n[l*4+1]=s+d*r,n[l*4+2]=o+v*r,n[l*4+3]=a+d*r}return n},Y3=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),h=u-1;if(h<0)return[];var c=h/u;return[(n-e)*c+e,(i-r)*c+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],h=l[0]*l[0]+l[1]*l[1],c=2*(u[0]*l[0]+u[1]*l[1]),v=u[0]*u[0]+u[1]*u[1]-a*a,d=c*c-4*h*v;if(d<0)return[];var x=(-c+Math.sqrt(d))/(2*h),w=(-c-Math.sqrt(d))/(2*h),g=Math.min(x,w),m=Math.max(x,w),y=[];if(g>=0&&g<=1&&y.push(g),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 h=e-s,c=n-e,v=a-s,d=r-o,x=i-r,w=l-o,g=v*d-w*h,m=c*d-x*h,y=w*c-v*x;if(y!==0){var b=g/y,_=m/y,R=.001,E=0-R,T=1+R;return E<=b&&b<=T&&E<=_&&_<=T?[e+b*c,r+b*x]:u?[e+b*c,r+b*x]:[]}else return g===0||m===0?Cd(e,n,a)===a?[a,l]:Cd(e,n,s)===s?[s,o]:Cd(s,a,n)===n?[n,i]:[]:[]},X3=function(e,r,n,i,s){var o=[],a=i/2,l=s/2,u=r,h=n;o.push({x:u+a*e[0],y:h+l*e[1]});for(var c=1;c<e.length/2;c++)o.push({x:u+a*e[c*2],y:h+l*e[c*2+1]});return o},dl=function(e,r,n,i,s,o,a,l){var u=[],h,c=new Array(n.length),v=!0;o==null&&(v=!1);var d;if(v){for(var x=0;x<c.length/2;x++)c[x*2]=n[x*2]*o+i,c[x*2+1]=n[x*2+1]*a+s;if(l>0){var w=Lc(c,-l);d=Rc(w)}else d=c}else d=n;for(var g,m,y,b,_=0;_<d.length/2;_++)g=d[_*2],m=d[_*2+1],_<d.length/2-1?(y=d[(_+1)*2],b=d[(_+1)*2+1]):(y=d[0],b=d[1]),h=Yi(e,r,i,s,g,m,y,b),h.length!==0&&u.push(h[0],h[1]);return u},K3=function(e,r,n,i,s,o,a,l,u){var h=[],c,v=new Array(n.length*2);u.forEach(function(y,b){b===0?(v[v.length-2]=y.startX,v[v.length-1]=y.startY):(v[b*4-2]=y.startX,v[b*4-1]=y.startY),v[b*4]=y.stopX,v[b*4+1]=y.stopY,c=Zo(e,r,i,s,y.cx,y.cy,y.radius),c.length!==0&&h.push(c[0],c[1])});for(var d=0;d<v.length/4;d++)c=Yi(e,r,i,s,v[d*4],v[d*4+1],v[d*4+2],v[d*4+3],!1),c.length!==0&&h.push(c[0],c[1]);if(h.length>2){for(var x=[h[0],h[1]],w=Math.pow(x[0]-e,2)+Math.pow(x[1]-r,2),g=1;g<h.length/2;g++){var m=Math.pow(h[g*2]-e,2)+Math.pow(h[g*2+1]-r,2);m<=w&&(x[0]=h[g*2],x[1]=h[g*2+1],w=m)}return x}return h},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 h=2/(a-s),c=2/(l-o),v=0;v<i;v++)r=e[2*v]=e[2*v]*h,n=e[2*v+1]=e[2*v+1]*c,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 d=0;d<i;d++)n=e[2*d+1]=e[2*d+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},Q3=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(c){for(var v=[],d=0;d<c.length;d++){var x=c[d],w=c[(d+1)%c.length],g={x:w.x-x.x,y:w.y-x.y},m={x:-g.y,y:g.x},y=Math.sqrt(m.x*m.x+m.y*m.y);v.push({x:m.x/y,y:m.y/y})}return v}function n(c,v){var d=1/0,x=-1/0,w=on(c),g;try{for(w.s();!(g=w.n()).done;){var m=g.value,y=m.x*v.x+m.y*v.y;d=Math.min(d,y),x=Math.max(x,y)}}catch(b){w.e(b)}finally{w.f()}return{min:d,max:x}}function i(c,v){return!(c.max<v.min||v.max<c.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),h=n(e,l);if(!i(u,h))return!1}}catch(c){o.e(c)}finally{o.f()}return!0}var Z3=Ar({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),J3={pageRank:function(e){for(var r=Z3(e),n=r.dampingFactor,i=r.precision,s=r.iterations,o=r.weight,a=this._private.cy,l=this.byGroup(),u=l.nodes,h=l.edges,c=u.length,v=c*c,d=h.length,x=new Array(v),w=new Array(c),g=(1-n)/c,m=0;m<c;m++){for(var y=0;y<c;y++){var b=m*c+y;x[b]=0}w[m]=0}for(var _=0;_<d;_++){var R=h[_],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*c+k;x[B]+=M,w[k]+=M}}for(var A=1/c+g,j=0;j<c;j++)if(w[j]===0)for(var D=0;D<c;D++){var I=D*c+j;x[I]=A}else for(var U=0;U<c;U++){var W=U*c+j;x[W]=x[W]/w[j]+g}for(var H=new Array(c),z=new Array(c),P,F=0;F<c;F++)H[F]=1;for(var G=0;G<s;G++){for(var $=0;$<c;$++)z[$]=0;for(var ee=0;ee<c;ee++)for(var re=0;re<c;re++){var ne=ee*c+re;z[ee]+=x[ne]*H[re]}M3(z),P=H,H=z,z=P;for(var Y=0,q=0;q<c;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 h={},c={},v=0,d=0,x=0;x<i;x++){var w=n[x],g=w.id();e.root=w;var m=this.degreeCentrality(e);v<m.indegree&&(v=m.indegree),d<m.outdegree&&(d=m.outdegree),h[g]=m.indegree,c[g]=m.outdegree}return{indegree:function(b){return v==0?0:(ut(b)&&(b=r.filter(b)),h[b.id()]/v)},outdegree:function(b){return d===0?0:(ut(b)&&(b=r.filter(b)),c[b.id()]/d)}}}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 d=s.connectedEdges(),x=d.filter(function(E){return E.target().same(s)&&n.has(E)}),w=d.filter(function(E){return E.source().same(s)&&n.has(E)}),g=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(g,1-l)*Math.pow(y,l),outdegree:Math.pow(m,1-l)*Math.pow(b,l)}}else{for(var u=s.connectedEdges().intersection(n),h=u.length,c=0,v=0;v<u.length;v++)c+=o(u[v]);return{degree:Math.pow(h,1-l)*Math.pow(c,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(),h=this.floydWarshall({weight:i,directed:s}),c=0;c<u.length;c++){for(var v=0,d=u[c],x=0;x<u.length;x++)if(c!==x){var w=h.distance(d,u[x]);n?v+=1/w:v+=w}n||(v=1/v),l<v&&(l=v),a[d.id()]=v}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(),h=0;h<u.length;h++){var c=u[h];if(!c.same(n)){var v=a.distanceTo(c);o?l+=1/v:l+=v}}return o?l:1/l}};Bs.cc=Bs.closenessCentrality;Bs.ccn=Bs.closenessCentralityNormalised=Bs.closenessCentralityNormalized;var eT=Ar({weight:null,directed:!1}),hv={betweennessCentrality:function(e){for(var r=eT(e),n=r.directed,i=r.weight,s=i!=null,o=this.cy(),a=this.nodes(),l={},u={},h=0,c={set:function(b,_){u[b]=_,_>h&&(h=_)},get:function(b){return u[b]}},v=0;v<a.length;v++){var d=a[v],x=d.id();n?l[x]=d.outgoers().nodes():l[x]=d.openNeighborhood().nodes(),c.set(x,0)}for(var w=function(){for(var b=a[g].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[g].id()&&c.set(F,c.get(F)+z[F])}},g=0;g<a.length;g++)w();var m={betweenness:function(b){var _=o.collection(b).id();return c.get(_)},betweennessNormalized:function(b){if(h==0)return 0;var _=o.collection(b).id();return c.get(_)/h}};return m.betweennessNormalised=m.betweennessNormalized,m}};hv.bc=hv.betweennessCentrality;var tT=Ar({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(t){return 1}]}),rT=function(e){return tT(e)},nT=function(e,r){for(var n=0,i=0;i<r.length;i++)n+=r[i](e);return n},iT=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}},aT=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},sT=function(e,r,n){for(var i=e.slice(0),s=1;s<n;s++)e=aT(e,i,r);return e},oT=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},lT=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},uT=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},cT=function(e,r){for(var n=0;n<e.length;n++)if(!r[n]||e[n].id()!==r[n].id())return!1;return!0},hT=function(e){for(var r=0;r<e.length;r++)for(var n=0;n<e.length;n++)r!=n&&cT(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=rT(e),o={},a=0;a<r.length;a++)o[r[a].id()]=a;for(var l=r.length,u=l*l,h=new Array(u),c,v=0;v<u;v++)h[v]=0;for(var d=0;d<n.length;d++){var x=n[d],w=o[x.source().id()],g=o[x.target().id()],m=nT(x,s.attributes);h[w*l+g]+=m,h[g*l+w]+=m}iT(h,l,s.multFactor),Dw(h,l);for(var y=!0,b=0;y&&b<s.maxIterations;)y=!1,c=sT(h,l,s.expandFactor),h=oT(c,l,s.inflateFactor),lT(h,c,u,4)||(y=!0),b++;var _=uT(h,l,r,i);return _=hT(_),_},fT={markovClustering:W0,mcl:W0},dT=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)},pT=function(e){return Math.sqrt(e)},vT=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]:dT,a=i,l,u,h=0;h<e;h++)l=r(h),u=n(h),a=s(a,l,u);return o(a)},zs={euclidean:function(e,r,n){return e>=2?Fo(e,r,n,0,$0,pT):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,vT)}};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 gT=Ar({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),tg=function(e){return gT(e)},Nc=function(e,r,n,i,s){var o=s!=="kMedoids",a=o?function(c){return n[c]}:function(c){return i[c](n)},l=function(v){return i[v](r)},u=n,h=r;return qc(e,i.length,a,l,u,h)},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 h=0;h<r;h++){l=[];for(var c=0;c<i;c++)l[c]=Math.random()*(o[c]-s[c])+s[c];a[h]=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},mT=function(e,r,n){return Math.abs(r-e)<=n},yT=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},xT=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)];xT(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},bT=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,h=0;u&&h<s.maxIterations;){for(var c=0;c<n.length;c++)i=n[c],a[i.id()]=Mw(i,l,s.distance,s.attributes,"kMeans");u=!1;for(var v=0;v<s.k;v++){var d=Pw(v,n,a);if(d.length!==0){for(var x=s.attributes.length,w=l[v],g=new Array(x),m=new Array(x),y=0;y<x;y++){m[y]=0;for(var b=0;b<d.length;b++)i=d[b],m[y]+=s.attributes[y](i);g[y]=m[y]/d.length,mT(g[y],w[y],s.sensitivityThreshold)||(u=!0)}l[v]=g,o[v]=r.collection(d)}}h++}return o},wT=function(e){var r=this.cy(),n=this.nodes(),i=null,s=tg(e),o=new Array(s.k),a,l={},u,h=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 c=!0,v=0;c&&v<s.maxIterations;){for(var d=0;d<n.length;d++)i=n[d],l[i.id()]=Mw(i,a,s.distance,s.attributes,"kMedoids");c=!1;for(var x=0;x<a.length;x++){var w=Pw(x,n,l);if(w.length!==0){h[x]=q0(a[x],w,s.attributes);for(var g=0;g<w.length;g++)u=q0(w[g],w,s.attributes),u<h[x]&&(h[x]=u,a[x]=w[g],c=!0);o[x]=r.collection(w)}}v++}return o},_T=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 h=0;h<e.length;h++)for(var c=0;c<s.attributes.length;c++){o=0,a=0;for(var v=0;v<r.length;v++)o+=i[v][h]*s.attributes[c](r[v]),a+=i[v][h];e[h][c]=o/a}},ST=function(e,r,n,i,s){for(var o=0;o<e.length;o++)r[o]=e[o].slice();for(var a,l,u,h=2/(s.m-1),c=0;c<n.length;c++)for(var v=0;v<i.length;v++){a=0;for(var d=0;d<n.length;d++)l=Nc(s.distance,i[v],n[c],s.attributes,"cmeans"),u=Nc(s.distance,i[v],n[d],s.attributes,"cmeans"),a+=Math.pow(l/u,h);e[v][c]=1/a}},CT=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 h=0;h<r[0].length;h++)r[u][h]>a&&(a=r[u][h],l=h);s[l].push(e[u])}for(var c=0;c<s.length;c++)s[c]=i.collection(s[c]);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 h=0;h<n.length;h++)l[h]=new Array(i.k);a=new Array(n.length);for(var c=0;c<n.length;c++)a[c]=new Array(i.k);for(var v=0;v<n.length;v++){for(var d=0,x=0;x<i.k;x++)a[v][x]=Math.random(),d+=a[v][x];for(var w=0;w<i.k;w++)a[v][w]=a[v][w]/d}o=new Array(i.k);for(var g=0;g<i.k;g++)o[g]=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,_T(o,n,a,u,i),ST(a,l,o,n,i),yT(a,l,i.sensitivityThreshold)||(y=!0),b++;return s=CT(n,a,i,r),{clusters:s,degreeOfMembership:a}},ET={kMeans:bT,kMedoids:wT,fuzzyCMeans:Y0,fcm:Y0},kT=Ar({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),TT={single:"min",complete:"max"},RT=function(e){var r=kT(e),n=TT[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,h=function(N,M){return qc(s.distance,u.length,function(B){return u[B](N)},function(B){return u[B](M)},N,M)},c=0;c<e.length;c++){var v=e[c].key,d=n[v][i[v]];d<a&&(o=v,a=d)}if(s.mode==="threshold"&&a>=s.threshold||s.mode==="dendrogram"&&e.length===1)return!1;var x=r[o],w=r[i[o]],g;s.mode==="dendrogram"?g={left:x,right:w,key:x.key}:g={value:x.value.concat(w.value),key:x.key},e[x.index]=g,e.splice(w.index,1),r[x.key]=g;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=h(y.value,x.value):l=h(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=RT(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=[],h=[],c=0;c<n.length;c++){var v={value:i.mode==="dendrogram"?n[c]:[n[c]],key:c,index:c};a[c]=v,h[c]=v,l[c]=[],u[c]=0}for(var d=0;d<a.length;d++)for(var x=0;x<=d;x++){var w=void 0;i.mode==="dendrogram"?w=d===x?1/0:o(a[d].value,a[x].value):w=d===x?1/0:o(a[d].value[0],a[x].value[0]),l[d][x]=w,l[x][d]=w,w<l[d][u[d]]&&(u[d]=x)}for(var g=X0(a,h,l,u,i);g;)g=X0(a,h,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},LT={hierarchicalClustering:K0,hca:K0},NT=Ar({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),DT=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)),NT(e)},AT=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)},MT=function(e,r){var n=null;return r==="median"?n=D3(e):r==="mean"?n=N3(e):r==="min"?n=R3(e):r==="max"?n=L3(e):n=r,n},PT=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 h=0;h<n.length;h++)i[n[h]]=n[h];return i},IT=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,h=0;h<o.length;h++){for(var c=0,v=0;v<o.length;v++)c+=r[o[v]*e+o[h]];c>u&&(l=h,u=c)}n[s]=o[l]}return i=Q0(e,r,n),i},Z0=function(e){for(var r=this.cy(),n=this.nodes(),i=DT(e),s={},o=0;o<n.length;o++)s[n[o].id()]=o;var a,l,u,h,c,v;a=n.length,l=a*a,u=new Array(l);for(var d=0;d<l;d++)u[d]=-1/0;for(var x=0;x<a;x++)for(var w=0;w<a;w++)x!==w&&(u[x*a+w]=AT(i.distance,n[x],n[w],i.attributes));h=MT(u,i.preference);for(var g=0;g<a;g++)u[g*a+g]=h;c=new Array(l);for(var m=0;m<l;m++)c[m]=0;v=new Array(l);for(var y=0;y<l;y++)v[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]=c[M*a+I],D=v[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++)c[M*a+U]=(1-i.damping)*(u[M*a+U]-B)+i.damping*b[U];c[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]=v[z*a+W],_[z]=Math.max(0,c[z*a+W]),H+=_[z];H-=_[W],_[W]=c[W*a+W],H+=_[W];for(var P=0;P<a;P++)v[P*a+W]=(1-i.damping)*Math.min(0,H-_[P])+i.damping*b[P];v[W*a+W]=(1-i.damping)*(H-_[W])+i.damping*b[W]}for(var F=0,G=0;G<a;G++){var $=v[G*a+G]+c[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=PT(a,c,v),q=IT(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},OT={affinityPropagation:Z0,ap:Z0},BT=Ar({root:void 0,directed:!1}),FT={hierholzer:function(e){if(!Dt(e)){var r=arguments;e={root:r[0],directed:r[1]}}var n=BT(e),i=n.root,s=n.directed,o=this,a=!1,l,u,h;i&&(h=ut(i)?this.filter(i)[0].id():i[0].id());var c={},v={};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),c[b]=[],y.outgoers().forEach(function(k){k.isEdge()&&c[b].push(k.id())})}else v[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),c[b]=[],y.connectedEdges().forEach(function(R){return c[b].push(R.id())})}else v[b]=[y.source().id(),y.target().id()]});var d={found:!1,trail:void 0};if(a)return d;if(u&&l)if(s){if(h&&u!=h)return d;h=u}else{if(h&&u!=h&&l!=h)return d;h||(h=u)}else h||(h=o[0].id());var x=function(b){for(var _=b,R=[b],E,T,k;c[_].length;)E=c[_].shift(),T=v[E][0],k=v[E][1],_!=k?(c[k]=c[k].filter(function(N){return N!=E}),_=k):!s&&_!=T&&(c[T]=c[T].filter(function(N){return N!=E}),_=T),R.unshift(E),R.unshift(_);return R},w=[],g=[];for(g=x(h);g.length!=1;)c[g[0]].length==0?(w.unshift(o.getElementById(g.shift())),w.unshift(o.getElementById(g.shift()))):g=x(g.shift()).concat(g);w.unshift(o.getElementById(g.shift()));for(var m in c)if(c[m].length)return d;return d.found=!0,d.trail=this.spawn(w,!0),d}},qu=function(){var e=this,r={},n=0,i=0,s=[],o=[],a={},l=function(v,d){for(var x=o.length-1,w=[],g=e.spawn();o[x].x!=v||o[x].y!=d;)w.push(o.pop().edge),x--;w.push(o.pop().edge),w.forEach(function(m){var y=m.connectedNodes().intersection(e);g.merge(m),y.forEach(function(b){var _=b.id(),R=b.connectedEdges().intersection(e);g.merge(b),r[_].cutVertex?g.merge(R.filter(function(E){return E.isLoop()})):g.merge(R)})}),s.push(g)},u=function(v,d,x){v===x&&(i+=1),r[d]={id:n,low:n++,cutVertex:!1};var w=e.getElementById(d).connectedEdges().intersection(e);if(w.size()===0)s.push(e.spawn(e.getElementById(d)));else{var g,m,y,b;w.forEach(function(_){g=_.source().id(),m=_.target().id(),y=g===d?m:g,y!==x&&(b=_.id(),a[b]||(a[b]=!0,o.push({x:d,y,edge:_})),y in r?r[d].low=Math.min(r[d].low,r[y].id):(u(v,y,d),r[d].low=Math.min(r[d].low,r[y].low),r[d].id<=r[y].low&&(r[d].cutVertex=!0,l(d,y))))})}};e.forEach(function(c){if(c.isNode()){var v=c.id();v in r||(i=0,u(v,v),r[v].cutVertex=i>1)}});var h=Object.keys(r).filter(function(c){return r[c].cutVertex}).map(function(c){return e.getElementById(c)});return{cut:e.spawn(h),components:s}},jT={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 h=e.getElementById(u).connectedEdges().intersection(e);if(h.forEach(function(w){var g=w.target().id();g!==u&&(g in r||a(g),r[g].explored||(r[u].low=Math.min(r[u].low,r[g].low)))}),r[u].index===r[u].low){for(var c=e.spawn();;){var v=s.pop();if(c.merge(e.getElementById(v)),r[v].low=r[u].index,r[v].explored=!0,v===u)break}var d=c.edgesWith(c),x=c.merge(d);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}},zT={tarjanStronglyConnected:Yu,tsc:Yu,tscc:Yu,tarjanStronglyConnectedComponents:Yu},Iw={};[hl,g3,m3,x3,w3,S3,k3,J3,Os,Bs,hv,fT,ET,LT,OT,FT,jT,zT].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(c){s(a,c)},function(c){r(c)});else{var h=l;s(a,h)}})(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,h){var c=e[u];c!=null&&(e[u]=e[h],e[h]=c)};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 HT={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 h=a.style();r=dt({},r,n);var c=Object.keys(r).length===0;if(c)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=h.getPropsList(r.style||r.css),r.css=void 0),u&&r.renderedPosition!=null){var v=r.renderedPosition,d=a.pan(),x=a.zoom();r.position=Ew(v,x,d)}if(l&&r.panBy!=null){var w=r.panBy,g=a.pan();r.pan={x:g.x+w.x,y:g.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],h=u.animated()&&(r.queue===void 0||r.queue),c=u.animation(r,h?{queue:!0}:void 0);c.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],h=u._private,c=h.animation.current,v=0;v<c.length;v++){var d=c[v],x=d._private;n&&(x.duration=0)}r&&(h.animation.queue=[]),n||(h.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 UT(){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 WT(){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 VT(){if(ax)return Nd;ax=1;var t=Vc(),e=t["__core-js_shared__"];return Nd=e,Nd}var Dd,sx;function $T(){if(sx)return Dd;sx=1;var t=VT(),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 GT(){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 qT(){if(lx)return Md;lx=1;var t=WT(),e=$T(),r=Cl(),n=GT(),i=/[\\^$.*+?()[\]{}|]/g,s=/^\[object .+?Constructor\]$/,o=Function.prototype,a=Object.prototype,l=o.toString,u=a.hasOwnProperty,h=RegExp("^"+l.call(u).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function c(v){if(!r(v)||e(v))return!1;var d=t(v)?h:s;return d.test(n(v))}return Md=c,Md}var Pd,ux;function YT(){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=qT(),e=YT();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 XT(){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 KT(){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 QT(){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 ZT(){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 JT(){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 eR(){if(mx)return Ud;mx=1;var t=XT(),e=KT(),r=QT(),n=ZT(),i=JT();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 tR(){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 rR(){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 nR(){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 iR(){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 aR(){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 sR(){if(Ex)return Kd;Ex=1;var t=tR(),e=rR(),r=nR(),n=iR(),i=aR();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 oR(){if(kx)return Qd;kx=1;var t=rg(),e=Vc(),r=t(e,"Map");return Qd=r,Qd}var Zd,Tx;function lR(){if(Tx)return Zd;Tx=1;var t=eR(),e=sR(),r=oR();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 uR(){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=uR();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 cR(){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 hR(){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 fR(){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 dR(){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 pR(){if(Px)return ap;Px=1;var t=lR(),e=cR(),r=hR(),n=fR(),i=dR();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 vR(){if(Ix)return sp;Ix=1;var t=pR(),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 gR(){if(Ox)return op;Ox=1;var t=vR(),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=gR(),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 mR(){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=mR();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=UT(),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 yR(){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 xR(){if(Vx)return vp;Vx=1;var t=yR();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 bR=xR(),wR=Sl(bR),gp,$x;function _R(){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 SR(){if(Gx)return mp;Gx=1;var t=_R();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 CR(){if(qx)return yp;qx=1;var t=SR(),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 ER(){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 kR(){if(Xx)return bp;Xx=1;var t=CR(),e=$w(),r=ER(),n=Cl(),i=ng();function s(o,a,l,u){if(!n(o))return o;a=e(a,o);for(var h=-1,c=a.length,v=c-1,d=o;d!=null&&++h<c;){var x=i(a[h]),w=l;if(x==="__proto__"||x==="constructor"||x==="prototype")return o;if(h!=v){var g=d[x];w=u?u(g,x,d):void 0,w===void 0&&(w=n(g)?g:r(a[h+1])?[]:{})}t(d,x,w),d=d[x]}return o}return bp=s,bp}var wp,Kx;function TR(){if(Kx)return wp;Kx=1;var t=kR();function e(r,n,i){return r==null?r:t(r,n,i)}return wp=e,wp}var RR=TR(),LR=Sl(RR),_p,Qx;function NR(){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 DR(){if(Zx)return Sp;Zx=1;var t=Ww(),e=NR(),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 AR=DR(),MR=Sl(AR),PR={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],h=l?a[0]:a;if(ut(i)){var c=i.indexOf(".")!==-1,v=c&&MR(i);if(o.allowGetting&&s===void 0){var d;return h&&(o.beforeGet(h),v&&h._private[o.field][i]===void 0?d=wR(h._private[o.field],v):d=h._private[o.field][i]),d}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 g=0,m=u.length;g<m;g++){var y=u[g];o.canSet(y)&&(v&&h._private[o.field][i]===void 0?LR(y._private[o.field],v,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 h&&(o.beforeGet(h),A=h._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+/),h=u.length,c=0;c<h;c++){var v=u[c];if(!Qi(v)){var d=!s.immutableKeys[v];if(d)for(var x=0,w=l.length;x<w;x++)l[x]._private[s.field][v]=void 0}}s.triggerEvent&&o[s.triggerFnName](s.event)}else if(i===void 0){for(var g=0,m=l.length;g<m;g++)for(var y=l[g]._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}}},IR={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(d){s.off.apply(s,c),a(d)},h=o.concat([u]),c=h.concat([]);s.on.apply(s,h)})}}},Ot={};[HT,PR,IR].forEach(function(t){dt(Ot,t)});var OR={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,h=!1,c=0;c<e.length;c++){var v=e[c],d=u.has(v);if(!d){h=!0;break}}h||(h=u.size!==e.length),h&&(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,h=!1,c=0;c<e.length;c++){var v=e[c],d=u.has(v),x=!1;r||i&&!d?(u.add(v),x=!0):(!r||i&&d)&&(u.delete(v),x=!0),!h&&x&&(s.push(l),h=!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 Pk(t.selector,e.selector)}),BR=(function(){for(var t={},e,r=0;r<vv.length;r++)e=vv[r],t[e.selector]=e.matches;return t})(),FR=function(e,r){return BR[e](r)},jR="("+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:jR,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(),h=jt(),c=jt();return o.checks.push({type:tt.COMPOUND_SPLIT,left:a,right:l,subject:u}),u.checks=r.checks,r.checks=[{type:tt.TRUE}],c.checks.push({type:tt.TRUE}),l.checks.push({type:tt.PARENT,parent:c,child:h}),Ui(e,a,o),e.currentSubject=u,e.compoundCount++,h}else{var v=jt(),d=jt(),x=[{type:tt.PARENT,parent:v,child:d}];return v.checks=r.checks,r.checks=x,e.compoundCount++,d}}},{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(),h=jt(),c=jt();return o.checks.push({type:tt.COMPOUND_SPLIT,left:a,right:l,subject:u}),u.checks=r.checks,r.checks=[{type:tt.TRUE}],c.checks.push({type:tt.TRUE}),l.checks.push({type:tt.ANCESTOR,ancestor:c,descendant:h}),Ui(e,a,o),e.currentSubject=u,e.compoundCount++,h}else{var v=jt(),d=jt(),x=[{type:tt.ANCESTOR,ancestor:v,descendant:d}];return v.checks=r.checks,r.checks=x,e.compoundCount++,d}}},{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 zR=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}},HR=function(e){var r=e.match(/^\s+/);if(r){var n=r[0];e=e.substring(n.length)}return e},UR=function(e){var r=this,n=r.inputText=e,i=r[0]=jt();for(r.length=1,n=HR(n);;){var s=zR(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 h=r[u];if(h.compoundCount>0&&h.edgeCount>0)return Bt("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(h.edgeCount>1)return Bt("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;h.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},WR=function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(h){return h??""},r=function(h){return ut(h)?'"'+h+'"':e(h)},n=function(h){return" "+h+" "},i=function(h,c){var v=h.type,d=h.value;switch(v){case tt.GROUP:{var x=e(d);return x.substring(0,x.length-1)}case tt.DATA_COMPARE:{var w=h.field,g=h.operator;return"["+w+n(e(g))+r(d)+"]"}case tt.DATA_BOOL:{var m=h.operator,y=h.field;return"["+e(m)+y+"]"}case tt.DATA_EXIST:{var b=h.field;return"["+b+"]"}case tt.META_COMPARE:{var _=h.operator,R=h.field;return"[["+R+n(e(_))+r(d)+"]]"}case tt.STATE:return d;case tt.ID:return"#"+d;case tt.CLASS:return"."+d;case tt.PARENT:case tt.CHILD:return s(h.parent,c)+n(">")+s(h.child,c);case tt.ANCESTOR:case tt.DESCENDANT:return s(h.ancestor,c)+" "+s(h.descendant,c);case tt.COMPOUND_SPLIT:{var E=s(h.left,c),T=s(h.subject,c),k=s(h.right,c);return E+(E.length>0?" ":"")+T+k}case tt.TRUE:return""}},s=function(h,c){return h.checks.reduce(function(v,d,x){return v+(c===h&&x===0?"$":"")+i(d,c)},"")},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},VR={parse:UR,toString:WR},Gw=function(e,r,n){var i,s=ut(e),o=Xe(e),a=ut(n),l,u,h=!1,c=!1,v=!1;switch(r.indexOf("!")>=0&&(r=r.replace("!",""),c=!0),r.indexOf("@")>=0&&(r=r.replace("@",""),h=!0),(s||a||h)&&(l=!s&&!o?"":""+e,u=""+n),h&&(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">":v=!0,i=e>n;break;case">=":v=!0,i=e>=n;break;case"<":v=!0,i=e<n;break;case"<=":v=!0,i=e<=n;break;default:i=!1;break}return c&&(e!=null||!v)&&(i=!i),i},$R=function(e,r){switch(r){case"?":return!!e;case"!":return!e;case"^":return e===void 0}},GR=function(e){return e!==void 0},ig=function(e,r){return e.data(r)},qR=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 FR(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(qR(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 $R(ig(e,r),n)};sr[tt.DATA_EXIST]=function(t,e){var r=t.field;return t.operator,GR(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 YR=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)},XR=function(e){for(var r=this,n=0;n<r.length;n++){var i=r[n];if(Xt(i,e))return!0}return!1},KR={matches:XR,filter:YR},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;[VR,KR].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,h;if(l==null?h="":mn(l)&&l.length===1&&(h=l.id()),u.length===1&&h){var c=u[0]._private,v=c.traversalCache=c.traversalCache||{},d=v[r]=v[r]||[],x=Oa(h),w=d[x];return w||(d[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 h=i.shift();e(h),s.add(h.id()),a&&n(i,s,h)}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 QR(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,QR)};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 ZR=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 h=this[u];r!==void 0?h.position(e,(r-o[e])/s):a!==void 0&&h.position(Ew(a,s,o))}else{var c=n.position();return a=Gc(c,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],h=a?u.parent():null,c=h&&h.length>0,v=c;c&&(h=h[0]);var d=v?h.position():{x:0,y:0};r!==void 0?u.position(e,r+d[e]):s!==void 0&&u.position({x:s.x+d.x,y:s.y+d.y})}else{var x=n.position(),w=a?n.parent():null,g=w&&w.length>0,m=g;g&&(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 JR=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"}},eL=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",h={width:{val:o.pstyle("min-width").pfValue,left:o.pstyle("min-width-bias-left"),right:o.pstyle("min-width-bias-right")},height:{val:o.pstyle("min-height").pfValue,top:o.pstyle("min-height-bias-top"),bottom:o.pstyle("min-height-bias-bottom")}},c=l.boundingBox({includeLabels:u,includeOverlays:!1,useCache:!1}),v=a.position;(c.w===0||c.h===0)&&(c={w:o.pstyle("width").pfValue,h:o.pstyle("height").pfValue},c.x1=v.x-c.w/2,c.x2=v.x+c.w/2,c.y1=v.y-c.h/2,c.y2=v.y+c.h/2);function d(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=h.width.left.value;h.width.left.units==="px"&&h.width.val>0&&(w=w*100/h.width.val);var g=h.width.right.value;h.width.right.units==="px"&&h.width.val>0&&(g=g*100/h.width.val);var m=h.height.top.value;h.height.top.units==="px"&&h.height.val>0&&(m=m*100/h.height.val);var y=h.height.bottom.value;h.height.bottom.units==="px"&&h.height.val>0&&(y=y*100/h.height.val);var b=d(h.width.val-c.w,w,g),_=b.biasDiff,R=b.biasComplementDiff,E=d(h.height.val-c.h,m,y),T=E.biasDiff,k=E.biasComplementDiff;a.autoPadding=x(c.w,c.h,o.pstyle("padding"),o.pstyle("padding-relative-to").value),a.autoWidth=Math.max(c.w,h.width.val),v.x=(-_+c.x1+c.x2+R)/2,a.autoHeight=Math.max(c.h,h.height.val),v.y=(-T+c.y1+c.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 h=i.arrowBounds=i.arrowBounds||{},c=h[n]=h[n]||{};c.x1=l-o,c.y1=u-o,c.x2=l+o,c.y2=u+o,c.w=c.x2-c.x1,c.h=c.y2-c.y1,uc(c,1),Fn(e,c.x1,c.y1,c.x2,c.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"),h=jo(o,"labelWidth",n),c=jo(o,"labelHeight",n),v=jo(o,"labelX",n),d=jo(o,"labelY",n),x=r.pstyle(i+"text-margin-x").pfValue,w=r.pstyle(i+"text-margin-y").pfValue,g=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=c,k=h,N=k/2,M=T/2,B,A,j,D;if(g)B=v-N,A=v+N,j=d-M,D=d+M;else{switch(Us(l.value)){case"left":B=v-k,A=v;break;case"center":B=v-N,A=v+N;break;case"right":B=v,A=v+k;break}switch(Ws(u.value)){case"top":j=d-T,D=d;break;case"center":j=d-M,D=d+M;break;case"bottom":j=d,D=d+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=g&&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(!g){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 h=r.position(),c=h.x,v=h.y,d=r.width(),x=r.height();if(u.hasMiterBounds){s==="center"&&(i/=2);var w=u.miterBounds(c,v,d,x,i);Vi(e,w)}else o!=null&&o>0&&cc(e,[o,o,o,o])}}},tL=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)}},rL=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(),h,c,v,d,x,w,g=a.rstyle,m=l&&i?e.pstyle("bounds-expansion").pfValue:[0],y=function(ze){return ze.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;h=x-j,c=x+j,v=w-I,d=w+I,Fn(o,h,v,c,d),i&&e1(o,e),i&&r.includeOutlines&&!s&&e1(o,e),i&&tL(o,e)}else if(u&&r.includeEdges)if(i&&!s){var U=e.pstyle("curve-style").strValue;if(h=Math.min(g.srcX,g.midX,g.tgtX),c=Math.max(g.srcX,g.midX,g.tgtX),v=Math.min(g.srcY,g.midY,g.tgtY),d=Math.max(g.srcY,g.midY,g.tgtY),h-=M,c+=M,v-=M,d+=M,Fn(o,h,v,c,d),U==="haystack"){var W=g.haystackPts;if(W&&W.length===2){if(h=W[0].x,v=W[0].y,c=W[1].x,d=W[1].y,h>c){var H=h;h=c,c=H}if(v>d){var z=v;v=d,d=z}Fn(o,h-M,v-M,c+M,d+M)}}else if(U==="bezier"||U==="unbundled-bezier"||Gi(U,"segments")||Gi(U,"taxi")){var P;switch(U){case"bezier":case"unbundled-bezier":P=g.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":P=g.linePts;break}if(P!=null)for(var F=0;F<P.length;F++){var G=P[F];h=G.x-M,c=G.x+M,v=G.y-M,d=G.y+M,Fn(o,h,v,c,d)}}}else{var $=e.source(),ee=$.position(),re=e.target(),ne=re.position();if(h=ee.x,c=ne.x,v=ee.y,d=ne.y,h>c){var Y=h;h=c,c=Y}if(v>d){var q=v;v=d,d=q}h-=M,c+=M,v-=M,d+=M,Fn(o,h,v,c,d)}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&&(h=o.x1,c=o.x2,v=o.y1,d=o.y2,Fn(o,h-k,v-k,c+k,d+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?O3(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=rL(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(h){var c=h._private;return c.bbCache==null||c.styleDirty||c.bbCachePosKey!==e_(h)},function(h){return h.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(h,c){return h._private.bbAtOldPos=t(h,c)},a=function(h){return h._private.bbAtOldPos};r.startBatch(),e.forEach(o).silentPositions(t),n&&(i.dirtyCompoundBoundsCache(),i.dirtyBoundingBoxCache(),i.updateCompoundBounds(!0));var l=I3(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 nL=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 h=2*n.padding();return a+u+h}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 iL=Rl,aL=function(e,r){if(e.isEdge()&&e.takesUpSpace())return r(e)},sL=function(e,r){if(e.isEdge()&&e.takesUpSpace()){var n=e.cy();return Gc(r(e),n.zoom(),n.pan())}},oL=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)})}},lL=function(e){return e.renderer().getControlPoints(e)},uL=function(e){return e.renderer().getSegmentPoints(e)},cL=function(e){return e.renderer().getSourceEndpoint(e)},hL=function(e){return e.renderer().getTargetEndpoint(e)},fL=function(e){return e.renderer().getEdgeMidpoint(e)},i1={controlPoints:{get:lL,mult:!0},segmentPoints:{get:uL,mult:!0},sourceEndpoint:{get:cL},targetEndpoint:{get:hL},midpoint:{get:fL}},dL=function(e){return"rendered"+e[0].toUpperCase()+e.substr(1)},pL=Object.keys(i1).reduce(function(t,e){var r=i1[e],n=dL(e);return t[e]=function(){return aL(this,r.get)},r.mult?t[n]=function(){return oL(this,r.get)}:t[n]=function(){return sL(this,r.get)},t},{}),vL=dt({},JR,nL,iL,pL);/*!
|
|
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_=/^([^.]+)(\.(?:[^.]+))?$/,gL=".*",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_),mL={};function Jc(){for(var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:mL,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 h=l[u];if(!Qi(h)){var c=h.match(n_);if(c){var v=c[1],d=c[2]?c[2]:null,x=r(e,h,v,d,i,s,o);if(x===!1)break}}}},s1=function(e,r){return e.addEventFields(e.context,r),new r_(r.type,r)},yL=function(e,r,n){if(Sk(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,h=s1(e,{type:l,namespace:u,target:e.context});r(e,h)}}}};ra.on=ra.addListener=function(t,e,r,n,i){return a_(this,function(s,o,a,l,u,h,c){nr(h)&&s.listeners.push({event:o,callback:h,type:a,namespace:l,qualifier:u,conf:c})},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=a3(this.listeners));for(var s=this.listeners,o=function(u){var h=s[u];a_(i,function(c,v,d,x,w,g){if((h.type===d||t==="*")&&(!x&&h.namespace!==".*"||h.namespace===x)&&(!w||c.qualifierCompare(h.qualifier,w))&&(!g||h.callback===g))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]),yL(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 h=n[l];if(h.type===o.type&&(!h.namespace||h.namespace===o.namespace||h.namespace===gL)&&s.eventMatches(s.context,h,o)){var c=[o];e!=null&&o3(c,e),s.beforeEmit(s.context,h,o),h.conf&&h.conf.one&&(s.listeners=s.listeners.filter(function(x){return x!==h}));var v=s.callbackContext(s.context,h,o),d=h.callback.apply(v,c);s.afterEmit(s.context,h,o),d===!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 xL={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(xL,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 h=a[u];l.has(h)&&n.push(h)}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 h=0;h<l.length;h++){var c=l[h],v=c._private.data.id,d=u.hasElementWithId(v);d||n.push(c)}};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(h,c,v){for(var d=0;d<h.length;d++){var x=h[d],w=x._private.data.id,g=c.hasElementWithId(w);g?s.merge(x):v.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 h=this.length++;this[h]=a,s.set(l,{ele:a,index:h})}}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 bL={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(h){var c=h.pstyle("z-compound-depth");return c.value==="auto"?i?h.zDepth():0:c.value==="bottom"?-1:c.value==="top"?Yv:0}var o=s(e)-s(r);if(o!==0)return o;function a(h){var c=h.pstyle("z-index-compare");return c.value==="auto"&&h.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 wL=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})})};wL();var _L=Ar({nodeDimensionsIncludeLabels:!1}),fc={layoutDimensions:function(e){e=_L(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}},h=r.spacingFactor&&r.spacingFactor!==1,c=function(){if(!h)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},v=c(),d=js(function(R,E){var T=l(R,E);if(h){var k=Math.abs(r.spacingFactor);T=u(k,v,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],g=d(w,x),m=r.animateFilter==null||r.animateFilter(w,x);if(m){var y=w.animation({position:g,duration:r.animationDuration,easing:r.animationEasing});e.animations.push(y)}else w.position(g)}if(r.fit){var b=s.animation({fit:{boundingBox:o.boundingBoxAt(d),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(d),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 SL=eh("eleInteractive",function(t){return t.pstyle("events").value==="yes"&&t.pstyle("visibility").value==="visible"&&Ys(t)}),CL=eh("parentInteractive",function(t){return t.pstyle("visibility").value==="visible"&&Ys(t)});Nr.interactive=th("interactive",sg({ok:SL,parentOk:CL,edgeOkViaNode:Ys}));Nr.noninteractive=function(){var t=this[0];if(t)return!t.interactive()};var EL=eh("eleVisible",function(t){return t.pstyle("visibility").value==="visible"&&t.pstyle("opacity").pfValue!==0&&Ys(t)}),kL=Ys;Nr.visible=th("visible",sg({ok:EL,edgeOkViaNode:kL}));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],h=l._private[t.field]!=t.value;if(t.overrideAble){var c=t.overrideAble(l);if(c!==void 0&&(u=c,!c))return this}u&&(l._private[t.field]=t.value,h&&r.push(l))}var v=this.spawn(r);v.updateStyle(),v.emit(t.event),o&&v.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(),h=0;h<u.length;h++){var c=u[h],v=c.source(),d=c.target();if(e.noIncomingEdges&&d===a&&v!==a||e.noOutgoingEdges&&v===a&&d!==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],h=u.source(),c=u.target();e.outgoing&&h===o?(i.push(u),i.push(c)):e.incoming&&c===o&&(i.push(u),i.push(h))}}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],h=u.id();s[h]||(s[h]=!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(),h=i===l?u:l;h.length>0&&e.push(h[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],h=u._private.data,c=this.hasElementWithId(h.source)&&r.hasElementWithId(h.target),v=r.hasElementWithId(h.source)&&this.hasElementWithId(h.target),d=c||v;d&&((s.thisIsSrc||s.thisIsTgt)&&(s.thisIsSrc&&!c||s.thisIsTgt&&!v)||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,h=u.source,c=h._private.data.id,v=u.data.target,d=h._private.edges,x=0;x<d.length;x++){var w=d[x],g=w._private.data,m=g.target,y=g.source,b=m===v&&y===c,_=c===m&&v===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(h,c){i.merge(h),s.unmerge(h),c.merge(h)};if(s.empty())return r.spawn();var l=function(){var h=n.collection();o.push(h);var c=s[0];a(c,h),r.bfs({directed:!1,roots:c,visit:function(d){return a(d,h)}}),h.forEach(function(v){v.connectedEdges().forEach(function(d){r.has(d)&&h.has(d.source())&&h.has(d.target())&&h.merge(d)})})};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,h=r.length;u<h;u++){var c=r[u];c.data==null&&(c.data={});var v=c.data;if(v.id==null)v.id=Sw();else if(e.hasElementWithId(v.id)||l.has(v.id))continue;var d=new $c(e,c,!1);a.push(d),l.add(v.id)}r=a}this.length=0;for(var x=0,w=r.length;x<w;x++){var g=r[x][0];if(g!=null){var m=g._private.data.id;(!n||!s.has(m))&&(n&&s.set(m,{index:this.length,ele:g}),this[this.length]=g,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,h=t.data.parent;u&&(h!=null||i.parent!=null)&&h!=i.parent&&(h===void 0&&(h=null),h!=null&&(h=""+h),e=e.move({parent:h}))}}t.position&&e.position(t.position);var c=function(w,g,m){var y=t[w];y!=null&&y!==n[w]&&(y?e[g]():e[m]())};return c("removed","remove","restore"),c("selected","select","unselect"),c("selectable","selectify","unselectify"),c("locked","lock","unlock"),c("grabbable","grabify","ungrabify"),c("pannable","panify","unpanify"),t.classes!=null&&e.classes(t.classes),r.endBatch(),this}else if(t===void 0){var v={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};v.classes="";var d=0;return n.classes.forEach(function(x){return v.classes+=d++===0?x:" "+x}),v}}};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 h=r[l];e&&!h.removed()||(h.isNode()?s.push(h):o.push(h))}a=s.concat(o);var c,v=function(){a.splice(c,1),c--};for(c=0;c<a.length;c++){var d=a[c],x=d._private,w=x.data;if(d.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+"`"),v();continue}else if(n.hasElementWithId(w.id)){Jt("Can not create second element with ID `"+w.id+"`"),v();continue}}var g=w.id;if(d.isNode()){var m=x.position;m.x==null&&(m.x=0),m.y==null&&(m.y=0)}if(d.isEdge()){for(var y=d,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 `"+g+"` with unspecified "+T),R=!0):n.hasElementWithId(k)||(Jt("Can not create edge `"+g+"` with nonexistent "+T+" `"+k+"`"),R=!0)}if(R){v();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(g,{ele:d,index:0}),x.removed=!1,e&&n.addToPool(d)}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,h=r.length;u<h;u++){var c=r[u];l(c)}function v(D,I){var U=D._private.edges;Zi(U,I),D.clearTraversalCache()}function d(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 g=0;g<n.length;g++){var m=n[g];if(m.isEdge()){var y=m.source()[0],b=m.target()[0];v(y,m),v(b,m);for(var _=m.parallelEdges(),R=0;R<_.length;R++){var E=_[R];d(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 d=0;d<r.length;d++){var x=r[d],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 h=s(t.parent),c=h===null||e.hasElementWithId(h);if(c){var v=h===null?void 0:h;e.batch(function(){var d=r.remove(n,i);d.emitAndNotify("moveout");for(var x=0;x<r.length;x++){var w=r[x],g=w._private.data;w.isNode()&&(g.parent=v)}d.restore(n,i)}),r.emitAndNotify("move")}}return this};[Iw,OR,hc,Xi,Hs,ZR,Zc,vL,s_,o_,bL,Dc,fc,Nr,Ki,zr].forEach(function(t){dt(Gt,t)});var TL={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,h=[],c=["nodes","edges"],v=0,d=c.length;v<d;v++){var x=c[v],w=u[x];if(Ut(w))for(var g=0,m=w.length;g<m;g++){var y=dt({group:x},w[g]);h.push(y)}}r=new Dr(n,h)}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 RL(t,e,r,n){var i=4,s=.001,o=1e-7,a=10,l=11,u=1/(l-1),h=typeof Float32Array<"u";if(arguments.length!==4)return!1;for(var c=0;c<4;++c)if(typeof arguments[c]!="number"||isNaN(arguments[c])||!isFinite(arguments[c]))return!1;t=Math.min(t,1),r=Math.min(r,1),t=Math.max(t,0),r=Math.max(r,0);var v=h?new Float32Array(l):new Array(l);function d(M,B){return 1-3*B+3*M}function x(M,B){return 3*B-6*M}function w(M){return 3*M}function g(M,B,A){return((d(B,A)*M+x(B,A))*M+w(B))*M}function m(M,B,A){return 3*d(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=g(B,t,r)-M;B-=D/j}return B}function b(){for(var M=0;M<l;++M)v[M]=g(M*u,t,r)}function _(M,B,A){var j,D,I=0;do D=B+(A-B)/2,j=g(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&&v[A]<=M;++A)B+=u;--A;var D=(M-v[A])/(v[A+1]-v[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:g(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 LL=(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),h=1/6*(s.dv+2*(o.dv+a.dv)+l.dv);return n.x=n.x+u*i,n.v=n.v+h*i,n}return function n(i,s,o){var a={x:-1,v:0,tension:null,friction:null},l=[0],u=0,h=1/1e4,c=16/1e3,v,d,x;for(i=parseFloat(i)||500,s=parseFloat(s)||20,o=o||null,a.tension=i,a.friction=s,v=o!==null,v?(u=n(i,s),d=u/o*c):d=c;x=r(x||a,d),l.push(1+x.x),u+=16,Math.abs(x.x)>h&&Math.abs(x.v)>h;);return v?function(w){return l[w*(l.length-1)|0]}:u}})(),$t=function(e,r,n,i){var s=RL(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=LL(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 h=o[u],c=a[u];if(h!=null&&c!=null){var v=p1(s,h,c,r,n);l.push(v)}else l.push(c)}return l}}function NL(t,e,r,n){var i=!n,s=t._private,o=e._private,a=o.easing,l=o.startTime,u=n?t:t.cy(),h=u.style();if(!o.easingImpl)if(a==null)o.easingImpl=dc.linear;else{var c;if(ut(a)){var v=h.parse("transition-timing-function",a);c=v.value}else c=a;var d,x;ut(c)?(d=c,x=[]):(d=c[1],x=c.slice(2).map(function(z){return+z})),x.length>0?(d==="spring"&&x.push(o.duration),o.easingImpl=dc[d].apply(null,x)):o.easingImpl=dc[d]}var w=o.easingImpl,g;if(o.duration===0?g=1:g=(r-l)/o.duration,o.applying&&(g=o.progress),g<0?g=0:g>1&&(g=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,g,w)),Ho(m.y,y.y)&&(b.y=xs(m.y,y.y,g,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,g,w)),Ho(_.y,R.y)&&(E.y=xs(_.y,R.y,g,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,g,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=h.properties[U.name],H=xs(U,I,g,w,W);h.overrideBypass(t,D,H)}t.emit("style")}}return o.progress=g,g}function Ho(t,e){return t==null||e==null?!1:Xe(t)&&Xe(e)?!0:!!(t&&e)}function DL(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(h,c){var v=h._private,d=v.animation.current,x=v.animation.queue,w=!1;if(d.length===0){var g=x.shift();g&&d.push(g)}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=d.length-1;y>=0;y--){var b=d[y],_=b._private;if(_.stopped){d.splice(y,1),_.hooked=!1,_.playing=!1,_.started=!1,m(_.frames);continue}!_.playing&&!_.applying||(_.playing&&_.applying&&(_.applying=!1),_.started||DL(h,b,t),NL(h,b,t,c),_.applying&&(_.applying=!1),m(_.frames),_.step!=null&&_.step(t),b.completed()&&(d.splice(y,1),_.hooked=!1,_.playing=!1,_.started=!1,m(_.completes)),w=!0)}return!c&&d.length===0&&x.length===0&&n.push(h),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 AL={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()}},ML={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(ML,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 PL={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)}})}},IL=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=IL(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",OL="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 h=e.updateStyleHints(o);h&&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],h=t[l]===rl,c=e[l]===rl,v=h!==c,d=u.mappedProperties.length>0;if(v||c&&d){var x=void 0;v&&d||v?x=u.properties:d&&(x=u.mappedProperties);for(var w=0;w<x.length;w++){for(var g=x[w],m=g.name,y=!1,b=l+1;b<r.length;b++){var _=r[b],R=e[b]===rl;if(R&&(y=_.properties[g.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+=OL}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],h=r.pstyle(l);if(!u)if(h)h.bypass?u={name:l,deleteBypassed:!0}:u={name:l,delete:!0};else continue;if(h!==u){if(u.mapped===o.fn&&h!=null&&h.mapping!=null&&h.mapping.value===u.value){var c=h.mapping,v=c.fnValue=u.value(r);if(v===c.prevFnValue)continue}var d=s[l]={prev:h};n.applyParsedProperty(r,u),d.next=r.pstyle(l),d.next&&d.next.bypass&&(d.next=d.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 h=i[u];e.styleKeys[h]=[Da,Ls]}for(var c=function(ie,ce){return e.styleKeys[ce][0]=ul(ie,e.styleKeys[ce][0])},v=function(ie,ce){return e.styleKeys[ce][1]=cl(ie,e.styleKeys[ce][1])},d=function(ie,ce){c(ie,ce),v(ie,ce)},x=function(ie,ce){for(var de=0;de<ie.length;de++){var Le=ie.charCodeAt(de);c(Le,ce),v(Le,ce)}},w=2e9,g=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;d(g(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=Qk(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],h=u&&u.bypass,c=t._private,v="mapping",d=function($){return $==null?null:$.pfValue!=null?$.pfValue:$.value},x=function(){var $=d(u),ee=d(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 g=n.field.split("."),m=c.data,y=0;y<g.length&&m;y++){var b=g[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,v)}else return!1;if(!s)return w(),!1;s.mapping=n,n=s;break}case o.data:{for(var U=n.field.split("."),W=c.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,v)),!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,v),!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?(h?n.bypassed=u.bypassed:n.bypassed=u,i[n.name]=n):h?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 h=i[u],c=t.pstyle(h),v=e[h];if(v){var d=v.prev,x=d,w=v.next!=null?v.next:c,g=!1,m=void 0,y=1e-6;x&&(Xe(x.pfValue)&&Xe(w.pfValue)?(g=w.pfValue-x.pfValue,m=x.pfValue+y*g):Xe(x.value)&&Xe(w.value)?(g=w.value-x.value,m=x.value+y*g):Ut(x.value)&&Ut(w.value)&&(g=x.value[0]!==w.value[0]||x.value[1]!==w.value[1]||x.value[2]!==w.value[2],m=x.strValue),g&&(a[h]=w.strValue,this.applyBypass(t,h,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,h=this.parse(u,r,!0);h&&s.push(h)}}else if(ut(e)){var c=this.parse(e,r,!0);c&&s.push(c)}else if(Dt(e)){var v=e;n=r;for(var d=Object.keys(v),x=0;x<d.length;x++){var w=d[x],g=v[w];if(g===void 0&&(g=v[Wc(w)]),g!==void 0){var m=this.parse(w,g,!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],h=s.pstyle(u.name);if(!(!h||!h.bypass)){var c="",v=this.parse(l,c,!0),d=o[u.name]={prev:h};this.applyParsedProperty(s,v),d.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 h=t.cy().zoom(),c=function(g){return g*h},v=function(g,m){return c(g)+m},d=Ut(a),x=d?l.every(function(w){return w!=null}):l!=null;return x?d?a.map(function(w,g){return v(w,l[g])}).join(" "):v(a,l):d?a.map(function(w){return ut(w)?w:""+c(w)}).join(" "):""+c(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)],h=this.parse(u.name,l);h&&r.push(h)}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 h=n.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!h){Bt("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+n);break}i=h[0];var c=h[1];if(c!=="core"){var v=new ea(c);if(v.invalid){Bt("Skipping parsing of block: Invalid selector found in string stylesheet: "+c),a();continue}}var d=h[2],x=!1;s=d;for(var w=[];;){var g=s.match(/^\s*$/);if(g)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:"+d),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(c);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=Lk,r=Dk,n=Ak,i=Mk,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,h=[{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}],c=[{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}],v=[{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}],d=[{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}],g=[{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,g,m,y,B,x,d,h,c,v,R,E,T,k,j,I,N,M,W,A),P=dr.propertyGroups={behavior:w,transition:b,visibility:g,overlay:m,underlay:y,ghost:B,commonLabel:x,labelDimensions:d,mainLabel:h,sourceLabel:c,targetLabel:v,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 h=1;h<=dr.pieBackgroundN;h++){var c=u.name.replace("{{i}}",h),v=u.value;l[c]=v}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 h=1;h<=dr.stripeBackgroundN;h++){var c=u.name.replace("{{i}}",h),v=u.value;l[c]=v}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(h){var c=h+"-"+u.name,v=u.value;l[c]=v}),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||[],h;return(h=u[l])||(h=u[l]=i.parseImplWarn(t,e,r,n)),(r||n==="mapping")&&(h=Zn(h),h&&(h.value=Zn(h.value))),h};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 h,c;if(!(!l||n||e.length<7||e[1]!=="a")){if(e.length>=7&&e[0]==="d"&&(h=new RegExp(a.data.regex).exec(e))){if(r)return!1;var v=a.data;return{name:t,value:h,strValue:""+e,mapped:v,field:h[1],bypass:r}}else if(e.length>=10&&e[0]==="m"&&(c=new RegExp(a.mapData.regex).exec(e))){if(r||u.multiple)return!1;var d=a.mapData;if(!(u.color||u.number))return!1;var x=this.parse(t,c[4]);if(!x||x.mapped)return!1;var w=this.parse(t,c[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 g=x.value,m=w.value,y=g[0]===m[0]&&g[1]===m[1]&&g[2]===m[2]&&(g[3]===m[3]||(g[3]==null||g[3]===1)&&(m[3]==null||m[3]===1));if(y)return!1}return{name:t,value:c,strValue:""+e,mapped:d,field:c[1],fieldMin:parseFloat(c[2]),fieldMax:parseFloat(c[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&&!_k(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:A3(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 BL={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()}},FL="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=FL),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(Ek(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,h=o,c={x:-h/u*(s.x-l.x)+s.x,y:-h/u*(s.y-l.y)+s.y};return{zoomed:!0,panned:!0,zoom:h,pan:c}}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,g){return w!==void 0?w:g!==void 0?g: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 h=function(x,w){var g=x.some(kk);if(g)return qs.all(x).then(w);w(x)};u.styleEnabled&&r.setStyle([]);var c=dt({},a,a.renderer);r.initRenderer(c);var v=function(x,w,g){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",g),r.emit("done")});var y=dt({},r._private.options.layout);y.eles=r.elements(),r.layout(y).run()};h([a.style,a.elements],function(d){var x=d[0],w=d[1];u.styleEnabled&&r.style().append(x),v(w,function(){r.startAnimationLoop(),u.ready=!0,nr(a.ready)&&r.on("ready",a.ready);for(var g=0;g<s.length;g++){var m=s[g];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 h=l[u],c=e.elements[h];Ut(c)&&a(c,h)}var v=r.collection();i.filter(function(b){return!o[b.id()]}).forEach(function(b){b.isParent()?v.merge(b):b.remove()}),v.forEach(function(b){return b.children().move({parent:null})}),v.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 d=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],x=0;x<d.length;x++){var w=d[x];e[w]!=null&&r[w](e[w])}return r.endBatch(),this}else{var g=!!e,m={};g?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;[TL,AL,c_,mv,pc,PL,yv,vc,BL,ja,gl].forEach(function(t){dt(Ac,t)});var jL={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}},zL={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({},jL,zL,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 h=[],c=0;c<t.roots.length;c++){var v=t.roots[c],d=e.getElementById(v);h.push(d)}u=e.collection(h)}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[g],Me=Ee.maxDegree(!1),Pe=Ee.filter(function(De){return De.degree(!1)===Me});u=u.add(Pe)},g=0;g<x.length;g++)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,We=Pe.index;m[De][We]=null,Ee.isChildless()&&b(Ee,Me)};i.bfs({roots:u,directed:t.directed,visit:function(Ee,Me,Pe,De,We){var Ye=Ee[0],ge=Ye.id();Ye.isChildless()&&b(Ye,We),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)}),We=-1,Ye=Ee.id(),ge=0;ge<De.length;ge++){var Ce=De[ge],Ae=bs(Ce);We=Math.max(We,Ae.depth)}if(Pe.depth<=We){if(!t.acyclic&&Me[Ye])return null;var Fe=We+1;return _(Ee,Fe),Me[Ye]=Fe,!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,We=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,Fe=Ce.depth;if(!(Ae==null||Fe==null)){var me=m[Fe].length;Fe<Me&&(De+=Ae/me,We++)}}}}return We=Math.max(1,We),De=De/We,We===0&&(De=0),G[Ee.id()]=De,De},ee=function(Ee,Me){var Pe=$(Ee),De=$(Me),We=Pe-De;return We===0?fw(Ee.id(),Me.id()):We};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),ze=function(Ee){var Me=bs(Ee),Pe=Me.depth,De=Me.index;if(t.circle){var We=Math.min(l.w/2/re,l.h/2/re);We=Math.max(We,U);var Ye=We*Pe+We-(re>0&&m[0].length<=3?We/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),Fe={x:ie.x+(De+1-(Ce+1)/2)*Ae,y:ie.y+(Pe+1-(re+1)/2)*de};return Fe}},_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 t3(ze(Ee),l,_e[t.direction])};return r.nodes().layoutPositions(this,t,ke),this};var HL={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({},HL,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),h,c=0,v=0;v<s.length;v++){var d=s[v],x=d.layoutDimensions(e),w=x.w,g=x.h;c=Math.max(c,w,g)}if(Xe(e.radius)?h=e.radius:s.length<=1?h=0:h=Math.min(o.h,o.w)/2-c,s.length>1&&e.avoidOverlap){c*=1.75;var m=Math.cos(u)-Math.cos(0),y=Math.sin(u)-Math.sin(0),b=Math.sqrt(c*c/(m*m+y*y));h=Math.max(b,h)}var _=function(E,T){var k=e.startAngle+T*u*(i?1:-1),N=h*Math.cos(k),M=h*Math.sin(k),B={x:a.x+N,y:a.y+M};return B};return n.nodes().layoutPositions(this,e,_),this};var UL={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({},UL,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,h=0;h<s.length;h++){var c=s[h],v=void 0;v=e.concentric(c),l.push({value:v,node:c}),c._private.scratch.concentric=v}s.updateStyle();for(var d=0;d<s.length;d++){var x=s[d],w=x.layoutDimensions(e);u=Math.max(u,w.w,w.h)}l.sort(function(de,Le){return Le.value-de.value});for(var g=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>=g&&(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,WL={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({},WL,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=VL(e,r,t);Tp&&GL(n),t.randomize&&qL(n);var i=vi(),s=function(){YL(n,e,t),t.fit===!0&&e.fit(t.padding)},o=function(v){return!(r.stopped||v>=t.numIter||(XL(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 v=t.eles.nodes(),d=v_(n,t,v);v.layoutPositions(r,t,d)}},l=0,u=!0;if(t.animate===!0){var h=function(){for(var v=0;u&&v<t.refresh;)u=o(l),l++,v++;if(!u)x1(n,t),a();else{var d=vi();d-i>=t.animationThreshold&&s(),kc(h)}};h()}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 VL=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={},h=0;h<l.length;h++)for(var c=l[h],v=0;v<c.length;v++){var d=c[v];u[d.id()]=h}for(var h=0;h<a.nodeSize;h++){var x=s[h],w=x.layoutDimensions(n),g={};g.isLocked=x.locked(),g.id=x.data("id"),g.parentId=x.data("parent"),g.cmptId=u[x.id()],g.children=[],g.positionX=x.position("x"),g.positionY=x.position("y"),g.offsetX=0,g.offsetY=0,g.height=w.w,g.width=w.h,g.maxX=g.positionX+g.width/2,g.minX=g.positionX-g.width/2,g.maxY=g.positionY+g.height/2,g.minY=g.positionY-g.height/2,g.padLeft=parseFloat(x.style("padding")),g.padRight=parseFloat(x.style("padding")),g.padTop=parseFloat(x.style("padding")),g.padBottom=parseFloat(x.style("padding")),g.nodeRepulsion=nr(n.nodeRepulsion)?n.nodeRepulsion(x):n.nodeRepulsion,a.layoutNodes.push(g),a.idToIndex[g.id]=h}for(var m=[],y=0,b=-1,_=[],h=0;h<a.nodeSize;h++){var x=a.layoutNodes[h],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],d=a.layoutNodes[T],k=d.children;if(k.length>0){a.graphSet.push(k);for(var h=0;h<k.length;h++)m[++b]=k[h]}}for(var h=0;h<a.graphSet.length;h++)for(var N=a.graphSet[h],v=0;v<N.length;v++){var M=a.idToIndex[N[v]];a.indexToGraph[M]=h}for(var h=0;h<a.edgeSize;h++){var B=i[h],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=$L(A.sourceId,A.targetId,a),P=a.graphSet[z],F=0,g=a.layoutNodes[I];P.indexOf(g.id)===-1;)g=a.layoutNodes[a.idToIndex[g.parentId]],F++;for(g=a.layoutNodes[U];P.indexOf(g.id)===-1;)g=a.layoutNodes[a.idToIndex[g.parentId]],F++;j*=F*n.nestingFactor}A.idealLength=j,A.elasticity=D,a.layoutEdges.push(A)}return a},$L=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],h=i.layoutNodes[u].children;if(h.length!==0){var c=i.indexToGraph[i.idToIndex[h[0]]],v=p_(e,r,c,i);if(v.count!==0)if(v.count===1){if(o++,o===2)break}else return v}}return{count:o,graph:n}},GL,qL=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,h=s.h===0?.5:(l.positionY-s.y1)/s.h;return{x:i.x1+u*i.w,y:i.y1+h*i.h}}else return{x:l.positionX,y:l.positionY}}},YL=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}))},XL=function(e,r,n){KL(e,r),JL(e),eN(e,r),tN(e),rN(e)},KL=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]]];QL(a,u,e,r)}},y1=function(e){return-e+2*e*Math.random()},QL=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 h=ZL(e,r,a,l);if(h>0)var c=i.nodeOverlap*h,v=Math.sqrt(a*a+l*l),d=c*a/v,x=c*l/v;else var w=Mc(e,a,l),g=Mc(r,-1*a,-1*l),m=g.x-w.x,y=g.y-w.y,b=m*m+y*y,v=Math.sqrt(b),c=(e.nodeRepulsion+r.nodeRepulsion)/b,d=c*m/v,x=c*y/v;e.isLocked||(e.offsetX-=d,e.offsetY-=x),r.isLocked||(r.offsetX+=d,r.offsetY+=x)}},ZL=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,h={};return r===0&&0<n||r===0&&0>n?(h.x=i,h.y=s+o/2,h):0<r&&-1*u<=l&&l<=u?(h.x=i+a/2,h.y=s+a*n/2/r,h):0>r&&-1*u<=l&&l<=u?(h.x=i-a/2,h.y=s-a*n/2/r,h):0<n&&(l<=-1*u||l>=u)?(h.x=i+o*r/2/n,h.y=s+o/2,h):(0>n&&(l<=-1*u||l>=u)&&(h.x=i-o*r/2/n,h.y=s-o/2),h)},JL=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,h=l.positionY-o.positionY;if(!(u===0&&h===0)){var c=Mc(o,u,h),v=Mc(l,-1*u,-1*h),d=v.x-c.x,x=v.y-c.y,w=Math.sqrt(d*d+x*x),g=Math.pow(i.idealLength-w,2)/i.elasticity;if(w!==0)var m=g*d/w,y=g*x/w;else var m=0,y=0;o.isLocked||(o.offsetX+=m,o.offsetY+=y),l.isLocked||(l.offsetX-=m,l.offsetY-=y)}}},eN=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]]],h=e.layoutNodes[e.idToIndex[u.parentId]],a=h.positionX,l=h.positionY;for(var c=0;c<o;c++){var v=e.layoutNodes[e.idToIndex[s[c]]];if(!v.isLocked){var d=a-v.positionX,x=l-v.positionY,w=Math.sqrt(d*d+x*x);if(w>n){var g=r.gravity*d/w,m=r.gravity*x/w;v.offsetX+=g,v.offsetY+=m}}}}},tN=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 h=l.offsetX,c=l.offsetY,v=0;v<u.length;v++){var d=e.layoutNodes[e.idToIndex[u[v]]];d.offsetX+=h,d.offsetY+=c,n[++s]=u[v]}l.offsetX=0,l.offsetY=0}}},rN=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=nN(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)}},nN=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 h=i[s];if(h){h.x1=1/0,h.x2=-1/0,h.y1=1/0,h.y2=-1/0;for(var c=0;c<h.length;c++){var v=h[c];h.x1=Math.min(h.x1,v.positionX-v.width/2),h.x2=Math.max(h.x2,v.positionX+v.width/2),h.y1=Math.min(h.y1,v.positionY-v.height/2),h.y2=Math.max(h.y2,v.positionY+v.height/2)}h.w=h.x2-h.x1,h.h=h.y2-h.y1,u+=h.w*h.h}}i.sort(function(y,b){return b.w*b.h-y.w*y.h});for(var d=0,x=0,w=0,g=0,m=Math.sqrt(u)*e.clientWidth/e.clientHeight,s=0;s<i.length;s++){var h=i[s];if(h){for(var c=0;c<h.length;c++){var v=h[c];v.isLocked||(v.positionX+=d-h.x1,v.positionY+=x-h.y1)}d+=h.w+r.componentSpacing,w+=h.w+r.componentSpacing,g=Math.max(g,h.h),w>m&&(x+=g+r.componentSpacing,d=0,w=0,g=0)}}},iN={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({},iN,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),h=function(ee){if(ee==null)return Math.min(l,u);var re=Math.min(l,u);re==l?l=ee:u=ee},c=function(ee){if(ee==null)return Math.max(l,u);var re=Math.max(l,u);re==l?l=ee:u=ee},v=e.rows,d=e.cols!=null?e.cols:e.columns;if(v!=null&&d!=null)l=v,u=d;else if(v!=null&&d==null)l=v,u=Math.ceil(o/l);else if(v==null&&d!=null)u=d,l=Math.ceil(o/u);else if(u*l>o){var x=h(),w=c();(x-1)*w>=o?h(x-1):(w-1)*x>=o&&c(w-1)}else for(;u*l<o;){var g=h(),m=c();(m+1)*g>=o?c(m+1):h(g+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 aN={ready:function(){},stop:function(){}};function ug(t){this.options=dt({},aN,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 sN={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({},sN,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 T3(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 oN={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({},oN,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 lN=[{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,h,c,v,d,x,w){var g=d.x-c/2-w,m=d.x+c/2+w,y=d.y-c/2-w,b=d.y+c/2+w,_=g<=u&&u<=m&&y<=h&&h<=b;return _},n=function(u,h,c,v,d){var x=u*Math.cos(v)-h*Math.sin(v),w=u*Math.sin(v)+h*Math.cos(v),g=x*c,m=w*c,y=g+d.x,b=m+d.y;return{x:y,y:b}},i=function(u,h,c,v){for(var d=[],x=0;x<u.length;x+=2){var w=u[x],g=u[x+1];d.push(n(w,g,h,c,v))}return d},s=function(u){for(var h=[],c=0;c<u.length;c++){var v=u[c];h.push(v.x,v.y)}return h},o=function(u){return u.pstyle("width").pfValue*u.pstyle("arrow-scale").pfValue*2},a=function(u,h){ut(h)&&(h=t[h]),t[u]=dt({name:u,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(v,d,x,w,g,m){var y=s(i(this.points,x+2*m,w,g)),b=sn(v,d,y);return b},roughCollide:r,draw:function(v,d,x,w){var g=i(this.points,d,x,w);e.arrowShapeImpl("polygon")(v,g)},spacing:function(v){return 0},gap:o},h)};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,h,c,v,d){var x=i(this.points,h,c,v),w=this.controlPoint,g=n(w[0],w[1],h,c,v);e.arrowShapeImpl(this.name)(u,x,g)},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,h,c,v,d,x,w){var g=s(i(this.points,c+2*w,v,d)),m=s(i(this.pointsTee,c+2*w,v,d)),y=sn(u,h,g)||sn(u,h,m);return y},draw:function(u,h,c,v,d){var x=i(this.points,h,c,v),w=i(this.pointsTee,h,c,v);e.arrowShapeImpl(this.name)(u,x,w)}}),a("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(u,h,c,v,d,x,w){var g=d,m=Math.pow(g.x-u,2)+Math.pow(g.y-h,2)<=Math.pow((c+2*w)*this.radius,2),y=s(i(this.points,c+2*w,v,d));return sn(u,h,y)||m},draw:function(u,h,c,v,d){var x=i(this.pointsTr,h,c,v);e.arrowShapeImpl(this.name)(u,x,v.x,v.y,this.radius*h)},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,h){var c=this.baseCrossLinePts.slice(),v=h/u,d=3,x=5;return c[d]=c[d]-v,c[x]=c[x]-v,c},collide:function(u,h,c,v,d,x,w){var g=s(i(this.points,c+2*w,v,d)),m=s(i(this.crossLinePts(c,x),c+2*w,v,d)),y=sn(u,h,g)||sn(u,h,m);return y},draw:function(u,h,c,v,d){var x=i(this.points,h,c,v),w=i(this.crossLinePts(h,d),h,c,v);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,h,c,v,d,x,w){var g=d,m=Math.pow(g.x-u,2)+Math.pow(g.y-h,2)<=Math.pow((c+2*w)*this.radius,2);return m},draw:function(u,h,c,v,d){e.arrowShapeImpl(this.name)(u,v.x,v.y,this.radius*h)},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,h=((e-s)/o-a.y)/l;return[u,h]};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,h=s.left+s.right,c=e.width/(o+h),v=o-l,d=a-u,x=e.left+i.left+s.left,w=e.top+i.top+s.top;return this.containerBB=[x,w,v,d,c]};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(),h=(n?24:8)/l,c=(n?8:2)/l,v=(n?8:2)/l,d=1/0,x,w;r&&(o=o.interactive);function g(T,k){if(T.isNode()){if(w)return;w=T,a.push(T)}if(T.isEdge()&&(k==null||k<d))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,d=k??d;break}}}else a.push(T),x=T,d=k??d}function m(T){var k=T.outerWidth()+2*c,N=T.outerHeight()+2*c,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 g(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+h,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(H3(t,e,U[W],U[W+1],U[W+2],U[W+3],D)&&j>(I=G3(t,e,U[W],U[W+1],U[W+2],U[W+3])))return g(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(U3(t,e,U[W],U[W+1],U[W+2],U[W+3],U[W+4],U[W+5],D)&&j>(I=$3(t,e,U[W],U[W+1],U[W+2],U[W+3],U[W+4],U[W+5])))return g(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,h)&&$.collide(t,e,P,G.angle,{x:G.x,y:G.y},ee,h))return g(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=v,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 g(T),!0}else if(qi(A,t,e))return g(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),h=Math.min(e,n),c=Math.max(e,n);t=l,r=u,e=h,n=c;var v=Kr({x1:t,y1:e,x2:r,y2:n}),d=[{x:v.x1,y:v.y1},{x:v.x2,y:v.y1},{x:v.x2,y:v.y2},{x:v.x1,y:v.y2}],x=[[d[0],d[1]],[d[1],d[2]],[d[2],d[3]],[d[3],d[0]]];function w(ce,de,Le){return Yr(ce,de,Le)}function g(ce,de){var Le=ce._private,ze=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,We=ke.x1-ze-Pe,Ye=ke.x2+ze-Pe,ge=ke.y1-ze-De,Ce=ke.y2+ze-De;if(Me){var Ae=Math.cos(Me),Fe=Math.sin(Me),me=function(te,oe){return te=te-Ne,oe=oe-Ee,{x:te*Ae-oe*Fe+Ne,y:te*Fe+oe*Ae+Ee}};return[me(We,ge),me(Ye,ge),me(Ye,Ce),me(We,Ce)]}else return[{x:We,y:ge},{x:Ye,y:ge},{x:Ye,y:Ce},{x:We,y:Ce}]}function m(ce,de,Le,ze){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,ze)!==_e(de,Le,ze)&&_e(ce,de,Le)!==_e(ce,de,ze)}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=g(_);B&&Ed(B,d)&&(a.push(_),M=!0)}!M&&Tw(v,N)&&a.push(_)}else if(E==="overlap"&&Jv(v,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,d))a.push(_);else{var D=g(_);D&&Ed(D,d)&&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(v,W.startX,W.startY)||W.endX!=null&&W.endY!=null&&!qi(v,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(v,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(v,W.startX,W.startY)||qi(v,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(v,$[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,h,c,v,d,m,y;if(r?(h=e.haystackPts[0],c=e.haystackPts[1],v=e.haystackPts[2],d=e.haystackPts[3]):(h=e.arrowStartX,c=e.arrowStartY,v=e.arrowEndX,d=e.arrowEndY),m=e.midX,y=e.midY,s)l=h-e.segpts[0],u=c-e.segpts[1];else if(i||o||a||n){var x=e.allpts,w=Cr(x[0],x[2],x[4],.1),g=Cr(x[1],x[3],x[5],.1);l=h-w,u=c-g}else l=h-m,u=c-y;e.srcArrowAngle=$u(l,u);var m=e.midX,y=e.midY;if(r&&(m=(h+v)/2,y=(c+d)/2),l=v-h,u=d-c,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=v-e.segpts[e.segpts.length-2],u=d-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),g=Cr(x[D-5],x[D-3],x[D-1],.9);l=v-w,u=d-g}else l=v-m,u=d-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)},uN=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},cN=function(e,r,n,i,s){if(e!==C1?E1(r,e,Xn):uN(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}:(cN(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,hN=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}},h=t.pstyle("edge-distances").value;switch(h){case"node-position":s=r;break;case"intersection":s=n;break;case"endpoints":{if(l){var c=this.manualEndptToPx(t.source()[0],o),v=pr(c,2),d=v[0],x=v[1],w=this.manualEndptToPx(t.target()[0],a),g=pr(w,2),m=g[0],y=g[1],b={x1:d,y1:x,x2:m,y2:y};i=u(d,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(),h=o.width(),c=a.width(),v=o.height(),d=a.height(),x=r.pstyle("haystack-radius").value,w=x/2;i.haystackPts=i.allpts=[i.source.x*h*w+l.x,i.source.y*v*w+l.y,i.target.x*c*w+u.x,i.target.y*d*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 h=0;h<a;h++){var c=n.pfValue[h],v=i.pfValue[h],d=1-c,x=c,w=this.findMidptPtsEtc(t,e),g=w.midptPts,m=w.vectorNormInverse,y={x:g.x1*d+g.x2*x,y:g.y1*d+g.y2*x};r.segpts.push(y.x+m.x*v,y.y+m.y*v),r.radii.push(s.pfValue[h]!==void 0?s.pfValue[h]:l),r.isArcRadius.push((o.pfValue[h]!==void 0?o.pfValue[h]: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,h=t.pstyle("loop-sweep").pfValue,c=t.pstyle("control-point-step-size").pfValue;i.edgeType="self";var v=r,d=c;n&&(v=0,d=l);var x=u-Math.PI/2,w=x-h/2,g=x+h/2,m=u+"_"+h;v=s[m]===void 0?s[m]=0:++s[m],i.ctrlpts=[o.x+Math.cos(w)*1.4*d*(v/3+1),o.y+Math.sin(w)*1.4*d*(v/3+1),o.x+Math.cos(g)*1.4*d*(v/3+1),o.y+Math.sin(g)*1.4*d*(v/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,h=e.tgtH,c=t.pstyle("control-point-step-size").pfValue,v=t.pstyle("control-point-distances"),d=v?v.pfValue[0]:void 0,x=r,w=c;n&&(x=0,w=d);var g=50,m={x:s.x-a/2,y:s.y-l/2},y={x:o.x-u/2,y:o.y-h/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(g,1.12)/100)*w*(x/3+1)*R,b.x-(1+Math.pow(g,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,h=a?a.pfValue[0]:void 0,c=l.value[0],v=n;s.edgeType=v?"multibezier":"bezier",s.ctrlpts=[];for(var d=0;d<u;d++){var x=(.5-e.eles.length/2+r)*o*(i?-1:1),w=void 0,g=Zv(x);v&&(h=a?a.pfValue[d]:o,c=l.value[d]),n?w=h:w=h!==void 0?g*h:void 0;var m=w!==void 0?w:x,y=1-c,b=c,_=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",h=e.posPts,c=e.srcW,v=e.srcH,d=e.tgtW,x=e.tgtH,w=t.pstyle("edge-distances").value,g=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=g?(c+d)/2:0,N=g?(v+x)/2:0,M=h.x2-h.x1,B=h.y2-h.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)<=v/2,K=Math.abs(M)<=d/2;if(q){var X=(h.x1+h.x2)/2,J=h.y1,ie=h.y2;r.segpts=[X,J,X,ie]}else if(K){var ce=(h.y1+h.y2)/2,de=h.x1,Le=h.x2;r.segpts=[de,ce,Le,ce]}else r.segpts=[h.x1,h.y2]}else{var ze=Math.abs(H)<=c/2,_e=Math.abs(B)<=x/2;if(ze){var ke=(h.y1+h.y2)/2,Ne=h.x1,Ee=h.x2;r.segpts=[Ne,ke,Ee,ke]}else if(_e){var Me=(h.x1+h.x2)/2,Pe=h.y1,De=h.y2;r.segpts=[Me,Pe,Me,De]}else r.segpts=[h.x2,h.y1]}else if(U){var We=h.y1+F+(g?v/2*z:0),Ye=h.x1,ge=h.x2;r.segpts=[Ye,We,ge,We]}else{var Ce=h.x1+F+(g?c/2*z:0),Ae=h.y1,Fe=h.y2;r.segpts=[Ce,Ae,Ce,Fe]}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,h=e.tgtShape,c=e.srcCornerRadius,v=e.tgtCornerRadius,d=e.srcRs,x=e.tgtRs,w=!Xe(r.startX)||!Xe(r.startY),g=!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||g||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,c,d);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=h.intersectLine(i.x,i.y,a,l,F.x,F.y,0,v,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 h=e.segpts.length/2-1;if(!e.isRound)e.midX=e.segpts[h],e.midY=e.segpts[h+1];else{var c={x:e.segpts[h],y:e.segpts[h+1]},v=e.roundCorners[h/2];if(v.radius===0){var d={x:e.segpts[h+2],y:e.segpts[h+3]};e.midX=c.x,e.midY=c.y,e.midVector=[c.y-d.y,d.x-c.x]}else{var x=[c.x-v.cx,c.y-v.cy],w=v.radius/Math.sqrt(Math.pow(x[0],2)+Math.pow(x[1],2));x=x.map(function(g){return g*w}),e.midX=v.cx+x[0],e.midY=v.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 h=t[u],c=h._private,v=h.pstyle("curve-style").value;if(!(h.removed()||!h.takesUpSpace())){if(v==="haystack"){l.push(h);continue}var d=v==="unbundled-bezier"||Gi(v,"segments")||v==="straight"||v==="straight-triangle"||Gi(v,"taxi"),x=v==="unbundled-bezier"||v==="bezier",w=c.source,g=c.target,m=w.poolIndex(),y=g.poolIndex(),b=[m,y].sort(),_=o(b,d),R=s.get(_);R==null&&(R={eles:[]},a.push({pairId:b,edgeIsUnbundled:d}),s.set(_,R)),R.eles.push(h),d&&(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,ze=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},We=Ee[1]-ke[1],Ye=Ee[0]-ke[0],ge=Math.sqrt(Ye*Ye+We*We);Xe(ge)&&ge>=hN||(ge=Math.sqrt(Math.max(Ye*Ye,yl)+Math.max(We*We,yl)));var Ce=j.vector={x:Ye,y:We},Ae=j.vectorNorm={x:Ce.x/ge,y:Ce.y/ge},Fe={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=Fe,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:-Fe.x,y:-Fe.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,ze):W===H?e.findLoopPoints(ce,me,ie,ze):Le.endsWith("segments")?e.findSegmentsPoints(ce,me):Le.endsWith("taxi")?e.findTaxiPoints(ce,me):Le==="straight"||!ze&&j.eles.length%2===1&&ie===Math.floor(j.eles.length/2)?e.findStraightEdgePoints(ce):e.findBezierPoints(ce,me,ie,ze,_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),h=[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,h[0],h[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(),h=l.position(),c=t.pstyle("target-arrow-shape").value,v=t.pstyle("source-arrow-shape").value,d=t.pstyle("target-distance-from-node").pfValue,x=t.pstyle("source-distance-from-node").pfValue,w=a._private.rscratch,g=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):[h.x+G[0],h.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=[h.x,h.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(h.x,h.y,l.outerWidth(),l.outerHeight(),P[0],P[1],0,W,g),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 ze=l.pstyle("text-halign").value;ze=Us(ze),ze==="left"?J-=ce:ze==="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],h.x,h.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[c].spacing(t)+d),We=Gu(o,H,s.arrowShapes[c].gap(t)+d);if(y.endX=We[0],y.endY=We[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=[h.x,h.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,Fe=Ye.labelY,me=ge/2,Z=Ce/2,te=a.pstyle("text-valign").value;te=Ws(te),te==="top"?Fe-=Z:te==="bottom"&&(Fe+=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,Fe-Z,Ae+me,Fe-Z,Ae+me,Fe+Z,Ae-me,Fe+Z],u.x,u.y);if(ue.length>0){var se=h,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[v].spacing(t)+x),Re=Gu(o,z,s.arrowShapes[v].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 fN(t,e,r){for(var n=function(u,h,c,v){return Cr(u,h,c,v)},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)fN(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,h=t.pstyle("text-valign").strValue,c=i.rscratch,v=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(h){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}c.labelX=r,c.labelY=n,v.labelX=r,v.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)},dN=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(c,v,d){Qn(r.rscratch,c,v,d),Qn(r.rstyle,c,v,d)};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 c=[],v=0;v+5<n.allpts.length;v+=4){var d={x:n.allpts[v],y:n.allpts[v+1]},x={x:n.allpts[v+2],y:n.allpts[v+3]},w={x:n.allpts[v+4],y:n.allpts[v+5]};c.push({p0:d,p1:x,p2:w,startDist:0,length:0,segments:[]})}var g=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<c.length;b++){var _=c[b],R=c[b-1];R&&(_.startDist=R.startDist+R.length),y(_,_.p0,g[b*m],0,i.bezierProjPcts[0]);for(var E=0;E<m-1;E++)y(_,g[b*m+E],g[b*m+E+1],i.bezierProjPcts[E],i.bezierProjPcts[E+1]);y(_,g[b*m+m-1],_.p2,i.bezierProjPcts[m-1],1)}return l.cache=c},u=function(c){var v,d=c==="source";if(s[c]){var x=t.pstyle(c+"-text-offset").pfValue;switch(n.edgeType){case"self":case"compound":case"bezier":case"multibezier":{for(var w=l(),g,m=0,y=0,b=0;b<w.length;b++){for(var _=w[d?b:w.length-1-b],R=0;R<_.segments.length;R++){var E=_.segments[d?R:_.segments.length-1-R],T=b===w.length-1&&R===_.segments.length-1;if(m=y,y+=E.length,y>=x||T){g={cp:_,segment:E};break}}if(g)break}var k=g.cp,N=g.segment,M=(x-m)/N.length,B=N.t1-N.t0,A=d?N.t0+B*M:N.t1-B*M;A=fl(0,A,1),e=Is(k.p0,k.p1,k.p2,A),v=dN(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&&(d?(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=P3(U,W,F),v=k_(U,W);break}}o("labelX",c,e.x),o("labelY",c,e.y),o("labelAutoAngle",c,v)}};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)||[],h=l!=="wrap"?1:Math.max(u.length,1),c=a*o,v=s.width,d=s.height+(h-1)*(o-1)*a;Qn(r.rstyle,"labelWidth",e,v),Qn(r.rscratch,"labelWidth",e,v),Qn(r.rstyle,"labelHeight",e,d),Qn(r.rscratch,"labelHeight",e,d),Qn(r.rscratch,"labelLineHeight",e,c),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="",h=i.split(`
|
|
59
|
+
`),c=t.pstyle("text-max-width").pfValue,v=t.pstyle("text-overflow-wrap").value,d=v==="anywhere",x=[],w=/[\s\u200b]+|$/g,g=0;g<h.length;g++){var m=h[g],y=this.calculateLabelDimensions(t,m),b=y.width;if(d){var _=m.split("").join(u);m=_}if(b>c){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<=c?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()?eL(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,h=t.pstyle("text-metrics").strValue||"font",c=this.labelCalcCanvas,v=this.labelCalcCanvasContext;if(!c){c=this.labelCalcCanvas=i.createElement("canvas"),v=this.labelCalcCanvasContext=c.getContext("2d");var d=c.style;d.position="absolute",d.left="-9999px",d.top="-9999px",d.zIndex="-1",d.visibility="hidden",d.pointerEvents="none"}v.font="".concat(o," ").concat(u," ").concat(a,"px ").concat(l);for(var x=0,w=0,g=e.split(`
|
|
61
|
+
`),m=g.length,y=0,b=0,_=0;_<m;_++){var R=g[_],E=v.measureText(R),T=Math.ceil(E.width),k=a;h==="glyph"&&(_===0&&(b=E.actualBoundingBoxAscent),_===m-1&&(y=E.actualBoundingBoxDescent)),x=Math.max(T,x),w+=k}return h==="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],h=u._private,c=h.rstyle;c.clean=!1,c.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],h=u._private.rstyle;u.isNode()&&!h.cleanConnected&&(n(u.connectedEdges()),h.cleanConnected=!0)}if(a)for(var c=0;c<a.length;c++){var v=a[c];v(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 h=i[u],c=h._private,v=c.rstyle,d=h.position();this.recalculateNodeLabelProjection(h),v.nodeX=d.x,v.nodeY=d.y,v.nodeW=h.pstyle("width").pfValue,v.nodeH=h.pstyle("height").pfValue}this.recalculateEdgeProjections(n);for(var x=0;x<n.length;x++){var w=n[x],g=w._private,m=g.rstyle,y=g.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))},pN=function(e){N_(e,!0)},vN=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||Ck(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,h){var c=Array.prototype.slice.call(arguments);return n&&e.supportsPassiveEvents&&(c[2]={capture:h??!1,passive:!1,once:!1}),e.bindings.push({target:t,args:c}),(t.addEventListener||t.on).apply(t,c),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},h=function(Z){Z[0]._private.rscratch.isGrabTarget=!1},c=function(Z,te){var oe=te.addToList,ue=oe.has(Z);!ue&&Z.grabbable()&&!Z.locked()&&(oe.merge(Z),pN(Z))},v=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&&c(oe,te)}},d=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){c(ue,te)}),v(Z,te),g(Z,{inDragLayer:te.inDragLayer}),t.updateCachedGrabbedEles()},x=d,w=function(Z){Z&&(t.getCachedZSortedEles().forEach(function(te){vN(te),l(te),h(te)}),t.updateCachedGrabbedEles())},g=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){c(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,He=Z.target,je=He.parentNode,Ge=!1;je;){if(je===Re){Ge=!0;break}je=je.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 He=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 je=te.$(function(Ge){return Ge.isNode()&&Ge.selected()&&t.nodeIsGrabbable(Ge)});d(je,{addToList:be}),pe.emit(Se("grabon")),je.forEach(He)}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 He=t.hoverData.last,je=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");je?je.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&&(je==null||je.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(je,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())}je&&je.pannable()&&je.active()&&je.unactivate()}}else{if(je&&je.pannable()&&je.active()&&je.unactivate(),(!je||!je.grabbed())&&Re!=He&&(He&&i(He,["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),je)if(Ze){if(ue.boxSelectionEnabled()&&st)je&&je.grabbed()&&(w(it),je.emit(yt("freeon")),it.emit(yt("free")),t.dragData.didDrag&&(je.emit(yt("dragfreeon")),it.emit(yt("dragfree")))),Rt();else if(je&&je.grabbed()&&t.nodeIsDraggable(je)){var ur=!t.dragData.didDrag;ur&&t.redrawHint("eles",!0),t.dragData.didDrag=!0,t.hoverData.draggingEles||d(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 He=Te("cxttap");be?be.emit(He):oe.emit(He)}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 je=oe.collection(t.getAllInBox(se[0],se[1],se[2],se[3]));t.redrawHint("select",!0),je.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(je).unselect(),je.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 He;te&&Math.abs(oe)>5&&(oe=Zv(oe)*5),He=oe/-250,I&&(He/=U,He*=3),He=He*t.wheelSensitivity;var je=Z.deltaMode===1;je&&(He*=33);var Ge=pe.zoom()*Math.pow(10,He);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 He=t.findNearestElement(oe[0],oe[1],!0,!0),je=t.findNearestElement(oe[2],oe[3],!0,!0);He&&He.isNode()?(He.activate().emit(he("cxttapstart")),t.touchData.start=He):je&&je.isNode()?(je.activate().emit(he("cxttapstart")),t.touchData.start=je):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)}),d(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 ze;t.registerBinding(e,"touchmove",ze=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 He=[],je=0;je<se.length;je++)He[je]=se[je]-he[je];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&&d(At,{inDragLayer:!0}),t.dragData.didDrag=!0;var cr={x:0,y:0};if(Xe(He[0])&&Xe(He[1])&&(cr.x+=He[0],cr.y+=He[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(He[0]),cn.push(He[1])):(cn[0]+=He[0],cn[1]+=He[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:He[0]*pe,y:He[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 je=0;je<se.length;je++)he[je]=se[je];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 He=Te("cxttap");te?te.emit(He):se.emit(He)}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 je=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()};je.emit(Te("box")).stdFilter(Ge).select().emit(Te("boxselect")),je.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}},We=function(Z){return{event:Z,touch:De(Z)}},Ye=function(Z){Pe.push(We(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})},Fe=function(Z){return Z.pointerType==="mouse"||Z.pointerType===4};t.registerBinding(t.container,"pointerdown",function(me){Fe(me)||(me.preventDefault(),Ye(me),Ae(me),Le(me))}),t.registerBinding(t.container,"pointerup",function(me){Fe(me)||(ge(me),Ae(me),ke(me))}),t.registerBinding(t.container,"pointercancel",function(me){Fe(me)||(ge(me),Ae(me),_e(me))}),t.registerBinding(t.container,"pointermove",function(me){Fe(me)||(me.preventDefault(),Ce(me),Ae(me),ze(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,h){return dl(a,l,this.points,n,i,s/2,o/2,u)},checkPoint:function(n,i,s,o,a,l,u,h){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 z3(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 Y3(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 h=s/2,c=o/2;a=a==="auto"?Nw(s,o):a;for(var v=new Array(e.length/2),d=0;d<e.length/2;d++)v[d]={x:n+h*e[d*2],y:i+c*e[d*2+1]};var x,w,g,m,y=v.length;for(w=v[y-1],x=0;x<y;x++)g=v[x%y],m=v[(x+1)%y],l[u][x]=hg(w,g,m,a),w=g,g=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,h,c){return K3(a,l,this.points,n,i,s,o,u,this.getOrCreateCorners(n,i,s,o,h,c,"corners"))},checkPoint:function(n,i,s,o,a,l,u,h,c){return q3(n,i,this.points,l,u,o,a,this.getOrCreateCorners(l,u,o,a,h,c,"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,h=s/2;l=l==="auto"?Ji(i,s):l,l=Math.min(u,h,l);var c=l*2;return!!(gi(e,r,this.points,o,a,i,s-c,[0,-1],n)||gi(e,r,this.points,o,a,i-c,s,[0,-1],n)||Ma(e,r,c,c,o-u+l,a-h+l,n)||Ma(e,r,c,c,o+u-l,a-h+l,n)||Ma(e,r,c,c,o+u-l,a+h-l,n)||Ma(e,r,c,c,o-u+l,a+h-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,h=n+l,c=i-a,v=i+a;return{topLeft:[u,c+o,u+o,c,u+o,c+o],topRight:[h-o,c,h,c+o,h-o,c+o],bottomRight:[h,v-o,h-o,v,h-o,v-o],bottomLeft:[u+o,v,u,v-o,u+o,v-o]}},intersectLine:function(e,r,n,i,s,o,a,l){var u=this.generateCutTrianglePts(n+2*a,i+2*a,e,r,l),h=[].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,h,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 h=this.generateCutTrianglePts(i,s,o,a);return sn(e,r,h.topLeft)||sn(e,r,h.topRight)||sn(e,r,h.bottomRight)||sn(e,r,h.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,h=.5,c=.85,v=this.generateBarrelBezierPts(n+2*a,i+2*a,e,r),d=function(g){var m=Is({x:g[0],y:g[1]},{x:g[2],y:g[3]},{x:g[4],y:g[5]},u),y=Is({x:g[0],y:g[1]},{x:g[2],y:g[3]},{x:g[4],y:g[5]},h),b=Is({x:g[0],y:g[1]},{x:g[2],y:g[3]},{x:g[4],y:g[5]},c);return[g[0],g[1],m.x,m.y,y.x,y.y,b.x,b.y,g[4],g[5]]},x=[].concat(d(v.topLeft),d(v.topRight),d(v.bottomRight),d(v.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,h=i+s,c=cv(e,r),v=c.heightOffset,d=c.widthOffset,x=c.ctrlPtOffsetPct*e,w={topLeft:[a,u+v,a+x,u,a+d,u],topRight:[l-d,u,l-x,u,l,u+v],bottomRight:[l,h-v,l-x,h,l-d,h],bottomLeft:[a+d,h,a+x,h,a,h-v]};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),h=u.heightOffset,c=u.widthOffset;if(gi(e,r,this.points,o,a,i,s-2*h,[0,-1],n)||gi(e,r,this.points,o,a,i-2*c,s,[0,-1],n))return!0;for(var v=this.generateBarrelBezierPts(i,s,o,a),d=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=Q3(B,A,j),F=W3(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(v),w=0;w<x.length;w++){var g=x[w],m=v[g],y=d(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),h=r-(i/2+a),c=h,v=e+(n/2+a),d=Yi(s,o,e,r,u,h,v,c,!1);return d.length>0?d: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 h=i/2+2*n,c=s/2+2*n,v=[o-h,a-c,o-h,a,o+h,a,o+h,a-c];return!!(sn(e,r,v)||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 h=u.join("$"),c="polygon-"+h,v;return(v=this[c])?v:e.generatePolygon(c,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 gN=function(e){this.init(e)},D_=gN,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 h=n.getComputedStyle(r),c=h.getPropertyValue("position");c==="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,h){var c=vi(),v=i.averageRedrawTime,d=i.lastRedrawTime,x=[],w=i.cy.extent(),g=i.getPixelRatio();for(u||i.flushRenderedStyleQueue();;){var m=vi(),y=m-c,b=m-h;if(d<Rp){var _=Rp-(u?v:0);if(b>=e.deqFastCost*_)break}else if(u){if(y>=e.deqCost*d||y>=e.deqAvgCost*v)break}else if(b>=e.deqNoDrawCost*Rp)break;var R=e.deq(n,g,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,g,w)&&s())},a=e.priority||Xv;i.beforeRender(o,a(n))}}}},mN=(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,yN=8,xN=1024,bN=1024,wN=1024,_N=.2,SN=.8,CN=10,EN=.15,kN=.1,TN=.9,RN=.9,LN=100,NN=1,Ps={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},DN=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=DN(r);dt(n,i),n.lookup=new mN(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),h=e.h*u,c=e.w*u,v=o.eleTextBiggerThanMin(t,u);if(!this.isVisible(t,v))return null;var d=l.get(t,n);if(d&&d.invalidated&&(d.invalidated=!1,d.texture.invalidatedWidth-=d.width),d)return d;var x;if(h<=L1?x=L1:h<=ec?x=ec:x=Math.ceil(h/ec)*ec,h>wN||c>bN)return null;var w=s.getTextureQueue(x),g=w[w.length-2],m=function(){return s.recycleTexture(x,c)||s.addTexture(x,c)};g||(g=w[w.length-1]),g||(g=m()),g.width-g.usedWidth<c&&(g=m());for(var y=function(U){return U&&U.scaledLabelShown===v},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(){g.context.drawImage(N.texture.canvas,N.x,0,N.width,N.height,g.usedWidth,0,c,h)};if(g.context.setTransform(1,0,0,1,0,0),g.context.clearRect(g.usedWidth,0,c,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;g.context.translate(g.usedWidth,0),g.context.scale(u,u),this.drawElement(g.context,t,e,v,!1),g.context.scale(1/u,1/u),g.context.translate(-g.usedWidth,0)}return d={x:g.usedWidth,texture:g,level:n,scale:u,width:c,height:h,scaledLabelShown:v},g.usedWidth+=Math.ceil(c+yN),g.eleCaches.push(d),l.set(t,n,d),s.checkTextureFullness(g),d};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],h=u.texture;h.invalidatedWidth+=u.width,u.invalidated=!0,e.checkTextureUtility(h)}e.removeFromQueue(t)}};br.checkTextureUtility=function(t){t.invalidatedWidth>=_N*t.width&&this.retireTexture(t)};br.checkTextureFullness=function(t){var e=this,r=e.getTextureQueue(t.height);t.usedWidth/t.width>SN&&t.fullnessChecks>=CN?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(xN,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<NN&&r.size()>0;o++){var a=r.pop(),l=a.key,u=a.eles[0],h=s.hasCache(u,a.level);if(n[l]=null,h)continue;i.push(a);var c=e.getBoundingBox(u);e.getElement(u,c,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:LN,deqCost:EN,deqAvgCost:kN,deqNoDrawCost:TN,deqFastCost:RN,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 AN=1,nl=-4,Ic=2,MN=3.99,PN=50,IN=50,ON=.15,BN=.1,FN=.9,jN=.9,zN=1,N1=250,HN=4e3*4e3,D1=32767,UN=!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)},IN),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,WN=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%WN,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>=MN||r>Ic)return null}n.validateLayersElesOrdering(r,t);var l=n.layersByLevel,u=Math.pow(2,r),h=l[r]=l[r]||[],c,v=n.levelIsComplete(r,t),d,x=function(){var M=function(I){if(n.validateLayersElesOrdering(I,t),n.levelIsComplete(I,t))return d=l[I],!0},B=function(I){if(!d)for(var U=r+I;nl<=U&&U<=Ic&&!M(U);U+=I);};B(1),B(-1);for(var A=h.length-1;A>=0;A--){var j=h[A];j.invalid&&Zi(h,j)}};if(!v)x();else return h;var w=function(){if(!c){c=Kr();for(var M=0;M<t.length;M++)B3(c,t[M].boundingBox())}return c},g=function(M){M=M||{};var B=M.after;w();var A=Math.ceil(c.w*u),j=Math.ceil(c.h*u);if(A>D1||j>D1)return null;var D=A*j;if(D>HN)return null;var I=n.makeLayer(c,r);if(B!=null){var U=h.indexOf(B)+1;h.splice(U,0,I)}else(M.insert===void 0||M.insert)&&h.unshift(I);return I};if(n.skipping&&!a)return null;for(var m=null,y=t.length/AN,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=g({insert:!0,after:m}),!m))return null;d||b?n.queueLayer(m,R):n.drawEleInLayer(m,R,r,e),m.eles.push(R),T[r]=m}return d||(b?null:h)};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,UN),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 h=l[u];h&&(s&&r.getEleLevelForLayerLevel(h.level)!==s.level||e(h,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<zN&&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:PN,deqCost:ON,deqAvgCost:BN,deqNoDrawCost:FN,deqFastCost:jN,deq:function(e,r){return e.dequeue(r)},onDeqd:Xv,shouldRedraw:ww,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var I_={},M1;function VN(t,e){for(var r=0;r<e.length;r++){var n=e[r];t.lineTo(n.x,n.y)}}function $N(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 GN(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 qN(t,e,r,n){t.arc(e,r,n,0,Math.PI*2,!1)}I_.arrowShapeImpl=function(t){return(M1||(M1={polygon:VN,"triangle-backcurve":$N,"triangle-tee":P1,"circle-triangle":GN,"triangle-cross":P1,circle:qN}))[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 h=r.getElement(e,u,n,i,s);if(h!=null){var c=a(l,e);if(c===0)return;var v=o(l,e),d=u.x1,x=u.y1,w=u.w,g=u.h,m,y,b,_,R;if(v!==0){var E=r.getRotationPoint(e);b=E.x,_=E.y,t.translate(b,_),t.rotate(v),R=l.getImgSmoothing(t),R||l.setImgSmoothing(t,!0);var T=r.getRotationOffset(e);m=T.x,y=T.y}else m=d,y=x;var k;c!==1&&(k=t.globalAlpha,t.globalAlpha=k*c),t.drawImage(h.texture.canvas,h.x,0,h.width,h.height,m,y,w,g),c!==1&&(t.globalAlpha=k),v!==0&&(t.rotate(-v),t.translate(-b,-_),R||l.setImgSmoothing(t,!1))}else r.drawElement(t,e)}};var YN=function(){return 0},XN=function(e,r){return e.getTextAngle(r,null)},KN=function(e,r){return e.getTextAngle(r,"source")},QN=function(e,r){return e.getTextAngle(r,"target")},ZN=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,h=a.slbTxrCache,c=a.tlbTxrCache,v=e.boundingBox(),d=s===!0?l.reasons.highQuality:null;if(!(v.w===0||v.h===0||!e.visible())&&(!n||Jv(v,n))){var x=e.isEdge(),w=e.element()._private.rscratch.badLine;o.drawElementUnderlay(t,e),o.drawCachedElementPortion(t,e,l,r,i,d,YN,ZN),(!x||!w)&&o.drawCachedElementPortion(t,e,u,r,i,d,XN,Lp),x&&!w&&(o.drawCachedElementPortion(t,e,h,r,i,d,KN,Lp),o.drawCachedElementPortion(t,e,c,r,i,d,QN,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,h=s?e.pstyle("line-opacity").value:1,c=e.pstyle("curve-style").value,v=e.pstyle("line-style").value,d=e.pstyle("width").pfValue,x=e.pstyle("line-cap").value,w=e.pstyle("line-outline-width").value,g=e.pstyle("line-outline-color").value,m=u*h,y=u*h,b=function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:m;c==="straight-triangle"?(o.eleStrokeStyle(t,e,I),o.drawEdgeTrianglePath(e,t,a.allpts)):(t.lineWidth=d,t.lineCap=x,o.eleStrokeStyle(t,e,I),o.drawEdgePath(e,t,a.allpts,v),t.lineCap="butt")},_=function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:m;if(t.lineWidth=d+w,t.lineCap=x,w>0)o.colorStrokeStyle(t,g[0],g[1],g[2],I);else{t.lineCap="butt";return}c==="straight-triangle"?o.drawEdgeTrianglePath(e,t,a.allpts):(o.drawEdgePath(e,t,a.allpts,v),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,h=n.pstyle("".concat(e,"-color")).value;r.lineWidth=u,a.edgeType==="self"&&!o?r.lineCap="butt":r.lineCap="round",s.colorStrokeStyle(r,h[0],h[1],h[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,h=t.pstyle("line-dash-offset").pfValue;if(l){var c=r.join("$"),v=i.pathCacheKey&&i.pathCacheKey===c;v?(o=e=i.pathCache,a=!0):(o=e=new Path2D,i.pathCacheKey=c,i.pathCache=o)}if(s.setLineDash)switch(n){case"dotted":s.setLineDash([1,1]);break;case"dashed":s.setLineDash(u),s.lineDashOffset=h;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 d=2;d+3<r.length;d+=4)e.quadraticCurveTo(r[d],r[d+1],r[d+2],r[d+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),g;try{for(w.s();!(g=w.n()).done;){var m=g.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",h=e.pstyle(r+"-arrow-fill").value,c=e.pstyle("width").pfValue,v=e.pstyle(r+"-arrow-width"),d=v.value==="match-line"?c:v.pfValue;v.units==="%"&&(d*=c);var x=e.pstyle("opacity").value;o===void 0&&(o=x);var w=t.globalCompositeOperation;(o!==1||h==="hollow")&&(t.globalCompositeOperation="destination-out",a.colorFillStyle(t,255,255,255,1),a.colorStrokeStyle(t,255,255,255,1),a.drawArrowShape(e,t,u,c,l,d,n,i,s),t.globalCompositeOperation=w);var g=e.pstyle(r+"-arrow-color").value;a.colorFillStyle(t,g[0],g[1],g[2],o),a.colorStrokeStyle(t,g[0],g[1],g[2],o),a.drawArrowShape(e,t,h,c,l,d,n,i,s)}}};yi.drawArrowShape=function(t,e,r,n,i,s,o,a,l){var u=this,h=this.usePaths()&&i!=="triangle-cross",c=!1,v,d=e,x={x:o,y:a},w=t.pstyle("arrow-scale").value,g=this.getArrowWidth(n,w),m=u.arrowShapes[i];if(h){var y=u.arrowPathCache=u.arrowPathCache||[],b=Oa(i),_=y[b];_!=null?(v=e=_,c=!0):(v=e=new Path2D,y[b]=v)}c||(e.beginPath&&e.beginPath(),h?m.draw(e,1,0,{x:0,y:0},1):m.draw(e,g,l,x,n),e.closePath&&e.closePath()),e=d,h&&(e.translate(o,a),e.rotate(l),e.scale(g,g)),(r==="filled"||r==="both")&&(h?e.fill(v):e.fill()),(r==="hollow"||r==="both")&&(e.lineWidth=s/(h?g:1),e.lineJoin="miter",h?e.stroke(v):e.stroke()),h&&(e.scale(1/g,1/g),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(h){Bt(h)}};dg.drawInscribedImage=function(t,e,r,n,i){var s=this,o=r.position(),a=o.x,l=o.y,u=r.cy().style(),h=u.getIndexedStyle.bind(u),c=h(r,"background-fit","value",n),v=h(r,"background-repeat","value",n),d=r.width(),x=r.height(),w=r.padding()*2,g=d+(h(r,"background-width-relative-to","value",n)==="inner"?0:w),m=x+(h(r,"background-height-relative-to","value",n)==="inner"?0:w),y=r._private.rscratch,b=h(r,"background-clip","value",n),_=b==="node",R=h(r,"background-image-opacity","value",n)*i,E=h(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(h(r,"background-width","value",n)!=="auto"&&(h(r,"background-width","units",n)==="%"?M=h(r,"background-width","pfValue",n)*g:M=h(r,"background-width","pfValue",n)),h(r,"background-height","value",n)!=="auto"&&(h(r,"background-height","units",n)==="%"?B=h(r,"background-height","pfValue",n)*m:B=h(r,"background-height","pfValue",n)),!(M===0||B===0)){if(c==="contain"){var A=Math.min(g/M,m/B);M*=A,B*=A}else if(c==="cover"){var A=Math.max(g/M,m/B);M*=A,B*=A}var j=a-g/2,D=h(r,"background-position-x","units",n),I=h(r,"background-position-x","pfValue",n);D==="%"?j+=(g-M)*I:j+=I;var U=h(r,"background-offset-x","units",n),W=h(r,"background-offset-x","pfValue",n);U==="%"?j+=(g-M)*W:j+=W;var H=l-m/2,z=h(r,"background-position-y","units",n),P=h(r,"background-position-y","pfValue",n);z==="%"?H+=(m-B)*P:H+=P;var F=h(r,"background-offset-y","units",n),G=h(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),v==="no-repeat")_&&(t.save(),y.pathCache?t.clip(y.pathCache):(s.nodeShapes[s.getNodeShape(r)].draw(t,a,l,g,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,v);t.fillStyle=ne,s.nodeShapes[s.getNodeShape(r)].draw(t,a,l,g,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 h=e.element()._private.rscratch.badLine,c=e.pstyle("label"),v=e.pstyle("source-label"),d=e.pstyle("target-label");if(h||(!c||!c.value)&&(!v||!v.value)&&(!d||!d.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,h=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,h[0],h[1],h[2],l)};function JN(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),h,c,v=this.getLabelText(e,r);if(v!=null&&v!==""&&!isNaN(l)&&!isNaN(u)){this.setupTextStyle(t,e,i);var d=r?r+"-":"",x=Yr(o,"labelWidth",r),w=Yr(o,"labelHeight",r),g=Yr(o,"labelActualDescent",r),m=e.pstyle(d+"text-margin-x").pfValue,y=e.pstyle(d+"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&&(h=l,c=u,t.translate(h,c),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(),JN(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-=g,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(v,l,u),t.fillText(v,l,u);E!==0&&(t.rotate(-E),t.translate(-h,-c))}}};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,h=u.rscratch,c=e.position();if(!(!Xe(c.x)||!Xe(c.y))&&!(s&&!e.visible())){var v=s?e.effectiveOpacity():1,d=o.usePaths(),x,w=!1,g=e.padding();a=e.width()+2*g,l=e.height()+2*g;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*v,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*v,G=e.pstyle("outline-width").pfValue,$=e.pstyle("outline-color").value,ee=e.pstyle("outline-style").value,re=e.pstyle("outline-opacity").value*v,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,h.pathCache=be):(be=new Path2D,se[he]=h.pathCache=be),{path:be,cacheHit:Se}},ie=e.pstyle("shape").strValue,ce=e.pstyle("shape-polygon-points").pfValue;if(d){t.translate(c.x,c.y);var de=J(a,l,ie,ce);x=de.path,w=de.cacheHit}var Le=function(){if(!w){var Z=c;d&&(Z={x:0,y:0}),o.nodeShapes[o.getNodeShape(e)].draw(x||t,Z.x,Z.y,a,l,Y,h)}d?t.fill(x):t.fill()},ze=function(){for(var Z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:v,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]:v;o.hasPie(e)&&(o.drawPie(t,e,te),Z&&(d||o.nodeShapes[o.getNodeShape(e)].draw(t,c.x,c.y,a,l,Y,h)))},ke=function(){var Z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:v;o.hasStripe(e)&&(t.save(),d?t.clip(h.pathCache):(o.nodeShapes[o.getNodeShape(e)].draw(t,c.x,c.y,a,l,Y,h),t.clip()),o.drawStripe(t,e,te),t.restore(),Z&&(d||o.nodeShapes[o.getNodeShape(e)].draw(t,c.x,c.y,a,l,Y,h)))},Ne=function(){var Z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:v,te=(B>0?B:-B)*Z,oe=B>0?0:255;B!==0&&(o.colorFillStyle(t,oe,oe,oe,te),d?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")d?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")}d?t.stroke(x):t.stroke(),t.restore()}else d?t.stroke(x):t.stroke();if(I==="double"){t.lineWidth=A/3;var te=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",d?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=c;d&&(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(d){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,He=0,je=0;te==="round-diamond"?Re=(oe+ne+G)*1.4:te==="round-heptagon"?(Re=(oe+ne+G)*1.075,je=-(oe/2+ne+G)/35):te==="round-hexagon"?Re=(oe+ne+G)*1.12:te==="round-pentagon"?(Re=(oe+ne+G)*1.13,je=-(oe/2+ne+G)/15):te==="round-tag"?(Re=(oe+ne+G)*1.12,He=(oe/2+G+ne)*.07):te==="round-triangle"&&(Re=(oe+ne+G)*(Math.PI/2),je=-(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+He+Ge*be[Qe*2],y:Z.y+je+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+He,Z.y+je,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(d?t.stroke(Se):t.stroke(),ee==="double"){t.lineWidth=oe/3;var kt=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",d?t.stroke(Se):t.stroke(),t.globalCompositeOperation=kt}t.setLineDash&&t.setLineDash([])}},Pe=function(){i&&o.drawNodeOverlay(t,e,c,a,l)},De=function(){i&&o.drawNodeUnderlay(t,e,c,a,l)},We=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,Fe=Ae*v;t.translate(ge,Ce),X(),Me(),q(Ae*j),Le(),ze(Fe,!0),K(Ae*F),Ee(),_e(B!==0||A!==0),ke(B!==0||A!==0),ze(Fe,!1),Ne(Fe),t.translate(-ge,-Ce)}d&&t.translate(-c.x,-c.y),De(),d&&t.translate(c.x,c.y),X(),Me(),q(),Le(),ze(v,!0),K(),Ee(),_e(B!==0||A!==0),ke(B!==0||A!==0),ze(v,!1),Ne(),d&&t.translate(-c.x,-c.y),We(),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,h=n.pstyle("".concat(e,"-color")).value,c=n.pstyle("".concat(e,"-shape")).value,v=n.pstyle("".concat(e,"-corner-radius")).value;if(u>0){if(i=i||n.position(),s==null||o==null){var d=n.padding();s=n.width()+2*d,o=n.height()+2*d}a.colorFillStyle(r,h[0],h[1],h[2],u),a.nodeShapes[c].draw(r,i.x,i.y,s+l*2,o+l*2,v),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,h=e.width(),c=e.height(),v=Math.min(h,c)/2,d,x=0,w=this.usePaths();if(w&&(l=0,u=0),s.units==="%"?v=v*s.pfValue:s.pfValue!==void 0&&(v=s.pfValue/2),o.units==="%"?d=v*o.pfValue:o.pfValue!==void 0&&(d=o.pfValue/2),!(d>=v))for(var g=1;g<=i.pieBackgroundN;g++){var m=e.pstyle("pie-"+g+"-background-size").value,y=e.pstyle("pie-"+g+"-background-color").value,b=e.pstyle("pie-"+g+"-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||(d===0?(t.beginPath(),t.moveTo(l,u),t.arc(l,u,v,R,T),t.closePath()):(t.beginPath(),t.arc(l,u,v,R,T),t.arc(l,u,d,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,h=this.usePaths();t.save();var c=e.pstyle("stripe-direction").value,v=e.pstyle("stripe-size");switch(c){case"vertical":break;case"righward":t.rotate(-Math.PI/2);break}var d=a,x=l;v.units==="%"?(d=d*v.pfValue,x=x*v.pfValue):v.pfValue!==void 0&&(d=v.pfValue,x=v.pfValue),h&&(s=0,o=0),o-=d/2,s-=x/2;for(var w=1;w<=i.stripeBackgroundN;w++){var g=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=g/100;b+u>1&&(b=1-u),!(g===0||u>=1||u+b>1)&&(t.beginPath(),t.rect(s,o+x*u,d,x*b),t.closePath(),this.colorFillStyle(t,m[0],m[1],m[2],y),t.fill(),u+=b)}t.restore()};var Qr={},eD=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(),h=r.targetEndpoint(),c=r.midpoint(),v=Ba(u,c),d=Ba(h,c);s=t.createRadialGradient(c.x,c.y,0,c.x,c.y,Math.max(v,d))}else{var x=o?{x:0,y:0}:r.position(),w=r.paddedWidth(),g=r.paddedHeight();s=t.createRadialGradient(x.x,x.y,0,x.x,x.y,Math.max(w,g))}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,h;if(!(l===e.canvasWidth&&u===e.canvasHeight)){e.fontCaches=null;var c=r.canvasContainer;c.style.width=i+"px",c.style.height=s+"px";for(var v=0;v<e.CANVAS_LAYERS;v++)h=r.canvases[v],h.width=l,h.height=u,h.style.width=i+"px",h.style.height=s+"px";for(var v=0;v<e.BUFFER_COUNT;v++)h=r.bufferCanvases[v],h.width=l,h.height=u,h.style.width=i+"px",h.style.height=s+"px";e.textureMult=1,o<=1&&(h=r.bufferCanvases[e.TEXTURE_BUFFER],e.textureMult=2,h.width=l*e.textureMult,h.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,h=u.canvasNeedsRedraw,c=e.textureOnViewport&&!n&&(e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming),v=t.motionBlur!==void 0?t.motionBlur:e.motionBlur,d=e.motionBlurPxRatio,x=r.hasCompoundNodes(),w=e.hoverData.draggingEles,g=!!(e.hoverData.selecting||e.touchData.selecting);v=v&&!n&&e.motionBlurEnabled&&!g;var m=v;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),v&&(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&&!c&&(h[e.NODE]=!0,h[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*d,y:R.y*d},ie=b*d,ce=e.canvasWidth*d,de=e.canvasHeight*d):(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(c||(e.textureDrawLastFrame=!1),c){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}}h[e.DRAG]=!1,h[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),v?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]=!h[e.NODE]&&v&&!e.clearedForMotionBlur[e.NODE]||e.clearingMotionBlur,F[e.NODE]&&(e.clearedForMotionBlur[e.NODE]=!0),F[e.DRAG]=!h[e.DRAG]&&v&&!e.clearedForMotionBlur[e.DRAG]||e.clearingMotionBlur,F[e.DRAG]&&(e.clearedForMotionBlur[e.DRAG]=!0),h[e.NODE]||i||s||F[e.NODE]){var G=v&&!F[e.NODE]&&d!==1,D=n||(G?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]:u.contexts[e.NODE]),$=v&&!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&&!v&&(h[e.NODE]=!1)}if(!s&&(h[e.DRAG]||i||F[e.DRAG])){var G=v&&!F[e.DRAG]&&d!==1,D=n||(G?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG]:u.contexts[e.DRAG]);A(D,v&&!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&&!v&&(h[e.DRAG]=!1)}if(this.drawSelectionRectangle(t,A),v&&d!==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=d;X.drawImage(J,0,0,e.canvasWidth*ce,e.canvasHeight*ce,0,0,e.canvasWidth,e.canvasHeight)};(h[e.NODE]||F[e.NODE])&&(q(ee,re,F[e.NODE]),h[e.NODE]=!1),(h[e.DRAG]||F[e.DRAG])&&(q(ne,Y,F[e.DRAG]),h[e.DRAG]=!1)}e.prevViewport=T,e.clearingMotionBlur&&(e.clearingMotionBlur=!1,e.motionBlurCleared=!0,e.motionBlur=!0),v&&(e.motionBlurTimeout=setTimeout(function(){e.motionBlurTimeout=null,e.clearedForMotionBlur[e.NODE]=!1,e.clearedForMotionBlur[e.DRAG]=!1,e.motionBlur=!1,e.clearingMotionBlur=!c,e.mbFrames=0,h[e.NODE]=!0,h[e.DRAG]=!0,e.redraw()},eD)),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 h=u||i.contexts[r.SELECT_BOX];if(e(h),r.selection[4]==1&&(r.hoverData.selecting||r.touchData.selecting)){var c=r.cy.zoom(),v=s.core("selection-box-border-width").value/c;h.lineWidth=v,h.fillStyle="rgba("+s.core("selection-box-color").value[0]+","+s.core("selection-box-color").value[1]+","+s.core("selection-box-color").value[2]+","+s.core("selection-box-opacity").value+")",h.fillRect(r.selection[0],r.selection[1],r.selection[2]-r.selection[0],r.selection[3]-r.selection[1]),v>0&&(h.strokeStyle="rgba("+s.core("selection-box-border-color").value[0]+","+s.core("selection-box-border-color").value[1]+","+s.core("selection-box-border-color").value[2]+","+s.core("selection-box-opacity").value+")",h.strokeRect(r.selection[0],r.selection[1],r.selection[2]-r.selection[0],r.selection[3]-r.selection[1]))}if(i.bgActivePosistion&&!r.hoverData.selecting){var c=r.cy.zoom(),d=i.bgActivePosistion;h.fillStyle="rgba("+s.core("active-bg-color").value[0]+","+s.core("active-bg-color").value[1]+","+s.core("active-bg-color").value[2]+","+s.core("active-bg-opacity").value+")",h.beginPath(),h.arc(d.x,d.y,s.core("active-bg-size").pfValue/c,0,2*Math.PI),h.fill()}var x=r.lastRedrawTime;if(r.showFps&&x){x=Math.round(x);var w=Math.round(1e3/x),g="1 frame = "+x+" ms = "+w+" fps";if(h.setTransform(1,0,0,1,0,0),h.fillStyle="rgba(255, 0, 0, 0.75)",h.strokeStyle="rgba(255, 0, 0, 0.75)",h.font="30px Arial",!Uo){var m=h.measureText(g);Uo=m.actualBoundingBoxAscent}h.fillText(g,0,Uo);var y=60;h.strokeRect(0,Uo+10,250,20),h.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 tD(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 rD(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 nD(t){var e=t.pixelRatio,r=t.cy.zoom();return r*e}function iD(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 aD(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 sD(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 oD(t){return t[0]+(t[1]<<8)+(t[2]<<16)+(t[3]<<24)}function lD(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 uD(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 cD(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),h=o*l,c=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,c),t.bufferData(t.ARRAY_BUFFER,e*h,t.DYNAMIC_DRAW),t.enableVertexAttribArray(n),a===t.FLOAT?t.vertexAttribPointer(n,o,a,!1,h,0):a===t.INT&&t.vertexAttribIPointer(n,o,a,h,0),t.vertexAttribDivisor(n,1),t.bindBuffer(t.ARRAY_BUFFER,null);for(var v=new Array(e),d=0;d<e;d++)v[d]=uD(t,a,u,h,o,d);return c.dataArray=u,c.stride=h,c.size=o,c.getView=function(x){return v[x]},c.setPoint=function(x,w,g){var m=v[x];m[0]=w,m[1]=g},c.bufferSubData=function(x){t.bindBuffer(t.ARRAY_BUFFER,c),x?t.bufferSubData(t.ARRAY_BUFFER,0,u,0,x*o):t.bufferSubData(t.ARRAY_BUFFER,0,u)},c}function hD(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 h=r+u;t.enableVertexAttribArray(h),t.vertexAttribPointer(h,3,t.FLOAT,!1,36,u*12),t.vertexAttribDivisor(h,1)}return t.bindBuffer(t.ARRAY_BUFFER,null),l.getMatrixView=function(c){return s[c]},l.setData=function(c,v){s[v].set(c,0)},l.bufferSubData=function(){t.bindBuffer(t.ARRAY_BUFFER,l),t.bufferSubData(t.ARRAY_BUFFER,0,i)},l}function fD(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 dD(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],h=e[7],c=e[8],v=r[0],d=r[1],x=r[2],w=r[3],g=r[4],m=r[5],y=r[6],b=r[7],_=r[8];return t[0]=v*n+d*o+x*u,t[1]=v*i+d*a+x*h,t[2]=v*s+d*l+x*c,t[3]=w*n+g*o+m*u,t[4]=w*i+g*a+m*h,t[5]=w*s+g*l+m*c,t[6]=y*n+b*o+_*u,t[7]=y*i+b*a+_*h,t[8]=y*s+b*l+_*c,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],h=e[7],c=e[8],v=r[0],d=r[1];return t[0]=n,t[1]=i,t[2]=s,t[3]=o,t[4]=a,t[5]=l,t[6]=v*n+d*o+u,t[7]=v*i+d*a+h,t[8]=v*s+d*l+c,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],h=e[7],c=e[8],v=Math.sin(r),d=Math.cos(r);return t[0]=d*n+v*o,t[1]=d*i+v*a,t[2]=d*s+v*l,t[3]=d*o-v*n,t[4]=d*a-v*i,t[5]=d*l-v*s,t[6]=u,t[7]=h,t[8]=c,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 pD(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 vD=(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),h=u.scale,c=u.texW,v=u.texH,d=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(h,h),i(R,n),R.restore()}},x=[null,null],w=function(){d(s.freePointer,s.canvas),x[0]={x:s.freePointer.x,y:s.freePointer.row*l,w:c,h:v},x[1]={x:s.freePointer.x+c,y:s.freePointer.row*l,w:0,h:v},s.freePointer.x+=c,s.freePointer.x==o&&(s.freePointer.x=0,s.freePointer.row++)},g=function(){var b=s.scratch,_=s.canvas;b.clear(),d({x:0,row:0},b);var R=o-s.freePointer.x,E=c-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:v}}{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:v}}s.freePointer.x=E,s.freePointer.row++},m=function(){s.freePointer.x=0,s.freePointer.row++};if(this.freePointer.x+c<=o)w();else{if(this.freePointer.row>=a-1)return!1;this.freePointer.x===o?(m(),w()):this.enableWrapping?g():(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=lD(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}}])})(),gD=(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 vD(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 c=l.value,v=c.getKeys(),d=mD(n,v);if(d.size===0)return i.push(c),v.forEach(function(R){return s.set(R,c)}),1;o||(o=r._createAtlas(),i.push(o));var x=on(v),w;try{for(x.s();!(w=x.n()).done;){var g=w.value;if(!d.has(g)){var m=c.getOffsets(g),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)),c.canvas&&(r._copyTextureToNewAtlas(g,c,o),s.set(g,o))}}}catch(R){x.e(R)}finally{x.f()}c.dispose()};for(a.s();!(l=a.n()).done;)u()}catch(h){a.e(h)}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(v){v.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 h=a.w+l.w,c=a.h;i.draw(r,{w:h,h:c},function(v){v.drawImage(u,0,0,h,c,0,0,h,c)})}}},{key:"getCounts",value:function(){return{keyCount:this.styleKeyToAtlas.size,atlasCount:new Set(this.styleKeyToAtlas.values()).size}}}])})();function mD(t,e){return t.intersection?t.intersection(e):new Set(Cc(t).filter(function(r){return e.has(r)}))}var yD=(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 gD(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,h=u===void 0?function(){return!0}:u,c=!1,v=!1,d=on(r),x;try{for(d.s();!(x=d.n()).done;){var w=x.value;if(l(w)){var g=on(this.renderTypes.values()),m;try{var y=function(){var _=m.value,R=_.type;if(h(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)}),v=!0;else{var N=_.getID?_.getID(w):w.id(),M=n._key(R,N),B=n.typeAndIdToKey.get(M);B!==void 0&&!sD(k,B)&&(c=!0,n.typeAndIdToKey.delete(M),B.forEach(function(A){return E.markKeyForGC(A)}))}}};for(g.s();!(m=g.n()).done;)y()}catch(b){g.e(b)}finally{g.f()}}}}catch(b){d.e(b)}finally{d.f()}return v&&(this.gc(),c=!1),c}},{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(v){o.drawClipped?(v.save(),v.beginPath(),v.rect(0,0,i.w,i.h),v.clip(),o.drawElement(v,r,i,!0,!0),v.restore()):o.drawElement(v,r,i,!0,!0),l=!0});if(l){var h=o.getID?o.getID(r):r.id(),c=this._key(n,h);this.typeAndIdToKey.has(c)?this.typeAndIdToKey.get(c).push(s):this.typeAndIdToKey.set(c,[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),h=i.getOrCreateAtlas(r,n,u,l),c=h.getOffsets(l),v=pr(c,2),d=v[0],x=v[1];return{atlas:h,tex:d,tex1:d,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,h=l.atlasCount;r.push({type:o,keyCount:u,atlasCount:h})}}catch(c){n.e(c)}finally{n.f()}return r}}])})(),xD=(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}}])})(),bD=`
|
|
62
|
+
float circleSD(vec2 p, float r) {
|
|
63
|
+
return distance(vec2(0), p) - r; // signed distance
|
|
64
|
+
}
|
|
65
|
+
`,wD=`
|
|
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
|
+
`,_D=`
|
|
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
|
+
`,SD=`
|
|
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,CD=(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=rD,this.atlasManager=new yD(e,n),this.batchManager=new xD(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(bD,`
|
|
288
|
+
`).concat(wD,`
|
|
289
|
+
`).concat(_D,`
|
|
290
|
+
`).concat(SD,`
|
|
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=tD(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),cD(i,"vec2",s.aPosition,r),this.transformBuffer=hD(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),h=on(u),c;try{for(h.s();!(c=h.n()).done;){var v=c.value,d=v.atlas,x=v.tex1,w=v.tex2;o.canAddToCurrentBatch(d)||this.endBatch();for(var g=o.getAtlasIndexForBatch(d),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]=g;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,v,R),this.instanceCount++,R||this.wrappedCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}catch(B){h.e(B)}finally{h.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,h=s.tex2,c=u.w/(u.w+h.w);o||(c=1-c);var v=this._getAdjustedBB(l,a,o,c);this._applyTransformMatrix(n,v,i,r)}else{var d=i.getBoundingBox(r),x=this._getAdjustedBB(d,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),h=u.x,c=u.y;yc(r,r,[h,c]),j1(r,r,l);var v=i.getRotationOffset(s);o=v.x+(n.xOffset||0),a=v.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,h=r.yOffset;n&&(o-=n,a-=n,l+=2*n,u+=2*n);var c=0,v=l*s;return i&&s<1?l=v:!i&&s<1&&(c=l-v,o+=c,l=v),{x1:o,y1:a,w:l,h:u,xOffset:c,yOffset:h}}},{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),h=this._getCornerRadius(r,o.radius,u),c=this.cornerRadiusBuffer.getView(l);c[0]=h,c[1]=h,c[2]=h,c[3]=h,a===Wo&&(c[0]=0,c[2]=0)}var v=this.indexBuffer.getView(l);_s(n,v);var d=this.renderTarget.picking?1:i==="node-body"?r.effectiveOpacity():1,x=this.renderTarget.picking?1:r.pstyle(o.opacity).value*d,w=r.pstyle(o.color).value,g=this.colorBuffer.getView(l);Ea(w,x,g);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,_=d*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 h=r.pstyle(i+"-arrow-color").value,c=r.pstyle("opacity").value,v=r.pstyle("line-opacity").value,d=c*v,x=r.pstyle("width").pfValue,w=r.pstyle("arrow-scale").value,g=this.r.getArrowWidth(x,w),m=this.instanceCount,y=this.transformBuffer.getMatrixView(m);F1(y),yc(y,y,[o,a]),Cv(y,y,[g,g]),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(h,d,_),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 h=this.instanceCount;this.vertTypeBuffer.getView(h)[0]=z1;var c=this.indexBuffer.getView(h);_s(n,c);var v=this.colorBuffer.getView(h);Ea(l,u,v);var d=this.lineWidthBuffer.getView(h);d[0]=a;var x=this.pointAPointBBuffer.getView(h);x[0]=i[0],x[1]=i[1],x[2]=i[2],x[3]=i[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var w=0;w<i.length-2;w+=2){var g=this.instanceCount;this.vertTypeBuffer.getView(g)[0]=H1;var m=this.indexBuffer.getView(g);_s(n,m);var y=this.colorBuffer.getView(g);Ea(l,u,y);var b=this.lineWidthBuffer.getView(g);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(g);A[0]=_,A[1]=R,A[2]=E,A[3]=T;var j=this.pointCPointDBuffer.getView(g);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 h=this.batchManager.getAtlases(),c=0;c<h.length;c++)h[c].bufferIfNeeded(r);for(var v=0;v<h.length;v++)r.activeTexture(r.TEXTURE0+v),r.bindTexture(r.TEXTURE_2D,h[v].texture),r.uniform1i(o.uTextures[v],v);r.uniform1f(o.uZoom,nD(this.r)),r.uniformMatrix3fv(o.uPanZoomMatrix,!1,this.panZoomMatrix),r.uniform1i(o.uAtlasSize,this.batchManager.getAtlasSize());var d=Ea(this.bgColor,1);r.uniform4fv(o.uBGColor,d),r.drawArraysInstanced(r.TRIANGLES,0,i,s),r.bindVertexArray(null),r.bindTexture(r.TEXTURE_2D,null),this.debug&&this.batchDebugInfo.push({count:s,atlasCount:h.length}),this.startBatch()}}},{key:"getDebugInfo",value:function(){var r=this.atlasManager.getDebugInfo(),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=ED(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=fD(n),r.pickingFrameBuffer.needsDraw=!0,r.drawing=new CD(r,n,t);var i=function(c){return function(v){return r.getTextAngle(v,c)}},s=function(c){return function(v){var d=v.pstyle(c);return d&&d.value}},o=function(c){return function(v){return v.pstyle("".concat(c,"-opacity")).value>0}},a=function(c){var v=c.pstyle("text-events").strValue==="yes";return v?Oc.USE_BB:Oc.IGNORE},l=function(c){var v=c.position(),d=v.x,x=v.y,w=c.outerWidth(),g=c.outerHeight();return{w,h:g,x1:d-w/2,y1:x-g/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:aD,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(h,c){var v=!1;c&&c.length>0&&(v|=r.drawing.invalidate(c)),v&&u()}),kD(r)};function ED(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,h=u*a,c=s.y1+h;return{x1:s.x1,w:s.w,y1:c,h:u,yOffset:h}}}return s}};function kD(t){{var e=t.render;t.render=function(s){s=s||{};var o=t.cy;t.webgl&&(o.zoom()>M_?(TD(t),e.call(t,s)):(RD(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 PD(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 TD(t){var e=t.data.contexts[t.WEBGL];e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)}function RD(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 LD(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();pD(a,e,r);var l=Np();return dD(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 ND(t,e){t.drawSelectionRectangle(e,function(r){return U_(t,r)})}function DD(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 AD(t){var e=function(i,s,o){for(var a=i.atlasManager.getAtlasCollection(s),l=t.data.contexts[t.NODE],u=a.atlases,h=0;h<u.length;h++){var c=u[h],v=c.canvas;if(v){var d=v.width,x=v.height,w=d*h,g=v.height*o,m=.4;l.save(),l.scale(m,m),l.drawImage(v,w,g),l.strokeStyle="black",l.rect(w,g,d,x),l.stroke(),l.restore()}}},r=0;e(t.drawing,"node",r++),e(t.drawing,"label",r++)}function MD(t,e,r,n,i){var s,o,a,l,u=pg(t),h=u.pan,c=u.zoom;{var v=iD(t,h,c,e,r),d=pr(v,2),x=d[0],w=d[1],g=6;s=x-g/2,o=w-g/2,a=g,l=g}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=oD(E)-1;T>=0&&_.add(T)}return _}function PD(t,e,r){var n=MD(t,e,r),i=t.getCachedZSortedEles(),s,o,a=on(n),l;try{for(a.s();!(l=a.n()).done;){var u=l.value,h=i[u];if(!s&&h.isNode()&&(s=h),!o&&h.isEdge()&&(o=h),s&&o)break}}catch(c){a.e(c)}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]&&ND(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=LD(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 h=0;h<l.drag.length;h++)Ip(t,h,l.drag[h])}else if(r.picking)for(var c=0;c<l.length;c++)Ip(t,c,l[c]);i.endFrame(),r.screen&&t.webglDebugShowAtlases&&(DD(t),AD(t)),t.data.canvasNeedsRedraw[t.NODE]=!1,t.data.canvasNeedsRedraw[t.DRAG]=!1}if(t.webglDebug){var v=performance.now(),d=!1,x=Math.ceil(v-n),w=i.getDebugInfo(),g=["".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(d)console.log("WebGL (".concat(r.name,") - time ").concat(x,"ms, ").concat(g));else{console.log("WebGL (".concat(r.name,") - frame time ").concat(x,"ms")),console.log("Totals:"),console.log(" ".concat(g)),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,h=r+o,c=cv(n,i),v=c.widthOffset,d=c.heightOffset,x=c.ctrlPtOffsetPct*v;t.beginPath&&t.beginPath(),t.moveTo(a,u+d),t.lineTo(a,h-d),t.quadraticCurveTo(a+x,h,a+v,h),t.lineTo(l-v,h),t.quadraticCurveTo(l-x,h,l,h-d),t.lineTo(l,u+d),t.quadraticCurveTo(l-x,u,l-v,u),t.lineTo(a+v,u),t.quadraticCurveTo(a+x,u,a,u+d),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 h=1/0,c=1/0;Xe(t.maxWidth)&&(h=u*t.maxWidth/s),Xe(t.maxHeight)&&(c=u*t.maxHeight/o),u=Math.min(h,c),s*=u,o*=u}a||(s*=l,o*=l,u*=l);var v=document.createElement("canvas");v.width=s,v.height=o,v.style.width=s+"px",v.style.height=o+"px";var d=v.getContext("2d");if(s>0&&o>0){d.clearRect(0,0,s,o),d.globalCompositeOperation="source-over";var x=this.getCachedZSortedEles();if(t.full)d.translate(-n.x1*u,-n.y1*u),d.scale(u,u),this.drawElements(d,x),d.scale(1/u,1/u),d.translate(n.x1*u,n.y1*u);else{var w=e.pan(),g={x:w.x*u,y:w.y*u};u*=e.zoom(),d.translate(g.x,g.y),d.scale(u,u),this.drawElements(d,x),d.scale(1/u,1/u),d.translate(-g.x,-g.y)}t.bg&&(d.globalCompositeOperation="destination-over",d.fillStyle=t.bg,d.rect(0,0,s,o),d.fill())}return v};function ID(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 ID(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 OD=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"};Tk()&&(l["-ms-touch-action"]="none",l["touch-action"]="none");for(var u=0;u<bt.CANVAS_LAYERS;u++){var h=e.data.canvases[u]=n.createElement("canvas"),c=bt.CANVAS_TYPES[u];e.data.contexts[u]=h.getContext(c),e.data.contexts[u]||Jt("Could not create canvas of type "+c),Object.keys(l).forEach(function(K){h.style[K]=l[K]}),h.style.position="absolute",h.setAttribute("data-id","layer"+u),h.style.zIndex=String(bt.CANVAS_LAYERS-u),e.data.canvasContainer.appendChild(h),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 v=Kr(),d=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},g=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||v},M=function(X){return X.boundingBox(),X[0]._private.labelBounds.source||v},B=function(X){return X.boundingBox(),X[0]._private.labelBounds.target||v},A=function(X,J){return J},j=function(X){return d(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:g,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:g,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 BD=typeof Path2D<"u";bt.path2dEnabled=function(t){if(t===void 0)return this.pathsEnabled;this.pathsEnabled=!!t};bt.usePaths=function(){return BD&&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 FD=[{name:"null",impl:b_},{name:"base",impl:D_},{name:"canvas",impl:OD}],jD=[{type:"layout",extensions:lN},{type:"renderer",extensions:FD}],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 h=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 h?h.call(this):this.emit("layoutstop"),this},o.destroy||(o.destroy=function(){return this}),o.cy=function(){return this._private.cy};var c=function(k){return k._private.cy},v={addEventFields:function(k,N){N.layout=k,N.cy=c(k),N.target=k},bubble:function(){return!0},parent:function(k){return c(k)}};dt(o,{createEmitter:function(){return this._private.emitter=new Jc(v,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 d=Q_("renderer","base"),x=d.prototype,w=r,g=r.prototype,m=function(){d.apply(this,arguments),w.apply(this,arguments)},y=m.prototype;for(var b in x){var _=x[b],R=g[b]!=null;if(R)return i(b);y[b]=_}for(var E in g)y[E]=g[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 zD(t,e,r,n,i){return pw({map:X_,keys:[t,e,r,n],value:i})}function HD(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 HD.apply(null,arguments);if(arguments.length===5)return zD.apply(null,arguments);Jt("Invalid extension access syntax")};ml.prototype.extension=Tv;jD.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,h=a;this[r].properties.push({name:u,value:h})}}}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 UD="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=UD;na.stylesheet=na.Stylesheet=Bc;var xc={exports:{}},bc={exports:{}},wc={exports:{}},WD=wc.exports,$1;function VD(){return $1||($1=1,(function(t,e){(function(n,i){t.exports=i()})(WD,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(h,c,v){s.call(this,v),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=v,this.bendpoints=[],this.source=h,this.target=c}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(h){if(this.source===h)return this.target;if(this.target===h)return this.source;throw"Node is not incident with this edge"},l.prototype.getOtherEndInGraph=function(h,c){for(var v=this.getOtherEnd(h),d=c.getGraphManager().getRoot();;){if(v.getOwner()==c)return v;if(v.getOwner()==d)break;v=v.getOwner().getParent()}return null},l.prototype.updateLength=function(){var h=new Array(4);this.isOverlapingSourceAndTarget=o.getIntersection(this.target.getRect(),this.source.getRect(),h),this.isOverlapingSourceAndTarget||(this.lengthX=h[0]-h[2],this.lengthY=h[1]-h[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),h=i(5);function c(d,x,w,g){w==null&&g==null&&(g=x),s.call(this,g),d.graphManager!=null&&(d=d.graphManager),this.estimatedSize=o.MIN_VALUE,this.inclusionTreeDepth=o.MAX_VALUE,this.vGraphObject=g,this.edges=[],this.graphManager=d,w!=null&&x!=null?this.rect=new a(x.x,x.y,w.width,w.height):this.rect=new a}c.prototype=Object.create(s.prototype);for(var v in s)c[v]=s[v];c.prototype.getEdges=function(){return this.edges},c.prototype.getChild=function(){return this.child},c.prototype.getOwner=function(){return this.owner},c.prototype.getWidth=function(){return this.rect.width},c.prototype.setWidth=function(d){this.rect.width=d},c.prototype.getHeight=function(){return this.rect.height},c.prototype.setHeight=function(d){this.rect.height=d},c.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},c.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},c.prototype.getCenter=function(){return new h(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},c.prototype.getLocation=function(){return new h(this.rect.x,this.rect.y)},c.prototype.getRect=function(){return this.rect},c.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},c.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},c.prototype.setRect=function(d,x){this.rect.x=d.x,this.rect.y=d.y,this.rect.width=x.width,this.rect.height=x.height},c.prototype.setCenter=function(d,x){this.rect.x=d-this.rect.width/2,this.rect.y=x-this.rect.height/2},c.prototype.setLocation=function(d,x){this.rect.x=d,this.rect.y=x},c.prototype.moveBy=function(d,x){this.rect.x+=d,this.rect.y+=x},c.prototype.getEdgeListToNode=function(d){var x=[],w=this;return w.edges.forEach(function(g){if(g.target==d){if(g.source!=w)throw"Incorrect edge source!";x.push(g)}}),x},c.prototype.getEdgesBetween=function(d){var x=[],w=this;return w.edges.forEach(function(g){if(!(g.source==w||g.target==w))throw"Incorrect edge source and/or target";(g.target==d||g.source==d)&&x.push(g)}),x},c.prototype.getNeighborsList=function(){var d=new Set,x=this;return x.edges.forEach(function(w){if(w.source==x)d.add(w.target);else{if(w.target!=x)throw"Incorrect incidency!";d.add(w.source)}}),d},c.prototype.withChildren=function(){var d=new Set,x,w;if(d.add(this),this.child!=null)for(var g=this.child.getNodes(),m=0;m<g.length;m++)x=g[m],w=x.withChildren(),w.forEach(function(y){d.add(y)});return d},c.prototype.getNoOfChildren=function(){var d=0,x;if(this.child==null)d=1;else for(var w=this.child.getNodes(),g=0;g<w.length;g++)x=w[g],d+=x.getNoOfChildren();return d==0&&(d=1),d},c.prototype.getEstimatedSize=function(){if(this.estimatedSize==o.MIN_VALUE)throw"assert failed";return this.estimatedSize},c.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)},c.prototype.scatter=function(){var d,x,w=-l.INITIAL_WORLD_BOUNDARY,g=l.INITIAL_WORLD_BOUNDARY;d=l.WORLD_CENTER_X+u.nextDouble()*(g-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=d,this.rect.y=x},c.prototype.updateBounds=function(){if(this.getChild()==null)throw"assert failed";if(this.getChild().getNodes().length!=0){var d=this.getChild();if(d.updateBounds(!0),this.rect.x=d.getLeft(),this.rect.y=d.getTop(),this.setWidth(d.getRight()-d.getLeft()),this.setHeight(d.getBottom()-d.getTop()),l.NODE_DIMENSIONS_INCLUDE_LABELS){var x=d.getRight()-d.getLeft(),w=d.getBottom()-d.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))}}},c.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==o.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},c.prototype.transform=function(d){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 g=new h(x,w),m=d.inverseTransformPoint(g);this.setLocation(m.x,m.y)},c.prototype.getLeft=function(){return this.rect.x},c.prototype.getRight=function(){return this.rect.x+this.rect.width},c.prototype.getTop=function(){return this.rect.y},c.prototype.getBottom=function(){return this.rect.y+this.rect.height},c.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},r.exports=c}),(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),h=i(1),c=i(13),v=i(12),d=i(11);function x(g,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=g,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(g,m,y){if(m==null&&y==null){var b=g;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 _=g;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(g){var m=g;if(g 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(g instanceof h){var b=g;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 g=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(),g>y&&(g=y),m>b&&(m=b)}return g==o.MAX_VALUE?null:(R[0].getParent().paddingLeft!=null?_=R[0].getParent().paddingLeft:_=this.margin,this.left=m-_,this.top=g-_,new v(this.left,this.top))},x.prototype.updateBounds=function(g){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];g&&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 c(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(g){for(var m=o.MAX_VALUE,y=-o.MAX_VALUE,b=o.MAX_VALUE,_=-o.MAX_VALUE,R,E,T,k,N=g.length,M=0;M<N;M++){var B=g[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 c(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 g=0,m=this.nodes,y=m.length,b=0;b<y;b++){var _=m[b];g+=_.calcEstimatedSize()}return g==0?this.estimatedSize=a.EMPTY_COMPOUND_NODE_SIZE:this.estimatedSize=g/Math.sqrt(this.nodes.length),this.estimatedSize},x.prototype.updateConnected=function(){var g=this;if(this.nodes.length==0){this.isConnected=!0;return}var m=new d,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==g&&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),h=this.add(l,u);return this.setRootGraph(h),this.rootGraph},a.prototype.add=function(l,u,h,c,v){if(h==null&&c==null&&v==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{v=h,c=u,h=l;var d=c.getOwner(),x=v.getOwner();if(!(d!=null&&d.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(x!=null&&x.getGraphManager()==this))throw"Target not in this graph mgr!";if(d==x)return h.isInterGraph=!1,d.add(h,c,v);if(h.isInterGraph=!0,h.source=c,h.target=v,this.edges.indexOf(h)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(h),!(h.source!=null&&h.target!=null))throw"Edge source and/or target is null!";if(!(h.source.edges.indexOf(h)==-1&&h.target.edges.indexOf(h)==-1))throw"Edge already in source and/or target incidency list!";return h.source.edges.push(h),h.target.edges.push(h),h}},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 h=[];h=h.concat(u.getEdges());for(var c,v=h.length,d=0;d<v;d++)c=h[d],u.remove(c);var x=[];x=x.concat(u.getNodes());var w;v=x.length;for(var d=0;d<v;d++)w=x[d],u.remove(w);u==this.rootGraph&&this.setRootGraph(null);var g=this.graphs.indexOf(u);this.graphs.splice(g,1),u.parent=null}else if(l instanceof o){if(c=l,c==null)throw"Edge is null!";if(!c.isInterGraph)throw"Not an inter-graph edge!";if(!(c.source!=null&&c.target!=null))throw"Source and/or target is null!";if(!(c.source.edges.indexOf(c)!=-1&&c.target.edges.indexOf(c)!=-1))throw"Source and/or target doesn't know this edge!";var g=c.source.edges.indexOf(c);if(c.source.edges.splice(g,1),g=c.target.edges.indexOf(c),c.target.edges.splice(g,1),!(c.source.owner!=null&&c.source.owner.getGraphManager()!=null))throw"Edge owner graph or owner graph manager is null!";if(c.source.owner.getGraphManager().edges.indexOf(c)==-1)throw"Not in owner graph manager's edge list!";var g=c.source.owner.getGraphManager().edges.indexOf(c);c.source.owner.getGraphManager().edges.splice(g,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(),h=u.length,c=0;c<h;c++)l=l.concat(u[c].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 h=0;h<u.length;h++)l=l.concat(u[h].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 h=l.getOwner(),c;do{if(c=h.getParent(),c==null)break;if(c==u)return!0;if(h=c.getOwner(),h==null)break}while(!0);h=u.getOwner();do{if(c=h.getParent(),c==null)break;if(c==l)return!0;if(h=c.getOwner(),h==null)break}while(!0);return!1},a.prototype.calcLowestCommonAncestors=function(){for(var l,u,h,c,v,d=this.getAllEdges(),x=d.length,w=0;w<x;w++){if(l=d[w],u=l.source,h=l.target,l.lca=null,l.sourceInLca=u,l.targetInLca=h,u==h){l.lca=u.getOwner();continue}for(c=u.getOwner();l.lca==null;){for(l.targetInLca=h,v=h.getOwner();l.lca==null;){if(v==c){l.lca=v;break}if(v==this.rootGraph)break;if(l.lca!=null)throw"assert failed";l.targetInLca=v.getParent(),v=l.targetInLca.getOwner()}if(c==this.rootGraph)break;l.lca==null&&(l.sourceInLca=c.getParent(),c=l.sourceInLca.getOwner())}if(l.lca==null)throw"assert failed"}},a.prototype.calcLowestCommonAncestor=function(l,u){if(l==u)return l.getOwner();var h=l.getOwner();do{if(h==null)break;var c=u.getOwner();do{if(c==null)break;if(c==h)return c;c=c.getParent().getOwner()}while(!0);h=h.getParent().getOwner()}while(!0);return h},a.prototype.calcInclusionTreeDepths=function(l,u){l==null&&u==null&&(l=this.rootGraph,u=1);for(var h,c=l.getNodes(),v=c.length,d=0;d<v;d++)h=c[d],h.inclusionTreeDepth=u,h.child!=null&&this.calcInclusionTreeDepths(h.child,u+1)},a.prototype.includesInvalidEdge=function(){for(var l,u=[],h=this.edges.length,c=0;c<h;c++)l=this.edges[c],this.isOneAncestorOfOther(l.source,l.target)&&u.push(l);for(var c=0;c<u.length;c++)this.remove(u[c]);return!1},r.exports=a}),(function(r,n,i){var s=i(12);function o(){}o.calcSeparationAmount=function(a,l,u,h){if(!a.intersects(l))throw"assert failed";var c=new Array(2);this.decideDirectionsForOverlappingNodes(a,l,c),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 v=Math.abs((l.getCenterY()-a.getCenterY())/(l.getCenterX()-a.getCenterX()));l.getCenterY()===a.getCenterY()&&l.getCenterX()===a.getCenterX()&&(v=1);var d=v*u[0],x=u[1]/v;u[0]<x?x=u[0]:d=u[1],u[0]=-1*c[0]*(x/2+h),u[1]=-1*c[1]*(d/2+h)},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 h=a.getCenterX(),c=a.getCenterY(),v=l.getCenterX(),d=l.getCenterY();if(a.intersects(l))return u[0]=h,u[1]=c,u[2]=v,u[3]=d,!0;var x=a.getX(),w=a.getY(),g=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(h===v){if(c>d)return u[0]=h,u[1]=w,u[2]=v,u[3]=M,!1;if(c<d)return u[0]=h,u[1]=y,u[2]=v,u[3]=T,!1}else if(c===d){if(h>v)return u[0]=x,u[1]=c,u[2]=k,u[3]=d,!1;if(h<v)return u[0]=g,u[1]=c,u[2]=E,u[3]=d,!1}else{var U=a.height/a.width,W=l.height/l.width,H=(d-c)/(v-h),z=void 0,P=void 0,F=void 0,G=void 0,$=void 0,ee=void 0;if(-U===H?h>v?(u[0]=m,u[1]=y,D=!0):(u[0]=g,u[1]=w,D=!0):U===H&&(h>v?(u[0]=x,u[1]=w,D=!0):(u[0]=b,u[1]=y,D=!0)),-W===H?v>h?(u[2]=N,u[3]=M,I=!0):(u[2]=k,u[3]=T,I=!0):W===H&&(v>h?(u[2]=E,u[3]=T,I=!0):(u[2]=B,u[3]=M,I=!0)),D&&I)return!1;if(h>v?c>d?(z=this.getCardinalDirection(U,H,4),P=this.getCardinalDirection(W,H,2)):(z=this.getCardinalDirection(-U,H,3),P=this.getCardinalDirection(-W,H,1)):c>d?(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=h+-R/H,u[0]=F,u[1]=G;break;case 2:F=b,G=c+_*H,u[0]=F,u[1]=G;break;case 3:G=y,F=h+R/H,u[0]=F,u[1]=G;break;case 4:F=m,G=c+-_*H,u[0]=F,u[1]=G;break}if(!I)switch(P){case 1:ee=T,$=v+-j/H,u[2]=$,u[3]=ee;break;case 2:$=B,ee=d+A*H,u[2]=$,u[3]=ee;break;case 3:ee=M,$=v+j/H,u[2]=$,u[3]=ee;break;case 4:$=N,ee=d+-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,h){if(h==null)return this.getIntersection2(a,l,u);var c=a.x,v=a.y,d=l.x,x=l.y,w=u.x,g=u.y,m=h.x,y=h.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-v,T=c-d,N=d*v-c*x,E=y-g,k=w-m,M=m*g-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,h){var c=void 0;return a!==u?(c=Math.atan((h-l)/(u-a)),u<a?c+=Math.PI:h<l&&(c+=this.TWO_PI)):h<l?c=this.ONE_AND_HALF_PI:c=this.HALF_PI,c},o.doIntersect=function(a,l,u,h){var c=a.x,v=a.y,d=l.x,x=l.y,w=u.x,g=u.y,m=h.x,y=h.y,b=(d-c)*(y-g)-(m-w)*(x-v);if(b===0)return!1;var _=((y-g)*(m-c)+(w-m)*(y-v))/b,R=((v-x)*(m-c)+(d-c)*(y-v))/b;return 0<_&&_<1&&0<R&&R<1},o.findCircleLineIntersections=function(a,l,u,h,c,v,d){var x=(u-a)*(u-a)+(h-l)*(h-l),w=2*((a-c)*(u-a)+(l-v)*(h-l)),g=(a-c)*(a-c)+(l-v)*(l-v)-d*d,m=w*w-4*x*g;if(m>=0){var y=(-w+Math.sqrt(w*w-4*x*g))/(2*x),b=(-w-Math.sqrt(w*w-4*x*g))/(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 c(v,d){for(var x=0;x<d.length;x++){var w=d[x];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(v,w.key,w)}}return function(v,d,x){return d&&c(v.prototype,d),x&&c(v,x),v}})();function o(c,v){if(!(c instanceof v))throw new TypeError("Cannot call a class as a function")}var a=function(v){return{value:v,next:null,prev:null}},l=function(v,d,x,w){return v!==null?v.next=d:w.head=d,x!==null?x.prev=d:w.tail=d,d.prev=v,d.next=x,w.length++,d},u=function(v,d){var x=v.prev,w=v.next;return x!==null?x.next=w:d.head=w,w!==null?w.prev=x:d.tail=x,v.prev=v.next=null,d.length--,v},h=(function(){function c(v){var d=this;o(this,c),this.length=0,this.head=null,this.tail=null,v!=null&&v.forEach(function(x){return d.push(x)})}return s(c,[{key:"size",value:function(){return this.length}},{key:"insertBefore",value:function(d,x){return l(x.prev,a(d),x,this)}},{key:"insertAfter",value:function(d,x){return l(x,a(d),x.next,this)}},{key:"insertNodeBefore",value:function(d,x){return l(x.prev,d,x,this)}},{key:"insertNodeAfter",value:function(d,x){return l(x,d,x.next,this)}},{key:"push",value:function(d){return l(this.tail,a(d),null,this)}},{key:"unshift",value:function(d){return l(null,a(d),this.head,this)}},{key:"remove",value:function(d){return u(d,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(d){if(d<=this.length()){for(var x=1,w=this.head;x<d;)w=w.next,x++;return w.value}}},{key:"set_object_at",value:function(d,x){if(d<=this.length()){for(var w=1,g=this.head;w<d;)g=g.next,w++;g.value=x}}}]),c})();r.exports=h}),(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 g=0,m=Array(w.length);g<w.length;g++)m[g]=w[g];return m}else return Array.from(w)}var o=i(0),a=i(7),l=i(3),u=i(1),h=i(6),c=i(5),v=i(17),d=i(29);function x(w){d.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(d.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 h(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(),g=0;g<w.length;g++)w[g];for(var m=this.graphManager.getRoot().getNodes(),g=0;g<m.length;g++)m[g];this.update(this.graphManager.getRoot())}},x.prototype.update=function(w){if(w==null)this.update2();else if(w instanceof l){var g=w;if(g.getChild()!=null)for(var m=g.getChild().getNodes(),y=0;y<m.length;y++)update(m[y]);if(g.vGraphObject!=null){var b=g.vGraphObject;b.update(g)}}else if(w instanceof u){var _=w;if(_.vGraphObject!=null){var R=_.vGraphObject;R.update(_)}}else if(w instanceof h){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 c(0,0));else{var g=new v,m=this.graphManager.getRoot().updateLeftTop();if(m!=null){g.setWorldOrgX(w.x),g.setWorldOrgY(w.y),g.setDeviceOrgX(m.x),g.setDeviceOrgY(m.y);for(var y=this.getAllNodes(),b,_=0;_<y.length;_++)b=y[_],b.transform(g)}}},x.prototype.positionNodesRandomly=function(w){if(w==null)this.positionNodesRandomly(this.getGraphManager().getRoot()),this.getGraphManager().getRoot().updateBounds(!0);else for(var g,m,y=w.getNodes(),b=0;b<y.length;b++)g=y[b],m=g.getChild(),m==null||m.getNodes().length==0?g.scatter():(this.positionNodesRandomly(m),g.updateBounds())},x.prototype.getFlatForest=function(){for(var w=[],g=!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&&g;){for(R.push(T[0]);R.length>0&&g;){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{g=!1;break}}}if(!g)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 g=[],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,_),g.add(_),m=_}var R=this.newEdge(null);return this.graphManager.add(R,m,w.target),this.edgeToDummyNodes.set(w,g),w.isInterGraph()?this.graphManager.remove(w):y.remove(w),g},x.prototype.createBendpointsFromDummyNodes=function(){var w=[];w=w.concat(this.graphManager.getAllEdges()),w=[].concat(s(this.edgeToDummyNodes.keys())).concat(w);for(var g=0;g<w.length;g++){var m=w[g];if(m.bendpoints.length>0){for(var y=this.edgeToDummyNodes.get(m),b=0;b<y.length;b++){var _=y[b],R=new c(_.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,g,m,y){if(m!=null&&y!=null){var b=g;if(w<=50){var _=g/m;b-=(g-_)/50*(50-w)}else{var R=g*y;b+=(R-g)/50*(w-50)}return b}else{var E,T;return w<=50?(E=9*g/500,T=g/10):(E=9*g/50,T=-8*g),E*w+T}},x.findCenterOfTree=function(w){var g=[];g=g.concat(w);var m=[],y=new Map,b=!1,_=null;(g.length==1||g.length==2)&&(b=!0,_=g[0]);for(var R=0;R<g.length;R++){var E=g[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<g.length;R++){var E=g[R],M=g.indexOf(E);M>=0&&g.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),(g.length==1||g.length==2)&&(b=!0,_=g[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(d){if(Array.isArray(d)){for(var x=0,w=Array(d.length);x<d.length;x++)w[x]=d[x];return w}else return Array.from(d)}var o=i(15),a=i(4),l=i(0),u=i(8),h=i(9);function c(){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}c.prototype=Object.create(o.prototype);for(var v in o)c[v]=o[v];c.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=[]},c.prototype.calcIdealEdgeLengths=function(){for(var d,x,w,g,m,y,b,_=this.getGraphManager().getAllEdges(),R=0;R<_.length;R++)d=_[R],x=d.idealLength,d.isInterGraph&&(g=d.getSource(),m=d.getTarget(),y=d.getSourceInLca().getEstimatedSize(),b=d.getTargetInLca().getEstimatedSize(),this.useSmartIdealEdgeLengthCalculation&&(d.idealLength+=y+b-2*l.SIMPLE_NODE_SIZE),w=d.getLca().getInclusionTreeDepth(),d.idealLength+=x*a.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR*(g.getInclusionTreeDepth()+m.getInclusionTreeDepth()-2*w))},c.prototype.initSpringEmbedder=function(){var d=this.getAllNodes().length;this.incremental?(d>a.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*a.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(d-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):(d>a.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(a.COOLING_ADAPTATION_FACTOR,1-(d-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()},c.prototype.calcSpringForces=function(){for(var d=this.getAllEdges(),x,w=0;w<d.length;w++)x=d[w],this.calcSpringForce(x,x.idealLength)},c.prototype.calcRepulsionForces=function(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,w,g,m,y,b=this.getAllNodes(),_;if(this.useFRGridVariant)for(this.totalIterations%a.GRID_CALCULATION_CHECK_PERIOD==1&&d&&this.updateGrid(),_=new Set,w=0;w<b.length;w++)m=b[w],this.calculateRepulsionForceOfANode(m,_,d,x),_.add(m);else for(w=0;w<b.length;w++)for(m=b[w],g=w+1;g<b.length;g++)y=b[g],m.getOwner()==y.getOwner()&&this.calcRepulsionForce(m,y)},c.prototype.calcGravitationalForces=function(){for(var d,x=this.getAllNodesToApplyGravitation(),w=0;w<x.length;w++)d=x[w],this.calcGravitationalForce(d)},c.prototype.moveNodes=function(){for(var d=this.getAllNodes(),x,w=0;w<d.length;w++)x=d[w],x.move()},c.prototype.calcSpringForce=function(d,x){var w=d.getSource(),g=d.getTarget(),m,y,b,_;if(this.uniformLeafNodeSizes&&w.getChild()==null&&g.getChild()==null)d.updateLengthSimple();else if(d.updateLength(),d.isOverlapingSourceAndTarget)return;m=d.getLength(),m!=0&&(y=d.edgeElasticity*(m-x),b=y*(d.lengthX/m),_=y*(d.lengthY/m),w.springForceX+=b,w.springForceY+=_,g.springForceX-=b,g.springForceY-=_)},c.prototype.calcRepulsionForce=function(d,x){var w=d.getRect(),g=x.getRect(),m=new Array(2),y=new Array(4),b,_,R,E,T,k,N;if(w.intersects(g)){u.calcSeparationAmount(w,g,m,a.DEFAULT_EDGE_LENGTH/2),k=2*m[0],N=2*m[1];var M=d.noOfChildren*x.noOfChildren/(d.noOfChildren+x.noOfChildren);d.repulsionForceX-=M*k,d.repulsionForceY-=M*N,x.repulsionForceX+=M*k,x.repulsionForceY+=M*N}else this.uniformLeafNodeSizes&&d.getChild()==null&&x.getChild()==null?(b=g.getCenterX()-w.getCenterX(),_=g.getCenterY()-w.getCenterY()):(u.getIntersection(w,g,y),b=y[2]-y[0],_=y[3]-y[1]),Math.abs(b)<a.MIN_REPULSION_DIST&&(b=h.sign(b)*a.MIN_REPULSION_DIST),Math.abs(_)<a.MIN_REPULSION_DIST&&(_=h.sign(_)*a.MIN_REPULSION_DIST),R=b*b+_*_,E=Math.sqrt(R),T=(d.nodeRepulsion/2+x.nodeRepulsion/2)*d.noOfChildren*x.noOfChildren/R,k=T*b/E,N=T*_/E,d.repulsionForceX-=k,d.repulsionForceY-=N,x.repulsionForceX+=k,x.repulsionForceY+=N},c.prototype.calcGravitationalForce=function(d){var x,w,g,m,y,b,_,R;x=d.getOwner(),w=(x.getRight()+x.getLeft())/2,g=(x.getTop()+x.getBottom())/2,m=d.getCenterX()-w,y=d.getCenterY()-g,b=Math.abs(m)+d.getWidth()/2,_=Math.abs(y)+d.getHeight()/2,d.getOwner()==this.graphManager.getRoot()?(R=x.getEstimatedSize()*this.gravityRangeFactor,(b>R||_>R)&&(d.gravitationForceX=-this.gravityConstant*m,d.gravitationForceY=-this.gravityConstant*y)):(R=x.getEstimatedSize()*this.compoundGravityRangeFactor,(b>R||_>R)&&(d.gravitationForceX=-this.gravityConstant*m*this.compoundGravityConstant,d.gravitationForceY=-this.gravityConstant*y*this.compoundGravityConstant))},c.prototype.isConverged=function(){var d,x=!1;return this.totalIterations>this.maxIterations/3&&(x=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),d=this.totalDisplacement<this.totalDisplacementThreshold,this.oldTotalDisplacement=this.totalDisplacement,d||x},c.prototype.animate=function(){this.animationDuringLayout&&!this.isSubLayout&&(this.notAnimatedIterations==this.animationPeriod?(this.update(),this.notAnimatedIterations=0):this.notAnimatedIterations++)},c.prototype.calcNoOfChildrenForAllNodes=function(){for(var d,x=this.graphManager.getAllNodes(),w=0;w<x.length;w++)d=x[w],d.noOfChildren=d.getNoOfChildren()},c.prototype.calcGrid=function(d){var x=0,w=0;x=parseInt(Math.ceil((d.getRight()-d.getLeft())/this.repulsionRange)),w=parseInt(Math.ceil((d.getBottom()-d.getTop())/this.repulsionRange));for(var g=new Array(x),m=0;m<x;m++)g[m]=new Array(w);for(var m=0;m<x;m++)for(var y=0;y<w;y++)g[m][y]=new Array;return g},c.prototype.addNodeToGrid=function(d,x,w){var g=0,m=0,y=0,b=0;g=parseInt(Math.floor((d.getRect().x-x)/this.repulsionRange)),m=parseInt(Math.floor((d.getRect().width+d.getRect().x-x)/this.repulsionRange)),y=parseInt(Math.floor((d.getRect().y-w)/this.repulsionRange)),b=parseInt(Math.floor((d.getRect().height+d.getRect().y-w)/this.repulsionRange));for(var _=g;_<=m;_++)for(var R=y;R<=b;R++)this.grid[_][R].push(d),d.setGridCoordinates(g,m,y,b)},c.prototype.updateGrid=function(){var d,x,w=this.getAllNodes();for(this.grid=this.calcGrid(this.graphManager.getRoot()),d=0;d<w.length;d++)x=w[d],this.addNodeToGrid(x,this.graphManager.getRoot().getLeft(),this.graphManager.getRoot().getTop())},c.prototype.calculateRepulsionForceOfANode=function(d,x,w,g){if(this.totalIterations%a.GRID_CALCULATION_CHECK_PERIOD==1&&w||g){var m=new Set;d.surrounding=new Array;for(var y,b=this.grid,_=d.startX-1;_<d.finishX+2;_++)for(var R=d.startY-1;R<d.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],!(d.getOwner()!=y.getOwner()||d==y)&&!x.has(y)&&!m.has(y)){var T=Math.abs(d.getCenterX()-y.getCenterX())-(d.getWidth()/2+y.getWidth()/2),k=Math.abs(d.getCenterY()-y.getCenterY())-(d.getHeight()/2+y.getHeight()/2);T<=this.repulsionRange&&k<=this.repulsionRange&&m.add(y)}}d.surrounding=[].concat(s(m))}for(_=0;_<d.surrounding.length;_++)this.calcRepulsionForce(d,d.surrounding[_])},c.prototype.calcRepulsionRange=function(){return 0},r.exports=c}),(function(r,n,i){var s=i(1),o=i(4);function a(u,h,c){s.call(this,u,h,c),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,h,c,v){s.call(this,u,h,c,v),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,h,c,v){this.startX=u,this.finishX=h,this.startY=c,this.finishY=v},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,h=0;h<u;h++)a.push(this.set[l[h]])},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 h=a[u];this.add(h)}},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 h=0;h<a[0].length;h++){l[u][h]=0;for(var c=0;c<o[0].length;c++)l[u][h]+=o[u][c]*a[c][h]}}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 h=0;h<o.length;h++)a[h]=l+o[h];return a},s.multL=function(o,a,l){for(var u=[],h=[],c=[],v=0;v<a[0].length;v++){for(var d=0,x=0;x<a.length;x++)d+=-.5*a[x][v]*o[x];h[v]=d}for(var w=0;w<l.length;w++){for(var g=0,m=0;m<l.length;m++)g+=l[w][m]*h[m];c[w]=g}for(var y=0;y<a.length;y++){for(var b=0,_=0;_<a[0].length;_++)b+=a[y][_]*c[_];u[y]=b}return u},r.exports=s}),(function(r,n,i){var s=(function(){function u(h,c){for(var v=0;v<c.length;v++){var d=c[v];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(h,d.key,d)}}return function(h,c,v){return c&&u(h.prototype,c),v&&u(h,v),h}})();function o(u,h){if(!(u instanceof h))throw new TypeError("Cannot call a class as a function")}var a=i(11),l=(function(){function u(h,c){o(this,u),(c!==null||c!==void 0)&&(this.compareFunction=this._defaultCompareFunction);var v=void 0;h instanceof a?v=h.size():v=h.length,this._quicksort(h,0,v-1)}return s(u,[{key:"_quicksort",value:function(c,v,d){if(v<d){var x=this._partition(c,v,d);this._quicksort(c,v,x),this._quicksort(c,x+1,d)}}},{key:"_partition",value:function(c,v,d){for(var x=this._get(c,v),w=v,g=d;;){for(;this.compareFunction(x,this._get(c,g));)g--;for(;this.compareFunction(this._get(c,w),x);)w++;if(w<g)this._swap(c,w,g),w++,g--;else return g}}},{key:"_get",value:function(c,v){return c instanceof a?c.get_object_at(v):c[v]}},{key:"_set",value:function(c,v,d){c instanceof a?c.set_object_at(v,d):c[v]=d}},{key:"_swap",value:function(c,v,d){var x=this._get(c,v);this._set(c,v,this._get(c,d)),this._set(c,d,x)}},{key:"_defaultCompareFunction",value:function(c,v){return v>c}}]),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),h=!0,c=Math.min(this.m-1,this.n),v=Math.max(0,Math.min(this.n-2,this.m)),d=0;d<Math.max(c,v);d++){if(d<c){this.s[d]=0;for(var x=d;x<this.m;x++)this.s[d]=s.hypot(this.s[d],o[x][d]);if(this.s[d]!==0){o[d][d]<0&&(this.s[d]=-this.s[d]);for(var w=d;w<this.m;w++)o[w][d]/=this.s[d];o[d][d]+=1}this.s[d]=-this.s[d]}for(var g=d+1;g<this.n;g++){if((function(st,vt){return st&&vt})(d<c,this.s[d]!==0)){for(var m=0,y=d;y<this.m;y++)m+=o[y][d]*o[y][g];m=-m/o[d][d];for(var b=d;b<this.m;b++)o[b][g]+=m*o[b][d]}l[g]=o[d][g]}if((function(st,vt){return vt})(h,d<c))for(var _=d;_<this.m;_++)this.U[_][d]=o[_][d];if(d<v){l[d]=0;for(var R=d+1;R<this.n;R++)l[d]=s.hypot(l[d],l[R]);if(l[d]!==0){l[d+1]<0&&(l[d]=-l[d]);for(var E=d+1;E<this.n;E++)l[E]/=l[d];l[d+1]+=1}if(l[d]=-l[d],(function(st,vt){return st&&vt})(d+1<this.m,l[d]!==0)){for(var T=d+1;T<this.m;T++)u[T]=0;for(var k=d+1;k<this.n;k++)for(var N=d+1;N<this.m;N++)u[N]+=l[k]*o[N][k];for(var M=d+1;M<this.n;M++)for(var B=-l[M]/l[d+1],A=d+1;A<this.m;A++)o[A][M]+=B*u[A]}for(var j=d+1;j<this.n;j++)this.V[j][d]=l[j]}}var D=Math.min(this.n,this.m+1);c<this.n&&(this.s[c]=o[c][c]),this.m<D&&(this.s[D-1]=0),v+1<D&&(l[v]=o[v][D-1]),l[D-1]=0;{for(var I=c;I<a;I++){for(var U=0;U<this.m;U++)this.U[U][I]=0;this.U[I][I]=1}for(var W=c-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<v,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 ze=void 0;for(ze=D-1;ze>=de&&ze!==de;ze--){var _e=(ze!==D?Math.abs(l[ze]):0)+(ze!==de+1?Math.abs(l[ze-1]):0);if(Math.abs(this.s[ze])<=ce+ie*_e){this.s[ze]=0;break}}ze===de?Le=3:ze===D-1?Le=1:(Le=2,de=ze)}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 We=l[de-1];l[de-1]=0;for(var Ye=de;Ye<D;Ye++){var ge=s.hypot(this.s[Ye],We),Ce=this.s[Ye]/ge,Ae=We/ge;this.s[Ye]=ge,We=-Ae*l[Ye],l[Ye]=Ce*l[Ye];for(var Fe=0;Fe<this.m;Fe++)ge=Ce*this.U[Fe][Ye]+Ae*this.U[Fe][de-1],this.U[Fe][de-1]=-Ae*this.U[Fe][Ye]+Ce*this.U[Fe][de-1],this.U[Fe][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 He=s.hypot(Se,Te),je=Se/He,Ge=Te/He;Re!==de&&(l[Re-1]=He),Se=je*this.s[Re]+Ge*l[Re],l[Re]=je*l[Re]-Ge*this.s[Re],Te=Ge*this.s[Re+1],this.s[Re+1]=je*this.s[Re+1];for(var it=0;it<this.n;it++)He=je*this.V[it][Re]+Ge*this.V[it][Re+1],this.V[it][Re+1]=-Ge*this.V[it][Re]+je*this.V[it][Re+1],this.V[it][Re]=He;if(He=s.hypot(Se,Te),je=Se/He,Ge=Te/He,this.s[Re]=He,Se=je*l[Re]+Ge*this.s[Re+1],this.s[Re+1]=-Ge*l[Re]+je*this.s[Re+1],Te=Ge*l[Re+1],l[Re+1]=je*l[Re+1],Re<this.m-1)for(var Ze=0;Ze<this.m;Ze++)He=je*this.U[Ze][Re]+Ge*this.U[Ze][Re+1],this.U[Ze][Re+1]=-Ge*this.U[Ze][Re]+je*this.U[Ze][Re+1],this.U[Ze][Re]=He}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,h){for(var c=0;c<h.length;c++){var v=h[c];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(u,v.key,v)}}return function(u,h,c){return h&&l(u.prototype,h),c&&l(u,c),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,h){var c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,v=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,d=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;o(this,l),this.sequence1=u,this.sequence2=h,this.match_score=c,this.mismatch_penalty=v,this.gap_penalty=d,this.iMax=u.length+1,this.jMax=h.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 g=0;g<this.iMax;g++){this.tracebackGrid[g]=new Array(this.jMax);for(var m=0;m<this.jMax;m++)this.tracebackGrid[g][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 h=1;h<this.jMax;h++)this.grid[0][h]=this.grid[0][h-1]+this.gap_penalty,this.tracebackGrid[0][h]=[!1,!1,!0];for(var c=1;c<this.iMax;c++)this.grid[c][0]=this.grid[c-1][0]+this.gap_penalty,this.tracebackGrid[c][0]=[!1,!0,!1];for(var v=1;v<this.iMax;v++)for(var d=1;d<this.jMax;d++){var x=void 0;this.sequence1[v-1]===this.sequence2[d-1]?x=this.grid[v-1][d-1]+this.match_score:x=this.grid[v-1][d-1]+this.mismatch_penalty;var w=this.grid[v-1][d]+this.gap_penalty,g=this.grid[v][d-1]+this.gap_penalty,m=[x,w,g],y=this.arrayAllMaxIndexes(m);this.grid[v][d]=m[y[0]],this.tracebackGrid[v][d]=[y.includes(0),y.includes(1),y.includes(2)]}this.score=this.grid[this.iMax-1][this.jMax-1]}},{key:"alignmentTraceback",value:function(){var h=[];for(h.push({pos:[this.sequence1.length,this.sequence2.length],seq1:"",seq2:""});h[0];){var c=h[0],v=this.tracebackGrid[c.pos[0]][c.pos[1]];v[0]&&h.push({pos:[c.pos[0]-1,c.pos[1]-1],seq1:this.sequence1[c.pos[0]-1]+c.seq1,seq2:this.sequence2[c.pos[1]-1]+c.seq2}),v[1]&&h.push({pos:[c.pos[0]-1,c.pos[1]],seq1:this.sequence1[c.pos[0]-1]+c.seq1,seq2:"-"+c.seq2}),v[2]&&h.push({pos:[c.pos[0],c.pos[1]-1],seq1:"-"+c.seq1,seq2:this.sequence2[c.pos[1]-1]+c.seq2}),c.pos[0]===0&&c.pos[1]===0&&this.alignments.push({sequence1:c.seq1,sequence2:c.seq2}),h.shift()}return this.alignments}},{key:"getAllIndexes",value:function(h,c){for(var v=[],d=-1;(d=h.indexOf(c,d+1))!==-1;)v.push(d);return v}},{key:"arrayAllMaxIndexes",value:function(h){return this.getAllIndexes(h,Math.max.apply(null,h))}}]),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 h=this.listeners[u];h.event===a&&h.callback===l&&this.listeners.splice(u,1)}},o.emit=function(a,l){for(var u=0;u<this.listeners.length;u++){var h=this.listeners[u];a===h.event&&h.callback(l)}},r.exports=s})])})})(wc)),wc.exports}var $D=bc.exports,G1;function GD(){return G1||(G1=1,(function(t,e){(function(n,i){t.exports=i(VD())})($D,function(r){return(()=>{var n={45:((a,l,u)=>{var h={};h.layoutBase=u(551),h.CoSEConstants=u(806),h.CoSEEdge=u(767),h.CoSEGraph=u(880),h.CoSEGraphManager=u(578),h.CoSELayout=u(765),h.CoSENode=u(991),h.ConstraintHandler=u(902),a.exports=h}),806:((a,l,u)=>{var h=u(551).FDLayoutConstants;function c(){}for(var v in h)c[v]=h[v];c.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,c.DEFAULT_RADIAL_SEPARATION=h.DEFAULT_EDGE_LENGTH,c.DEFAULT_COMPONENT_SEPERATION=60,c.TILE=!0,c.TILING_PADDING_VERTICAL=10,c.TILING_PADDING_HORIZONTAL=10,c.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,c.ENFORCE_CONSTRAINTS=!0,c.APPLY_LAYOUT=!0,c.RELAX_MOVEMENT_ON_CONSTRAINTS=!0,c.TREE_REDUCTION_ON_INCREMENTAL=!0,c.PURE_INCREMENTAL=c.DEFAULT_INCREMENTAL,a.exports=c}),767:((a,l,u)=>{var h=u(551).FDLayoutEdge;function c(d,x,w){h.call(this,d,x,w)}c.prototype=Object.create(h.prototype);for(var v in h)c[v]=h[v];a.exports=c}),880:((a,l,u)=>{var h=u(551).LGraph;function c(d,x,w){h.call(this,d,x,w)}c.prototype=Object.create(h.prototype);for(var v in h)c[v]=h[v];a.exports=c}),578:((a,l,u)=>{var h=u(551).LGraphManager;function c(d){h.call(this,d)}c.prototype=Object.create(h.prototype);for(var v in h)c[v]=h[v];a.exports=c}),765:((a,l,u)=>{var h=u(551).FDLayout,c=u(578),v=u(880),d=u(991),x=u(767),w=u(806),g=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(){h.call(this),this.toBeTiled={},this.constraints={}}A.prototype=Object.create(h.prototype);for(var j in h)A[j]=h[j];A.prototype.newGraphManager=function(){var D=new c(this);return this.graphManager=D,D},A.prototype.newGraph=function(D){return new v(null,this.graphManager,D)},A.prototype.newNode=function(D){return new d(this.graphManager,D)},A.prototype.newEdge=function(D){return new x(null,null,D)},A.prototype.initParameters=function(){h.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(){h.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&&(g.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,ze=0;return X.forEach(function(_e,ke){if(!Le.has(ke)){ie[ze]=[],ce[ze]=!1;var Ne=ke;for(de.push(Ne),Le.add(Ne),ie[ze].push(Ne);de.length!=0;){Ne=de.shift(),J.has(Ne)&&(ce[ze]=!0);var Ee=X.get(Ne);Ee.forEach(function(Me){Le.has(Me)||(de.push(Me),Le.add(Me),ie[ze].push(Me))})}ze++}}),{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 ze=(U+Y*ce)%360,_e=(ze+ce)%360;A.branchRadialLayout(Le,D,ze,_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 d(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 h=u(551).FDLayoutNode,c=u(551).IMath;function v(x,w,g,m){h.call(this,x,w,g,m)}v.prototype=Object.create(h.prototype);for(var d in h)v[d]=h[d];v.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*c.sign(this.displacementX)),Math.abs(this.displacementY)>x.coolingFactor*x.maxNodeDisplacement&&(this.displacementY=x.coolingFactor*x.maxNodeDisplacement*c.sign(this.displacementY)),this.child&&this.child.getNodes().length>0&&this.propogateDisplacementToChildren(this.displacementX,this.displacementY)},v.prototype.propogateDisplacementToChildren=function(x,w){for(var g=this.getChild().getNodes(),m,y=0;y<g.length;y++)m=g[y],m.getChild()==null?(m.displacementX+=x,m.displacementY+=w):m.propogateDisplacementToChildren(x,w)},v.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},v.prototype.setPred1=function(x){this.pred1=x},v.prototype.getPred1=function(){return pred1},v.prototype.getPred2=function(){return pred2},v.prototype.setNext=function(x){this.next=x},v.prototype.getNext=function(){return next},v.prototype.setProcessed=function(x){this.processed=x},v.prototype.isProcessed=function(){return processed},a.exports=v}),902:((a,l,u)=>{function h(g){if(Array.isArray(g)){for(var m=0,y=Array(g.length);m<g.length;m++)y[m]=g[m];return y}else return Array.from(g)}var c=u(806),v=u(551).LinkedList,d=u(551).Matrix,x=u(551).SVD;function w(){}w.handleConstraints=function(g){var m={};m.fixedNodeConstraint=g.constraints.fixedNodeConstraint,m.alignmentConstraint=g.constraints.alignmentConstraint,m.relativePlacementConstraint=g.constraints.relativePlacementConstraint;for(var y=new Map,b=new Map,_=[],R=[],E=g.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=c.DEFAULT_EDGE_LENGTH+y.get(te.left).getWidth()/2+y.get(te.right).getWidth()/2:te.gap=c.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,He=new v;Se.forEach(function(Ze,qe){Ze==0?(He.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 je=function(){var qe=He.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&&He.push(Qe.id),se&&Re.set(Qe.id,be(Re.get(qe),Re.get(Qe.id)))})};He.length!=0;)je();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(h(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 v,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(He){he.has(He.id)||(se.push(He.id),he.add(He.id),ue[pe].push(He.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($)),c.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 He=new Set([].concat(h(Re)).filter(function(Ge){return F.has(Ge)})),je=void 0;He.size>0?je=_[b.get(He.values().next().value)]:je=B(Re).x,oe[Te].forEach(function(Ge){W[te]=[je,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 He=new Set([].concat(h(Re)).filter(function(Ge){return F.has(Ge)})),je=void 0;He.size>0?je=_[b.get(He.values().next().value)]:je=B(Re).y,he[Te].forEach(function(Ge){W[te]=[_[b.get(Ge)],je],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=d.transpose(W),Le=d.transpose(H),ze=0;ze<de.length;ze++)de[ze]=d.multGamma(de[ze]),Le[ze]=d.multGamma(Le[ze]);var _e=d.multMat(de,d.transpose(Le)),ke=x.svd(_e);ce=d.multMat(ke.V,d.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]=d.dotProduct(Ee,Me),R[Ne]=d.dotProduct(Ee,Pe)}P&&j(m.relativePlacementConstraint)}}if(c.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 We=m.alignmentConstraint.vertical,Ye=function(oe){var ue=new Set;We[oe].forEach(function(pe){ue.add(pe)});var se=new Set([].concat(h(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<We.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(h(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)})},Fe=0;Fe<Ce.length;Fe++)Ae(Fe)}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])])},He=0;He<Te.length;He++)Re(He);if(m.alignmentConstraint.horizontal)for(var je=m.alignmentConstraint.horizontal,Ge=function(rt){se.set("dummy"+rt,[]),je[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(je[rt][0])])},it=0;it<je.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 qD=xc.exports,q1;function YD(){return q1||(q1=1,(function(t,e){(function(n,i){t.exports=i(GD())})(qD,function(r){return(()=>{var n={658:(a=>{a.exports=Object.assign!=null?Object.assign.bind(Object):function(l){for(var u=arguments.length,h=Array(u>1?u-1:0),c=1;c<u;c++)h[c-1]=arguments[c];return h.forEach(function(v){Object.keys(v).forEach(function(d){return l[d]=v[d]})}),l}}),548:((a,l,u)=>{var h=(function(){function d(x,w){var g=[],m=!0,y=!1,b=void 0;try{for(var _=x[Symbol.iterator](),R;!(m=(R=_.next()).done)&&(g.push(R.value),!(w&&g.length===w));m=!0);}catch(E){y=!0,b=E}finally{try{!m&&_.return&&_.return()}finally{if(y)throw b}}return g}return function(x,w){if(Array.isArray(x))return x;if(Symbol.iterator in Object(x))return d(x,w);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),c=u(140).layoutBase.LinkedList,v={};v.getTopMostNodes=function(d){for(var x={},w=0;w<d.length;w++)x[d[w].id()]=!0;var g=d.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 g},v.connectComponents=function(d,x,w,g){var m=new c,y=new Set,b=[],_=void 0,R=void 0,E=void 0,T=!1,k=1,N=[],M=[],B=function(){var j=d.collection();M.push(j);var D=w[0],I=d.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=d.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=d.collection();W.merge(b[0]),b.forEach(function(H){W.merge(H)}),b=[],w=w.difference(W),k++}};do B();while(!T);return g&&N.length>0&&g.set("dummy"+(g.size+1),N),M},v.relocateComponent=function(d,x,w){if(!w.fixedNodeConstraint){var g=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=h(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<g&&(g=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=d.x-(m+g)/2,P=d.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<g&&(g=re),ne>m&&(m=ne),Y<y&&(y=Y),q>b&&(b=q)});var F=d.x-(m+g)/2,G=d.y-(b+y)/2;Object.keys(x).forEach(function($){var ee=x[$];ee.setCenter(ee.getCenterX()+F,ee.getCenterY()+G)})}}},v.calcBoundingBox=function(d,x,w,g){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=d.descendants().not(":parent"),M=N.length,B=0;B<M;B++){var A=N[B];R=x[g.get(A.id())]-A.width()/2,E=x[g.get(A.id())]+A.width()/2,T=w[g.get(A.id())]-A.height()/2,k=w[g.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},v.calcParentsWithoutChildren=function(d,x){var w=d.collection();return x.nodes(":parent").forEach(function(g){var m=!1;g.children().forEach(function(y){y.css("display")!="none"&&(m=!0)}),m||w.merge(g)}),w},a.exports=v}),816:((a,l,u)=>{var h=u(548),c=u(140).CoSELayout,v=u(140).CoSENode,d=u(140).layoutBase.PointD,x=u(140).layoutBase.DimensionD,w=u(140).layoutBase.LayoutConstants,g=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=h.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 v(re.graphManager,new d(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=h.calcBoundingBox(K,B,A,M);K.intersection(U).length==0?J=$.add(new v(re.graphManager,new d(ce.topLeftX,ce.topLeftY),new x(ce.width,ce.height))):J=$.add(new v(re.graphManager,new d(ce.topLeftX,ce.topLeftY),new x(parseFloat(ie.w),parseFloat(ie.h))))}else J=$.add(new v(re.graphManager,new d(K.position("x")-ie.w/2,K.position("y")-ie.h/2),new x(parseFloat(ie.w),parseFloat(ie.h))));else J=$.add(new v(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=g.DEFAULT_EDGE_LENGTH=ne/Y:D(_.idealEdgeLength)?m.DEFAULT_EDGE_LENGTH=g.DEFAULT_EDGE_LENGTH=50:m.DEFAULT_EDGE_LENGTH=g.DEFAULT_EDGE_LENGTH=_.idealEdgeLength,m.MIN_REPULSION_DIST=g.MIN_REPULSION_DIST=g.DEFAULT_EDGE_LENGTH/10,m.DEFAULT_RADIAL_SEPARATION=g.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=g.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=_.nestingFactor),_.gravity!=null&&(m.DEFAULT_GRAVITY_STRENGTH=g.DEFAULT_GRAVITY_STRENGTH=_.gravity),_.numIter!=null&&(m.MAX_ITERATIONS=g.MAX_ITERATIONS=_.numIter),_.gravityRange!=null&&(m.DEFAULT_GRAVITY_RANGE_FACTOR=g.DEFAULT_GRAVITY_RANGE_FACTOR=_.gravityRange),_.gravityCompound!=null&&(m.DEFAULT_COMPOUND_GRAVITY_STRENGTH=g.DEFAULT_COMPOUND_GRAVITY_STRENGTH=_.gravityCompound),_.gravityRangeCompound!=null&&(m.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=g.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=_.gravityRangeCompound),_.initialEnergyOnIncremental!=null&&(m.DEFAULT_COOLING_FACTOR_INCREMENTAL=g.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=g.NODE_DIMENSIONS_INCLUDE_LABELS=w.NODE_DIMENSIONS_INCLUDE_LABELS=_.nodeDimensionsIncludeLabels,m.DEFAULT_INCREMENTAL=g.DEFAULT_INCREMENTAL=w.DEFAULT_INCREMENTAL=!_.randomize,m.ANIMATE=g.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=g.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 c,F=P.newGraphManager();return W(F.addRoot(),h.getTopMostNodes(k),P,_),H(P,F,N),z(P,_),P.runLayout(),j};a.exports={coseLayout:y}}),212:((a,l,u)=>{var h=(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 c(_,R){if(!(_ instanceof R))throw new TypeError("Cannot call a class as a function")}var v=u(658),d=u(548),x=u(657),w=x.spectralLayout,g=u(816),m=g.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){c(this,_),this.options=v({},y,R)}return h(_,[{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=d.getTopMostNodes(T.eles.nodes());if(A=d.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])),d.relocateComponent(j[ke],B[ke],T)})}else A.forEach(function(_e,ke){d.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=d.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(),We=Pe.target();if(De.css("display")!="none"&&We.css("display")!="none")if(T.quality=="draft"){var Ye=Ne.get(De.id()),ge=Ne.get(We.id()),Ce=[],Ae=[];if(De.isParent()){var Fe=d.calcBoundingBox(De,M[ke].xCoords,M[ke].yCoords,Ne);Ce.push(Fe.topLeftX+Fe.width/2),Ce.push(Fe.topLeftY+Fe.height/2)}else Ce.push(M[ke].xCoords[Ye]),Ce.push(M[ke].yCoords[Ye]);if(We.isParent()){var me=d.calcBoundingBox(We,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][We.id()]&&Ee.edges.push({startX:B[ke][De.id()].getCenterX(),startY:B[ke][De.id()].getCenterY(),endX:B[ke][We.id()].getCenterX(),endY:B[ke][We.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])),d.relocateComponent(j[0],B[0],T)):d.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(We){Pe in We&&(Ee={x:We[Pe].getRect().getCenterX(),y:We[Pe].getRect().getCenterY()},Me=We[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(We){var Ye=We.nodeIndexes.get(ke.id());Ye!=null&&(De={x:We.xCoords[Ye],y:We.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=d.calcParentsWithoutChildren(k,N),ze=N.filter(function(_e){return _e.css("display")=="none"});T.eles=N.not(ze),N.nodes().not(":parent").not(ze).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 h=u(548),c=u(140).layoutBase.Matrix,v=u(140).layoutBase.SVD,d=function(w){var g=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=[],He=0,je=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]>He&&(He=B[pt],je=pt)}return je},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 He=0;He<F;He++)j[Re][He]=A[M[He]][Re]},re=function(){for(var oe=v.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=c.multMat(c.multMat(he,be),c.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=c.normalize(se),he=c.normalize(he);for(var Te=W,Re=W,He=void 0;;){for(var je=0;je<I;je++)pe[je]=se[je];if(se=c.multGamma(c.multL(c.multGamma(pe),A,D)),oe=c.dotProduct(pe,se),se=c.normalize(se),Te=c.dotProduct(pe,se),He=Math.abs(Te/Re),He<=1+H&&He>=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=c.minusOp(be,c.multCons(pe,c.dotProduct(pe,be))),he=c.multGamma(c.multL(c.multGamma(be),A,D)),ue=c.dotProduct(be,he),he=c.normalize(he),Te=c.dotProduct(be,he),He=Math.abs(Te/Re),He<=1+H&&He>=1)break;Re=Te}for(var Ze=0;Ze<I;Ze++)be[Ze]=he[Ze];k=c.multCons(pe,Math.sqrt(Math.abs(oe))),N=c.multCons(be,Math.sqrt(Math.abs(ue)))};h.connectComponents(g,m,h.getTopMostNodes(y),_),b.forEach(function(te){h.connectComponents(g,m,h.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 ze=function(oe){var ue=R.get(oe),se=void 0;_.get(oe).forEach(function(he){g.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;ze(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 We=0;We<I;We++)A[We]=[];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(g.getElementById(oe).position("x")),N.push(g.getElementById(oe).position("y"))}),De={nodeIndexes:R,xCoords:k,yCoords:N}),De}else{var ge=R.keys(),Ce=g.getElementById(ge.next().value),Ae=Ce.position(),Fe=Ce.outerWidth();if(k.push(Ae.x),N.push(Ae.y),I==2){var me=g.getElementById(ge.next().value),Z=me.outerWidth();k.push(Ae.x+Fe/2+Z/2+w.idealEdgeLength),N.push(Ae.y)}return De={nodeIndexes:R,xCoords:k,yCoords:N},De}};a.exports={spectralLayout:d}}),579:((a,l,u)=>{var h=u(212),c=function(d){d&&d("layout","fcose",h)};typeof cytoscape<"u"&&c(cytoscape),a.exports=c}),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 XD=YD();const KD=Uc(XD);na.use(KD);const QD={function:"#10b981",method:"#10b981",constructor:"#10b981",class:"#f97316",struct:"#f97316",interface:"#3b82f6",type_alias:"#3b82f6",trait:"#3b82f6",enum:"#8b5cf6",macro:"#a855f7"},ZD={typescript:"#10b981",javascript:"#10b981",rust:"#f97316",python:"#3b82f6",go:"#06b6d4"};function JD(t){var e,r;return QD[(e=t.kind)==null?void 0:e.toLowerCase()]??ZD[(r=t.lang)==null?void 0:r.toLowerCase()]??"#9ca3af"}function eA(t){return Math.round(Math.min(20+Math.sqrt(t)*6,60))}function Z_({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),h=ae.useRef(i);return ae.useEffect(()=>{u.current=n,h.current=i},[n,i]),ae.useEffect(()=>{if(!s.current)return;const c=new Map(t.map((x,w)=>[x.id,`n${w}`]));l.current=c;const v=[...t.map(x=>({group:"nodes",data:{id:c.get(x.id),label:x.name||x.id.split("/").pop()||x.id,color:JD(x),size:eA(x.inDeg),kind:x.kind,file:x.file,inDeg:x.inDeg,outDeg:x.outDeg,raw:x}})),...e.filter(x=>c.has(x.src)&&c.has(x.tgt)).map((x,w)=>({group:"edges",data:{id:`e${w}`,source:c.get(x.src),target:c.get(x.tgt)}}))],d=na({container:s.current,elements:v,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 d.on("tap","node",x=>{var m,y;const w=x.target.data("raw");(m=u.current)==null||m.call(u,w),(y=h.current)==null||y.call(h,w),d.elements().removeClass("highlighted dimmed");const g=x.target.closedNeighborhood();d.elements().addClass("dimmed"),g.removeClass("dimmed").addClass("highlighted"),x.target.select()}),d.on("tap",x=>{var w;x.target===d&&(d.elements().removeClass("highlighted dimmed"),d.elements("node").unselect(),(w=h.current)==null||w.call(h,null))}),d.ready(()=>{d.destroyed()||d.fit(void 0,40)}),a(d),()=>{d.destroy(),a(null)}},[t,e]),ae.useEffect(()=>{if(o&&!o.destroyed()&&(o.elements("node").unselect(),o.elements().removeClass("highlighted dimmed"),r)){const c=l.current.get(r)??r,v=o.$id(c);if(v.length){v.select();const d=v.closedNeighborhood();o.elements().addClass("dimmed"),d.removeClass("dimmed").addClass("highlighted"),o.destroyed()||o.animate({fit:{eles:d,padding:60},duration:300})}}},[o,r]),S.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 S.jsx("div",{className:"h-full flex flex-col overflow-hidden",style:{background:"#0f1419"},children:S.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),h=o.id===e,c=o.name||o.id.split("/").pop()||o.id,v=o.file?o.file.split("/").slice(-2).join("/"):"";return S.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:h?"rgba(63,185,80,0.08)":"transparent"},onMouseEnter:d=>{h||(d.currentTarget.style.background="rgba(230,237,243,0.04)")},onMouseLeave:d=>{h||(d.currentTarget.style.background="transparent")},children:[S.jsx("div",{className:"absolute inset-y-0 left-0 pointer-events-none",style:{width:`${l}%`,backgroundColor:u,opacity:h?.18:.1}}),S.jsxs("div",{className:"relative flex items-center gap-2",children:[S.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}),S.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:u}}),S.jsxs("span",{className:"flex-1 min-w-0 flex flex-col",children:[S.jsx("span",{className:"font-mono text-[11px] truncate font-medium",style:{color:"#e6edf3"},title:o.name||o.id,children:c}),v&&S.jsxs("span",{className:"text-[9px] truncate font-mono",style:{color:"rgba(230,237,243,0.35)"},children:[o.kind&&S.jsx("span",{style:{color:"rgba(230,237,243,0.45)",marginRight:"4px"},children:o.kind}),v]})]}),S.jsx("span",{className:"shrink-0 text-[11px] font-semibold tabular-nums ml-2 font-mono",style:{color:h?"#3fb950":"rgba(230,237,243,0.6)"},children:o.inDeg})]})]},o.id)})})})}const Be={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 S.jsxs("div",{className:"w-64 shrink-0 flex flex-col border-l overflow-hidden",style:{background:Be.canvas2,borderColor:Be.hairline},children:[S.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-2 border-b shrink-0 min-w-0",style:{borderColor:Be.hairline},children:[S.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:s}}),S.jsx("span",{className:"text-[11px] font-semibold truncate flex-1 font-mono",style:{color:Be.ink},title:t.name||t.id,children:t.name||t.id.split("/").pop()}),S.jsx("button",{type:"button",onClick:r,className:"shrink-0 leading-none text-base",style:{color:Be.faint},children:"×"})]}),S.jsxs("div",{className:"overflow-y-auto flex-1 p-3 flex flex-col gap-3 text-[11px]",children:[t.kind&&S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-semibold uppercase",style:{background:Be.surface,color:Be.muted},children:t.kind}),S.jsx("span",{className:"capitalize font-mono",style:{color:Be.faint},children:t.lang||""})]}),t.file&&S.jsxs("div",{children:[S.jsx("p",{className:"text-[10px] mb-0.5 font-mono uppercase tracking-wide",style:{color:Be.faint},children:"File"}),S.jsx("p",{className:"font-mono text-[10px] break-all",style:{color:Be.muted},children:t.file})]}),S.jsxs("div",{className:"flex gap-4",children:[S.jsxs("div",{children:[S.jsx("p",{className:"text-[10px] font-mono uppercase tracking-wide mb-0.5",style:{color:Be.faint},children:"Callers"}),S.jsx("p",{className:"font-mono font-bold",style:{color:Be.ink},children:t.inDeg})]}),S.jsxs("div",{children:[S.jsx("p",{className:"text-[10px] font-mono uppercase tracking-wide mb-0.5",style:{color:Be.faint},children:"Calls"}),S.jsx("p",{className:"font-mono font-bold",style:{color:Be.ink},children:t.outDeg})]})]}),n.length>0&&S.jsxs("div",{children:[S.jsxs("p",{className:"text-[10px] font-mono uppercase tracking-wide mb-1",style:{color:Be.faint},children:["Called by (in view) ",S.jsx("span",{style:{color:Be.muted},children:n.length})]}),S.jsxs("div",{className:"flex flex-col gap-0.5",children:[n.slice(0,10).map(a=>S.jsx("p",{className:"font-mono text-[10px] truncate",style:{color:Be.muted},title:a.src,children:o(a.src)},a.src)),n.length>10&&S.jsxs("p",{className:"text-[10px] font-mono",style:{color:Be.faint},children:["+",n.length-10," more"]})]})]}),i.length>0&&S.jsxs("div",{children:[S.jsxs("p",{className:"text-[10px] font-mono uppercase tracking-wide mb-1",style:{color:Be.faint},children:["Calls (in view) ",S.jsx("span",{style:{color:Be.muted},children:i.length})]}),S.jsxs("div",{className:"flex flex-col gap-0.5",children:[i.slice(0,10).map(a=>S.jsx("p",{className:"font-mono text-[10px] truncate",style:{color:Be.muted},title:a.tgt,children:o(a.tgt)},a.tgt)),i.length>10&&S.jsxs("p",{className:"text-[10px] font-mono",style:{color:Be.faint},children:["+",i.length-10," more"]})]})]})]})]})}function uA({graph:t}){const[e,r]=ae.useState(""),[n,i]=ae.useState(null),{nodes:s,edges:o,reqCounts:a}=ae.useMemo(()=>{var y;const c=Object.keys(t.domains),v=new Set(c),d=new Map;for(const b of c)d.set(b,Object.keys(((y=t.domains[b])==null?void 0:y.requirements)??{}).length);const x=b=>{if(b==="(root)")return null;let _=b;for(;_.includes("/");)if(_=_.slice(0,_.lastIndexOf("/")),v.has(_))return _;return v.has("(root)")?"(root)":null},w=new Map,g=[];for(const b of c){const _=x(b);_!==null&&(g.push({src:_,tgt:b}),w.set(_,(w.get(_)??0)+1))}return{nodes:c.map(b=>({id:b,name:b==="(root)"?"(root)":b.slice(b.lastIndexOf("/")+1),kind:"domain",file:b,inDeg:Math.min(d.get(b)??0,60),outDeg:w.get(b)??0,lang:"domain"})),edges:g,reqCounts:d}},[t]),l=e.trim().toLowerCase(),u=ae.useMemo(()=>{if(l==="")return{nodes:s,edges:o};const c=new Set(s.filter(x=>{var w;return x.id.toLowerCase().includes(l)||Object.values(((w=t.domains[x.id])==null?void 0:w.requirements)??{}).some(g=>(g.title??"").toLowerCase().includes(l))}).map(x=>x.id)),v=new Set(c),d=new Map(o.map(x=>[x.tgt,x.src]));for(const x of c){let w=d.get(x);for(;w!==void 0&&!v.has(w);)v.add(w),w=d.get(w)}return{nodes:s.filter(x=>v.has(x.id)),edges:o.filter(x=>v.has(x.src)&&v.has(x.tgt))}},[s,o,l,t]),h=n!==null?t.domains[n]:void 0;return s.length===0?S.jsx("div",{className:"h-full overflow-y-auto p-4",children:S.jsx("p",{className:"text-sm text-center mt-8 font-mono",style:{color:Be.faint},children:"No domains in this graph."})}):S.jsxs("div",{className:"h-full flex flex-col",children:[S.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 shrink-0 border-b",style:{borderColor:Be.hairline},children:[S.jsxs("span",{className:"text-[11px] font-mono shrink-0",style:{color:Be.muted},children:[s.length," domains · ",[...a.values()].reduce((c,v)=>c+v,0)," requirements"]}),S.jsx("input",{type:"text",value:e,onChange:c=>r(c.target.value),placeholder:"Filter domains + requirement titles…",className:"flex-1 text-[11px] font-mono px-3 py-1.5 rounded-lg border outline-none",style:{border:`1px solid ${Be.hairlineS}`,background:Be.canvas2,color:Be.ink}}),l!==""&&S.jsx("span",{className:"text-[10px] font-mono shrink-0",style:{color:Be.faint},children:u.nodes.length===1?"1 match":`${u.nodes.length} matches`})]}),S.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[S.jsx("div",{className:"flex-1 overflow-hidden",style:{background:Be.canvas},children:S.jsx(Z_,{nodes:u.nodes,edges:u.edges,externalSelectedId:n,onNodeSelect:c=>i(c?c.id:null)})}),n!==null&&h&&S.jsx(cA,{domainId:n,domain:h,onClose:()=>i(null)})]})]})}function cA({domainId:t,domain:e,onClose:r}){const i=Object.entries(e.requirements??{});return S.jsxs("div",{className:"w-[380px] shrink-0 border-l flex flex-col",style:{borderColor:Be.hairlineS,background:Be.surface2},children:[S.jsxs("div",{className:"px-4 py-2.5 border-b flex items-center gap-2 shrink-0",style:{borderColor:Be.hairline,background:Be.canvas2},children:[S.jsx("span",{className:"text-[11px] font-semibold font-mono truncate",style:{color:Be.ink},children:t}),S.jsxs("span",{className:"text-[10px] font-mono ml-auto shrink-0",style:{color:Be.faint},children:[i.length," reqs"]}),S.jsx("button",{type:"button",onClick:r,"aria-label":"Close domain details",className:"text-sm shrink-0 px-1",style:{color:Be.muted},children:"×"})]}),S.jsxs("div",{className:"flex-1 overflow-y-auto",children:[e.description&&S.jsx("p",{className:"text-[11px] px-4 pt-3 pb-1",style:{color:Be.muted},children:e.description}),i.length===0?S.jsx("p",{className:"text-[11px] px-4 py-3 font-mono",style:{color:Be.faint},children:"No requirements recorded for this domain."}):S.jsxs("div",{className:"divide-y",style:{borderColor:Be.hairline},children:[i.slice(0,150).map(([s,o])=>S.jsxs("div",{className:"px-4 py-2.5",style:{borderColor:Be.hairline},children:[S.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[S.jsx("span",{className:"text-[10px] font-mono",style:{color:Be.faint},children:s}),o.status&&S.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)":Be.surface,color:o.status==="active"?Be.ok:o.status==="deprecated"?Be.deny:Be.muted},children:o.status})]}),S.jsx("p",{className:"text-[11px]",style:{color:Be.ink},children:o.title}),o.description&&o.description!==o.title&&S.jsx("p",{className:"text-[10px] mt-0.5",style:{color:Be.muted},children:o.description.slice(0,160)})]},s)),i.length>150&&S.jsxs("p",{className:"text-[10px] font-mono px-4 py-2",style:{color:Be.faint},children:["+",i.length-150," more requirements"]})]})]})]})}function Y1(){return S.jsxs("div",{className:"flex items-center gap-1.5",children:[S.jsx("span",{className:"w-3 h-3 rounded-full",style:{background:Be.deny}}),S.jsx("span",{className:"w-3 h-3 rounded-full",style:{background:Be.accent}}),S.jsx("span",{className:"w-3 h-3 rounded-full",style:{background:Be.ok}})]})}function hA({repo:t,onClose:e,onSelectRun:r}){const[n,i]=ae.useState("graph"),[s,o]=ae.useState("code"),[a,l]=ae.useState(!0),[u,h]=ae.useState(null),[c,v]=ae.useState(null),[d,x]=ae.useState(null),[w,g]=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})=>h(H)).catch(()=>h(null)).finally(()=>l(!1))},[t.id]),ae.useEffect(()=>{s!=="domain"||c!==null||(g(!0),lt.getRepoDomainGraph(t.id).then(({graph:H,coverage:z})=>{v(H),x(z)}).catch(()=>{v(null),x(null)}).finally(()=>g(!1)))},[s,c,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 S.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?Be.surface:"transparent",color:G?Be.ink:Be.muted,boxShadow:G?"0 1px 4px rgba(0,0,0,0.4)":"none"},children:P})}return S.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:S.jsxs("div",{className:"w-[92vw] h-[92vh] rounded-2xl flex flex-col overflow-hidden",style:{background:Be.blue,border:`1px solid ${Be.hairlineS}`,boxShadow:"0 40px 80px -20px rgba(0,0,0,0.8)"},children:[S.jsxs("div",{className:"flex items-center gap-3 px-5 py-3 border-b shrink-0",style:{background:Be.blue2,borderColor:Be.hairline},children:[S.jsx("span",{className:"text-[13px] font-semibold font-mono mr-1",style:{color:Be.ink},children:t.name}),S.jsx("div",{className:"flex gap-0.5 rounded p-0.5",style:{background:"rgba(0,0,0,0.25)"},children:["code","domain"].map(H=>S.jsx(W,{value:H,current:s,label:H==="code"?"Code":"Domain",onChange:o},H))}),s==="code"&&S.jsx("div",{className:"flex gap-0.5 rounded p-0.5",style:{background:"rgba(0,0,0,0.25)"},children:["graph","hotspots"].map(H=>S.jsx(W,{value:H,current:n,label:H==="graph"?"Graph":"Hotspots",onChange:i},H))}),s==="code"&&S.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?Be.hairline:"rgba(255,218,25,0.4)",background:N?"rgba(0,0,0,0.2)":"rgba(255,218,25,0.08)",color:N?Be.faint:Be.accent},children:N?"tests hidden":"tests shown"}),u&&s==="code"&&S.jsxs("span",{className:"text-[10px] font-mono px-2 py-0.5 rounded",style:{background:"rgba(0,0,0,0.2)",color:Be.muted},children:[I.length," nodes · ",u.stats.edgeCount," edges"]}),S.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:Be.faint},onMouseEnter:H=>H.currentTarget.style.color=Be.ink,onMouseLeave:H=>H.currentTarget.style.color=Be.faint,children:"×"})]}),S.jsx("div",{className:"flex-1 overflow-hidden",style:{background:Be.blue},children:a?S.jsx("div",{className:"flex items-center justify-center h-full",children:S.jsx("span",{className:"text-sm font-mono",style:{color:Be.muted},children:"Loading…"})}):s==="domain"?w?S.jsx("div",{className:"flex items-center justify-center h-full",children:S.jsx("span",{className:"text-sm font-mono",style:{color:Be.muted},children:"Loading domain graph…"})}):c?S.jsx(uA,{graph:c}):S.jsx("div",{className:"flex items-center justify-center h-full",children:S.jsxs("div",{className:"max-w-sm w-full mx-auto p-6 rounded-xl border flex flex-col gap-4",style:{border:`1px solid ${Be.hairlineS}`,background:Be.canvas2},children:[S.jsx("p",{className:"text-sm font-semibold font-mono",style:{color:Be.ink},children:"Domain graph not yet generated"}),S.jsxs("p",{className:"text-xs leading-relaxed",style:{color:Be.muted},children:["The domain model requires full annotation coverage — every behavior-bearing node in the code graph must be linked to a requirement. To get there: run the",S.jsx("span",{className:"font-mono",children:" domain-extraction"})," workflow for this repo (it annotates behavior nodes with requirement claims), then re-run Onboard — its domain phase runs ",S.jsx("span",{className:"font-mono",children:"wicked-core domain-graph"}),"."]}),d?S.jsxs("div",{className:"rounded-lg p-4 flex flex-col gap-2 border",style:{border:`1px solid ${Be.hairline}`},children:[S.jsxs("div",{className:"flex justify-between items-baseline",children:[S.jsx("span",{className:"text-[11px] font-mono",style:{color:Be.muted},children:"Annotation coverage"}),S.jsxs("span",{className:"text-[11px] font-mono font-bold",style:{color:Be.ink},children:[(d.coverage*100).toFixed(1),"%"]})]}),S.jsx("div",{className:"w-full h-1.5 rounded-full overflow-hidden",style:{background:Be.surface},children:S.jsx("div",{className:"h-full rounded-full",style:{width:`${Math.max(d.coverage*100,.5)}%`,background:Be.ok}})}),S.jsxs("div",{className:"flex gap-4 mt-1 text-[10px] font-mono tabular-nums",style:{color:Be.faint},children:[S.jsxs("span",{children:[d.resolved.toLocaleString()," resolved"]}),S.jsxs("span",{children:[d.behavior_bearing.toLocaleString()," behavior-bearing"]}),S.jsxs("span",{children:[d.total.toLocaleString()," total"]})]})]}):S.jsx("p",{className:"text-[11px] font-mono",style:{color:Be.faint},children:"No coverage data — run onboarding first."}),S.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:Be.accent,color:Be.accentInk},children:m?"Starting…":"Run annotation workflow →"}),b&&S.jsx("p",{className:"text-[11px] font-mono",style:{color:Be.deny},children:b})]})}):U?S.jsx("div",{className:"flex items-center justify-center h-full",children:S.jsx("p",{className:"text-sm font-mono",style:{color:Be.muted},children:"Code graph not yet available — run onboarding first."})}):S.jsxs("div",{className:"h-full flex p-4 gap-4",children:[S.jsxs("div",{className:"flex-1 flex flex-col gap-3 min-w-0 overflow-hidden",children:[S.jsxs("div",{className:"rounded-xl overflow-hidden flex flex-col",style:{display:n==="graph"?"flex":"none",flex:1,border:`1px solid ${Be.hairlineS}`,background:Be.canvas2,boxShadow:"0 20px 50px -20px rgba(0,0,0,0.6)"},children:[S.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 border-b shrink-0",style:{background:Be.canvas,borderColor:Be.hairline},children:[S.jsx(Y1,{}),S.jsxs("span",{className:"font-mono text-[10px] ml-1",style:{color:Be.faint},children:["code-graph · ",S.jsx("span",{style:{color:Be.link},children:t.name})]}),S.jsxs("span",{className:"ml-auto font-mono text-[9px] px-2 py-0.5 rounded",style:{background:Be.surface,color:Be.muted},children:[I.length," nodes"]})]}),S.jsx("div",{className:"flex-1 overflow-hidden",style:{background:Be.canvas},children:S.jsx(Z_,{nodes:I,edges:u.edges,externalSelectedId:R,onNodeSelect:j})})]}),S.jsxs("div",{className:"rounded-xl overflow-hidden flex flex-col",style:{display:n==="hotspots"?"flex":"none",flex:1,border:`1px solid ${Be.hairlineS}`,background:Be.canvas2,boxShadow:"0 20px 50px -20px rgba(0,0,0,0.6)"},children:[S.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 border-b shrink-0",style:{background:Be.canvas,borderColor:Be.hairline},children:[S.jsx(Y1,{}),S.jsxs("span",{className:"font-mono text-[10px] ml-1",style:{color:Be.faint},children:["hotspots · ",S.jsx("span",{style:{color:Be.link},children:t.name})]})]}),S.jsx("div",{className:"flex-1 overflow-hidden",style:{background:Be.surface2},children:S.jsx(iA,{nodes:I,selectedId:(T==null?void 0:T.id)??null,onSelect:A})})]})]}),T&&S.jsx(lA,{node:T,edges:u.edges,onClose:()=>k(null)})]})})]})})}const fA=new Set(["sessionStarted","unitPlanned","unitDistributed","unitExecuting","gateDecided","unitDone","unitDenied","awaitingHuman","resumed","runCancelled","sessionFailed","sessionCompleted"]);function dA(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 pA(t,e){var w;const r={...t.session},n=new Map;for(const g of t.units)n.set(g.ord,{ord:g.ord,description:g.description,stage:g.stage,status:g.status,resolved:!0,assignedCli:g.assigned_cli,assignedInvocation:g.assigned_invocation,routing:g.routing,denialReason:g.denial_reason,skillRef:g.skill_ref??null,phaseStatus:g.phase_status,role:g.role??null,gate:g.gate??null,hasValidatorPin:g.has_validator_pin??!1,executorType:g.tool_cmd!=null?"tool":"agent",attempts:[],usage:[],filesRead:[],gateEvals:[],stepErrors:[],crashRedrives:0,workerSessionReuses:0,contextInjections:[],hookFires:[],validationPinAttached:!1,gateEscalated:!1,toolExecutorCmd:g.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,h=new Set,c=new Set,v=new Set,d=g=>{let m=n.get(g);return m===void 0&&(m=dA(g),n.set(g,m)),m};for(const g of e){const m=typeof g.ord=="number"?g.ord:void 0;switch(g.type){case"sessionStarted":r.status="planning";break;case"unitPlanned":if(m!==void 0){const y=d(m);y.description=typeof g.description=="string"?g.description:y.description;const b=(g.hasValidatorPin??g.has_validator_pin)===!0,_=g.executorType??g.executor_type,R=g.skillRef??g.skill_ref;y.resolved?(y.role===null&&typeof g.role=="string"&&(y.role=g.role),y.gate===null&&typeof g.gate=="string"&&(y.gate=g.gate),!y.hasValidatorPin&&b&&(y.hasValidatorPin=!0),y.executorType===null&&typeof _=="string"&&(y.executorType=_)):(typeof g.stage=="string"&&(y.stage=g.stage),typeof g.role=="string"&&(y.role=g.role),typeof g.gate=="string"&&(y.gate=g.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=d(m);y.status==="pending"&&(y.status="distributed"),typeof g.cli=="string"&&y.assignedCli===null&&(y.assignedCli=g.cli)}break;case"unitExecuting":if(m!==void 0){const y=d(m);y.status==="pending"&&(y.status="distributed")}break;case"unitDone":m!==void 0&&(d(m).status="done");break;case"unitDenied":m!==void 0&&(d(m).status="rejected");break;case"awaitingHuman":m!==void 0&&(r.status="awaiting_human",i={ord:m,prompt:typeof g.prompt=="string"?g.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 g.attempt=="number"){const y=d(m);y.attempts.includes(g.attempt)||(y.attempts.push(g.attempt),y.attempts.sort((b,_)=>b-_))}break;case"cliUsage":if(m!==void 0&&typeof g.attempt=="number"&&typeof g.inputTokens=="number"&&typeof g.outputTokens=="number"){const y=d(m),b=typeof g.costUsd=="number"?g.costUsd:null,_=y.usage.find(R=>R.attempt===g.attempt);_?(_.inputTokens=g.inputTokens,_.outputTokens=g.outputTokens,_.costUsd=b):y.usage.push({attempt:g.attempt,inputTokens:g.inputTokens,outputTokens:g.outputTokens,costUsd:b})}break;case"dataUsed":if(m!==void 0&&Array.isArray(g.files)){const y=d(m);for(const b of g.files)typeof b=="string"&&!y.filesRead.includes(b)&&y.filesRead.push(b)}break;case"gateEvaluated":if(m!==void 0){const y=d(m),b={criterion:g.criterion??null,hasDeterministicFloor:g.hasDeterministicFloor===!0,deterministicPass:g.deterministicPass===!0,agentVerdict:g.agentVerdict??null,agentReasoning:g.agentReasoning??null,evaluatorPass:typeof g.evaluatorPass=="boolean"?g.evaluatorPass:null,denialReason:g.denialReason??null,combined:g.combined===!0},_=X1(b);y.gateEvals.some(R=>X1(R)===_)||y.gateEvals.push(b)}break;case"stepFailed":if(m!==void 0&&typeof g.attempt=="number"&&typeof g.detail=="string"&&typeof g.failureKind=="string"){const y=d(m);y.stepErrors.some(b=>b.attempt===g.attempt)||y.stepErrors.push({attempt:g.attempt,detail:g.detail,failureKind:g.failureKind})}break;case"crashRecoveryRedrive":if(m!==void 0&&typeof g.attempt=="number"){let y=u.get(m);y||(y=new Set,u.set(m,y)),y.has(g.attempt)||(y.add(g.attempt),d(m).crashRedrives+=1)}break;case"workerSessionStarted":typeof g.terminalId=="string"&&(s=g.terminalId);break;case"acpSessionStarted":break;case"acpFallback":typeof g.cliKey=="string"&&typeof g.reason=="string"&&typeof g.fallbackKind=="string"&&(o.some(b=>b.cliKey===g.cliKey&&b.reason===g.reason&&b.fallbackKind===g.fallbackKind)||o.push({cliKey:g.cliKey,reason:g.reason,fallbackKind:g.fallbackKind}));break;case"workerSessionReused":if(m!==void 0&&typeof g.terminalId=="string"){const y=`${m}:${g.terminalId}`;h.has(y)||(h.add(y),d(m).workerSessionReuses+=1)}break;case"workerSessionClosed":typeof g.terminalId=="string"&&(g.reason==="run_complete"||g.reason==="error")&&(a={terminalId:g.terminalId,reason:g.reason});break;case"unitContextInjected":if(m!==void 0&&Array.isArray(g.priorUnits)&&!c.has(m)){c.add(m);const y=d(m);for(const b of g.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 g.attempt=="number"&&typeof g.toolName=="string"&&(g.decision==="allow"||g.decision==="deny")){const y=`${m}:${g.attempt}:${g.toolName}`;v.has(y)||(v.add(y),d(m).hookFires.push({toolName:g.toolName,decision:g.decision,denyingPolicy:typeof g.denyingPolicy=="string"?g.denyingPolicy:null}))}break;case"validationPinAttached":m!==void 0&&(d(m).validationPinAttached=!0);break;case"gateEscalated":m!==void 0&&(d(m).gateEscalated=!0);break;case"toolExecutorDispatched":m!==void 0&&Array.isArray(g.cmd)&&(d(m).toolExecutorCmd=g.cmd);break;case"governanceContextArmed":m!==void 0&&(d(m).governanceArmed=!0);break;case"workflowSelected":l===null&&typeof g.workflowId=="string"&&(l=g.workflowId);break;case"unitReworkAmended":if(m!==void 0&&typeof g.amendment=="string"){const y=d(m);y.reworkAmendment=g.amendment,typeof g.updatedDescription=="string"&&(y.description=g.updatedDescription)}break;case"unitOutputCaptured":if(m!==void 0&&typeof g.attempt=="number"&&typeof g.outputBytes=="number"&&typeof g.governed=="boolean"){const y=d(m);y.outputBytes=g.outputBytes,y.outputGoverned=g.governed}break}}const x=[...n.values()].sort((g,m)=>g.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 vA(t,e){const r=t==null?void 0:t.trim();return r?K1(r.split(/\s+/)[0]??"")==="claude":e!==null&&K1(e)==="claude"}function gA(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 c of t.units){const v=c.status==="distributed"||c.status==="done"||c.status==="rejected";c.usage.length===0&&c.assignedCli!==null&&v&&(vA(c.assignedInvocation,c.assignedCli)?u.add(c.assignedCli):l.add(c.assignedCli));const d=c.assignedCli??"unknown",x=c.usage.length>0?Math.min(...c.usage.map(w=>w.attempt)):0;for(const w of c.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 g=a.get(d)??{cli:d,input:0,output:0,cost:null};g.input+=w.inputTokens,g.output+=w.outputTokens,w.costUsd!==null&&(g.cost=(g.cost??0)+w.costUsd),a.set(d,g)}}const h=e+r;return{totalInput:e,totalOutput:r,totalTokens:h,totalCost:i>0?n:null,costComplete:s>0&&i===s,reworkTokens:o,reworkPct:h>0?o/h*100:0,perCli:[...a.values()],noAdapterClis:[...l],pendingUsageClis:[...u],hasUsage:s>0}}const mA=[];function yA(t,e){const r=Sc(o=>o.byRun[t])??mA,[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)fA.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:pA(n,r),[n,r,t])}const Q1=2e5,Es=500;function J_(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=J_(r,e.ord);let c=(n.outputs[u]??"")+e.chunk;return c.length>Q1&&(c=c.slice(c.length-Q1)),{seq:i,outputs:{...n.outputs,[u]:c}}}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:""},h=n.assumptions[r]??[];return{seq:i,assumptions:{...n.assumptions,[r]:[...h,u]}}}if((e.type==="councilConvened"||e.type==="councilDeliberated"||e.type==="councilVoted")&&typeof e.ord=="number"){const u=`${r}:${e.ord}`,h=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}:{}},c={seq:i,type:e.type,ts:Date.now(),detail:Op(e)};c.ord=e.ord,typeof e.attempt=="number"&&(c.attempt=e.attempt);const d=[...n.logs[r]??[],c];return d.length>Es&&d.splice(0,d.length-Es),{seq:i,councilStatus:{...n.councilStatus,[u]:h},logs:{...n.logs,[r]:d}}}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 h={seq:i,type:e.type,ts:Date.now(),detail:Op(e)};h.ord=e.ord;const v=[...n.logs[r]??[],h];return v.length>Es&&v.splice(0,v.length-Es),{logs:{...n.logs,[r]:v}}})()}}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 xA(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 bA({model:t}){const e=t.units.filter(n=>n.resolved&&n.routing!=null),r=Pa(n=>n.assumptions[t.session.id])??[];return S.jsxs("div",{"data-testid":"assumptions",className:"flex flex-col gap-2 text-[11px]",children:[r.length>0&&S.jsxs("div",{className:"flex flex-col gap-1",children:[S.jsx("p",{className:"font-mono font-semibold",style:{color:"rgba(230,237,243,0.6)"},children:"external transformations"}),S.jsx("ul",{className:"flex flex-col gap-1",children:r.map((n,i)=>S.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:[S.jsxs("div",{className:"flex items-center gap-1.5",children:[S.jsxs("span",{style:{color:"#e6edf3"},children:["unit #",n.ord]}),S.jsx("span",{style:{color:"#79c0ff"},children:n.library}),!n.known&&S.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"})]}),S.jsx("p",{style:{color:"rgba(230,237,243,0.7)"},children:n.transform}),S.jsx("p",{style:{color:"rgba(230,237,243,0.45)"},children:n.detail})]},`${n.ord}:${n.library}:${i}`))})]}),e.length===0?S.jsx("p",{style:{color:"rgba(230,237,243,0.4)"},children:"No routing decisions recorded yet."}):S.jsx("ul",{className:"flex flex-col gap-1",children:e.map(n=>S.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:[S.jsxs("span",{className:"font-medium",style:{color:"#e6edf3"},children:["unit #",n.ord]}),n.description.includes(" — ")&&S.jsx("span",{className:"ml-1",style:{color:"rgba(230,237,243,0.4)"},children:n.description.split(" — ")[0]})," ","— ",xA(n.routing)]},n.ord))})]})}const wA=new Set(["completed","cancelled","failed"]),_A=new Intl.NumberFormat("en-US");function $o(t){return _A.format(t)}function Z1(t){return t===null?"—":`$${t.toFixed(4)}`}function SA({model:t}){const e=gA(t),n=!wA.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 S.jsxs("div",{"data-testid":"burn",className:"flex flex-col gap-2 text-[11px]",children:[e.hasUsage?S.jsxs(S.Fragment,{children:[S.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[S.jsxs("div",{style:i,children:[S.jsxs("p",{style:{color:"rgba(230,237,243,0.4)"},children:["tokens",n?" (partial)":""]}),S.jsx("p",{className:"font-mono text-sm",style:{color:"#e6edf3"},children:$o(e.totalTokens)}),S.jsxs("p",{className:"text-[10px]",style:{color:"rgba(230,237,243,0.35)"},children:[$o(e.totalInput)," in / ",$o(e.totalOutput)," out"]})]}),S.jsxs("div",{style:i,children:[S.jsxs("p",{style:{color:"rgba(230,237,243,0.4)"},children:["cost",e.costComplete&&!n?"":" (partial)"]}),S.jsx("p",{className:"font-mono text-sm",style:{color:"#e6edf3"},children:Z1(e.totalCost)}),e.totalCost===null&&S.jsx("p",{className:"text-[10px]",style:{color:"rgba(230,237,243,0.35)"},children:"no cost reported"})]}),S.jsxs("div",{style:i,"data-testid":"burn-rework",children:[S.jsxs("p",{style:{color:"rgba(230,237,243,0.4)"},children:["rework",n?" (prov.)":""]}),S.jsxs("p",{className:"font-mono text-sm",style:{color:"#e6edf3"},children:[n?"~":"",e.reworkPct.toFixed(0),"%"]}),S.jsxs("p",{className:"text-[10px]",style:{color:"rgba(230,237,243,0.35)"},children:[$o(e.reworkTokens)," tok"]})]})]}),n&&S.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."}),S.jsxs("div",{children:[S.jsx("p",{className:"mb-1",style:{color:"rgba(230,237,243,0.4)"},children:"per CLI"}),S.jsx("ul",{className:"flex flex-col gap-0.5",children:e.perCli.map(s=>S.jsxs("li",{className:"flex justify-between font-mono",style:{color:"rgba(230,237,243,0.6)"},children:[S.jsx("span",{children:s.cli}),S.jsxs("span",{children:[$o(s.input+s.output)," tok · ",Z1(s.cost)]})]},s.cli))})]})]}):S.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 ",S.jsx("code",{children:"cliUsage"})," ","(claude reports tokens + cost directly)."]}),e.noAdapterClis.length>0&&S.jsxs("p",{style:{color:"#ffda19"},"data-testid":"burn-unavailable",children:["usage unavailable for ",e.noAdapterClis.join(", ")," — no usage adapter"]}),e.pendingUsageClis.length>0&&S.jsxs("p",{style:{color:"rgba(230,237,243,0.4)"},"data-testid":"burn-pending",children:["usage not yet reported for ",e.pendingUsageClis.join(", ")]})]})}function CA({model:t}){const e=t.units.filter(r=>r.filesRead.length>0);return S.jsxs("div",{"data-testid":"data-used",className:"flex flex-col gap-2 text-[11px]",children:[e.length===0?S.jsxs("p",{style:{color:"rgba(230,237,243,0.4)"},"data-testid":"data-used-empty",children:["No files-read captured yet — populated from claude ",S.jsx("code",{children:"tool_use"})," blocks via"," ",S.jsx("code",{children:"dataUsed"}),"."]}):S.jsx("ul",{className:"flex flex-col gap-2",children:e.map(r=>S.jsxs("li",{"data-testid":"data-used-unit","data-ord":r.ord,children:[S.jsxs("p",{className:"font-semibold font-mono",style:{color:"rgba(230,237,243,0.7)"},children:["unit #",r.ord,r.assignedCli?` · ${r.assignedCli}`:""]}),S.jsx("ul",{className:"mt-0.5 flex flex-col gap-0.5",children:r.filesRead.map(n=>S.jsx("li",{className:"truncate font-mono",style:{color:"rgba(230,237,243,0.45)"},title:n,children:n},n))})]},r.ord))}),S.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 EA({routing:t}){return t?t.method==="council"?S.jsxs("p",{className:"text-[11px] font-mono",style:{color:"rgba(230,237,243,0.45)"},"data-testid":"routing-provenance",children:[S.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"?S.jsxs("p",{className:"text-[11px] font-mono",style:{color:"#ffda19"},"data-testid":"routing-provenance",children:[S.jsx("span",{className:"font-medium",children:"Degraded:"})," ",t.reason]}):t.method==="tool"?S.jsxs("p",{className:"text-[11px] font-mono",style:{color:"rgba(230,237,243,0.4)"},"data-testid":"routing-provenance",children:[S.jsx("span",{className:"font-medium",children:"Tool:"})," direct command — no council"]}):S.jsxs("p",{className:"text-[11px] font-mono",style:{color:"#a78bfa"},"data-testid":"routing-provenance",children:[S.jsx("span",{className:"font-medium",children:"Evaluator-distinct:"})," ",t.winner," (was ",t.was,")"]}):null}function kA(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 TA({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 S.jsx("div",{"data-testid":"decisions-ledger",className:"flex flex-col gap-2",children:i.length===0&&n===null?S.jsx("p",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"No governed decisions recorded yet."}):S.jsxs("ol",{className:"flex flex-col gap-2",children:[i.map(l=>S.jsxs("li",{"data-testid":"ledger-row","data-ord":l.ord,style:a,children:[S.jsxs("div",{className:"flex items-center justify-between mb-1",children:[S.jsxs("div",{className:"flex items-center gap-1",children:[S.jsxs("span",{className:"font-semibold text-[11px] font-mono",style:{color:"#e6edf3"},children:["unit #",l.ord]}),(l.role==="creator"||l.role==="evaluator")&&S.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"&&S.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&&S.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]})]}),S.jsx("span",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.35)"},children:l.resolved?l.stage:"resolving…"})]}),S.jsx(EA,{routing:l.routing}),l.skillRef&&S.jsxs("p",{className:"text-[11px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:["skill: ",S.jsx("span",{style:{color:"rgba(230,237,243,0.6)"},children:l.skillRef})]}),l.gateEvals.map((u,h)=>S.jsxs("div",{className:"mt-1 rounded p-1.5",style:{background:"#0f1419",border:"1px solid rgba(230,237,243,0.05)"},children:[S.jsxs("p",{className:"text-[11px] font-mono",children:[S.jsx("span",{className:"font-semibold",style:{color:u.combined?"#3fb950":"#f85149"},children:u.combined?"ALLOW":"DENY"}),S.jsxs("span",{style:{color:"rgba(230,237,243,0.45)"},children:[" · ",kA(u),u.criterion?` · ${u.criterion}`:" · (ungated)"]})]}),u.hasDeterministicFloor&&S.jsxs("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:["deterministic: ",u.deterministicPass?"pass":"fail"]}),u.agentVerdict!==null&&S.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&&S.jsxs("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:["evaluator: ",u.evaluatorPass?"pass":"fail"]}),u.denialReason&&S.jsxs("p",{className:"text-[10px] font-mono",style:{color:"#f85149"},children:["reason: ",u.denialReason]})]},h)),l.denialReason&&l.gateEvals.length===0&&S.jsxs("p",{className:"mt-1 text-[11px] font-mono",style:{color:"#f85149"},"data-testid":"ledger-denial",children:["denied: ",l.denialReason]})]},l.ord)),n!==null&&S.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:[S.jsx("span",{className:"font-semibold",children:"PENDING"})," · awaiting human · before unit #",n.ord,n.prompt?` — ${n.prompt}`:""]}),s!==null&&S.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 RA({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 S.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 LA({claim:t}){const[e,r]=ae.useState(!1),n=new Date(t.evaluated_at*1e3).toLocaleTimeString();return S.jsxs("li",{className:"rounded p-2 text-[11px]",style:{background:"#161c26",border:"1px solid rgba(230,237,243,0.07)"},children:[S.jsxs("div",{className:"flex items-center justify-between gap-2",children:[S.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[S.jsx(RA,{decision:t.decision}),S.jsx("span",{className:"font-mono truncate",style:{color:"rgba(230,237,243,0.6)"},children:t.phase})]}),S.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[S.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)&&S.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&&S.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&&S.jsxs("p",{children:[S.jsx("span",{className:"font-semibold",style:{color:"rgba(230,237,243,0.7)"},children:"criteria: "}),t.criteria]}),t.policy_ids.length>0&&S.jsxs("div",{children:[S.jsx("p",{className:"font-semibold",style:{color:"rgba(230,237,243,0.7)"},children:"policies matched:"}),S.jsx("ul",{className:"list-inside list-disc pl-1",children:t.policy_ids.map(i=>S.jsx("li",{children:i},i))})]}),t.obligations.length>0&&S.jsxs("div",{children:[S.jsx("p",{className:"font-semibold",style:{color:"rgba(230,237,243,0.7)"},children:"obligations:"}),S.jsx("ul",{className:"list-inside list-disc pl-1",children:t.obligations.map((i,s)=>S.jsx("li",{children:i},s))})]}),S.jsxs("p",{children:["evaluator: ",S.jsx("span",{children:t.evaluator_identity})," · ","claim: ",S.jsx("span",{children:t.claim_id})]})]})]})}function NA({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:c}=await lt.listClaims();r(c.filter(v=>v.scope===t.session.id).sort((v,d)=>v.evaluated_at-d.evaluated_at))}catch(c){o(c instanceof Error?c.message:String(c))}finally{i(!1)}},[t.session.id]);ae.useEffect(()=>{a()},[a]);const l=S.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 S.jsx("p",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Loading governance claims…"});if(s)return S.jsxs("div",{className:"flex flex-col gap-1",children:[S.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 S.jsxs("div",{className:"flex flex-col gap-1",children:[S.jsx("p",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"No governance claims recorded for this run."}),S.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(c=>c.decision==="deny").length,h=e.filter(c=>c.decision==="allow_with_conditions").length;return S.jsxs("div",{className:"flex flex-col gap-2",children:[S.jsxs("div",{className:"flex items-center justify-between",children:[S.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&&S.jsxs("span",{className:"ml-1 font-semibold",style:{color:"#f85149"},children:["· ",u," denied"]}),h>0&&S.jsxs("span",{className:"ml-1",style:{color:"#ffda19"},children:["· ",h," with obligations"]})]}),l]}),S.jsx("ol",{className:"flex flex-col gap-1.5",children:e.map(c=>S.jsx(LA,{claim:c},c.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]),S.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"rgba(0,0,0,0.6)"},children:S.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:[S.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:[S.jsx("h2",{id:i,className:"text-sm font-semibold font-mono",style:{color:"#e6edf3"},children:t}),S.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:"✕"})]}),S.jsx("div",{className:"flex-1 overflow-auto p-4",children:r})]})})}const DA={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 AA({runId:t}){const e=zv(r=>r.entries).filter(r=>r.runId===t);return e.length===0?S.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."}):S.jsxs("div",{className:"flex flex-col gap-2",children:[S.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."}),S.jsx("ol",{"data-testid":"steering-timeline",className:"flex flex-col gap-2",children:e.map(r=>{const n=DA[r.action];return S.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:[S.jsxs("div",{className:"flex items-center justify-between",children:[S.jsx("span",{className:"font-semibold font-mono",style:{color:n.color},children:n.label}),S.jsx("span",{className:"font-mono",style:{color:"rgba(230,237,243,0.35)"},children:typeof r.ord=="number"?`before unit #${r.ord}`:"—"})]}),r.amend&&S.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:[S.jsx("span",{className:"font-medium",style:{color:"#e6edf3"},children:"amended instruction:"})," ",r.amend]}),S.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 MA(){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},h=this&&this.__param||function(y,b){return function(_,R){b(_,R,y)}};Object.defineProperty(a,"__esModule",{value:!0}),a.AccessibilityManager=void 0;const c=l(9042),v=l(9924),d=l(844),x=l(4725),w=l(2585),g=l(3656);let m=a.AccessibilityManager=class extends d.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 v.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,g.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,d.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+=c.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([h(1,w.IInstantiationService),h(2,x.ICoreBrowserService),h(3,x.IRenderService)],m)},3614:(o,a)=>{function l(v){return v.replace(/\r?\n/g,"\r")}function u(v,d){return d?"\x1B[200~"+v+"\x1B[201~":v}function h(v,d,x,w){v=u(v=l(v),x.decPrivateModes.bracketedPasteMode&&w.rawOptions.ignoreBracketedPasteMode!==!0),x.triggerDataEvent(v,!0),d.value=""}function c(v,d,x){const w=x.getBoundingClientRect(),g=v.clientX-w.left-10,m=v.clientY-w.top-10;d.style.width="20px",d.style.height="20px",d.style.left=`${g}px`,d.style.top=`${m}px`,d.style.zIndex="1000",d.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(v,d){v.clipboardData&&v.clipboardData.setData("text/plain",d.selectionText),v.preventDefault()},a.handlePasteEvent=function(v,d,x,w){v.stopPropagation(),v.clipboardData&&h(v.clipboardData.getData("text/plain"),d,x,w)},a.paste=h,a.moveTextAreaUnderMouseCursor=c,a.rightClickHandler=function(v,d,x,w,g){c(v,d,x),g&&w.rightClickSelect(v),d.value=w.selectionText,d.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(h,c,v){this._css.set(h,c,v)}getCss(h,c){return this._css.get(h,c)}setColor(h,c,v){this._color.set(h,c,v)}getColor(h,c){return this._color.get(h,c)}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,h,c){l.addEventListener(u,h,c);let v=!1;return{dispose:()=>{v||(v=!0,l.removeEventListener(u,h,c))}}}},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},h=this&&this.__param||function(m,y){return function(b,_){y(b,_,m)}};Object.defineProperty(a,"__esModule",{value:!0}),a.Linkifier=void 0;const c=l(3656),v=l(8460),d=l(844),x=l(2585),w=l(4725);let g=a.Linkifier=class extends d.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 v.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new v.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,d.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,d.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,c.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,c.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,c.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,c.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,d.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=g=u([h(1,w.IMouseService),h(2,w.IRenderService),h(3,x.IBufferService),h(4,w.ILinkProviderService)],g)},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,g,m,y){var b,_=arguments.length,R=_<3?g:y===null?y=Object.getOwnPropertyDescriptor(g,m):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(w,g,m,y);else for(var E=w.length-1;E>=0;E--)(b=w[E])&&(R=(_<3?b(R):_>3?b(g,m,R):b(g,m))||R);return _>3&&R&&Object.defineProperty(g,m,R),R},h=this&&this.__param||function(w,g){return function(m,y){g(m,y,w)}};Object.defineProperty(a,"__esModule",{value:!0}),a.OscLinkProvider=void 0;const c=l(511),v=l(2585);let d=a.OscLinkProvider=class{constructor(w,g,m){this._bufferService=w,this._optionsService=g,this._oscLinkService=m}provideLinks(w,g){var N;const m=this._bufferService.buffer.lines.get(w-1);if(!m)return void g(void 0);const y=[],b=this._optionsService.rawOptions.linkHandler,_=new c.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)}}g(y)}};function x(w,g){if(confirm(`Do you want to navigate to ${g}?
|
|
378
|
+
|
|
379
|
+
WARNING: This link could potentially be dangerous`)){const m=window.open();if(m){try{m.opener=null}catch{}m.location.href=g}else console.warn("Opening link blocked as opener could not be cleared")}}a.OscLinkProvider=d=u([h(0,v.IBufferService),h(1,v.IOptionsService),h(2,v.IOscLinkService)],d)},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,h){this._rowCount=h,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),h=l(3656),c=l(3551),v=l(9042),d=l(3730),x=l(1680),w=l(3107),g=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(d.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,h.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,h.addDisposableDomListener)(this.textarea,"paste",Y)),this.register((0,h.addDisposableDomListener)(this.element,"paste",Y)),I.isFirefox?this.register((0,h.addDisposableDomListener)(this.element,"mousedown",(q=>{q.button===2&&(0,u.rightClickHandler)(q,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,h.addDisposableDomListener)(this.element,"contextmenu",(q=>{(0,u.rightClickHandler)(q,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),I.isLinux&&this.register((0,h.addDisposableDomListener)(this.element,"auxclick",(q=>{q.button===1&&(0,u.moveTextAreaUnderMouseCursor)(q,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,h.addDisposableDomListener)(this.textarea,"keyup",(Y=>this._keyUp(Y)),!0)),this.register((0,h.addDisposableDomListener)(this.textarea,"keydown",(Y=>this._keyDown(Y)),!0)),this.register((0,h.addDisposableDomListener)(this.textarea,"keypress",(Y=>this._keyPress(Y)),!0)),this.register((0,h.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,h.addDisposableDomListener)(this.textarea,"compositionupdate",(Y=>this._compositionHelper.compositionupdate(Y)))),this.register((0,h.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,h.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,h.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",v.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,h.addDisposableDomListener)(this.textarea,"focus",(X=>this._handleTextAreaFocus(X)))),this.register((0,h.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(c.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,h.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(w.BufferDecorationRenderer,this.screenElement)),this.register((0,h.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(g.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(X=>{!this._overviewRulerRenderer&&X&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(g.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,h.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,h.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 ze=0;ze<Math.abs(ce);ze++)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,h.addDisposableDomListener)(q,"touchstart",(ie=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(ie),this.cancel(ie)}),{passive:!0})),this.register((0,h.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,h){this._rowCount=h,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 c=Date.now();if(c-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=c,this._innerRefresh();else if(!this._additionalRefreshRequested){const v=c-this._lastRefreshMs,d=this._debounceThresholdMS-v;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),d)}}_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},h=this&&this.__param||function(m,y){return function(b,_){y(b,_,m)}};Object.defineProperty(a,"__esModule",{value:!0}),a.Viewport=void 0;const c=l(3656),v=l(4725),d=l(8460),x=l(844),w=l(2585);let g=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 d.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,c.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=g=u([h(2,w.IBufferService),h(3,w.IOptionsService),h(4,v.ICharSizeService),h(5,v.IRenderService),h(6,v.ICoreBrowserService),h(7,v.IThemeService)],g)},3107:function(o,a,l){var u=this&&this.__decorate||function(w,g,m,y){var b,_=arguments.length,R=_<3?g:y===null?y=Object.getOwnPropertyDescriptor(g,m):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(w,g,m,y);else for(var E=w.length-1;E>=0;E--)(b=w[E])&&(R=(_<3?b(R):_>3?b(g,m,R):b(g,m))||R);return _>3&&R&&Object.defineProperty(g,m,R),R},h=this&&this.__param||function(w,g){return function(m,y){g(m,y,w)}};Object.defineProperty(a,"__esModule",{value:!0}),a.BufferDecorationRenderer=void 0;const c=l(4725),v=l(844),d=l(2585);let x=a.BufferDecorationRenderer=class extends v.Disposable{constructor(w,g,m,y,b){super(),this._screenElement=w,this._bufferService=g,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,v.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 g=this._coreBrowserService.mainDocument.createElement("div");g.classList.add("xterm-decoration"),g.classList.toggle("xterm-decoration-top-layer",((y=w==null?void 0:w.options)==null?void 0:y.layer)==="top"),g.style.width=`${Math.round((w.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,g.style.height=(w.options.height||1)*this._renderService.dimensions.css.cell.height+"px",g.style.top=(w.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",g.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const m=w.options.x??0;return m&&m>this._bufferService.cols&&(g.style.display="none"),this._refreshXPosition(w,g),g}_refreshStyle(w){const g=w.marker.line-this._bufferService.buffers.active.ydisp;if(g<0||g>=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=g*this._renderService.dimensions.css.cell.height+"px",m.style.display=this._altBufferIsActive?"none":"block",w.onRenderEmitter.fire(m)}}_refreshXPosition(w,g=w.element){if(!g)return;const m=w.options.x??0;(w.options.anchor||"left")==="right"?g.style.right=m?m*this._renderService.dimensions.css.cell.width+"px":"":g.style.left=m?m*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(w){var g;(g=this._decorationElements.get(w))==null||g.remove(),this._decorationElements.delete(w),w.dispose()}};a.BufferDecorationRenderer=x=u([h(1,d.IBufferService),h(2,c.ICoreBrowserService),h(3,d.IDecorationService),h(4,c.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,h){return u>=l.startBufferLine-this._linePadding[h||"full"]&&u<=l.endBufferLine+this._linePadding[h||"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},h=this&&this.__param||function(b,_){return function(R,E){_(R,E,b)}};Object.defineProperty(a,"__esModule",{value:!0}),a.OverviewRulerRenderer=void 0;const c=l(5871),v=l(4725),d=l(844),x=l(2585),w={full:0,left:0,center:0,right:0},g={full:0,left:0,center:0,right:0},m={full:0,left:0,center:0,right:0};let y=a.OverviewRulerRenderer=class extends d.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 c.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,d.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);g.full=this._canvas.width,g.left=b,g.center=_,g.right=b,this._refreshDrawHeightConstants(),m.full=0,m.left=0,m.center=g.left,m.right=g.left+g.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),g[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([h(2,x.IBufferService),h(3,x.IDecorationService),h(4,v.IRenderService),h(5,x.IOptionsService),h(6,v.ICoreBrowserService)],y)},2950:function(o,a,l){var u=this&&this.__decorate||function(w,g,m,y){var b,_=arguments.length,R=_<3?g:y===null?y=Object.getOwnPropertyDescriptor(g,m):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(w,g,m,y);else for(var E=w.length-1;E>=0;E--)(b=w[E])&&(R=(_<3?b(R):_>3?b(g,m,R):b(g,m))||R);return _>3&&R&&Object.defineProperty(g,m,R),R},h=this&&this.__param||function(w,g){return function(m,y){g(m,y,w)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CompositionHelper=void 0;const c=l(4725),v=l(2585),d=l(2584);let x=a.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(w,g,m,y,b,_){this._textarea=w,this._compositionView=g,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 g={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let m;this._isSendingComposition=!1,g.start+=this._dataAlreadySent.length,m=this._isComposing?this._textarea.value.substring(g.start,g.end):this._textarea.value.substring(g.start),m.length>0&&this._coreService.triggerDataEvent(m,!0)}}),0)}else{this._isSendingComposition=!1;const g=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(g,!0)}}_handleAnyTextareaChanges(){const w=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const g=this._textarea.value,m=g.replace(w,"");this._dataAlreadySent=m,g.length>w.length?this._coreService.triggerDataEvent(m,!0):g.length<w.length?this._coreService.triggerDataEvent(`${d.C0.DEL}`,!0):g.length===w.length&&g!==w&&this._coreService.triggerDataEvent(g,!0)}}),0)}updateCompositionElements(w){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const g=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=g*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([h(2,v.IBufferService),h(3,v.IOptionsService),h(4,v.ICoreService),h(5,c.IRenderService)],x)},9806:(o,a)=>{function l(u,h,c){const v=c.getBoundingClientRect(),d=u.getComputedStyle(c),x=parseInt(d.getPropertyValue("padding-left")),w=parseInt(d.getPropertyValue("padding-top"));return[h.clientX-v.left-x,h.clientY-v.top-w]}Object.defineProperty(a,"__esModule",{value:!0}),a.getCoords=a.getCoordsRelativeToElement=void 0,a.getCoordsRelativeToElement=l,a.getCoords=function(u,h,c,v,d,x,w,g,m){if(!x)return;const y=l(u,h,c);return y?(y[0]=Math.ceil((y[0]+(m?w/2:0))/w),y[1]=Math.ceil(y[1]/g),y[0]=Math.min(Math.max(y[0],1),v+(m?1:0)),y[1]=Math.min(Math.max(y[1],1),d),y):void 0}},9504:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.moveToCellSequence=void 0;const u=l(2584);function h(g,m,y,b){const _=g-c(g,y),R=m-c(m,y),E=Math.abs(_-R)-(function(T,k,N){let M=0;const B=T-c(T,N),A=k-c(k,N);for(let j=0;j<Math.abs(B-A);j++){const D=v(T,k)==="A"?-1:1,I=N.buffer.lines.get(B+D*j);I!=null&&I.isWrapped&&M++}return M})(g,m,y);return w(E,x(v(g,m),b))}function c(g,m){let y=0,b=m.buffer.lines.get(g),_=b==null?void 0:b.isWrapped;for(;_&&g>=0&&g<m.rows;)y++,b=m.buffer.lines.get(--g),_=b==null?void 0:b.isWrapped;return y}function v(g,m){return g>m?"A":"B"}function d(g,m,y,b,_,R){let E=g,T=m,k="";for(;E!==y||T!==b;)E+=_?1:-1,_&&E>R.cols-1?(k+=R.buffer.translateBufferLineToString(T,!1,g,E),E=0,g=0,T++):!_&&E<0&&(k+=R.buffer.translateBufferLineToString(T,!1,0,g+1),E=R.cols-1,g=E,T--);return k+R.buffer.translateBufferLineToString(T,!1,g,E)}function x(g,m){const y=m?"O":"[";return u.C0.ESC+y+g}function w(g,m){g=Math.floor(g);let y="";for(let b=0;b<g;b++)y+=m;return y}a.moveToCellSequence=function(g,m,y,b){const _=y.buffer.x,R=y.buffer.y;if(!y.buffer.hasScrollback)return(function(k,N,M,B,A,j){return h(N,B,A,j).length===0?"":w(d(k,N,k,N-c(N,A),!1,A).length,x("D",j))})(_,R,0,m,y,b)+h(R,m,y,b)+(function(k,N,M,B,A,j){let D;D=h(N,B,A,j).length>0?B-c(B,A):N;const I=B,U=(function(W,H,z,P,F,G){let $;return $=h(z,P,F,G).length>0?P-c(P,F):H,W<z&&$<=P||W>=z&&$<P?"C":"D"})(k,N,M,B,A,j);return w(d(k,D,M,I,U==="C",A).length,x(U,j))})(_,R,g,m,y,b);let E;if(R===m)return E=_>g?"D":"C",w(Math.abs(_-g),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?g:_,y)+(T-1)*y.cols+1+((R>m?_:g)-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},h=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 c=l(3787),v=l(2550),d=l(2223),x=l(6171),w=l(6052),g=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(c.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 v.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}${d.INVERTED_DEFAULT_COLOR} { color: ${m.color.opaque(j.background).css}; }${this._terminalSelector} .${T}${d.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${m.color.multiplyOpacity(m.color.opaque(j.background),.5).css}; }${this._terminalSelector} .${k}${d.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([h(7,_.IInstantiationService),h(8,g.ICharSizeService),h(9,_.IOptionsService),h(10,_.IBufferService),h(11,g.ICoreBrowserService),h(12,g.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},h=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 c=l(2223),v=l(643),d=l(511),x=l(2585),w=l(8055),g=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 d.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,ze=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]),ze=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()||v.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()?$+=v.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<=ze&&(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()?v.WHITESPACE_CELL_CHAR:_e.getChars()||v.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(),We=_e.getFgColorMode(),Ye=_e.getBgColor(),ge=_e.getBgColorMode();const Ce=!!_e.isInverse();if(Ce){const te=De;De=Ye,Ye=te;const oe=We;We=ge,ge=oe}let Ae,Fe,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&&(We=50331648,De=te.foregroundColorRGB.rgba>>8&16777215,Fe=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&&(We=50331648,De=z.selectionForeground.rgba>>8&16777215,Fe=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-${c.INVERTED_DEFAULT_COLOR}`)):me=z.background}switch(Ae||_e.isDim()&&(Ae=w.color.multiplyOpacity(me,.5)),We){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,Fe)||this._addStyle(P,`color:#${R(De.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(P,me,z.foreground,_e,Ae,Fe)||Ce&&J.push(`xterm-fg-${c.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=ze}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([h(1,g.ICharacterJoinerService),h(2,x.IOptionsService),h(3,g.ICoreBrowserService),h(4,x.ICoreService),h(5,x.IDecorationService),h(6,g.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 h=l.createElement("span");h.classList.add("xterm-char-measure-element");const c=l.createElement("span");c.classList.add("xterm-char-measure-element"),c.style.fontWeight="bold";const v=l.createElement("span");v.classList.add("xterm-char-measure-element"),v.style.fontStyle="italic";const d=l.createElement("span");d.classList.add("xterm-char-measure-element"),d.style.fontWeight="bold",d.style.fontStyle="italic",this._measureElements=[h,c,v,d],this._container.appendChild(h),this._container.appendChild(c),this._container.appendChild(v),this._container.appendChild(d),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,h,c){l===this._font&&u===this._fontSize&&h===this._weight&&c===this._weightBold||(this._font=l,this._fontSize=u,this._weight=h,this._weightBold=c,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${h}`,this._measureElements[1].style.fontWeight=`${c}`,this._measureElements[2].style.fontWeight=`${h}`,this._measureElements[3].style.fontWeight=`${c}`,this.clear())}get(l,u,h){let c=0;if(!u&&!h&&l.length===1&&(c=l.charCodeAt(0))<256){if(this._flat[c]!==-9999)return this._flat[c];const x=this._measure(l,0);return x>0&&(this._flat[c]=x),x}let v=l;u&&(v+="B"),h&&(v+="I");let d=this._holey.get(v);if(d===void 0){let x=0;u&&(x|=1),h&&(x|=2),d=this._measure(l,x),d>0&&this._holey.set(v,d)}return d}_measure(l,u){const h=this._measureElements[u];return h.textContent=l.repeat(32),h.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(h){return 57508<=h&&h<=57558}function u(h){return h>=128512&&h<=128591||h>=127744&&h<=128511||h>=128640&&h<=128767||h>=9728&&h<=9983||h>=9984&&h<=10175||h>=65024&&h<=65039||h>=129280&&h<=129535||h>=127462&&h<=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(h){if(!h)throw new Error("value must not be falsy");return h},a.isPowerlineGlyph=l,a.isRestrictedPowerlineGlyph=function(h){return 57520<=h&&h<=57527},a.isEmoji=u,a.allowRescaling=function(h,c,v,d){return c===1&&v>Math.ceil(1.5*d)&&h!==void 0&&h>255&&!u(h)&&!l(h)&&!(function(x){return 57344<=x&&x<=63743})(h)},a.treatGlyphAsBackgroundColor=function(h){return l(h)||(function(c){return 9472<=c&&c<=9631})(h)},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(h,c,v=0){return(h-(2*Math.round(c)-v))%(2*Math.round(c))}},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(h,c,v,d=!1){if(this.selectionStart=c,this.selectionEnd=v,!c||!v||c[0]===v[0]&&c[1]===v[1])return void this.clear();const x=h.buffers.active.ydisp,w=c[1]-x,g=v[1]-x,m=Math.max(w,0),y=Math.min(g,h.rows-1);m>=h.rows||y<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=d,this.viewportStartRow=w,this.viewportEndRow=g,this.viewportCappedStartRow=m,this.viewportCappedEndRow=y,this.startCol=c[0],this.endCol=v[0])}isCellSelected(h,c,v){return!!this.hasSelection&&(v-=h.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?c>=this.startCol&&v>=this.viewportCappedStartRow&&c<this.endCol&&v<=this.viewportCappedEndRow:c<this.startCol&&v>=this.viewportCappedStartRow&&c>=this.endCol&&v<=this.viewportCappedEndRow:v>this.viewportStartRow&&v<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&v===this.viewportStartRow&&c>=this.startCol&&c<this.endCol||this.viewportStartRow<this.viewportEndRow&&v===this.viewportEndRow&&c<this.endCol||this.viewportStartRow<this.viewportEndRow&&v===this.viewportStartRow&&c>=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},h=this&&this.__param||function(y,b){return function(_,R){b(_,R,y)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CharSizeService=void 0;const c=l(2585),v=l(8460),d=l(844);let x=a.CharSizeService=class extends d.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 v.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new m(this._optionsService))}catch{this._measureStrategy=this.register(new g(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([h(2,c.IOptionsService)],x);class w extends d.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 g 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},h=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 c=l(3734),v=l(643),d=l(511),x=l(2585);class w extends c.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 g=a.CharacterJoinerService=class eS{constructor(y){this._bufferService=y,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new d.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||v.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++)eS._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||v.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=g=u([h(0,x.IBufferService)],g)},5114:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CoreBrowserService=void 0;const u=l(844),h=l(8460),c=l(3656);class v extends u.Disposable{constructor(w,g,m){super(),this._textarea=w,this._window=g,this.mainDocument=m,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new d(this._window),this._onDprChange=this.register(new h.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new h.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((y=>this._screenDprMonitor.setWindow(y)))),this.register((0,h.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=v;class d extends u.Disposable{constructor(w){super(),this._parentWindow=w,this._windowResizeListener=this.register(new u.MutableDisposable),this._onDprChange=this.register(new h.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,c.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 h extends u.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,u.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(v){return this.linkProviders.push(v),{dispose:()=>{const d=this.linkProviders.indexOf(v);d!==-1&&this.linkProviders.splice(d,1)}}}}a.LinkProviderService=h},8934:function(o,a,l){var u=this&&this.__decorate||function(x,w,g,m){var y,b=arguments.length,_=b<3?w:m===null?m=Object.getOwnPropertyDescriptor(w,g):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(x,w,g,m);else for(var R=x.length-1;R>=0;R--)(y=x[R])&&(_=(b<3?y(_):b>3?y(w,g,_):y(w,g))||_);return b>3&&_&&Object.defineProperty(w,g,_),_},h=this&&this.__param||function(x,w){return function(g,m){w(g,m,x)}};Object.defineProperty(a,"__esModule",{value:!0}),a.MouseService=void 0;const c=l(4725),v=l(9806);let d=a.MouseService=class{constructor(x,w){this._renderService=x,this._charSizeService=w}getCoords(x,w,g,m,y){return(0,v.getCoords)(window,x,w,g,m,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,y)}getMouseReportCoords(x,w){const g=(0,v.getCoordsRelativeToElement)(window,x,w);if(this._charSizeService.hasValidSize)return g[0]=Math.min(Math.max(g[0],0),this._renderService.dimensions.css.canvas.width-1),g[1]=Math.min(Math.max(g[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(g[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(g[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(g[0]),y:Math.floor(g[1])}}};a.MouseService=d=u([h(0,c.IRenderService),h(1,c.ICharSizeService)],d)},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},h=this&&this.__param||function(y,b){return function(_,R){b(_,R,y)}};Object.defineProperty(a,"__esModule",{value:!0}),a.RenderService=void 0;const c=l(6193),v=l(4725),d=l(8460),x=l(844),w=l(7226),g=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 d.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new d.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new d.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new d.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new c.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([h(2,g.IOptionsService),h(3,v.ICharSizeService),h(4,g.IDecorationService),h(5,g.IBufferService),h(6,v.ICoreBrowserService),h(7,v.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},h=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 c=l(9806),v=l(9504),d=l(456),x=l(4725),w=l(8460),g=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 g.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 d.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,g.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,c.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,v.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([h(3,_.IBufferService),h(4,_.ICoreService),h(5,x.IMouseService),h(6,_.IOptionsService),h(7,x.IRenderService),h(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},h=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 c=l(7239),v=l(8055),d=l(8460),x=l(844),w=l(2585),g=v.css.toColor("#ffffff"),m=v.css.toColor("#000000"),y=v.css.toColor("#ffffff"),b=v.css.toColor("#000000"),_={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};a.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const T=[v.css.toColor("#2e3436"),v.css.toColor("#cc0000"),v.css.toColor("#4e9a06"),v.css.toColor("#c4a000"),v.css.toColor("#3465a4"),v.css.toColor("#75507b"),v.css.toColor("#06989a"),v.css.toColor("#d3d7cf"),v.css.toColor("#555753"),v.css.toColor("#ef2929"),v.css.toColor("#8ae234"),v.css.toColor("#fce94f"),v.css.toColor("#729fcf"),v.css.toColor("#ad7fa8"),v.css.toColor("#34e2e2"),v.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:v.channels.toCss(M,B,A),rgba:v.channels.toRgba(M,B,A)})}for(let N=0;N<24;N++){const M=8+10*N;T.push({css:v.channels.toCss(M,M,M),rgba:v.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 c.ColorContrastCache,this._halfContrastCache=new c.ColorContrastCache,this._onChangeColors=this.register(new d.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:g,background:m,cursor:y,cursorAccent:b,selectionForeground:void 0,selectionBackgroundTransparent:_,selectionBackgroundOpaque:v.color.blend(m,_),selectionInactiveBackgroundTransparent:_,selectionInactiveBackgroundOpaque:v.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,g),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=v.color.blend(k.background,k.selectionBackgroundTransparent),k.selectionInactiveBackgroundTransparent=E(T.selectionInactiveBackground,k.selectionBackgroundTransparent),k.selectionInactiveBackgroundOpaque=v.color.blend(k.background,k.selectionInactiveBackgroundTransparent),k.selectionForeground=T.selectionForeground?E(T.selectionForeground,v.NULL_COLOR):void 0,k.selectionForeground===v.NULL_COLOR&&(k.selectionForeground=void 0),v.color.isOpaque(k.selectionBackgroundTransparent)&&(k.selectionBackgroundTransparent=v.color.opacity(k.selectionBackgroundTransparent,.3)),v.color.isOpaque(k.selectionInactiveBackgroundTransparent)&&(k.selectionInactiveBackgroundTransparent=v.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 v.css.toColor(T)}catch{}return k}a.ThemeService=R=u([h(0,w.IOptionsService)],R)},6349:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CircularList=void 0;const u=l(8460),h=l(844);class c extends h.Disposable{constructor(d){super(),this._maxLength=d,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(d){if(this._maxLength===d)return;const x=new Array(d);for(let w=0;w<Math.min(d,this.length);w++)x[w]=this._array[this._getCyclicIndex(w)];this._array=x,this._maxLength=d,this._startIndex=0}get length(){return this._length}set length(d){if(d>this._length)for(let x=this._length;x<d;x++)this._array[x]=void 0;this._length=d}get(d){return this._array[this._getCyclicIndex(d)]}set(d,x){this._array[this._getCyclicIndex(d)]=x}push(d){this._array[this._getCyclicIndex(this._length)]=d,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(d,x,...w){if(x){for(let g=d;g<this._length-x;g++)this._array[this._getCyclicIndex(g)]=this._array[this._getCyclicIndex(g+x)];this._length-=x,this.onDeleteEmitter.fire({index:d,amount:x})}for(let g=this._length-1;g>=d;g--)this._array[this._getCyclicIndex(g+w.length)]=this._array[this._getCyclicIndex(g)];for(let g=0;g<w.length;g++)this._array[this._getCyclicIndex(d+g)]=w[g];if(w.length&&this.onInsertEmitter.fire({index:d,amount:w.length}),this._length+w.length>this._maxLength){const g=this._length+w.length-this._maxLength;this._startIndex+=g,this._length=this._maxLength,this.onTrimEmitter.fire(g)}else this._length+=w.length}trimStart(d){d>this._length&&(d=this._length),this._startIndex+=d,this._length-=d,this.onTrimEmitter.fire(d)}shiftElements(d,x,w){if(!(x<=0)){if(d<0||d>=this._length)throw new Error("start argument out of range");if(d+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(d+m+w,this.get(d+m));const g=d+x+w-this._length;if(g>0)for(this._length+=g;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let g=0;g<x;g++)this.set(d+g+w,this.get(d+g))}}_getCyclicIndex(d){return(this._startIndex+d)%this._maxLength}}a.CircularList=c},1439:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.clone=void 0,a.clone=function l(u,h=5){if(typeof u!="object")return u;const c=Array.isArray(u)?[]:{};for(const v in u)c[v]=h<=1?u[v]:u[v]&&l(u[v],h-1);return c}},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,h=0,c=0;var v,d,x,w,g;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)}}})(v||(a.channels=v={})),(function(b){function _(R,E){return c=Math.round(255*E),[l,u,h]=g.toChannels(R.rgba),{css:v.toCss(l,u,h,c),rgba:v.toRgba(l,u,h,c)}}b.blend=function(R,E){if(c=(255&E.rgba)/255,c===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)*c),u=B+Math.round((k-B)*c),h=A+Math.round((N-A)*c),{css:v.toCss(l,u,h),rgba:v.toRgba(l,u,h)}},b.isOpaque=function(R){return(255&R.rgba)==255},b.ensureContrastRatio=function(R,E,T){const k=g.ensureContrastRatio(R.rgba,E.rgba,T);if(k)return v.toColor(k>>24&255,k>>16&255,k>>8&255)},b.opaque=function(R){const E=(255|R.rgba)>>>0;return[l,u,h]=g.toChannels(E),{css:v.toCss(l,u,h),rgba:E}},b.opacity=_,b.multiplyOpacity=function(R,E){return c=255&R.rgba,_(R,c*E/255)},b.toColorRGB=function(R){return[R.rgba>>24&255,R.rgba>>16&255,R.rgba>>8&255]}})(d||(a.color=d={})),(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),h=parseInt(E.slice(3,4).repeat(2),16),v.toColor(l,u,h);case 5:return l=parseInt(E.slice(1,2).repeat(2),16),u=parseInt(E.slice(2,3).repeat(2),16),h=parseInt(E.slice(3,4).repeat(2),16),c=parseInt(E.slice(4,5).repeat(2),16),v.toColor(l,u,h,c);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]),h=parseInt(T[3]),c=Math.round(255*(T[5]===void 0?1:parseFloat(T[5]))),v.toColor(l,u,h,c);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,h,c]=_.getImageData(0,0,1,1).data,c!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:v.toRgba(l,u,h,c),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(c=(255&T)/255,c===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)*c),u=A+Math.round((N-A)*c),h=j+Math.round((M-j)*c),v.toRgba(l,u,h)},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]}})(g||(a.rgba=g={})),a.toPaddedHex=m,a.contrastRatio=y},8969:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CoreTerminal=void 0;const u=l(844),h=l(2585),c=l(4348),v=l(7866),d=l(744),x=l(7302),w=l(6975),g=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 g.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 g.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new g.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new g.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new g.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new g.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new g.EventEmitter),this._instantiationService=new c.InstantiationService,this.optionsService=this.register(new x.OptionsService(B)),this._instantiationService.setService(h.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(d.BufferService)),this._instantiationService.setService(h.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(v.LogService)),this._instantiationService.setService(h.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(w.CoreService)),this._instantiationService.setService(h.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(m.CoreMouseService)),this._instantiationService.setService(h.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(y.UnicodeService)),this._instantiationService.setService(h.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(b.CharsetService),this._instantiationService.setService(h.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(T.OscLinkService),this._instantiationService.setService(h.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,g.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,g.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,g.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,g.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,g.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(B,A){this._writeBuffer.write(B,A)}writeSync(B,A){this._logService.logLevel<=h.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,d.MINIMUM_COLS),A=Math.max(A,d.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 h=[];for(let c=0;c<this._listeners.length;c++)h.push(this._listeners[c]);for(let c=0;c<h.length;c++)h[c].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((h=>u.fire(h)))},a.runAndSubscribe=function(l,u){return u(void 0),l((h=>u(h)))}},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},h=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 c=l(2584),v=l(7116),d=l(2015),x=l(844),w=l(482),g=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 d.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=g.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=g.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(c.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(c.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(c.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(c.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(c.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(c.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(c.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(c.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(c.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(c.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(c.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(c.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 v.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 ze=ee[String.fromCharCode(G)];ze&&(G=ze.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 ze=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 g.BufferLine&&X.copyCellsFrom(ze,_e,0,Le,!1);_e<ne;)ze.setCellFromCodepoint(_e++,0,1,K)}else if(this._activeBuffer.x=ne-1,$===2)continue}if(de&&this._activeBuffer.x){const ze=X.getWidth(this._activeBuffer.x-1)?1:2;X.addCodepointToCell(this._activeBuffer.x-ze,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(g.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(c.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(c.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(z){return z.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(c.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(c.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(z.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(c.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,v.DEFAULT_CHARSET),this._charsetService.setgCharset(1,v.DEFAULT_CHARSET),this._charsetService.setgCharset(2,v.DEFAULT_CHARSET),this._charsetService.setgCharset(3,v.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(`${c.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=g.DEFAULT_ATTR_DATA.fg,z.bg=g.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&g.DEFAULT_ATTR_DATA.fg):F===49?(G.bg&=-67108864,G.bg|=16777215&g.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&g.DEFAULT_ATTR_DATA.fg,G.bg&=-67108864,G.bg|=16777215&g.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(`${c.C0.ESC}[0n`);break;case 6:const P=this._activeBuffer.y+1,F=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${c.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(`${c.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=g.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(`${c.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,v.DEFAULT_CHARSET),!0}selectCharset(z){return z.length!==2?(this.selectDefaultCharset(),!0):(z[0]==="/"||this._charsetService.setgCharset(M[z[0]],v.CHARSETS[z[1]]||v.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=g.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=g.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(`${c.C0.ESC}${$}${c.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([h(0,R.IBufferService)],U)},844:(o,a)=>{function l(u){for(const h of u)h.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 h=this._disposables.indexOf(u);h!==-1&&this._disposables.splice(h,1)}},a.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(u){var h;this._isDisposed||u===this._value||((h=this._value)==null||h.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(h,c,v){this._data[h]||(this._data[h]={}),this._data[h][c]=v}get(h,c){return this._data[h]?this._data[h][c]:void 0}clear(){this._data={}}}a.TwoKeyMap=l,a.FourKeyMap=class{constructor(){this._data=new l}set(u,h,c,v,d){this._data.get(u,h)||this._data.set(u,h,new l),this._data.get(u,h).set(c,v,d)}get(u,h,c,v){var d;return(d=this._data.get(u,h))==null?void 0:d.get(c,v)}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 h=l.match(/Version\/(\d+)/);return h===null||h.length<2?0:parseInt(h[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 h=this._getKey(u);if(h===void 0||(l=this._search(h),l===-1)||this._getKey(this._array[l])!==h)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])===h);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,h){if(this._array.length!==0&&(l=this._search(u),!(l<0||l>=this._array.length)&&this._getKey(this._array[l])===u))do h(this._array[l]);while(++l<this._array.length&&this._getKey(this._array[l])===u)}values(){return[...this._array].values()}_search(u){let h=0,c=this._array.length-1;for(;c>=h;){let v=h+c>>1;const d=this._getKey(this._array[v]);if(d>u)c=v-1;else{if(!(d<u)){for(;v>0&&this._getKey(this._array[v-1])===u;)v--;return v}h=v+1}}return h}}},7226:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.DebouncedIdleTask=a.IdleTaskQueue=a.PriorityTaskQueue=void 0;const u=l(6114);class h{constructor(){this._tasks=[],this._i=0}enqueue(d){this._tasks.push(d),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(d){this._idleCallback=void 0;let x=0,w=0,g=d.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=d.timeRemaining(),1.5*w>m)return g-x<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(g-x))}ms`),void this._start();g=m}this.clear()}}class c extends h{_requestCallback(d){return setTimeout((()=>d(this._createDeadline(16))))}_cancelCallback(d){clearTimeout(d)}_createDeadline(d){const x=Date.now()+d;return{timeRemaining:()=>Math.max(0,x-Date.now())}}}a.PriorityTaskQueue=c,a.IdleTaskQueue=!u.isNode&&"requestIdleCallback"in window?class extends h{_requestCallback(v){return requestIdleCallback(v)}_cancelCallback(v){cancelIdleCallback(v)}}:c,a.DebouncedIdleTask=class{constructor(){this._queue=new a.IdleTaskQueue}set(v){this._queue.clear(),this._queue.enqueue(v)}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(h){const c=h.buffer.lines.get(h.buffer.ybase+h.buffer.y-1),v=c==null?void 0:c.get(h.cols-1),d=h.buffer.lines.get(h.buffer.ybase+h.buffer.y);d&&v&&(d.isWrapped=v[u.CHAR_DATA_CODE_INDEX]!==u.NULL_CELL_CODE&&v[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(c){return[c>>>16&255,c>>>8&255,255&c]}static fromColorRGB(c){return(255&c[0])<<16|(255&c[1])<<8|255&c[2]}clone(){const c=new l;return c.fg=this.fg,c.bg=this.bg,c.extended=this.extended.clone(),c}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(c){this._ext=c}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(c){this._ext&=-469762049,this._ext|=c<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(c){this._ext&=-67108864,this._ext|=67108863&c}get urlId(){return this._urlId}set urlId(c){this._urlId=c}get underlineVariantOffset(){const c=(3758096384&this._ext)>>29;return c<0?4294967288^c:c}set underlineVariantOffset(c){this._ext&=536870911,this._ext|=c<<29&3758096384}constructor(c=0,v=0){this._ext=0,this._urlId=0,this._ext=c,this._urlId=v}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),h=l(7226),c=l(3734),v=l(8437),d=l(4634),x=l(511),w=l(643),g=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=v.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 h.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 c.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 c.ExtendedAttrs),this._whitespaceCell}getBlankLine(y,b){return new v.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=v.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(v.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 v.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 v.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,d.reflowLargerGetLinesToRemove)(this.lines,this._cols,y,this.ybase+this.y,this.getNullCell(v.DEFAULT_ATTR_DATA));if(_.length>0){const R=(0,d.reflowLargerCreateNewLayout)(this.lines,_);(0,d.reflowLargerApplyNewLayout)(this.lines,R.layout),this._reflowLargerAdjustViewport(y,b,R.countRemoved)}}_reflowLargerAdjustViewport(y,b,_){const R=this.getNullCell(v.DEFAULT_ATTR_DATA);let E=_;for(;E-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<b&&this.lines.push(new v.BufferLine(y,R))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-_,0)}_reflowSmaller(y,b){const _=this.getNullCell(v.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,d.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(v.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,d.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 g.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),h=l(511),c=l(643),v=l(482);a.DEFAULT_ATTR_DATA=Object.freeze(new u.AttributeData);let d=0;class x{constructor(g,m,y=!1){this.isWrapped=y,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*g);const b=m||h.CellData.fromCharData([0,c.NULL_CELL_CHAR,c.NULL_CELL_WIDTH,c.NULL_CELL_CODE]);for(let _=0;_<g;++_)this.setCell(_,b);this.length=g}get(g){const m=this._data[3*g+0],y=2097151&m;return[this._data[3*g+1],2097152&m?this._combined[g]:y?(0,v.stringFromCodePoint)(y):"",m>>22,2097152&m?this._combined[g].charCodeAt(this._combined[g].length-1):y]}set(g,m){this._data[3*g+1]=m[c.CHAR_DATA_ATTR_INDEX],m[c.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[g]=m[1],this._data[3*g+0]=2097152|g|m[c.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*g+0]=m[c.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|m[c.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(g){return this._data[3*g+0]>>22}hasWidth(g){return 12582912&this._data[3*g+0]}getFg(g){return this._data[3*g+1]}getBg(g){return this._data[3*g+2]}hasContent(g){return 4194303&this._data[3*g+0]}getCodePoint(g){const m=this._data[3*g+0];return 2097152&m?this._combined[g].charCodeAt(this._combined[g].length-1):2097151&m}isCombined(g){return 2097152&this._data[3*g+0]}getString(g){const m=this._data[3*g+0];return 2097152&m?this._combined[g]:2097151&m?(0,v.stringFromCodePoint)(2097151&m):""}isProtected(g){return 536870912&this._data[3*g+2]}loadCell(g,m){return d=3*g,m.content=this._data[d+0],m.fg=this._data[d+1],m.bg=this._data[d+2],2097152&m.content&&(m.combinedData=this._combined[g]),268435456&m.bg&&(m.extended=this._extendedAttrs[g]),m}setCell(g,m){2097152&m.content&&(this._combined[g]=m.combinedData),268435456&m.bg&&(this._extendedAttrs[g]=m.extended),this._data[3*g+0]=m.content,this._data[3*g+1]=m.fg,this._data[3*g+2]=m.bg}setCellFromCodepoint(g,m,y,b){268435456&b.bg&&(this._extendedAttrs[g]=b.extended),this._data[3*g+0]=m|y<<22,this._data[3*g+1]=b.fg,this._data[3*g+2]=b.bg}addCodepointToCell(g,m,y){let b=this._data[3*g+0];2097152&b?this._combined[g]+=(0,v.stringFromCodePoint)(m):2097151&b?(this._combined[g]=(0,v.stringFromCodePoint)(2097151&b)+(0,v.stringFromCodePoint)(m),b&=-2097152,b|=2097152):b=m|4194304,y&&(b&=-12582913,b|=y<<22),this._data[3*g+0]=b}insertCells(g,m,y){if((g%=this.length)&&this.getWidth(g-1)===2&&this.setCellFromCodepoint(g-1,0,1,y),m<this.length-g){const b=new h.CellData;for(let _=this.length-g-m-1;_>=0;--_)this.setCell(g+m+_,this.loadCell(g+_,b));for(let _=0;_<m;++_)this.setCell(g+_,y)}else for(let b=g;b<this.length;++b)this.setCell(b,y);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,y)}deleteCells(g,m,y){if(g%=this.length,m<this.length-g){const b=new h.CellData;for(let _=0;_<this.length-g-m;++_)this.setCell(g+_,this.loadCell(g+m+_,b));for(let _=this.length-m;_<this.length;++_)this.setCell(_,y)}else for(let b=g;b<this.length;++b)this.setCell(b,y);g&&this.getWidth(g-1)===2&&this.setCellFromCodepoint(g-1,0,1,y),this.getWidth(g)!==0||this.hasContent(g)||this.setCellFromCodepoint(g,0,1,y)}replaceCells(g,m,y,b=!1){if(b)for(g&&this.getWidth(g-1)===2&&!this.isProtected(g-1)&&this.setCellFromCodepoint(g-1,0,1,y),m<this.length&&this.getWidth(m-1)===2&&!this.isProtected(m)&&this.setCellFromCodepoint(m,0,1,y);g<m&&g<this.length;)this.isProtected(g)||this.setCell(g,y),g++;else for(g&&this.getWidth(g-1)===2&&this.setCellFromCodepoint(g-1,0,1,y),m<this.length&&this.getWidth(m-1)===2&&this.setCellFromCodepoint(m,0,1,y);g<m&&g<this.length;)this.setCell(g++,y)}resize(g,m){if(g===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const y=3*g;if(g>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<g;++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>=g&&delete this._combined[E]}const _=Object.keys(this._extendedAttrs);for(let R=0;R<_.length;R++){const E=parseInt(_[R],10);E>=g&&delete this._extendedAttrs[E]}}return this.length=g,4*y*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const g=new Uint32Array(this._data.length);return g.set(this._data),this._data=g,1}return 0}fill(g,m=!1){if(m)for(let y=0;y<this.length;++y)this.isProtected(y)||this.setCell(y,g);else{this._combined={},this._extendedAttrs={};for(let y=0;y<this.length;++y)this.setCell(y,g)}}copyFrom(g){this.length!==g.length?this._data=new Uint32Array(g._data):this._data.set(g._data),this.length=g.length,this._combined={};for(const m in g._combined)this._combined[m]=g._combined[m];this._extendedAttrs={};for(const m in g._extendedAttrs)this._extendedAttrs[m]=g._extendedAttrs[m];this.isWrapped=g.isWrapped}clone(){const g=new x(0);g._data=new Uint32Array(this._data),g.length=this.length;for(const m in this._combined)g._combined[m]=this._combined[m];for(const m in this._extendedAttrs)g._extendedAttrs[m]=this._extendedAttrs[m];return g.isWrapped=this.isWrapped,g}getTrimmedLength(){for(let g=this.length-1;g>=0;--g)if(4194303&this._data[3*g+0])return g+(this._data[3*g+0]>>22);return 0}getNoBgTrimmedLength(){for(let g=this.length-1;g>=0;--g)if(4194303&this._data[3*g+0]||50331648&this._data[3*g+2])return g+(this._data[3*g+0]>>22);return 0}copyCellsFrom(g,m,y,b,_){const R=g._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]=g._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]=g._extendedAttrs[m+T])}const E=Object.keys(g._combined);for(let T=0;T<E.length;T++){const k=parseInt(E[T],10);k>=m&&(this._combined[k-m+y]=g._combined[k])}}translateToString(g,m,y,b){m=m??0,y=y??this.length,g&&(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,v.stringFromCodePoint)(E):c.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,h,c){if(h===u.length-1)return u[h].getTrimmedLength();const v=!u[h].hasContent(c-1)&&u[h].getWidth(c-1)===1,d=u[h+1].getWidth(0)===2;return v&&d?c-1:c}Object.defineProperty(a,"__esModule",{value:!0}),a.getWrappedLineTrimmedLength=a.reflowSmallerGetNewLineLengths=a.reflowLargerApplyNewLayout=a.reflowLargerCreateNewLayout=a.reflowLargerGetLinesToRemove=void 0,a.reflowLargerGetLinesToRemove=function(u,h,c,v,d){const x=[];for(let w=0;w<u.length-1;w++){let g=w,m=u.get(++g);if(!m.isWrapped)continue;const y=[u.get(w)];for(;g<u.length&&m.isWrapped;)y.push(m),m=u.get(++g);if(v>=w&&v<g){w+=y.length-1;continue}let b=0,_=l(y,b,h),R=1,E=0;for(;R<y.length;){const k=l(y,R,h),N=k-E,M=c-_,B=Math.min(N,M);y[b].copyCellsFrom(y[R],E,_,B,!1),_+=B,_===c&&(b++,_=0),E+=B,E===k&&(R++,E=0),_===0&&b!==0&&y[b-1].getWidth(c-1)===2&&(y[b].copyCellsFrom(y[b-1],c-1,_++,1,!1),y[b-1].setCell(c-1,d))}y[b].replaceCells(_,c,d);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,h){const c=[];let v=0,d=h[v],x=0;for(let w=0;w<u.length;w++)if(d===w){const g=h[++v];u.onDeleteEmitter.fire({index:w-x,amount:g}),w+=g-1,x+=g,d=h[++v]}else c.push(w);return{layout:c,countRemoved:x}},a.reflowLargerApplyNewLayout=function(u,h){const c=[];for(let v=0;v<h.length;v++)c.push(u.get(h[v]));for(let v=0;v<c.length;v++)u.set(v,c[v]);u.length=h.length},a.reflowSmallerGetNewLineLengths=function(u,h,c){const v=[],d=u.map(((m,y)=>l(u,y,h))).reduce(((m,y)=>m+y));let x=0,w=0,g=0;for(;g<d;){if(d-g<c){v.push(d-g);break}x+=c;const m=l(u,w,h);x>m&&(x-=m,w++);const y=u[w].getWidth(x-1)===2;y&&x--;const b=y?c-1:c;v.push(b),g+=b}return v},a.getWrappedLineTrimmedLength=l},5295:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferSet=void 0;const u=l(8460),h=l(844),c=l(9092);class v extends h.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 c.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new c.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=v},511:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CellData=void 0;const u=l(482),h=l(643),c=l(3734);class v extends c.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new c.ExtendedAttrs,this.combinedData=""}static fromCharData(x){const w=new v;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[h.CHAR_DATA_ATTR_INDEX],this.bg=0;let w=!1;if(x[h.CHAR_DATA_CHAR_INDEX].length>2)w=!0;else if(x[h.CHAR_DATA_CHAR_INDEX].length===2){const g=x[h.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=g&&g<=56319){const m=x[h.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=m&&m<=57343?this.content=1024*(g-55296)+m-56320+65536|x[h.CHAR_DATA_WIDTH_INDEX]<<22:w=!0}else w=!0}else this.content=x[h.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|x[h.CHAR_DATA_WIDTH_INDEX]<<22;w&&(this.combinedData=x[h.CHAR_DATA_CHAR_INDEX],this.content=2097152|x[h.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}a.CellData=v},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),h=l(844);class c{get id(){return this._id}constructor(d){this.line=d,this.isDisposed=!1,this._disposables=[],this._id=c._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,h.disposeArray)(this._disposables),this._disposables.length=0)}register(d){return this._disposables.push(d),d}}a.Marker=c,c._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,h;Object.defineProperty(a,"__esModule",{value:!0}),a.C1_ESCAPED=a.C1=a.C0=void 0,(function(c){c.NUL="\0",c.SOH="",c.STX="",c.ETX="",c.EOT="",c.ENQ="",c.ACK="",c.BEL="\x07",c.BS="\b",c.HT=" ",c.LF=`
|
|
382
|
+
`,c.VT="\v",c.FF="\f",c.CR="\r",c.SO="",c.SI="",c.DLE="",c.DC1="",c.DC2="",c.DC3="",c.DC4="",c.NAK="",c.SYN="",c.ETB="",c.CAN="",c.EM="",c.SUB="",c.ESC="\x1B",c.FS="",c.GS="",c.RS="",c.US="",c.SP=" ",c.DEL=""})(l||(a.C0=l={})),(function(c){c.PAD="",c.HOP="",c.BPH="",c.NBH="",c.IND="",c.NEL="
",c.SSA="",c.ESA="",c.HTS="",c.HTJ="",c.VTS="",c.PLD="",c.PLU="",c.RI="",c.SS2="",c.SS3="",c.DCS="",c.PU1="",c.PU2="",c.STS="",c.CCH="",c.MW="",c.SPA="",c.EPA="",c.SOS="",c.SGCI="",c.SCI="",c.CSI="",c.ST="",c.OSC="",c.PM="",c.APC=""})(u||(a.C1=u={})),(function(c){c.ST=`${l.ESC}\\`})(h||(a.C1_ESCAPED=h={}))},7399:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.evaluateKeyboardEvent=void 0;const u=l(2584),h={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(c,v,d,x){const w={type:0,cancel:!1,key:void 0},g=(c.shiftKey?1:0)|(c.altKey?2:0)|(c.ctrlKey?4:0)|(c.metaKey?8:0);switch(c.keyCode){case 0:c.key==="UIKeyInputUpArrow"?w.key=v?u.C0.ESC+"OA":u.C0.ESC+"[A":c.key==="UIKeyInputLeftArrow"?w.key=v?u.C0.ESC+"OD":u.C0.ESC+"[D":c.key==="UIKeyInputRightArrow"?w.key=v?u.C0.ESC+"OC":u.C0.ESC+"[C":c.key==="UIKeyInputDownArrow"&&(w.key=v?u.C0.ESC+"OB":u.C0.ESC+"[B");break;case 8:w.key=c.ctrlKey?"\b":u.C0.DEL,c.altKey&&(w.key=u.C0.ESC+w.key);break;case 9:if(c.shiftKey){w.key=u.C0.ESC+"[Z";break}w.key=u.C0.HT,w.cancel=!0;break;case 13:w.key=c.altKey?u.C0.ESC+u.C0.CR:u.C0.CR,w.cancel=!0;break;case 27:w.key=u.C0.ESC,c.altKey&&(w.key=u.C0.ESC+u.C0.ESC),w.cancel=!0;break;case 37:if(c.metaKey)break;g?(w.key=u.C0.ESC+"[1;"+(g+1)+"D",w.key===u.C0.ESC+"[1;3D"&&(w.key=u.C0.ESC+(d?"b":"[1;5D"))):w.key=v?u.C0.ESC+"OD":u.C0.ESC+"[D";break;case 39:if(c.metaKey)break;g?(w.key=u.C0.ESC+"[1;"+(g+1)+"C",w.key===u.C0.ESC+"[1;3C"&&(w.key=u.C0.ESC+(d?"f":"[1;5C"))):w.key=v?u.C0.ESC+"OC":u.C0.ESC+"[C";break;case 38:if(c.metaKey)break;g?(w.key=u.C0.ESC+"[1;"+(g+1)+"A",d||w.key!==u.C0.ESC+"[1;3A"||(w.key=u.C0.ESC+"[1;5A")):w.key=v?u.C0.ESC+"OA":u.C0.ESC+"[A";break;case 40:if(c.metaKey)break;g?(w.key=u.C0.ESC+"[1;"+(g+1)+"B",d||w.key!==u.C0.ESC+"[1;3B"||(w.key=u.C0.ESC+"[1;5B")):w.key=v?u.C0.ESC+"OB":u.C0.ESC+"[B";break;case 45:c.shiftKey||c.ctrlKey||(w.key=u.C0.ESC+"[2~");break;case 46:w.key=g?u.C0.ESC+"[3;"+(g+1)+"~":u.C0.ESC+"[3~";break;case 36:w.key=g?u.C0.ESC+"[1;"+(g+1)+"H":v?u.C0.ESC+"OH":u.C0.ESC+"[H";break;case 35:w.key=g?u.C0.ESC+"[1;"+(g+1)+"F":v?u.C0.ESC+"OF":u.C0.ESC+"[F";break;case 33:c.shiftKey?w.type=2:c.ctrlKey?w.key=u.C0.ESC+"[5;"+(g+1)+"~":w.key=u.C0.ESC+"[5~";break;case 34:c.shiftKey?w.type=3:c.ctrlKey?w.key=u.C0.ESC+"[6;"+(g+1)+"~":w.key=u.C0.ESC+"[6~";break;case 112:w.key=g?u.C0.ESC+"[1;"+(g+1)+"P":u.C0.ESC+"OP";break;case 113:w.key=g?u.C0.ESC+"[1;"+(g+1)+"Q":u.C0.ESC+"OQ";break;case 114:w.key=g?u.C0.ESC+"[1;"+(g+1)+"R":u.C0.ESC+"OR";break;case 115:w.key=g?u.C0.ESC+"[1;"+(g+1)+"S":u.C0.ESC+"OS";break;case 116:w.key=g?u.C0.ESC+"[15;"+(g+1)+"~":u.C0.ESC+"[15~";break;case 117:w.key=g?u.C0.ESC+"[17;"+(g+1)+"~":u.C0.ESC+"[17~";break;case 118:w.key=g?u.C0.ESC+"[18;"+(g+1)+"~":u.C0.ESC+"[18~";break;case 119:w.key=g?u.C0.ESC+"[19;"+(g+1)+"~":u.C0.ESC+"[19~";break;case 120:w.key=g?u.C0.ESC+"[20;"+(g+1)+"~":u.C0.ESC+"[20~";break;case 121:w.key=g?u.C0.ESC+"[21;"+(g+1)+"~":u.C0.ESC+"[21~";break;case 122:w.key=g?u.C0.ESC+"[23;"+(g+1)+"~":u.C0.ESC+"[23~";break;case 123:w.key=g?u.C0.ESC+"[24;"+(g+1)+"~":u.C0.ESC+"[24~";break;default:if(!c.ctrlKey||c.shiftKey||c.altKey||c.metaKey)if(d&&!x||!c.altKey||c.metaKey)!d||c.altKey||c.ctrlKey||c.shiftKey||!c.metaKey?c.key&&!c.ctrlKey&&!c.altKey&&!c.metaKey&&c.keyCode>=48&&c.key.length===1?w.key=c.key:c.key&&c.ctrlKey&&(c.key==="_"&&(w.key=u.C0.US),c.key==="@"&&(w.key=u.C0.NUL)):c.keyCode===65&&(w.type=1);else{const m=h[c.keyCode],y=m==null?void 0:m[c.shiftKey?1:0];if(y)w.key=u.C0.ESC+y;else if(c.keyCode>=65&&c.keyCode<=90){const b=c.ctrlKey?c.keyCode-64:c.keyCode+32;let _=String.fromCharCode(b);c.shiftKey&&(_=_.toUpperCase()),w.key=u.C0.ESC+_}else if(c.keyCode===32)w.key=u.C0.ESC+(c.ctrlKey?u.C0.NUL:" ");else if(c.key==="Dead"&&c.code.startsWith("Key")){let b=c.code.slice(3,4);c.shiftKey||(b=b.toLowerCase()),w.key=u.C0.ESC+b,w.cancel=!0}}else c.keyCode>=65&&c.keyCode<=90?w.key=String.fromCharCode(c.keyCode-64):c.keyCode===32?w.key=u.C0.NUL:c.keyCode>=51&&c.keyCode<=55?w.key=String.fromCharCode(c.keyCode-51+27):c.keyCode===56?w.key=u.C0.DEL:c.keyCode===219?w.key=u.C0.ESC:c.keyCode===220?w.key=u.C0.FS:c.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,h=l.length){let c="";for(let v=u;v<h;++v){let d=l[v];d>65535?(d-=65536,c+=String.fromCharCode(55296+(d>>10))+String.fromCharCode(d%1024+56320)):c+=String.fromCharCode(d)}return c},a.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(l,u){const h=l.length;if(!h)return 0;let c=0,v=0;if(this._interim){const d=l.charCodeAt(v++);56320<=d&&d<=57343?u[c++]=1024*(this._interim-55296)+d-56320+65536:(u[c++]=this._interim,u[c++]=d),this._interim=0}for(let d=v;d<h;++d){const x=l.charCodeAt(d);if(55296<=x&&x<=56319){if(++d>=h)return this._interim=x,c;const w=l.charCodeAt(d);56320<=w&&w<=57343?u[c++]=1024*(x-55296)+w-56320+65536:(u[c++]=x,u[c++]=w)}else x!==65279&&(u[c++]=x)}return c}},a.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(l,u){const h=l.length;if(!h)return 0;let c,v,d,x,w=0,g=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>=h)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=h-4;let b=m;for(;b<h;){for(;!(!(b<y)||128&(c=l[b])||128&(v=l[b+1])||128&(d=l[b+2])||128&(x=l[b+3]));)u[w++]=c,u[w++]=v,u[w++]=d,u[w++]=x,b+=4;if(c=l[b++],c<128)u[w++]=c;else if((224&c)==192){if(b>=h)return this.interim[0]=c,w;if(v=l[b++],(192&v)!=128){b--;continue}if(g=(31&c)<<6|63&v,g<128){b--;continue}u[w++]=g}else if((240&c)==224){if(b>=h)return this.interim[0]=c,w;if(v=l[b++],(192&v)!=128){b--;continue}if(b>=h)return this.interim[0]=c,this.interim[1]=v,w;if(d=l[b++],(192&d)!=128){b--;continue}if(g=(15&c)<<12|(63&v)<<6|63&d,g<2048||g>=55296&&g<=57343||g===65279)continue;u[w++]=g}else if((248&c)==240){if(b>=h)return this.interim[0]=c,w;if(v=l[b++],(192&v)!=128){b--;continue}if(b>=h)return this.interim[0]=c,this.interim[1]=v,w;if(d=l[b++],(192&d)!=128){b--;continue}if(b>=h)return this.interim[0]=c,this.interim[1]=v,this.interim[2]=d,w;if(x=l[b++],(192&x)!=128){b--;continue}if(g=(7&c)<<18|(63&v)<<12|(63&d)<<6|63&x,g<65536||g>1114111)continue;u[w++]=g}}return w}}},225:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.UnicodeV6=void 0;const u=l(1480),h=[[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]],c=[[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 v;a.UnicodeV6=class{constructor(){if(this.version="6",!v){v=new Uint8Array(65536),v.fill(1),v[0]=0,v.fill(0,1,32),v.fill(0,127,160),v.fill(2,4352,4448),v[9001]=2,v[9002]=2,v.fill(2,11904,42192),v[12351]=1,v.fill(2,44032,55204),v.fill(2,63744,64256),v.fill(2,65040,65050),v.fill(2,65072,65136),v.fill(2,65280,65377),v.fill(2,65504,65511);for(let d=0;d<h.length;++d)v.fill(0,h[d][0],h[d][1]+1)}}wcwidth(d){return d<32?0:d<127?1:d<65536?v[d]:(function(x,w){let g,m=0,y=w.length-1;if(x<w[0][0]||x>w[y][1])return!1;for(;y>=m;)if(g=m+y>>1,x>w[g][1])m=g+1;else{if(!(x<w[g][0]))return!0;y=g-1}return!1})(d,c)?0:d>=131072&&d<=196605||d>=196608&&d<=262141?2:1}charProperties(d,x){let w=this.wcwidth(d),g=w===0&&x!==0;if(g){const m=u.UnicodeService.extractWidth(x);m===0?g=!1:m>w&&(w=m)}return u.UnicodeService.createPropertyValue(0,w,g)}}},5981:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.WriteBuffer=void 0;const u=l(8460),h=l(844);class c extends h.Disposable{constructor(d){super(),this._action=d,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(d,x){if(x!==void 0&&this._syncCalls>x)return void(this._syncCalls=0);if(this._pendingData+=d.length,this._writeBuffer.push(d),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let w;for(this._isSyncWriting=!0;w=this._writeBuffer.shift();){this._action(w);const g=this._callbacks.shift();g&&g()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(d,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+=d.length,this._writeBuffer.push(d),this._callbacks.push(x),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=d.length,this._writeBuffer.push(d),this._callbacks.push(x)}_innerWrite(d=0,x=!0){const w=d||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const g=this._writeBuffer[this._bufferOffset],m=this._action(g,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-=g.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=c},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 h(c,v){const d=c.toString(16),x=d.length<2?"0"+d:d;switch(v){case 4:return d[0];case 8:return x;case 12:return(x+x).slice(0,3);default:return x+x}}a.parseColor=function(c){if(!c)return;let v=c.toLowerCase();if(v.indexOf("rgb:")===0){v=v.slice(4);const d=l.exec(v);if(d){const x=d[1]?15:d[4]?255:d[7]?4095:65535;return[Math.round(parseInt(d[1]||d[4]||d[7]||d[10],16)/x*255),Math.round(parseInt(d[2]||d[5]||d[8]||d[11],16)/x*255),Math.round(parseInt(d[3]||d[6]||d[9]||d[12],16)/x*255)]}}else if(v.indexOf("#")===0&&(v=v.slice(1),u.exec(v)&&[3,6,9,12].includes(v.length))){const d=v.length/3,x=[0,0,0];for(let w=0;w<3;++w){const g=parseInt(v.slice(d*w,d*w+d),16);x[w]=d===1?g<<4:d===2?g:d===3?g>>4:g>>8}return x}},a.toRgbString=function(c,v=16){const[d,x,w]=c;return`rgb:${h(d,v)}/${h(x,v)}/${h(w,v)}`}},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),h=l(8742),c=l(5770),v=[];a.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=v,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=v}registerHandler(x,w){this._handlers[x]===void 0&&(this._handlers[x]=[]);const g=this._handlers[x];return g.push(w),{dispose:()=>{const m=g.indexOf(w);m!==-1&&g.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=v,this._ident=0}hook(x,w){if(this.reset(),this._ident=x,this._active=this._handlers[x]||v,this._active.length)for(let g=this._active.length-1;g>=0;g--)this._active[g].hook(w);else this._handlerFb(this._ident,"HOOK",w)}put(x,w,g){if(this._active.length)for(let m=this._active.length-1;m>=0;m--)this._active[m].put(x,w,g);else this._handlerFb(this._ident,"PUT",(0,u.utf32ToString)(x,w,g))}unhook(x,w=!0){if(this._active.length){let g=!1,m=this._active.length-1,y=!1;if(this._stack.paused&&(m=this._stack.loopPosition-1,g=w,y=this._stack.fallThrough,this._stack.paused=!1),!y&&g===!1){for(;m>=0&&(g=this._active[m].unhook(x),g!==!0);m--)if(g instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=m,this._stack.fallThrough=!1,g;m--}for(;m>=0;m--)if(g=this._active[m].unhook(!1),g instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=m,this._stack.fallThrough=!0,g}else this._handlerFb(this._ident,"UNHOOK",x);this._active=v,this._ident=0}};const d=new h.Params;d.addParam(0),a.DcsHandler=class{constructor(x){this._handler=x,this._data="",this._params=d,this._hitLimit=!1}hook(x){this._params=x.length>1||x.params[0]?x.clone():d,this._data="",this._hitLimit=!1}put(x,w,g){this._hitLimit||(this._data+=(0,u.utf32ToString)(x,w,g),this._data.length>c.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((g=>(this._params=d,this._data="",this._hitLimit=!1,g)));return this._params=d,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),h=l(8742),c=l(6242),v=l(6351);class d{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=d;const x=160;a.VT500_TRANSITION_TABLE=(function(){const g=new d(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 g.setDefault(1,0),g.addMany(b,0,2,0),R)g.addMany([24,26,153,154],E,3,0),g.addMany(y(128,144),E,3,0),g.addMany(y(144,152),E,3,0),g.add(156,E,0,0),g.add(27,E,11,1),g.add(157,E,4,8),g.addMany([152,158,159],E,0,7),g.add(155,E,11,3),g.add(144,E,11,9);return g.addMany(_,0,3,0),g.addMany(_,1,3,1),g.add(127,1,0,1),g.addMany(_,8,0,8),g.addMany(_,3,3,3),g.add(127,3,0,3),g.addMany(_,4,3,4),g.add(127,4,0,4),g.addMany(_,6,3,6),g.addMany(_,5,3,5),g.add(127,5,0,5),g.addMany(_,2,3,2),g.add(127,2,0,2),g.add(93,1,4,8),g.addMany(b,8,5,8),g.add(127,8,5,8),g.addMany([156,27,24,26,7],8,6,0),g.addMany(y(28,32),8,0,8),g.addMany([88,94,95],1,0,7),g.addMany(b,7,0,7),g.addMany(_,7,0,7),g.add(156,7,0,0),g.add(127,7,0,7),g.add(91,1,11,3),g.addMany(y(64,127),3,7,0),g.addMany(y(48,60),3,8,4),g.addMany([60,61,62,63],3,9,4),g.addMany(y(48,60),4,8,4),g.addMany(y(64,127),4,7,0),g.addMany([60,61,62,63],4,0,6),g.addMany(y(32,64),6,0,6),g.add(127,6,0,6),g.addMany(y(64,127),6,0,0),g.addMany(y(32,48),3,9,5),g.addMany(y(32,48),5,9,5),g.addMany(y(48,64),5,0,6),g.addMany(y(64,127),5,7,0),g.addMany(y(32,48),4,9,5),g.addMany(y(32,48),1,9,2),g.addMany(y(32,48),2,9,2),g.addMany(y(48,127),2,10,0),g.addMany(y(48,80),1,10,0),g.addMany(y(81,88),1,10,0),g.addMany([89,90,92],1,10,0),g.addMany(y(96,127),1,10,0),g.add(80,1,11,9),g.addMany(_,9,0,9),g.add(127,9,0,9),g.addMany(y(28,32),9,0,9),g.addMany(y(32,48),9,9,12),g.addMany(y(48,60),9,8,10),g.addMany([60,61,62,63],9,9,10),g.addMany(_,11,0,11),g.addMany(y(32,128),11,0,11),g.addMany(y(28,32),11,0,11),g.addMany(_,10,0,10),g.add(127,10,0,10),g.addMany(y(28,32),10,0,10),g.addMany(y(48,60),10,8,10),g.addMany([60,61,62,63],10,0,11),g.addMany(y(32,48),10,9,12),g.addMany(_,12,0,12),g.add(127,12,0,12),g.addMany(y(28,32),12,0,12),g.addMany(y(32,48),12,9,12),g.addMany(y(48,64),12,0,11),g.addMany(y(64,127),12,12,13),g.addMany(y(64,127),10,12,13),g.addMany(y(64,127),9,12,13),g.addMany(_,13,13,13),g.addMany(b,13,13,13),g.add(127,13,0,13),g.addMany([27,156,24,26],13,14,0),g.add(x,0,2,0),g.add(x,8,5,8),g.add(x,6,0,6),g.add(x,11,0,11),g.add(x,13,13,13),g})();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 h.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 c.OscParser),this._dcsParser=this.register(new v.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),h=l(482),c=[];a.OscParser=class{constructor(){this._state=0,this._active=c,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(v,d){this._handlers[v]===void 0&&(this._handlers[v]=[]);const x=this._handlers[v];return x.push(d),{dispose:()=>{const w=x.indexOf(d);w!==-1&&x.splice(w,1)}}}clearHandler(v){this._handlers[v]&&delete this._handlers[v]}setHandlerFallback(v){this._handlerFb=v}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=c}reset(){if(this._state===2)for(let v=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;v>=0;--v)this._active[v].end(!1);this._stack.paused=!1,this._active=c,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||c,this._active.length)for(let v=this._active.length-1;v>=0;v--)this._active[v].start();else this._handlerFb(this._id,"START")}_put(v,d,x){if(this._active.length)for(let w=this._active.length-1;w>=0;w--)this._active[w].put(v,d,x);else this._handlerFb(this._id,"PUT",(0,h.utf32ToString)(v,d,x))}start(){this.reset(),this._state=1}put(v,d,x){if(this._state!==3){if(this._state===1)for(;d<x;){const w=v[d++];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-d>0&&this._put(v,d,x)}}end(v,d=!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,g=!1;if(this._stack.paused&&(w=this._stack.loopPosition-1,x=d,g=this._stack.fallThrough,this._stack.paused=!1),!g&&x===!1){for(;w>=0&&(x=this._active[w].end(v),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",v);this._active=c,this._id=-1,this._state=0}}},a.OscHandler=class{constructor(v){this._handler=v,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(v,d,x){this._hitLimit||(this._data+=(0,h.utf32ToString)(v,d,x),this._data.length>u.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(v){let d=!1;if(this._hitLimit)d=!1;else if(v&&(d=this._handler(this._data),d instanceof Promise))return d.then((x=>(this._data="",this._hitLimit=!1,x)));return this._data="",this._hitLimit=!1,d}}},8742:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Params=void 0;const l=2147483647;class u{static fromArray(c){const v=new u;if(!c.length)return v;for(let d=Array.isArray(c[0])?1:0;d<c.length;++d){const x=c[d];if(Array.isArray(x))for(let w=0;w<x.length;++w)v.addSubParam(x[w]);else v.addParam(x)}return v}constructor(c=32,v=32){if(this.maxLength=c,this.maxSubParamsLength=v,v>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(c),this.length=0,this._subParams=new Int32Array(v),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(c),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const c=new u(this.maxLength,this.maxSubParamsLength);return c.params.set(this.params),c.length=this.length,c._subParams.set(this._subParams),c._subParamsLength=this._subParamsLength,c._subParamsIdx.set(this._subParamsIdx),c._rejectDigits=this._rejectDigits,c._rejectSubDigits=this._rejectSubDigits,c._digitIsSub=this._digitIsSub,c}toArray(){const c=[];for(let v=0;v<this.length;++v){c.push(this.params[v]);const d=this._subParamsIdx[v]>>8,x=255&this._subParamsIdx[v];x-d>0&&c.push(Array.prototype.slice.call(this._subParams,d,x))}return c}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(c){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(c<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=c>l?l:c}}addSubParam(c){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(c<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=c>l?l:c,this._subParamsIdx[this.length-1]++}}hasSubParams(c){return(255&this._subParamsIdx[c])-(this._subParamsIdx[c]>>8)>0}getSubParams(c){const v=this._subParamsIdx[c]>>8,d=255&this._subParamsIdx[c];return d-v>0?this._subParams.subarray(v,d):null}getSubParamsAll(){const c={};for(let v=0;v<this.length;++v){const d=this._subParamsIdx[v]>>8,x=255&this._subParamsIdx[v];x-d>0&&(c[v]=this._subParams.slice(d,x))}return c}addDigit(c){let v;if(this._rejectDigits||!(v=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const d=this._digitIsSub?this._subParams:this.params,x=d[v-1];d[v-1]=~x?Math.min(10*x+c,l):c}}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 h={instance:u,dispose:u.dispose,isDisposed:!1};this._addons.push(h),u.dispose=()=>this._wrappedAddonDispose(h),u.activate(l)}_wrappedAddonDispose(l){if(l.isDisposed)return;let u=-1;for(let h=0;h<this._addons.length;h++)if(this._addons[h]===l){u=h;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),h=l(511);a.BufferApiView=class{constructor(c,v){this._buffer=c,this.type=v}init(c){return this._buffer=c,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(c){const v=this._buffer.lines.get(c);if(v)return new u.BufferLineApiView(v)}getNullCell(){return new h.CellData}}},3785:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferLineApiView=void 0;const u=l(511);a.BufferLineApiView=class{constructor(h){this._line=h}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(h,c){if(!(h<0||h>=this._line.length))return c?(this._line.loadCell(h,c),c):this._line.loadCell(h,new u.CellData)}translateToString(h,c,v){return this._line.translateToString(h,c,v)}}},8285:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferNamespaceApi=void 0;const u=l(8771),h=l(8460),c=l(844);class v extends c.Disposable{constructor(x){super(),this._core=x,this._onBufferChange=this.register(new h.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=v},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,(h=>u(h.toArray())))}addCsiHandler(l,u){return this.registerCsiHandler(l,u)}registerDcsHandler(l,u){return this._core.registerDcsHandler(l,((h,c)=>u(h,c.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(g,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(g,m,y,b);else for(var T=g.length-1;T>=0;T--)(_=g[T])&&(E=(R<3?_(E):R>3?_(m,y,E):_(m,y))||E);return R>3&&E&&Object.defineProperty(m,y,E),E},h=this&&this.__param||function(g,m){return function(y,b){m(y,b,g)}};Object.defineProperty(a,"__esModule",{value:!0}),a.BufferService=a.MINIMUM_ROWS=a.MINIMUM_COLS=void 0;const c=l(8460),v=l(844),d=l(5295),x=l(2585);a.MINIMUM_COLS=2,a.MINIMUM_ROWS=1;let w=a.BufferService=class extends v.Disposable{get buffer(){return this.buffers.active}constructor(g){super(),this.isUserScrolling=!1,this._onResize=this.register(new c.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new c.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(g.rawOptions.cols||0,a.MINIMUM_COLS),this.rows=Math.max(g.rawOptions.rows||0,a.MINIMUM_ROWS),this.buffers=this.register(new d.BufferSet(g,this))}resize(g,m){this.cols=g,this.rows=m,this.buffers.resize(g,m),this._onResize.fire({cols:g,rows:m})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(g,m=!1){const y=this.buffer;let b;b=this._cachedBlankLine,b&&b.length===this.cols&&b.getFg(0)===g.fg&&b.getBg(0)===g.bg||(b=y.getBlankLine(g,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(g,m,y){const b=this.buffer;if(g<0){if(b.ydisp===0)return;this.isUserScrolling=!0}else g+b.ydisp>=b.ybase&&(this.isUserScrolling=!1);const _=b.ydisp;b.ydisp=Math.max(Math.min(b.ydisp+g,b.ybase),0),_!==b.ydisp&&(m||this._onScroll.fire(b.ydisp))}};a.BufferService=w=u([h(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},h=this&&this.__param||function(b,_){return function(R,E){_(R,E,b)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CoreMouseService=void 0;const c=l(2585),v=l(8460),d=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 g=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${g(_[0])}${g(_[1])}${g(_[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 d.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 v.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([h(0,c.IBufferService),h(1,c.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},h=this&&this.__param||function(y,b){return function(_,R){b(_,R,y)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CoreService=void 0;const c=l(1439),v=l(8460),d=l(844),x=l(2585),w=Object.freeze({insertMode:!1}),g=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let m=a.CoreService=class extends d.Disposable{constructor(y,b,_){super(),this._bufferService=y,this._logService=b,this._optionsService=_,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new v.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new v.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new v.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new v.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,c.clone)(w),this.decPrivateModes=(0,c.clone)(g)}reset(){this.modes=(0,c.clone)(w),this.decPrivateModes=(0,c.clone)(g)}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([h(0,x.IBufferService),h(1,x.ILogService),h(2,x.IOptionsService)],m)},9074:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.DecorationService=void 0;const u=l(8055),h=l(8460),c=l(844),v=l(6106);let d=0,x=0;class w extends c.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new v.SortedList((y=>y==null?void 0:y.marker.line)),this._onDecorationRegistered=this.register(new h.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new h.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,c.toDisposable)((()=>this.reset())))}registerDecoration(y){if(y.marker.isDisposed)return;const b=new g(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=>{d=E.options.x??0,x=d+(E.options.width??1),y>=d&&y<x&&(!_||(E.options.layer??"bottom")===_)&&R(E)}))}}a.DecorationService=w;class g extends c.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 h.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new h.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),h=l(8343);class c{constructor(...d){this._entries=new Map;for(const[x,w]of d)this.set(x,w)}set(d,x){const w=this._entries.get(d);return this._entries.set(d,x),w}forEach(d){for(const[x,w]of this._entries.entries())d(x,w)}has(d){return this._entries.has(d)}get(d){return this._entries.get(d)}}a.ServiceCollection=c,a.InstantiationService=class{constructor(){this._services=new c,this._services.set(u.IInstantiationService,this)}setService(v,d){this._services.set(v,d)}getService(v){return this._services.get(v)}createInstance(v,...d){const x=(0,h.getServiceDependencies)(v).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] ${v.name} depends on UNKNOWN service ${m.id}.`);w.push(y)}const g=x.length>0?x[0].index:d.length;if(d.length!==g)throw new Error(`[createInstance] First service dependency of ${v.name} at position ${g+1} conflicts with ${d.length} static arguments`);return new v(...d,...w)}}},7866:function(o,a,l){var u=this&&this.__decorate||function(g,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(g,m,y,b);else for(var T=g.length-1;T>=0;T--)(_=g[T])&&(E=(R<3?_(E):R>3?_(m,y,E):_(m,y))||E);return R>3&&E&&Object.defineProperty(m,y,E),E},h=this&&this.__param||function(g,m){return function(y,b){m(y,b,g)}};Object.defineProperty(a,"__esModule",{value:!0}),a.traceCall=a.setTraceLogger=a.LogService=void 0;const c=l(844),v=l(2585),d={trace:v.LogLevelEnum.TRACE,debug:v.LogLevelEnum.DEBUG,info:v.LogLevelEnum.INFO,warn:v.LogLevelEnum.WARN,error:v.LogLevelEnum.ERROR,off:v.LogLevelEnum.OFF};let x,w=a.LogService=class extends c.Disposable{get logLevel(){return this._logLevel}constructor(g){super(),this._optionsService=g,this._logLevel=v.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),x=this}_updateLogLevel(){this._logLevel=d[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(g){for(let m=0;m<g.length;m++)typeof g[m]=="function"&&(g[m]=g[m]())}_log(g,m,y){this._evalLazyOptionalParams(y),g.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+m,...y)}trace(g,...m){var y;this._logLevel<=v.LogLevelEnum.TRACE&&this._log(((y=this._optionsService.options.logger)==null?void 0:y.trace.bind(this._optionsService.options.logger))??console.log,g,m)}debug(g,...m){var y;this._logLevel<=v.LogLevelEnum.DEBUG&&this._log(((y=this._optionsService.options.logger)==null?void 0:y.debug.bind(this._optionsService.options.logger))??console.log,g,m)}info(g,...m){var y;this._logLevel<=v.LogLevelEnum.INFO&&this._log(((y=this._optionsService.options.logger)==null?void 0:y.info.bind(this._optionsService.options.logger))??console.info,g,m)}warn(g,...m){var y;this._logLevel<=v.LogLevelEnum.WARN&&this._log(((y=this._optionsService.options.logger)==null?void 0:y.warn.bind(this._optionsService.options.logger))??console.warn,g,m)}error(g,...m){var y;this._logLevel<=v.LogLevelEnum.ERROR&&this._log(((y=this._optionsService.options.logger)==null?void 0:y.error.bind(this._optionsService.options.logger))??console.error,g,m)}};a.LogService=w=u([h(0,v.IOptionsService)],w),a.setTraceLogger=function(g){x=g},a.traceCall=function(g,m,y){if(typeof y.value!="function")throw new Error("not supported");const b=y.value;y.value=function(..._){if(x.logLevel!==v.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),h=l(844),c=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:c.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const v=["normal","bold","100","200","300","400","500","600","700","800","900"];class d extends h.Disposable{constructor(w){super(),this._onOptionChange=this.register(new u.EventEmitter),this.onOptionChange=this._onOptionChange.event;const g={...a.DEFAULT_OPTIONS};for(const m in w)if(m in g)try{const y=w[m];g[m]=this._sanitizeAndValidateOption(m,y)}catch(y){console.error(y)}this.rawOptions=g,this.options={...g},this._setupOptions(),this.register((0,h.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(w,g){return this.onOptionChange((m=>{m===w&&g(this.rawOptions[w])}))}onMultipleOptionChange(w,g){return this.onOptionChange((m=>{w.indexOf(m)!==-1&&g()}))}_setupOptions(){const w=m=>{if(!(m in a.DEFAULT_OPTIONS))throw new Error(`No option with key "${m}"`);return this.rawOptions[m]},g=(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:g.bind(this,m)};Object.defineProperty(this.options,m,y)}}_sanitizeAndValidateOption(w,g){switch(w){case"cursorStyle":if(g||(g=a.DEFAULT_OPTIONS[w]),!(function(m){return m==="block"||m==="underline"||m==="bar"})(g))throw new Error(`"${g}" is not a valid value for ${w}`);break;case"wordSeparator":g||(g=a.DEFAULT_OPTIONS[w]);break;case"fontWeight":case"fontWeightBold":if(typeof g=="number"&&1<=g&&g<=1e3)break;g=v.includes(g)?g:a.DEFAULT_OPTIONS[w];break;case"cursorWidth":g=Math.floor(g);case"lineHeight":case"tabStopWidth":if(g<1)throw new Error(`${w} cannot be less than 1, value: ${g}`);break;case"minimumContrastRatio":g=Math.max(1,Math.min(21,Math.round(10*g)/10));break;case"scrollback":if((g=Math.min(g,4294967295))<0)throw new Error(`${w} cannot be less than 0, value: ${g}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(g<=0)throw new Error(`${w} cannot be less than or equal to 0, value: ${g}`);break;case"rows":case"cols":if(!g&&g!==0)throw new Error(`${w} must be numeric, value: ${g}`);break;case"windowsPty":g=g??{}}return g}}a.OptionsService=d},2660:function(o,a,l){var u=this&&this.__decorate||function(d,x,w,g){var m,y=arguments.length,b=y<3?x:g===null?g=Object.getOwnPropertyDescriptor(x,w):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(d,x,w,g);else for(var _=d.length-1;_>=0;_--)(m=d[_])&&(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},h=this&&this.__param||function(d,x){return function(w,g){x(w,g,d)}};Object.defineProperty(a,"__esModule",{value:!0}),a.OscLinkService=void 0;const c=l(2585);let v=a.OscLinkService=class{constructor(d){this._bufferService=d,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(d){const x=this._bufferService.buffer;if(d.id===void 0){const _=x.addMarker(x.ybase+x.y),R={data:d,id:this._nextId++,lines:[_]};return _.onDispose((()=>this._removeMarkerFromLink(R,_))),this._dataByLinkId.set(R.id,R),R.id}const w=d,g=this._getEntryIdKey(w),m=this._entriesWithId.get(g);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(d,x){const w=this._dataByLinkId.get(d);if(w&&w.lines.every((g=>g.line!==x))){const g=this._bufferService.buffer.addMarker(x);w.lines.push(g),g.onDispose((()=>this._removeMarkerFromLink(w,g)))}}getLinkData(d){var x;return(x=this._dataByLinkId.get(d))==null?void 0:x.data}_getEntryIdKey(d){return`${d.id};;${d.uri}`}_removeMarkerFromLink(d,x){const w=d.lines.indexOf(x);w!==-1&&(d.lines.splice(w,1),d.lines.length===0&&(d.data.id!==void 0&&this._entriesWithId.delete(d.key),this._dataByLinkId.delete(d.id)))}};a.OscLinkService=v=u([h(0,c.IBufferService)],v)},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(h){return h[u]||[]},a.createDecorator=function(h){if(a.serviceRegistry.has(h))return a.serviceRegistry.get(h);const c=function(v,d,x){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(w,g,m){g[l]===g?g[u].push({id:w,index:m}):(g[u]=[{id:w,index:m}],g[l]=g)})(c,v,x)};return c.toString=()=>h,a.serviceRegistry.set(h,c),c}},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 h;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(c){c[c.TRACE=0]="TRACE",c[c.DEBUG=1]="DEBUG",c[c.INFO=2]="INFO",c[c.WARN=3]="WARN",c[c.ERROR=4]="ERROR",c[c.OFF=5]="OFF"})(h||(a.LogLevelEnum=h={})),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),h=l(225);class c{static extractShouldJoin(d){return(1&d)!=0}static extractWidth(d){return d>>1&3}static extractCharKind(d){return d>>3}static createPropertyValue(d,x,w=!1){return(16777215&d)<<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 d=new h.UnicodeV6;this.register(d),this._active=d.version,this._activeProvider=d}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(d){if(!this._providers[d])throw new Error(`unknown Unicode version "${d}"`);this._active=d,this._activeProvider=this._providers[d],this._onChange.fire(d)}register(d){this._providers[d.version]=d}wcwidth(d){return this._activeProvider.wcwidth(d)}getStringCellWidth(d){let x=0,w=0;const g=d.length;for(let m=0;m<g;++m){let y=d.charCodeAt(m);if(55296<=y&&y<=56319){if(++m>=g)return x+this.wcwidth(y);const R=d.charCodeAt(m);56320<=R&&R<=57343?y=1024*(y-55296)+R-56320+65536:x+=this.wcwidth(R)}const b=this.charProperties(y,w);let _=c.extractWidth(b);c.extractShouldJoin(b)&&(_-=c.extractWidth(w)),x+=_,w=b}return x}charProperties(d,x){return this._activeProvider.charProperties(d,x)}}a.UnicodeService=c}},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),h=i(5741),c=i(8285),v=i(7975),d=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 h.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 v.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new d.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 c.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 tS=MA(),Fp={exports:{}},tb;function PA(){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"))),h=window.getComputedStyle(this._terminal.element),c=l-(parseInt(h.getPropertyValue("padding-top"))+parseInt(h.getPropertyValue("padding-bottom"))),v=u-(parseInt(h.getPropertyValue("padding-right"))+parseInt(h.getPropertyValue("padding-left")))-o;return{cols:Math.max(2,Math.floor(v/s.css.cell.width)),rows:Math.max(1,Math.floor(c/s.css.cell.height))}}}})(),r})()))})(Fp)),Fp.exports}var rS=PA();function IA({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 tS.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"}}),h=new rS.FitAddon;u.loadAddon(h);const c=u.onData(x=>{a&&a.readyState===WebSocket.OPEN&&a.send(x)}),v=typeof ResizeObserver<"u"?new ResizeObserver(()=>{try{h.fit()}catch{}l&<.resizeTerminal(l,u.cols,u.rows).catch(()=>{})}):void 0,d=requestAnimationFrame(()=>{if(!o){u.open(s);try{h.fit()}catch{}v==null||v.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 g=new WebSocket(tw(w));g.binaryType="arraybuffer",g.onmessage=m=>{typeof m.data=="string"?u.write(m.data):u.write(new Uint8Array(m.data))},a=g})()}});return()=>{o=!0,cancelAnimationFrame(d),v==null||v.disconnect(),c.dispose();try{a==null||a.close()}catch{}l&<.closeTerminal(l).catch(()=>{}),u.dispose()}},[]),S.jsxs("div",{"data-testid":"terminal",className:"flex flex-col gap-1",children:[S.jsxs("div",{className:"flex items-center justify-between text-[11px]",children:[S.jsx("span",{className:"font-semibold font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Terminal"}),S.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"})]}),S.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 S.jsxs("div",{className:"flex gap-2 text-[11px]",children:[S.jsx("span",{className:"w-20 shrink-0 font-mono",style:{color:"rgba(230,237,243,0.4)"},children:t}),S.jsx("span",{className:r?"font-mono break-all":"",style:{color:"rgba(230,237,243,0.7)"},children:e})]})}function OA({model:t}){const{session:e}=t;return S.jsxs("div",{"data-testid":"what-where",className:"flex flex-col gap-1.5",children:[S.jsx(Go,{label:"intent",value:e.problem}),S.jsx(Go,{label:"repo",value:e.repo_ref??"—",mono:!0}),S.jsx(Go,{label:"worktree",value:e.workdir??"—",mono:!0}),S.jsx(Go,{label:"roster",value:e.clis.length>0?e.clis.join(", "):"—",mono:!0}),S.jsx(Go,{label:"entity",value:e.entity_mode}),S.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 (",S.jsx("code",{children:"work_output"})," pending daemon surface)"]})]})}const BA=[{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"}],FA=new Set(["Write","Edit","MultiEdit","NotebookEdit"]),jA=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)",h=e==="delete"?"#f85149":"#e6edf3";function c(){navigator.clipboard.writeText(t).then(()=>{n(!0),i.current!==null&&clearTimeout(i.current),i.current=setTimeout(()=>{n(!1),i.current=null},1500)}).catch(()=>{})}return S.jsxs("li",{title:r?"Copied!":t,className:"flex items-start gap-1.5 min-w-0",children:[S.jsx("span",{className:"shrink-0 mt-0.5 text-[9px] font-mono select-none",style:{color:u},children:l}),S.jsxs("button",{type:"button",onClick:c,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&&S.jsx("span",{style:{color:"rgba(230,237,243,0.3)"},children:a}),S.jsx("span",{style:{color:h},children:o}),r&&S.jsx("span",{className:"ml-1 text-[9px]",style:{color:"#3fb950"},children:"✓"})]})]})}function zA({model:t}){const e=new Set,r=new Set;for(const d of t.units)for(const x of d.hookFires)FA.has(x.toolName)&&e.add(d.ord),jA.has(x.toolName)&&r.add(d.ord);const n=new Set,i=new Set,s=new Set;for(const d of t.units)for(const x of d.filesRead)s.add(x),r.has(d.ord)?i.add(x):e.has(d.ord)&&n.add(x);for(const d of i)n.delete(d);const o=new Set;for(const d of s)!n.has(d)&&!i.has(d)&&o.add(d);const a=n.size>0||i.size>0,l=s.size>0,u=!["completed","cancelled","failed"].includes(t.session.status);if(!l)return S.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 h=[...n].sort(),c=[...i].sort(),v=[...o].sort();return S.jsxs("div",{className:"flex flex-col gap-4",children:[(a||u)&&S.jsxs("div",{children:[S.jsx("p",{className:"text-[10px] font-mono mb-2 uppercase tracking-wider",style:{color:"rgba(230,237,243,0.3)"},children:"Modified / Created"}),a?S.jsxs("ul",{className:"flex flex-col gap-1",children:[h.map(d=>S.jsx(jp,{path:d,opKind:"write"},d)),c.map(d=>S.jsx(jp,{path:d,opKind:"delete"},d))]}):S.jsx("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.3)"},children:"No files changed yet."})]}),v.length>0&&S.jsxs("div",{children:[S.jsx("p",{className:"text-[10px] font-mono mb-2 uppercase tracking-wider",style:{color:"rgba(230,237,243,0.3)"},children:"Referenced"}),S.jsx("ul",{className:"flex flex-col gap-1",children:v.map(d=>S.jsx(jp,{path:d},d))})]}),S.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 HA=new Set(["executing","distributing","planning"]);function UA({view:t}){const[e,r]=ae.useState(!1),[n,i]=ae.useState("whatwhere"),[s,o]=ae.useState(!1),[a,l]=ae.useState(!1),[u,h]=ae.useState(""),[c,v]=ae.useState(!1),[d,x]=ae.useState(null),w=ae.useRef(null),g=ae.useRef(!1),{session:m}=t,y=yA(m.id,t),b=HA.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?S.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:[S.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:"‹"}),S.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:"⬛"}),S.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:"%"})]}):S.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:[S.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:[S.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:[S.jsx("span",{className:"text-sm leading-none shrink-0",style:{color:"rgba(230,237,243,0.35)"},children:"›"}),S.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-widest font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Insights"})]}),S.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"}),S.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"})]}),S.jsx("div",{className:"flex-1 overflow-y-auto",children:BA.map(({id:E,label:T})=>S.jsxs("div",{style:{borderBottom:"1px solid rgba(230,237,243,0.06)"},children:[S.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:[S.jsxs("div",{className:"flex items-center gap-1.5",children:[S.jsx("span",{className:"text-xs font-medium font-mono",children:T}),E==="files"&&_!==null&&_>0&&S.jsx("span",{className:"text-[9px] font-mono px-1 py-0.5 rounded",style:{background:"rgba(121,192,255,0.12)",color:"#79c0ff"},children:_})]}),S.jsx("span",{className:"text-xs",style:{color:"rgba(230,237,243,0.3)"},children:n===E?"▲":"▼"})]}),n===E&&y&&S.jsxs("div",{className:"px-4 py-3",style:{background:"#0a0d12"},children:[E==="decisions"&&S.jsx(TA,{model:y}),E==="governance"&&S.jsx(NA,{model:y}),E==="burn"&&S.jsx(SA,{model:y}),E==="data"&&S.jsx(CA,{model:y}),E==="steering"&&S.jsx(AA,{runId:y.session.id}),E==="whatwhere"&&S.jsx(OA,{model:y}),E==="assumptions"&&S.jsx(bA,{model:y}),E==="files"&&S.jsx(zA,{model:y})]}),n===E&&!y&&S.jsx("div",{className:"px-4 py-3",children:S.jsx("p",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.35)"},children:"Loading…"})})]},E))}),b&&S.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:[S.jsx("p",{className:"text-[9px] font-mono uppercase tracking-widest",style:{color:"rgba(230,237,243,0.3)"},children:"Steer"}),S.jsxs("form",{onSubmit:E=>{E.preventDefault();const T=u.trim();!T||g.current||(g.current=!0,v(!0),x(null),lt.injectMessage(m.id,T,"all").then(()=>{h("")}).catch(k=>{const N=k instanceof Error?k.message:String(k);x(N||"Failed to send instruction — please try again.")}).finally(()=>{g.current=!1,v(!1)}))},className:"flex flex-col gap-1",children:[S.jsxs("div",{className:"flex gap-1.5",children:[S.jsx("textarea",{ref:w,value:u,onChange:E=>{h(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:c,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}}),S.jsx("button",{type:"submit","aria-label":c?"Sending…":"Send steering instruction",disabled:c||!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:c?"…":"↑"})]}),d&&S.jsx("p",{className:"text-[10px] font-mono",style:{color:"#f85149"},children:d})]})]}),s&&S.jsx(J1,{title:"Operator shell",onClose:()=>o(!1),disableEscapeKey:!0,children:S.jsx(IA,{cwd:m.workdir??".",governed:!0})}),a&&S.jsx(J1,{title:"Coverage report",onClose:()=>l(!1),children:S.jsx(iw,{})})]})}const nS={critical:"#f85149",error:"#f97316",warn:"#ffda19",info:"rgba(230,237,243,0.5)"},WA={id:"",rule_type:"pattern",statement:"",severity:"warn",confidence:.9,targets:{},provenance:{source:"manual",source_kinds:["policy"]}};function VA({rule:t,onEdit:e}){var r,n,i;return S.jsxs("tr",{className:"text-[11px]",style:{borderBottom:"1px solid rgba(230,237,243,0.06)"},children:[S.jsx("td",{className:"px-3 py-2 font-mono",style:{color:"rgba(230,237,243,0.7)"},children:t.id}),S.jsx("td",{className:"px-3 py-2",style:{color:"rgba(230,237,243,0.45)"},children:t.rule_type}),S.jsx("td",{className:"px-3 py-2",children:S.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:nS[t.severity]??"rgba(230,237,243,0.5)"},children:t.severity})}),S.jsx("td",{className:"px-3 py-2 truncate max-w-xs",style:{color:"rgba(230,237,243,0.6)"},children:t.statement}),S.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(" / ")||"—"}),S.jsx("td",{className:"px-3 py-2",children:S.jsx("button",{type:"button",onClick:()=>e(t),className:"text-[10px] hover:underline",style:{color:"#79c0ff"},children:"Edit"})})]})}function $A(){const[t,e]=ae.useState([]),[r,n]=ae.useState(!0),[i,s]=ae.useState(null),[o,a]=ae.useState(""),[l,u]=ae.useState(null),[h,c]=ae.useState("idle"),[v,d]=ae.useState(null),[x,w]=ae.useState({}),[g,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??WA,null,2)),u(null),c("idle"),d(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}c("saving"),d(null);try{await lt.upsertConformanceRule(A),c("ok"),await E()}catch(j){c("error"),d(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)=>S.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 S.jsxs("div",{className:"flex flex-col gap-4",children:[S.jsxs("div",{className:"flex items-center gap-3",children:[S.jsx("h2",{className:"text-sm font-semibold",style:{color:"#e6edf3"},children:"Conformance rules"}),S.jsx("button",{type:"button",onClick:()=>void E(),className:"text-[10px] hover:underline",style:{color:"rgba(230,237,243,0.4)"},children:"Refresh"}),S.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&&S.jsx("p",{className:"rounded px-2 py-1 text-xs",style:{background:"rgba(248,81,73,0.08)",color:"#f85149"},children:i}),r?S.jsx("p",{className:"text-xs",style:{color:"rgba(230,237,243,0.4)"},children:"Loading rules…"}):S.jsx("div",{className:"overflow-x-auto rounded",style:{border:"1px solid rgba(230,237,243,0.08)"},children:S.jsxs("table",{className:"w-full text-[11px]",children:[S.jsx("thead",{children:S.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:[S.jsx("th",{className:"px-3 py-2 text-left",children:"ID"}),S.jsx("th",{className:"px-3 py-2 text-left",children:"Type"}),S.jsx("th",{className:"px-3 py-2 text-left",children:"Severity"}),S.jsx("th",{className:"px-3 py-2 text-left",children:"Statement"}),S.jsx("th",{className:"px-3 py-2 text-left",children:"Targets"}),S.jsx("th",{className:"px-3 py-2"})]})}),S.jsx("tbody",{children:t.length===0?S.jsx("tr",{children:S.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=>S.jsx(VA,{rule:A,onEdit:T},A.id))})]})}),o!==""&&S.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:[S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("span",{className:"text-[11px] font-semibold",style:{color:"#ffda19"},children:"Rule JSON"}),S.jsx("button",{type:"button",onClick:()=>{a(""),c("idle")},className:"ml-auto text-[10px] hover:underline",style:{color:"rgba(230,237,243,0.4)"},children:"Cancel"})]}),S.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&&S.jsx("p",{className:"text-[10px]",style:{color:"#f85149"},children:l}),S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("button",{type:"button",onClick:()=>void N(),disabled:!!l||h==="saving",className:"rounded px-3 py-1 text-[11px] font-semibold disabled:opacity-50",style:{background:"#3fb950",color:"#0d1117"},children:h==="saving"?"Saving…":"Save rule"}),h==="ok"&&S.jsx("span",{className:"text-[10px]",style:{color:"#3fb950"},children:"Saved."}),h==="error"&&S.jsx("span",{className:"text-[10px]",style:{color:"#f85149"},children:v})]})]}),S.jsxs("div",{className:"flex flex-col gap-2 rounded p-3",style:{border:"1px solid rgba(230,237,243,0.08)",background:"#0f1419"},children:[S.jsx("p",{className:"text-[11px] font-semibold",style:{color:"rgba(230,237,243,0.7)"},children:"Preview — which rules apply?"}),S.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"),S.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"})]}),_&&S.jsx("p",{className:"text-[10px]",style:{color:"#f85149"},children:_}),g!==null&&(g.length===0?S.jsx("p",{className:"text-[10px]",style:{color:"rgba(230,237,243,0.4)"},children:"No rules match this query."}):S.jsx("ul",{className:"flex flex-col gap-0.5",children:g.map(A=>S.jsxs("li",{className:"flex items-center gap-2 text-[10px]",children:[S.jsx("span",{className:"inline-flex rounded px-1 text-[9px] font-semibold font-mono",style:{background:"rgba(230,237,243,0.06)",color:nS[A.severity]??"rgba(230,237,243,0.5)"},children:A.severity}),S.jsx("span",{className:"font-mono",style:{color:"rgba(230,237,243,0.6)"},children:A.id}),S.jsx("span",{className:"truncate",style:{color:"rgba(230,237,243,0.45)"},children:A.statement})]},A.id))}))]})]})}const GA={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),[h,c]=ae.useState(null);async function v(m,y){u(!0),c(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){c(b instanceof Error?b.message:String(b))}finally{u(!1)}}const d=()=>v(()=>lt.confirmGate(t,{approve:!0}),{kind:"approve"}),x=()=>{const m=o.trim();if(!m)return Promise.resolve();const y={approve:!0,amend:m};return v(()=>lt.confirmGate(t,y),{kind:"approve-with-steer",amend:m})},w=()=>v(()=>lt.confirmGate(t,{approve:!1}),{kind:"reject"}),g=()=>v(()=>lt.cancelRun(t),{kind:"cancel"});return S.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:[S.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[S.jsx("span",{className:"w-2 h-2 rounded-full animate-pulse",style:{background:"#ffda19"}}),S.jsx("p",{className:"font-semibold text-sm font-mono",style:{color:"#ffda19"},children:"Awaiting human decision"})]}),S.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}`:""]}),S.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."}),S.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}),h&&S.jsx("p",{className:"text-xs mb-3 font-mono",style:{color:"#f85149"},"data-testid":"steering-error",children:h}),S.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[S.jsx("button",{"data-testid":"steering-approve",onClick:()=>void d(),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"}),S.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"}),S.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"}),S.jsx("button",{"data-testid":"steering-cancel",onClick:()=>void g(),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 iS={feature:"Feature (6 phases)",bug:"Bug (4 phases)",migration:"Migration (5 phases)"};function qA(t,e){const r=e.find(n=>n.id===t);return r?`${t.charAt(0).toUpperCase()}${t.slice(1)} (${r.phases.length} phases)`:iS[t]??t}function ks({children:t}){return S.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 S.jsx("div",{style:{height:"1px",background:"rgba(230,237,243,0.07)"}})}function YA({roster:t,selectedClis:e,onToggleCli:r,confirmMode:n,onConfirmModeChange:i,beforeOrd:s,onBeforeOrdChange:o,entityMode:a,onEntityModeChange:l,workflows:u,workflow:h,onWorkflowChange:c,repos:v,repoRefs:d,onRepoRefsChange:x,attachedFiles:w,onFilesChange:g}){const m=ae.useRef(null);function y(_){const R=Array.from(_.target.files??[]);g([...w,...R]),_.target.value=""}function b(_){g(w.filter((R,E)=>E!==_))}return S.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:[S.jsxs("div",{className:"px-4 py-3",children:[S.jsx(ks,{children:"Upload files"}),S.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)…"}),S.jsx("input",{ref:m,type:"file",multiple:!0,className:"hidden",onChange:y,"aria-label":"Upload files for knowledge context"}),w.length>0&&S.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:w.map((_,R)=>S.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,S.jsx("button",{type:"button",onClick:()=>b(R),"aria-label":`Remove ${_.name}`,className:"opacity-60 hover:opacity-100 leading-none",children:"×"})]},R))})]}),S.jsx(qo,{}),S.jsxs("div",{className:"px-4 py-3",children:[S.jsx(ks,{children:"CLIs on/off"}),t.length===0?S.jsx("span",{style:{color:"rgba(230,237,243,0.3)"},children:"No roster loaded"}):S.jsx("div",{className:"flex flex-wrap gap-x-4 gap-y-1.5",children:t.map(_=>S.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer",style:{color:"rgba(230,237,243,0.65)"},children:[S.jsx("input",{type:"checkbox",checked:e.has(_.key),onChange:()=>r(_.key),"data-testid":`launch-seat-${_.key}`}),S.jsx("span",{children:_.key})]},_.key))})]}),S.jsx(qo,{}),S.jsxs("div",{className:"px-4 py-3",children:[S.jsx(ks,{children:"Set gate"}),S.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[S.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:[S.jsx("option",{value:"none",children:"None"}),S.jsx("option",{value:"all",children:"Every unit"}),S.jsx("option",{value:"before",children:"Before unit #"})]}),n==="before"&&S.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"}})]})]}),S.jsx(qo,{}),S.jsxs("div",{className:"px-4 py-3",children:[S.jsx(ks,{children:"Set mode"}),S.jsx("div",{className:"flex items-center gap-1.5",children:["shared","isolated"].map(_=>S.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:_},_))})]}),S.jsx(qo,{}),S.jsxs("div",{className:"px-4 py-3",children:[S.jsx(ks,{children:"Choose workflow"}),S.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:h,onChange:_=>c(_.target.value),children:[S.jsx("option",{value:"",children:"(free-text)"}),(u.length>0?u.map(_=>_.id):Object.keys(iS)).map(_=>S.jsx("option",{value:_,children:qA(_,u)},_))]})]}),S.jsx(qo,{}),S.jsxs("div",{className:"px-4 py-3",children:[S.jsx(ks,{children:"Add repos"}),v.length===0?S.jsx("p",{className:"text-[11px] font-mono italic",style:{color:"rgba(230,237,243,0.3)"},children:"No repos registered."}):S.jsx("div",{className:"flex flex-col gap-1.5 max-h-36 overflow-y-auto pr-1",children:v.map(_=>{const R=d.includes(_.id);return S.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:[S.jsx("input",{type:"checkbox","data-testid":`launch-repo-${_.id}`,checked:R,onChange:()=>{x(R?d.filter(E=>E!==_.id):[...d,_.id])},className:"accent-[#ffda19] w-3.5 h-3.5 shrink-0"}),S.jsx("span",{className:"text-[11px] font-mono truncate",style:{color:"#e6edf3"},children:_.name})]},_.id)})})]})]})}const XA=new Set(["executing","distributing","planning"]);function KA(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 QA({label:t,onClear:e}){return S.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,S.jsx("button",{type:"button",onClick:e,"aria-label":`Clear ${t}`,className:"opacity-60 hover:opacity-100 leading-none ml-0.5",children:"×"})]})}const ZA=new Set(["chat","onboarding","survey-repo","repo-graph","domain-graph-slice","memories"]);function aS({runId:t,runStatus:e,onLaunched:r,embedded:n,workflowOverride:i,mode:s,injectTarget:o,onClearInjectTarget:a}){const l=Jn(se=>se.clearGate),[u,h]=ae.useState(""),[c,v]=ae.useState(!1),[d,x]=ae.useState(null),w=ae.useRef(null),[g,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&&!ZA.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),[ze,_e]=ae.useState(null),[ke,Ne]=ae.useState(!1),[Ee,Me]=ae.useState(!1),Pe=ae.useRef(null),De=ae.useRef(null),We=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=We.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(KA(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)){v(!0),x(null);try{await lt.confirmGate(t,{approve:!0,amend:se}),h(""),l(t)}catch(he){x(he instanceof Error?he.message:String(he))}finally{v(!1)}}}async function Fe(){const se=g.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&&!c;return S.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:[d&&S.jsx("p",{className:"text-[11px] font-mono",style:{color:"#f85149"},children:d}),S.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:[S.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=>h(he.target.value),onKeyDown:he=>{he.key==="Enter"&&(he.metaKey||he.ctrlKey)&&(he.preventDefault(),Ae())},disabled:c,rows:1}),S.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:c?"…":"Steer →"})]}),S.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&&XA.has(e)){const se=g.trim().length>0&&!y,he=(o==null?void 0:o.trim())||"all",pe=he!=="all",be=pe?he:"all agents";return S.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:[_&&S.jsx("p",{className:"text-[11px] font-mono",style:{color:"#f85149"},children:_}),S.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:[S.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:g,onChange:Se=>m(Se.target.value),onKeyDown:Se=>{Se.key==="Enter"&&(Se.metaKey||Se.ctrlKey)&&(Se.preventDefault(),Fe())},disabled:y,rows:1}),S.jsx("button",{type:"button",onClick:()=>void Fe(),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 →"})]}),S.jsxs("div",{className:"flex items-center gap-2",children:[S.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&&S.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&&S.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 S.jsx("div",{className:"px-5 py-4 shrink-0",style:{borderTop:"1px solid rgba(230,237,243,0.07)",background:"#161c26"},children:S.jsx("div",{className:"rounded-2xl px-5 py-4",style:{border:"1px solid rgba(230,237,243,0.1)",background:"#1b222e"},children:S.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=ze!==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}),S.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&&S.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:[S.jsxs("span",{children:["Detected: ",S.jsx("strong",{style:{color:"#ffda19"},children:ze})," workflow"]}),S.jsx("button",{type:"button",onClick:()=>{M(ze),Ne(!0)},className:"rounded-lg px-3 py-1 font-semibold text-xs",style:{background:"#ffda19",color:"#0d1117"},children:"Apply"}),S.jsx("button",{type:"button",onClick:()=>Ne(!0),className:"ml-auto",style:{color:"rgba(230,237,243,0.35)"},children:"✕"})]}),S.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:[S.jsxs("div",{className:"relative shrink-0",ref:Pe,children:[Ee&&S.jsx("div",{style:{position:"absolute",bottom:"calc(100% + 10px)",left:0,zIndex:50},children:S.jsx(YA,{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})}),S.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:"+"})]}),S.jsx("textarea",{ref:We,"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}),S.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&&S.jsx("div",{className:"flex flex-wrap gap-1.5 px-1",children:ue.map((se,he)=>S.jsx(QA,{label:se.label,onClear:se.onClear},he))}),de&&S.jsx("p",{className:"text-xs px-1 font-mono",style:{color:"#f85149"},"data-testid":"launch-error",children:de}),X&&ie>=5&&S.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 JA({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 tS.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 rS.FitAddon;a.loadAddon(l),a.open(s);try{l.fit()}catch{}const u=new WebSocket(tw(i.current));u.binaryType="arraybuffer",u.onmessage=c=>{typeof c.data=="string"?a.write(c.data):a.write(new Uint8Array(c.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 h=typeof ResizeObserver<"u"?new ResizeObserver(()=>{try{l.fit()}catch{}}):void 0;return h==null||h.observe(s),()=>{o=!0,h==null||h.disconnect();try{u.close()}catch{}a.dispose()}},[t]),S.jsxs("div",{className:"flex flex-col rounded-xl overflow-hidden",style:{background:"#0d1117",border:"1px solid rgba(230,237,243,0.08)"},children:[S.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:[S.jsxs("span",{className:"text-[11px] font-mono font-semibold",style:{color:"rgba(230,237,243,0.5)"},children:[e," ",S.jsx("span",{style:{color:"rgba(230,237,243,0.3)",fontWeight:400},children:"· observer"})]}),S.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:"×"})]}),S.jsx("div",{ref:n,className:"h-56 w-full overflow-hidden p-1"})]})}function eM(t,e){const r={};return(t[t.length-1]===""?[...t,""]:t).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const tM=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,rM=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,nM={};function nb(t,e){return(nM.jsx?rM:tM).test(t)}const iM=/[ \t\n\f\r]/g;function aM(t){return typeof t=="object"?t.type==="text"?ib(t.value):!1:ib(t)}function ib(t){return t.replace(iM,"")===""}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 sS(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 sM=0;const mt=Va(),fr=Va(),Lv=Va(),Ve=Va(),Ht=Va(),Ia=Va(),vn=Va();function Va(){return 2**++sM}const Nv=Object.freeze(Object.defineProperty({__proto__:null,boolean:mt,booleanish:fr,commaOrSpaceSeparated:vn,commaSeparated:Ia,number:Ve,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 oS=Zs({properties:{ariaActiveDescendant:null,ariaAtomic:fr,ariaAutoComplete:null,ariaBusy:fr,ariaChecked:fr,ariaColCount:Ve,ariaColIndex:Ve,ariaColSpan:Ve,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:Ve,ariaLive:null,ariaModal:fr,ariaMultiLine:fr,ariaMultiSelectable:fr,ariaOrientation:null,ariaOwns:Ht,ariaPlaceholder:null,ariaPosInSet:Ve,ariaPressed:fr,ariaReadOnly:fr,ariaRelevant:null,ariaRequired:fr,ariaRoleDescription:Ht,ariaRowCount:Ve,ariaRowIndex:Ve,ariaRowSpan:Ve,ariaSelected:fr,ariaSetSize:Ve,ariaSort:null,ariaValueMax:Ve,ariaValueMin:Ve,ariaValueNow:Ve,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function lS(t,e){return e in t?t[e]:e}function uS(t,e){return lS(t,e.toLowerCase())}const oM=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:Ve,colSpan:Ve,command:null,commandFor:null,content:null,contentEditable:fr,controls:mt,controlsList:Ht,coords:Ve|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:Ve,hidden:Lv,high:Ve,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:Ve,manifest:null,max:null,maxLength:Ve,media:null,method:null,min:null,minLength:Ve,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:Ve,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:Ve,rowSpan:Ve,sandbox:Ht,scope:null,scoped:mt,seamless:mt,selected:mt,shadowRootClonable:mt,shadowRootCustomElementRegistry:mt,shadowRootDelegatesFocus:mt,shadowRootMode:null,shadowRootSerializable:mt,shape:null,size:Ve,sizes:null,slot:null,span:Ve,spellCheck:fr,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ve,step:null,style:null,tabIndex:Ve,target:null,title:null,translate:null,type:null,typeMustMatch:mt,useMap:null,value:fr,width:Ve,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ht,axis:null,background:null,bgColor:null,border:Ve,borderColor:null,bottomMargin:Ve,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:Ve,leftMargin:Ve,link:null,longDesc:null,lowSrc:null,marginHeight:Ve,marginWidth:Ve,noResize:mt,noHref:mt,noShade:mt,noWrap:mt,object:null,profile:null,prompt:null,rev:null,rightMargin:Ve,rules:null,scheme:null,scrolling:fr,standby:null,summary:null,text:null,topMargin:Ve,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ve,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:mt,disablePictureInPicture:mt,disableRemotePlayback:mt,exportParts:Ia,part:Ht,prefix:null,property:null,results:Ve,security:null,unselectable:null},space:"html",transform:uS}),lM=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:Ve,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ve,amplitude:Ve,arabicForm:null,ascent:Ve,attributeName:null,attributeType:null,azimuth:Ve,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ve,by:null,calcMode:null,capHeight:Ve,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:Ve,diffuseConstant:Ve,direction:null,display:null,dur:null,divisor:Ve,dominantBaseline:null,download:mt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ve,enableBackground:null,end:null,event:null,exponent:Ve,externalResourcesRequired:null,fill:null,fillOpacity:Ve,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:Ve,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ve,horizOriginX:Ve,horizOriginY:Ve,id:null,ideographic:Ve,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ve,k:Ve,k1:Ve,k2:Ve,k3:Ve,k4:Ve,kernelMatrix:vn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ve,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:Ve,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:Ve,overlineThickness:Ve,paintOrder:null,panose1:null,path:null,pathLength:Ve,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ht,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ve,pointsAtY:Ve,pointsAtZ:Ve,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:Ve,specularExponent:Ve,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ve,strikethroughThickness:Ve,string:null,stroke:null,strokeDashArray:vn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ve,strokeOpacity:Ve,strokeWidth:null,style:null,surfaceScale:Ve,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:vn,tabIndex:Ve,tableValues:null,target:null,targetX:Ve,targetY:Ve,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:Ve,underlineThickness:Ve,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ve,values:null,vAlphabetic:Ve,vMathematical:Ve,vectorEffect:null,vHanging:Ve,vIdeographic:Ve,version:null,vertAdvY:Ve,vertOriginX:Ve,vertOriginY:Ve,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ve,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:lS}),cS=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()}}),hS=Zs({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:uS}),fS=Zs({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),uM={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"},cM=/[A-Z]/g,sb=/-[a-z]/g,hM=/^data[-\w.:]+$/i;function fM(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"&&hM.test(e)){if(e.charAt(4)==="-"){const s=e.slice(5).replace(sb,pM);n="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=e.slice(4);if(!sb.test(s)){let o=s.replace(cM,dM);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}i=vg}return new i(n,e)}function dM(t){return"-"+t.toLowerCase()}function pM(t){return t.charAt(1).toUpperCase()}const vM=sS([oS,oM,cS,hS,fS],"html"),gg=sS([oS,lM,cS,hS,fS],"svg");function gM(t){return t.join(" ").trim()}var Ts={},Hp,ob;function mM(){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="/",h="*",c="",v="comment",d="declaration";function x(g,m){if(typeof g!="string")throw new TypeError("First argument must be a string");if(!g)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=g;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=g,!m.silent)throw I}function k(D){var I=D.exec(g);if(I){var U=I[0];return _(U),g=g.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!=g.charAt(0)||h!=g.charAt(1))){for(var I=2;c!=g.charAt(I)&&(h!=g.charAt(I)||u!=g.charAt(I+1));)++I;if(I+=2,c===g.charAt(I-1))return T("End of comment missing");var U=g.slice(2,I-2);return b+=2,_(U),g=g.slice(I),b+=2,D({type:v,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:d,property:w(I[0].replace(t,c)),value:U?w(U[0].replace(t,c)):c});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(g){return g?g.replace(a,c):c}return Hp=x,Hp}var lb;function yM(){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(mM());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:h}=l;a?i(u,h,l):h&&(s=s||{},s[u]=h)}),s}return Ts}var Yo={},ub;function xM(){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,h){return h.toUpperCase()},a=function(u,h){return"".concat(h,"-")},l=function(u,h){return h===void 0&&(h={}),s(u)?u:(u=u.toLowerCase(),h.reactCompat?u=u.replace(i,a):u=u.replace(n,a),u.replace(e,o))};return Yo.camelCase=l,Yo}var Xo,cb;function bM(){if(cb)return Xo;cb=1;var t=Xo&&Xo.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},e=t(yM()),r=xM();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 wM=bM();const _M=Uc(wM),dS=pS("end"),mg=pS("start");function pS(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 SM(t){const e=mg(t),r=dS(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,CM=new Map,EM=/[A-Z]/g,kM=new Set(["table","tbody","thead","tfoot","tr"]),TM=new Set(["td","th"]),vS="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function RM(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=OM(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=IM(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:vM,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},s=gS(i,t,void 0);return s&&typeof s!="string"?s:i.create(t,i.Fragment,{children:s||void 0},void 0)}function gS(t,e,r){if(e.type==="element")return LM(t,e,r);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return NM(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return AM(t,e,r);if(e.type==="mdxjsEsm")return DM(t,e);if(e.type==="root")return MM(t,e,r);if(e.type==="text")return PM(t,e)}function LM(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=yS(t,e.tagName,!1),o=BM(t,e);let a=bg(t,e);return kM.has(e.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!aM(l):!0})),mS(t,o,s,e),xg(o,a),t.ancestors.pop(),t.schema=n,t.create(e,s,o,r)}function NM(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 DM(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);xl(t,e.position)}function AM(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:yS(t,e.name,!0),o=FM(t,e),a=bg(t,e);return mS(t,o,s,e),xg(o,a),t.ancestors.pop(),t.schema=n,t.create(e,s,o,r)}function MM(t,e,r){const n={};return xg(n,bg(t,e)),t.create(e,t.Fragment,n,r)}function PM(t,e){return e.value}function mS(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 IM(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 OM(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 BM(t,e){const r={};let n,i;for(i in e.properties)if(i!=="children"&&yg.call(e.properties,i)){const s=jM(t,i,e.properties[i]);if(s){const[o,a]=s;t.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&TM.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 FM(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:CM;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=gS(t,s,o);a!==void 0&&r.push(a)}return r}function jM(t,e,r){const n=fM(t.schema,e);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=n.commaSeparated?eM(r):gM(r)),n.property==="style"){let i=typeof r=="object"?r:zM(t,String(r));return t.stylePropertyNameCase==="css"&&(i=HM(i)),["style",i]}return[t.elementAttributeNameCase==="react"&&n.space?uM[n.property]||n.property:n.attribute,r]}}function zM(t,e){try{return _M(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=vS+"#cannot-parse-style-attribute",i}}function yS(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=vS+"#cannot-handle-mdx-estrees-without-createevaluater",r}function HM(t){const e={};let r;for(r in t)yg.call(t,r)&&(e[UM(r)]=t[r]);return e}function UM(t){let e=t.replace(EM,WM);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function WM(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"]},VM={};function wg(t,e){const r=VM,n=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,i=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return xS(t,n,i)}function xS(t,e,r){if($M(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]=xS(t[i],e,r);return n.join("")}function $M(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 bS(t){const e={};let r=-1;for(;++r<t.length;)GM(e,t[r]);return e}function GM(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];qM(i[o],Array.isArray(a)?a:a?[a]:[])}}}function qM(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 wS(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]/),YM=ua(/[#-'*+\--9=?A-Z^-~]/);function Fc(t){return t!==null&&(t<32||t===127)}const Av=ua(/\d/),XM=ua(/[\dA-Fa-f]/),KM=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 QM={tokenize:ZM};function ZM(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 JM={tokenize:eP},gb={tokenize:tP};function eP(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 v(b);if(i.currentConstruct&&i.currentConstruct.concrete)return x(b);e.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(gb,h,c)(b)}function h(b){return i&&y(),m(n),v(b)}function c(b){return e.parser.lazy[e.now().line]=n!==r.length,o=e.now().offset,x(b)}function v(b){return e.containerState={},t.attempt(gb,d,x)(b)}function d(b){return n++,r.push([e.currentConstruct,e.containerState]),v(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){g(t.exit("chunkFlow"),!0),m(0),t.consume(b);return}return ft(b)?(t.consume(b),g(t.exit("chunkFlow")),n=0,e.interrupt=void 0,a):(t.consume(b),w)}function g(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 tP(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:rP,tokenize:nP};function rP(t,e){let r=-1,n,i,s,o,a,l,u,h;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 c={...t[n][1].end},v={...t[r][1].start};mb(c,-l),mb(v,l),o={type:l>1?"strongSequence":"emphasisSequence",start:c,end:{...t[n][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...t[r][1].start},end:v},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?(h=2,u=Rn(u,[["enter",t[r][1],e],["exit",t[r][1],e]])):h=0,yn(t,n-1,r-n+3,u),r=n+u.length-h-2;break}}for(r=-1;++r<t.length;)t[r][1].type==="attentionSequence"&&(t[r][1].type="data");return t}function nP(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"),h=Vs(l),c=!h||h===2&&i||r.includes(l),v=!i||i===2&&h||r.includes(n);return u._open=!!(s===42?c:c&&(i||!v)),u._close=!!(s===42?v:v&&(h||!c)),e(l)}}function mb(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const iP={name:"autolink",tokenize:aP};function aP(t,e,r){let n=0;return i;function i(d){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(d),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),s}function s(d){return Xr(d)?(t.consume(d),o):d===64?r(d):u(d)}function o(d){return d===43||d===45||d===46||jr(d)?(n=1,a(d)):u(d)}function a(d){return d===58?(t.consume(d),n=0,l):(d===43||d===45||d===46||jr(d))&&n++<32?(t.consume(d),a):(n=0,u(d))}function l(d){return d===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(d),t.exit("autolinkMarker"),t.exit("autolink"),e):d===null||d===32||d===60||Fc(d)?r(d):(t.consume(d),l)}function u(d){return d===64?(t.consume(d),h):YM(d)?(t.consume(d),u):r(d)}function h(d){return jr(d)?c(d):r(d)}function c(d){return d===46?(t.consume(d),n=0,h):d===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(d),t.exit("autolinkMarker"),t.exit("autolink"),e):v(d)}function v(d){if((d===45||jr(d))&&n++<63){const x=d===45?v:c;return t.consume(d),x}return r(d)}}const Pl={partial:!0,tokenize:sP};function sP(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 _S={continuation:{tokenize:lP},exit:uP,name:"blockQuote",tokenize:oP};function oP(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 lP(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(_S,e,r)(o)}}function uP(t){t.exit("blockQuote")}const SS={name:"characterEscape",tokenize:cP};function cP(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 KM(s)?(t.enter("characterEscapeValue"),t.consume(s),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):r(s)}}const CS={name:"characterReference",tokenize:hP};function hP(t,e,r){const n=this;let i=0,s,o;return a;function a(c){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(c),t.exit("characterReferenceMarker"),l}function l(c){return c===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(c),t.exit("characterReferenceMarkerNumeric"),u):(t.enter("characterReferenceValue"),s=31,o=jr,h(c))}function u(c){return c===88||c===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(c),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),s=6,o=XM,h):(t.enter("characterReferenceValue"),s=7,o=Av,h(c))}function h(c){if(c===59&&i){const v=t.exit("characterReferenceValue");return o===jr&&!_g(n.sliceSerialize(v))?r(c):(t.enter("characterReferenceMarker"),t.consume(c),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return o(c)&&i++<s?(t.consume(c),h):r(c)}}const yb={partial:!0,tokenize:dP},xb={concrete:!0,name:"codeFenced",tokenize:fP};function fP(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"),h(E)}function h(E){return E===a?(o++,t.consume(E),h):o<3?r(E):(t.exit("codeFencedFenceSequence"),Ct(E)?Tt(t,c,"whitespace")(E):c(E))}function c(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"}),v(E))}function v(E){return E===null||ft(E)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),c(E)):Ct(E)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),Tt(t,d,"whitespace")(E)):E===96&&E===a?r(E):(t.consume(E),v)}function d(E){return E===null||ft(E)?c(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"),c(E)):E===96&&E===a?r(E):(t.consume(E),x)}function w(E){return t.attempt(i,_,g)(E)}function g(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 dP(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:vP},pP={partial:!0,tokenize:gP};function vP(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 h=n.events[n.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?o(u):r(u)}function o(u){return u===null?l(u):ft(u)?t.attempt(pP,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 gP(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 mP={name:"codeText",previous:xP,resolve:yP,tokenize:bP};function yP(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 xP(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function bP(t,e,r){let n=0,i,s;return o;function o(c){return t.enter("codeText"),t.enter("codeTextSequence"),a(c)}function a(c){return c===96?(t.consume(c),n++,a):(t.exit("codeTextSequence"),l(c))}function l(c){return c===null?r(c):c===32?(t.enter("space"),t.consume(c),t.exit("space"),l):c===96?(s=t.enter("codeTextSequence"),i=0,h(c)):ft(c)?(t.enter("lineEnding"),t.consume(c),t.exit("lineEnding"),l):(t.enter("codeTextData"),u(c))}function u(c){return c===null||c===32||c===96||ft(c)?(t.exit("codeTextData"),l(c)):(t.consume(c),u)}function h(c){return c===96?(t.consume(c),i++,h):i===n?(t.exit("codeTextSequence"),t.exit("codeText"),e(c)):(s.type="codeTextData",u(c))}}class wP{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 ES(t){const e={};let r=-1,n,i,s,o,a,l,u;const h=new wP(t);for(;++r<h.length;){for(;r in e;)r=e[r];if(n=h.get(r),r&&n[1].type==="chunkFlow"&&h.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,_P(h,r)),r=e[r],u=!0);else if(n[1]._container){for(s=r,i=void 0;s--;)if(o=h.get(s),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(h.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={...h.get(i)[1].start},a=h.slice(i,r),a.unshift(n),h.splice(i,r-i+1,a))}}return yn(t,0,Number.POSITIVE_INFINITY,h.slice(0)),!u}function _P(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 h,c,v=-1,d=r,x=0,w=0;const g=[w];for(;d;){for(;t.get(++i)[1]!==d;);s.push(i),d._tokenizer||(h=n.sliceStream(d),d.next||h.push(null),c&&o.defineSkip(d.start),d._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(h),d._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),c=d,d=d.next}for(d=r;++v<a.length;)a[v][0]==="exit"&&a[v-1][0]==="enter"&&a[v][1].type===a[v-1][1].type&&a[v][1].start.line!==a[v][1].end.line&&(w=v+1,g.push(w),d._tokenizer=void 0,d.previous=void 0,d=d.next);for(o.events=[],d?(d._tokenizer=void 0,d.previous=void 0):g.pop(),v=g.length;v--;){const m=a.slice(g[v],g[v+1]),y=s.pop();l.push([y,y+m.length-1]),t.splice(y,2,m)}for(l.reverse(),v=-1;++v<l.length;)u[x+l[v][0]]=x+l[v][1],x+=l[v][1]-l[v][0]-1;return u}const SP={resolve:EP,tokenize:kP},CP={partial:!0,tokenize:TP};function EP(t){return ES(t),t}function kP(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(CP,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 TP(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 kS(t,e,r,n,i,s,o,a,l){const u=l||Number.POSITIVE_INFINITY;let h=0;return c;function c(m){return m===60?(t.enter(n),t.enter(i),t.enter(s),t.consume(m),t.exit(s),v):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 v(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"}),d(m))}function d(m){return m===62?(t.exit("chunkString"),t.exit(a),v(m)):m===null||m===60||ft(m)?r(m):(t.consume(m),m===92?x:d)}function x(m){return m===60||m===62||m===92?(t.consume(m),d):d(m)}function w(m){return!h&&(m===null||m===41||Wt(m))?(t.exit("chunkString"),t.exit(a),t.exit(o),t.exit(n),e(m)):h<u&&m===40?(t.consume(m),h++,w):m===41?(t.consume(m),h--,w):m===null||m===32||m===40||Fc(m)?r(m):(t.consume(m),m===92?g:w)}function g(m){return m===40||m===41||m===92?(t.consume(m),w):w(m)}}function TS(t,e,r,n,i,s){const o=this;let a=0,l;return u;function u(d){return t.enter(n),t.enter(i),t.consume(d),t.exit(i),t.enter(s),h}function h(d){return a>999||d===null||d===91||d===93&&!l||d===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?r(d):d===93?(t.exit(s),t.enter(i),t.consume(d),t.exit(i),t.exit(n),e):ft(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),h):(t.enter("chunkString",{contentType:"string"}),c(d))}function c(d){return d===null||d===91||d===93||ft(d)||a++>999?(t.exit("chunkString"),h(d)):(t.consume(d),l||(l=!Ct(d)),d===92?v:c)}function v(d){return d===91||d===92||d===93?(t.consume(d),a++,c):c(d)}}function RS(t,e,r,n,i,s){let o;return a;function a(v){return v===34||v===39||v===40?(t.enter(n),t.enter(i),t.consume(v),t.exit(i),o=v===40?41:v,l):r(v)}function l(v){return v===o?(t.enter(i),t.consume(v),t.exit(i),t.exit(n),e):(t.enter(s),u(v))}function u(v){return v===o?(t.exit(s),l(o)):v===null?r(v):ft(v)?(t.enter("lineEnding"),t.consume(v),t.exit("lineEnding"),Tt(t,u,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),h(v))}function h(v){return v===o||v===null||ft(v)?(t.exit("chunkString"),u(v)):(t.consume(v),v===92?c:h)}function c(v){return v===o||v===92?(t.consume(v),h):h(v)}}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 RP={name:"definition",tokenize:NP},LP={partial:!0,tokenize:DP};function NP(t,e,r){const n=this;let i;return s;function s(d){return t.enter("definition"),o(d)}function o(d){return TS.call(n,t,a,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(d)}function a(d){return i=zn(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),d===58?(t.enter("definitionMarker"),t.consume(d),t.exit("definitionMarker"),l):r(d)}function l(d){return Wt(d)?sl(t,u)(d):u(d)}function u(d){return kS(t,h,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(d)}function h(d){return t.attempt(LP,c,c)(d)}function c(d){return Ct(d)?Tt(t,v,"whitespace")(d):v(d)}function v(d){return d===null||ft(d)?(t.exit("definition"),n.parser.defined.push(i),e(d)):r(d)}}function DP(t,e,r){return n;function n(a){return Wt(a)?sl(t,i)(a):r(a)}function i(a){return RS(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 AP={name:"hardBreakEscape",tokenize:MP};function MP(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 PP={name:"headingAtx",resolve:IP,tokenize:OP};function IP(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 OP(t,e,r){let n=0;return i;function i(h){return t.enter("atxHeading"),s(h)}function s(h){return t.enter("atxHeadingSequence"),o(h)}function o(h){return h===35&&n++<6?(t.consume(h),o):h===null||Wt(h)?(t.exit("atxHeadingSequence"),a(h)):r(h)}function a(h){return h===35?(t.enter("atxHeadingSequence"),l(h)):h===null||ft(h)?(t.exit("atxHeading"),e(h)):Ct(h)?Tt(t,a,"whitespace")(h):(t.enter("atxHeadingText"),u(h))}function l(h){return h===35?(t.consume(h),l):(t.exit("atxHeadingSequence"),a(h))}function u(h){return h===null||h===35||Wt(h)?(t.exit("atxHeadingText"),a(h)):(t.consume(h),u)}}const BP=["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"],FP={concrete:!0,name:"htmlFlow",resolveTo:HP,tokenize:UP},jP={partial:!0,tokenize:VP},zP={partial:!0,tokenize:WP};function HP(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 UP(t,e,r){const n=this;let i,s,o,a,l;return u;function u($){return h($)}function h($){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume($),c}function c($){return $===33?(t.consume($),v):$===47?(t.consume($),s=!0,w):$===63?(t.consume($),i=3,n.interrupt?e:P):Xr($)?(t.consume($),o=String.fromCharCode($),g):r($)}function v($){return $===45?(t.consume($),i=2,d):$===91?(t.consume($),i=5,a=0,x):Xr($)?(t.consume($),i=4,n.interrupt?e:P):r($)}function d($){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($),g):r($)}function g($){if($===null||$===47||$===62||Wt($)){const ee=$===47,re=o.toLowerCase();return!ee&&!s&&bb.includes(re)?(i=1,n.interrupt?e($):A($)):BP.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($),g):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(jP,G,j)($)):$===null||ft($)?(t.exit("htmlFlowData"),j($)):(t.consume($),A)}function j($){return t.check(zP,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 WP(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 VP(t,e,r){return n;function n(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(Pl,e,r)}}const $P={name:"htmlText",tokenize:GP};function GP(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),h):P===91?(t.consume(P),s=0,x):Xr(P)?(t.consume(P),y):r(P)}function h(P){return P===45?(t.consume(P),d):r(P)}function c(P){return P===null?r(P):P===45?(t.consume(P),v):ft(P)?(o=c,W(P)):(t.consume(P),c)}function v(P){return P===45?(t.consume(P),d):c(P)}function d(P){return P===62?U(P):P===45?v(P):c(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),g):ft(P)?(o=w,W(P)):(t.consume(P),w)}function g(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:KP,resolveTo:QP,tokenize:ZP},qP={tokenize:JP},YP={tokenize:e5},XP={tokenize:t5};function KP(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 QP(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}},h={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",h,e]]),a=Rn(a,lh(e.parser.constructs.insideSpan.null,t.slice(s+n+4,o-3),e)),a=Rn(a,[["exit",h,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 ZP(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(v){return s?s._inactive?c(v):(o=n.parser.defined.includes(zn(n.sliceSerialize({start:s.end,end:n.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(v),t.exit("labelMarker"),t.exit("labelEnd"),l):r(v)}function l(v){return v===40?t.attempt(qP,h,o?h:c)(v):v===91?t.attempt(YP,h,o?u:c)(v):o?h(v):c(v)}function u(v){return t.attempt(XP,h,c)(v)}function h(v){return e(v)}function c(v){return s._balanced=!0,r(v)}}function JP(t,e,r){return n;function n(c){return t.enter("resource"),t.enter("resourceMarker"),t.consume(c),t.exit("resourceMarker"),i}function i(c){return Wt(c)?sl(t,s)(c):s(c)}function s(c){return c===41?h(c):kS(t,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(c)}function o(c){return Wt(c)?sl(t,l)(c):h(c)}function a(c){return r(c)}function l(c){return c===34||c===39||c===40?RS(t,u,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(c):h(c)}function u(c){return Wt(c)?sl(t,h)(c):h(c)}function h(c){return c===41?(t.enter("resourceMarker"),t.consume(c),t.exit("resourceMarker"),t.exit("resource"),e):r(c)}}function e5(t,e,r){const n=this;return i;function i(a){return TS.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 t5(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 r5={name:"labelStartImage",resolveAll:Sg.resolveAll,tokenize:n5};function n5(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 i5={name:"labelStartLink",resolveAll:Sg.resolveAll,tokenize:a5};function a5(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:s5};function s5(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:o5};function o5(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:h5},exit:d5,name:"list",tokenize:c5},l5={partial:!0,tokenize:p5},u5={partial:!0,tokenize:f5};function c5(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(d){const x=n.containerState.type||(d===42||d===43||d===45?"listUnordered":"listOrdered");if(x==="listUnordered"?!n.containerState.marker||d===n.containerState.marker:Av(d)){if(n.containerState.type||(n.containerState.type=x,t.enter(x,{_container:!0})),x==="listUnordered")return t.enter("listItemPrefix"),d===42||d===45?t.check(_c,r,u)(d):u(d);if(!n.interrupt||d===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(d)}return r(d)}function l(d){return Av(d)&&++o<10?(t.consume(d),l):(!n.interrupt||o<2)&&(n.containerState.marker?d===n.containerState.marker:d===41||d===46)?(t.exit("listItemValue"),u(d)):r(d)}function u(d){return t.enter("listItemMarker"),t.consume(d),t.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||d,t.check(Pl,n.interrupt?r:h,t.attempt(l5,v,c))}function h(d){return n.containerState.initialBlankLine=!0,s++,v(d)}function c(d){return Ct(d)?(t.enter("listItemPrefixWhitespace"),t.consume(d),t.exit("listItemPrefixWhitespace"),v):r(d)}function v(d){return n.containerState.size=s+n.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(d)}}function h5(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(u5,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 f5(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 d5(t){t.exit(this.containerState.type)}function p5(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:v5,tokenize:g5};function v5(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 g5(t,e,r){const n=this;let i;return s;function s(u){let h=n.events.length,c;for(;h--;)if(n.events[h][1].type!=="lineEnding"&&n.events[h][1].type!=="linePrefix"&&n.events[h][1].type!=="content"){c=n.events[h][1].type==="paragraph";break}return!n.parser.lazy[n.now().line]&&(n.interrupt||c)?(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 m5={tokenize:y5};function y5(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(SP,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 x5={resolveAll:NS()},b5=LS("string"),w5=LS("text");function LS(t){return{resolveAll:NS(t==="text"?_5: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(h){return u(h)?s(h):a(h)}function a(h){if(h===null){r.consume(h);return}return r.enter("data"),r.consume(h),l}function l(h){return u(h)?(r.exit("data"),s(h)):(r.consume(h),l)}function u(h){if(h===null)return!0;const c=i[h];let v=-1;if(c)for(;++v<c.length;){const d=c[v];if(!d.previous||d.previous.call(n,n.previous))return!0}return!1}}}function NS(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 _5(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 S5={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:_S},C5={91:RP},E5={[-2]:Wp,[-1]:Wp,32:Wp},k5={35:PP,42:_c,45:[wb,_c],60:FP,61:wb,95:_c,96:xb,126:xb},T5={38:CS,92:SS},R5={[-5]:Vp,[-4]:Vp,[-3]:Vp,33:r5,38:CS,42:Mv,60:[iP,$P],91:i5,92:[AP,SS],93:Sg,95:Mv,96:mP},L5={null:[Mv,x5]},N5={null:[42,95]},D5={null:[]},A5=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:N5,contentInitial:C5,disable:D5,document:S5,flow:k5,flowInitial:E5,insideSpan:L5,string:T5,text:R5},Symbol.toStringTag,{value:"Module"}));function M5(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:v,sliceStream:d,write:c};let h=e.tokenize.call(u,l);return e.resolveAll&&s.push(e),u;function c(B){return o=Rn(o,B),g(),o[o.length-1]!==null?[]:(k(e,0),u.events=lh(s,u.events,u),u.events)}function v(B,A){return I5(d(B),A)}function d(B){return P5(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 g(){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){h=h(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 P5(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 I5(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 O5(t){const n={constructs:bS([A5,...(t||{}).extensions||[]]),content:i(QM),defined:[],document:i(JM),flow:i(m5),lazy:{},string:i(b5),text:i(w5)};return n;function i(s){return o;function o(a){return M5(n,s,a)}}}function B5(t){for(;!ES(t););return t}const _b=/[\0\t\n\r]/g;function F5(){let t=1,e="",r=!0,n;return i;function i(s,o,a){const l=[];let u,h,c,v,d;for(s=e+(typeof s=="string"?s.toString():new TextDecoder(o||void 0).decode(s)),c=0,e="",r&&(s.charCodeAt(0)===65279&&c++,r=void 0);c<s.length;){if(_b.lastIndex=c,u=_b.exec(s),v=u&&u.index!==void 0?u.index:s.length,d=s.charCodeAt(v),!u){e=s.slice(c);break}if(d===10&&c===v&&n)l.push(-3),n=void 0;else switch(n&&(l.push(-5),n=void 0),c<v&&(l.push(s.slice(c,v)),t+=v-c),d){case 0:{l.push(65533),t++;break}case 9:{for(h=Math.ceil(t/4)*4,l.push(-2);t++<h;)l.push(-1);break}case 10:{l.push(-4),t=1;break}default:n=!0,t=1}c=v+1}return a&&(n&&l.push(-5),e&&l.push(e),l.push(null)),l}}const j5=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function z5(t){return t.replace(j5,H5)}function H5(t,e,r){if(e)return e;if(r.charCodeAt(0)===35){const i=r.charCodeAt(1),s=i===120||i===88;return wS(r.slice(s?2:1),s?16:10)}return _g(r)||t}const DS={}.hasOwnProperty;function U5(t,e,r){return e&&typeof e=="object"&&(r=e,e=void 0),W5(r)(B5(O5(r).document().write(F5()(t,e,!0))))}function W5(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(ze),hardBreakTrailing:s(ze),htmlFlow:s(_e,o),htmlFlowData:N,htmlText:s(_e,o),htmlTextData:N,image:s(ke),label:o,link:s(Ne),listItem:s(Me),listItemValue:v,listOrdered:s(Ee,c),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(g),codeFencedFence:w,codeFencedFenceInfo:d,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()}};AS(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:h,data:r},Fe=[];let me=-1;for(;++me<ge.length;)if(ge[me][1].type==="listOrdered"||ge[me][1].type==="listUnordered")if(ge[me][0]==="enter")Fe.push(me);else{const Z=Fe.pop();me=i(ge,Z,me)}for(me=-1;++me<ge.length;){const Z=e[ge[me][0]];DS.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 Fe=Ce-1,me=-1,Z=!1,te,oe,ue,se;for(;++Fe<=Ae;){const he=ge[Fe];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=Fe),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=Fe;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||Fe,0,["exit",te,he[2]]),Fe++,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(Fe,0,["enter",pe,he[2]]),Fe++,Ae++,ue=void 0,se=!0}}}return ge[Ce][1]._spread=Z,Ae}function s(ge,Ce){return Ae;function Ae(Fe){a.call(this,ge(Fe),Fe),Ce&&Ce.call(this,Fe)}}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(),Fe=this.tokenStack.pop();if(Fe)Fe[0].type!==ge.type&&(Ce?Ce.call(this,ge,Fe[0]):(Fe[1]||Sb).call(this,ge,Fe[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 h(){return wg(this.stack.pop())}function c(){this.data.expectingFirstListItemValue=!0}function v(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 d(){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 g(){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 Fe=Ae[Ae.length-1];(!Fe||Fe.type!=="text")&&(Fe=We(),Fe.position={start:Wi(ge.start),end:void 0},Ae.push(Fe)),this.stack.push(Fe)}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=z5(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 Fe=ge.children;Ae.children=Fe}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 Fe;Ae?(Fe=wS(Ce,Ae==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Fe=_g(Ce);const me=this.stack[this.stack.length-1];me.value+=Fe}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 ze(){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 We(){return{type:"text",value:""}}function Ye(){return{type:"thematicBreak"}}}function Wi(t){return{line:t.line,column:t.column,offset:t.offset}}function AS(t,e){let r=-1;for(;++r<e.length;){const n=e[r];Array.isArray(n)?AS(t,n):V5(t,n)}}function V5(t,e){let r;for(r in e)if(DS.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 $5(t){const e=this;e.parser=r;function r(n){return U5(n,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function G5(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 q5(t,e){const r={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,r),[t.applyData(e,r),{type:"text",value:`
|
|
393
|
+
`}]}function Y5(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 X5(t,e){const r={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function K5(t,e){const r={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function Q5(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 Z5(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 J5(t,e){if(t.options.allowDangerousHtml){const r={type:"raw",value:e.value};return t.patch(e,r),t.applyData(e,r)}}function MS(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 e4(t,e){const r=String(e.identifier).toUpperCase(),n=t.definitionById.get(r);if(!n)return MS(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 t4(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 r4(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 n4(t,e){const r=String(e.identifier).toUpperCase(),n=t.definitionById.get(r);if(!n)return MS(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 i4(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 a4(t,e,r){const n=t.all(e),i=r?s4(r):PS(e),s={},o=[];if(typeof e.checked=="boolean"){const h=n[0];let c;h&&h.type==="element"&&h.tagName==="p"?c=h:(c={type:"element",tagName:"p",properties:{},children:[]},n.unshift(c)),c.children.length>0&&c.children.unshift({type:"text",value:" "}),c.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 h=n[a];(i||a!==0||h.type!=="element"||h.tagName!=="p")&&o.push({type:"text",value:`
|
|
395
|
+
`}),h.type==="element"&&h.tagName==="p"&&!i?o.push(...h.children):o.push(h)}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 s4(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=PS(r[n])}return e}function PS(t){const e=t.spread;return e??t.children.length>1}function o4(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 l4(t,e){const r={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function u4(t,e){const r={type:"root",children:t.wrap(t.all(e))};return t.patch(e,r),t.applyData(e,r)}function c4(t,e){const r={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function h4(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=dS(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 f4(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 c=e.children[l],v={},d=o?o[l]:void 0;d&&(v.align=d);let x={type:"element",tagName:s,properties:v,children:[]};c&&(x.children=t.all(c),t.patch(c,x),x=t.applyData(c,x)),u.push(x)}const h={type:"element",tagName:"tr",properties:{},children:t.wrap(u,!0)};return t.patch(e,h),t.applyData(e,h)}function d4(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 p4(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 v4(t,e){const r={type:"text",value:p4(String(e.value))};return t.patch(e,r),t.applyData(e,r)}function g4(t,e){const r={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,r),t.applyData(e,r)}const m4={blockquote:G5,break:q5,code:Y5,delete:X5,emphasis:K5,footnoteReference:Q5,heading:Z5,html:J5,imageReference:e4,image:t4,inlineCode:r4,linkReference:n4,link:i4,listItem:a4,list:o4,paragraph:l4,root:u4,strong:c4,table:h4,tableCell:d4,tableRow:f4,text:v4,thematicBreak:g4,toml:rc,yaml:rc,definition:rc,footnoteDefinition:rc};function rc(){}const IS=-1,uh=0,ol=1,jc=2,Cg=3,Eg=4,kg=5,Tg=6,OS=7,BS=8,FS=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 FS[t](e)},y4=(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 IS: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 OS:{const{name:a,message:l}=o;return r(typeof FS[a]=="function"?Tb(a,l):new Error(l),i)}case BS: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=>y4(new Map,t)(0),Na="",{toString:x4}={},{keys:b4}=Object,Qo=t=>{const e=typeof t;if(e!=="object"||!t)return[uh,e];const r=x4.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?[OS,t.name||"Error"]:[jc,r]},nc=([t,e])=>t===uh&&(e==="function"||e==="symbol"),w4=(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 h=o;switch(l){case"bigint":a=BS,h=o.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+l);h=null;break;case"undefined":return i([IS],o)}return i([a,h],o)}case ol:{if(l){let v=o;return l==="DataView"?v=new Uint8Array(o.buffer):l==="ArrayBuffer"&&(v=new Uint8Array(o)),i([l,[...v]],o)}const h=[],c=i([a,h],o);for(const v of o)h.push(s(v));return c}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 h=[],c=i([a,h],o);for(const v of b4(o))(t||!nc(Qo(o[v])))&&h.push([s(v),s(o[v])]);return c}case Cg:return i([a,isNaN(o.getTime())?Na:o.toISOString()],o);case Eg:{const{source:h,flags:c}=o;return i([a,{source:h,flags:c}],o)}case kg:{const h=[],c=i([a,h],o);for(const[v,d]of o)(t||!(nc(Qo(v))||nc(Qo(d))))&&h.push([s(v),s(d)]);return c}case Tg:{const h=[],c=i([a,h],o);for(const v of o)(t||!nc(Qo(v)))&&h.push(s(v));return c}}const{message:u}=o;return i([a,{name:l,message:u}],o)};return s},Lb=(t,{json:e,lossy:r}={})=>{const n=[];return w4(!(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 _4(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 S4(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function C4(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=t.options.footnoteBackContent||_4,n=t.options.footnoteBackLabel||S4,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 h=t.all(u),c=String(u.identifier).toUpperCase(),v=Js(c.toLowerCase());let d=0;const x=[],w=t.footnoteCounts.get(c);for(;w!==void 0&&++d<=w;){x.length>0&&x.push({type:"text",value:" "});let y=typeof r=="string"?r:r(l,d);typeof y=="string"&&(y={type:"text",value:y}),x.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+v+(d>1?"-"+d:""),dataFootnoteBackref:"",ariaLabel:typeof n=="string"?n:n(l,d),className:["data-footnote-backref"]},children:Array.isArray(y)?y:[y]})}const g=h[h.length-1];if(g&&g.type==="element"&&g.tagName==="p"){const y=g.children[g.children.length-1];y&&y.type==="text"?y.value+=" ":g.children.push({type:"text",value:" "}),g.children.push(...x)}else h.push(...x);const m={type:"element",tagName:"li",properties:{id:e+"fn-"+v},children:t.wrap(h,!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 R4;if(typeof t=="function")return hh(t);if(typeof t=="object")return Array.isArray(t)?E4(t):k4(t);if(typeof t=="string")return T4(t);throw new Error("Expected function, string, or object as test")});function E4(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 k4(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 T4(t){return hh(e);function e(r){return r&&r.type===t}}function hh(t){return e;function e(r,n,i){return!!(L4(r)&&t.call(this,r,typeof n=="number"?n:void 0,i||void 0))}}function R4(){return!0}function L4(t){return t!==null&&typeof t=="object"&&"type"in t}const jS=[],N4=!0,Pv=!1,D4="skip";function zS(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,h){const c=l&&typeof l=="object"?l:{};if(typeof c.type=="string"){const d=typeof c.tagName=="string"?c.tagName:typeof c.name=="string"?c.name:void 0;Object.defineProperty(v,"name",{value:"node ("+(l.type+(d?"<"+d+">":""))+")"})}return v;function v(){let d=jS,x,w,g;if((!e||s(l,u,h[h.length-1]||void 0))&&(d=A4(r(l,h)),d[0]===Pv))return d;if("children"in l&&l.children){const m=l;if(m.children&&d[0]!==D4)for(w=(n?m.children.length:-1)+o,g=h.concat(m);w>-1&&w<m.children.length;){const y=m.children[w];if(x=a(y,w,g)(),x[0]===Pv)return x;w=typeof x[1]=="number"?x[1]:w+o}}return d}}}function A4(t){return Array.isArray(t)?t:typeof t=="number"?[N4,t]:t==null?jS:[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),zS(t,s,a,i);function a(l,u){const h=u[u.length-1],c=h?h.children.indexOf(l):void 0;return o(l,c,h)}}const Iv={}.hasOwnProperty,M4={};function P4(t,e){const r=e||M4,n=new Map,i=new Map,s=new Map,o={...m4,...r.handlers},a={all:u,applyData:O4,definitionById:n,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:o,one:l,options:r,patch:I4,wrap:F4};return Rg(t,function(h){if(h.type==="definition"||h.type==="footnoteDefinition"){const c=h.type==="definition"?n:i,v=String(h.identifier).toUpperCase();c.has(v)||c.set(v,h)}}),a;function l(h,c){const v=h.type,d=a.handlers[v];if(Iv.call(a.handlers,v)&&d)return d(a,h,c);if(a.options.passThrough&&a.options.passThrough.includes(v)){if("children"in h){const{children:w,...g}=h,m=zc(g);return m.children=a.all(h),m}return zc(h)}return(a.options.unknownHandler||B4)(a,h,c)}function u(h){const c=[];if("children"in h){const v=h.children;let d=-1;for(;++d<v.length;){const x=a.one(v[d],h);if(x){if(d&&v[d-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)?c.push(...x):c.push(x)}}}return c}}function I4(t,e){t.position&&(e.position=SM(t))}function O4(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 B4(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 F4(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=P4(t,e),n=r.one(t,void 0),i=C4(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 j4(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 z4(){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 h=t.call(u,"constructor"),c=u.constructor&&u.constructor.prototype&&t.call(u.constructor.prototype,"isPrototypeOf");if(u.constructor&&!h&&!c)return!1;var v;for(v in u);return typeof v>"u"||t.call(u,v)},o=function(u,h){r&&h.name==="__proto__"?r(u,h.name,{enumerable:!0,configurable:!0,value:h.newValue,writable:!0}):u[h.name]=h.newValue},a=function(u,h){if(h==="__proto__")if(t.call(u,h)){if(n)return n(u,h).value}else return;return u[h]};return $p=function l(){var u,h,c,v,d,x,w=arguments[0],g=1,m=arguments.length,y=!1;for(typeof w=="boolean"&&(y=w,w=arguments[1]||{},g=2),(w==null||typeof w!="object"&&typeof w!="function")&&(w={});g<m;++g)if(u=arguments[g],u!=null)for(h in u)c=a(w,h),v=a(u,h),w!==v&&(y&&v&&(s(v)||(d=i(v)))?(d?(d=!1,x=c&&i(c)?c:[]):x=c&&s(c)?c:{},o(w,{name:h,newValue:l(y,x,v)})):typeof v<"u"&&o(w,{name:h,newValue:v}));return w},$p}var H4=z4();const Gp=Uc(H4);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 U4(){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 h=t[++s];let c=-1;if(l){o(l);return}for(;++c<i.length;)(u[c]===null||u[c]===void 0)&&(u[c]=i[c]);i=u,h?W4(h,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 W4(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 h=u;if(a&&r)throw h;return i(h)}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:V4,dirname:$4,extname:G4,join:q4,sep:"/"};function V4(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 $4(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 G4(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 q4(...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?".":Y4(r)}function Y4(t){Il(t);const e=t.codePointAt(0)===47;let r=X4(t,!e);return r.length===0&&!e&&(r="."),r.length>0&&t.codePointAt(t.length-1)===47&&(r+="/"),e?"/"+r:r}function X4(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 K4={cwd:Q4};function Q4(){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 Z4(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 J4(t)}function J4(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 HS{constructor(e){let r;e?Bv(e)?r={path:e}:typeof e=="string"||eI(e)?r={value:e}:r=e:r={},this.cwd="cwd"in r?"":K4.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=Z4(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 eI(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const tI=(function(t){const n=this.constructor.prototype,i=n[t],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,n),s}),rI={}.hasOwnProperty;class Lg extends tI{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=U4()}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):rI.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(h,c,v){if(h||!c||!v)return u(h);const d=c,x=n.stringify(d,v);aI(x)?v.value=x:v.result=x,u(h,v)});function u(h,c){h||!c?o(h):s?s(c):r(void 0,c)}}}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(h,c,v){const d=c||e;h?a(h):o?o(d):n(void 0,d,v)}}}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[h,...c]=u;l(h,c)}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 h=-1;if(u!=null)if(Array.isArray(u))for(;++h<u.length;){const c=u[h];s(c)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,h){let c=-1,v=-1;for(;++c<n.length;)if(n[c][0]===u){v=c;break}if(v===-1)n.push([u,...h]);else if(h.length>0){let[d,...x]=h;const w=n[v][1];Ov(w)&&Ov(d)&&(d=Gp(!0,w,d)),n[v]=[u,d,...x]}}}}const nI=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 iI(t)?t:new HS(t)}function iI(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function aI(t){return typeof t=="string"||sI(t)}function sI(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const oI="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Bb=[],Fb={allowDangerousHtml:!0},lI=/^(https?|ircs?|mailto|xmpp)$/i,uI=[{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 cI(t){const e=hI(t),r=fI(t);return dI(e.runSync(e.parse(r),r),t)}function hI(t){const e=t.rehypePlugins||Bb,r=t.remarkPlugins||Bb,n=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...Fb}:Fb;return nI().use($5).use(r).use(j4,n).use(e)}function fI(t){const e=t.children||"",r=new HS;return typeof e=="string"&&(r.value=e),r}function dI(t,e){const r=e.allowedElements,n=e.allowElement,i=e.components,s=e.disallowedElements,o=e.skipHtml,a=e.unwrapDisallowed,l=e.urlTransform||pI;for(const h of uI)Object.hasOwn(e,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+oI+h.id,void 0);return Rg(t,u),RM(t,{Fragment:S.Fragment,components:i,ignoreInvalidStyle:!0,jsx:S.jsx,jsxs:S.jsxs,passKeys:!0,passNode:!0});function u(h,c,v){if(h.type==="raw"&&v&&typeof c=="number")return o?v.children.splice(c,1):v.children[c]={type:"text",value:h.value},c;if(h.type==="element"){let d;for(d in Up)if(Object.hasOwn(Up,d)&&Object.hasOwn(h.properties,d)){const x=h.properties[d],w=Up[d];(w===null||w.includes(h.tagName))&&(h.properties[d]=l(String(x||""),d,h))}}if(h.type==="element"){let d=r?!r.includes(h.tagName):s?s.includes(h.tagName):!1;if(!d&&n&&typeof c=="number"&&(d=!n(h,c,v)),d&&v&&typeof c=="number")return a&&h.children?v.children.splice(c,1,...h.children):v.children.splice(c,1),c}}}function pI(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||lI.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 vI(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function gI(t,e,r){const i=ch((r||{}).ignore||[]),s=mI(e);let o=-1;for(;++o<s.length;)zS(t,"text",a);function a(u,h){let c=-1,v;for(;++c<h.length;){const d=h[c],x=v?v.children:void 0;if(i(d,x?x.indexOf(d):void 0,v))return;v=d}if(v)return l(u,h)}function l(u,h){const c=h[h.length-1],v=s[o][0],d=s[o][1];let x=0;const g=c.children.indexOf(u);let m=!1,y=[];v.lastIndex=0;let b=v.exec(u.value);for(;b;){const _=b.index,R={index:b.index,input:b.input,stack:[...h,u]};let E=d(...b,R);if(typeof E=="string"&&(E=E.length>0?{type:"text",value:E}:void 0),E===!1?v.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),!v.global)break;b=v.exec(u.value)}return m?(x<u.value.length&&y.push({type:"text",value:u.value.slice(x)}),c.children.splice(g,1,...y)):y=[u],g+y.length}}function mI(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([yI(i[0]),xI(i[1])])}return e}function yI(t){return typeof t=="string"?new RegExp(vI(t),"g"):t}function xI(t){return typeof t=="function"?t:function(){return t}}const Jp="phrasing",ev=["autolink","link","image","label"];function bI(){return{transforms:[TI],enter:{literalAutolink:_I,literalAutolinkEmail:tv,literalAutolinkHttp:tv,literalAutolinkWww:tv},exit:{literalAutolink:kI,literalAutolinkEmail:EI,literalAutolinkHttp:SI,literalAutolinkWww:CI}}}function wI(){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 _I(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function tv(t){this.config.enter.autolinkProtocol.call(this,t)}function SI(t){this.config.exit.autolinkProtocol.call(this,t)}function CI(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 EI(t){this.config.exit.autolinkEmail.call(this,t)}function kI(t){this.exit(t)}function TI(t){gI(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,RI],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),LI]],{ignore:["link","linkReference"]})}function RI(t,e,r,n,i){let s="";if(!US(i)||(/^w/i.test(e)&&(r=e+r,e="",s="http://"),!NI(r)))return!1;const o=DI(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 LI(t,e,r,n){return!US(n,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+r,children:[{type:"text",value:e+"@"+r}]}}function NI(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 DI(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 US(t,e){const r=t.input.charCodeAt(t.index-1);return(t.index===0||Ha(r)||oh(r))&&(!e||r!==47)}WS.peek=zI;function AI(){this.buffer()}function MI(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function PI(){this.buffer()}function II(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function OI(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 BI(t){this.exit(t)}function FI(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 jI(t){this.exit(t)}function zI(){return"["}function WS(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 HI(){return{enter:{gfmFootnoteCallString:AI,gfmFootnoteCall:MI,gfmFootnoteDefinitionLabelString:PI,gfmFootnoteDefinition:II},exit:{gfmFootnoteCallString:OI,gfmFootnoteCall:BI,gfmFootnoteDefinitionLabelString:FI,gfmFootnoteDefinition:jI}}}function UI(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:r,footnoteReference:WS},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"),h=s.enter("label");return l+=a.move(s.safe(s.associationId(n),{before:l,after:"]"})),h(),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?VS:WI))),u(),l}}function WI(t,e,r){return e===0?t:VS(t,e,r)}function VS(t,e,r){return(r?"":" ")+t}const VI=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];$S.peek=XI;function $I(){return{canContainEols:["delete"],enter:{strikethrough:qI},exit:{strikethrough:YI}}}function GI(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:VI}],handlers:{delete:$S}}}function qI(t){this.enter({type:"delete",children:[]},t)}function YI(t){this.exit(t)}function $S(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 XI(){return"~"}function KI(t){return t.length}function QI(t,e){const r=e||{},n=(r.align||[]).concat(),i=r.stringLength||KI,s=[],o=[],a=[],l=[];let u=0,h=-1;for(;++h<t.length;){const w=[],g=[];let m=-1;for(t[h].length>u&&(u=t[h].length);++m<t[h].length;){const y=ZI(t[h][m]);if(r.alignDelimiters!==!1){const b=i(y);g[m]=b,(l[m]===void 0||b>l[m])&&(l[m]=b)}w.push(y)}o[h]=w,a[h]=g}let c=-1;if(typeof n=="object"&&"length"in n)for(;++c<u;)s[c]=zb(n[c]);else{const w=zb(n);for(;++c<u;)s[c]=w}c=-1;const v=[],d=[];for(;++c<u;){const w=s[c];let g="",m="";w===99?(g=":",m=":"):w===108?g=":":w===114&&(m=":");let y=r.alignDelimiters===!1?1:Math.max(1,l[c]-g.length-m.length);const b=g+"-".repeat(y)+m;r.alignDelimiters!==!1&&(y=g.length+y+m.length,y>l[c]&&(l[c]=y),d[c]=y),v[c]=b}o.splice(1,0,v),a.splice(1,0,d),h=-1;const x=[];for(;++h<o.length;){const w=o[h],g=a[h];c=-1;const m=[];for(;++c<u;){const y=w[c]||"";let b="",_="";if(r.alignDelimiters!==!1){const R=l[c]-(g[c]||0),E=s[c];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&&!c&&m.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&y==="")&&(r.delimiterStart!==!1||c)&&m.push(" "),r.alignDelimiters!==!1&&m.push(b),m.push(y),r.alignDelimiters!==!1&&m.push(_),r.padding!==!1&&m.push(" "),(r.delimiterEnd!==!1||c!==u-1)&&m.push("|")}x.push(r.delimiterEnd===!1?m.join("").replace(/ +$/,""):m.join(""))}return x.join(`
|
|
404
|
+
`)}function ZI(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 JI(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()),eO);return i(),o}function eO(t,e,r){return">"+(r?"":" ")+t}function tO(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
|
+
`&&tO(r.stack,r.unsafe[i]))return/[ \t]/.test(n.before)?"":" ";return`\\
|
|
406
|
+
`}function rO(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 nO(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 iO(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 aO(t,e,r,n){const i=iO(r),s=t.value||"",o=i==="`"?"GraveAccent":"Tilde";if(nO(t,r)){const c=r.enter("codeIndented"),v=r.indentLines(s,sO);return c(),v}const a=r.createTracker(n),l=i.repeat(Math.max(rO(s,i)+1,3)),u=r.enter("codeFenced");let h=a.move(l);if(t.lang){const c=r.enter(`codeFencedLang${o}`);h+=a.move(r.safe(t.lang,{before:h,after:" ",encode:["`"],...a.current()})),c()}if(t.lang&&t.meta){const c=r.enter(`codeFencedMeta${o}`);h+=a.move(" "),h+=a.move(r.safe(t.meta,{before:h,after:`
|
|
407
|
+
`,encode:["`"],...a.current()})),c()}return h+=a.move(`
|
|
408
|
+
`),s&&(h+=a.move(s+`
|
|
409
|
+
`)),h+=a.move(l),u(),h}function sO(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 oO(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 lO(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}}GS.peek=uO;function GS(t,e,r,n){const i=lO(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),h=Hc(n.before.charCodeAt(n.before.length-1),u,i);h.inside&&(l=bl(u)+l.slice(1));const c=l.charCodeAt(l.length-1),v=Hc(n.after.charCodeAt(0),c,i);v.inside&&(l=l.slice(0,-1)+bl(c));const d=o.move(i);return s(),r.attentionEncodeSurroundingInfo={after:v.outside,before:h.outside},a+l+d}function uO(t,e,r){return r.options.emphasis||"*"}function cO(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 hO(t,e,r,n){const i=Math.max(Math.min(6,t.depth||1),1),s=r.createTracker(n);if(cO(t,r)){const h=r.enter("headingSetext"),c=r.enter("phrasing"),v=r.containerPhrasing(t,{...s.current(),before:`
|
|
411
|
+
`,after:`
|
|
412
|
+
`});return c(),h(),v+`
|
|
413
|
+
`+(i===1?"=":"-").repeat(v.length-(Math.max(v.lastIndexOf("\r"),v.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}qS.peek=fO;function qS(t){return t.value||""}function fO(){return"<"}YS.peek=dO;function YS(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 dO(){return"!"}XS.peek=pO;function XS(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 h=r.stack;r.stack=[],o=r.enter("reference");const c=r.safe(r.associationId(t),{before:l,after:"]",...a.current()});return o(),r.stack=h,s(),i==="full"||!u||u!==c?l+=a.move(c+"]"):i==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function pO(){return"!"}KS.peek=vO;function KS(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 vO(){return"`"}function QS(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))}ZS.peek=gO;function ZS(t,e,r,n){const i=Ng(r),s=i==='"'?"Quote":"Apostrophe",o=r.createTracker(n);let a,l;if(QS(t,r)){const h=r.stack;r.stack=[],a=r.enter("autolink");let c=o.move("<");return c+=o.move(r.containerPhrasing(t,{before:c,after:">",...o.current()})),c+=o.move(">"),a(),r.stack=h,c}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 gO(t,e,r){return QS(t,r)?"<":"["}JS.peek=mO;function JS(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 h=r.stack;r.stack=[],o=r.enter("reference");const c=r.safe(r.associationId(t),{before:l,after:"]",...a.current()});return o(),r.stack=h,s(),i==="full"||!u||u!==c?l+=a.move(c+"]"):i==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function mO(){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 yO(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 xO(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 e2(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 bO(t,e,r,n){const i=r.enter("list"),s=r.bulletCurrent;let o=t.ordered?xO(r):Dg(r);const a=t.ordered?o==="."?")":".":yO(r);let l=e&&r.bulletLastUsed?o===r.bulletLastUsed:!1;if(!t.ordered){const h=t.children?t.children[0]:void 0;if((o==="*"||o==="-")&&h&&(!h.children||!h.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),e2(r)===o&&h){let c=-1;for(;++c<t.children.length;){const v=t.children[c];if(v&&v.type==="listItem"&&v.children&&v.children[0]&&v.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 wO(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 _O(t,e,r,n){const i=wO(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()),h);return l(),u;function h(c,v,d){return v?(d?"":" ".repeat(o))+c:(d?s:s+" ".repeat(o-s.length))+c}}function SO(t,e,r,n){const i=r.enter("paragraph"),s=r.enter("phrasing"),o=r.containerPhrasing(t,n);return s(),i(),o}const CO=ch(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function EO(t,e,r,n){return(t.children.some(function(o){return CO(o)})?r.containerPhrasing:r.containerFlow).call(r,t,n)}function kO(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}t2.peek=TO;function t2(t,e,r,n){const i=kO(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),h=Hc(n.before.charCodeAt(n.before.length-1),u,i);h.inside&&(l=bl(u)+l.slice(1));const c=l.charCodeAt(l.length-1),v=Hc(n.after.charCodeAt(0),c,i);v.inside&&(l=l.slice(0,-1)+bl(c));const d=o.move(i+i);return s(),r.attentionEncodeSurroundingInfo={after:v.outside,before:h.outside},a+l+d}function TO(t,e,r){return r.options.strong||"*"}function RO(t,e,r,n){return r.safe(t.value,n)}function LO(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 NO(t,e,r){const n=(e2(r)+(r.options.ruleSpaces?" ":"")).repeat(LO(r));return r.options.ruleSpaces?n.slice(0,-1):n}const r2={blockquote:JI,break:Ub,code:aO,definition:oO,emphasis:GS,hardBreak:Ub,heading:hO,html:qS,image:YS,imageReference:XS,inlineCode:KS,link:ZS,linkReference:JS,list:bO,listItem:_O,paragraph:SO,root:EO,strong:t2,text:RO,thematicBreak:NO};function DO(){return{enter:{table:AO,tableData:Wb,tableHeader:Wb,tableRow:PO},exit:{codeText:IO,table:MO,tableData:rv,tableHeader:rv,tableRow:rv}}}function AO(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 MO(t){this.exit(t),this.data.inTable=void 0}function PO(t){this.enter({type:"tableRow",children:[]},t)}function rv(t){this.exit(t)}function Wb(t){this.enter({type:"tableCell",children:[]},t)}function IO(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,OO));const r=this.stack[this.stack.length-1];r.type,r.value=e,this.exit(t)}function OO(t,e){return e==="|"?e:t}function BO(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:v,table:o,tableCell:l,tableRow:a}};function o(d,x,w,g){return u(h(d,w,g),d.align)}function a(d,x,w,g){const m=c(d,w,g),y=u([m]);return y.slice(0,y.indexOf(`
|
|
417
|
+
`))}function l(d,x,w,g){const m=w.enter("tableCell"),y=w.enter("phrasing"),b=w.containerPhrasing(d,{...g,before:s,after:s});return y(),m(),b}function u(d,x){return QI(d,{align:x,alignDelimiters:n,padding:r,stringLength:i})}function h(d,x,w){const g=d.children;let m=-1;const y=[],b=x.enter("table");for(;++m<g.length;)y[m]=c(g[m],x,w);return b(),y}function c(d,x,w){const g=d.children;let m=-1;const y=[],b=x.enter("tableRow");for(;++m<g.length;)y[m]=l(g[m],d,x,w);return b(),y}function v(d,x,w){let g=r2.inlineCode(d,x,w);return w.stack.includes("tableCell")&&(g=g.replace(/\|/g,"\\$&")),g}}function FO(){return{exit:{taskListCheckValueChecked:Vb,taskListCheckValueUnchecked:Vb,paragraph:zO}}}function jO(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:HO}}}function Vb(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function zO(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 HO(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=r2.listItem(t,e,r,{...n,...a.current()});return s&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),l;function u(h){return h+o}}function UO(){return[bI(),HI(),$I(),DO(),FO()]}function WO(t){return{extensions:[wI(),UI(t),GI(),BO(t),jO()]}}const VO={tokenize:KO,partial:!0},n2={tokenize:QO,partial:!0},i2={tokenize:ZO,partial:!0},a2={tokenize:JO,partial:!0},$O={tokenize:eB,partial:!0},s2={name:"wwwAutolink",tokenize:YO,previous:l2},o2={name:"protocolAutolink",tokenize:XO,previous:u2},xi={name:"emailAutolink",tokenize:qO,previous:c2},ni={};function GO(){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,o2];ni[104]=[xi,o2];ni[87]=[xi,s2];ni[119]=[xi,s2];function qO(t,e,r){const n=this;let i,s;return o;function o(c){return!Fv(c)||!c2.call(n,n.previous)||Ag(n.events)?r(c):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),a(c))}function a(c){return Fv(c)?(t.consume(c),a):c===64?(t.consume(c),l):r(c)}function l(c){return c===46?t.check($O,h,u)(c):c===45||c===95||jr(c)?(s=!0,t.consume(c),l):h(c)}function u(c){return t.consume(c),i=!0,l}function h(c){return s&&i&&Xr(n.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(c)):r(c)}}function YO(t,e,r){const n=this;return i;function i(o){return o!==87&&o!==119||!l2.call(n,n.previous)||Ag(n.events)?r(o):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(VO,t.attempt(n2,t.attempt(i2,s),r),r)(o))}function s(o){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(o)}}function XO(t,e,r){const n=this;let i="",s=!1;return o;function o(c){return(c===72||c===104)&&u2.call(n,n.previous)&&!Ag(n.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),i+=String.fromCodePoint(c),t.consume(c),a):r(c)}function a(c){if(Xr(c)&&i.length<5)return i+=String.fromCodePoint(c),t.consume(c),a;if(c===58){const v=i.toLowerCase();if(v==="http"||v==="https")return t.consume(c),l}return r(c)}function l(c){return c===47?(t.consume(c),s?u:(s=!0,l)):r(c)}function u(c){return c===null||Fc(c)||Wt(c)||Ha(c)||oh(c)?r(c):t.attempt(n2,t.attempt(i2,h),r)(c)}function h(c){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(c)}}function KO(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 QO(t,e,r){let n,i,s;return o;function o(u){return u===46||u===95?t.check(a2,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 ZO(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(a2,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 JO(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 eB(t,e,r){return n;function n(s){return t.consume(s),i}function i(s){return jr(s)?r(s):e(s)}}function l2(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||Wt(t)}function u2(t){return!Xr(t)}function c2(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 tB={tokenize:uB,partial:!0};function rB(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:sB,continuation:{tokenize:oB},exit:lB}},text:{91:{name:"gfmFootnoteCall",tokenize:aB},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:nB,resolveTo:iB}}}}function nB(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 iB(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 aB(t,e,r){const n=this,i=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let s=0,o;return a;function a(c){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(c),t.exit("gfmFootnoteCallLabelMarker"),l}function l(c){return c!==94?r(c):(t.enter("gfmFootnoteCallMarker"),t.consume(c),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",u)}function u(c){if(s>999||c===93&&!o||c===null||c===91||Wt(c))return r(c);if(c===93){t.exit("chunkString");const v=t.exit("gfmFootnoteCallString");return i.includes(zn(n.sliceSerialize(v)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(c),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):r(c)}return Wt(c)||(o=!0),s++,t.consume(c),c===92?h:u}function h(c){return c===91||c===92||c===93?(t.consume(c),s++,u):u(c)}}function sB(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",h):r(x)}function h(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"),v}return Wt(x)||(a=!0),o++,t.consume(x),x===92?c:h}function c(x){return x===91||x===92||x===93?(t.consume(x),o++,h):h(x)}function v(x){return x===58?(t.enter("definitionMarker"),t.consume(x),t.exit("definitionMarker"),i.includes(s)||i.push(s),Tt(t,d,"gfmFootnoteDefinitionWhitespace")):r(x)}function d(x){return e(x)}}function oB(t,e,r){return t.check(Pl,e,t.attempt(tB,e,r))}function lB(t){t.exit("gfmFootnoteDefinition")}function uB(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 cB(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 h={type:"strikethrough",start:Object.assign({},o[u][1].start),end:Object.assign({},o[l][1].end)},c={type:"strikethroughText",start:Object.assign({},o[u][1].end),end:Object.assign({},o[l][1].start)},v=[["enter",h,a],["enter",o[u][1],a],["exit",o[u][1],a],["enter",c,a]],d=a.parser.constructs.insideSpan.null;d&&yn(v,v.length,0,lh(d,o.slice(u+1,l),a)),yn(v,v.length,0,[["exit",c,a],["enter",o[l][1],a],["exit",o[l][1],a],["exit",h,a]]),yn(o,u-1,l-u+3,v),l=u+v.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,h=this.events;let c=0;return v;function v(x){return u===126&&h[h.length-1][1].type!=="characterEscape"?l(x):(o.enter("strikethroughSequenceTemporary"),d(x))}function d(x){const w=Vs(u);if(x===126)return c>1?l(x):(o.consume(x),c++,d);if(c<2&&!r)return l(x);const g=o.exit("strikethroughSequenceTemporary"),m=Vs(x);return g._open=!m||m===2&&!!w,g._close=!w||w===2&&!!m,a(x)}}}class hB{constructor(){this.map=[]}add(e,r,n){fB(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 fB(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 dB(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 pB(){return{flow:{null:{name:"table",tokenize:vB,resolveAll:gB}}}}function vB(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),h(M)}function h(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"),d):r(M):Ct(M)?Tt(t,h,"whitespace")(M):(s+=1,o&&(o=!1,i+=1),M===124?(t.enter("tableCellDivider"),t.consume(M),t.exit("tableCellDivider"),o=!0,h):(t.enter("data"),c(M)))}function c(M){return M===null||M===124||Wt(M)?(t.exit("data"),h(M)):(t.consume(M),M===92?v:c)}function v(M){return M===92||M===124?(t.consume(M),c):c(M)}function d(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?g(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,g,"whitespace")(M):g(M)}function g(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 gB(t,e){let r=-1,n=!0,i=0,s=[0,0,0,0],o=[0,0,0,0],a=!1,l=0,u,h,c;const v=new hB;for(;++r<t.length;){const d=t[r],x=d[1];d[0]==="enter"?x.type==="tableHead"?(a=!1,l!==0&&($b(v,e,l,u,h),h=void 0,l=0),u={type:"table",start:Object.assign({},x.start),end:Object.assign({},x.end)},v.add(r,0,[["enter",u,e]])):x.type==="tableRow"||x.type==="tableDelimiterRow"?(n=!0,c=void 0,s=[0,0,0,0],o=[0,r+1,0,0],a&&(a=!1,h={type:"tableBody",start:Object.assign({},x.start),end:Object.assign({},x.end)},v.add(r,0,[["enter",h,e]])),i=x.type==="tableDelimiterRow"?2:h?3:1):i&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")?(n=!1,o[2]===0&&(s[1]!==0&&(o[0]=o[1],c=ac(v,e,s,i,void 0,c),s=[0,0,0,0]),o[2]=r)):x.type==="tableCellDivider"&&(n?n=!1:(s[1]!==0&&(o[0]=o[1],c=ac(v,e,s,i,void 0,c)),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],c=ac(v,e,s,i,r,c)):o[1]!==0&&(c=ac(v,e,o,i,r,c)),i=0):i&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")&&(o[3]=r)}for(l!==0&&$b(v,e,l,u,h),v.consume(e.events),r=-1;++r<e.events.length;){const d=e.events[r];d[0]==="enter"&&d[1].type==="table"&&(d[1]._align=dB(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]),h=Ns(e.events,r[3]),c={type:a,start:Object.assign({},u),end:Object.assign({},h)};if(t.add(r[2],0,[["enter",c,e]]),n!==2){const v=e.events[r[2]],d=e.events[r[3]];if(v[1].end=Object.assign({},d[1].end),v[1].type="chunkText",v[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",c,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 mB={name:"tasklistCheck",tokenize:xB};function yB(){return{text:{91:mB}}}function xB(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:bB},e,r)(l):r(l)}}function bB(t,e,r){return Tt(t,n,"whitespace");function n(i){return i===null?r(i):e(i)}}function wB(t){return bS([GO(),rB(),cB(t),pB(),yB()])}const _B={};function SB(t){const e=this,r=t||_B,n=e.data(),i=n.micromarkExtensions||(n.micromarkExtensions=[]),s=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),o=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);i.push(wB(r)),s.push(UO()),o.push(WO(r))}const CB={h1:({children:t})=>S.jsx("h1",{className:"text-lg font-bold mt-4 mb-2",style:{color:"#e6edf3"},children:t}),h2:({children:t})=>S.jsx("h2",{className:"text-base font-bold mt-3 mb-1.5",style:{color:"#e6edf3"},children:t}),h3:({children:t})=>S.jsx("h3",{className:"text-sm font-semibold mt-2 mb-1",style:{color:"#e6edf3"},children:t}),p:({children:t})=>S.jsx("p",{className:"mb-2 last:mb-0 leading-relaxed",children:t}),a:({href:t,children:e})=>S.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"underline",style:{color:"#79c0ff"},children:e}),img:({alt:t})=>S.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
|
+
`)?S.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}):S.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})=>S.jsx("pre",{className:"my-2",children:t}),blockquote:({children:t})=>S.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})=>S.jsx("ul",{className:"list-disc pl-5 mb-2 space-y-0.5",children:t}),ol:({children:t})=>S.jsx("ol",{className:"list-decimal pl-5 mb-2 space-y-0.5",children:t}),li:({children:t})=>S.jsx("li",{className:"text-sm leading-relaxed",children:t}),table:({children:t})=>S.jsx("div",{className:"overflow-x-auto my-2",children:S.jsx("table",{className:"text-xs w-full border-collapse font-mono",children:t})}),thead:({children:t})=>S.jsx("thead",{style:{borderBottom:"1px solid rgba(230,237,243,0.12)"},children:t}),tbody:({children:t})=>S.jsx("tbody",{children:t}),tr:({children:t})=>S.jsx("tr",{style:{borderBottom:"1px solid rgba(230,237,243,0.06)"},children:t}),th:({children:t})=>S.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})=>S.jsx("td",{className:"px-3 py-1.5",style:{color:"#e6edf3"},children:t}),hr:()=>S.jsx("hr",{className:"my-3",style:{borderColor:"rgba(230,237,243,0.1)"}}),strong:({children:t})=>S.jsx("strong",{className:"font-semibold",style:{color:"#e6edf3"},children:t}),em:({children:t})=>S.jsx("em",{style:{color:"rgba(230,237,243,0.8)"},children:t})};function EB({children:t,className:e}){return S.jsx("div",{className:`text-sm leading-relaxed ${e??""}`,style:{color:"#e6edf3"},children:S.jsx(cI,{remarkPlugins:[SB],components:CB,children:t})})}const kB={ask:"Ask",balanced:"Balanced",autonomous:"Autonomous"},TB={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"}},RB={bg:"rgba(230,237,243,0.1)",fg:"rgba(230,237,243,0.55)"};function LB(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 NB({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 S.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:[S.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"}}),S.jsx("span",{children:n})]})}function DB({runId:t,ord:e}){const r=Pa(i=>i.outputs[J_(t,e)]);if(!r)return null;const n=r.length>800?"…"+r.slice(r.length-800):r;return S.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 AB({reason:t}){const[e,r]=ae.useState(!1),[n,i]=ae.useState(!1),s="degraded-routing-detail";return e?S.jsx(S.Fragment,{}):S.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:[S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("span",{className:"shrink-0","aria-hidden":"true",children:"⚠"}),S.jsxs("span",{className:"flex-1",children:["Degraded routing: ",t]}),S.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?"▲":"▼"}),S.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:S.jsx("span",{"aria-hidden":"true",children:"✕"})})]}),n&&S.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 ",S.jsx("strong",{children:"Decisions"})," section in the Insights panel on the right to see each reviewer's verdict."]})]})}function MB({cli:t}){const{bg:e,fg:r}=TB[t.toLowerCase()]??RB;return S.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:LB(t)})}const PB={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"}},IB={pending:"queued",distributed:"dispatched",done:"done",rejected:"rejected"};function OB(t,e,r){return e.startsWith(`${t}:`)?e.slice(t.length+1):`u${r}`}const BB=new Set(["sessionStarted","sessionCompleted","sessionFailed","awaitingHuman","gateDecided","resumed","runCancelled","workerMessageQueued","workerMessageInjected"]),FB=new Set(["stepFailed","crashRecoveryRedrive","workerStalled","failureTriaged"]);function jB(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 zB(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 HB(){return S.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[S.jsx("circle",{cx:"8",cy:"8",r:"6.75",stroke:"currentColor",strokeWidth:"1.5"}),S.jsx("rect",{x:"5.25",y:"5.25",width:"5.5",height:"5.5",rx:"0.75",fill:"currentColor"})]})}function UB(){return S.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[S.jsx("path",{d:"M8 2v7.25m0 0L5.25 6.5M8 9.25l2.75-2.75",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),S.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 WB({runId:t,disabled:e}){const[r,n]=ae.useState(!1),[i,s]=ae.useState(null);async function o(){n(!0),s(null);try{await lE(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 S.jsxs(S.Fragment,{children:[i&&S.jsxs("span",{role:"alert",className:"text-[11px] font-mono shrink-0 max-w-[14rem] truncate",style:{color:"#f85149"},children:["Export failed: ",i]}),S.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:S.jsx(UB,{})})]})}function VB({detail:t,onStop:e,canStop:r}){return S.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:[S.jsxs("div",{className:"flex items-center gap-2 font-semibold text-[11px] uppercase tracking-wide",children:[S.jsx("span",{children:"⚠"}),S.jsx("span",{children:"Step failure"})]}),t&&S.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}),S.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[S.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"}),S.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 $B({attempt:t}){return S.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:[S.jsxs("div",{className:"flex items-center gap-2 font-semibold text-[11px] uppercase tracking-wide",children:[S.jsx("span",{children:"↺"}),S.jsxs("span",{children:["Crash recovery — attempt ",t]})]}),S.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 h2({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 S.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)=>S.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:kB[s]},s))})}function GB({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]),h=Pa(A=>A.logs[a.id])??[],c=Pa(A=>A.executorTypes),[v,d]=ae.useState("all"),x=Pa(A=>A.terminalIds),[w,g]=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,h.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,OB(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=GA[a.status]??{label:a.status,color:"rgba(230,237,243,0.5)"},T=["completed","cancelled","failed"].includes(a.status),k=h.filter(A=>BB.has(A.type)||FB.has(A.type)),N=zB(a.status),M=["executing","distributing","planning","awaiting_human"].includes(a.status);function B(){o==null||o(a.id)}return S.jsxs("div",{className:"flex flex-col h-full",children:[S.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:[S.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:"←"}),S.jsx("span",{className:`w-2.5 h-2.5 rounded-full shrink-0 ${M?"animate-pulse":""}`,style:{background:N}}),S.jsx("p",{className:"flex-1 text-base font-semibold truncate",style:{color:"#e6edf3"},title:a.problem,children:a.problem}),S.jsx("span",{className:"text-xs font-medium shrink-0 font-mono",style:{color:E.color},children:E.label}),S.jsx(h2,{mode:e,onChange:r,readOnly:T}),S.jsx(WB,{runId:a.id,disabled:!T}),!T&&o&&S.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:S.jsx(HB,{})})]}),S.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:[S.jsx("div",{className:"flex justify-end",children:S.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=PB[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=S.jsxs("div",{className:"flex flex-col gap-2",children:[A.routing!==null&&A.routing.method==="council"&&S.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:[S.jsx("span",{className:"shrink-0",children:"⚖"}),S.jsxs("span",{children:[S.jsxs("span",{className:"font-semibold",children:["Council → ",A.assigned_cli??"?"]}),S.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"&&S.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:[S.jsx("span",{className:"shrink-0",children:"⚖"}),S.jsxs("span",{children:[S.jsxs("span",{className:"font-semibold",children:["Evaluator-distinct → ",A.assigned_cli??"?"]}),S.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"&&S.jsx(AB,{reason:A.routing.reason}),S.jsxs("div",{className:"self-start max-w-[85%] flex flex-col gap-2",children:[S.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[A.assigned_cli?S.jsxs("div",{className:"flex items-center gap-1",children:[S.jsxs("button",{type:"button",onClick:()=>d(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:[S.jsx(MB,{cli:A.assigned_cli}),S.jsxs("span",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.55)"},children:[A.assigned_cli,S.jsxs("span",{style:{color:"rgba(230,237,243,0.3)"},children:[" · unit ",A.ord]})]})]}),x[`${a.id}:${A.assigned_cli}`]&&S.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}`];g((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:"⌨"})]}):S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("span",{className:"w-7 h-7 rounded-full shrink-0",style:{background:"rgba(230,237,243,0.06)"}}),S.jsxs("span",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.55)"},children:["agent",S.jsxs("span",{style:{color:"rgba(230,237,243,0.3)"},children:[" · unit ",A.ord]})]})]}),S.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&&S.jsx("span",{role:"img","aria-label":"Governance floor armed",style:{color:"#ffda19",fontSize:"12px"},children:"🔒"}),S.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})]}),S.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&&S.jsxs("div",{children:[S.jsxs("div",{className:"flex items-center gap-2 text-sm font-mono",style:{color:"rgba(230,237,243,0.5)"},children:[S.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full animate-pulse",style:{background:"#79c0ff"}}),S.jsx("span",{children:"Working…"})]}),S.jsx(DB,{runId:a.id,ord:A.ord})]}),A.status==="distributed"&&T&&S.jsxs("div",{className:"flex items-center gap-2 text-sm font-mono",style:{color:"rgba(230,237,243,0.35)"},children:[S.jsx("span",{children:"—"}),S.jsx("span",{children:"Not started"})]}),A.status==="done"&&S.jsxs("div",{className:"flex items-center gap-2 text-sm font-mono",style:{color:"#3fb950"},children:[S.jsx("span",{children:"✓"}),S.jsx("span",{className:"font-medium",children:IB[A.status]})]}),A.status==="rejected"&&S.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=c[`${a.id}:${A.ord}`];return(W?W==="agent":!0)?S.jsx(NB,{runId:a.id,ord:A.ord}):S.jsxs("div",{className:"flex items-center gap-2 text-sm font-mono",style:{color:"rgba(230,237,243,0.3)"},children:[S.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full",style:{background:"rgba(230,237,243,0.2)"}}),S.jsx("span",{children:"Queued"})]})})(),A.status==="done"&&S.jsxs("div",{className:"mt-3",children:[S.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)&&S.jsx("div",{className:"mt-2.5 max-h-96 overflow-auto rounded-xl p-4",style:{background:"#0d1117"},children:j.loading?S.jsx("span",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.5)"},children:"Loading…"}):S.jsx(EB,{className:"whitespace-pre-wrap",children:j.text??""})})]})]})]})]},A.id);return I?[S.jsx("div",{className:"self-center w-full max-w-lg",children:S.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"?S.jsx("div",{className:"flex flex-col gap-2",children:S.jsx(VB,{detail:A.detail,onStop:B,canStop:o!==void 0&&!T})},A.seq):A.type==="crashRecoveryRedrive"?S.jsx("div",{className:"flex flex-col gap-2",children:S.jsx($B,{attempt:A.attempt??1})},A.seq):S.jsx("div",{className:"flex justify-center",children:S.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:jB(A.type,A.detail)})},A.seq)),a.status==="awaiting_human"&&!l.some(A=>(u==null?void 0:u.ord)===A.ord)&&S.jsx("div",{className:"self-center w-full max-w-lg",children:S.jsx(rb,{runId:a.id,...u?{ord:u.ord,prompt:u.prompt}:{},onResolved:s})}),S.jsx("div",{ref:_})]}),w&&S.jsx("div",{className:"px-4 pb-3 shrink-0",children:S.jsx(JA,{terminalId:w.terminalId,cliKey:w.cliKey,onClose:()=>g(null)})}),S.jsx(aS,{runId:T?null:a.id,runStatus:T?null:a.status,mode:e,onLaunched:n,injectTarget:v,onClearInjectTarget:()=>d("all")})]})}function qB({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 S.jsx("div",{className:"flex flex-col h-full items-center justify-center",children:S.jsxs("div",{className:"w-full max-w-2xl px-8 flex flex-col gap-5",children:[S.jsxs("div",{className:"flex flex-col gap-2 text-center",children:[S.jsx("h1",{className:"text-3xl font-bold tracking-tight",style:{color:"#e6edf3"},children:i}),S.jsx("p",{className:"text-base leading-relaxed",style:{color:"rgba(230,237,243,0.5)"},children:s})]}),S.jsx("div",{className:"flex justify-center",children:S.jsx(h2,{mode:e,onChange:r})}),S.jsx(aS,{embedded:!0,mode:e,onLaunched:n,...t?{workflowOverride:"chat"}:{}})]})})}function YB({view:t,chatMode:e,onLaunched:r,onNavigateBack:n,onRefresh:i,onKill:s}){const[o,a]=ae.useState("balanced");if(t){let l=function(c){a(c),h||lt.injectMessage(u.session.id,`mode:${c}`,"all").catch(()=>{})};const u=t,h=["completed","cancelled","failed"].includes(u.session.status);return S.jsx(GB,{view:u,mode:o,onModeChange:l,onLaunched:r,onNavigateBack:n,onRefresh:i,...s!==void 0?{onKill:s}:{}},u.session.id)}return S.jsx(qB,{chatMode:e??!1,mode:o,onModeChange:a,onLaunched:r})}function XB(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 KB={recon:"#79c0ff",build:"#3fb950",review:"#a78bfa",test:"#ffda19"};function f2(t){return KB[t]??"rgba(230,237,243,0.3)"}function QB({phase:t}){const e=t.executor,r=f2(t.kind);return S.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:[S.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[S.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:r},title:t.kind}),S.jsx("span",{className:"font-semibold",style:{color:"#e6edf3"},children:t.id}),S.jsx("span",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:t.kind}),t.role!=="neutral"&&S.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"&&S.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(" ")]})]}),S.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-0.5 text-[10px]",style:{color:"rgba(230,237,243,0.45)"},children:[S.jsxs("span",{children:[S.jsx("span",{className:"font-medium",style:{color:"rgba(230,237,243,0.6)"},children:"gate:"})," ",t.gate_type?`${t.gate_type} / `:"",XB(t.gate)]}),t.depends_on.length>0&&S.jsxs("span",{children:[S.jsx("span",{className:"font-medium",style:{color:"rgba(230,237,243,0.6)"},children:"after:"})," ",t.depends_on.join(", ")]}),t.skill_ref&&S.jsxs("span",{children:[S.jsx("span",{className:"font-medium",style:{color:"rgba(230,237,243,0.6)"},children:"skill:"})," ",S.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 ZB(t){return t==="human"?{human_confirm:{unconditional:!1}}:t==="human_if"?{human_confirm_if:"verdict_not_pass"}:"auto"}async function JB(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:ZB(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 JB(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 S.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 eF({phase:t,index:e,total:r,allIds:n,onChange:i,onRemove:s,onMoveUp:o,onMoveDown:a}){const l=(h,c)=>i({...t,[h]:c}),u=n.slice(0,e);return S.jsxs("div",{className:"rounded p-3 flex flex-col gap-2",style:{border:"1px solid rgba(230,237,243,0.08)",background:"#1b222e"},children:[S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("span",{className:"h-2.5 w-2.5 rounded-full",style:{backgroundColor:f2(t.kind)}}),S.jsxs("span",{className:"text-[11px] font-semibold",style:{color:"rgba(230,237,243,0.7)"},children:["Phase ",e+1]}),S.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[S.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:"▲"}),S.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:"▼"}),S.jsx("button",{type:"button",onClick:s,className:"px-1 text-[10px]",style:{color:"#f85149"},children:"✕"})]})]}),S.jsxs("div",{className:"flex gap-2",children:[S.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:h=>l("id",h.target.value),style:tl}),S.jsx("select",{className:"rounded px-2 py-1 text-xs focus:outline-none",value:t.kind,onChange:h=>l("kind",h.target.value),style:tl,children:["recon","build","review","test"].map(h=>S.jsx("option",{value:h,children:h},h))})]}),S.jsxs("div",{className:"flex flex-col gap-1.5",children:[S.jsx("div",{className:"flex gap-1",children:["agent","command","script"].map(h=>S.jsx(sc,{active:t.execMode===h,onClick:()=>l("execMode",h),children:h==="agent"?"Agent":h==="command"?"Command":"Script"},h))}),t.execMode==="command"&&S.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:h=>l("cmd",h.target.value),style:tl}),t.execMode==="script"&&S.jsxs("div",{className:"flex flex-col gap-1",children:[S.jsxs("div",{className:"flex gap-1 items-center",children:[S.jsx("span",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Language:"}),["bash","sh","python"].map(h=>S.jsx(sc,{active:t.scriptLang===h,onClick:()=>l("scriptLang",h),children:h},h))]}),S.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:h=>l("script",h.target.value),style:{...tl,background:"#0d1117"}}),S.jsxs("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.3)"},children:["Saved to"," ",S.jsxs("span",{style:{color:"rgba(230,237,243,0.5)"},children:["~/.wicked/scripts/",t.id||"script",".",t.scriptLang==="python"?"py":"sh"]})]})]})]}),S.jsxs("div",{className:"flex gap-2 flex-wrap",children:[S.jsxs("div",{className:"flex flex-col gap-0.5",children:[S.jsx("span",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Gate"}),S.jsx("div",{className:"flex gap-1",children:[["auto","Auto"],["human","Human"],["human_if","Human if fails"]].map(([h,c])=>S.jsx(sc,{active:t.gate===h,onClick:()=>l("gate",h),children:c},h))})]}),S.jsxs("div",{className:"flex flex-col gap-0.5",children:[S.jsx("span",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Role"}),S.jsx("div",{className:"flex gap-1",children:["neutral","creator","evaluator"].map(h=>S.jsx(sc,{active:t.role===h,onClick:()=>l("role",h),children:h},h))})]})]}),u.length>0&&S.jsxs("div",{className:"flex flex-col gap-0.5",children:[S.jsx("span",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Depends on"}),S.jsx("div",{className:"flex flex-wrap gap-1.5",children:u.map(h=>S.jsxs("label",{className:"flex items-center gap-1 text-[10px] cursor-pointer",style:{color:"rgba(230,237,243,0.55)"},children:[S.jsx("input",{type:"checkbox",checked:t.dependsOn.includes(h),onChange:c=>l("dependsOn",c.target.checked?[...t.dependsOn,h]:t.dependsOn.filter(v=>v!==h))}),S.jsx("span",{className:"font-mono",children:h})]},h))})]}),S.jsxs("div",{className:"flex gap-3 text-[10px]",style:{color:"rgba(230,237,243,0.45)"},children:[S.jsxs("label",{className:"flex items-center gap-1 cursor-pointer",children:[S.jsx("input",{type:"checkbox",checked:t.executesCode,onChange:h=>l("executesCode",h.target.checked)}),"executes code"]}),S.jsxs("label",{className:"flex items-center gap-1 cursor-pointer",children:[S.jsx("input",{type:"checkbox",checked:t.verifiedEvidence,onChange:h=>l("verifiedEvidence",h.target.checked)}),"verified evidence"]})]})]})}function tF({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,h]=ae.useState(null),[c,v]=ae.useState(!1),[d,x]=ae.useState(""),w=s.map(N=>N.id).filter(Boolean);function g(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)),v(!0)}catch(N){h(N instanceof Error?N.message:String(N))}}async function E(){if(!n.trim()){h("Workflow ID is required");return}if(s.length===0){h("At least one phase is required");return}l(!0),h(null);try{const N=await qb(n.trim(),s);await lt.createWorkflow(N),e(N)}catch(N){h(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}})),h(null)}catch{h("Could not parse workflow JSON")}},B.readAsText(M),N.target.value=""}return S.jsxs("div",{className:"flex flex-col gap-3 min-w-0",children:[S.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[S.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}),S.jsx("input",{ref:T,type:"file",accept:".json",className:"hidden",onChange:k}),S.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"}),S.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"}),S.jsx("button",{type:"button",onClick:r,className:"text-[11px] px-1 hover:underline",style:{color:"rgba(230,237,243,0.4)"},children:"Cancel"})]}),c&&S.jsxs("div",{className:"relative",children:[S.jsx("pre",{className:"rounded text-[10px] p-3 overflow-auto max-h-48 font-mono",style:{background:"#0d1117",color:"#3fb950"},children:d}),S.jsx("button",{type:"button",onClick:()=>v(!1),className:"absolute top-1 right-1 text-[10px]",style:{color:"rgba(230,237,243,0.4)"},children:"✕"})]}),S.jsx("div",{className:"flex flex-col gap-2",children:s.map((N,M)=>S.jsx(eF,{phase:N,index:M,total:s.length,allIds:w,onChange:B=>g(M,B),onRemove:()=>m(M),onMoveUp:()=>b(M),onMoveDown:()=>_(M)},N._key))}),S.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&&S.jsx("p",{className:"text-[11px]",style:{color:"#f85149"},children:u}),S.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 rF(){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),[h,c]=ae.useState(void 0),v=ae.useRef(null);v.current=r;const d=ae.useCallback(async()=>{var m;s(!0),a(null);try{const{workflows:y}=await lt.listWorkflows();e(y),y.length>0&&!v.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(()=>{d()},[d]);function x(m){c(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 g=t.find(m=>m.id===r)??null;return S.jsxs("div",{className:"flex flex-col gap-4",children:[S.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[S.jsx("h2",{className:"text-sm font-semibold flex-1",style:{color:"#e6edf3"},children:"Workflows"}),!l&&S.jsxs(S.Fragment,{children:[S.jsx("button",{type:"button",onClick:()=>x(),className:"rounded px-3 py-1 text-[11px] font-semibold",style:{background:"#3fb950",color:"#0d1117"},children:"New workflow"}),S.jsx("button",{type:"button",onClick:()=>void d(),className:"text-[10px] hover:underline",style:{color:"rgba(230,237,243,0.4)"},children:"Refresh"})]})]}),i&&S.jsx("p",{className:"text-xs",style:{color:"rgba(230,237,243,0.4)"},children:"Loading workflows…"}),o&&S.jsx("p",{className:"rounded px-2 py-1 text-xs",style:{background:"rgba(248,81,73,0.08)",color:"#f85149"},children:o}),S.jsxs("div",{className:"flex gap-4",children:[!l&&S.jsx("div",{className:"flex flex-col gap-1.5 w-40 shrink-0",children:t.map(m=>S.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:[S.jsx("div",{className:"font-semibold",children:m.id}),S.jsxs("div",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.35)"},children:[m.phases.length," phases"]})]},m.id))}),S.jsx("div",{className:"flex-1 min-w-0",children:l?S.jsx(tF,{...h!==void 0?{initial:h}:{},onSaved:w,onCancel:()=>u(!1)}):g?S.jsxs("div",{className:"flex flex-col gap-2",children:[S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider font-mono",style:{color:"rgba(230,237,243,0.4)"},children:g.id}),S.jsxs("span",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.35)"},children:["— ",g.phases.length," phases"]}),S.jsx("button",{type:"button",onClick:()=>x(g),className:"ml-auto text-[10px] hover:underline",style:{color:"#79c0ff"},children:"Edit"}),S.jsx("button",{type:"button",onClick:()=>x({...g,id:`${g.id}-copy`}),className:"text-[10px] hover:underline",style:{color:"rgba(230,237,243,0.4)"},children:"Duplicate"})]}),g.phases.map(m=>S.jsx(QB,{phase:m},m.id))]}):null})]}),!l&&S.jsxs("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.25)"},children:["Workflows saved to ",S.jsx("span",{style:{color:"rgba(230,237,243,0.4)"},children:"~/.wicked/workflows/"})," and registered immediately. Scripts saved to ",S.jsx("span",{style:{color:"rgba(230,237,243,0.4)"},children:"~/.wicked/scripts/"}),"."]})]})}const d2=t=>["completed","failed","cancelled"].includes(t),nv=t=>!d2(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 nF({runs:t,selectedRunId:e,onSelect:r,navigate:n}){const[i,s]=ae.useState(""),[o,a]=ae.useState("all"),l=ae.useRef([]),{range:u,setRange:h,filter:c}=Hv("30d"),v=ae.useMemo(()=>t.filter(E=>!!E.session.workflow_id&&E.session.workflow_id!=="chat"),[t]),d=ae.useMemo(()=>c(v),[v,c]),x=i.toLowerCase(),w=ae.useMemo(()=>i?d.filter(E=>E.session.problem.toLowerCase().includes(x)):d,[d,i,x]),g=ae.useMemo(()=>{const E=d.length,T=d.filter(D=>nv(D.session.status)).length,k=d.filter(D=>iv(D.session.status)).length,N=d.filter(D=>d2(D.session.status)).length,M=N>0?`${Math.round(k/N*100)}%`:"—",B=new Map;for(const D of d){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}},[d]),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 S.jsxs("div",{className:"flex flex-col h-full",style:{color:"#e6edf3"},children:[S.jsxs("div",{className:"px-8 pt-8 pb-4 flex items-center gap-4",children:[S.jsx("h1",{className:"text-xl font-semibold font-mono",children:"Work"}),S.jsx("div",{className:"flex-1"}),S.jsx(Uv,{value:u,onChange:h}),S.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"}}),S.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"})]}),S.jsx("div",{className:"px-8 pb-4 grid gap-3",style:{gridTemplateColumns:"repeat(4, 1fr)"},children:[{label:"Total Runs",value:String(g.total),accent:void 0},{label:"Active",value:String(g.active),accent:"#79c0ff"},{label:"Success Rate",value:g.successRate,accent:"#3fb950"},{label:"Top Workflow",value:g.topWorkflow,accent:void 0}].map(E=>S.jsxs("div",{className:"rounded-xl px-4 py-3",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.07)"},children:[S.jsx("p",{className:"text-[10px] font-mono uppercase tracking-widest",style:{color:"rgba(230,237,243,0.4)",margin:0},children:E.label}),S.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))}),S.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)=>S.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))}),S.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"?S.jsxs(S.Fragment,{children:[y.length>0&&S.jsxs(S.Fragment,{children:[S.jsx(av,{pulse:!0,children:"Active"}),y.map(E=>S.jsx($i,{view:E,selectedRunId:e,onSelect:r},E.session.id))]}),b.length>0&&S.jsxs(S.Fragment,{children:[S.jsx(av,{children:"Completed"}),b.map(E=>S.jsx($i,{view:E,selectedRunId:e,onSelect:r},E.session.id))]}),_.length>0&&S.jsxs(S.Fragment,{children:[S.jsx(av,{children:"Failed"}),_.map(E=>S.jsx($i,{view:E,selectedRunId:e,onSelect:r},E.session.id))]}),w.length===0&&S.jsx(Kb,{query:i})]}):S.jsx(S.Fragment,{children:R.length===0?S.jsx(Kb,{query:i,tab:o}):R.map(E=>S.jsx($i,{view:E,selectedRunId:e,onSelect:r},E.session.id))})})]})}function av({children:t,pulse:e}){return S.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&&S.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 S.jsx("p",{className:"px-3 py-6 text-sm font-mono italic",style:{color:"rgba(230,237,243,0.35)"},children:r})}const p2="wicked_default_clis";function iF({label:t,description:e,children:r}){return S.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:[S.jsxs("div",{className:"flex-1 min-w-0",children:[S.jsx("p",{className:"text-sm font-medium",style:{color:"#e6edf3"},children:t}),S.jsx("p",{className:"text-xs mt-0.5",style:{color:"rgba(230,237,243,0.45)"},children:e})]}),S.jsx("div",{className:"shrink-0",children:r})]})}function aF(t){try{const e=localStorage.getItem(p2);if(e)return new Set(JSON.parse(e))}catch{}return new Set(t.filter(e=>e.enabled_for_council).map(e=>e.key))}function sF(){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),h=ae.useRef(null),[c,v]=ae.useState([]),[d,x]=ae.useState(new Set),[w,g]=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})=>{v(k),x(aF(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(p2,JSON.stringify([...d]))}catch(k){u(String(k));return}g(!0),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>g(!1),2500)}ae.useEffect(()=>()=>{h.current&&clearTimeout(h.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),h.current&&clearTimeout(h.current),h.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 S.jsxs("div",{className:"max-w-2xl mx-auto",children:[S.jsxs("div",{className:"mb-6",children:[S.jsx("h1",{className:"text-lg font-semibold",style:{color:"#e6edf3"},children:"System"}),S.jsxs("p",{className:"text-sm mt-1",style:{color:"rgba(230,237,243,0.45)"},children:["Runtime tunables persisted to"," ",S.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&&S.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}),S.jsxs("section",{className:"rounded-xl px-5 mb-6",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.07)"},children:[S.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"}),S.jsx(iF,{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:S.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"}})})]}),S.jsxs("div",{className:"flex items-center gap-3 mb-8",children:[S.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&&S.jsx("span",{className:"text-xs font-medium",style:{color:"#3fb950"},children:"Saved"})]}),S.jsxs("section",{className:"rounded-xl px-5 mb-6",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.07)"},children:[S.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"}),S.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."}),c.length===0?S.jsx("p",{className:"text-xs italic pb-4 font-mono",style:{color:"rgba(230,237,243,0.3)"},children:"Loading roster…"}):S.jsx("div",{className:"flex flex-col gap-2 pb-4",children:c.map(k=>S.jsxs("label",{className:"flex items-center gap-3 cursor-pointer group",children:[S.jsx("input",{type:"checkbox",checked:d.has(k.key),onChange:()=>y(k.key),className:"accent-[#ffda19] w-3.5 h-3.5 shrink-0"}),S.jsx("span",{className:"text-sm font-mono flex-1",style:{color:"#e6edf3"},children:k.display_name}),S.jsx("span",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.3)"},children:k.key})]},k.key))}),c.length>0&&S.jsxs("div",{className:"flex items-center gap-3 pb-4 pt-2 border-t",style:{borderColor:"rgba(230,237,243,0.07)"},children:[S.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&&S.jsx("span",{className:"text-xs font-medium",style:{color:"#3fb950"},children:"Saved"})]})]})]})}function oF(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 lF=["runs","coverage","workflows","domain","policies","rules","repos","system","chats","work","repo-detail"];function Qb(t){try{return decodeURIComponent(t)}catch{return t}}function uF(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}:lF.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 cF(){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{...uF(t),navigate:r,panelPath:n}}function hF(){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 h;try{({runs:h}=await lt.listRuns())}catch{return}if(u)return;i(h);const c=h.filter(v=>v.session.status==="awaiting_human").map(v=>v.session.id);r(c);for(const v of c)if(!Jn.getState().gates[v])try{const d=await lt.getGate(v);if(u)return;e({runId:d.runId,ord:d.ord,prompt:d.prompt,lifecycle:d.lifecycle,receivedAt:Date.parse(d.receivedAt)||Date.now()})}catch{}})(),()=>{u=!0}},[t,s,e,r]),{runs:n,refresh:l}}const fF=new Set(["sessionStarted","unitPlanned","unitDistributed","unitExecuting","gateDecided","unitDone","unitDenied","awaitingHuman","resumed","runCancelled","sessionFailed","sessionCompleted"]);function dF(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 h=e.find(v=>v.session.id===t);if(!h)return;["completed","cancelled","failed"].includes(h.session.status)||(i.preventDefault(),r(t))}}return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t,e,r])}function pF(){const{panel:t,runId:e,repoId:r,showLaunch:n,showRegisterRepo:i,chatMode:s,navigate:o}=cF(),{runs:a,refresh:l}=hF(),u=Jn(N=>N.ingest),h=oc(N=>N.ingest),c=Pa(N=>N.ingest),v=Sc(N=>N.ingest),d=ae.useCallback(()=>{l()},[l]),x=ae.useCallback(()=>{l()},[l]),w=ae.useCallback(N=>{u(N),h(N),c(N),v(N),fF.has(N.type)&&l()},[u,h,c,v,l]);oF(w);const g=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]);dF(e,a,b);const _=a.find(N=>N.session.id===e)??null,[R,E]=ae.useState(null),T=ae.useCallback(()=>{r&<.listRepos().then(({repos:N})=>{const M=N.find(B=>B.id===r);M&&E(M)})},[r]);function k(){return t==="coverage"?S.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:S.jsx(iw,{})}):t==="workflows"?S.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:S.jsx(rF,{})}):t==="domain"?S.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:S.jsx(IE,{})}):t==="policies"?S.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:S.jsx(rk,{})}):t==="rules"?S.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:S.jsx($A,{})}):t==="repos"?S.jsx("div",{className:"flex-1 overflow-hidden",children:S.jsx(ak,{onSelectRun:g,autoShowRegister:i,navigate:o})}):t==="repo-detail"&&r?S.jsx("div",{className:"flex-1 overflow-y-auto",children:S.jsx(ok,{repoId:r,onSelectRun:g,navigate:o,onOpenGraph:T})}):t==="chats"?S.jsx("div",{className:"flex-1 overflow-y-auto",children:S.jsx(TE,{runs:a,onSelect:g,navigate:o})}):t==="work"?S.jsx("div",{className:"flex-1 overflow-y-auto",children:S.jsx(nF,{runs:a,selectedRunId:e,onSelect:g,navigate:o})}):t==="system"?S.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:S.jsx(sF,{})}):t==="runs"&&!e&&!_&&!n?S.jsx("div",{className:"flex-1 overflow-y-auto",children:S.jsx(EE,{runs:a,onSelectRun:g,onApproveGate:d,onRejectGate:x,navigate:o})}):S.jsx("div",{className:"flex-1 overflow-hidden",children:S.jsx(YB,{view:_,chatMode:s,onLaunched:m,onNavigateBack:y,onRefresh:l,onKill:b})})}return S.jsxs("div",{className:"flex h-screen overflow-hidden bg-wk-canvas",children:[S.jsx(KE,{runs:a,selectedRunId:e,onSelectRun:g,navigate:o}),S.jsx("div",{className:"flex flex-1 overflow-hidden",children:k()}),_!==null&&S.jsx(UA,{view:_}),S.jsx(OE,{onSelect:g}),R!==null&&S.jsx(hA,{repo:R,onClose:()=>E(null),onSelectRun:g})]})}class vF 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:S.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:[S.jsx("p",{className:"text-sm font-semibold",style:{color:"#f85149"},children:"Something went wrong"}),S.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."}),S.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 v2=document.getElementById("root");if(!v2)throw new Error("Root element not found");oE.createRoot(v2).render(S.jsx(ae.StrictMode,{children:S.jsx(vF,{children:S.jsx(pF,{})})}));
|