wicked-studio 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,428 @@
|
|
|
1
|
+
var B3=Object.defineProperty;var F3=(t,e,r)=>e in t?B3(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Cc=(t,e,r)=>F3(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 a of i)if(a.type==="childList")for(const s of a.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&n(s)}).observe(document,{childList:!0,subtree:!0});function r(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function n(i){if(i.ep)return;i.ep=!0;const a=r(i);fetch(i.href,a)}})();function $d(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Qf={exports:{}},fl={},Zf={exports:{}},Ct={};/**
|
|
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 jx;function z3(){if(jx)return Ct;jx=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"),a=Symbol.for("react.provider"),s=Symbol.for("react.context"),o=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),u=Symbol.for("react.memo"),c=Symbol.for("react.lazy"),d=Symbol.iterator;function p(H){return H===null||typeof H!="object"?null:(H=d&&H[d]||H["@@iterator"],typeof H=="function"?H:null)}var f={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,S={};function v(H,W,V){this.props=H,this.context=W,this.refs=S,this.updater=V||f}v.prototype.isReactComponent={},v.prototype.setState=function(H,W){if(typeof H!="object"&&typeof H!="function"&&H!=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,H,W,"setState")},v.prototype.forceUpdate=function(H){this.updater.enqueueForceUpdate(this,H,"forceUpdate")};function m(){}m.prototype=v.prototype;function b(H,W,V){this.props=H,this.context=W,this.refs=S,this.updater=V||f}var w=b.prototype=new m;w.constructor=b,x(w,v.prototype),w.isPureReactComponent=!0;var _=Array.isArray,T=Object.prototype.hasOwnProperty,N={current:null},E={key:!0,ref:!0,__self:!0,__source:!0};function k(H,W,V){var re,J={},ne=null,X=null;if(W!=null)for(re in W.ref!==void 0&&(X=W.ref),W.key!==void 0&&(ne=""+W.key),W)T.call(W,re)&&!E.hasOwnProperty(re)&&(J[re]=W[re]);var q=arguments.length-2;if(q===1)J.children=V;else if(1<q){for(var Y=Array(q),Q=0;Q<q;Q++)Y[Q]=arguments[Q+2];J.children=Y}if(H&&H.defaultProps)for(re in q=H.defaultProps,q)J[re]===void 0&&(J[re]=q[re]);return{$$typeof:t,type:H,key:ne,ref:X,props:J,_owner:N.current}}function L(H,W){return{$$typeof:t,type:H.type,key:W,ref:H.ref,props:H.props,_owner:H._owner}}function A(H){return typeof H=="object"&&H!==null&&H.$$typeof===t}function M(H){var W={"=":"=0",":":"=2"};return"$"+H.replace(/[=:]/g,function(V){return W[V]})}var O=/\/+/g;function $(H,W){return typeof H=="object"&&H!==null&&H.key!=null?M(""+H.key):W.toString(36)}function D(H,W,V,re,J){var ne=typeof H;(ne==="undefined"||ne==="boolean")&&(H=null);var X=!1;if(H===null)X=!0;else switch(ne){case"string":case"number":X=!0;break;case"object":switch(H.$$typeof){case t:case e:X=!0}}if(X)return X=H,J=J(X),H=re===""?"."+$(X,0):re,_(J)?(V="",H!=null&&(V=H.replace(O,"$&/")+"/"),D(J,W,V,"",function(Q){return Q})):J!=null&&(A(J)&&(J=L(J,V+(!J.key||X&&X.key===J.key?"":(""+J.key).replace(O,"$&/")+"/")+H)),W.push(J)),1;if(X=0,re=re===""?".":re+":",_(H))for(var q=0;q<H.length;q++){ne=H[q];var Y=re+$(ne,q);X+=D(ne,W,V,Y,J)}else if(Y=p(H),typeof Y=="function")for(H=Y.call(H),q=0;!(ne=H.next()).done;)ne=ne.value,Y=re+$(ne,q++),X+=D(ne,W,V,Y,J);else if(ne==="object")throw W=String(H),Error("Objects are not valid as a React child (found: "+(W==="[object Object]"?"object with keys {"+Object.keys(H).join(", ")+"}":W)+"). If you meant to render a collection of children, use an array instead.");return X}function B(H,W,V){if(H==null)return H;var re=[],J=0;return D(H,re,"","",function(ne){return W.call(V,ne,J++)}),re}function j(H){if(H._status===-1){var W=H._result;W=W(),W.then(function(V){(H._status===0||H._status===-1)&&(H._status=1,H._result=V)},function(V){(H._status===0||H._status===-1)&&(H._status=2,H._result=V)}),H._status===-1&&(H._status=0,H._result=W)}if(H._status===1)return H._result.default;throw H._result}var I={current:null},U={transition:null},F={ReactCurrentDispatcher:I,ReactCurrentBatchConfig:U,ReactCurrentOwner:N};function P(){throw Error("act(...) is not supported in production builds of React.")}return Ct.Children={map:B,forEach:function(H,W,V){B(H,function(){W.apply(this,arguments)},V)},count:function(H){var W=0;return B(H,function(){W++}),W},toArray:function(H){return B(H,function(W){return W})||[]},only:function(H){if(!A(H))throw Error("React.Children.only expected to receive a single React element child.");return H}},Ct.Component=v,Ct.Fragment=r,Ct.Profiler=i,Ct.PureComponent=b,Ct.StrictMode=n,Ct.Suspense=l,Ct.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=F,Ct.act=P,Ct.cloneElement=function(H,W,V){if(H==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+H+".");var re=x({},H.props),J=H.key,ne=H.ref,X=H._owner;if(W!=null){if(W.ref!==void 0&&(ne=W.ref,X=N.current),W.key!==void 0&&(J=""+W.key),H.type&&H.type.defaultProps)var q=H.type.defaultProps;for(Y in W)T.call(W,Y)&&!E.hasOwnProperty(Y)&&(re[Y]=W[Y]===void 0&&q!==void 0?q[Y]:W[Y])}var Y=arguments.length-2;if(Y===1)re.children=V;else if(1<Y){q=Array(Y);for(var Q=0;Q<Y;Q++)q[Q]=arguments[Q+2];re.children=q}return{$$typeof:t,type:H.type,key:J,ref:ne,props:re,_owner:X}},Ct.createContext=function(H){return H={$$typeof:s,_currentValue:H,_currentValue2:H,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},H.Provider={$$typeof:a,_context:H},H.Consumer=H},Ct.createElement=k,Ct.createFactory=function(H){var W=k.bind(null,H);return W.type=H,W},Ct.createRef=function(){return{current:null}},Ct.forwardRef=function(H){return{$$typeof:o,render:H}},Ct.isValidElement=A,Ct.lazy=function(H){return{$$typeof:c,_payload:{_status:-1,_result:H},_init:j}},Ct.memo=function(H,W){return{$$typeof:u,type:H,compare:W===void 0?null:W}},Ct.startTransition=function(H){var W=U.transition;U.transition={};try{H()}finally{U.transition=W}},Ct.unstable_act=P,Ct.useCallback=function(H,W){return I.current.useCallback(H,W)},Ct.useContext=function(H){return I.current.useContext(H)},Ct.useDebugValue=function(){},Ct.useDeferredValue=function(H){return I.current.useDeferredValue(H)},Ct.useEffect=function(H,W){return I.current.useEffect(H,W)},Ct.useId=function(){return I.current.useId()},Ct.useImperativeHandle=function(H,W,V){return I.current.useImperativeHandle(H,W,V)},Ct.useInsertionEffect=function(H,W){return I.current.useInsertionEffect(H,W)},Ct.useLayoutEffect=function(H,W){return I.current.useLayoutEffect(H,W)},Ct.useMemo=function(H,W){return I.current.useMemo(H,W)},Ct.useReducer=function(H,W,V){return I.current.useReducer(H,W,V)},Ct.useRef=function(H){return I.current.useRef(H)},Ct.useState=function(H){return I.current.useState(H)},Ct.useSyncExternalStore=function(H,W,V){return I.current.useSyncExternalStore(H,W,V)},Ct.useTransition=function(){return I.current.useTransition()},Ct.version="18.3.1",Ct}var Ix;function lm(){return Ix||(Ix=1,Zf.exports=z3()),Zf.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 Bx;function $3(){if(Bx)return fl;Bx=1;var t=lm(),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,a={key:!0,ref:!0,__self:!0,__source:!0};function s(o,l,u){var c,d={},p=null,f=null;u!==void 0&&(p=""+u),l.key!==void 0&&(p=""+l.key),l.ref!==void 0&&(f=l.ref);for(c in l)n.call(l,c)&&!a.hasOwnProperty(c)&&(d[c]=l[c]);if(o&&o.defaultProps)for(c in l=o.defaultProps,l)d[c]===void 0&&(d[c]=l[c]);return{$$typeof:e,type:o,key:p,ref:f,props:d,_owner:i.current}}return fl.Fragment=r,fl.jsx=s,fl.jsxs=s,fl}var Fx;function H3(){return Fx||(Fx=1,Qf.exports=$3()),Qf.exports}var y=H3(),K=lm();const kc=$d(K);var Ec={},Jf={exports:{}},fn={},ep={exports:{}},tp={};/**
|
|
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 zx;function U3(){return zx||(zx=1,(function(t){function e(U,F){var P=U.length;U.push(F);e:for(;0<P;){var H=P-1>>>1,W=U[H];if(0<i(W,F))U[H]=F,U[P]=W,P=H;else break e}}function r(U){return U.length===0?null:U[0]}function n(U){if(U.length===0)return null;var F=U[0],P=U.pop();if(P!==F){U[0]=P;e:for(var H=0,W=U.length,V=W>>>1;H<V;){var re=2*(H+1)-1,J=U[re],ne=re+1,X=U[ne];if(0>i(J,P))ne<W&&0>i(X,J)?(U[H]=X,U[ne]=P,H=ne):(U[H]=J,U[re]=P,H=re);else if(ne<W&&0>i(X,P))U[H]=X,U[ne]=P,H=ne;else break e}}return F}function i(U,F){var P=U.sortIndex-F.sortIndex;return P!==0?P:U.id-F.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;t.unstable_now=function(){return a.now()}}else{var s=Date,o=s.now();t.unstable_now=function(){return s.now()-o}}var l=[],u=[],c=1,d=null,p=3,f=!1,x=!1,S=!1,v=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(U){for(var F=r(u);F!==null;){if(F.callback===null)n(u);else if(F.startTime<=U)n(u),F.sortIndex=F.expirationTime,e(l,F);else break;F=r(u)}}function _(U){if(S=!1,w(U),!x)if(r(l)!==null)x=!0,j(T);else{var F=r(u);F!==null&&I(_,F.startTime-U)}}function T(U,F){x=!1,S&&(S=!1,m(k),k=-1),f=!0;var P=p;try{for(w(F),d=r(l);d!==null&&(!(d.expirationTime>F)||U&&!M());){var H=d.callback;if(typeof H=="function"){d.callback=null,p=d.priorityLevel;var W=H(d.expirationTime<=F);F=t.unstable_now(),typeof W=="function"?d.callback=W:d===r(l)&&n(l),w(F)}else n(l);d=r(l)}if(d!==null)var V=!0;else{var re=r(u);re!==null&&I(_,re.startTime-F),V=!1}return V}finally{d=null,p=P,f=!1}}var N=!1,E=null,k=-1,L=5,A=-1;function M(){return!(t.unstable_now()-A<L)}function O(){if(E!==null){var U=t.unstable_now();A=U;var F=!0;try{F=E(!0,U)}finally{F?$():(N=!1,E=null)}}else N=!1}var $;if(typeof b=="function")$=function(){b(O)};else if(typeof MessageChannel<"u"){var D=new MessageChannel,B=D.port2;D.port1.onmessage=O,$=function(){B.postMessage(null)}}else $=function(){v(O,0)};function j(U){E=U,N||(N=!0,$())}function I(U,F){k=v(function(){U(t.unstable_now())},F)}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(U){U.callback=null},t.unstable_continueExecution=function(){x||f||(x=!0,j(T))},t.unstable_forceFrameRate=function(U){0>U||125<U?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):L=0<U?Math.floor(1e3/U):5},t.unstable_getCurrentPriorityLevel=function(){return p},t.unstable_getFirstCallbackNode=function(){return r(l)},t.unstable_next=function(U){switch(p){case 1:case 2:case 3:var F=3;break;default:F=p}var P=p;p=F;try{return U()}finally{p=P}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(U,F){switch(U){case 1:case 2:case 3:case 4:case 5:break;default:U=3}var P=p;p=U;try{return F()}finally{p=P}},t.unstable_scheduleCallback=function(U,F,P){var H=t.unstable_now();switch(typeof P=="object"&&P!==null?(P=P.delay,P=typeof P=="number"&&0<P?H+P:H):P=H,U){case 1:var W=-1;break;case 2:W=250;break;case 5:W=1073741823;break;case 4:W=1e4;break;default:W=5e3}return W=P+W,U={id:c++,callback:F,priorityLevel:U,startTime:P,expirationTime:W,sortIndex:-1},P>H?(U.sortIndex=P,e(u,U),r(l)===null&&U===r(u)&&(S?(m(k),k=-1):S=!0,I(_,P-H))):(U.sortIndex=W,e(l,U),x||f||(x=!0,j(T))),U},t.unstable_shouldYield=M,t.unstable_wrapCallback=function(U){var F=p;return function(){var P=p;p=F;try{return U.apply(this,arguments)}finally{p=P}}}})(tp)),tp}var $x;function W3(){return $x||($x=1,ep.exports=U3()),ep.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 Hx;function V3(){if(Hx)return fn;Hx=1;var t=lm(),e=W3();function r(h){for(var g="https://reactjs.org/docs/error-decoder.html?invariant="+h,C=1;C<arguments.length;C++)g+="&args[]="+encodeURIComponent(arguments[C]);return"Minified React error #"+h+"; visit "+g+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var n=new Set,i={};function a(h,g){s(h,g),s(h+"Capture",g)}function s(h,g){for(i[h]=g,h=0;h<g.length;h++)n.add(g[h])}var o=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),l=Object.prototype.hasOwnProperty,u=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,c={},d={};function p(h){return l.call(d,h)?!0:l.call(c,h)?!1:u.test(h)?d[h]=!0:(c[h]=!0,!1)}function f(h,g,C,R){if(C!==null&&C.type===0)return!1;switch(typeof g){case"function":case"symbol":return!0;case"boolean":return R?!1:C!==null?!C.acceptsBooleans:(h=h.toLowerCase().slice(0,5),h!=="data-"&&h!=="aria-");default:return!1}}function x(h,g,C,R){if(g===null||typeof g>"u"||f(h,g,C,R))return!0;if(R)return!1;if(C!==null)switch(C.type){case 3:return!g;case 4:return g===!1;case 5:return isNaN(g);case 6:return isNaN(g)||1>g}return!1}function S(h,g,C,R,z,G,Z){this.acceptsBooleans=g===2||g===3||g===4,this.attributeName=R,this.attributeNamespace=z,this.mustUseProperty=C,this.propertyName=h,this.type=g,this.sanitizeURL=G,this.removeEmptyString=Z}var v={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(h){v[h]=new S(h,0,!1,h,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(h){var g=h[0];v[g]=new S(g,1,!1,h[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(h){v[h]=new S(h,2,!1,h.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(h){v[h]=new S(h,2,!1,h,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(h){v[h]=new S(h,3,!1,h.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(h){v[h]=new S(h,3,!0,h,null,!1,!1)}),["capture","download"].forEach(function(h){v[h]=new S(h,4,!1,h,null,!1,!1)}),["cols","rows","size","span"].forEach(function(h){v[h]=new S(h,6,!1,h,null,!1,!1)}),["rowSpan","start"].forEach(function(h){v[h]=new S(h,5,!1,h.toLowerCase(),null,!1,!1)});var m=/[\-:]([a-z])/g;function b(h){return h[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(h){var g=h.replace(m,b);v[g]=new S(g,1,!1,h,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(h){var g=h.replace(m,b);v[g]=new S(g,1,!1,h,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(h){var g=h.replace(m,b);v[g]=new S(g,1,!1,h,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(h){v[h]=new S(h,1,!1,h.toLowerCase(),null,!1,!1)}),v.xlinkHref=new S("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(h){v[h]=new S(h,1,!1,h.toLowerCase(),null,!0,!0)});function w(h,g,C,R){var z=v.hasOwnProperty(g)?v[g]:null;(z!==null?z.type!==0:R||!(2<g.length)||g[0]!=="o"&&g[0]!=="O"||g[1]!=="n"&&g[1]!=="N")&&(x(g,C,z,R)&&(C=null),R||z===null?p(g)&&(C===null?h.removeAttribute(g):h.setAttribute(g,""+C)):z.mustUseProperty?h[z.propertyName]=C===null?z.type===3?!1:"":C:(g=z.attributeName,R=z.attributeNamespace,C===null?h.removeAttribute(g):(z=z.type,C=z===3||z===4&&C===!0?"":""+C,R?h.setAttributeNS(R,g,C):h.setAttribute(g,C))))}var _=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,T=Symbol.for("react.element"),N=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),L=Symbol.for("react.profiler"),A=Symbol.for("react.provider"),M=Symbol.for("react.context"),O=Symbol.for("react.forward_ref"),$=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),B=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),I=Symbol.for("react.offscreen"),U=Symbol.iterator;function F(h){return h===null||typeof h!="object"?null:(h=U&&h[U]||h["@@iterator"],typeof h=="function"?h:null)}var P=Object.assign,H;function W(h){if(H===void 0)try{throw Error()}catch(C){var g=C.stack.trim().match(/\n( *(at )?)/);H=g&&g[1]||""}return`
|
|
34
|
+
`+H+h}var V=!1;function re(h,g){if(!h||V)return"";V=!0;var C=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(g)if(g=function(){throw Error()},Object.defineProperty(g.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(g,[])}catch(_e){var R=_e}Reflect.construct(h,[],g)}else{try{g.call()}catch(_e){R=_e}h.call(g.prototype)}else{try{throw Error()}catch(_e){R=_e}h()}}catch(_e){if(_e&&R&&typeof _e.stack=="string"){for(var z=_e.stack.split(`
|
|
35
|
+
`),G=R.stack.split(`
|
|
36
|
+
`),Z=z.length-1,oe=G.length-1;1<=Z&&0<=oe&&z[Z]!==G[oe];)oe--;for(;1<=Z&&0<=oe;Z--,oe--)if(z[Z]!==G[oe]){if(Z!==1||oe!==1)do if(Z--,oe--,0>oe||z[Z]!==G[oe]){var fe=`
|
|
37
|
+
`+z[Z].replace(" at new "," at ");return h.displayName&&fe.includes("<anonymous>")&&(fe=fe.replace("<anonymous>",h.displayName)),fe}while(1<=Z&&0<=oe);break}}}finally{V=!1,Error.prepareStackTrace=C}return(h=h?h.displayName||h.name:"")?W(h):""}function J(h){switch(h.tag){case 5:return W(h.type);case 16:return W("Lazy");case 13:return W("Suspense");case 19:return W("SuspenseList");case 0:case 2:case 15:return h=re(h.type,!1),h;case 11:return h=re(h.type.render,!1),h;case 1:return h=re(h.type,!0),h;default:return""}}function ne(h){if(h==null)return null;if(typeof h=="function")return h.displayName||h.name||null;if(typeof h=="string")return h;switch(h){case E:return"Fragment";case N:return"Portal";case L:return"Profiler";case k:return"StrictMode";case $:return"Suspense";case D:return"SuspenseList"}if(typeof h=="object")switch(h.$$typeof){case M:return(h.displayName||"Context")+".Consumer";case A:return(h._context.displayName||"Context")+".Provider";case O:var g=h.render;return h=h.displayName,h||(h=g.displayName||g.name||"",h=h!==""?"ForwardRef("+h+")":"ForwardRef"),h;case B:return g=h.displayName||null,g!==null?g:ne(h.type)||"Memo";case j:g=h._payload,h=h._init;try{return ne(h(g))}catch{}}return null}function X(h){var g=h.type;switch(h.tag){case 24:return"Cache";case 9:return(g.displayName||"Context")+".Consumer";case 10:return(g._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return h=g.render,h=h.displayName||h.name||"",g.displayName||(h!==""?"ForwardRef("+h+")":"ForwardRef");case 7:return"Fragment";case 5:return g;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ne(g);case 8:return g===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 g=="function")return g.displayName||g.name||null;if(typeof g=="string")return g}return null}function q(h){switch(typeof h){case"boolean":case"number":case"string":case"undefined":return h;case"object":return h;default:return""}}function Y(h){var g=h.type;return(h=h.nodeName)&&h.toLowerCase()==="input"&&(g==="checkbox"||g==="radio")}function Q(h){var g=Y(h)?"checked":"value",C=Object.getOwnPropertyDescriptor(h.constructor.prototype,g),R=""+h[g];if(!h.hasOwnProperty(g)&&typeof C<"u"&&typeof C.get=="function"&&typeof C.set=="function"){var z=C.get,G=C.set;return Object.defineProperty(h,g,{configurable:!0,get:function(){return z.call(this)},set:function(Z){R=""+Z,G.call(this,Z)}}),Object.defineProperty(h,g,{enumerable:C.enumerable}),{getValue:function(){return R},setValue:function(Z){R=""+Z},stopTracking:function(){h._valueTracker=null,delete h[g]}}}}function te(h){h._valueTracker||(h._valueTracker=Q(h))}function ie(h){if(!h)return!1;var g=h._valueTracker;if(!g)return!0;var C=g.getValue(),R="";return h&&(R=Y(h)?h.checked?"true":"false":h.value),h=R,h!==C?(g.setValue(h),!0):!1}function le(h){if(h=h||(typeof document<"u"?document:void 0),typeof h>"u")return null;try{return h.activeElement||h.body}catch{return h.body}}function pe(h,g){var C=g.checked;return P({},g,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:C??h._wrapperState.initialChecked})}function Le(h,g){var C=g.defaultValue==null?"":g.defaultValue,R=g.checked!=null?g.checked:g.defaultChecked;C=q(g.value!=null?g.value:C),h._wrapperState={initialChecked:R,initialValue:C,controlled:g.type==="checkbox"||g.type==="radio"?g.checked!=null:g.value!=null}}function je(h,g){g=g.checked,g!=null&&w(h,"checked",g,!1)}function Se(h,g){je(h,g);var C=q(g.value),R=g.type;if(C!=null)R==="number"?(C===0&&h.value===""||h.value!=C)&&(h.value=""+C):h.value!==""+C&&(h.value=""+C);else if(R==="submit"||R==="reset"){h.removeAttribute("value");return}g.hasOwnProperty("value")?Ae(h,g.type,C):g.hasOwnProperty("defaultValue")&&Ae(h,g.type,q(g.defaultValue)),g.checked==null&&g.defaultChecked!=null&&(h.defaultChecked=!!g.defaultChecked)}function Te(h,g,C){if(g.hasOwnProperty("value")||g.hasOwnProperty("defaultValue")){var R=g.type;if(!(R!=="submit"&&R!=="reset"||g.value!==void 0&&g.value!==null))return;g=""+h._wrapperState.initialValue,C||g===h.value||(h.value=g),h.defaultValue=g}C=h.name,C!==""&&(h.name=""),h.defaultChecked=!!h._wrapperState.initialChecked,C!==""&&(h.name=C)}function Ae(h,g,C){(g!=="number"||le(h.ownerDocument)!==h)&&(C==null?h.defaultValue=""+h._wrapperState.initialValue:h.defaultValue!==""+C&&(h.defaultValue=""+C))}var Ne=Array.isArray;function Pe(h,g,C,R){if(h=h.options,g){g={};for(var z=0;z<C.length;z++)g["$"+C[z]]=!0;for(C=0;C<h.length;C++)z=g.hasOwnProperty("$"+h[C].value),h[C].selected!==z&&(h[C].selected=z),z&&R&&(h[C].defaultSelected=!0)}else{for(C=""+q(C),g=null,z=0;z<h.length;z++){if(h[z].value===C){h[z].selected=!0,R&&(h[z].defaultSelected=!0);return}g!==null||h[z].disabled||(g=h[z])}g!==null&&(g.selected=!0)}}function ze(h,g){if(g.dangerouslySetInnerHTML!=null)throw Error(r(91));return P({},g,{value:void 0,defaultValue:void 0,children:""+h._wrapperState.initialValue})}function Ie(h,g){var C=g.value;if(C==null){if(C=g.children,g=g.defaultValue,C!=null){if(g!=null)throw Error(r(92));if(Ne(C)){if(1<C.length)throw Error(r(93));C=C[0]}g=C}g==null&&(g=""),C=g}h._wrapperState={initialValue:q(C)}}function $e(h,g){var C=q(g.value),R=q(g.defaultValue);C!=null&&(C=""+C,C!==h.value&&(h.value=C),g.defaultValue==null&&h.defaultValue!==C&&(h.defaultValue=C)),R!=null&&(h.defaultValue=""+R)}function Ge(h){var g=h.textContent;g===h._wrapperState.initialValue&&g!==""&&g!==null&&(h.value=g)}function ve(h){switch(h){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 Ee(h,g){return h==null||h==="http://www.w3.org/1999/xhtml"?ve(g):h==="http://www.w3.org/2000/svg"&&g==="foreignObject"?"http://www.w3.org/1999/xhtml":h}var Me,ye=(function(h){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(g,C,R,z){MSApp.execUnsafeLocalFunction(function(){return h(g,C,R,z)})}:h})(function(h,g){if(h.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in h)h.innerHTML=g;else{for(Me=Me||document.createElement("div"),Me.innerHTML="<svg>"+g.valueOf().toString()+"</svg>",g=Me.firstChild;h.firstChild;)h.removeChild(h.firstChild);for(;g.firstChild;)h.appendChild(g.firstChild)}});function ee(h,g){if(g){var C=h.firstChild;if(C&&C===h.lastChild&&C.nodeType===3){C.nodeValue=g;return}}h.textContent=g}var ue={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},ae=["Webkit","ms","Moz","O"];Object.keys(ue).forEach(function(h){ae.forEach(function(g){g=g+h.charAt(0).toUpperCase()+h.substring(1),ue[g]=ue[h]})});function se(h,g,C){return g==null||typeof g=="boolean"||g===""?"":C||typeof g!="number"||g===0||ue.hasOwnProperty(h)&&ue[h]?(""+g).trim():g+"px"}function ce(h,g){h=h.style;for(var C in g)if(g.hasOwnProperty(C)){var R=C.indexOf("--")===0,z=se(C,g[C],R);C==="float"&&(C="cssFloat"),R?h.setProperty(C,z):h[C]=z}}var be=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(h,g){if(g){if(be[h]&&(g.children!=null||g.dangerouslySetInnerHTML!=null))throw Error(r(137,h));if(g.dangerouslySetInnerHTML!=null){if(g.children!=null)throw Error(r(60));if(typeof g.dangerouslySetInnerHTML!="object"||!("__html"in g.dangerouslySetInnerHTML))throw Error(r(61))}if(g.style!=null&&typeof g.style!="object")throw Error(r(62))}}function de(h,g){if(h.indexOf("-")===-1)return typeof g.is=="string";switch(h){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 me=null;function ke(h){return h=h.target||h.srcElement||window,h.correspondingUseElement&&(h=h.correspondingUseElement),h.nodeType===3?h.parentNode:h}var Re=null,Ce=null,De=null;function Qe(h){if(h=Zo(h)){if(typeof Re!="function")throw Error(r(280));var g=h.stateNode;g&&(g=Fu(g),Re(h.stateNode,h.type,g))}}function Xe(h){Ce?De?De.push(h):De=[h]:Ce=h}function yt(){if(Ce){var h=Ce,g=De;if(De=Ce=null,Qe(h),g)for(h=0;h<g.length;h++)Qe(g[h])}}function et(h,g){return h(g)}function Ze(){}var ct=!1;function tt(h,g,C){if(ct)return h(g,C);ct=!0;try{return et(h,g,C)}finally{ct=!1,(Ce!==null||De!==null)&&(Ze(),yt())}}function Ye(h,g){var C=h.stateNode;if(C===null)return null;var R=Fu(C);if(R===null)return null;C=R[g];e:switch(g){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(R=!R.disabled)||(h=h.type,R=!(h==="button"||h==="input"||h==="select"||h==="textarea")),h=!R;break e;default:h=!1}if(h)return null;if(C&&typeof C!="function")throw Error(r(231,g,typeof C));return C}var kt=!1;if(o)try{var ft={};Object.defineProperty(ft,"passive",{get:function(){kt=!0}}),window.addEventListener("test",ft,ft),window.removeEventListener("test",ft,ft)}catch{kt=!1}function ut(h,g,C,R,z,G,Z,oe,fe){var _e=Array.prototype.slice.call(arguments,3);try{g.apply(C,_e)}catch(Fe){this.onError(Fe)}}var Ft=!1,Tt=null,Vt=!1,jt=null,vr={onError:function(h){Ft=!0,Tt=h}};function or(h,g,C,R,z,G,Z,oe,fe){Ft=!1,Tt=null,ut.apply(vr,arguments)}function ir(h,g,C,R,z,G,Z,oe,fe){if(or.apply(this,arguments),Ft){if(Ft){var _e=Tt;Ft=!1,Tt=null}else throw Error(r(198));Vt||(Vt=!0,jt=_e)}}function zt(h){var g=h,C=h;if(h.alternate)for(;g.return;)g=g.return;else{h=g;do g=h,(g.flags&4098)!==0&&(C=g.return),h=g.return;while(h)}return g.tag===3?C:null}function Qr(h){if(h.tag===13){var g=h.memoizedState;if(g===null&&(h=h.alternate,h!==null&&(g=h.memoizedState)),g!==null)return g.dehydrated}return null}function dr(h){if(zt(h)!==h)throw Error(r(188))}function Dn(h){var g=h.alternate;if(!g){if(g=zt(h),g===null)throw Error(r(188));return g!==h?null:h}for(var C=h,R=g;;){var z=C.return;if(z===null)break;var G=z.alternate;if(G===null){if(R=z.return,R!==null){C=R;continue}break}if(z.child===G.child){for(G=z.child;G;){if(G===C)return dr(z),h;if(G===R)return dr(z),g;G=G.sibling}throw Error(r(188))}if(C.return!==R.return)C=z,R=G;else{for(var Z=!1,oe=z.child;oe;){if(oe===C){Z=!0,C=z,R=G;break}if(oe===R){Z=!0,R=z,C=G;break}oe=oe.sibling}if(!Z){for(oe=G.child;oe;){if(oe===C){Z=!0,C=G,R=z;break}if(oe===R){Z=!0,R=G,C=z;break}oe=oe.sibling}if(!Z)throw Error(r(189))}}if(C.alternate!==R)throw Error(r(190))}if(C.tag!==3)throw Error(r(188));return C.stateNode.current===C?h:g}function ki(h){return h=Dn(h),h!==null?Vn(h):null}function Vn(h){if(h.tag===5||h.tag===6)return h;for(h=h.child;h!==null;){var g=Vn(h);if(g!==null)return g;h=h.sibling}return null}var Gn=e.unstable_scheduleCallback,Pa=e.unstable_cancelCallback,Ma=e.unstable_shouldYield,Ss=e.unstable_requestPaint,Gt=e.unstable_now,Ei=e.unstable_getCurrentPriorityLevel,qn=e.unstable_ImmediatePriority,oi=e.unstable_UserBlockingPriority,li=e.unstable_NormalPriority,Ui=e.unstable_LowPriority,Oa=e.unstable_IdlePriority,Nt=null,dt=null;function Rt(h){if(dt&&typeof dt.onCommitFiberRoot=="function")try{dt.onCommitFiberRoot(Nt,h,void 0,(h.current.flags&128)===128)}catch{}}var Xt=Math.clz32?Math.clz32:hy,Qt=Math.log,vh=Math.LN2;function hy(h){return h>>>=0,h===0?32:31-(Qt(h)/vh|0)|0}var _s=64,Su=4194304;function Mo(h){switch(h&-h){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 h&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return h&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return h}}function _u(h,g){var C=h.pendingLanes;if(C===0)return 0;var R=0,z=h.suspendedLanes,G=h.pingedLanes,Z=C&268435455;if(Z!==0){var oe=Z&~z;oe!==0?R=Mo(oe):(G&=Z,G!==0&&(R=Mo(G)))}else Z=C&~z,Z!==0?R=Mo(Z):G!==0&&(R=Mo(G));if(R===0)return 0;if(g!==0&&g!==R&&(g&z)===0&&(z=R&-R,G=g&-g,z>=G||z===16&&(G&4194240)!==0))return g;if((R&4)!==0&&(R|=C&16),g=h.entangledLanes,g!==0)for(h=h.entanglements,g&=R;0<g;)C=31-Xt(g),z=1<<C,R|=h[C],g&=~z;return R}function nE(h,g){switch(h){case 1:case 2:case 4:return g+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 g+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 iE(h,g){for(var C=h.suspendedLanes,R=h.pingedLanes,z=h.expirationTimes,G=h.pendingLanes;0<G;){var Z=31-Xt(G),oe=1<<Z,fe=z[Z];fe===-1?((oe&C)===0||(oe&R)!==0)&&(z[Z]=nE(oe,g)):fe<=g&&(h.expiredLanes|=oe),G&=~oe}}function mh(h){return h=h.pendingLanes&-1073741825,h!==0?h:h&1073741824?1073741824:0}function fy(){var h=_s;return _s<<=1,(_s&4194240)===0&&(_s=64),h}function yh(h){for(var g=[],C=0;31>C;C++)g.push(h);return g}function Oo(h,g,C){h.pendingLanes|=g,g!==536870912&&(h.suspendedLanes=0,h.pingedLanes=0),h=h.eventTimes,g=31-Xt(g),h[g]=C}function aE(h,g){var C=h.pendingLanes&~g;h.pendingLanes=g,h.suspendedLanes=0,h.pingedLanes=0,h.expiredLanes&=g,h.mutableReadLanes&=g,h.entangledLanes&=g,g=h.entanglements;var R=h.eventTimes;for(h=h.expirationTimes;0<C;){var z=31-Xt(C),G=1<<z;g[z]=0,R[z]=-1,h[z]=-1,C&=~G}}function xh(h,g){var C=h.entangledLanes|=g;for(h=h.entanglements;C;){var R=31-Xt(C),z=1<<R;z&g|h[R]&g&&(h[R]|=g),C&=~z}}var Ut=0;function py(h){return h&=-h,1<h?4<h?(h&268435455)!==0?16:536870912:4:1}var gy,bh,vy,my,yy,wh=!1,Cu=[],Wi=null,Vi=null,Gi=null,jo=new Map,Io=new Map,qi=[],sE="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 xy(h,g){switch(h){case"focusin":case"focusout":Wi=null;break;case"dragenter":case"dragleave":Vi=null;break;case"mouseover":case"mouseout":Gi=null;break;case"pointerover":case"pointerout":jo.delete(g.pointerId);break;case"gotpointercapture":case"lostpointercapture":Io.delete(g.pointerId)}}function Bo(h,g,C,R,z,G){return h===null||h.nativeEvent!==G?(h={blockedOn:g,domEventName:C,eventSystemFlags:R,nativeEvent:G,targetContainers:[z]},g!==null&&(g=Zo(g),g!==null&&bh(g)),h):(h.eventSystemFlags|=R,g=h.targetContainers,z!==null&&g.indexOf(z)===-1&&g.push(z),h)}function oE(h,g,C,R,z){switch(g){case"focusin":return Wi=Bo(Wi,h,g,C,R,z),!0;case"dragenter":return Vi=Bo(Vi,h,g,C,R,z),!0;case"mouseover":return Gi=Bo(Gi,h,g,C,R,z),!0;case"pointerover":var G=z.pointerId;return jo.set(G,Bo(jo.get(G)||null,h,g,C,R,z)),!0;case"gotpointercapture":return G=z.pointerId,Io.set(G,Bo(Io.get(G)||null,h,g,C,R,z)),!0}return!1}function by(h){var g=ja(h.target);if(g!==null){var C=zt(g);if(C!==null){if(g=C.tag,g===13){if(g=Qr(C),g!==null){h.blockedOn=g,yy(h.priority,function(){vy(C)});return}}else if(g===3&&C.stateNode.current.memoizedState.isDehydrated){h.blockedOn=C.tag===3?C.stateNode.containerInfo:null;return}}}h.blockedOn=null}function ku(h){if(h.blockedOn!==null)return!1;for(var g=h.targetContainers;0<g.length;){var C=_h(h.domEventName,h.eventSystemFlags,g[0],h.nativeEvent);if(C===null){C=h.nativeEvent;var R=new C.constructor(C.type,C);me=R,C.target.dispatchEvent(R),me=null}else return g=Zo(C),g!==null&&bh(g),h.blockedOn=C,!1;g.shift()}return!0}function wy(h,g,C){ku(h)&&C.delete(g)}function lE(){wh=!1,Wi!==null&&ku(Wi)&&(Wi=null),Vi!==null&&ku(Vi)&&(Vi=null),Gi!==null&&ku(Gi)&&(Gi=null),jo.forEach(wy),Io.forEach(wy)}function Fo(h,g){h.blockedOn===g&&(h.blockedOn=null,wh||(wh=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,lE)))}function zo(h){function g(z){return Fo(z,h)}if(0<Cu.length){Fo(Cu[0],h);for(var C=1;C<Cu.length;C++){var R=Cu[C];R.blockedOn===h&&(R.blockedOn=null)}}for(Wi!==null&&Fo(Wi,h),Vi!==null&&Fo(Vi,h),Gi!==null&&Fo(Gi,h),jo.forEach(g),Io.forEach(g),C=0;C<qi.length;C++)R=qi[C],R.blockedOn===h&&(R.blockedOn=null);for(;0<qi.length&&(C=qi[0],C.blockedOn===null);)by(C),C.blockedOn===null&&qi.shift()}var Cs=_.ReactCurrentBatchConfig,Eu=!0;function uE(h,g,C,R){var z=Ut,G=Cs.transition;Cs.transition=null;try{Ut=1,Sh(h,g,C,R)}finally{Ut=z,Cs.transition=G}}function cE(h,g,C,R){var z=Ut,G=Cs.transition;Cs.transition=null;try{Ut=4,Sh(h,g,C,R)}finally{Ut=z,Cs.transition=G}}function Sh(h,g,C,R){if(Eu){var z=_h(h,g,C,R);if(z===null)zh(h,g,R,Tu,C),xy(h,R);else if(oE(z,h,g,C,R))R.stopPropagation();else if(xy(h,R),g&4&&-1<sE.indexOf(h)){for(;z!==null;){var G=Zo(z);if(G!==null&&gy(G),G=_h(h,g,C,R),G===null&&zh(h,g,R,Tu,C),G===z)break;z=G}z!==null&&R.stopPropagation()}else zh(h,g,R,null,C)}}var Tu=null;function _h(h,g,C,R){if(Tu=null,h=ke(R),h=ja(h),h!==null)if(g=zt(h),g===null)h=null;else if(C=g.tag,C===13){if(h=Qr(g),h!==null)return h;h=null}else if(C===3){if(g.stateNode.current.memoizedState.isDehydrated)return g.tag===3?g.stateNode.containerInfo:null;h=null}else g!==h&&(h=null);return Tu=h,null}function Sy(h){switch(h){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(Ei()){case qn:return 1;case oi:return 4;case li:case Ui:return 16;case Oa:return 536870912;default:return 16}default:return 16}}var Yi=null,Ch=null,Nu=null;function _y(){if(Nu)return Nu;var h,g=Ch,C=g.length,R,z="value"in Yi?Yi.value:Yi.textContent,G=z.length;for(h=0;h<C&&g[h]===z[h];h++);var Z=C-h;for(R=1;R<=Z&&g[C-R]===z[G-R];R++);return Nu=z.slice(h,1<R?1-R:void 0)}function Ru(h){var g=h.keyCode;return"charCode"in h?(h=h.charCode,h===0&&g===13&&(h=13)):h=g,h===10&&(h=13),32<=h||h===13?h:0}function Lu(){return!0}function Cy(){return!1}function bn(h){function g(C,R,z,G,Z){this._reactName=C,this._targetInst=z,this.type=R,this.nativeEvent=G,this.target=Z,this.currentTarget=null;for(var oe in h)h.hasOwnProperty(oe)&&(C=h[oe],this[oe]=C?C(G):G[oe]);return this.isDefaultPrevented=(G.defaultPrevented!=null?G.defaultPrevented:G.returnValue===!1)?Lu:Cy,this.isPropagationStopped=Cy,this}return P(g.prototype,{preventDefault:function(){this.defaultPrevented=!0;var C=this.nativeEvent;C&&(C.preventDefault?C.preventDefault():typeof C.returnValue!="unknown"&&(C.returnValue=!1),this.isDefaultPrevented=Lu)},stopPropagation:function(){var C=this.nativeEvent;C&&(C.stopPropagation?C.stopPropagation():typeof C.cancelBubble!="unknown"&&(C.cancelBubble=!0),this.isPropagationStopped=Lu)},persist:function(){},isPersistent:Lu}),g}var ks={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(h){return h.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},kh=bn(ks),$o=P({},ks,{view:0,detail:0}),dE=bn($o),Eh,Th,Ho,Du=P({},$o,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Rh,button:0,buttons:0,relatedTarget:function(h){return h.relatedTarget===void 0?h.fromElement===h.srcElement?h.toElement:h.fromElement:h.relatedTarget},movementX:function(h){return"movementX"in h?h.movementX:(h!==Ho&&(Ho&&h.type==="mousemove"?(Eh=h.screenX-Ho.screenX,Th=h.screenY-Ho.screenY):Th=Eh=0,Ho=h),Eh)},movementY:function(h){return"movementY"in h?h.movementY:Th}}),ky=bn(Du),hE=P({},Du,{dataTransfer:0}),fE=bn(hE),pE=P({},$o,{relatedTarget:0}),Nh=bn(pE),gE=P({},ks,{animationName:0,elapsedTime:0,pseudoElement:0}),vE=bn(gE),mE=P({},ks,{clipboardData:function(h){return"clipboardData"in h?h.clipboardData:window.clipboardData}}),yE=bn(mE),xE=P({},ks,{data:0}),Ey=bn(xE),bE={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},wE={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"},SE={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function _E(h){var g=this.nativeEvent;return g.getModifierState?g.getModifierState(h):(h=SE[h])?!!g[h]:!1}function Rh(){return _E}var CE=P({},$o,{key:function(h){if(h.key){var g=bE[h.key]||h.key;if(g!=="Unidentified")return g}return h.type==="keypress"?(h=Ru(h),h===13?"Enter":String.fromCharCode(h)):h.type==="keydown"||h.type==="keyup"?wE[h.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Rh,charCode:function(h){return h.type==="keypress"?Ru(h):0},keyCode:function(h){return h.type==="keydown"||h.type==="keyup"?h.keyCode:0},which:function(h){return h.type==="keypress"?Ru(h):h.type==="keydown"||h.type==="keyup"?h.keyCode:0}}),kE=bn(CE),EE=P({},Du,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ty=bn(EE),TE=P({},$o,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Rh}),NE=bn(TE),RE=P({},ks,{propertyName:0,elapsedTime:0,pseudoElement:0}),LE=bn(RE),DE=P({},Du,{deltaX:function(h){return"deltaX"in h?h.deltaX:"wheelDeltaX"in h?-h.wheelDeltaX:0},deltaY:function(h){return"deltaY"in h?h.deltaY:"wheelDeltaY"in h?-h.wheelDeltaY:"wheelDelta"in h?-h.wheelDelta:0},deltaZ:0,deltaMode:0}),AE=bn(DE),PE=[9,13,27,32],Lh=o&&"CompositionEvent"in window,Uo=null;o&&"documentMode"in document&&(Uo=document.documentMode);var ME=o&&"TextEvent"in window&&!Uo,Ny=o&&(!Lh||Uo&&8<Uo&&11>=Uo),Ry=" ",Ly=!1;function Dy(h,g){switch(h){case"keyup":return PE.indexOf(g.keyCode)!==-1;case"keydown":return g.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ay(h){return h=h.detail,typeof h=="object"&&"data"in h?h.data:null}var Es=!1;function OE(h,g){switch(h){case"compositionend":return Ay(g);case"keypress":return g.which!==32?null:(Ly=!0,Ry);case"textInput":return h=g.data,h===Ry&&Ly?null:h;default:return null}}function jE(h,g){if(Es)return h==="compositionend"||!Lh&&Dy(h,g)?(h=_y(),Nu=Ch=Yi=null,Es=!1,h):null;switch(h){case"paste":return null;case"keypress":if(!(g.ctrlKey||g.altKey||g.metaKey)||g.ctrlKey&&g.altKey){if(g.char&&1<g.char.length)return g.char;if(g.which)return String.fromCharCode(g.which)}return null;case"compositionend":return Ny&&g.locale!=="ko"?null:g.data;default:return null}}var IE={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 Py(h){var g=h&&h.nodeName&&h.nodeName.toLowerCase();return g==="input"?!!IE[h.type]:g==="textarea"}function My(h,g,C,R){Xe(R),g=ju(g,"onChange"),0<g.length&&(C=new kh("onChange","change",null,C,R),h.push({event:C,listeners:g}))}var Wo=null,Vo=null;function BE(h){Zy(h,0)}function Au(h){var g=Ds(h);if(ie(g))return h}function FE(h,g){if(h==="change")return g}var Oy=!1;if(o){var Dh;if(o){var Ah="oninput"in document;if(!Ah){var jy=document.createElement("div");jy.setAttribute("oninput","return;"),Ah=typeof jy.oninput=="function"}Dh=Ah}else Dh=!1;Oy=Dh&&(!document.documentMode||9<document.documentMode)}function Iy(){Wo&&(Wo.detachEvent("onpropertychange",By),Vo=Wo=null)}function By(h){if(h.propertyName==="value"&&Au(Vo)){var g=[];My(g,Vo,h,ke(h)),tt(BE,g)}}function zE(h,g,C){h==="focusin"?(Iy(),Wo=g,Vo=C,Wo.attachEvent("onpropertychange",By)):h==="focusout"&&Iy()}function $E(h){if(h==="selectionchange"||h==="keyup"||h==="keydown")return Au(Vo)}function HE(h,g){if(h==="click")return Au(g)}function UE(h,g){if(h==="input"||h==="change")return Au(g)}function WE(h,g){return h===g&&(h!==0||1/h===1/g)||h!==h&&g!==g}var Yn=typeof Object.is=="function"?Object.is:WE;function Go(h,g){if(Yn(h,g))return!0;if(typeof h!="object"||h===null||typeof g!="object"||g===null)return!1;var C=Object.keys(h),R=Object.keys(g);if(C.length!==R.length)return!1;for(R=0;R<C.length;R++){var z=C[R];if(!l.call(g,z)||!Yn(h[z],g[z]))return!1}return!0}function Fy(h){for(;h&&h.firstChild;)h=h.firstChild;return h}function zy(h,g){var C=Fy(h);h=0;for(var R;C;){if(C.nodeType===3){if(R=h+C.textContent.length,h<=g&&R>=g)return{node:C,offset:g-h};h=R}e:{for(;C;){if(C.nextSibling){C=C.nextSibling;break e}C=C.parentNode}C=void 0}C=Fy(C)}}function $y(h,g){return h&&g?h===g?!0:h&&h.nodeType===3?!1:g&&g.nodeType===3?$y(h,g.parentNode):"contains"in h?h.contains(g):h.compareDocumentPosition?!!(h.compareDocumentPosition(g)&16):!1:!1}function Hy(){for(var h=window,g=le();g instanceof h.HTMLIFrameElement;){try{var C=typeof g.contentWindow.location.href=="string"}catch{C=!1}if(C)h=g.contentWindow;else break;g=le(h.document)}return g}function Ph(h){var g=h&&h.nodeName&&h.nodeName.toLowerCase();return g&&(g==="input"&&(h.type==="text"||h.type==="search"||h.type==="tel"||h.type==="url"||h.type==="password")||g==="textarea"||h.contentEditable==="true")}function VE(h){var g=Hy(),C=h.focusedElem,R=h.selectionRange;if(g!==C&&C&&C.ownerDocument&&$y(C.ownerDocument.documentElement,C)){if(R!==null&&Ph(C)){if(g=R.start,h=R.end,h===void 0&&(h=g),"selectionStart"in C)C.selectionStart=g,C.selectionEnd=Math.min(h,C.value.length);else if(h=(g=C.ownerDocument||document)&&g.defaultView||window,h.getSelection){h=h.getSelection();var z=C.textContent.length,G=Math.min(R.start,z);R=R.end===void 0?G:Math.min(R.end,z),!h.extend&&G>R&&(z=R,R=G,G=z),z=zy(C,G);var Z=zy(C,R);z&&Z&&(h.rangeCount!==1||h.anchorNode!==z.node||h.anchorOffset!==z.offset||h.focusNode!==Z.node||h.focusOffset!==Z.offset)&&(g=g.createRange(),g.setStart(z.node,z.offset),h.removeAllRanges(),G>R?(h.addRange(g),h.extend(Z.node,Z.offset)):(g.setEnd(Z.node,Z.offset),h.addRange(g)))}}for(g=[],h=C;h=h.parentNode;)h.nodeType===1&&g.push({element:h,left:h.scrollLeft,top:h.scrollTop});for(typeof C.focus=="function"&&C.focus(),C=0;C<g.length;C++)h=g[C],h.element.scrollLeft=h.left,h.element.scrollTop=h.top}}var GE=o&&"documentMode"in document&&11>=document.documentMode,Ts=null,Mh=null,qo=null,Oh=!1;function Uy(h,g,C){var R=C.window===C?C.document:C.nodeType===9?C:C.ownerDocument;Oh||Ts==null||Ts!==le(R)||(R=Ts,"selectionStart"in R&&Ph(R)?R={start:R.selectionStart,end:R.selectionEnd}:(R=(R.ownerDocument&&R.ownerDocument.defaultView||window).getSelection(),R={anchorNode:R.anchorNode,anchorOffset:R.anchorOffset,focusNode:R.focusNode,focusOffset:R.focusOffset}),qo&&Go(qo,R)||(qo=R,R=ju(Mh,"onSelect"),0<R.length&&(g=new kh("onSelect","select",null,g,C),h.push({event:g,listeners:R}),g.target=Ts)))}function Pu(h,g){var C={};return C[h.toLowerCase()]=g.toLowerCase(),C["Webkit"+h]="webkit"+g,C["Moz"+h]="moz"+g,C}var Ns={animationend:Pu("Animation","AnimationEnd"),animationiteration:Pu("Animation","AnimationIteration"),animationstart:Pu("Animation","AnimationStart"),transitionend:Pu("Transition","TransitionEnd")},jh={},Wy={};o&&(Wy=document.createElement("div").style,"AnimationEvent"in window||(delete Ns.animationend.animation,delete Ns.animationiteration.animation,delete Ns.animationstart.animation),"TransitionEvent"in window||delete Ns.transitionend.transition);function Mu(h){if(jh[h])return jh[h];if(!Ns[h])return h;var g=Ns[h],C;for(C in g)if(g.hasOwnProperty(C)&&C in Wy)return jh[h]=g[C];return h}var Vy=Mu("animationend"),Gy=Mu("animationiteration"),qy=Mu("animationstart"),Yy=Mu("transitionend"),Ky=new Map,Xy="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 Ki(h,g){Ky.set(h,g),a(g,[h])}for(var Ih=0;Ih<Xy.length;Ih++){var Bh=Xy[Ih],qE=Bh.toLowerCase(),YE=Bh[0].toUpperCase()+Bh.slice(1);Ki(qE,"on"+YE)}Ki(Vy,"onAnimationEnd"),Ki(Gy,"onAnimationIteration"),Ki(qy,"onAnimationStart"),Ki("dblclick","onDoubleClick"),Ki("focusin","onFocus"),Ki("focusout","onBlur"),Ki(Yy,"onTransitionEnd"),s("onMouseEnter",["mouseout","mouseover"]),s("onMouseLeave",["mouseout","mouseover"]),s("onPointerEnter",["pointerout","pointerover"]),s("onPointerLeave",["pointerout","pointerover"]),a("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),a("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),a("onBeforeInput",["compositionend","keypress","textInput","paste"]),a("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Yo="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(" "),KE=new Set("cancel close invalid load scroll toggle".split(" ").concat(Yo));function Qy(h,g,C){var R=h.type||"unknown-event";h.currentTarget=C,ir(R,g,void 0,h),h.currentTarget=null}function Zy(h,g){g=(g&4)!==0;for(var C=0;C<h.length;C++){var R=h[C],z=R.event;R=R.listeners;e:{var G=void 0;if(g)for(var Z=R.length-1;0<=Z;Z--){var oe=R[Z],fe=oe.instance,_e=oe.currentTarget;if(oe=oe.listener,fe!==G&&z.isPropagationStopped())break e;Qy(z,oe,_e),G=fe}else for(Z=0;Z<R.length;Z++){if(oe=R[Z],fe=oe.instance,_e=oe.currentTarget,oe=oe.listener,fe!==G&&z.isPropagationStopped())break e;Qy(z,oe,_e),G=fe}}}if(Vt)throw h=jt,Vt=!1,jt=null,h}function tr(h,g){var C=g[Gh];C===void 0&&(C=g[Gh]=new Set);var R=h+"__bubble";C.has(R)||(Jy(g,h,2,!1),C.add(R))}function Fh(h,g,C){var R=0;g&&(R|=4),Jy(C,h,R,g)}var Ou="_reactListening"+Math.random().toString(36).slice(2);function Ko(h){if(!h[Ou]){h[Ou]=!0,n.forEach(function(C){C!=="selectionchange"&&(KE.has(C)||Fh(C,!1,h),Fh(C,!0,h))});var g=h.nodeType===9?h:h.ownerDocument;g===null||g[Ou]||(g[Ou]=!0,Fh("selectionchange",!1,g))}}function Jy(h,g,C,R){switch(Sy(g)){case 1:var z=uE;break;case 4:z=cE;break;default:z=Sh}C=z.bind(null,g,C,h),z=void 0,!kt||g!=="touchstart"&&g!=="touchmove"&&g!=="wheel"||(z=!0),R?z!==void 0?h.addEventListener(g,C,{capture:!0,passive:z}):h.addEventListener(g,C,!0):z!==void 0?h.addEventListener(g,C,{passive:z}):h.addEventListener(g,C,!1)}function zh(h,g,C,R,z){var G=R;if((g&1)===0&&(g&2)===0&&R!==null)e:for(;;){if(R===null)return;var Z=R.tag;if(Z===3||Z===4){var oe=R.stateNode.containerInfo;if(oe===z||oe.nodeType===8&&oe.parentNode===z)break;if(Z===4)for(Z=R.return;Z!==null;){var fe=Z.tag;if((fe===3||fe===4)&&(fe=Z.stateNode.containerInfo,fe===z||fe.nodeType===8&&fe.parentNode===z))return;Z=Z.return}for(;oe!==null;){if(Z=ja(oe),Z===null)return;if(fe=Z.tag,fe===5||fe===6){R=G=Z;continue e}oe=oe.parentNode}}R=R.return}tt(function(){var _e=G,Fe=ke(C),He=[];e:{var Be=Ky.get(h);if(Be!==void 0){var rt=kh,at=h;switch(h){case"keypress":if(Ru(C)===0)break e;case"keydown":case"keyup":rt=kE;break;case"focusin":at="focus",rt=Nh;break;case"focusout":at="blur",rt=Nh;break;case"beforeblur":case"afterblur":rt=Nh;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":rt=ky;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":rt=fE;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":rt=NE;break;case Vy:case Gy:case qy:rt=vE;break;case Yy:rt=LE;break;case"scroll":rt=dE;break;case"wheel":rt=AE;break;case"copy":case"cut":case"paste":rt=yE;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":rt=Ty}var ot=(g&4)!==0,pr=!ot&&h==="scroll",xe=ot?Be!==null?Be+"Capture":null:Be;ot=[];for(var ge=_e,we;ge!==null;){we=ge;var Ve=we.stateNode;if(we.tag===5&&Ve!==null&&(we=Ve,xe!==null&&(Ve=Ye(ge,xe),Ve!=null&&ot.push(Xo(ge,Ve,we)))),pr)break;ge=ge.return}0<ot.length&&(Be=new rt(Be,at,null,C,Fe),He.push({event:Be,listeners:ot}))}}if((g&7)===0){e:{if(Be=h==="mouseover"||h==="pointerover",rt=h==="mouseout"||h==="pointerout",Be&&C!==me&&(at=C.relatedTarget||C.fromElement)&&(ja(at)||at[Ti]))break e;if((rt||Be)&&(Be=Fe.window===Fe?Fe:(Be=Fe.ownerDocument)?Be.defaultView||Be.parentWindow:window,rt?(at=C.relatedTarget||C.toElement,rt=_e,at=at?ja(at):null,at!==null&&(pr=zt(at),at!==pr||at.tag!==5&&at.tag!==6)&&(at=null)):(rt=null,at=_e),rt!==at)){if(ot=ky,Ve="onMouseLeave",xe="onMouseEnter",ge="mouse",(h==="pointerout"||h==="pointerover")&&(ot=Ty,Ve="onPointerLeave",xe="onPointerEnter",ge="pointer"),pr=rt==null?Be:Ds(rt),we=at==null?Be:Ds(at),Be=new ot(Ve,ge+"leave",rt,C,Fe),Be.target=pr,Be.relatedTarget=we,Ve=null,ja(Fe)===_e&&(ot=new ot(xe,ge+"enter",at,C,Fe),ot.target=we,ot.relatedTarget=pr,Ve=ot),pr=Ve,rt&&at)t:{for(ot=rt,xe=at,ge=0,we=ot;we;we=Rs(we))ge++;for(we=0,Ve=xe;Ve;Ve=Rs(Ve))we++;for(;0<ge-we;)ot=Rs(ot),ge--;for(;0<we-ge;)xe=Rs(xe),we--;for(;ge--;){if(ot===xe||xe!==null&&ot===xe.alternate)break t;ot=Rs(ot),xe=Rs(xe)}ot=null}else ot=null;rt!==null&&e0(He,Be,rt,ot,!1),at!==null&&pr!==null&&e0(He,pr,at,ot,!0)}}e:{if(Be=_e?Ds(_e):window,rt=Be.nodeName&&Be.nodeName.toLowerCase(),rt==="select"||rt==="input"&&Be.type==="file")var lt=FE;else if(Py(Be))if(Oy)lt=UE;else{lt=$E;var pt=zE}else(rt=Be.nodeName)&&rt.toLowerCase()==="input"&&(Be.type==="checkbox"||Be.type==="radio")&&(lt=HE);if(lt&&(lt=lt(h,_e))){My(He,lt,C,Fe);break e}pt&&pt(h,Be,_e),h==="focusout"&&(pt=Be._wrapperState)&&pt.controlled&&Be.type==="number"&&Ae(Be,"number",Be.value)}switch(pt=_e?Ds(_e):window,h){case"focusin":(Py(pt)||pt.contentEditable==="true")&&(Ts=pt,Mh=_e,qo=null);break;case"focusout":qo=Mh=Ts=null;break;case"mousedown":Oh=!0;break;case"contextmenu":case"mouseup":case"dragend":Oh=!1,Uy(He,C,Fe);break;case"selectionchange":if(GE)break;case"keydown":case"keyup":Uy(He,C,Fe)}var gt;if(Lh)e:{switch(h){case"compositionstart":var xt="onCompositionStart";break e;case"compositionend":xt="onCompositionEnd";break e;case"compositionupdate":xt="onCompositionUpdate";break e}xt=void 0}else Es?Dy(h,C)&&(xt="onCompositionEnd"):h==="keydown"&&C.keyCode===229&&(xt="onCompositionStart");xt&&(Ny&&C.locale!=="ko"&&(Es||xt!=="onCompositionStart"?xt==="onCompositionEnd"&&Es&&(gt=_y()):(Yi=Fe,Ch="value"in Yi?Yi.value:Yi.textContent,Es=!0)),pt=ju(_e,xt),0<pt.length&&(xt=new Ey(xt,h,null,C,Fe),He.push({event:xt,listeners:pt}),gt?xt.data=gt:(gt=Ay(C),gt!==null&&(xt.data=gt)))),(gt=ME?OE(h,C):jE(h,C))&&(_e=ju(_e,"onBeforeInput"),0<_e.length&&(Fe=new Ey("onBeforeInput","beforeinput",null,C,Fe),He.push({event:Fe,listeners:_e}),Fe.data=gt))}Zy(He,g)})}function Xo(h,g,C){return{instance:h,listener:g,currentTarget:C}}function ju(h,g){for(var C=g+"Capture",R=[];h!==null;){var z=h,G=z.stateNode;z.tag===5&&G!==null&&(z=G,G=Ye(h,C),G!=null&&R.unshift(Xo(h,G,z)),G=Ye(h,g),G!=null&&R.push(Xo(h,G,z))),h=h.return}return R}function Rs(h){if(h===null)return null;do h=h.return;while(h&&h.tag!==5);return h||null}function e0(h,g,C,R,z){for(var G=g._reactName,Z=[];C!==null&&C!==R;){var oe=C,fe=oe.alternate,_e=oe.stateNode;if(fe!==null&&fe===R)break;oe.tag===5&&_e!==null&&(oe=_e,z?(fe=Ye(C,G),fe!=null&&Z.unshift(Xo(C,fe,oe))):z||(fe=Ye(C,G),fe!=null&&Z.push(Xo(C,fe,oe)))),C=C.return}Z.length!==0&&h.push({event:g,listeners:Z})}var XE=/\r\n?/g,QE=/\u0000|\uFFFD/g;function t0(h){return(typeof h=="string"?h:""+h).replace(XE,`
|
|
38
|
+
`).replace(QE,"")}function Iu(h,g,C){if(g=t0(g),t0(h)!==g&&C)throw Error(r(425))}function Bu(){}var $h=null,Hh=null;function Uh(h,g){return h==="textarea"||h==="noscript"||typeof g.children=="string"||typeof g.children=="number"||typeof g.dangerouslySetInnerHTML=="object"&&g.dangerouslySetInnerHTML!==null&&g.dangerouslySetInnerHTML.__html!=null}var Wh=typeof setTimeout=="function"?setTimeout:void 0,ZE=typeof clearTimeout=="function"?clearTimeout:void 0,r0=typeof Promise=="function"?Promise:void 0,JE=typeof queueMicrotask=="function"?queueMicrotask:typeof r0<"u"?function(h){return r0.resolve(null).then(h).catch(e3)}:Wh;function e3(h){setTimeout(function(){throw h})}function Vh(h,g){var C=g,R=0;do{var z=C.nextSibling;if(h.removeChild(C),z&&z.nodeType===8)if(C=z.data,C==="/$"){if(R===0){h.removeChild(z),zo(g);return}R--}else C!=="$"&&C!=="$?"&&C!=="$!"||R++;C=z}while(C);zo(g)}function Xi(h){for(;h!=null;h=h.nextSibling){var g=h.nodeType;if(g===1||g===3)break;if(g===8){if(g=h.data,g==="$"||g==="$!"||g==="$?")break;if(g==="/$")return null}}return h}function n0(h){h=h.previousSibling;for(var g=0;h;){if(h.nodeType===8){var C=h.data;if(C==="$"||C==="$!"||C==="$?"){if(g===0)return h;g--}else C==="/$"&&g++}h=h.previousSibling}return null}var Ls=Math.random().toString(36).slice(2),ui="__reactFiber$"+Ls,Qo="__reactProps$"+Ls,Ti="__reactContainer$"+Ls,Gh="__reactEvents$"+Ls,t3="__reactListeners$"+Ls,r3="__reactHandles$"+Ls;function ja(h){var g=h[ui];if(g)return g;for(var C=h.parentNode;C;){if(g=C[Ti]||C[ui]){if(C=g.alternate,g.child!==null||C!==null&&C.child!==null)for(h=n0(h);h!==null;){if(C=h[ui])return C;h=n0(h)}return g}h=C,C=h.parentNode}return null}function Zo(h){return h=h[ui]||h[Ti],!h||h.tag!==5&&h.tag!==6&&h.tag!==13&&h.tag!==3?null:h}function Ds(h){if(h.tag===5||h.tag===6)return h.stateNode;throw Error(r(33))}function Fu(h){return h[Qo]||null}var qh=[],As=-1;function Qi(h){return{current:h}}function rr(h){0>As||(h.current=qh[As],qh[As]=null,As--)}function Zt(h,g){As++,qh[As]=h.current,h.current=g}var Zi={},Hr=Qi(Zi),ln=Qi(!1),Ia=Zi;function Ps(h,g){var C=h.type.contextTypes;if(!C)return Zi;var R=h.stateNode;if(R&&R.__reactInternalMemoizedUnmaskedChildContext===g)return R.__reactInternalMemoizedMaskedChildContext;var z={},G;for(G in C)z[G]=g[G];return R&&(h=h.stateNode,h.__reactInternalMemoizedUnmaskedChildContext=g,h.__reactInternalMemoizedMaskedChildContext=z),z}function un(h){return h=h.childContextTypes,h!=null}function zu(){rr(ln),rr(Hr)}function i0(h,g,C){if(Hr.current!==Zi)throw Error(r(168));Zt(Hr,g),Zt(ln,C)}function a0(h,g,C){var R=h.stateNode;if(g=g.childContextTypes,typeof R.getChildContext!="function")return C;R=R.getChildContext();for(var z in R)if(!(z in g))throw Error(r(108,X(h)||"Unknown",z));return P({},C,R)}function $u(h){return h=(h=h.stateNode)&&h.__reactInternalMemoizedMergedChildContext||Zi,Ia=Hr.current,Zt(Hr,h),Zt(ln,ln.current),!0}function s0(h,g,C){var R=h.stateNode;if(!R)throw Error(r(169));C?(h=a0(h,g,Ia),R.__reactInternalMemoizedMergedChildContext=h,rr(ln),rr(Hr),Zt(Hr,h)):rr(ln),Zt(ln,C)}var Ni=null,Hu=!1,Yh=!1;function o0(h){Ni===null?Ni=[h]:Ni.push(h)}function n3(h){Hu=!0,o0(h)}function Ji(){if(!Yh&&Ni!==null){Yh=!0;var h=0,g=Ut;try{var C=Ni;for(Ut=1;h<C.length;h++){var R=C[h];do R=R(!0);while(R!==null)}Ni=null,Hu=!1}catch(z){throw Ni!==null&&(Ni=Ni.slice(h+1)),Gn(qn,Ji),z}finally{Ut=g,Yh=!1}}return null}var Ms=[],Os=0,Uu=null,Wu=0,An=[],Pn=0,Ba=null,Ri=1,Li="";function Fa(h,g){Ms[Os++]=Wu,Ms[Os++]=Uu,Uu=h,Wu=g}function l0(h,g,C){An[Pn++]=Ri,An[Pn++]=Li,An[Pn++]=Ba,Ba=h;var R=Ri;h=Li;var z=32-Xt(R)-1;R&=~(1<<z),C+=1;var G=32-Xt(g)+z;if(30<G){var Z=z-z%5;G=(R&(1<<Z)-1).toString(32),R>>=Z,z-=Z,Ri=1<<32-Xt(g)+z|C<<z|R,Li=G+h}else Ri=1<<G|C<<z|R,Li=h}function Kh(h){h.return!==null&&(Fa(h,1),l0(h,1,0))}function Xh(h){for(;h===Uu;)Uu=Ms[--Os],Ms[Os]=null,Wu=Ms[--Os],Ms[Os]=null;for(;h===Ba;)Ba=An[--Pn],An[Pn]=null,Li=An[--Pn],An[Pn]=null,Ri=An[--Pn],An[Pn]=null}var wn=null,Sn=null,ar=!1,Kn=null;function u0(h,g){var C=In(5,null,null,0);C.elementType="DELETED",C.stateNode=g,C.return=h,g=h.deletions,g===null?(h.deletions=[C],h.flags|=16):g.push(C)}function c0(h,g){switch(h.tag){case 5:var C=h.type;return g=g.nodeType!==1||C.toLowerCase()!==g.nodeName.toLowerCase()?null:g,g!==null?(h.stateNode=g,wn=h,Sn=Xi(g.firstChild),!0):!1;case 6:return g=h.pendingProps===""||g.nodeType!==3?null:g,g!==null?(h.stateNode=g,wn=h,Sn=null,!0):!1;case 13:return g=g.nodeType!==8?null:g,g!==null?(C=Ba!==null?{id:Ri,overflow:Li}:null,h.memoizedState={dehydrated:g,treeContext:C,retryLane:1073741824},C=In(18,null,null,0),C.stateNode=g,C.return=h,h.child=C,wn=h,Sn=null,!0):!1;default:return!1}}function Qh(h){return(h.mode&1)!==0&&(h.flags&128)===0}function Zh(h){if(ar){var g=Sn;if(g){var C=g;if(!c0(h,g)){if(Qh(h))throw Error(r(418));g=Xi(C.nextSibling);var R=wn;g&&c0(h,g)?u0(R,C):(h.flags=h.flags&-4097|2,ar=!1,wn=h)}}else{if(Qh(h))throw Error(r(418));h.flags=h.flags&-4097|2,ar=!1,wn=h}}}function d0(h){for(h=h.return;h!==null&&h.tag!==5&&h.tag!==3&&h.tag!==13;)h=h.return;wn=h}function Vu(h){if(h!==wn)return!1;if(!ar)return d0(h),ar=!0,!1;var g;if((g=h.tag!==3)&&!(g=h.tag!==5)&&(g=h.type,g=g!=="head"&&g!=="body"&&!Uh(h.type,h.memoizedProps)),g&&(g=Sn)){if(Qh(h))throw h0(),Error(r(418));for(;g;)u0(h,g),g=Xi(g.nextSibling)}if(d0(h),h.tag===13){if(h=h.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(r(317));e:{for(h=h.nextSibling,g=0;h;){if(h.nodeType===8){var C=h.data;if(C==="/$"){if(g===0){Sn=Xi(h.nextSibling);break e}g--}else C!=="$"&&C!=="$!"&&C!=="$?"||g++}h=h.nextSibling}Sn=null}}else Sn=wn?Xi(h.stateNode.nextSibling):null;return!0}function h0(){for(var h=Sn;h;)h=Xi(h.nextSibling)}function js(){Sn=wn=null,ar=!1}function Jh(h){Kn===null?Kn=[h]:Kn.push(h)}var i3=_.ReactCurrentBatchConfig;function Jo(h,g,C){if(h=C.ref,h!==null&&typeof h!="function"&&typeof h!="object"){if(C._owner){if(C=C._owner,C){if(C.tag!==1)throw Error(r(309));var R=C.stateNode}if(!R)throw Error(r(147,h));var z=R,G=""+h;return g!==null&&g.ref!==null&&typeof g.ref=="function"&&g.ref._stringRef===G?g.ref:(g=function(Z){var oe=z.refs;Z===null?delete oe[G]:oe[G]=Z},g._stringRef=G,g)}if(typeof h!="string")throw Error(r(284));if(!C._owner)throw Error(r(290,h))}return h}function Gu(h,g){throw h=Object.prototype.toString.call(g),Error(r(31,h==="[object Object]"?"object with keys {"+Object.keys(g).join(", ")+"}":h))}function f0(h){var g=h._init;return g(h._payload)}function p0(h){function g(xe,ge){if(h){var we=xe.deletions;we===null?(xe.deletions=[ge],xe.flags|=16):we.push(ge)}}function C(xe,ge){if(!h)return null;for(;ge!==null;)g(xe,ge),ge=ge.sibling;return null}function R(xe,ge){for(xe=new Map;ge!==null;)ge.key!==null?xe.set(ge.key,ge):xe.set(ge.index,ge),ge=ge.sibling;return xe}function z(xe,ge){return xe=oa(xe,ge),xe.index=0,xe.sibling=null,xe}function G(xe,ge,we){return xe.index=we,h?(we=xe.alternate,we!==null?(we=we.index,we<ge?(xe.flags|=2,ge):we):(xe.flags|=2,ge)):(xe.flags|=1048576,ge)}function Z(xe){return h&&xe.alternate===null&&(xe.flags|=2),xe}function oe(xe,ge,we,Ve){return ge===null||ge.tag!==6?(ge=Vf(we,xe.mode,Ve),ge.return=xe,ge):(ge=z(ge,we),ge.return=xe,ge)}function fe(xe,ge,we,Ve){var lt=we.type;return lt===E?Fe(xe,ge,we.props.children,Ve,we.key):ge!==null&&(ge.elementType===lt||typeof lt=="object"&<!==null&<.$$typeof===j&&f0(lt)===ge.type)?(Ve=z(ge,we.props),Ve.ref=Jo(xe,ge,we),Ve.return=xe,Ve):(Ve=vc(we.type,we.key,we.props,null,xe.mode,Ve),Ve.ref=Jo(xe,ge,we),Ve.return=xe,Ve)}function _e(xe,ge,we,Ve){return ge===null||ge.tag!==4||ge.stateNode.containerInfo!==we.containerInfo||ge.stateNode.implementation!==we.implementation?(ge=Gf(we,xe.mode,Ve),ge.return=xe,ge):(ge=z(ge,we.children||[]),ge.return=xe,ge)}function Fe(xe,ge,we,Ve,lt){return ge===null||ge.tag!==7?(ge=qa(we,xe.mode,Ve,lt),ge.return=xe,ge):(ge=z(ge,we),ge.return=xe,ge)}function He(xe,ge,we){if(typeof ge=="string"&&ge!==""||typeof ge=="number")return ge=Vf(""+ge,xe.mode,we),ge.return=xe,ge;if(typeof ge=="object"&&ge!==null){switch(ge.$$typeof){case T:return we=vc(ge.type,ge.key,ge.props,null,xe.mode,we),we.ref=Jo(xe,null,ge),we.return=xe,we;case N:return ge=Gf(ge,xe.mode,we),ge.return=xe,ge;case j:var Ve=ge._init;return He(xe,Ve(ge._payload),we)}if(Ne(ge)||F(ge))return ge=qa(ge,xe.mode,we,null),ge.return=xe,ge;Gu(xe,ge)}return null}function Be(xe,ge,we,Ve){var lt=ge!==null?ge.key:null;if(typeof we=="string"&&we!==""||typeof we=="number")return lt!==null?null:oe(xe,ge,""+we,Ve);if(typeof we=="object"&&we!==null){switch(we.$$typeof){case T:return we.key===lt?fe(xe,ge,we,Ve):null;case N:return we.key===lt?_e(xe,ge,we,Ve):null;case j:return lt=we._init,Be(xe,ge,lt(we._payload),Ve)}if(Ne(we)||F(we))return lt!==null?null:Fe(xe,ge,we,Ve,null);Gu(xe,we)}return null}function rt(xe,ge,we,Ve,lt){if(typeof Ve=="string"&&Ve!==""||typeof Ve=="number")return xe=xe.get(we)||null,oe(ge,xe,""+Ve,lt);if(typeof Ve=="object"&&Ve!==null){switch(Ve.$$typeof){case T:return xe=xe.get(Ve.key===null?we:Ve.key)||null,fe(ge,xe,Ve,lt);case N:return xe=xe.get(Ve.key===null?we:Ve.key)||null,_e(ge,xe,Ve,lt);case j:var pt=Ve._init;return rt(xe,ge,we,pt(Ve._payload),lt)}if(Ne(Ve)||F(Ve))return xe=xe.get(we)||null,Fe(ge,xe,Ve,lt,null);Gu(ge,Ve)}return null}function at(xe,ge,we,Ve){for(var lt=null,pt=null,gt=ge,xt=ge=0,Rr=null;gt!==null&&xt<we.length;xt++){gt.index>xt?(Rr=gt,gt=null):Rr=gt.sibling;var It=Be(xe,gt,we[xt],Ve);if(It===null){gt===null&&(gt=Rr);break}h&>&&It.alternate===null&&g(xe,gt),ge=G(It,ge,xt),pt===null?lt=It:pt.sibling=It,pt=It,gt=Rr}if(xt===we.length)return C(xe,gt),ar&&Fa(xe,xt),lt;if(gt===null){for(;xt<we.length;xt++)gt=He(xe,we[xt],Ve),gt!==null&&(ge=G(gt,ge,xt),pt===null?lt=gt:pt.sibling=gt,pt=gt);return ar&&Fa(xe,xt),lt}for(gt=R(xe,gt);xt<we.length;xt++)Rr=rt(gt,xe,xt,we[xt],Ve),Rr!==null&&(h&&Rr.alternate!==null&>.delete(Rr.key===null?xt:Rr.key),ge=G(Rr,ge,xt),pt===null?lt=Rr:pt.sibling=Rr,pt=Rr);return h&>.forEach(function(la){return g(xe,la)}),ar&&Fa(xe,xt),lt}function ot(xe,ge,we,Ve){var lt=F(we);if(typeof lt!="function")throw Error(r(150));if(we=lt.call(we),we==null)throw Error(r(151));for(var pt=lt=null,gt=ge,xt=ge=0,Rr=null,It=we.next();gt!==null&&!It.done;xt++,It=we.next()){gt.index>xt?(Rr=gt,gt=null):Rr=gt.sibling;var la=Be(xe,gt,It.value,Ve);if(la===null){gt===null&&(gt=Rr);break}h&>&&la.alternate===null&&g(xe,gt),ge=G(la,ge,xt),pt===null?lt=la:pt.sibling=la,pt=la,gt=Rr}if(It.done)return C(xe,gt),ar&&Fa(xe,xt),lt;if(gt===null){for(;!It.done;xt++,It=we.next())It=He(xe,It.value,Ve),It!==null&&(ge=G(It,ge,xt),pt===null?lt=It:pt.sibling=It,pt=It);return ar&&Fa(xe,xt),lt}for(gt=R(xe,gt);!It.done;xt++,It=we.next())It=rt(gt,xe,xt,It.value,Ve),It!==null&&(h&&It.alternate!==null&>.delete(It.key===null?xt:It.key),ge=G(It,ge,xt),pt===null?lt=It:pt.sibling=It,pt=It);return h&>.forEach(function(I3){return g(xe,I3)}),ar&&Fa(xe,xt),lt}function pr(xe,ge,we,Ve){if(typeof we=="object"&&we!==null&&we.type===E&&we.key===null&&(we=we.props.children),typeof we=="object"&&we!==null){switch(we.$$typeof){case T:e:{for(var lt=we.key,pt=ge;pt!==null;){if(pt.key===lt){if(lt=we.type,lt===E){if(pt.tag===7){C(xe,pt.sibling),ge=z(pt,we.props.children),ge.return=xe,xe=ge;break e}}else if(pt.elementType===lt||typeof lt=="object"&<!==null&<.$$typeof===j&&f0(lt)===pt.type){C(xe,pt.sibling),ge=z(pt,we.props),ge.ref=Jo(xe,pt,we),ge.return=xe,xe=ge;break e}C(xe,pt);break}else g(xe,pt);pt=pt.sibling}we.type===E?(ge=qa(we.props.children,xe.mode,Ve,we.key),ge.return=xe,xe=ge):(Ve=vc(we.type,we.key,we.props,null,xe.mode,Ve),Ve.ref=Jo(xe,ge,we),Ve.return=xe,xe=Ve)}return Z(xe);case N:e:{for(pt=we.key;ge!==null;){if(ge.key===pt)if(ge.tag===4&&ge.stateNode.containerInfo===we.containerInfo&&ge.stateNode.implementation===we.implementation){C(xe,ge.sibling),ge=z(ge,we.children||[]),ge.return=xe,xe=ge;break e}else{C(xe,ge);break}else g(xe,ge);ge=ge.sibling}ge=Gf(we,xe.mode,Ve),ge.return=xe,xe=ge}return Z(xe);case j:return pt=we._init,pr(xe,ge,pt(we._payload),Ve)}if(Ne(we))return at(xe,ge,we,Ve);if(F(we))return ot(xe,ge,we,Ve);Gu(xe,we)}return typeof we=="string"&&we!==""||typeof we=="number"?(we=""+we,ge!==null&&ge.tag===6?(C(xe,ge.sibling),ge=z(ge,we),ge.return=xe,xe=ge):(C(xe,ge),ge=Vf(we,xe.mode,Ve),ge.return=xe,xe=ge),Z(xe)):C(xe,ge)}return pr}var Is=p0(!0),g0=p0(!1),qu=Qi(null),Yu=null,Bs=null,ef=null;function tf(){ef=Bs=Yu=null}function rf(h){var g=qu.current;rr(qu),h._currentValue=g}function nf(h,g,C){for(;h!==null;){var R=h.alternate;if((h.childLanes&g)!==g?(h.childLanes|=g,R!==null&&(R.childLanes|=g)):R!==null&&(R.childLanes&g)!==g&&(R.childLanes|=g),h===C)break;h=h.return}}function Fs(h,g){Yu=h,ef=Bs=null,h=h.dependencies,h!==null&&h.firstContext!==null&&((h.lanes&g)!==0&&(cn=!0),h.firstContext=null)}function Mn(h){var g=h._currentValue;if(ef!==h)if(h={context:h,memoizedValue:g,next:null},Bs===null){if(Yu===null)throw Error(r(308));Bs=h,Yu.dependencies={lanes:0,firstContext:h}}else Bs=Bs.next=h;return g}var za=null;function af(h){za===null?za=[h]:za.push(h)}function v0(h,g,C,R){var z=g.interleaved;return z===null?(C.next=C,af(g)):(C.next=z.next,z.next=C),g.interleaved=C,Di(h,R)}function Di(h,g){h.lanes|=g;var C=h.alternate;for(C!==null&&(C.lanes|=g),C=h,h=h.return;h!==null;)h.childLanes|=g,C=h.alternate,C!==null&&(C.childLanes|=g),C=h,h=h.return;return C.tag===3?C.stateNode:null}var ea=!1;function sf(h){h.updateQueue={baseState:h.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function m0(h,g){h=h.updateQueue,g.updateQueue===h&&(g.updateQueue={baseState:h.baseState,firstBaseUpdate:h.firstBaseUpdate,lastBaseUpdate:h.lastBaseUpdate,shared:h.shared,effects:h.effects})}function Ai(h,g){return{eventTime:h,lane:g,tag:0,payload:null,callback:null,next:null}}function ta(h,g,C){var R=h.updateQueue;if(R===null)return null;if(R=R.shared,(Pt&2)!==0){var z=R.pending;return z===null?g.next=g:(g.next=z.next,z.next=g),R.pending=g,Di(h,C)}return z=R.interleaved,z===null?(g.next=g,af(R)):(g.next=z.next,z.next=g),R.interleaved=g,Di(h,C)}function Ku(h,g,C){if(g=g.updateQueue,g!==null&&(g=g.shared,(C&4194240)!==0)){var R=g.lanes;R&=h.pendingLanes,C|=R,g.lanes=C,xh(h,C)}}function y0(h,g){var C=h.updateQueue,R=h.alternate;if(R!==null&&(R=R.updateQueue,C===R)){var z=null,G=null;if(C=C.firstBaseUpdate,C!==null){do{var Z={eventTime:C.eventTime,lane:C.lane,tag:C.tag,payload:C.payload,callback:C.callback,next:null};G===null?z=G=Z:G=G.next=Z,C=C.next}while(C!==null);G===null?z=G=g:G=G.next=g}else z=G=g;C={baseState:R.baseState,firstBaseUpdate:z,lastBaseUpdate:G,shared:R.shared,effects:R.effects},h.updateQueue=C;return}h=C.lastBaseUpdate,h===null?C.firstBaseUpdate=g:h.next=g,C.lastBaseUpdate=g}function Xu(h,g,C,R){var z=h.updateQueue;ea=!1;var G=z.firstBaseUpdate,Z=z.lastBaseUpdate,oe=z.shared.pending;if(oe!==null){z.shared.pending=null;var fe=oe,_e=fe.next;fe.next=null,Z===null?G=_e:Z.next=_e,Z=fe;var Fe=h.alternate;Fe!==null&&(Fe=Fe.updateQueue,oe=Fe.lastBaseUpdate,oe!==Z&&(oe===null?Fe.firstBaseUpdate=_e:oe.next=_e,Fe.lastBaseUpdate=fe))}if(G!==null){var He=z.baseState;Z=0,Fe=_e=fe=null,oe=G;do{var Be=oe.lane,rt=oe.eventTime;if((R&Be)===Be){Fe!==null&&(Fe=Fe.next={eventTime:rt,lane:0,tag:oe.tag,payload:oe.payload,callback:oe.callback,next:null});e:{var at=h,ot=oe;switch(Be=g,rt=C,ot.tag){case 1:if(at=ot.payload,typeof at=="function"){He=at.call(rt,He,Be);break e}He=at;break e;case 3:at.flags=at.flags&-65537|128;case 0:if(at=ot.payload,Be=typeof at=="function"?at.call(rt,He,Be):at,Be==null)break e;He=P({},He,Be);break e;case 2:ea=!0}}oe.callback!==null&&oe.lane!==0&&(h.flags|=64,Be=z.effects,Be===null?z.effects=[oe]:Be.push(oe))}else rt={eventTime:rt,lane:Be,tag:oe.tag,payload:oe.payload,callback:oe.callback,next:null},Fe===null?(_e=Fe=rt,fe=He):Fe=Fe.next=rt,Z|=Be;if(oe=oe.next,oe===null){if(oe=z.shared.pending,oe===null)break;Be=oe,oe=Be.next,Be.next=null,z.lastBaseUpdate=Be,z.shared.pending=null}}while(!0);if(Fe===null&&(fe=He),z.baseState=fe,z.firstBaseUpdate=_e,z.lastBaseUpdate=Fe,g=z.shared.interleaved,g!==null){z=g;do Z|=z.lane,z=z.next;while(z!==g)}else G===null&&(z.shared.lanes=0);Ua|=Z,h.lanes=Z,h.memoizedState=He}}function x0(h,g,C){if(h=g.effects,g.effects=null,h!==null)for(g=0;g<h.length;g++){var R=h[g],z=R.callback;if(z!==null){if(R.callback=null,R=C,typeof z!="function")throw Error(r(191,z));z.call(R)}}}var el={},ci=Qi(el),tl=Qi(el),rl=Qi(el);function $a(h){if(h===el)throw Error(r(174));return h}function of(h,g){switch(Zt(rl,g),Zt(tl,h),Zt(ci,el),h=g.nodeType,h){case 9:case 11:g=(g=g.documentElement)?g.namespaceURI:Ee(null,"");break;default:h=h===8?g.parentNode:g,g=h.namespaceURI||null,h=h.tagName,g=Ee(g,h)}rr(ci),Zt(ci,g)}function zs(){rr(ci),rr(tl),rr(rl)}function b0(h){$a(rl.current);var g=$a(ci.current),C=Ee(g,h.type);g!==C&&(Zt(tl,h),Zt(ci,C))}function lf(h){tl.current===h&&(rr(ci),rr(tl))}var lr=Qi(0);function Qu(h){for(var g=h;g!==null;){if(g.tag===13){var C=g.memoizedState;if(C!==null&&(C=C.dehydrated,C===null||C.data==="$?"||C.data==="$!"))return g}else if(g.tag===19&&g.memoizedProps.revealOrder!==void 0){if((g.flags&128)!==0)return g}else if(g.child!==null){g.child.return=g,g=g.child;continue}if(g===h)break;for(;g.sibling===null;){if(g.return===null||g.return===h)return null;g=g.return}g.sibling.return=g.return,g=g.sibling}return null}var uf=[];function cf(){for(var h=0;h<uf.length;h++)uf[h]._workInProgressVersionPrimary=null;uf.length=0}var Zu=_.ReactCurrentDispatcher,df=_.ReactCurrentBatchConfig,Ha=0,ur=null,wr=null,Tr=null,Ju=!1,nl=!1,il=0,a3=0;function Ur(){throw Error(r(321))}function hf(h,g){if(g===null)return!1;for(var C=0;C<g.length&&C<h.length;C++)if(!Yn(h[C],g[C]))return!1;return!0}function ff(h,g,C,R,z,G){if(Ha=G,ur=g,g.memoizedState=null,g.updateQueue=null,g.lanes=0,Zu.current=h===null||h.memoizedState===null?u3:c3,h=C(R,z),nl){G=0;do{if(nl=!1,il=0,25<=G)throw Error(r(301));G+=1,Tr=wr=null,g.updateQueue=null,Zu.current=d3,h=C(R,z)}while(nl)}if(Zu.current=rc,g=wr!==null&&wr.next!==null,Ha=0,Tr=wr=ur=null,Ju=!1,g)throw Error(r(300));return h}function pf(){var h=il!==0;return il=0,h}function di(){var h={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Tr===null?ur.memoizedState=Tr=h:Tr=Tr.next=h,Tr}function On(){if(wr===null){var h=ur.alternate;h=h!==null?h.memoizedState:null}else h=wr.next;var g=Tr===null?ur.memoizedState:Tr.next;if(g!==null)Tr=g,wr=h;else{if(h===null)throw Error(r(310));wr=h,h={memoizedState:wr.memoizedState,baseState:wr.baseState,baseQueue:wr.baseQueue,queue:wr.queue,next:null},Tr===null?ur.memoizedState=Tr=h:Tr=Tr.next=h}return Tr}function al(h,g){return typeof g=="function"?g(h):g}function gf(h){var g=On(),C=g.queue;if(C===null)throw Error(r(311));C.lastRenderedReducer=h;var R=wr,z=R.baseQueue,G=C.pending;if(G!==null){if(z!==null){var Z=z.next;z.next=G.next,G.next=Z}R.baseQueue=z=G,C.pending=null}if(z!==null){G=z.next,R=R.baseState;var oe=Z=null,fe=null,_e=G;do{var Fe=_e.lane;if((Ha&Fe)===Fe)fe!==null&&(fe=fe.next={lane:0,action:_e.action,hasEagerState:_e.hasEagerState,eagerState:_e.eagerState,next:null}),R=_e.hasEagerState?_e.eagerState:h(R,_e.action);else{var He={lane:Fe,action:_e.action,hasEagerState:_e.hasEagerState,eagerState:_e.eagerState,next:null};fe===null?(oe=fe=He,Z=R):fe=fe.next=He,ur.lanes|=Fe,Ua|=Fe}_e=_e.next}while(_e!==null&&_e!==G);fe===null?Z=R:fe.next=oe,Yn(R,g.memoizedState)||(cn=!0),g.memoizedState=R,g.baseState=Z,g.baseQueue=fe,C.lastRenderedState=R}if(h=C.interleaved,h!==null){z=h;do G=z.lane,ur.lanes|=G,Ua|=G,z=z.next;while(z!==h)}else z===null&&(C.lanes=0);return[g.memoizedState,C.dispatch]}function vf(h){var g=On(),C=g.queue;if(C===null)throw Error(r(311));C.lastRenderedReducer=h;var R=C.dispatch,z=C.pending,G=g.memoizedState;if(z!==null){C.pending=null;var Z=z=z.next;do G=h(G,Z.action),Z=Z.next;while(Z!==z);Yn(G,g.memoizedState)||(cn=!0),g.memoizedState=G,g.baseQueue===null&&(g.baseState=G),C.lastRenderedState=G}return[G,R]}function w0(){}function S0(h,g){var C=ur,R=On(),z=g(),G=!Yn(R.memoizedState,z);if(G&&(R.memoizedState=z,cn=!0),R=R.queue,mf(k0.bind(null,C,R,h),[h]),R.getSnapshot!==g||G||Tr!==null&&Tr.memoizedState.tag&1){if(C.flags|=2048,sl(9,C0.bind(null,C,R,z,g),void 0,null),Nr===null)throw Error(r(349));(Ha&30)!==0||_0(C,g,z)}return z}function _0(h,g,C){h.flags|=16384,h={getSnapshot:g,value:C},g=ur.updateQueue,g===null?(g={lastEffect:null,stores:null},ur.updateQueue=g,g.stores=[h]):(C=g.stores,C===null?g.stores=[h]:C.push(h))}function C0(h,g,C,R){g.value=C,g.getSnapshot=R,E0(g)&&T0(h)}function k0(h,g,C){return C(function(){E0(g)&&T0(h)})}function E0(h){var g=h.getSnapshot;h=h.value;try{var C=g();return!Yn(h,C)}catch{return!0}}function T0(h){var g=Di(h,1);g!==null&&Jn(g,h,1,-1)}function N0(h){var g=di();return typeof h=="function"&&(h=h()),g.memoizedState=g.baseState=h,h={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:al,lastRenderedState:h},g.queue=h,h=h.dispatch=l3.bind(null,ur,h),[g.memoizedState,h]}function sl(h,g,C,R){return h={tag:h,create:g,destroy:C,deps:R,next:null},g=ur.updateQueue,g===null?(g={lastEffect:null,stores:null},ur.updateQueue=g,g.lastEffect=h.next=h):(C=g.lastEffect,C===null?g.lastEffect=h.next=h:(R=C.next,C.next=h,h.next=R,g.lastEffect=h)),h}function R0(){return On().memoizedState}function ec(h,g,C,R){var z=di();ur.flags|=h,z.memoizedState=sl(1|g,C,void 0,R===void 0?null:R)}function tc(h,g,C,R){var z=On();R=R===void 0?null:R;var G=void 0;if(wr!==null){var Z=wr.memoizedState;if(G=Z.destroy,R!==null&&hf(R,Z.deps)){z.memoizedState=sl(g,C,G,R);return}}ur.flags|=h,z.memoizedState=sl(1|g,C,G,R)}function L0(h,g){return ec(8390656,8,h,g)}function mf(h,g){return tc(2048,8,h,g)}function D0(h,g){return tc(4,2,h,g)}function A0(h,g){return tc(4,4,h,g)}function P0(h,g){if(typeof g=="function")return h=h(),g(h),function(){g(null)};if(g!=null)return h=h(),g.current=h,function(){g.current=null}}function M0(h,g,C){return C=C!=null?C.concat([h]):null,tc(4,4,P0.bind(null,g,h),C)}function yf(){}function O0(h,g){var C=On();g=g===void 0?null:g;var R=C.memoizedState;return R!==null&&g!==null&&hf(g,R[1])?R[0]:(C.memoizedState=[h,g],h)}function j0(h,g){var C=On();g=g===void 0?null:g;var R=C.memoizedState;return R!==null&&g!==null&&hf(g,R[1])?R[0]:(h=h(),C.memoizedState=[h,g],h)}function I0(h,g,C){return(Ha&21)===0?(h.baseState&&(h.baseState=!1,cn=!0),h.memoizedState=C):(Yn(C,g)||(C=fy(),ur.lanes|=C,Ua|=C,h.baseState=!0),g)}function s3(h,g){var C=Ut;Ut=C!==0&&4>C?C:4,h(!0);var R=df.transition;df.transition={};try{h(!1),g()}finally{Ut=C,df.transition=R}}function B0(){return On().memoizedState}function o3(h,g,C){var R=aa(h);if(C={lane:R,action:C,hasEagerState:!1,eagerState:null,next:null},F0(h))z0(g,C);else if(C=v0(h,g,C,R),C!==null){var z=Jr();Jn(C,h,R,z),$0(C,g,R)}}function l3(h,g,C){var R=aa(h),z={lane:R,action:C,hasEagerState:!1,eagerState:null,next:null};if(F0(h))z0(g,z);else{var G=h.alternate;if(h.lanes===0&&(G===null||G.lanes===0)&&(G=g.lastRenderedReducer,G!==null))try{var Z=g.lastRenderedState,oe=G(Z,C);if(z.hasEagerState=!0,z.eagerState=oe,Yn(oe,Z)){var fe=g.interleaved;fe===null?(z.next=z,af(g)):(z.next=fe.next,fe.next=z),g.interleaved=z;return}}catch{}finally{}C=v0(h,g,z,R),C!==null&&(z=Jr(),Jn(C,h,R,z),$0(C,g,R))}}function F0(h){var g=h.alternate;return h===ur||g!==null&&g===ur}function z0(h,g){nl=Ju=!0;var C=h.pending;C===null?g.next=g:(g.next=C.next,C.next=g),h.pending=g}function $0(h,g,C){if((C&4194240)!==0){var R=g.lanes;R&=h.pendingLanes,C|=R,g.lanes=C,xh(h,C)}}var rc={readContext:Mn,useCallback:Ur,useContext:Ur,useEffect:Ur,useImperativeHandle:Ur,useInsertionEffect:Ur,useLayoutEffect:Ur,useMemo:Ur,useReducer:Ur,useRef:Ur,useState:Ur,useDebugValue:Ur,useDeferredValue:Ur,useTransition:Ur,useMutableSource:Ur,useSyncExternalStore:Ur,useId:Ur,unstable_isNewReconciler:!1},u3={readContext:Mn,useCallback:function(h,g){return di().memoizedState=[h,g===void 0?null:g],h},useContext:Mn,useEffect:L0,useImperativeHandle:function(h,g,C){return C=C!=null?C.concat([h]):null,ec(4194308,4,P0.bind(null,g,h),C)},useLayoutEffect:function(h,g){return ec(4194308,4,h,g)},useInsertionEffect:function(h,g){return ec(4,2,h,g)},useMemo:function(h,g){var C=di();return g=g===void 0?null:g,h=h(),C.memoizedState=[h,g],h},useReducer:function(h,g,C){var R=di();return g=C!==void 0?C(g):g,R.memoizedState=R.baseState=g,h={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:h,lastRenderedState:g},R.queue=h,h=h.dispatch=o3.bind(null,ur,h),[R.memoizedState,h]},useRef:function(h){var g=di();return h={current:h},g.memoizedState=h},useState:N0,useDebugValue:yf,useDeferredValue:function(h){return di().memoizedState=h},useTransition:function(){var h=N0(!1),g=h[0];return h=s3.bind(null,h[1]),di().memoizedState=h,[g,h]},useMutableSource:function(){},useSyncExternalStore:function(h,g,C){var R=ur,z=di();if(ar){if(C===void 0)throw Error(r(407));C=C()}else{if(C=g(),Nr===null)throw Error(r(349));(Ha&30)!==0||_0(R,g,C)}z.memoizedState=C;var G={value:C,getSnapshot:g};return z.queue=G,L0(k0.bind(null,R,G,h),[h]),R.flags|=2048,sl(9,C0.bind(null,R,G,C,g),void 0,null),C},useId:function(){var h=di(),g=Nr.identifierPrefix;if(ar){var C=Li,R=Ri;C=(R&~(1<<32-Xt(R)-1)).toString(32)+C,g=":"+g+"R"+C,C=il++,0<C&&(g+="H"+C.toString(32)),g+=":"}else C=a3++,g=":"+g+"r"+C.toString(32)+":";return h.memoizedState=g},unstable_isNewReconciler:!1},c3={readContext:Mn,useCallback:O0,useContext:Mn,useEffect:mf,useImperativeHandle:M0,useInsertionEffect:D0,useLayoutEffect:A0,useMemo:j0,useReducer:gf,useRef:R0,useState:function(){return gf(al)},useDebugValue:yf,useDeferredValue:function(h){var g=On();return I0(g,wr.memoizedState,h)},useTransition:function(){var h=gf(al)[0],g=On().memoizedState;return[h,g]},useMutableSource:w0,useSyncExternalStore:S0,useId:B0,unstable_isNewReconciler:!1},d3={readContext:Mn,useCallback:O0,useContext:Mn,useEffect:mf,useImperativeHandle:M0,useInsertionEffect:D0,useLayoutEffect:A0,useMemo:j0,useReducer:vf,useRef:R0,useState:function(){return vf(al)},useDebugValue:yf,useDeferredValue:function(h){var g=On();return wr===null?g.memoizedState=h:I0(g,wr.memoizedState,h)},useTransition:function(){var h=vf(al)[0],g=On().memoizedState;return[h,g]},useMutableSource:w0,useSyncExternalStore:S0,useId:B0,unstable_isNewReconciler:!1};function Xn(h,g){if(h&&h.defaultProps){g=P({},g),h=h.defaultProps;for(var C in h)g[C]===void 0&&(g[C]=h[C]);return g}return g}function xf(h,g,C,R){g=h.memoizedState,C=C(R,g),C=C==null?g:P({},g,C),h.memoizedState=C,h.lanes===0&&(h.updateQueue.baseState=C)}var nc={isMounted:function(h){return(h=h._reactInternals)?zt(h)===h:!1},enqueueSetState:function(h,g,C){h=h._reactInternals;var R=Jr(),z=aa(h),G=Ai(R,z);G.payload=g,C!=null&&(G.callback=C),g=ta(h,G,z),g!==null&&(Jn(g,h,z,R),Ku(g,h,z))},enqueueReplaceState:function(h,g,C){h=h._reactInternals;var R=Jr(),z=aa(h),G=Ai(R,z);G.tag=1,G.payload=g,C!=null&&(G.callback=C),g=ta(h,G,z),g!==null&&(Jn(g,h,z,R),Ku(g,h,z))},enqueueForceUpdate:function(h,g){h=h._reactInternals;var C=Jr(),R=aa(h),z=Ai(C,R);z.tag=2,g!=null&&(z.callback=g),g=ta(h,z,R),g!==null&&(Jn(g,h,R,C),Ku(g,h,R))}};function H0(h,g,C,R,z,G,Z){return h=h.stateNode,typeof h.shouldComponentUpdate=="function"?h.shouldComponentUpdate(R,G,Z):g.prototype&&g.prototype.isPureReactComponent?!Go(C,R)||!Go(z,G):!0}function U0(h,g,C){var R=!1,z=Zi,G=g.contextType;return typeof G=="object"&&G!==null?G=Mn(G):(z=un(g)?Ia:Hr.current,R=g.contextTypes,G=(R=R!=null)?Ps(h,z):Zi),g=new g(C,G),h.memoizedState=g.state!==null&&g.state!==void 0?g.state:null,g.updater=nc,h.stateNode=g,g._reactInternals=h,R&&(h=h.stateNode,h.__reactInternalMemoizedUnmaskedChildContext=z,h.__reactInternalMemoizedMaskedChildContext=G),g}function W0(h,g,C,R){h=g.state,typeof g.componentWillReceiveProps=="function"&&g.componentWillReceiveProps(C,R),typeof g.UNSAFE_componentWillReceiveProps=="function"&&g.UNSAFE_componentWillReceiveProps(C,R),g.state!==h&&nc.enqueueReplaceState(g,g.state,null)}function bf(h,g,C,R){var z=h.stateNode;z.props=C,z.state=h.memoizedState,z.refs={},sf(h);var G=g.contextType;typeof G=="object"&&G!==null?z.context=Mn(G):(G=un(g)?Ia:Hr.current,z.context=Ps(h,G)),z.state=h.memoizedState,G=g.getDerivedStateFromProps,typeof G=="function"&&(xf(h,g,G,C),z.state=h.memoizedState),typeof g.getDerivedStateFromProps=="function"||typeof z.getSnapshotBeforeUpdate=="function"||typeof z.UNSAFE_componentWillMount!="function"&&typeof z.componentWillMount!="function"||(g=z.state,typeof z.componentWillMount=="function"&&z.componentWillMount(),typeof z.UNSAFE_componentWillMount=="function"&&z.UNSAFE_componentWillMount(),g!==z.state&&nc.enqueueReplaceState(z,z.state,null),Xu(h,C,z,R),z.state=h.memoizedState),typeof z.componentDidMount=="function"&&(h.flags|=4194308)}function $s(h,g){try{var C="",R=g;do C+=J(R),R=R.return;while(R);var z=C}catch(G){z=`
|
|
39
|
+
Error generating stack: `+G.message+`
|
|
40
|
+
`+G.stack}return{value:h,source:g,stack:z,digest:null}}function wf(h,g,C){return{value:h,source:null,stack:C??null,digest:g??null}}function Sf(h,g){try{console.error(g.value)}catch(C){setTimeout(function(){throw C})}}var h3=typeof WeakMap=="function"?WeakMap:Map;function V0(h,g,C){C=Ai(-1,C),C.tag=3,C.payload={element:null};var R=g.value;return C.callback=function(){cc||(cc=!0,If=R),Sf(h,g)},C}function G0(h,g,C){C=Ai(-1,C),C.tag=3;var R=h.type.getDerivedStateFromError;if(typeof R=="function"){var z=g.value;C.payload=function(){return R(z)},C.callback=function(){Sf(h,g)}}var G=h.stateNode;return G!==null&&typeof G.componentDidCatch=="function"&&(C.callback=function(){Sf(h,g),typeof R!="function"&&(na===null?na=new Set([this]):na.add(this));var Z=g.stack;this.componentDidCatch(g.value,{componentStack:Z!==null?Z:""})}),C}function q0(h,g,C){var R=h.pingCache;if(R===null){R=h.pingCache=new h3;var z=new Set;R.set(g,z)}else z=R.get(g),z===void 0&&(z=new Set,R.set(g,z));z.has(C)||(z.add(C),h=E3.bind(null,h,g,C),g.then(h,h))}function Y0(h){do{var g;if((g=h.tag===13)&&(g=h.memoizedState,g=g!==null?g.dehydrated!==null:!0),g)return h;h=h.return}while(h!==null);return null}function K0(h,g,C,R,z){return(h.mode&1)===0?(h===g?h.flags|=65536:(h.flags|=128,C.flags|=131072,C.flags&=-52805,C.tag===1&&(C.alternate===null?C.tag=17:(g=Ai(-1,1),g.tag=2,ta(C,g,1))),C.lanes|=1),h):(h.flags|=65536,h.lanes=z,h)}var f3=_.ReactCurrentOwner,cn=!1;function Zr(h,g,C,R){g.child=h===null?g0(g,null,C,R):Is(g,h.child,C,R)}function X0(h,g,C,R,z){C=C.render;var G=g.ref;return Fs(g,z),R=ff(h,g,C,R,G,z),C=pf(),h!==null&&!cn?(g.updateQueue=h.updateQueue,g.flags&=-2053,h.lanes&=~z,Pi(h,g,z)):(ar&&C&&Kh(g),g.flags|=1,Zr(h,g,R,z),g.child)}function Q0(h,g,C,R,z){if(h===null){var G=C.type;return typeof G=="function"&&!Wf(G)&&G.defaultProps===void 0&&C.compare===null&&C.defaultProps===void 0?(g.tag=15,g.type=G,Z0(h,g,G,R,z)):(h=vc(C.type,null,R,g,g.mode,z),h.ref=g.ref,h.return=g,g.child=h)}if(G=h.child,(h.lanes&z)===0){var Z=G.memoizedProps;if(C=C.compare,C=C!==null?C:Go,C(Z,R)&&h.ref===g.ref)return Pi(h,g,z)}return g.flags|=1,h=oa(G,R),h.ref=g.ref,h.return=g,g.child=h}function Z0(h,g,C,R,z){if(h!==null){var G=h.memoizedProps;if(Go(G,R)&&h.ref===g.ref)if(cn=!1,g.pendingProps=R=G,(h.lanes&z)!==0)(h.flags&131072)!==0&&(cn=!0);else return g.lanes=h.lanes,Pi(h,g,z)}return _f(h,g,C,R,z)}function J0(h,g,C){var R=g.pendingProps,z=R.children,G=h!==null?h.memoizedState:null;if(R.mode==="hidden")if((g.mode&1)===0)g.memoizedState={baseLanes:0,cachePool:null,transitions:null},Zt(Us,_n),_n|=C;else{if((C&1073741824)===0)return h=G!==null?G.baseLanes|C:C,g.lanes=g.childLanes=1073741824,g.memoizedState={baseLanes:h,cachePool:null,transitions:null},g.updateQueue=null,Zt(Us,_n),_n|=h,null;g.memoizedState={baseLanes:0,cachePool:null,transitions:null},R=G!==null?G.baseLanes:C,Zt(Us,_n),_n|=R}else G!==null?(R=G.baseLanes|C,g.memoizedState=null):R=C,Zt(Us,_n),_n|=R;return Zr(h,g,z,C),g.child}function ex(h,g){var C=g.ref;(h===null&&C!==null||h!==null&&h.ref!==C)&&(g.flags|=512,g.flags|=2097152)}function _f(h,g,C,R,z){var G=un(C)?Ia:Hr.current;return G=Ps(g,G),Fs(g,z),C=ff(h,g,C,R,G,z),R=pf(),h!==null&&!cn?(g.updateQueue=h.updateQueue,g.flags&=-2053,h.lanes&=~z,Pi(h,g,z)):(ar&&R&&Kh(g),g.flags|=1,Zr(h,g,C,z),g.child)}function tx(h,g,C,R,z){if(un(C)){var G=!0;$u(g)}else G=!1;if(Fs(g,z),g.stateNode===null)ac(h,g),U0(g,C,R),bf(g,C,R,z),R=!0;else if(h===null){var Z=g.stateNode,oe=g.memoizedProps;Z.props=oe;var fe=Z.context,_e=C.contextType;typeof _e=="object"&&_e!==null?_e=Mn(_e):(_e=un(C)?Ia:Hr.current,_e=Ps(g,_e));var Fe=C.getDerivedStateFromProps,He=typeof Fe=="function"||typeof Z.getSnapshotBeforeUpdate=="function";He||typeof Z.UNSAFE_componentWillReceiveProps!="function"&&typeof Z.componentWillReceiveProps!="function"||(oe!==R||fe!==_e)&&W0(g,Z,R,_e),ea=!1;var Be=g.memoizedState;Z.state=Be,Xu(g,R,Z,z),fe=g.memoizedState,oe!==R||Be!==fe||ln.current||ea?(typeof Fe=="function"&&(xf(g,C,Fe,R),fe=g.memoizedState),(oe=ea||H0(g,C,oe,R,Be,fe,_e))?(He||typeof Z.UNSAFE_componentWillMount!="function"&&typeof Z.componentWillMount!="function"||(typeof Z.componentWillMount=="function"&&Z.componentWillMount(),typeof Z.UNSAFE_componentWillMount=="function"&&Z.UNSAFE_componentWillMount()),typeof Z.componentDidMount=="function"&&(g.flags|=4194308)):(typeof Z.componentDidMount=="function"&&(g.flags|=4194308),g.memoizedProps=R,g.memoizedState=fe),Z.props=R,Z.state=fe,Z.context=_e,R=oe):(typeof Z.componentDidMount=="function"&&(g.flags|=4194308),R=!1)}else{Z=g.stateNode,m0(h,g),oe=g.memoizedProps,_e=g.type===g.elementType?oe:Xn(g.type,oe),Z.props=_e,He=g.pendingProps,Be=Z.context,fe=C.contextType,typeof fe=="object"&&fe!==null?fe=Mn(fe):(fe=un(C)?Ia:Hr.current,fe=Ps(g,fe));var rt=C.getDerivedStateFromProps;(Fe=typeof rt=="function"||typeof Z.getSnapshotBeforeUpdate=="function")||typeof Z.UNSAFE_componentWillReceiveProps!="function"&&typeof Z.componentWillReceiveProps!="function"||(oe!==He||Be!==fe)&&W0(g,Z,R,fe),ea=!1,Be=g.memoizedState,Z.state=Be,Xu(g,R,Z,z);var at=g.memoizedState;oe!==He||Be!==at||ln.current||ea?(typeof rt=="function"&&(xf(g,C,rt,R),at=g.memoizedState),(_e=ea||H0(g,C,_e,R,Be,at,fe)||!1)?(Fe||typeof Z.UNSAFE_componentWillUpdate!="function"&&typeof Z.componentWillUpdate!="function"||(typeof Z.componentWillUpdate=="function"&&Z.componentWillUpdate(R,at,fe),typeof Z.UNSAFE_componentWillUpdate=="function"&&Z.UNSAFE_componentWillUpdate(R,at,fe)),typeof Z.componentDidUpdate=="function"&&(g.flags|=4),typeof Z.getSnapshotBeforeUpdate=="function"&&(g.flags|=1024)):(typeof Z.componentDidUpdate!="function"||oe===h.memoizedProps&&Be===h.memoizedState||(g.flags|=4),typeof Z.getSnapshotBeforeUpdate!="function"||oe===h.memoizedProps&&Be===h.memoizedState||(g.flags|=1024),g.memoizedProps=R,g.memoizedState=at),Z.props=R,Z.state=at,Z.context=fe,R=_e):(typeof Z.componentDidUpdate!="function"||oe===h.memoizedProps&&Be===h.memoizedState||(g.flags|=4),typeof Z.getSnapshotBeforeUpdate!="function"||oe===h.memoizedProps&&Be===h.memoizedState||(g.flags|=1024),R=!1)}return Cf(h,g,C,R,G,z)}function Cf(h,g,C,R,z,G){ex(h,g);var Z=(g.flags&128)!==0;if(!R&&!Z)return z&&s0(g,C,!1),Pi(h,g,G);R=g.stateNode,f3.current=g;var oe=Z&&typeof C.getDerivedStateFromError!="function"?null:R.render();return g.flags|=1,h!==null&&Z?(g.child=Is(g,h.child,null,G),g.child=Is(g,null,oe,G)):Zr(h,g,oe,G),g.memoizedState=R.state,z&&s0(g,C,!0),g.child}function rx(h){var g=h.stateNode;g.pendingContext?i0(h,g.pendingContext,g.pendingContext!==g.context):g.context&&i0(h,g.context,!1),of(h,g.containerInfo)}function nx(h,g,C,R,z){return js(),Jh(z),g.flags|=256,Zr(h,g,C,R),g.child}var kf={dehydrated:null,treeContext:null,retryLane:0};function Ef(h){return{baseLanes:h,cachePool:null,transitions:null}}function ix(h,g,C){var R=g.pendingProps,z=lr.current,G=!1,Z=(g.flags&128)!==0,oe;if((oe=Z)||(oe=h!==null&&h.memoizedState===null?!1:(z&2)!==0),oe?(G=!0,g.flags&=-129):(h===null||h.memoizedState!==null)&&(z|=1),Zt(lr,z&1),h===null)return Zh(g),h=g.memoizedState,h!==null&&(h=h.dehydrated,h!==null)?((g.mode&1)===0?g.lanes=1:h.data==="$!"?g.lanes=8:g.lanes=1073741824,null):(Z=R.children,h=R.fallback,G?(R=g.mode,G=g.child,Z={mode:"hidden",children:Z},(R&1)===0&&G!==null?(G.childLanes=0,G.pendingProps=Z):G=mc(Z,R,0,null),h=qa(h,R,C,null),G.return=g,h.return=g,G.sibling=h,g.child=G,g.child.memoizedState=Ef(C),g.memoizedState=kf,h):Tf(g,Z));if(z=h.memoizedState,z!==null&&(oe=z.dehydrated,oe!==null))return p3(h,g,Z,R,oe,z,C);if(G){G=R.fallback,Z=g.mode,z=h.child,oe=z.sibling;var fe={mode:"hidden",children:R.children};return(Z&1)===0&&g.child!==z?(R=g.child,R.childLanes=0,R.pendingProps=fe,g.deletions=null):(R=oa(z,fe),R.subtreeFlags=z.subtreeFlags&14680064),oe!==null?G=oa(oe,G):(G=qa(G,Z,C,null),G.flags|=2),G.return=g,R.return=g,R.sibling=G,g.child=R,R=G,G=g.child,Z=h.child.memoizedState,Z=Z===null?Ef(C):{baseLanes:Z.baseLanes|C,cachePool:null,transitions:Z.transitions},G.memoizedState=Z,G.childLanes=h.childLanes&~C,g.memoizedState=kf,R}return G=h.child,h=G.sibling,R=oa(G,{mode:"visible",children:R.children}),(g.mode&1)===0&&(R.lanes=C),R.return=g,R.sibling=null,h!==null&&(C=g.deletions,C===null?(g.deletions=[h],g.flags|=16):C.push(h)),g.child=R,g.memoizedState=null,R}function Tf(h,g){return g=mc({mode:"visible",children:g},h.mode,0,null),g.return=h,h.child=g}function ic(h,g,C,R){return R!==null&&Jh(R),Is(g,h.child,null,C),h=Tf(g,g.pendingProps.children),h.flags|=2,g.memoizedState=null,h}function p3(h,g,C,R,z,G,Z){if(C)return g.flags&256?(g.flags&=-257,R=wf(Error(r(422))),ic(h,g,Z,R)):g.memoizedState!==null?(g.child=h.child,g.flags|=128,null):(G=R.fallback,z=g.mode,R=mc({mode:"visible",children:R.children},z,0,null),G=qa(G,z,Z,null),G.flags|=2,R.return=g,G.return=g,R.sibling=G,g.child=R,(g.mode&1)!==0&&Is(g,h.child,null,Z),g.child.memoizedState=Ef(Z),g.memoizedState=kf,G);if((g.mode&1)===0)return ic(h,g,Z,null);if(z.data==="$!"){if(R=z.nextSibling&&z.nextSibling.dataset,R)var oe=R.dgst;return R=oe,G=Error(r(419)),R=wf(G,R,void 0),ic(h,g,Z,R)}if(oe=(Z&h.childLanes)!==0,cn||oe){if(R=Nr,R!==null){switch(Z&-Z){case 4:z=2;break;case 16:z=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:z=32;break;case 536870912:z=268435456;break;default:z=0}z=(z&(R.suspendedLanes|Z))!==0?0:z,z!==0&&z!==G.retryLane&&(G.retryLane=z,Di(h,z),Jn(R,h,z,-1))}return Uf(),R=wf(Error(r(421))),ic(h,g,Z,R)}return z.data==="$?"?(g.flags|=128,g.child=h.child,g=T3.bind(null,h),z._reactRetry=g,null):(h=G.treeContext,Sn=Xi(z.nextSibling),wn=g,ar=!0,Kn=null,h!==null&&(An[Pn++]=Ri,An[Pn++]=Li,An[Pn++]=Ba,Ri=h.id,Li=h.overflow,Ba=g),g=Tf(g,R.children),g.flags|=4096,g)}function ax(h,g,C){h.lanes|=g;var R=h.alternate;R!==null&&(R.lanes|=g),nf(h.return,g,C)}function Nf(h,g,C,R,z){var G=h.memoizedState;G===null?h.memoizedState={isBackwards:g,rendering:null,renderingStartTime:0,last:R,tail:C,tailMode:z}:(G.isBackwards=g,G.rendering=null,G.renderingStartTime=0,G.last=R,G.tail=C,G.tailMode=z)}function sx(h,g,C){var R=g.pendingProps,z=R.revealOrder,G=R.tail;if(Zr(h,g,R.children,C),R=lr.current,(R&2)!==0)R=R&1|2,g.flags|=128;else{if(h!==null&&(h.flags&128)!==0)e:for(h=g.child;h!==null;){if(h.tag===13)h.memoizedState!==null&&ax(h,C,g);else if(h.tag===19)ax(h,C,g);else if(h.child!==null){h.child.return=h,h=h.child;continue}if(h===g)break e;for(;h.sibling===null;){if(h.return===null||h.return===g)break e;h=h.return}h.sibling.return=h.return,h=h.sibling}R&=1}if(Zt(lr,R),(g.mode&1)===0)g.memoizedState=null;else switch(z){case"forwards":for(C=g.child,z=null;C!==null;)h=C.alternate,h!==null&&Qu(h)===null&&(z=C),C=C.sibling;C=z,C===null?(z=g.child,g.child=null):(z=C.sibling,C.sibling=null),Nf(g,!1,z,C,G);break;case"backwards":for(C=null,z=g.child,g.child=null;z!==null;){if(h=z.alternate,h!==null&&Qu(h)===null){g.child=z;break}h=z.sibling,z.sibling=C,C=z,z=h}Nf(g,!0,C,null,G);break;case"together":Nf(g,!1,null,null,void 0);break;default:g.memoizedState=null}return g.child}function ac(h,g){(g.mode&1)===0&&h!==null&&(h.alternate=null,g.alternate=null,g.flags|=2)}function Pi(h,g,C){if(h!==null&&(g.dependencies=h.dependencies),Ua|=g.lanes,(C&g.childLanes)===0)return null;if(h!==null&&g.child!==h.child)throw Error(r(153));if(g.child!==null){for(h=g.child,C=oa(h,h.pendingProps),g.child=C,C.return=g;h.sibling!==null;)h=h.sibling,C=C.sibling=oa(h,h.pendingProps),C.return=g;C.sibling=null}return g.child}function g3(h,g,C){switch(g.tag){case 3:rx(g),js();break;case 5:b0(g);break;case 1:un(g.type)&&$u(g);break;case 4:of(g,g.stateNode.containerInfo);break;case 10:var R=g.type._context,z=g.memoizedProps.value;Zt(qu,R._currentValue),R._currentValue=z;break;case 13:if(R=g.memoizedState,R!==null)return R.dehydrated!==null?(Zt(lr,lr.current&1),g.flags|=128,null):(C&g.child.childLanes)!==0?ix(h,g,C):(Zt(lr,lr.current&1),h=Pi(h,g,C),h!==null?h.sibling:null);Zt(lr,lr.current&1);break;case 19:if(R=(C&g.childLanes)!==0,(h.flags&128)!==0){if(R)return sx(h,g,C);g.flags|=128}if(z=g.memoizedState,z!==null&&(z.rendering=null,z.tail=null,z.lastEffect=null),Zt(lr,lr.current),R)break;return null;case 22:case 23:return g.lanes=0,J0(h,g,C)}return Pi(h,g,C)}var ox,Rf,lx,ux;ox=function(h,g){for(var C=g.child;C!==null;){if(C.tag===5||C.tag===6)h.appendChild(C.stateNode);else if(C.tag!==4&&C.child!==null){C.child.return=C,C=C.child;continue}if(C===g)break;for(;C.sibling===null;){if(C.return===null||C.return===g)return;C=C.return}C.sibling.return=C.return,C=C.sibling}},Rf=function(){},lx=function(h,g,C,R){var z=h.memoizedProps;if(z!==R){h=g.stateNode,$a(ci.current);var G=null;switch(C){case"input":z=pe(h,z),R=pe(h,R),G=[];break;case"select":z=P({},z,{value:void 0}),R=P({},R,{value:void 0}),G=[];break;case"textarea":z=ze(h,z),R=ze(h,R),G=[];break;default:typeof z.onClick!="function"&&typeof R.onClick=="function"&&(h.onclick=Bu)}he(C,R);var Z;C=null;for(_e in z)if(!R.hasOwnProperty(_e)&&z.hasOwnProperty(_e)&&z[_e]!=null)if(_e==="style"){var oe=z[_e];for(Z in oe)oe.hasOwnProperty(Z)&&(C||(C={}),C[Z]="")}else _e!=="dangerouslySetInnerHTML"&&_e!=="children"&&_e!=="suppressContentEditableWarning"&&_e!=="suppressHydrationWarning"&&_e!=="autoFocus"&&(i.hasOwnProperty(_e)?G||(G=[]):(G=G||[]).push(_e,null));for(_e in R){var fe=R[_e];if(oe=z!=null?z[_e]:void 0,R.hasOwnProperty(_e)&&fe!==oe&&(fe!=null||oe!=null))if(_e==="style")if(oe){for(Z in oe)!oe.hasOwnProperty(Z)||fe&&fe.hasOwnProperty(Z)||(C||(C={}),C[Z]="");for(Z in fe)fe.hasOwnProperty(Z)&&oe[Z]!==fe[Z]&&(C||(C={}),C[Z]=fe[Z])}else C||(G||(G=[]),G.push(_e,C)),C=fe;else _e==="dangerouslySetInnerHTML"?(fe=fe?fe.__html:void 0,oe=oe?oe.__html:void 0,fe!=null&&oe!==fe&&(G=G||[]).push(_e,fe)):_e==="children"?typeof fe!="string"&&typeof fe!="number"||(G=G||[]).push(_e,""+fe):_e!=="suppressContentEditableWarning"&&_e!=="suppressHydrationWarning"&&(i.hasOwnProperty(_e)?(fe!=null&&_e==="onScroll"&&tr("scroll",h),G||oe===fe||(G=[])):(G=G||[]).push(_e,fe))}C&&(G=G||[]).push("style",C);var _e=G;(g.updateQueue=_e)&&(g.flags|=4)}},ux=function(h,g,C,R){C!==R&&(g.flags|=4)};function ol(h,g){if(!ar)switch(h.tailMode){case"hidden":g=h.tail;for(var C=null;g!==null;)g.alternate!==null&&(C=g),g=g.sibling;C===null?h.tail=null:C.sibling=null;break;case"collapsed":C=h.tail;for(var R=null;C!==null;)C.alternate!==null&&(R=C),C=C.sibling;R===null?g||h.tail===null?h.tail=null:h.tail.sibling=null:R.sibling=null}}function Wr(h){var g=h.alternate!==null&&h.alternate.child===h.child,C=0,R=0;if(g)for(var z=h.child;z!==null;)C|=z.lanes|z.childLanes,R|=z.subtreeFlags&14680064,R|=z.flags&14680064,z.return=h,z=z.sibling;else for(z=h.child;z!==null;)C|=z.lanes|z.childLanes,R|=z.subtreeFlags,R|=z.flags,z.return=h,z=z.sibling;return h.subtreeFlags|=R,h.childLanes=C,g}function v3(h,g,C){var R=g.pendingProps;switch(Xh(g),g.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Wr(g),null;case 1:return un(g.type)&&zu(),Wr(g),null;case 3:return R=g.stateNode,zs(),rr(ln),rr(Hr),cf(),R.pendingContext&&(R.context=R.pendingContext,R.pendingContext=null),(h===null||h.child===null)&&(Vu(g)?g.flags|=4:h===null||h.memoizedState.isDehydrated&&(g.flags&256)===0||(g.flags|=1024,Kn!==null&&(zf(Kn),Kn=null))),Rf(h,g),Wr(g),null;case 5:lf(g);var z=$a(rl.current);if(C=g.type,h!==null&&g.stateNode!=null)lx(h,g,C,R,z),h.ref!==g.ref&&(g.flags|=512,g.flags|=2097152);else{if(!R){if(g.stateNode===null)throw Error(r(166));return Wr(g),null}if(h=$a(ci.current),Vu(g)){R=g.stateNode,C=g.type;var G=g.memoizedProps;switch(R[ui]=g,R[Qo]=G,h=(g.mode&1)!==0,C){case"dialog":tr("cancel",R),tr("close",R);break;case"iframe":case"object":case"embed":tr("load",R);break;case"video":case"audio":for(z=0;z<Yo.length;z++)tr(Yo[z],R);break;case"source":tr("error",R);break;case"img":case"image":case"link":tr("error",R),tr("load",R);break;case"details":tr("toggle",R);break;case"input":Le(R,G),tr("invalid",R);break;case"select":R._wrapperState={wasMultiple:!!G.multiple},tr("invalid",R);break;case"textarea":Ie(R,G),tr("invalid",R)}he(C,G),z=null;for(var Z in G)if(G.hasOwnProperty(Z)){var oe=G[Z];Z==="children"?typeof oe=="string"?R.textContent!==oe&&(G.suppressHydrationWarning!==!0&&Iu(R.textContent,oe,h),z=["children",oe]):typeof oe=="number"&&R.textContent!==""+oe&&(G.suppressHydrationWarning!==!0&&Iu(R.textContent,oe,h),z=["children",""+oe]):i.hasOwnProperty(Z)&&oe!=null&&Z==="onScroll"&&tr("scroll",R)}switch(C){case"input":te(R),Te(R,G,!0);break;case"textarea":te(R),Ge(R);break;case"select":case"option":break;default:typeof G.onClick=="function"&&(R.onclick=Bu)}R=z,g.updateQueue=R,R!==null&&(g.flags|=4)}else{Z=z.nodeType===9?z:z.ownerDocument,h==="http://www.w3.org/1999/xhtml"&&(h=ve(C)),h==="http://www.w3.org/1999/xhtml"?C==="script"?(h=Z.createElement("div"),h.innerHTML="<script><\/script>",h=h.removeChild(h.firstChild)):typeof R.is=="string"?h=Z.createElement(C,{is:R.is}):(h=Z.createElement(C),C==="select"&&(Z=h,R.multiple?Z.multiple=!0:R.size&&(Z.size=R.size))):h=Z.createElementNS(h,C),h[ui]=g,h[Qo]=R,ox(h,g,!1,!1),g.stateNode=h;e:{switch(Z=de(C,R),C){case"dialog":tr("cancel",h),tr("close",h),z=R;break;case"iframe":case"object":case"embed":tr("load",h),z=R;break;case"video":case"audio":for(z=0;z<Yo.length;z++)tr(Yo[z],h);z=R;break;case"source":tr("error",h),z=R;break;case"img":case"image":case"link":tr("error",h),tr("load",h),z=R;break;case"details":tr("toggle",h),z=R;break;case"input":Le(h,R),z=pe(h,R),tr("invalid",h);break;case"option":z=R;break;case"select":h._wrapperState={wasMultiple:!!R.multiple},z=P({},R,{value:void 0}),tr("invalid",h);break;case"textarea":Ie(h,R),z=ze(h,R),tr("invalid",h);break;default:z=R}he(C,z),oe=z;for(G in oe)if(oe.hasOwnProperty(G)){var fe=oe[G];G==="style"?ce(h,fe):G==="dangerouslySetInnerHTML"?(fe=fe?fe.__html:void 0,fe!=null&&ye(h,fe)):G==="children"?typeof fe=="string"?(C!=="textarea"||fe!=="")&&ee(h,fe):typeof fe=="number"&&ee(h,""+fe):G!=="suppressContentEditableWarning"&&G!=="suppressHydrationWarning"&&G!=="autoFocus"&&(i.hasOwnProperty(G)?fe!=null&&G==="onScroll"&&tr("scroll",h):fe!=null&&w(h,G,fe,Z))}switch(C){case"input":te(h),Te(h,R,!1);break;case"textarea":te(h),Ge(h);break;case"option":R.value!=null&&h.setAttribute("value",""+q(R.value));break;case"select":h.multiple=!!R.multiple,G=R.value,G!=null?Pe(h,!!R.multiple,G,!1):R.defaultValue!=null&&Pe(h,!!R.multiple,R.defaultValue,!0);break;default:typeof z.onClick=="function"&&(h.onclick=Bu)}switch(C){case"button":case"input":case"select":case"textarea":R=!!R.autoFocus;break e;case"img":R=!0;break e;default:R=!1}}R&&(g.flags|=4)}g.ref!==null&&(g.flags|=512,g.flags|=2097152)}return Wr(g),null;case 6:if(h&&g.stateNode!=null)ux(h,g,h.memoizedProps,R);else{if(typeof R!="string"&&g.stateNode===null)throw Error(r(166));if(C=$a(rl.current),$a(ci.current),Vu(g)){if(R=g.stateNode,C=g.memoizedProps,R[ui]=g,(G=R.nodeValue!==C)&&(h=wn,h!==null))switch(h.tag){case 3:Iu(R.nodeValue,C,(h.mode&1)!==0);break;case 5:h.memoizedProps.suppressHydrationWarning!==!0&&Iu(R.nodeValue,C,(h.mode&1)!==0)}G&&(g.flags|=4)}else R=(C.nodeType===9?C:C.ownerDocument).createTextNode(R),R[ui]=g,g.stateNode=R}return Wr(g),null;case 13:if(rr(lr),R=g.memoizedState,h===null||h.memoizedState!==null&&h.memoizedState.dehydrated!==null){if(ar&&Sn!==null&&(g.mode&1)!==0&&(g.flags&128)===0)h0(),js(),g.flags|=98560,G=!1;else if(G=Vu(g),R!==null&&R.dehydrated!==null){if(h===null){if(!G)throw Error(r(318));if(G=g.memoizedState,G=G!==null?G.dehydrated:null,!G)throw Error(r(317));G[ui]=g}else js(),(g.flags&128)===0&&(g.memoizedState=null),g.flags|=4;Wr(g),G=!1}else Kn!==null&&(zf(Kn),Kn=null),G=!0;if(!G)return g.flags&65536?g:null}return(g.flags&128)!==0?(g.lanes=C,g):(R=R!==null,R!==(h!==null&&h.memoizedState!==null)&&R&&(g.child.flags|=8192,(g.mode&1)!==0&&(h===null||(lr.current&1)!==0?Sr===0&&(Sr=3):Uf())),g.updateQueue!==null&&(g.flags|=4),Wr(g),null);case 4:return zs(),Rf(h,g),h===null&&Ko(g.stateNode.containerInfo),Wr(g),null;case 10:return rf(g.type._context),Wr(g),null;case 17:return un(g.type)&&zu(),Wr(g),null;case 19:if(rr(lr),G=g.memoizedState,G===null)return Wr(g),null;if(R=(g.flags&128)!==0,Z=G.rendering,Z===null)if(R)ol(G,!1);else{if(Sr!==0||h!==null&&(h.flags&128)!==0)for(h=g.child;h!==null;){if(Z=Qu(h),Z!==null){for(g.flags|=128,ol(G,!1),R=Z.updateQueue,R!==null&&(g.updateQueue=R,g.flags|=4),g.subtreeFlags=0,R=C,C=g.child;C!==null;)G=C,h=R,G.flags&=14680066,Z=G.alternate,Z===null?(G.childLanes=0,G.lanes=h,G.child=null,G.subtreeFlags=0,G.memoizedProps=null,G.memoizedState=null,G.updateQueue=null,G.dependencies=null,G.stateNode=null):(G.childLanes=Z.childLanes,G.lanes=Z.lanes,G.child=Z.child,G.subtreeFlags=0,G.deletions=null,G.memoizedProps=Z.memoizedProps,G.memoizedState=Z.memoizedState,G.updateQueue=Z.updateQueue,G.type=Z.type,h=Z.dependencies,G.dependencies=h===null?null:{lanes:h.lanes,firstContext:h.firstContext}),C=C.sibling;return Zt(lr,lr.current&1|2),g.child}h=h.sibling}G.tail!==null&&Gt()>Ws&&(g.flags|=128,R=!0,ol(G,!1),g.lanes=4194304)}else{if(!R)if(h=Qu(Z),h!==null){if(g.flags|=128,R=!0,C=h.updateQueue,C!==null&&(g.updateQueue=C,g.flags|=4),ol(G,!0),G.tail===null&&G.tailMode==="hidden"&&!Z.alternate&&!ar)return Wr(g),null}else 2*Gt()-G.renderingStartTime>Ws&&C!==1073741824&&(g.flags|=128,R=!0,ol(G,!1),g.lanes=4194304);G.isBackwards?(Z.sibling=g.child,g.child=Z):(C=G.last,C!==null?C.sibling=Z:g.child=Z,G.last=Z)}return G.tail!==null?(g=G.tail,G.rendering=g,G.tail=g.sibling,G.renderingStartTime=Gt(),g.sibling=null,C=lr.current,Zt(lr,R?C&1|2:C&1),g):(Wr(g),null);case 22:case 23:return Hf(),R=g.memoizedState!==null,h!==null&&h.memoizedState!==null!==R&&(g.flags|=8192),R&&(g.mode&1)!==0?(_n&1073741824)!==0&&(Wr(g),g.subtreeFlags&6&&(g.flags|=8192)):Wr(g),null;case 24:return null;case 25:return null}throw Error(r(156,g.tag))}function m3(h,g){switch(Xh(g),g.tag){case 1:return un(g.type)&&zu(),h=g.flags,h&65536?(g.flags=h&-65537|128,g):null;case 3:return zs(),rr(ln),rr(Hr),cf(),h=g.flags,(h&65536)!==0&&(h&128)===0?(g.flags=h&-65537|128,g):null;case 5:return lf(g),null;case 13:if(rr(lr),h=g.memoizedState,h!==null&&h.dehydrated!==null){if(g.alternate===null)throw Error(r(340));js()}return h=g.flags,h&65536?(g.flags=h&-65537|128,g):null;case 19:return rr(lr),null;case 4:return zs(),null;case 10:return rf(g.type._context),null;case 22:case 23:return Hf(),null;case 24:return null;default:return null}}var sc=!1,Vr=!1,y3=typeof WeakSet=="function"?WeakSet:Set,nt=null;function Hs(h,g){var C=h.ref;if(C!==null)if(typeof C=="function")try{C(null)}catch(R){hr(h,g,R)}else C.current=null}function Lf(h,g,C){try{C()}catch(R){hr(h,g,R)}}var cx=!1;function x3(h,g){if($h=Eu,h=Hy(),Ph(h)){if("selectionStart"in h)var C={start:h.selectionStart,end:h.selectionEnd};else e:{C=(C=h.ownerDocument)&&C.defaultView||window;var R=C.getSelection&&C.getSelection();if(R&&R.rangeCount!==0){C=R.anchorNode;var z=R.anchorOffset,G=R.focusNode;R=R.focusOffset;try{C.nodeType,G.nodeType}catch{C=null;break e}var Z=0,oe=-1,fe=-1,_e=0,Fe=0,He=h,Be=null;t:for(;;){for(var rt;He!==C||z!==0&&He.nodeType!==3||(oe=Z+z),He!==G||R!==0&&He.nodeType!==3||(fe=Z+R),He.nodeType===3&&(Z+=He.nodeValue.length),(rt=He.firstChild)!==null;)Be=He,He=rt;for(;;){if(He===h)break t;if(Be===C&&++_e===z&&(oe=Z),Be===G&&++Fe===R&&(fe=Z),(rt=He.nextSibling)!==null)break;He=Be,Be=He.parentNode}He=rt}C=oe===-1||fe===-1?null:{start:oe,end:fe}}else C=null}C=C||{start:0,end:0}}else C=null;for(Hh={focusedElem:h,selectionRange:C},Eu=!1,nt=g;nt!==null;)if(g=nt,h=g.child,(g.subtreeFlags&1028)!==0&&h!==null)h.return=g,nt=h;else for(;nt!==null;){g=nt;try{var at=g.alternate;if((g.flags&1024)!==0)switch(g.tag){case 0:case 11:case 15:break;case 1:if(at!==null){var ot=at.memoizedProps,pr=at.memoizedState,xe=g.stateNode,ge=xe.getSnapshotBeforeUpdate(g.elementType===g.type?ot:Xn(g.type,ot),pr);xe.__reactInternalSnapshotBeforeUpdate=ge}break;case 3:var we=g.stateNode.containerInfo;we.nodeType===1?we.textContent="":we.nodeType===9&&we.documentElement&&we.removeChild(we.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(Ve){hr(g,g.return,Ve)}if(h=g.sibling,h!==null){h.return=g.return,nt=h;break}nt=g.return}return at=cx,cx=!1,at}function ll(h,g,C){var R=g.updateQueue;if(R=R!==null?R.lastEffect:null,R!==null){var z=R=R.next;do{if((z.tag&h)===h){var G=z.destroy;z.destroy=void 0,G!==void 0&&Lf(g,C,G)}z=z.next}while(z!==R)}}function oc(h,g){if(g=g.updateQueue,g=g!==null?g.lastEffect:null,g!==null){var C=g=g.next;do{if((C.tag&h)===h){var R=C.create;C.destroy=R()}C=C.next}while(C!==g)}}function Df(h){var g=h.ref;if(g!==null){var C=h.stateNode;switch(h.tag){case 5:h=C;break;default:h=C}typeof g=="function"?g(h):g.current=h}}function dx(h){var g=h.alternate;g!==null&&(h.alternate=null,dx(g)),h.child=null,h.deletions=null,h.sibling=null,h.tag===5&&(g=h.stateNode,g!==null&&(delete g[ui],delete g[Qo],delete g[Gh],delete g[t3],delete g[r3])),h.stateNode=null,h.return=null,h.dependencies=null,h.memoizedProps=null,h.memoizedState=null,h.pendingProps=null,h.stateNode=null,h.updateQueue=null}function hx(h){return h.tag===5||h.tag===3||h.tag===4}function fx(h){e:for(;;){for(;h.sibling===null;){if(h.return===null||hx(h.return))return null;h=h.return}for(h.sibling.return=h.return,h=h.sibling;h.tag!==5&&h.tag!==6&&h.tag!==18;){if(h.flags&2||h.child===null||h.tag===4)continue e;h.child.return=h,h=h.child}if(!(h.flags&2))return h.stateNode}}function Af(h,g,C){var R=h.tag;if(R===5||R===6)h=h.stateNode,g?C.nodeType===8?C.parentNode.insertBefore(h,g):C.insertBefore(h,g):(C.nodeType===8?(g=C.parentNode,g.insertBefore(h,C)):(g=C,g.appendChild(h)),C=C._reactRootContainer,C!=null||g.onclick!==null||(g.onclick=Bu));else if(R!==4&&(h=h.child,h!==null))for(Af(h,g,C),h=h.sibling;h!==null;)Af(h,g,C),h=h.sibling}function Pf(h,g,C){var R=h.tag;if(R===5||R===6)h=h.stateNode,g?C.insertBefore(h,g):C.appendChild(h);else if(R!==4&&(h=h.child,h!==null))for(Pf(h,g,C),h=h.sibling;h!==null;)Pf(h,g,C),h=h.sibling}var Mr=null,Qn=!1;function ra(h,g,C){for(C=C.child;C!==null;)px(h,g,C),C=C.sibling}function px(h,g,C){if(dt&&typeof dt.onCommitFiberUnmount=="function")try{dt.onCommitFiberUnmount(Nt,C)}catch{}switch(C.tag){case 5:Vr||Hs(C,g);case 6:var R=Mr,z=Qn;Mr=null,ra(h,g,C),Mr=R,Qn=z,Mr!==null&&(Qn?(h=Mr,C=C.stateNode,h.nodeType===8?h.parentNode.removeChild(C):h.removeChild(C)):Mr.removeChild(C.stateNode));break;case 18:Mr!==null&&(Qn?(h=Mr,C=C.stateNode,h.nodeType===8?Vh(h.parentNode,C):h.nodeType===1&&Vh(h,C),zo(h)):Vh(Mr,C.stateNode));break;case 4:R=Mr,z=Qn,Mr=C.stateNode.containerInfo,Qn=!0,ra(h,g,C),Mr=R,Qn=z;break;case 0:case 11:case 14:case 15:if(!Vr&&(R=C.updateQueue,R!==null&&(R=R.lastEffect,R!==null))){z=R=R.next;do{var G=z,Z=G.destroy;G=G.tag,Z!==void 0&&((G&2)!==0||(G&4)!==0)&&Lf(C,g,Z),z=z.next}while(z!==R)}ra(h,g,C);break;case 1:if(!Vr&&(Hs(C,g),R=C.stateNode,typeof R.componentWillUnmount=="function"))try{R.props=C.memoizedProps,R.state=C.memoizedState,R.componentWillUnmount()}catch(oe){hr(C,g,oe)}ra(h,g,C);break;case 21:ra(h,g,C);break;case 22:C.mode&1?(Vr=(R=Vr)||C.memoizedState!==null,ra(h,g,C),Vr=R):ra(h,g,C);break;default:ra(h,g,C)}}function gx(h){var g=h.updateQueue;if(g!==null){h.updateQueue=null;var C=h.stateNode;C===null&&(C=h.stateNode=new y3),g.forEach(function(R){var z=N3.bind(null,h,R);C.has(R)||(C.add(R),R.then(z,z))})}}function Zn(h,g){var C=g.deletions;if(C!==null)for(var R=0;R<C.length;R++){var z=C[R];try{var G=h,Z=g,oe=Z;e:for(;oe!==null;){switch(oe.tag){case 5:Mr=oe.stateNode,Qn=!1;break e;case 3:Mr=oe.stateNode.containerInfo,Qn=!0;break e;case 4:Mr=oe.stateNode.containerInfo,Qn=!0;break e}oe=oe.return}if(Mr===null)throw Error(r(160));px(G,Z,z),Mr=null,Qn=!1;var fe=z.alternate;fe!==null&&(fe.return=null),z.return=null}catch(_e){hr(z,g,_e)}}if(g.subtreeFlags&12854)for(g=g.child;g!==null;)vx(g,h),g=g.sibling}function vx(h,g){var C=h.alternate,R=h.flags;switch(h.tag){case 0:case 11:case 14:case 15:if(Zn(g,h),hi(h),R&4){try{ll(3,h,h.return),oc(3,h)}catch(ot){hr(h,h.return,ot)}try{ll(5,h,h.return)}catch(ot){hr(h,h.return,ot)}}break;case 1:Zn(g,h),hi(h),R&512&&C!==null&&Hs(C,C.return);break;case 5:if(Zn(g,h),hi(h),R&512&&C!==null&&Hs(C,C.return),h.flags&32){var z=h.stateNode;try{ee(z,"")}catch(ot){hr(h,h.return,ot)}}if(R&4&&(z=h.stateNode,z!=null)){var G=h.memoizedProps,Z=C!==null?C.memoizedProps:G,oe=h.type,fe=h.updateQueue;if(h.updateQueue=null,fe!==null)try{oe==="input"&&G.type==="radio"&&G.name!=null&&je(z,G),de(oe,Z);var _e=de(oe,G);for(Z=0;Z<fe.length;Z+=2){var Fe=fe[Z],He=fe[Z+1];Fe==="style"?ce(z,He):Fe==="dangerouslySetInnerHTML"?ye(z,He):Fe==="children"?ee(z,He):w(z,Fe,He,_e)}switch(oe){case"input":Se(z,G);break;case"textarea":$e(z,G);break;case"select":var Be=z._wrapperState.wasMultiple;z._wrapperState.wasMultiple=!!G.multiple;var rt=G.value;rt!=null?Pe(z,!!G.multiple,rt,!1):Be!==!!G.multiple&&(G.defaultValue!=null?Pe(z,!!G.multiple,G.defaultValue,!0):Pe(z,!!G.multiple,G.multiple?[]:"",!1))}z[Qo]=G}catch(ot){hr(h,h.return,ot)}}break;case 6:if(Zn(g,h),hi(h),R&4){if(h.stateNode===null)throw Error(r(162));z=h.stateNode,G=h.memoizedProps;try{z.nodeValue=G}catch(ot){hr(h,h.return,ot)}}break;case 3:if(Zn(g,h),hi(h),R&4&&C!==null&&C.memoizedState.isDehydrated)try{zo(g.containerInfo)}catch(ot){hr(h,h.return,ot)}break;case 4:Zn(g,h),hi(h);break;case 13:Zn(g,h),hi(h),z=h.child,z.flags&8192&&(G=z.memoizedState!==null,z.stateNode.isHidden=G,!G||z.alternate!==null&&z.alternate.memoizedState!==null||(jf=Gt())),R&4&&gx(h);break;case 22:if(Fe=C!==null&&C.memoizedState!==null,h.mode&1?(Vr=(_e=Vr)||Fe,Zn(g,h),Vr=_e):Zn(g,h),hi(h),R&8192){if(_e=h.memoizedState!==null,(h.stateNode.isHidden=_e)&&!Fe&&(h.mode&1)!==0)for(nt=h,Fe=h.child;Fe!==null;){for(He=nt=Fe;nt!==null;){switch(Be=nt,rt=Be.child,Be.tag){case 0:case 11:case 14:case 15:ll(4,Be,Be.return);break;case 1:Hs(Be,Be.return);var at=Be.stateNode;if(typeof at.componentWillUnmount=="function"){R=Be,C=Be.return;try{g=R,at.props=g.memoizedProps,at.state=g.memoizedState,at.componentWillUnmount()}catch(ot){hr(R,C,ot)}}break;case 5:Hs(Be,Be.return);break;case 22:if(Be.memoizedState!==null){xx(He);continue}}rt!==null?(rt.return=Be,nt=rt):xx(He)}Fe=Fe.sibling}e:for(Fe=null,He=h;;){if(He.tag===5){if(Fe===null){Fe=He;try{z=He.stateNode,_e?(G=z.style,typeof G.setProperty=="function"?G.setProperty("display","none","important"):G.display="none"):(oe=He.stateNode,fe=He.memoizedProps.style,Z=fe!=null&&fe.hasOwnProperty("display")?fe.display:null,oe.style.display=se("display",Z))}catch(ot){hr(h,h.return,ot)}}}else if(He.tag===6){if(Fe===null)try{He.stateNode.nodeValue=_e?"":He.memoizedProps}catch(ot){hr(h,h.return,ot)}}else if((He.tag!==22&&He.tag!==23||He.memoizedState===null||He===h)&&He.child!==null){He.child.return=He,He=He.child;continue}if(He===h)break e;for(;He.sibling===null;){if(He.return===null||He.return===h)break e;Fe===He&&(Fe=null),He=He.return}Fe===He&&(Fe=null),He.sibling.return=He.return,He=He.sibling}}break;case 19:Zn(g,h),hi(h),R&4&&gx(h);break;case 21:break;default:Zn(g,h),hi(h)}}function hi(h){var g=h.flags;if(g&2){try{e:{for(var C=h.return;C!==null;){if(hx(C)){var R=C;break e}C=C.return}throw Error(r(160))}switch(R.tag){case 5:var z=R.stateNode;R.flags&32&&(ee(z,""),R.flags&=-33);var G=fx(h);Pf(h,G,z);break;case 3:case 4:var Z=R.stateNode.containerInfo,oe=fx(h);Af(h,oe,Z);break;default:throw Error(r(161))}}catch(fe){hr(h,h.return,fe)}h.flags&=-3}g&4096&&(h.flags&=-4097)}function b3(h,g,C){nt=h,mx(h)}function mx(h,g,C){for(var R=(h.mode&1)!==0;nt!==null;){var z=nt,G=z.child;if(z.tag===22&&R){var Z=z.memoizedState!==null||sc;if(!Z){var oe=z.alternate,fe=oe!==null&&oe.memoizedState!==null||Vr;oe=sc;var _e=Vr;if(sc=Z,(Vr=fe)&&!_e)for(nt=z;nt!==null;)Z=nt,fe=Z.child,Z.tag===22&&Z.memoizedState!==null?bx(z):fe!==null?(fe.return=Z,nt=fe):bx(z);for(;G!==null;)nt=G,mx(G),G=G.sibling;nt=z,sc=oe,Vr=_e}yx(h)}else(z.subtreeFlags&8772)!==0&&G!==null?(G.return=z,nt=G):yx(h)}}function yx(h){for(;nt!==null;){var g=nt;if((g.flags&8772)!==0){var C=g.alternate;try{if((g.flags&8772)!==0)switch(g.tag){case 0:case 11:case 15:Vr||oc(5,g);break;case 1:var R=g.stateNode;if(g.flags&4&&!Vr)if(C===null)R.componentDidMount();else{var z=g.elementType===g.type?C.memoizedProps:Xn(g.type,C.memoizedProps);R.componentDidUpdate(z,C.memoizedState,R.__reactInternalSnapshotBeforeUpdate)}var G=g.updateQueue;G!==null&&x0(g,G,R);break;case 3:var Z=g.updateQueue;if(Z!==null){if(C=null,g.child!==null)switch(g.child.tag){case 5:C=g.child.stateNode;break;case 1:C=g.child.stateNode}x0(g,Z,C)}break;case 5:var oe=g.stateNode;if(C===null&&g.flags&4){C=oe;var fe=g.memoizedProps;switch(g.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(g.memoizedState===null){var _e=g.alternate;if(_e!==null){var Fe=_e.memoizedState;if(Fe!==null){var He=Fe.dehydrated;He!==null&&zo(He)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}Vr||g.flags&512&&Df(g)}catch(Be){hr(g,g.return,Be)}}if(g===h){nt=null;break}if(C=g.sibling,C!==null){C.return=g.return,nt=C;break}nt=g.return}}function xx(h){for(;nt!==null;){var g=nt;if(g===h){nt=null;break}var C=g.sibling;if(C!==null){C.return=g.return,nt=C;break}nt=g.return}}function bx(h){for(;nt!==null;){var g=nt;try{switch(g.tag){case 0:case 11:case 15:var C=g.return;try{oc(4,g)}catch(fe){hr(g,C,fe)}break;case 1:var R=g.stateNode;if(typeof R.componentDidMount=="function"){var z=g.return;try{R.componentDidMount()}catch(fe){hr(g,z,fe)}}var G=g.return;try{Df(g)}catch(fe){hr(g,G,fe)}break;case 5:var Z=g.return;try{Df(g)}catch(fe){hr(g,Z,fe)}}}catch(fe){hr(g,g.return,fe)}if(g===h){nt=null;break}var oe=g.sibling;if(oe!==null){oe.return=g.return,nt=oe;break}nt=g.return}}var w3=Math.ceil,lc=_.ReactCurrentDispatcher,Mf=_.ReactCurrentOwner,jn=_.ReactCurrentBatchConfig,Pt=0,Nr=null,mr=null,Or=0,_n=0,Us=Qi(0),Sr=0,ul=null,Ua=0,uc=0,Of=0,cl=null,dn=null,jf=0,Ws=1/0,Mi=null,cc=!1,If=null,na=null,dc=!1,ia=null,hc=0,dl=0,Bf=null,fc=-1,pc=0;function Jr(){return(Pt&6)!==0?Gt():fc!==-1?fc:fc=Gt()}function aa(h){return(h.mode&1)===0?1:(Pt&2)!==0&&Or!==0?Or&-Or:i3.transition!==null?(pc===0&&(pc=fy()),pc):(h=Ut,h!==0||(h=window.event,h=h===void 0?16:Sy(h.type)),h)}function Jn(h,g,C,R){if(50<dl)throw dl=0,Bf=null,Error(r(185));Oo(h,C,R),((Pt&2)===0||h!==Nr)&&(h===Nr&&((Pt&2)===0&&(uc|=C),Sr===4&&sa(h,Or)),hn(h,R),C===1&&Pt===0&&(g.mode&1)===0&&(Ws=Gt()+500,Hu&&Ji()))}function hn(h,g){var C=h.callbackNode;iE(h,g);var R=_u(h,h===Nr?Or:0);if(R===0)C!==null&&Pa(C),h.callbackNode=null,h.callbackPriority=0;else if(g=R&-R,h.callbackPriority!==g){if(C!=null&&Pa(C),g===1)h.tag===0?n3(Sx.bind(null,h)):o0(Sx.bind(null,h)),JE(function(){(Pt&6)===0&&Ji()}),C=null;else{switch(py(R)){case 1:C=qn;break;case 4:C=oi;break;case 16:C=li;break;case 536870912:C=Oa;break;default:C=li}C=Lx(C,wx.bind(null,h))}h.callbackPriority=g,h.callbackNode=C}}function wx(h,g){if(fc=-1,pc=0,(Pt&6)!==0)throw Error(r(327));var C=h.callbackNode;if(Vs()&&h.callbackNode!==C)return null;var R=_u(h,h===Nr?Or:0);if(R===0)return null;if((R&30)!==0||(R&h.expiredLanes)!==0||g)g=gc(h,R);else{g=R;var z=Pt;Pt|=2;var G=Cx();(Nr!==h||Or!==g)&&(Mi=null,Ws=Gt()+500,Va(h,g));do try{C3();break}catch(oe){_x(h,oe)}while(!0);tf(),lc.current=G,Pt=z,mr!==null?g=0:(Nr=null,Or=0,g=Sr)}if(g!==0){if(g===2&&(z=mh(h),z!==0&&(R=z,g=Ff(h,z))),g===1)throw C=ul,Va(h,0),sa(h,R),hn(h,Gt()),C;if(g===6)sa(h,R);else{if(z=h.current.alternate,(R&30)===0&&!S3(z)&&(g=gc(h,R),g===2&&(G=mh(h),G!==0&&(R=G,g=Ff(h,G))),g===1))throw C=ul,Va(h,0),sa(h,R),hn(h,Gt()),C;switch(h.finishedWork=z,h.finishedLanes=R,g){case 0:case 1:throw Error(r(345));case 2:Ga(h,dn,Mi);break;case 3:if(sa(h,R),(R&130023424)===R&&(g=jf+500-Gt(),10<g)){if(_u(h,0)!==0)break;if(z=h.suspendedLanes,(z&R)!==R){Jr(),h.pingedLanes|=h.suspendedLanes&z;break}h.timeoutHandle=Wh(Ga.bind(null,h,dn,Mi),g);break}Ga(h,dn,Mi);break;case 4:if(sa(h,R),(R&4194240)===R)break;for(g=h.eventTimes,z=-1;0<R;){var Z=31-Xt(R);G=1<<Z,Z=g[Z],Z>z&&(z=Z),R&=~G}if(R=z,R=Gt()-R,R=(120>R?120:480>R?480:1080>R?1080:1920>R?1920:3e3>R?3e3:4320>R?4320:1960*w3(R/1960))-R,10<R){h.timeoutHandle=Wh(Ga.bind(null,h,dn,Mi),R);break}Ga(h,dn,Mi);break;case 5:Ga(h,dn,Mi);break;default:throw Error(r(329))}}}return hn(h,Gt()),h.callbackNode===C?wx.bind(null,h):null}function Ff(h,g){var C=cl;return h.current.memoizedState.isDehydrated&&(Va(h,g).flags|=256),h=gc(h,g),h!==2&&(g=dn,dn=C,g!==null&&zf(g)),h}function zf(h){dn===null?dn=h:dn.push.apply(dn,h)}function S3(h){for(var g=h;;){if(g.flags&16384){var C=g.updateQueue;if(C!==null&&(C=C.stores,C!==null))for(var R=0;R<C.length;R++){var z=C[R],G=z.getSnapshot;z=z.value;try{if(!Yn(G(),z))return!1}catch{return!1}}}if(C=g.child,g.subtreeFlags&16384&&C!==null)C.return=g,g=C;else{if(g===h)break;for(;g.sibling===null;){if(g.return===null||g.return===h)return!0;g=g.return}g.sibling.return=g.return,g=g.sibling}}return!0}function sa(h,g){for(g&=~Of,g&=~uc,h.suspendedLanes|=g,h.pingedLanes&=~g,h=h.expirationTimes;0<g;){var C=31-Xt(g),R=1<<C;h[C]=-1,g&=~R}}function Sx(h){if((Pt&6)!==0)throw Error(r(327));Vs();var g=_u(h,0);if((g&1)===0)return hn(h,Gt()),null;var C=gc(h,g);if(h.tag!==0&&C===2){var R=mh(h);R!==0&&(g=R,C=Ff(h,R))}if(C===1)throw C=ul,Va(h,0),sa(h,g),hn(h,Gt()),C;if(C===6)throw Error(r(345));return h.finishedWork=h.current.alternate,h.finishedLanes=g,Ga(h,dn,Mi),hn(h,Gt()),null}function $f(h,g){var C=Pt;Pt|=1;try{return h(g)}finally{Pt=C,Pt===0&&(Ws=Gt()+500,Hu&&Ji())}}function Wa(h){ia!==null&&ia.tag===0&&(Pt&6)===0&&Vs();var g=Pt;Pt|=1;var C=jn.transition,R=Ut;try{if(jn.transition=null,Ut=1,h)return h()}finally{Ut=R,jn.transition=C,Pt=g,(Pt&6)===0&&Ji()}}function Hf(){_n=Us.current,rr(Us)}function Va(h,g){h.finishedWork=null,h.finishedLanes=0;var C=h.timeoutHandle;if(C!==-1&&(h.timeoutHandle=-1,ZE(C)),mr!==null)for(C=mr.return;C!==null;){var R=C;switch(Xh(R),R.tag){case 1:R=R.type.childContextTypes,R!=null&&zu();break;case 3:zs(),rr(ln),rr(Hr),cf();break;case 5:lf(R);break;case 4:zs();break;case 13:rr(lr);break;case 19:rr(lr);break;case 10:rf(R.type._context);break;case 22:case 23:Hf()}C=C.return}if(Nr=h,mr=h=oa(h.current,null),Or=_n=g,Sr=0,ul=null,Of=uc=Ua=0,dn=cl=null,za!==null){for(g=0;g<za.length;g++)if(C=za[g],R=C.interleaved,R!==null){C.interleaved=null;var z=R.next,G=C.pending;if(G!==null){var Z=G.next;G.next=z,R.next=Z}C.pending=R}za=null}return h}function _x(h,g){do{var C=mr;try{if(tf(),Zu.current=rc,Ju){for(var R=ur.memoizedState;R!==null;){var z=R.queue;z!==null&&(z.pending=null),R=R.next}Ju=!1}if(Ha=0,Tr=wr=ur=null,nl=!1,il=0,Mf.current=null,C===null||C.return===null){Sr=1,ul=g,mr=null;break}e:{var G=h,Z=C.return,oe=C,fe=g;if(g=Or,oe.flags|=32768,fe!==null&&typeof fe=="object"&&typeof fe.then=="function"){var _e=fe,Fe=oe,He=Fe.tag;if((Fe.mode&1)===0&&(He===0||He===11||He===15)){var Be=Fe.alternate;Be?(Fe.updateQueue=Be.updateQueue,Fe.memoizedState=Be.memoizedState,Fe.lanes=Be.lanes):(Fe.updateQueue=null,Fe.memoizedState=null)}var rt=Y0(Z);if(rt!==null){rt.flags&=-257,K0(rt,Z,oe,G,g),rt.mode&1&&q0(G,_e,g),g=rt,fe=_e;var at=g.updateQueue;if(at===null){var ot=new Set;ot.add(fe),g.updateQueue=ot}else at.add(fe);break e}else{if((g&1)===0){q0(G,_e,g),Uf();break e}fe=Error(r(426))}}else if(ar&&oe.mode&1){var pr=Y0(Z);if(pr!==null){(pr.flags&65536)===0&&(pr.flags|=256),K0(pr,Z,oe,G,g),Jh($s(fe,oe));break e}}G=fe=$s(fe,oe),Sr!==4&&(Sr=2),cl===null?cl=[G]:cl.push(G),G=Z;do{switch(G.tag){case 3:G.flags|=65536,g&=-g,G.lanes|=g;var xe=V0(G,fe,g);y0(G,xe);break e;case 1:oe=fe;var ge=G.type,we=G.stateNode;if((G.flags&128)===0&&(typeof ge.getDerivedStateFromError=="function"||we!==null&&typeof we.componentDidCatch=="function"&&(na===null||!na.has(we)))){G.flags|=65536,g&=-g,G.lanes|=g;var Ve=G0(G,oe,g);y0(G,Ve);break e}}G=G.return}while(G!==null)}Ex(C)}catch(lt){g=lt,mr===C&&C!==null&&(mr=C=C.return);continue}break}while(!0)}function Cx(){var h=lc.current;return lc.current=rc,h===null?rc:h}function Uf(){(Sr===0||Sr===3||Sr===2)&&(Sr=4),Nr===null||(Ua&268435455)===0&&(uc&268435455)===0||sa(Nr,Or)}function gc(h,g){var C=Pt;Pt|=2;var R=Cx();(Nr!==h||Or!==g)&&(Mi=null,Va(h,g));do try{_3();break}catch(z){_x(h,z)}while(!0);if(tf(),Pt=C,lc.current=R,mr!==null)throw Error(r(261));return Nr=null,Or=0,Sr}function _3(){for(;mr!==null;)kx(mr)}function C3(){for(;mr!==null&&!Ma();)kx(mr)}function kx(h){var g=Rx(h.alternate,h,_n);h.memoizedProps=h.pendingProps,g===null?Ex(h):mr=g,Mf.current=null}function Ex(h){var g=h;do{var C=g.alternate;if(h=g.return,(g.flags&32768)===0){if(C=v3(C,g,_n),C!==null){mr=C;return}}else{if(C=m3(C,g),C!==null){C.flags&=32767,mr=C;return}if(h!==null)h.flags|=32768,h.subtreeFlags=0,h.deletions=null;else{Sr=6,mr=null;return}}if(g=g.sibling,g!==null){mr=g;return}mr=g=h}while(g!==null);Sr===0&&(Sr=5)}function Ga(h,g,C){var R=Ut,z=jn.transition;try{jn.transition=null,Ut=1,k3(h,g,C,R)}finally{jn.transition=z,Ut=R}return null}function k3(h,g,C,R){do Vs();while(ia!==null);if((Pt&6)!==0)throw Error(r(327));C=h.finishedWork;var z=h.finishedLanes;if(C===null)return null;if(h.finishedWork=null,h.finishedLanes=0,C===h.current)throw Error(r(177));h.callbackNode=null,h.callbackPriority=0;var G=C.lanes|C.childLanes;if(aE(h,G),h===Nr&&(mr=Nr=null,Or=0),(C.subtreeFlags&2064)===0&&(C.flags&2064)===0||dc||(dc=!0,Lx(li,function(){return Vs(),null})),G=(C.flags&15990)!==0,(C.subtreeFlags&15990)!==0||G){G=jn.transition,jn.transition=null;var Z=Ut;Ut=1;var oe=Pt;Pt|=4,Mf.current=null,x3(h,C),vx(C,h),VE(Hh),Eu=!!$h,Hh=$h=null,h.current=C,b3(C),Ss(),Pt=oe,Ut=Z,jn.transition=G}else h.current=C;if(dc&&(dc=!1,ia=h,hc=z),G=h.pendingLanes,G===0&&(na=null),Rt(C.stateNode),hn(h,Gt()),g!==null)for(R=h.onRecoverableError,C=0;C<g.length;C++)z=g[C],R(z.value,{componentStack:z.stack,digest:z.digest});if(cc)throw cc=!1,h=If,If=null,h;return(hc&1)!==0&&h.tag!==0&&Vs(),G=h.pendingLanes,(G&1)!==0?h===Bf?dl++:(dl=0,Bf=h):dl=0,Ji(),null}function Vs(){if(ia!==null){var h=py(hc),g=jn.transition,C=Ut;try{if(jn.transition=null,Ut=16>h?16:h,ia===null)var R=!1;else{if(h=ia,ia=null,hc=0,(Pt&6)!==0)throw Error(r(331));var z=Pt;for(Pt|=4,nt=h.current;nt!==null;){var G=nt,Z=G.child;if((nt.flags&16)!==0){var oe=G.deletions;if(oe!==null){for(var fe=0;fe<oe.length;fe++){var _e=oe[fe];for(nt=_e;nt!==null;){var Fe=nt;switch(Fe.tag){case 0:case 11:case 15:ll(8,Fe,G)}var He=Fe.child;if(He!==null)He.return=Fe,nt=He;else for(;nt!==null;){Fe=nt;var Be=Fe.sibling,rt=Fe.return;if(dx(Fe),Fe===_e){nt=null;break}if(Be!==null){Be.return=rt,nt=Be;break}nt=rt}}}var at=G.alternate;if(at!==null){var ot=at.child;if(ot!==null){at.child=null;do{var pr=ot.sibling;ot.sibling=null,ot=pr}while(ot!==null)}}nt=G}}if((G.subtreeFlags&2064)!==0&&Z!==null)Z.return=G,nt=Z;else e:for(;nt!==null;){if(G=nt,(G.flags&2048)!==0)switch(G.tag){case 0:case 11:case 15:ll(9,G,G.return)}var xe=G.sibling;if(xe!==null){xe.return=G.return,nt=xe;break e}nt=G.return}}var ge=h.current;for(nt=ge;nt!==null;){Z=nt;var we=Z.child;if((Z.subtreeFlags&2064)!==0&&we!==null)we.return=Z,nt=we;else e:for(Z=ge;nt!==null;){if(oe=nt,(oe.flags&2048)!==0)try{switch(oe.tag){case 0:case 11:case 15:oc(9,oe)}}catch(lt){hr(oe,oe.return,lt)}if(oe===Z){nt=null;break e}var Ve=oe.sibling;if(Ve!==null){Ve.return=oe.return,nt=Ve;break e}nt=oe.return}}if(Pt=z,Ji(),dt&&typeof dt.onPostCommitFiberRoot=="function")try{dt.onPostCommitFiberRoot(Nt,h)}catch{}R=!0}return R}finally{Ut=C,jn.transition=g}}return!1}function Tx(h,g,C){g=$s(C,g),g=V0(h,g,1),h=ta(h,g,1),g=Jr(),h!==null&&(Oo(h,1,g),hn(h,g))}function hr(h,g,C){if(h.tag===3)Tx(h,h,C);else for(;g!==null;){if(g.tag===3){Tx(g,h,C);break}else if(g.tag===1){var R=g.stateNode;if(typeof g.type.getDerivedStateFromError=="function"||typeof R.componentDidCatch=="function"&&(na===null||!na.has(R))){h=$s(C,h),h=G0(g,h,1),g=ta(g,h,1),h=Jr(),g!==null&&(Oo(g,1,h),hn(g,h));break}}g=g.return}}function E3(h,g,C){var R=h.pingCache;R!==null&&R.delete(g),g=Jr(),h.pingedLanes|=h.suspendedLanes&C,Nr===h&&(Or&C)===C&&(Sr===4||Sr===3&&(Or&130023424)===Or&&500>Gt()-jf?Va(h,0):Of|=C),hn(h,g)}function Nx(h,g){g===0&&((h.mode&1)===0?g=1:(g=Su,Su<<=1,(Su&130023424)===0&&(Su=4194304)));var C=Jr();h=Di(h,g),h!==null&&(Oo(h,g,C),hn(h,C))}function T3(h){var g=h.memoizedState,C=0;g!==null&&(C=g.retryLane),Nx(h,C)}function N3(h,g){var C=0;switch(h.tag){case 13:var R=h.stateNode,z=h.memoizedState;z!==null&&(C=z.retryLane);break;case 19:R=h.stateNode;break;default:throw Error(r(314))}R!==null&&R.delete(g),Nx(h,C)}var Rx;Rx=function(h,g,C){if(h!==null)if(h.memoizedProps!==g.pendingProps||ln.current)cn=!0;else{if((h.lanes&C)===0&&(g.flags&128)===0)return cn=!1,g3(h,g,C);cn=(h.flags&131072)!==0}else cn=!1,ar&&(g.flags&1048576)!==0&&l0(g,Wu,g.index);switch(g.lanes=0,g.tag){case 2:var R=g.type;ac(h,g),h=g.pendingProps;var z=Ps(g,Hr.current);Fs(g,C),z=ff(null,g,R,h,z,C);var G=pf();return g.flags|=1,typeof z=="object"&&z!==null&&typeof z.render=="function"&&z.$$typeof===void 0?(g.tag=1,g.memoizedState=null,g.updateQueue=null,un(R)?(G=!0,$u(g)):G=!1,g.memoizedState=z.state!==null&&z.state!==void 0?z.state:null,sf(g),z.updater=nc,g.stateNode=z,z._reactInternals=g,bf(g,R,h,C),g=Cf(null,g,R,!0,G,C)):(g.tag=0,ar&&G&&Kh(g),Zr(null,g,z,C),g=g.child),g;case 16:R=g.elementType;e:{switch(ac(h,g),h=g.pendingProps,z=R._init,R=z(R._payload),g.type=R,z=g.tag=L3(R),h=Xn(R,h),z){case 0:g=_f(null,g,R,h,C);break e;case 1:g=tx(null,g,R,h,C);break e;case 11:g=X0(null,g,R,h,C);break e;case 14:g=Q0(null,g,R,Xn(R.type,h),C);break e}throw Error(r(306,R,""))}return g;case 0:return R=g.type,z=g.pendingProps,z=g.elementType===R?z:Xn(R,z),_f(h,g,R,z,C);case 1:return R=g.type,z=g.pendingProps,z=g.elementType===R?z:Xn(R,z),tx(h,g,R,z,C);case 3:e:{if(rx(g),h===null)throw Error(r(387));R=g.pendingProps,G=g.memoizedState,z=G.element,m0(h,g),Xu(g,R,null,C);var Z=g.memoizedState;if(R=Z.element,G.isDehydrated)if(G={element:R,isDehydrated:!1,cache:Z.cache,pendingSuspenseBoundaries:Z.pendingSuspenseBoundaries,transitions:Z.transitions},g.updateQueue.baseState=G,g.memoizedState=G,g.flags&256){z=$s(Error(r(423)),g),g=nx(h,g,R,C,z);break e}else if(R!==z){z=$s(Error(r(424)),g),g=nx(h,g,R,C,z);break e}else for(Sn=Xi(g.stateNode.containerInfo.firstChild),wn=g,ar=!0,Kn=null,C=g0(g,null,R,C),g.child=C;C;)C.flags=C.flags&-3|4096,C=C.sibling;else{if(js(),R===z){g=Pi(h,g,C);break e}Zr(h,g,R,C)}g=g.child}return g;case 5:return b0(g),h===null&&Zh(g),R=g.type,z=g.pendingProps,G=h!==null?h.memoizedProps:null,Z=z.children,Uh(R,z)?Z=null:G!==null&&Uh(R,G)&&(g.flags|=32),ex(h,g),Zr(h,g,Z,C),g.child;case 6:return h===null&&Zh(g),null;case 13:return ix(h,g,C);case 4:return of(g,g.stateNode.containerInfo),R=g.pendingProps,h===null?g.child=Is(g,null,R,C):Zr(h,g,R,C),g.child;case 11:return R=g.type,z=g.pendingProps,z=g.elementType===R?z:Xn(R,z),X0(h,g,R,z,C);case 7:return Zr(h,g,g.pendingProps,C),g.child;case 8:return Zr(h,g,g.pendingProps.children,C),g.child;case 12:return Zr(h,g,g.pendingProps.children,C),g.child;case 10:e:{if(R=g.type._context,z=g.pendingProps,G=g.memoizedProps,Z=z.value,Zt(qu,R._currentValue),R._currentValue=Z,G!==null)if(Yn(G.value,Z)){if(G.children===z.children&&!ln.current){g=Pi(h,g,C);break e}}else for(G=g.child,G!==null&&(G.return=g);G!==null;){var oe=G.dependencies;if(oe!==null){Z=G.child;for(var fe=oe.firstContext;fe!==null;){if(fe.context===R){if(G.tag===1){fe=Ai(-1,C&-C),fe.tag=2;var _e=G.updateQueue;if(_e!==null){_e=_e.shared;var Fe=_e.pending;Fe===null?fe.next=fe:(fe.next=Fe.next,Fe.next=fe),_e.pending=fe}}G.lanes|=C,fe=G.alternate,fe!==null&&(fe.lanes|=C),nf(G.return,C,g),oe.lanes|=C;break}fe=fe.next}}else if(G.tag===10)Z=G.type===g.type?null:G.child;else if(G.tag===18){if(Z=G.return,Z===null)throw Error(r(341));Z.lanes|=C,oe=Z.alternate,oe!==null&&(oe.lanes|=C),nf(Z,C,g),Z=G.sibling}else Z=G.child;if(Z!==null)Z.return=G;else for(Z=G;Z!==null;){if(Z===g){Z=null;break}if(G=Z.sibling,G!==null){G.return=Z.return,Z=G;break}Z=Z.return}G=Z}Zr(h,g,z.children,C),g=g.child}return g;case 9:return z=g.type,R=g.pendingProps.children,Fs(g,C),z=Mn(z),R=R(z),g.flags|=1,Zr(h,g,R,C),g.child;case 14:return R=g.type,z=Xn(R,g.pendingProps),z=Xn(R.type,z),Q0(h,g,R,z,C);case 15:return Z0(h,g,g.type,g.pendingProps,C);case 17:return R=g.type,z=g.pendingProps,z=g.elementType===R?z:Xn(R,z),ac(h,g),g.tag=1,un(R)?(h=!0,$u(g)):h=!1,Fs(g,C),U0(g,R,z),bf(g,R,z,C),Cf(null,g,R,!0,h,C);case 19:return sx(h,g,C);case 22:return J0(h,g,C)}throw Error(r(156,g.tag))};function Lx(h,g){return Gn(h,g)}function R3(h,g,C,R){this.tag=h,this.key=C,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=g,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=R,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function In(h,g,C,R){return new R3(h,g,C,R)}function Wf(h){return h=h.prototype,!(!h||!h.isReactComponent)}function L3(h){if(typeof h=="function")return Wf(h)?1:0;if(h!=null){if(h=h.$$typeof,h===O)return 11;if(h===B)return 14}return 2}function oa(h,g){var C=h.alternate;return C===null?(C=In(h.tag,g,h.key,h.mode),C.elementType=h.elementType,C.type=h.type,C.stateNode=h.stateNode,C.alternate=h,h.alternate=C):(C.pendingProps=g,C.type=h.type,C.flags=0,C.subtreeFlags=0,C.deletions=null),C.flags=h.flags&14680064,C.childLanes=h.childLanes,C.lanes=h.lanes,C.child=h.child,C.memoizedProps=h.memoizedProps,C.memoizedState=h.memoizedState,C.updateQueue=h.updateQueue,g=h.dependencies,C.dependencies=g===null?null:{lanes:g.lanes,firstContext:g.firstContext},C.sibling=h.sibling,C.index=h.index,C.ref=h.ref,C}function vc(h,g,C,R,z,G){var Z=2;if(R=h,typeof h=="function")Wf(h)&&(Z=1);else if(typeof h=="string")Z=5;else e:switch(h){case E:return qa(C.children,z,G,g);case k:Z=8,z|=8;break;case L:return h=In(12,C,g,z|2),h.elementType=L,h.lanes=G,h;case $:return h=In(13,C,g,z),h.elementType=$,h.lanes=G,h;case D:return h=In(19,C,g,z),h.elementType=D,h.lanes=G,h;case I:return mc(C,z,G,g);default:if(typeof h=="object"&&h!==null)switch(h.$$typeof){case A:Z=10;break e;case M:Z=9;break e;case O:Z=11;break e;case B:Z=14;break e;case j:Z=16,R=null;break e}throw Error(r(130,h==null?h:typeof h,""))}return g=In(Z,C,g,z),g.elementType=h,g.type=R,g.lanes=G,g}function qa(h,g,C,R){return h=In(7,h,R,g),h.lanes=C,h}function mc(h,g,C,R){return h=In(22,h,R,g),h.elementType=I,h.lanes=C,h.stateNode={isHidden:!1},h}function Vf(h,g,C){return h=In(6,h,null,g),h.lanes=C,h}function Gf(h,g,C){return g=In(4,h.children!==null?h.children:[],h.key,g),g.lanes=C,g.stateNode={containerInfo:h.containerInfo,pendingChildren:null,implementation:h.implementation},g}function D3(h,g,C,R,z){this.tag=g,this.containerInfo=h,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=yh(0),this.expirationTimes=yh(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=yh(0),this.identifierPrefix=R,this.onRecoverableError=z,this.mutableSourceEagerHydrationData=null}function qf(h,g,C,R,z,G,Z,oe,fe){return h=new D3(h,g,C,oe,fe),g===1?(g=1,G===!0&&(g|=8)):g=0,G=In(3,null,null,g),h.current=G,G.stateNode=h,G.memoizedState={element:R,isDehydrated:C,cache:null,transitions:null,pendingSuspenseBoundaries:null},sf(G),h}function A3(h,g,C){var R=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:N,key:R==null?null:""+R,children:h,containerInfo:g,implementation:C}}function Dx(h){if(!h)return Zi;h=h._reactInternals;e:{if(zt(h)!==h||h.tag!==1)throw Error(r(170));var g=h;do{switch(g.tag){case 3:g=g.stateNode.context;break e;case 1:if(un(g.type)){g=g.stateNode.__reactInternalMemoizedMergedChildContext;break e}}g=g.return}while(g!==null);throw Error(r(171))}if(h.tag===1){var C=h.type;if(un(C))return a0(h,C,g)}return g}function Ax(h,g,C,R,z,G,Z,oe,fe){return h=qf(C,R,!0,h,z,G,Z,oe,fe),h.context=Dx(null),C=h.current,R=Jr(),z=aa(C),G=Ai(R,z),G.callback=g??null,ta(C,G,z),h.current.lanes=z,Oo(h,z,R),hn(h,R),h}function yc(h,g,C,R){var z=g.current,G=Jr(),Z=aa(z);return C=Dx(C),g.context===null?g.context=C:g.pendingContext=C,g=Ai(G,Z),g.payload={element:h},R=R===void 0?null:R,R!==null&&(g.callback=R),h=ta(z,g,Z),h!==null&&(Jn(h,z,Z,G),Ku(h,z,Z)),Z}function xc(h){if(h=h.current,!h.child)return null;switch(h.child.tag){case 5:return h.child.stateNode;default:return h.child.stateNode}}function Px(h,g){if(h=h.memoizedState,h!==null&&h.dehydrated!==null){var C=h.retryLane;h.retryLane=C!==0&&C<g?C:g}}function Yf(h,g){Px(h,g),(h=h.alternate)&&Px(h,g)}function P3(){return null}var Mx=typeof reportError=="function"?reportError:function(h){console.error(h)};function Kf(h){this._internalRoot=h}bc.prototype.render=Kf.prototype.render=function(h){var g=this._internalRoot;if(g===null)throw Error(r(409));yc(h,g,null,null)},bc.prototype.unmount=Kf.prototype.unmount=function(){var h=this._internalRoot;if(h!==null){this._internalRoot=null;var g=h.containerInfo;Wa(function(){yc(null,h,null,null)}),g[Ti]=null}};function bc(h){this._internalRoot=h}bc.prototype.unstable_scheduleHydration=function(h){if(h){var g=my();h={blockedOn:null,target:h,priority:g};for(var C=0;C<qi.length&&g!==0&&g<qi[C].priority;C++);qi.splice(C,0,h),C===0&&by(h)}};function Xf(h){return!(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)}function wc(h){return!(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11&&(h.nodeType!==8||h.nodeValue!==" react-mount-point-unstable "))}function Ox(){}function M3(h,g,C,R,z){if(z){if(typeof R=="function"){var G=R;R=function(){var _e=xc(Z);G.call(_e)}}var Z=Ax(g,R,h,0,null,!1,!1,"",Ox);return h._reactRootContainer=Z,h[Ti]=Z.current,Ko(h.nodeType===8?h.parentNode:h),Wa(),Z}for(;z=h.lastChild;)h.removeChild(z);if(typeof R=="function"){var oe=R;R=function(){var _e=xc(fe);oe.call(_e)}}var fe=qf(h,0,!1,null,null,!1,!1,"",Ox);return h._reactRootContainer=fe,h[Ti]=fe.current,Ko(h.nodeType===8?h.parentNode:h),Wa(function(){yc(g,fe,C,R)}),fe}function Sc(h,g,C,R,z){var G=C._reactRootContainer;if(G){var Z=G;if(typeof z=="function"){var oe=z;z=function(){var fe=xc(Z);oe.call(fe)}}yc(g,Z,h,z)}else Z=M3(C,g,h,z,R);return xc(Z)}gy=function(h){switch(h.tag){case 3:var g=h.stateNode;if(g.current.memoizedState.isDehydrated){var C=Mo(g.pendingLanes);C!==0&&(xh(g,C|1),hn(g,Gt()),(Pt&6)===0&&(Ws=Gt()+500,Ji()))}break;case 13:Wa(function(){var R=Di(h,1);if(R!==null){var z=Jr();Jn(R,h,1,z)}}),Yf(h,1)}},bh=function(h){if(h.tag===13){var g=Di(h,134217728);if(g!==null){var C=Jr();Jn(g,h,134217728,C)}Yf(h,134217728)}},vy=function(h){if(h.tag===13){var g=aa(h),C=Di(h,g);if(C!==null){var R=Jr();Jn(C,h,g,R)}Yf(h,g)}},my=function(){return Ut},yy=function(h,g){var C=Ut;try{return Ut=h,g()}finally{Ut=C}},Re=function(h,g,C){switch(g){case"input":if(Se(h,C),g=C.name,C.type==="radio"&&g!=null){for(C=h;C.parentNode;)C=C.parentNode;for(C=C.querySelectorAll("input[name="+JSON.stringify(""+g)+'][type="radio"]'),g=0;g<C.length;g++){var R=C[g];if(R!==h&&R.form===h.form){var z=Fu(R);if(!z)throw Error(r(90));ie(R),Se(R,z)}}}break;case"textarea":$e(h,C);break;case"select":g=C.value,g!=null&&Pe(h,!!C.multiple,g,!1)}},et=$f,Ze=Wa;var O3={usingClientEntryPoint:!1,Events:[Zo,Ds,Fu,Xe,yt,$f]},hl={findFiberByHostInstance:ja,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},j3={bundleType:hl.bundleType,version:hl.version,rendererPackageName:hl.rendererPackageName,rendererConfig:hl.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:_.ReactCurrentDispatcher,findHostInstanceByFiber:function(h){return h=ki(h),h===null?null:h.stateNode},findFiberByHostInstance:hl.findFiberByHostInstance||P3,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 _c=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!_c.isDisabled&&_c.supportsFiber)try{Nt=_c.inject(j3),dt=_c}catch{}}return fn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=O3,fn.createPortal=function(h,g){var C=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Xf(g))throw Error(r(200));return A3(h,g,null,C)},fn.createRoot=function(h,g){if(!Xf(h))throw Error(r(299));var C=!1,R="",z=Mx;return g!=null&&(g.unstable_strictMode===!0&&(C=!0),g.identifierPrefix!==void 0&&(R=g.identifierPrefix),g.onRecoverableError!==void 0&&(z=g.onRecoverableError)),g=qf(h,1,!1,null,null,C,!1,R,z),h[Ti]=g.current,Ko(h.nodeType===8?h.parentNode:h),new Kf(g)},fn.findDOMNode=function(h){if(h==null)return null;if(h.nodeType===1)return h;var g=h._reactInternals;if(g===void 0)throw typeof h.render=="function"?Error(r(188)):(h=Object.keys(h).join(","),Error(r(268,h)));return h=ki(g),h=h===null?null:h.stateNode,h},fn.flushSync=function(h){return Wa(h)},fn.hydrate=function(h,g,C){if(!wc(g))throw Error(r(200));return Sc(null,h,g,!0,C)},fn.hydrateRoot=function(h,g,C){if(!Xf(h))throw Error(r(405));var R=C!=null&&C.hydratedSources||null,z=!1,G="",Z=Mx;if(C!=null&&(C.unstable_strictMode===!0&&(z=!0),C.identifierPrefix!==void 0&&(G=C.identifierPrefix),C.onRecoverableError!==void 0&&(Z=C.onRecoverableError)),g=Ax(g,null,h,1,C??null,z,!1,G,Z),h[Ti]=g.current,Ko(h),R)for(h=0;h<R.length;h++)C=R[h],z=C._getVersion,z=z(C._source),g.mutableSourceEagerHydrationData==null?g.mutableSourceEagerHydrationData=[C,z]:g.mutableSourceEagerHydrationData.push(C,z);return new bc(g)},fn.render=function(h,g,C){if(!wc(g))throw Error(r(200));return Sc(null,h,g,!1,C)},fn.unmountComponentAtNode=function(h){if(!wc(h))throw Error(r(40));return h._reactRootContainer?(Wa(function(){Sc(null,null,h,!1,function(){h._reactRootContainer=null,h[Ti]=null})}),!0):!1},fn.unstable_batchedUpdates=$f,fn.unstable_renderSubtreeIntoContainer=function(h,g,C,R){if(!wc(C))throw Error(r(200));if(h==null||h._reactInternals===void 0)throw Error(r(38));return Sc(h,g,C,!1,R)},fn.version="18.3.1-next-f1338f8080-20240426",fn}var Ux;function G3(){if(Ux)return Jf.exports;Ux=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(),Jf.exports=V3(),Jf.exports}var Wx;function q3(){if(Wx)return Ec;Wx=1;var t=G3();return Ec.createRoot=t.createRoot,Ec.hydrateRoot=t.hydrateRoot,Ec}var Y3=q3();const rp={};function sS(){const t=rp==null?void 0:rp.VITE_API_HOST;return typeof t=="string"&&t.length>0?t:void 0}function um(){const t=sS();return t?`http://${t}/api/v1`:`${window.location.origin}/api/v1`}function oS(){const t=sS();return t?`ws://${t}`:`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}`}const lS=t=>`${oS()}/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(`${um()}${t}`,{...e,headers:r});if(!n.ok){const i=await n.text();let a;try{const s=JSON.parse(i),o=s.error??s.message??i;a=typeof o=="string"?o:JSON.stringify(o)}catch{a=i}throw a||(a=n.statusText||String(n.status)),new Error(`API ${n.status}: ${a}`)}return n.json()}async function K3(t){var a;const e=await fetch(`${um()}/runs/${encodeURIComponent(t)}/evidence`);if(!e.ok){const s=await e.text();let o=s;try{const l=JSON.parse(s);typeof l.error=="string"&&(o=l.error)}catch{}throw new Error(`API ${e.status}: ${o||e.statusText||String(e.status)}`)}const r=((a=/filename="([^"]+)"/.exec(e.headers.get("Content-Disposition")??""))==null?void 0:a[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 Ue={listRuns:t=>st(t?"/runs?include=archived":"/runs"),archiveRun:(t,e,r)=>st(`/runs/${encodeURIComponent(t)}/archive`,{method:"POST",body:JSON.stringify(r===void 0?{archived:e}:{archived:e,note:r})}),getRun:t=>st(`/runs/${encodeURIComponent(t)}`),getRunEvents:t=>st(`/runs/${encodeURIComponent(t)}/events`),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"}),openChat:t=>st("/chats",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),sendChatMessage:(t,e,r)=>st(`/chats/${encodeURIComponent(t)}/messages`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r===void 0?{text:e}:{text:e,targets:r})}),closeChat:t=>st(`/chats/${encodeURIComponent(t)}`,{method:"DELETE"}),getChat:t=>st(`/chats/${encodeURIComponent(t)}`),listChats:()=>st("/chats"),getUnitOutput:(t,e)=>st(`/runs/${encodeURIComponent(t)}/units/${encodeURIComponent(e)}/output`),getGate:t=>st(`/runs/${encodeURIComponent(t)}/gate`),getElicitation:async t=>{try{return await st(`/runs/${encodeURIComponent(t)}/elicitation`)}catch(e){if(e instanceof Error&&/\b404\b/.test(e.message))return null;throw e}},respondToElicitation:(t,e)=>st(`/runs/${encodeURIComponent(t)}/elicitation`,{method:"POST",body:JSON.stringify(e)}),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"}),openPath:(t,e)=>st("/open",{method:"POST",body:JSON.stringify(e===void 0?{path:t}:{path:t,runId:e})}),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})}),listRequirements:(t,e)=>{const r=new URLSearchParams;return e.q&&r.set("q",e.q),e.risk&&r.set("risk",e.risk),e.category&&r.set("category",e.category),e.domain&&r.set("domain",e.domain),r.set("offset",String(e.offset??0)),r.set("limit",String(e.limit??50)),st(`/repos/${encodeURIComponent(t)}/requirements?${r.toString()}`)},getRequirement:(t,e)=>st(`/repos/${encodeURIComponent(t)}/requirements/${encodeURIComponent(e)}`),patchRequirement:(t,e,r)=>st(`/repos/${encodeURIComponent(t)}/requirements/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}),getDomainGraph:()=>st("/domain-graph"),getRepoGraph:(t,e)=>{const r=new URLSearchParams;e!=null&&e.focus&&r.set("focus",e.focus),e!=null&&e.limit&&r.set("limit",String(e.limit));const n=r.size>0?`?${r.toString()}`:"";return st(`/repos/${encodeURIComponent(t)}/graph${n}`)},getBlastRadius:(t,e)=>st(`/repos/${encodeURIComponent(t)}/graph/blast-radius?name=${encodeURIComponent(e)}`),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"),getCoverageReportForRepo:t=>st(`/governance/coverage?repo=${encodeURIComponent(t)}`),getGraphKindsForRepo:t=>st(`/governance/graph?repo=${encodeURIComponent(t)}`),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)}),retirePolicy:t=>st(`/governance/policies/${encodeURIComponent(t)}`,{method:"DELETE"}),retireConformanceRule:t=>st(`/governance/rules/${encodeURIComponent(t)}`,{method:"DELETE"}),recallRulesPreview:t=>{const e=new URLSearchParams;for(const[i,a]of Object.entries(t))a&&e.set(i,a);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)}),listProjects:t=>{const e=t?`?status=${t}`:"";return st(`/projects${e}`)},getProject:t=>st(`/projects/${encodeURIComponent(t)}`),createProject:t=>st("/projects",{method:"POST",body:JSON.stringify(t)}),updateProject:(t,e)=>st(`/projects/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify(e)}),listProjectMembers:t=>st(`/projects/${encodeURIComponent(t)}/members`),attachProjectMember:(t,e)=>st(`/projects/${encodeURIComponent(t)}/members`,{method:"POST",body:JSON.stringify(e)}),detachProjectMember:(t,e)=>st(`/projects/${encodeURIComponent(t)}/members/${encodeURIComponent(e)}`,{method:"DELETE"}),getProjectActivity:(t,e)=>{const r=e?`?cursor=${encodeURIComponent(e)}`:"";return st(`/projects/${encodeURIComponent(t)}/activity${r}`)}};function uS(t,e){if(t.status!=="executing")return null;const n=[...e].sort((i,a)=>i.ord-a.ord)[t.unit_ix];return n===void 0||n.status==="done"||n.status==="rejected"?null:n.ord}function X3(t){return t.reduce((e,r)=>e+(uS(r.session,r.units)===null?0:1),0)}const Vx=t=>{let e;const r=new Set,n=(u,c)=>{const d=typeof u=="function"?u(e):u;if(!Object.is(d,e)){const p=e;e=c??(typeof d!="object"||d===null)?d:Object.assign({},e,d),r.forEach(f=>f(e,p))}},i=()=>e,o={setState:n,getState:i,getInitialState:()=>l,subscribe:u=>(r.add(u),()=>r.delete(u))},l=e=t(n,i,o);return o},Q3=(t=>t?Vx(t):Vx),Z3=t=>t;function J3(t,e=Z3){const r=kc.useSyncExternalStore(t.subscribe,kc.useCallback(()=>e(t.getState()),[t,e]),kc.useCallback(()=>e(t.getInitialState()),[t,e]));return kc.useDebugValue(r),r}const Gx=t=>{const e=Q3(t),r=n=>J3(e,n);return Object.assign(r,e),r},si=(t=>t?Gx(t):Gx);function cS(t){for(const e of["choices","options"]){const r=t[e];if(Array.isArray(r))return r.filter(n=>typeof n=="string");if(r===null)return null}return t.freeText===!0?null:void 0}function eT(t){return t===void 0?!0:t.choices===null?!1:(t.choices??["approve","reject"]).length<=2}const Un=si(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":{if(typeof e.ord=="number"&&typeof e.prompt=="string"){const i=cS(e);return{gates:{...n.gates,[r]:{runId:r,ord:e.ord,prompt:e.prompt,lifecycle:"open",receivedAt:Date.now(),...i!==void 0?{choices:i}:{}}}}}return 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 a=!1;for(const[s,o]of Object.entries(r.gates))n.has(s)?i[s]=o:a=!0;return a?{gates:i}:r})})),qx=5e4,Yx=new Set(["cliOutputDelta","unitOutputDelta","heartbeat"]),ho=si(t=>({byRun:{},ingest:e=>{const r=typeof e.session=="string"?e.session:void 0;r!==void 0&&(Yx.has(e.type)||t(n=>{const a=[...n.byRun[r]??[],e];return a.length>qx&&a.splice(0,a.length-qx),{byRun:{...n.byRun,[r]:a}}}))},hydrate:(e,r)=>t(n=>{if((n.byRun[e]??[]).length>0)return n;const i=r.filter(a=>a.session===e&&!Yx.has(a.type));return i.length===0?n:{byRun:{...n.byRun,[e]:i}}}),clear:e=>t(r=>{if(!(e in r.byRun))return r;const n={...r.byRun};return delete n[e],{byRun:n}})})),cm=si(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()}]}})})),tT=[{value:"30d",label:"30d"},{value:"60d",label:"60d"},{value:"90d",label:"90d"}];function rT(t,e){const r=e==="30d"?30:e==="60d"?60:90;return t.slice(0,r)}function dm(t="30d"){const[e,r]=K.useState(t),n=K.useCallback(i=>rT(i,e),[e]);return{range:e,setRange:r,filter:n}}const nT={fontFamily:"monospace"};function hm({value:t,onChange:e}){return y.jsx("div",{role:"group","aria-label":"Time range",style:{display:"flex",gap:"4px"},children:tT.map(({value:r,label:n})=>y.jsx("button",{type:"button","aria-pressed":t===r,onClick:()=>e(r),style:{padding:"3px 8px",borderRadius:"5px",fontSize:"10px",fontWeight:600,...nT,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 Tc=new Set(["planning","distributing","executing","awaiting_human"]),iT=new Set(["awaitingHuman","gateEscalated","stepFailed","sessionFailed","crashRecoveryRedrive","unitDone","workflowSelected","acpFallback"]),_t={fontFamily:"monospace"},io={background:"#1b222e",border:"1px solid rgba(230,237,243,0.08)",borderRadius:"12px"},es={fontSize:"10px",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.1em",color:"rgba(230,237,243,0.4)",fontFamily:"monospace",margin:0},aT={pending:"rgba(230,237,243,0.18)",distributed:"#79c0ff",done:"#3fb950",rejected:"#f85149"},sT={distributed:!0};function Wl(t,e){return t.length>e?`${t.slice(0,e)}…`:t}function _v(t){const e=t.session.problem;return e.length>0?Wl(e,32):t.session.id.slice(0,8)}function oT(t){return t<.01?"<$0.01":`$${t.toFixed(2)}`}function lT(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}const dS={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)"}},hS={icon:"·",label:"Event",borderColor:"rgba(230,237,243,0.08)",textColor:"#e6edf3",badgeColor:"rgba(230,237,243,0.04)"};function uT({runId:t,ord:e,prompt:r,sessionLbl:n,onApprove:i,onReject:a}){const[s,o]=K.useState(""),[l,u]=K.useState(!1),[c,d]=K.useState(!1),p=K.useCallback(async x=>{u(!0);try{await x()}catch{}finally{u(!1)}},[]),f=dS.awaitingHuman??hS;return y.jsxs("div",{style:{background:"#161c26",border:`1px solid ${f.borderColor}`,borderRadius:"10px",padding:"14px 16px"},children:[y.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"4px"},children:[y.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"7px"},children:[y.jsx("span",{style:{color:f.textColor,fontSize:"13px"},children:f.icon}),y.jsx("span",{style:{fontSize:"12px",fontWeight:600,color:f.textColor,..._t},children:f.label})]}),y.jsx("span",{style:{fontSize:"10px",color:"rgba(230,237,243,0.4)",..._t,flexShrink:0,marginLeft:"8px"},children:n})]}),y.jsxs("p",{style:{fontSize:"11px",color:"rgba(230,237,243,0.45)",..._t,margin:"0 0 8px"},children:[t.slice(0,8),typeof e=="number"?` · before unit #${e}`:""]}),r&&y.jsx("p",{style:{fontSize:"12px",color:"rgba(230,237,243,0.7)",..._t,margin:"0 0 10px",lineHeight:1.5,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:r}),c&&y.jsx("textarea",{style:{width:"100%",background:"#0f1419",border:"1px solid rgba(230,237,243,0.14)",borderRadius:"6px",color:"#e6edf3",fontSize:"12px",..._t,padding:"6px 8px",resize:"vertical",marginBottom:"10px",boxSizing:"border-box",outline:"none"},rows:2,placeholder:"Steer / amendment for the next unit…",value:s,onChange:x=>o(x.target.value),disabled:l}),y.jsxs("div",{style:{display:"flex",gap:"6px",flexWrap:"wrap"},children:[y.jsx("button",{type:"button",disabled:l,onClick:()=>void p(()=>i(t)),style:{background:"#3fb950",color:"#0d1117",border:"none",borderRadius:"6px",padding:"5px 12px",fontSize:"11px",fontWeight:700,..._t,cursor:l?"not-allowed":"pointer",opacity:l?.5:1},children:"Approve"}),y.jsx("button",{type:"button",disabled:l,onClick:()=>{c?s.trim()&&p(()=>i(t,s.trim())):d(!0)},style:{background:c&&s.trim()?"#ffda19":"rgba(255,218,25,0.12)",color:c&&s.trim()?"#0d1117":"#ffda19",border:"1px solid rgba(255,218,25,0.3)",borderRadius:"6px",padding:"5px 12px",fontSize:"11px",fontWeight:600,..._t,cursor:l?"not-allowed":"pointer",opacity:l?.5:1},children:c&&s.trim()?"Send steer":"Approve + steer"}),y.jsx("button",{type:"button",disabled:l,onClick:()=>void p(()=>a(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,..._t,cursor:l?"not-allowed":"pointer",opacity:l?.5:1},children:"Reject"})]})]})}function cT({type:t,sessionId:e,sessionLbl:r,ord:n,detail:i}){const a=dS[t]??hS;return y.jsxs("div",{style:{background:a.badgeColor,border:`1px solid ${a.borderColor}`,borderRadius:"8px",padding:"8px 12px",display:"flex",alignItems:"flex-start",gap:"8px"},children:[y.jsx("span",{style:{color:a.textColor,fontSize:"12px",lineHeight:"18px",flexShrink:0},children:a.icon}),y.jsxs("div",{style:{flex:1,minWidth:0},children:[y.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:"8px"},children:[y.jsxs("span",{style:{fontSize:"11px",fontWeight:600,color:a.textColor,..._t},children:[a.label,typeof n=="number"?` · unit #${n}`:""]}),y.jsx("span",{style:{fontSize:"10px",color:"rgba(230,237,243,0.3)",..._t,flexShrink:0},children:e.slice(0,6)})]}),i&&y.jsx("p",{style:{fontSize:"11px",color:"rgba(230,237,243,0.55)",..._t,margin:"2px 0 0",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:i,children:Wl(i,80)}),!i&&y.jsx("p",{style:{fontSize:"10px",color:"rgba(230,237,243,0.3)",..._t,margin:"2px 0 0"},children:r})]})]})}function dT({view:t,onSelect:e}){const{session:r,units:n}=t,i=_v(t),a=r.id,s=r.status==="awaiting_human";return y.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(a),onMouseEnter:o=>{o.currentTarget.style.borderColor="rgba(230,237,243,0.18)"},onMouseLeave:o=>{o.currentTarget.style.borderColor="rgba(230,237,243,0.07)"},children:[y.jsx("span",{style:{width:"7px",height:"7px",borderRadius:"50%",background:s?"#ffda19":"#79c0ff",flexShrink:0,marginTop:"5px",boxShadow:s?"0 0 6px rgba(255,218,25,0.5)":"0 0 6px rgba(121,192,255,0.4)"}}),y.jsxs("div",{style:{flex:1,minWidth:0},children:[y.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"6px",gap:"8px"},children:[y.jsx("span",{style:{fontSize:"11px",fontWeight:600,color:"#e6edf3",..._t,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i}),y.jsxs("span",{style:{fontSize:"10px",color:"rgba(230,237,243,0.35)",..._t,flexShrink:0},children:[a.slice(0,6)," · Open chat →"]})]}),y.jsx("div",{style:{display:"flex",gap:"4px",flexWrap:"wrap"},children:n.length===0?y.jsx("span",{style:{fontSize:"10px",color:"rgba(230,237,243,0.3)",..._t},children:"planning…"}):n.map(o=>{const l=["completed","cancelled","failed"].includes(r.status),u=l&&o.status==="distributed"?"rgba(230,237,243,0.18)":aT[o.status]??"rgba(230,237,243,0.18)",c=sT[o.status]===!0&&!l;return y.jsx("span",{title:`unit #${o.ord} — ${o.stage??"?"} — ${o.status}`,style:{display:"inline-block",width:"8px",height:"8px",borderRadius:"50%",background:u,flexShrink:0,animation:c?"pulse 1.5s ease-in-out infinite":"none"}},o.ord)})})]})]})}function hT({activeRuns:t}){const[e,r]=K.useState(""),[n,i]=K.useState("__all__"),[a,s]=K.useState(!1),[o,l]=K.useState(!1),u=K.useRef(null),c=K.useRef(null);K.useEffect(()=>()=>{c.current&&clearTimeout(c.current)},[]);const d=K.useCallback(async()=>{var f;const p=e.trim();if(!(!p||t.length===0)){s(!0);try{if(n==="__all__"){const S=(await Promise.allSettled(t.map(v=>Ue.injectMessage(v.session.id,p,"all")))).filter(v=>v.status==="rejected").length;if(S>0)throw new Error(`${S} inject(s) failed`)}else await Ue.injectMessage(n,p,"all");r(""),l(!0),c.current=setTimeout(()=>l(!1),2500),(f=u.current)==null||f.focus()}finally{s(!1)}}},[e,n,t]);return y.jsxs("div",{children:[y.jsx("p",{style:{...es,marginBottom:"10px"},children:"Send to agents"}),y.jsx("div",{style:{...io,padding:"14px 16px"},children:t.length===0?y.jsx("p",{style:{fontSize:"11px",color:"rgba(230,237,243,0.3)",..._t},children:"No active sessions"}):y.jsxs(y.Fragment,{children:[y.jsx("div",{style:{display:"flex",gap:"8px",marginBottom:"8px",flexWrap:"wrap"},children:y.jsxs("select",{value:n,onChange:p=>i(p.target.value),disabled:a,style:{background:"#0f1419",border:"1px solid rgba(230,237,243,0.14)",borderRadius:"6px",color:"#e6edf3",fontSize:"11px",..._t,padding:"4px 8px",cursor:"pointer",outline:"none",flexShrink:0},children:[y.jsx("option",{value:"__all__",children:"All active agents"}),t.map(p=>y.jsxs("option",{value:p.session.id,children:[Wl(p.session.problem||p.session.id,30)," (",p.session.id.slice(0,6),")"]},p.session.id))]})}),y.jsx("textarea",{ref:u,value:e,onChange:p=>r(p.target.value),onKeyDown:p=>{p.key==="Enter"&&(p.ctrlKey||p.metaKey)&&d()},disabled:a,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",..._t,padding:"8px 10px",resize:"vertical",outline:"none",boxSizing:"border-box",marginBottom:"8px"}}),y.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[y.jsx("button",{type:"button",disabled:a||!e.trim(),onClick:()=>void d(),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,..._t,cursor:a||!e.trim()?"not-allowed":"pointer",transition:"all 0.15s"},children:a?"Sending…":"Send"}),o&&y.jsx("span",{style:{fontSize:"11px",color:"#3fb950",..._t},children:"✓ Injected"}),y.jsx("span",{style:{fontSize:"10px",color:"rgba(230,237,243,0.25)",..._t},children:"Ctrl+Enter"})]})]})})]})}function fT({runs:t,onSelectRun:e,onApproveGate:r,onRejectGate:n,navigate:i}){const a=ho(k=>k.byRun),s=Un(k=>k.gates),o=Un(k=>k.clearGate),l=cm(k=>k.record),{range:u,setRange:c,filter:d}=dm("30d"),p=K.useMemo(()=>d(t),[t,d]),f=K.useMemo(()=>p.filter(k=>Tc.has(k.session.status)),[p]),x=K.useMemo(()=>{let k=0,L=0,A=0,M=!1;for(const O of f){const $=a[O.session.id]??[];for(const D of $)D.type==="cliUsage"&&(typeof D.inputTokens=="number"&&(k+=D.inputTokens),typeof D.outputTokens=="number"&&(L+=D.outputTokens),typeof D.costUsd=="number"&&(A+=D.costUsd,M=!0))}return{totalTokens:k+L,totalCost:M?A:null}},[a,f]),S=K.useMemo(()=>X3(p),[p]),v=K.useCallback(async(k,L)=>{await Ue.confirmGate(k,{approve:!0,...L?{amend:L}:{}}),l({runId:k,action:L?"approve-with-steer":"approve",...L?{amend:L}:{}}),o(k),r(k,L)},[o,l,r]),m=K.useCallback(async k=>{await Ue.confirmGate(k,{approve:!1}),l({runId:k,action:"reject"}),o(k),n(k)},[o,l,n]),b=K.useMemo(()=>{const k=[];for(const L of f){const A=L.session.id,M=_v(L),$=(a[A]??[]).slice(-30);for(const D of $){if(D.type==="awaitingHuman"||!iT.has(D.type))continue;let B;if(D.type==="stepFailed"&&typeof D.detail=="string")B=D.detail;else if(D.type==="sessionFailed"&&typeof D.message=="string")B=D.message;else if(D.type==="workflowSelected"&&typeof D.workflowId=="string")B=`workflow: ${D.workflowId}`;else if(D.type==="acpFallback"){const j=typeof D.reason=="string"?D.reason:"";B=[typeof D.cliKey=="string"?D.cliKey:"",j].filter(Boolean).join(" — ")}else D.type==="crashRecoveryRedrive"&&typeof D.attempt=="number"&&(B=`attempt #${D.attempt}`);k.push({key:`${A}-${D.type}-${typeof D.ord=="number"?D.ord:0}-${k.length}`,sessionId:A,sessionLbl:M,type:D.type,...typeof D.ord=="number"?{ord:D.ord}:{},...B!==void 0?{detail:B}:{}})}}return k.reverse(),k},[a,f]),w=K.useMemo(()=>Object.values(s).sort((k,L)=>L.receivedAt-k.receivedAt),[s]),_=K.useMemo(()=>p.filter(k=>!k.session.workflow_id||k.session.workflow_id==="chat").slice().reverse(),[p]),T=K.useMemo(()=>p.filter(k=>!!k.session.workflow_id&&k.session.workflow_id!=="chat"),[p]),N=K.useMemo(()=>T.filter(k=>Tc.has(k.session.status)),[T]),E=K.useMemo(()=>p.filter(k=>k.session.status==="completed").slice(-5).reverse(),[p]);return y.jsxs("div",{style:{color:"#e6edf3",..._t},children:[y.jsx("style",{children:`
|
|
41
|
+
@keyframes pulse {
|
|
42
|
+
0%, 100% { opacity: 1; }
|
|
43
|
+
50% { opacity: 0.4; }
|
|
44
|
+
}
|
|
45
|
+
`}),y.jsxs("div",{style:{maxWidth:"1100px",margin:"0 auto",padding:"28px 32px"},children:[y.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"24px",gap:"16px",flexWrap:"wrap"},children:[y.jsxs("div",{children:[y.jsx("h1",{style:{fontSize:"20px",fontWeight:600,color:"#e6edf3",margin:0,..._t},children:"wicked-crew studio"}),y.jsx("p",{style:{fontSize:"11px",color:"rgba(230,237,243,0.38)",margin:"4px 0 0",..._t},children:"cross-session control"})]}),y.jsxs("div",{style:{display:"flex",gap:"20px",flexWrap:"wrap",alignItems:"center"},children:[y.jsx(hm,{value:u,onChange:c}),y.jsx(Nc,{label:"Active sessions",value:String(f.length),color:"#79c0ff"}),y.jsx(Nc,{label:"Units in-flight",value:String(S),color:"#79c0ff"}),y.jsx(Nc,{label:"Cost",value:x.totalCost!==null?oT(x.totalCost):"—",color:x.totalCost!==null?"#3fb950":"rgba(230,237,243,0.3)"}),y.jsx(Nc,{label:"Tokens",value:x.totalTokens>0?lT(x.totalTokens):"—",color:x.totalTokens>0?"#e6edf3":"rgba(230,237,243,0.3)"})]})]}),w.length>0&&y.jsxs("div",{style:{marginBottom:"24px"},children:[y.jsx("p",{style:{...es,marginBottom:"10px"},children:"Gate inbox"}),y.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:w.map(k=>{const L=t.find(M=>M.session.id===k.runId),A=L?_v(L):k.runId.slice(0,8);return y.jsx(uT,{runId:k.runId,ord:k.ord,prompt:k.prompt,sessionLbl:A,onApprove:v,onReject:m},`gate-${k.runId}-${k.ord??"x"}`)})})]}),y.jsxs("div",{style:{display:"grid",gridTemplateColumns:"2fr 1fr 1.5fr",gap:"16px",marginBottom:"28px",alignItems:"start"},children:[y.jsxs("div",{style:{...io,padding:"16px 20px"},children:[y.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"12px"},children:[y.jsx("p",{style:es,children:"Runs"}),y.jsx("button",{type:"button",onClick:()=>i("/runs/new"),style:{background:"#ffda19",color:"#0d1117",border:"none",borderRadius:"6px",padding:"4px 12px",fontSize:"11px",fontWeight:700,..._t,cursor:"pointer",flexShrink:0},children:"Do Work"})]}),T.length===0?y.jsx("p",{style:{fontSize:"11px",color:"rgba(230,237,243,0.3)",..._t,fontStyle:"italic"},children:"No work sessions yet"}):y.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[...N,...T.filter(k=>!Tc.has(k.session.status)).slice(-3).reverse()].slice(0,5).map(k=>y.jsx(dT,{view:k,onSelect:e},k.session.id))}),T.length>5&&y.jsx("button",{type:"button",onClick:()=>i("/work"),style:{fontSize:"11px",color:"#79c0ff",..._t,background:"none",border:"none",cursor:"pointer",padding:"8px 0 0",display:"block"},children:"view all →"})]}),y.jsxs("div",{style:{...io,padding:"16px 20px"},children:[y.jsx("p",{style:{...es,marginBottom:"12px"},children:"Campaigns"}),y.jsxs("div",{"data-testid":"campaign-dag-stub",style:{border:"1px dashed rgba(230,237,243,0.15)",borderRadius:"8px",padding:"12px",background:"#161c26"},children:[y.jsx("p",{style:{fontSize:"11px",fontWeight:600,color:"rgba(230,237,243,0.55)",..._t,margin:"0 0 4px"},children:"Campaign DAG"}),y.jsx("p",{style:{fontSize:"10px",color:"rgba(230,237,243,0.35)",..._t,margin:0,lineHeight:1.5},children:"Pending core's Campaign primitive + RunFinished events (§4.3)."})]})]}),y.jsxs("div",{style:{...io,padding:"16px 20px"},children:[y.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"12px"},children:[y.jsx("p",{style:es,children:"Chats"}),y.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,..._t,cursor:"pointer",flexShrink:0},children:"New Chat"})]}),_.length===0?y.jsx("p",{style:{fontSize:"11px",color:"rgba(230,237,243,0.3)",..._t,fontStyle:"italic"},children:"No chats yet"}):y.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:_.slice(0,4).map(k=>y.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:L=>{L.currentTarget.style.background="rgba(230,237,243,0.03)"},onMouseLeave:L=>{L.currentTarget.style.background="transparent"},children:[y.jsx("span",{style:{width:"7px",height:"7px",borderRadius:"50%",flexShrink:0,background:Tc.has(k.session.status)?"#79c0ff":k.session.status==="completed"?"#3fb950":"rgba(230,237,243,0.25)"}}),y.jsx("span",{style:{fontSize:"11px",color:"#e6edf3",..._t,flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Wl(k.session.problem||k.session.id,28)})]},k.session.id))}),_.length>4&&y.jsx("button",{type:"button",onClick:()=>i("/chats"),style:{fontSize:"11px",color:"#79c0ff",..._t,background:"none",border:"none",cursor:"pointer",padding:"8px 0 0",display:"block"},children:"view all →"})]})]}),w.length===0&&f.length>0&&y.jsxs("div",{style:{marginBottom:"28px"},children:[y.jsx("p",{style:{...es,marginBottom:"10px"},children:"Agent activity"}),y.jsxs("div",{style:{...io,padding:"14px",maxHeight:"220px",overflowY:"auto",display:"flex",flexDirection:"column",gap:"8px"},children:[b.slice(0,5).map(k=>y.jsx(cT,{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)),b.length===0&&y.jsx("p",{style:{fontSize:"12px",color:"rgba(230,237,243,0.28)",..._t,textAlign:"center",padding:"12px 0"},children:"Waiting for events…"})]})]}),E.length>0&&y.jsxs("div",{style:{marginBottom:"28px"},children:[y.jsx("p",{style:{...es,marginBottom:"10px"},children:"Sessions review"}),y.jsx("div",{style:{...io,padding:"4px 0",display:"flex",flexDirection:"column"},children:E.map((k,L)=>y.jsxs("button",{type:"button",onClick:()=>e(k.session.id),style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 16px",background:"transparent",border:"none",borderTop:L===0?"none":"1px solid rgba(230,237,243,0.05)",cursor:"pointer",textAlign:"left",width:"100%"},onMouseEnter:A=>{A.currentTarget.style.background="rgba(230,237,243,0.03)"},onMouseLeave:A=>{A.currentTarget.style.background="transparent"},children:[y.jsx("span",{style:{width:"7px",height:"7px",borderRadius:"50%",flexShrink:0,background:"#3fb950"}}),y.jsx("span",{style:{fontSize:"12px",color:"#e6edf3",..._t,flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Wl(k.session.problem||k.session.id,60)}),y.jsx("span",{style:{fontSize:"10px",color:"rgba(230,237,243,0.3)",..._t,flexShrink:0},children:k.session.id.slice(0,8)}),y.jsx("span",{style:{fontSize:"10px",color:"rgba(121,192,255,0.5)",..._t,flexShrink:0},children:"→"})]},k.session.id))})]}),y.jsx(hT,{activeRuns:f})]})]})}function Nc({label:t,value:e,color:r}){return y.jsxs("div",{style:{textAlign:"right"},children:[y.jsx("p",{style:{fontSize:"10px",color:"rgba(230,237,243,0.38)",..._t,margin:0},children:t}),y.jsx("p",{style:{fontSize:"16px",fontWeight:600,color:r,..._t,margin:"2px 0 0"},children:e})]})}const pT=t=>["completed","failed","cancelled"].includes(t);function gT({runs:t,onSelect:e,navigate:r}){const[n,i]=K.useState(""),{range:a,setRange:s,filter:o}=dm("30d"),l=K.useMemo(()=>t.filter(f=>!f.session.workflow_id||f.session.workflow_id==="chat"),[t]),u=K.useMemo(()=>o(l),[l,o]),c=K.useMemo(()=>u.filter(f=>!pT(f.session.status)),[u]),d=K.useMemo(()=>{if(u.length===0)return"—";const x=u.reduce((S,v)=>S+v.units.length,0)/u.length;return x%1===0?String(x):x.toFixed(1)},[u]),p=K.useMemo(()=>n?u.filter(f=>f.session.problem.toLowerCase().includes(n.toLowerCase())):u,[u,n]);return y.jsxs("div",{className:"flex flex-col gap-6",style:{color:"#e6edf3"},children:[y.jsxs("div",{className:"px-8 pt-8 pb-4 flex items-center justify-between gap-4",children:[y.jsx("h1",{className:"text-2xl font-semibold font-mono",children:"Chats"}),y.jsxs("div",{className:"flex items-center gap-3",children:[y.jsx(hm,{value:a,onChange:s}),y.jsx("input",{type:"text",placeholder:"Search chats…",value:n,onChange:f=>i(f.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"}}),y.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"})]})]}),y.jsx("div",{className:"px-8 grid grid-cols-3 gap-4",children:[{label:"Total Chats",value:String(u.length),accent:void 0},{label:"Active",value:String(c.length),accent:"#79c0ff"},{label:"Avg Units",value:d,accent:"#a78bfa"}].map(f=>y.jsxs("div",{className:"rounded-2xl px-6 py-4",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.07)"},children:[y.jsx("p",{className:"text-xs font-mono uppercase tracking-widest",style:{color:"rgba(230,237,243,0.4)"},children:f.label}),y.jsx("p",{className:"text-3xl font-semibold mt-1",style:{color:f.accent??"#e6edf3"},children:f.value})]},f.label))}),y.jsx("div",{className:"px-8 pb-8 flex flex-col gap-2",children:p.length===0?y.jsxs("div",{className:"rounded-2xl p-10 text-center",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.07)"},children:[y.jsx("p",{className:"text-base font-mono font-semibold mb-3",children:"No chat sessions yet"}),y.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."}),y.jsx("p",{className:"mt-5",children:y.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"})})]}):p.map(f=>y.jsxs("button",{type:"button",onClick:()=>e(f.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:[y.jsx("p",{className:"text-sm font-mono truncate",children:f.session.problem}),y.jsxs("p",{className:"text-xs mt-1 font-mono",style:{color:"rgba(230,237,243,0.35)"},children:[f.session.id.slice(0,8)," · ",f.session.status]})]},f.session.id))})]})}function fm(t){return`${(t*100).toFixed(1)}%`}function pm(t){return t.behavior_bearing===0?"—":t.unaccounted>0&&t.coverage*100>=99.95?"<100%":fm(t.coverage)}function Kx(t,e){return e===0?"—":fm(t)}function vT(t){return t.behavior_bearing===0?"no-data":t.unaccounted===0?"pass":"deny"}function mT({report:t}){const e=vT(t),r={pass:{bg:"rgba(63,185,80,0.12)",fg:"#3fb950",bd:"rgba(63,185,80,0.3)",label:"GATE PASS"},deny:{bg:"rgba(248,81,73,0.12)",fg:"#f85149",bd:"rgba(248,81,73,0.3)",label:"GATE FAIL"},"no-data":{bg:"rgba(230,237,243,0.08)",fg:"rgba(230,237,243,0.6)",bd:"rgba(230,237,243,0.2)",label:"NOT EXTRACTED"}}[e];return y.jsx("span",{className:"inline-flex items-center gap-1 rounded px-2 py-0.5 text-xs font-semibold font-mono",style:{background:r.bg,color:r.fg,border:`1px solid ${r.bd}`},title:e==="no-data"?"No behavior-bearing nodes: nothing has been annotated, so coverage is undefined rather than complete.":`Gate rule: behavior_bearing >= 1 and unaccounted == 0 (currently ${t.behavior_bearing} and ${t.unaccounted}).`,children:r.label})}function yT({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:pm(t)},{label:"Resolved rate",value:Kx(t.resolved_rate,t.resolved+t.risk_flagged)},{label:"Mean confidence",value:Kx(t.mean_confidence,t.resolved)},{label:"Threshold",value:fm(t.resolve_threshold)}];return y.jsx("div",{className:"grid grid-cols-3 gap-2 sm:grid-cols-5",children:e.map(({label:r,value:n})=>y.jsxs("div",{className:"rounded p-2 text-center",style:{border:"1px solid rgba(230,237,243,0.07)",background:"#1b222e"},children:[y.jsx("p",{className:"text-[11px]",style:{color:"rgba(230,237,243,0.4)"},children:r}),y.jsx("p",{className:"text-sm font-semibold",style:{color:"#e6edf3"},children:n})]},r))})}function xT({apps:t}){return t.length===0?y.jsx("p",{className:"text-xs",style:{color:"rgba(230,237,243,0.4)"},children:"No per-app data."}):y.jsxs("table",{className:"w-full text-[11px]",children:[y.jsx("thead",{children:y.jsxs("tr",{className:"border-b text-left",style:{borderColor:"rgba(230,237,243,0.08)",color:"rgba(230,237,243,0.4)"},children:[y.jsx("th",{className:"py-1 pr-3 font-medium",children:"App"}),y.jsx("th",{className:"py-1 pr-3 font-medium text-right",children:"Behavior-bearing"}),y.jsx("th",{className:"py-1 pr-3 font-medium text-right",children:"Resolved"}),y.jsx("th",{className:"py-1 pr-3 font-medium text-right",children:"Risk"}),y.jsx("th",{className:"py-1 pr-3 font-medium text-right",children:"Unaccounted"}),y.jsx("th",{className:"py-1 font-medium text-right",children:"Coverage"})]})}),y.jsx("tbody",{children:t.map(e=>y.jsxs("tr",{className:"border-b",style:{borderColor:"rgba(230,237,243,0.06)"},children:[y.jsx("td",{className:"py-1 pr-3 font-mono",style:{color:"rgba(230,237,243,0.7)"},children:e.app}),y.jsx("td",{className:"py-1 pr-3 text-right",style:{color:"rgba(230,237,243,0.6)"},children:e.behavior_bearing}),y.jsx("td",{className:"py-1 pr-3 text-right",style:{color:"#3fb950"},children:e.resolved}),y.jsx("td",{className:"py-1 pr-3 text-right",style:{color:"#ffda19"},children:e.risk_flagged}),y.jsx("td",{className:"py-1 pr-3 text-right",style:{color:"#f85149"},children:e.unaccounted}),y.jsx("td",{className:"py-1 text-right font-semibold",style:{color:"#e6edf3"},children:pm(e)})]},e.app))})]})}function Rc({col:t,active:e,dir:r,onSort:n,children:i}){return y.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 bT({nodes:t}){const[e,r]=K.useState(""),[n,i]=K.useState("file"),[a,s]=K.useState("asc"),[o,l]=K.useState(""),[u,c]=K.useState(""),d=K.useMemo(()=>[...new Set(t.map(v=>v.kind??"").filter(Boolean))].sort(),[t]),p=K.useMemo(()=>[...new Set(t.map(v=>v.app??"").filter(Boolean))].sort(),[t]),f=K.useCallback(v=>{v===n?s(m=>m==="asc"?"desc":"asc"):(i(v),s("asc"))},[n]),x=K.useMemo(()=>{let v=t;if(e){const m=e.toLowerCase();v=v.filter(b=>(b.name??"").toLowerCase().includes(m)||(b.file??"").toLowerCase().includes(m)||(b.symbol_id??"").toLowerCase().includes(m))}return o&&(v=v.filter(m=>m.kind===o)),u&&(v=v.filter(m=>m.app===u)),[...v].sort((m,b)=>{const w=n==="name"?m.name??m.symbol_id:m[n]??"",_=n==="name"?b.name??b.symbol_id:b[n]??"";return a==="asc"?w.localeCompare(_):_.localeCompare(w)})},[t,e,o,u,n,a]),S={background:"#161c26",border:"1px solid rgba(230,237,243,0.1)",color:"#e6edf3"};return t.length===0?y.jsx("p",{className:"text-xs",style:{color:"#3fb950"},children:"No unaccounted nodes — gate is satisfied."}):y.jsxs("div",{className:"flex flex-col gap-2",children:[y.jsxs("div",{className:"flex flex-wrap gap-2",children:[y.jsx("input",{type:"text","aria-label":"Search by name, file, or symbol id",placeholder:"Search name / file / id…",value:e,onChange:v=>r(v.target.value),className:"rounded px-2 py-1 text-[11px] w-48 focus:outline-none",style:S}),y.jsxs("select",{"aria-label":"Filter by kind",value:o,onChange:v=>l(v.target.value),className:"rounded px-2 py-1 text-[11px] focus:outline-none",style:S,children:[y.jsx("option",{value:"",children:"All kinds"}),d.map(v=>y.jsx("option",{value:v,children:v},v))]}),y.jsxs("select",{"aria-label":"Filter by app",value:u,onChange:v=>c(v.target.value),className:"rounded px-2 py-1 text-[11px] focus:outline-none",style:S,children:[y.jsx("option",{value:"",children:"All apps"}),p.map(v=>y.jsx("option",{value:v,children:v},v))]}),y.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":""]})]}),y.jsxs("table",{className:"w-full text-[11px]",children:[y.jsx("thead",{children:y.jsxs("tr",{className:"border-b",style:{borderColor:"rgba(230,237,243,0.08)"},children:[y.jsx("th",{className:"py-1 pr-3",children:y.jsx(Rc,{col:"name",active:n,dir:a,onSort:f,children:"Name"})}),y.jsx("th",{className:"py-1 pr-3",children:y.jsx(Rc,{col:"kind",active:n,dir:a,onSort:f,children:"Kind"})}),y.jsx("th",{className:"py-1 pr-3",children:y.jsx(Rc,{col:"app",active:n,dir:a,onSort:f,children:"App"})}),y.jsx("th",{className:"py-1",children:y.jsx(Rc,{col:"file",active:n,dir:a,onSort:f,children:"File"})})]})}),y.jsx("tbody",{children:x.map(v=>y.jsxs("tr",{className:"border-b",style:{borderColor:"rgba(230,237,243,0.06)"},children:[y.jsx("td",{className:"py-1 pr-3 font-mono",style:{color:"rgba(230,237,243,0.7)"},children:v.name??v.symbol_id}),y.jsx("td",{className:"py-1 pr-3",style:{color:"rgba(230,237,243,0.45)"},children:v.kind??"—"}),y.jsx("td",{className:"py-1 pr-3",style:{color:"rgba(230,237,243,0.45)"},children:v.app??"—"}),y.jsx("td",{className:"py-1",style:{color:"rgba(230,237,243,0.35)"},title:v.file,children:y.jsx("div",{className:"truncate max-w-xs",children:v.file??"—"})})]},v.symbol_id))})]})]})}function fS(){const[t,e]=K.useState(null),[r,n]=K.useState(!0),[i,a]=K.useState(null),[s,o]=K.useState([]),[l,u]=K.useState(""),[c,d]=K.useState(null),p=K.useCallback(async()=>{n(!0),a(null);try{if(l){const[{report:f},{kinds:x}]=await Promise.all([Ue.getCoverageReportForRepo(l),Ue.getGraphKindsForRepo(l)]);e(f),d(x)}else{const{report:f}=await Ue.getCoverageReport();e(f),d(null)}}catch(f){a(f instanceof Error?f.message:String(f))}finally{n(!1)}},[l]);return K.useEffect(()=>{Ue.listRepos().then(({repos:f})=>o(f)).catch(()=>o([]))},[]),K.useEffect(()=>{p()},[p]),y.jsxs("div",{className:"flex flex-col gap-4",children:[y.jsxs("div",{className:"flex items-center justify-between",children:[y.jsx("h2",{className:"text-sm font-semibold",style:{color:"#e6edf3"},children:"Coverage gate"}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsxs("select",{"aria-label":"Coverage repo",value:l,onChange:f=>u(f.target.value),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)",background:"transparent"},children:[y.jsx("option",{value:"",children:"All (daemon)"}),s.map(f=>y.jsx("option",{value:f.id,children:f.name},f.id))]}),y.jsx("button",{type:"button",onClick:()=>void p(),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&&y.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&&y.jsxs("p",{className:"text-xs",style:{color:"rgba(230,237,243,0.4)"},children:["No coverage data — run"," ",y.jsx("code",{className:"font-mono",style:{color:"rgba(230,237,243,0.6)"},children:"wicked-core rules ingest"})," ","to populate."]}),c&&y.jsxs("section",{className:"flex flex-col gap-1","aria-label":"Code graph summary",children:[y.jsxs("p",{className:"text-[11px] font-semibold uppercase tracking-wider font-mono",style:{color:"rgba(230,237,243,0.4)"},children:["Code graph (",c.reduce((f,x)=>f+x.count,0)," nodes)"]}),c.length===0?y.jsx("p",{className:"text-xs",style:{color:"rgba(230,237,243,0.4)"},children:"This repo’s graph holds no nodes yet — onboard the repo to populate it."}):y.jsx("table",{className:"text-xs",style:{color:"rgba(230,237,243,0.7)"},children:y.jsx("tbody",{children:c.map(f=>y.jsxs("tr",{children:[y.jsx("td",{className:"pr-4 font-mono",children:f.kind}),y.jsx("td",{className:"text-right tabular-nums",children:f.count})]},f.kind))})})]}),t&&y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"flex items-center gap-3",children:[y.jsx("span",{className:"text-2xl font-bold",style:{color:"#e6edf3"},children:pm(t)}),y.jsx(mT,{report:t})]}),y.jsx(yT,{report:t}),t.per_app.length>0&&y.jsxs("section",{className:"flex flex-col gap-1",children:[y.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wider font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Per-app"}),y.jsx(xT,{apps:t.per_app})]}),y.jsxs("section",{className:"flex flex-col gap-2",children:[y.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,")"]}),y.jsx(bT,{nodes:t.unaccounted_nodes})]})]})]})}function wT(t){if(!t)return null;const r={active:"#3fb950",proposed:"#ffda19",deprecated:"#f85149"}[t]??"rgba(230,237,243,0.5)";return y.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 ST({id:t,req:e}){var i,a,s,o,l;const[r,n]=K.useState(!1);return y.jsxs("div",{className:"rounded",style:{border:"1px solid rgba(230,237,243,0.07)"},children:[y.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:[y.jsx("span",{className:"mt-0.5 shrink-0 text-[10px]",style:{color:"rgba(230,237,243,0.25)"},children:r?"▾":"▸"}),y.jsxs("div",{className:"flex-1 min-w-0",children:[y.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[y.jsx("span",{className:"font-mono text-[10px]",style:{color:"rgba(230,237,243,0.35)"},children:t}),y.jsx("span",{className:"text-[11px] font-medium truncate",style:{color:"#e6edf3"},children:e.title}),wT(e.status),e.disposition&&y.jsx("span",{className:"text-[10px] italic",style:{color:"rgba(230,237,243,0.4)"},children:e.disposition})]}),!r&&e.description&&y.jsx("p",{className:"text-[10px] truncate mt-0.5",style:{color:"rgba(230,237,243,0.4)"},children:e.description})]}),y.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 · ",((a=e.validations)==null?void 0:a.length)??0,"val"]})]}),r&&y.jsxs("div",{className:"px-4 pb-3 flex flex-col gap-2 text-[10px]",style:{background:"#0f1419"},children:[e.description&&y.jsx("p",{style:{color:"rgba(230,237,243,0.55)"},children:e.description}),(((s=e.business_rules)==null?void 0:s.length)??0)>0&&y.jsxs("div",{children:[y.jsx("p",{className:"font-semibold uppercase tracking-wider mb-1 font-mono",style:{color:"rgba(230,237,243,0.35)"},children:"Business rules"}),y.jsx("ul",{className:"flex flex-col gap-0.5",children:(e.business_rules??[]).map(u=>y.jsxs("li",{className:"flex items-start gap-1.5",children:[y.jsx("span",{className:"font-mono shrink-0",style:{color:"rgba(230,237,243,0.25)"},children:u.id}),y.jsx("span",{style:{color:"rgba(230,237,243,0.65)"},children:u.statement}),y.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))})]}),(((o=e.validations)==null?void 0:o.length)??0)>0&&y.jsxs("div",{children:[y.jsx("p",{className:"font-semibold uppercase tracking-wider mb-1 font-mono",style:{color:"rgba(230,237,243,0.35)"},children:"Validations"}),y.jsx("ul",{className:"flex flex-col gap-0.5",children:(e.validations??[]).map(u=>y.jsxs("li",{className:"flex items-start gap-1.5",children:[y.jsx("span",{className:"font-mono shrink-0",style:{color:"rgba(230,237,243,0.25)"},children:u.id}),y.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&&y.jsxs("div",{children:[y.jsx("p",{className:"font-semibold uppercase tracking-wider mb-1 font-mono",style:{color:"rgba(248,81,73,0.6)"},children:"Error paths"}),y.jsx("ul",{className:"flex flex-col gap-0.5",children:(e.error_paths??[]).map(u=>y.jsxs("li",{className:"flex items-start gap-1.5",children:[y.jsx("span",{className:"font-mono shrink-0",style:{color:"rgba(230,237,243,0.25)"},children:u.id}),y.jsx("span",{style:{color:"#f85149"},children:u.statement})]},u.id))})]})]})]})}function _T({name:t,domain:e}){const[r,n]=K.useState(!0),i=Object.keys(e.requirements??{}),a=Object.keys(e.entities??{});return y.jsxs("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid rgba(230,237,243,0.08)"},children:[y.jsxs("button",{type:"button",onClick:()=>n(s=>!s),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:s=>{s.currentTarget.style.background="#1f2937"},onMouseLeave:s=>{s.currentTarget.style.background="#1b222e"},children:[y.jsx("span",{className:"text-[10px]",style:{color:"rgba(230,237,243,0.35)"},children:r?"▾":"▸"}),y.jsx("span",{className:"font-semibold text-[12px]",style:{color:"#e6edf3"},children:t}),y.jsxs("span",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.35)"},children:[i.length," req · ",a.length," entity"]}),e.cluster_id!==void 0&&y.jsxs("span",{className:"ml-auto text-[10px] font-mono",style:{color:"rgba(230,237,243,0.25)"},children:["cluster ",e.cluster_id]})]}),r&&y.jsxs("div",{className:"p-3 flex flex-col gap-2",style:{background:"#161c26"},children:[e.description&&y.jsx("p",{className:"text-[10px] italic",style:{color:"rgba(230,237,243,0.4)"},children:e.description}),i.length>0&&y.jsx("div",{className:"flex flex-col gap-1",children:i.map(s=>y.jsx(ST,{id:s,req:e.requirements[s]},s))}),a.length>0&&y.jsxs("div",{children:[y.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider mb-1 font-mono",style:{color:"rgba(230,237,243,0.35)"},children:"Entities"}),y.jsx("div",{className:"flex flex-wrap gap-1",children:a.map(s=>{var o;return y.jsx("span",{title:(o=e.entities[s])==null?void 0:o.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:s},s)})})]})]})]})}function CT(){const[t,e]=K.useState(null),[r,n]=K.useState(!0),[i,a]=K.useState(null),[s,o]=K.useState(""),l=K.useCallback(async()=>{n(!0),a(null);try{const{graph:d}=await Ue.getDomainGraph();e(d)}catch(d){a(d instanceof Error?d.message:String(d))}finally{n(!1)}},[]);if(K.useEffect(()=>{l()},[l]),r)return y.jsx("p",{className:"text-xs",style:{color:"rgba(230,237,243,0.4)"},children:"Loading domain model…"});if(i)return y.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 y.jsxs("div",{className:"flex flex-col gap-2",children:[y.jsx("p",{className:"text-sm",style:{color:"rgba(230,237,243,0.5)"},children:"No domain model found."}),y.jsxs("p",{className:"text-[10px]",style:{color:"rgba(230,237,243,0.4)"},children:["Run"," ",y.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"," ",y.jsx("span",{className:"font-mono",style:{color:"rgba(230,237,243,0.5)"},children:".wicked-estate/requirements/requirements_graph.json"}),"."]})]});const u=s.toLowerCase(),c=Object.keys(t.domains??{}).filter(d=>{var f;if(!u)return!0;const p=t.domains[d];return d.toLowerCase().includes(u)||(f=p.description)!=null&&f.toLowerCase().includes(u)?!0:Object.entries(p.requirements??{}).some(([x,S])=>{var v,m;return x.toLowerCase().includes(u)||((v=S.title)==null?void 0:v.toLowerCase().includes(u))||((m=S.description)==null?void 0:m.toLowerCase().includes(u))})});return y.jsxs("div",{className:"flex flex-col gap-4",children:[y.jsxs("div",{className:"flex items-center gap-3",children:[y.jsx("h2",{className:"text-sm font-semibold",style:{color:"#e6edf3"},children:"Domain Model"}),y.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"]}),y.jsx("input",{"aria-label":"Search domains and requirements",type:"search",placeholder:"Search…",value:s,onChange:d=>o(d.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"}}),y.jsx("button",{type:"button",onClick:()=>void l(),className:"text-[10px] hover:underline",style:{color:"rgba(230,237,243,0.4)"},children:"Refresh"})]}),c.length===0?y.jsx("p",{className:"text-xs",style:{color:"rgba(230,237,243,0.4)"},children:"No domains match your search."}):y.jsx("div",{className:"flex flex-col gap-3",children:c.map(d=>y.jsx(_T,{name:d,domain:t.domains[d]},d))}),t.metadata.source&&y.jsxs("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.25)"},children:["Source: ",y.jsx("span",{children:t.metadata.source})]})]})}function kT({onSelect:t,runId:e}){const r=Un(a=>a.gates),n=Object.values(r),i=e?n.filter(a=>a.runId===e):n;return i.length===0?y.jsx(y.Fragment,{}):y.jsx("div",{className:"fixed bottom-4 right-4 flex flex-col gap-2 z-50","data-testid":"gate-notification",style:{pointerEvents:"none"},children:i.map(a=>y.jsxs("button",{type:"button",onClick:()=>t(a.runId),"data-testid":"gate-toast","data-run-id":a.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)",pointerEvents:"auto"},onMouseEnter:s=>{s.currentTarget.style.borderColor="rgba(255,218,25,0.55)"},onMouseLeave:s=>{s.currentTarget.style.borderColor="rgba(255,218,25,0.35)"},children:[y.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[y.jsx("span",{className:"w-1.5 h-1.5 rounded-full animate-pulse",style:{background:"#ffda19"}}),y.jsx("p",{className:"text-xs font-semibold",style:{color:"#ffda19"},children:"Run awaiting human"})]}),y.jsxs("p",{className:"text-[11px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:[a.runId.slice(0,8)," · before unit #",a.ord]}),a.prompt&&y.jsx("p",{className:"mt-1 text-xs line-clamp-2",style:{color:"rgba(230,237,243,0.6)"},children:a.prompt}),y.jsx("p",{className:"mt-1.5 text-[11px] font-mono",style:{color:"#79c0ff"},children:"Review →"})]},a.runId))})}class gm extends Error{constructor(r){super(`Interactive bridge unavailable: ${r}`);Cc(this,"hint");this.name="BridgeUnavailableError",this.hint=r}}class Hd extends Error{constructor(r,n){super(r);Cc(this,"hint");this.name="ServiceHintError",this.hint=n}}function Ea(t){return`${um()}/projects/${encodeURIComponent(t)}/interactive`}function fo(t,e){return`${Ea(t)}${e.startsWith("/")?e:`/${e}`}`}function ms(t,e){return`${Ea(t)}/d/${encodeURIComponent(e)}`}async function Ln(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(t,{...e,headers:r});if(!n.ok){const i=await n.text();let a;try{const l=JSON.parse(i);typeof l=="object"&&l!==null&&(a=l)}catch{}if(n.status===503&&(a==null?void 0:a.code)==="bridge_unavailable")throw new gm(typeof a.hint=="string"?a.hint:"");const s=(a==null?void 0:a.error)??(a==null?void 0:a.message)??i,o=(typeof s=="string"?s:JSON.stringify(s))||n.statusText||String(n.status);throw typeof(a==null?void 0:a.hint)=="string"&&a.hint.trim()!==""?new Hd(`API ${n.status}: ${o}`,a.hint.trim()):new Error(`API ${n.status}: ${o}`)}return n.json()}const ys=t=>({method:"POST",body:JSON.stringify(t)});function vm(t){return Ln(`${Ea(t)}/api/docs`)}function mm(t,e){return Ln(`${ms(t,e)}/api/versions`)}function pS(t,e){return Ln(`${Ea(t)}/api/docs`,ys(e))}function gS(t,e,r,n){return Ln(`${ms(t,e)}/api/fork`,ys({from:r,...n?{source_message_id:n}:{}}))}function ET(t,e,r,n){return Ln(`${ms(t,e)}/api/export`,ys({version:r,format:n}))}function Ud(t,e){return Ln(`${Ea(t)}/api/events`,ys({event_type:e.event_type,payload:e.payload??{}}))}function TT(t){return Ln(`${Ea(t)}/api/themes`).then(e=>Array.isArray(e)?e:e.themes)}function NT(t,e){return Ln(`${Ea(t)}/api/theme/learn`,ys(e))}function RT(t,e,r){return Ln(`${ms(t,e)}/api/sources`,ys({path:r}))}function LT(t){return Ln(`${Ea(t)}/api/preflight`)}function DT(t){return vm(t).then(e=>e.filter(r=>r.kind==="demo"))}function AT(t,e){return Ln(`${ms(t,e)}/api/demo/spec`)}function PT(t,e){return Ln(`${ms(t,e)}/api/demo/recordings`)}function MT(t,e){return Ln(`${ms(t,e)}/api/demo/record`,ys({}))}function xd(t,e,r,n,i){return Ud(t,{event_type:"wicked.interactive.chat.posted",payload:{role:"user",text:r,document_id:e,source_message_id:n,...i===void 0||i===""?{}:{theme_id:i}}})}const Xx=["gate","failing","running","drafts","quiet"],OT=new Set(["planning","distributing","executing"]),jT=new Set(["crew.run","crew.chat"]);function IT(t){const e=t.interactiveRoot??t.interactive_root;return typeof e=="string"&&e.trim()!==""?e:null}function BT(t,e){return t.some(r=>r.session.status==="awaiting_human")?"gate":t.some(r=>r.session.status==="failed")?"failing":t.some(r=>OT.has(r.session.status))?"running":e.length>0?"drafts":"quiet"}function FT(t){return[...t].sort((e,r)=>Xx.indexOf(e.attention)-Xx.indexOf(r.attention)||r.project.updated_at-e.project.updated_at||e.project.name.localeCompare(r.project.name))}const zT={runIds:new Set,repo:null,docs:[]};async function Qx(t,e){var a;const[r,n]=await Promise.all([Ue.listProjectMembers(t.id).then(s=>s.members).catch(()=>[]),IT(t)?vm(t.id).catch(()=>[]):Promise.resolve([])]),i=((a=r.find(s=>s.member_kind==="crew.repo"))==null?void 0:a.member_ref)??null;return{runIds:new Set(r.filter(s=>jT.has(s.member_kind)).map(s=>s.member_ref)),repo:i===null?null:e.get(i)??i,docs:n}}function $T(t){const[e,r]=K.useState([]),[n,i]=K.useState({}),[a,s]=K.useState(!0),[o,l]=K.useState(null),u=K.useRef(new Map),c=K.useRef(new Set);return K.useEffect(()=>{let p=!1;return(async()=>{let f;try{const[{projects:S},v]=await Promise.all([Ue.listProjects(),Ue.listRepos().then(m=>m.repos).catch(()=>[])]);f=S.filter(m=>m.status==="active"),u.current=new Map(v.map(m=>[m.id,m.name]))}catch(S){p||(l(S instanceof Error?S.message:String(S)),s(!1));return}if(p)return;r(f),s(!1);const x=await Promise.all(f.map(async S=>[S.id,await Qx(S,u.current)]));p||i(Object.fromEntries(x))})(),()=>{p=!0}},[]),K.useEffect(()=>{if(e.length===0||Object.keys(n).length===0)return;const p=new Set(Object.values(n).flatMap(S=>[...S.runIds])),f=t.filter(S=>!p.has(S.session.id)&&!c.current.has(S.session.id));if(f.length===0)return;for(const S of f)c.current.add(S.session.id);let x=!1;return(async()=>{const S=await Promise.all(e.map(async v=>[v.id,await Qx(v,u.current)]));x||i(Object.fromEntries(S))})(),()=>{x=!0}},[t,e,n]),{items:K.useMemo(()=>FT(e.map(p=>{const f=n[p.id]??zT,x=t.filter(S=>f.runIds.has(S.session.id));return{project:p,repo:f.repo,runs:x,docs:f.docs,attention:BT(x,f.docs)}})),[e,n,t]),loading:a,error:o}}const HT=new Set(["wiring the harness","pondering the loop","tightening the bolts","consulting the spine","aligning the lanes","reticulating splines","checking the gates"]),UT=/reticulat|splines/i,WT=/^(working|processing|thinking|running|busy|loading|please wait|one moment)$/u;function vS(t){return t.toLowerCase().replace(/\s+/g," ").replace(/[\s….!]+$/u,"").trim()}function VT(t){return UT.test(t)||HT.has(vS(t))}function GT(t){return WT.test(vS(t))}function ym(t){return VT(t)||GT(t)}function qT(t,e){for(let r=t.length-1;r>=0;r-=1){const n=(t[r]??"").trim();if(n!==""&&!ym(n))return n}return e}const Lc=2e5,ua=500;function bd(t,e){return`${t}:u${e}`}const Zx=160;function Jx(t){const e=t.replace(/\r/g,"").split(`
|
|
46
|
+
`)[0]??"";return e.length>Zx?`${e.slice(0,Zx-1)}…`:e}function Dc(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"councilSeatFailed":{const e=typeof t.exitCode=="number"?` (exit ${t.exitCode})`:"",r=typeof t.stderr=="string"&&t.stderr.trim()||typeof t.detail=="string"&&t.detail.trim()||"";return`seat ${String(t.cli??"?")} did not vote — ${String(t.kind??"unreported")}${e}${Jx(r)?`: ${Jx(r)}`:""}`}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}}function e1(t){return t.type==="unitOutputDelta"&&typeof t.text=="string"?t.text:t.type==="cliOutputDelta"&&typeof t.chunk=="string"?t.chunk:null}const YT="wicked.interactive.status.posted";function pl(t,...e){for(const r of e){const n=t[r];if(typeof n=="string"&&n.trim()!=="")return n.trim()}return null}function KT(t){if(t.type!=="interactiveEvent"||typeof t.event!="object"||t.event===null)return null;const e=t.event;if(pl(e,"event_type","type")!==YT)return null;const r=typeof e.payload=="object"&&e.payload!==null?e.payload:{},n=pl(r,"project_id","project")??pl(e,"project_id","project"),i=pl(r,"message","status","text");return n===null||i===null||ym(i)?null:{projectId:n,activity:{docId:pl(r,"document_id","doc_id","document"),message:i,at:Date.now()}}}const Wn=si(t=>({outputs:{},deltaSeq:{},docActivity:{},councilStatus:{},assumptions:{},logs:{},executorTypes:{},terminalIds:{},seq:0,ingest:e=>{const r=KT(e);if(r!==null){t(i=>({seq:i.seq+1,docActivity:{...i.docActivity,[r.projectId]:r.activity}}));return}const n=typeof e.session=="string"?e.session:void 0;n!==void 0&&t(i=>{var d;const a=i.seq+1,s=e1(e);if(s!==null&&typeof e.ord=="number"){const p=bd(n,e.ord);let x=(i.outputs[p]??"")+s;return x.length>Lc&&(x=x.slice(x.length-Lc)),{seq:a,outputs:{...i.outputs,[p]:x},deltaSeq:{...i.deltaSeq,[n]:a}}}if(e.type==="heartbeat")return{seq:a};if(e.type==="assumptionRecorded"&&typeof e.ord=="number"&&typeof e.library=="string"&&typeof e.transform=="string"){const p={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:""},f=i.assumptions[n]??[];return{seq:a,assumptions:{...i.assumptions,[n]:[...f,p]}}}if(e.type==="councilSeatFailed"&&typeof e.ord=="number"){const p=`${n}:${e.ord}`,f=i.councilStatus[p],x={cli:typeof e.cli=="string"?e.cli:"?",kind:typeof e.kind=="string"?e.kind:"unreported",...typeof e.exitCode=="number"?{exitCode:e.exitCode}:{},why:(typeof e.stderr=="string"&&e.stderr.trim()||typeof e.detail=="string"&&e.detail.trim()||"").replace(/\r\n?/g,`
|
|
47
|
+
`)},S={seq:a,type:e.type,ts:Date.now(),detail:Dc(e)};S.ord=e.ord;const m=[...i.logs[n]??[],S];return m.length>ua&&m.splice(0,m.length-ua),{seq:a,councilStatus:{...i.councilStatus,[p]:{...f??{state:"convened"},failedSeats:[...(f==null?void 0:f.failedSeats)??[],x]}},logs:{...i.logs,[n]:m}}}if((e.type==="councilConvened"||e.type==="councilDeliberated"||e.type==="councilVoted")&&typeof e.ord=="number"){const p=`${n}:${e.ord}`,f=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}:{}},x=(d=i.councilStatus[p])==null?void 0:d.failedSeats;x!==void 0&&x.length>0&&(f.failedSeats=x);const S={seq:a,type:e.type,ts:Date.now(),detail:Dc(e)};S.ord=e.ord,typeof e.attempt=="number"&&(S.attempt=e.attempt);const m=[...i.logs[n]??[],S];return m.length>ua&&m.splice(0,m.length-ua),{seq:a,councilStatus:{...i.councilStatus,[p]:f},logs:{...i.logs,[n]:m}}}const o=e.executorType??e.executor_type;if(e.type==="unitPlanned"&&typeof e.ord=="number"&&(o==="agent"||o==="tool")){const p=`${n}:${e.ord}`;return{seq:a,executorTypes:{...i.executorTypes,[p]:o},...(()=>{const f={seq:a,type:e.type,ts:Date.now(),detail:Dc(e)};f.ord=e.ord;const S=[...i.logs[n]??[],f];return S.length>ua&&S.splice(0,S.length-ua),{logs:{...i.logs,[n]:S}}})()}}if(e.type==="workerSessionStarted"&&typeof e.terminalId=="string"&&typeof e.cliKey=="string"){const p=`${n}:${e.cliKey}`;return{seq:a,terminalIds:{...i.terminalIds,[p]:e.terminalId}}}const l={seq:a,type:e.type,ts:Date.now(),detail:Dc(e)};typeof e.ord=="number"&&(l.ord=e.ord),typeof e.attempt=="number"&&(l.attempt=e.attempt);const c=[...i.logs[n]??[],l];return c.length>ua&&c.splice(0,c.length-ua),{seq:a,logs:{...i.logs,[n]:c}}})},hydrateOutputs:(e,r)=>t(n=>{const i={};for(const a of r){if(a.session!==e)continue;const s=e1(a);if(s===null||typeof a.ord!="number")continue;const o=bd(e,a.ord);if(n.outputs[o]!==void 0)continue;let l=(i[o]??"")+s;l.length>Lc&&(l=l.slice(l.length-Lc)),i[o]=l}return Object.keys(i).length===0?n:{outputs:{...i,...n.outputs}}}),clear:e=>t(r=>{const n={...r.outputs};for(const c of Object.keys(n))c.startsWith(`${e}:u`)&&delete n[c];const i={...r.councilStatus};for(const c of Object.keys(i))c.startsWith(`${e}:`)&&delete i[c];const a={...r.assumptions};delete a[e];const s={...r.executorTypes};for(const c of Object.keys(s))c.startsWith(`${e}:`)&&delete s[c];const o={...r.terminalIds};for(const c of Object.keys(o))c.startsWith(`${e}:`)&&delete o[c];const l={...r.logs};delete l[e];const u={...r.deltaSeq};return delete u[e],{outputs:n,deltaSeq:u,councilStatus:i,assumptions:a,executorTypes:s,terminalIds:o,logs:l}})})),XT=new Set(["completed","cancelled","failed"]);function QT(t){return!XT.has(t.session.status)}const ZT=new Set(["sessionStarted","unitPlanned","unitDistributed","unitExecuting","unitDone","unitDenied","awaitingHuman","resumed","workerStalled","stepFailed"]),t1=110,JT=/\u001B\[[0-9;?]*[ -\u002F]*[@-~]/g,eN=/[█▉▊▋▌▍▎▏▁▂▃▄▅▆▇░▒▓]{2,}|[=#*.-]{6,}/;function mS(t){return t.length>t1?`${t.slice(0,t1-1)}…`:t}function tN(t){if(t===void 0||t==="")return null;const e=t.replace(JT,"").split(/[\r\n]+/);for(let r=e.length-1;r>=0;r--){const n=(e[r]??"").trim();if(!(n===""||!/[\p{L}\p{N}]/u.test(n)||eN.test(n)))return mS(n)}return null}function yS(t){return t.units[t.session.unit_ix]??t.units[t.units.length-1]}function rN({view:t,text:e,log:r,deltaSeq:n}){const i=yS(t),a=(i==null?void 0:i.stage)??t.session.status,s=[...r??[]].reverse().find(l=>ZT.has(l.type)),o=(s!==void 0&&s.seq>n&&s.detail||null)??tN(e)??(i==null?void 0:i.description)??t.session.problem;return`${a} — ${mS(o.trim())}`}function nN(t){var s;const e=t.session.id,r=((s=yS(t))==null?void 0:s.ord)??0,n=Wn(o=>o.outputs[bd(e,r)]),i=Wn(o=>o.logs[e]),a=Wn(o=>o.deltaSeq[e]??-1);return rN({view:t,text:n,log:i,deltaSeq:a})}const iN=["runs","coverage","workflows","domain","policies","rules","repos","system","chats","work","repo-detail","projects","project-detail"],xm=["chat","build","document","video"];function xS(t){return xm.includes(t)?t:null}const aN={panel:"runs",runId:null,showLaunch:!1,repoId:null,showRegisterRepo:!1,chatMode:!1,projectId:null,mode:null,artifactId:null};function ei(t){return{...aN,...t}}function gl(t){try{return decodeURIComponent(t)}catch{return t}}const bS="wk.studio.lastMode";function sN(t){try{return xS(window.localStorage.getItem(`${bS}.${t}`)??"")??"chat"}catch{return"chat"}}function oN(t,e){try{window.localStorage.setItem(`${bS}.${t}`,e)}catch{}}function Tn(t,e,r){const n=`/p/${encodeURIComponent(t)}/${e}`;return r?`${n}/${encodeURIComponent(r)}`:n}function wd(t,e,r){const n=Tn(t,"document",e);return r===null?n:`${n}?v=${r}`}function r1(t){const e=new URLSearchParams(t).get("v");if(e===null)return null;const r=Number(e);return Number.isInteger(r)&&r>0?r:null}function lN(t){const[,e="",r="",n="",i=""]=t.split("/");if(e==="")return ei({panel:"home"});if(e==="p"&&r){const a=xS(n),s=a!==null&&i?gl(i):null;return ei({projectId:gl(r),mode:a,artifactId:s,runId:a==="build"||a==="chat"?s:null,chatMode:a==="chat"})}return e==="repo-detail"&&r?ei({panel:"repo-detail",repoId:gl(r)}):e==="repo-detail"?ei({panel:"repos"}):e==="repos"&&r==="new"?ei({panel:"repos",showRegisterRepo:!0}):e==="chat"&&r==="new"?ei({panel:"runs",showLaunch:!0,chatMode:!0}):e==="projects"&&r?ei({panel:"project-detail",projectId:gl(r)}):iN.includes(e)&&e!=="runs"?ei({panel:e}):ei(r==="new"?{panel:"runs",showLaunch:!0}:r?{panel:"runs",runId:gl(r)}:{panel:"runs"})}function uN(){const[t,e]=K.useState(()=>window.location.pathname),[r,n]=K.useState(()=>window.location.search);K.useEffect(()=>{const s=()=>{e(window.location.pathname),n(window.location.search)};return window.addEventListener("popstate",s),()=>window.removeEventListener("popstate",s)},[]);const i=K.useCallback((s,o)=>{o!=null&&o.replace?history.replaceState(null,"",s):history.pushState(null,"",s);const l=new URL(s,window.location.origin);e(l.pathname),n(l.search)},[]),a=K.useCallback(s=>s==="home"?"/":`/${s}`,[]);return{...lN(t),navigate:i,panelPath:a,search:r}}let cN=0;function tn(){return`dmsg-${++cN}`}const dN="wicked.interactive.status.posted",hN="wicked.interactive.chat.posted",fN="wicked.interactive.review.completed",pN="wicked.interactive.version.created",gN="wicked.interactive.export.generated",vN=new Set(["generated","structural","demo"]);function Lr(t,...e){for(const r of e){const n=t[r];if(typeof n=="string"&&n.trim()!=="")return n.trim()}return null}function mN(t){if(t.type!=="interactiveEvent")return null;const e=t.event;if(typeof e!="object"||e===null)return null;const r=Lr(e,"event_type","type"),n=typeof e.payload=="object"&&e.payload!==null?e.payload:e,i=Lr(n,"document_id","doc_id","document"),a=Lr(n,"project_id","project")??Lr(e,"project_id","project");return r===null||i===null||a===null?null:{key:ii(a,i),type:r,payload:n}}function ii(t,e){return`${t}:${e}`}function fi(t,e,r){return{...t,[e]:[...t[e]??[],r]}}const an=si(t=>({messages:{},genState:{},anchor:{},landed:{},ingest:e=>{const r=mN(e);if(r===null)return;const{key:n,type:i,payload:a}=r;t(s=>{const o=s.messages,l=s.genState[n]??"terminal";if(i===dN){const u=Lr(a,"state")??"working",c=Lr(a,"message","status","text");if(u==="asking"){const f=Lr(a,"request_id","requestId"),x=Lr(a,"question")??c;if(f===null||x===null)return s;const S=Array.isArray(a.options)?a.options.filter(v=>typeof v=="string"):[];return{messages:fi(o,n,{kind:"gate",id:tn(),requestId:f,question:x,options:S}),genState:{...s.genState,[n]:"gated"}}}const p=u==="complete"||u==="error"?"terminal":l==="gated"?"gated":"generating";return c===null||ym(c)?{genState:{...s.genState,[n]:p}}:{messages:fi(o,n,{kind:"narration",id:tn(),text:c}),genState:{...s.genState,[n]:p}}}if(i===hN){const u=Lr(a,"role")??"agent",c=Lr(a,"text","message","content");if(c===null||u==="user")return s;const d=Lr(a,"reviewer","author","cli")??(u==="review"?"reviewer":"agent");return{messages:fi(o,n,u==="review"?{kind:"verdict",id:tn(),author:d,text:c}:{kind:"agent",id:tn(),author:d,text:c})}}if(i===fN){const u=Lr(a,"reviewer","author")??"reviewer",c=Lr(a,"verdict","message","text")??`${u} review complete`;return{messages:fi(o,n,{kind:"verdict",id:tn(),author:u,text:c})}}if(i===gN){const u=Lr(a,"format")??"file",c=Lr(a,"file")??u,d=Lr(a,"download");return d!==null&&(o[n]??[]).some(p=>p.kind==="agent"&&p.href===d)?s:{messages:fi(o,n,{kind:"agent",id:tn(),author:"export",text:`${u.toUpperCase()} export ready — ${c}`,...d===null?{}:{href:d,file:c}})}}if(i===pN){const u=a.version,c=typeof u=="number"?u:Number(Lr(a,"version")??NaN),d=Lr(a,"kind")??"";if(!Number.isInteger(c))return s;const p=s.anchor[n],f=vN.has(d),x=p===void 0?o:{...o,[n]:(o[n]??[]).map(v=>v.kind==="user"&&v.id===p?{...v,version:c}:v)},S={...s.anchor};return f&&delete S[n],{messages:x,anchor:S,landed:{...s.landed,[n]:c},genState:f?{...s.genState,[n]:"terminal"}:s.genState}}return s})},addUserMsg:(e,r,n,i)=>t(a=>({messages:fi(a.messages,e,{kind:"user",id:r,text:n,...i?{items:i}:{}}),anchor:{...a.anchor,[e]:r}})),markNotRecorded:(e,r,n)=>t(i=>({messages:{...i.messages,[e]:(i.messages[e]??[]).map(a=>a.kind==="user"&&a.id===r?{...a,notRecorded:n}:a)}})),addNarration:(e,r)=>t(n=>({messages:fi(n.messages,e,{kind:"narration",id:tn(),text:r})})),addAgentMsg:(e,r,n,i)=>t(a=>({messages:fi(a.messages,e,{kind:"agent",id:tn(),author:r,text:n,...i===void 0?{}:{href:i.href},...(i==null?void 0:i.file)===void 0?{}:{file:i.file}})})),addActionable:(e,r,n,i)=>t(a=>({messages:fi(a.messages,e,{kind:"actionable",id:tn(),text:r,hint:n,...i===void 0?{}:{retry:i}})})),addDivider:(e,r)=>t(n=>({messages:fi(n.messages,e,{kind:"divider",id:tn(),version:r})})),setGenState:(e,r)=>t(n=>({genState:{...n.genState,[e]:r}})),clear:e=>t(r=>{const n={...r.messages};delete n[e];const i={...r.genState};delete i[e];const a={...r.anchor};delete a[e];const s={...r.landed};return delete s[e],{messages:n,genState:i,anchor:a,landed:s}})})),yN=["html","pdf","pptx"];function xN(t,e,r,n){if(typeof n=="string"&&n.trim()!=="")return n.trim();const i=t.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return`${i===""?"document":i}_v${e}.${r}`}function bN(t,e,r){return`Exporting “${t}” v${e} as ${r.toUpperCase()} — rendering it on the service.`}function wN(t){return t instanceof Hd?t.hint:t instanceof Error?t.message:String(t)}async function wS({projectId:t,docId:e,version:r,format:n}){const i=ii(t,e),a=an.getState();a.addNarration(i,bN(e,r,n));try{const s=await ET(t,e,r,n),o=xN(e,r,n,s.file);return a.addAgentMsg(i,"export",`${n.toUpperCase()} export ready — ${o}`,{href:s.download,file:o}),{ok:!0,file:o,result:s}}catch(s){const o=wN(s);return a.addActionable(i,`${n.toUpperCase()} export of “${e}” v${r} did not run. The document is unchanged and still editable.`,o,{format:n,version:r}),{ok:!1,hint:o}}}const os={border:"rgba(230,237,243,0.1)",muted:"rgba(230,237,243,0.55)",faint:"rgba(230,237,243,0.3)",accent:"#ffda19"},SN={background:"transparent",border:`1px solid ${os.border}`,borderRadius:"5px",color:os.muted,cursor:"pointer",fontSize:"10px",lineHeight:1.6,padding:"1px 6px"},_N={background:"none",border:"none",color:os.muted,cursor:"pointer",fontFamily:"monospace",fontSize:"9px",padding:0};function SS({projectId:t,docId:e,version:r,compact:n=!1}){const[i,a]=K.useState(null),[s,o]=K.useState(null);function l(u){a(u),o(null),wS({projectId:t,docId:e,version:r,format:u}).then(c=>{c.ok||o(c.hint)}).finally(()=>a(null))}return y.jsxs("div",{"data-testid":"export-menu","data-doc-id":e,"data-version":r,style:{alignSelf:"center",display:"flex",flexDirection:"column",flexShrink:0,gap:"2px",maxWidth:"220px",minWidth:0},children:[y.jsxs("div",{style:{alignItems:"center",display:"flex",gap:n?"7px":"5px"},children:[!n&&y.jsxs("span",{style:{color:os.faint,fontSize:"10px",letterSpacing:"0.06em",textTransform:"uppercase"},children:["Export v",r]}),yN.map(u=>y.jsx("button",{type:"button","data-testid":"export-format","data-format":u,disabled:i!==null,onClick:()=>l(u),title:`Export “${e}” v${r} as ${u.toUpperCase()} — it lands in the thread as a download`,style:{...n?_N:SN,color:i===u?os.accent:os.muted,opacity:i!==null&&i!==u?.4:1},children:i===u?`${u}…`:n?u:u.toUpperCase()},u))]}),s!==null&&y.jsx("span",{"data-testid":"export-hint",title:s,style:{color:os.accent,fontSize:"9px",fontFamily:"monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s})]})}const _S="#gate",ao={accent:"#ffda19",green:"#3fb950",red:"#f85149",muted:"rgba(230,237,243,0.55)"},np={fontSize:"10px",fontFamily:"monospace",borderRadius:"4px",padding:"2px 6px",border:"1px solid transparent",cursor:"pointer",flexShrink:0},pi={wrap:{display:"flex",alignItems:"center",gap:"4px",flexShrink:0,flexWrap:"nowrap"},label:{fontSize:"10px",fontFamily:"monospace",color:ao.accent,fontWeight:700},approve:{...np,background:"rgba(63,185,80,0.15)",borderColor:"rgba(63,185,80,0.35)",color:ao.green},reject:{...np,background:"rgba(248,81,73,0.12)",borderColor:"rgba(248,81,73,0.3)",color:ao.red},open:{...np,textDecoration:"none",background:"rgba(255,218,25,0.12)",borderColor:"rgba(255,218,25,0.35)",color:ao.accent},error:{fontSize:"10px",fontFamily:"monospace",color:ao.red,maxWidth:"92px",flexShrink:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}};function CN({runId:t,projectId:e,gate:r,navigate:n}){const i=Un(p=>p.clearGate),[a,s]=K.useState(!1),[o,l]=K.useState(null),[u,c]=K.useState(null);if(!eT(r)){const p=`${Tn(e,"build",t)}${_S}`;return y.jsxs("span",{style:pi.wrap,children:[y.jsx("span",{style:pi.label,children:"gate"}),y.jsx("a",{href:p,onClick:f=>{f.preventDefault(),n(p)},"data-testid":`gate-open-${t}`,title:(r==null?void 0:r.prompt)??"Open this gate in the thread",style:pi.open,children:"Answer ›"})]})}async function d(p){if(!(a||o!==null)){s(!0),c(null);try{await Ue.confirmGate(t,{approve:p}),l(p?"approved":"rejected"),i(t)}catch(f){c(f instanceof Error?f.message:String(f))}finally{s(!1)}}}return o!==null?y.jsx("span",{style:pi.wrap,"data-testid":`gate-answered-${t}`,children:y.jsxs("span",{style:{...pi.label,color:ao.muted,fontWeight:400},children:[o," · advancing…"]})}):y.jsxs("span",{style:pi.wrap,"data-testid":`gate-chip-${t}`,children:[y.jsx("span",{style:pi.label,children:a?"answering…":"gate"}),u!==null&&y.jsx("span",{"data-testid":`gate-error-${t}`,title:`Could not answer the gate: ${u} — try again`,style:pi.error,children:u}),y.jsx("button",{type:"button","data-testid":`gate-approve-${t}`,onClick:()=>void d(!0),disabled:a,title:u!==null?"Retry approve":(r==null?void 0:r.prompt)??"Approve this gate",style:{...pi.approve,opacity:a?.5:1},children:"Approve"}),y.jsx("button",{type:"button","data-testid":`gate-reject-${t}`,onClick:()=>void d(!1),disabled:a,title:u!==null?"Retry reject":"Reject this gate",style:{...pi.reject,opacity:a?.5:1},children:"Reject"})]})}const kN=new Set(["planning","distributing","executing"]);function n1(t){return t.includes("awaiting_human")?"gate":t.some(e=>kN.has(e))?"executing":"none"}function EN(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function TN(t,e,r=!1){if(t==="none")return null;const n=t==="gate"?"wk-live-edge wk-live-edge--gate":e?"wk-live-edge wk-live-edge--static":"wk-live-edge";return r?`${n} wk-live-edge--pill`:n}function Cv({state:t,pill:e=!1}){const r=TN(t,EN(),e);return r===null?null:y.jsx("span",{"data-testid":"live-edge","data-edge-state":t,"aria-hidden":"true",className:r})}const CS={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"}},kS=352,ip=3,ap=2,sp=2,Ir={border:"rgba(230,237,243,0.1)",ink:"#e6edf3",muted:"rgba(230,237,243,0.55)",faint:"rgba(230,237,243,0.3)"},NN={gate:"#ffda19",failing:"#f85149",running:"#79c0ff",drafts:"rgba(230,237,243,0.45)",quiet:"rgba(230,237,243,0.2)"},RN=[{mode:"chat",label:"New chat",glyph:"💬"},{mode:"build",label:"Do work",glyph:"⚙"},{mode:"document",label:"New doc",glyph:"▤"},{mode:"video",label:"Record demo",glyph:"▶"}],En={card:{height:`${kS}px`,boxSizing:"border-box",overflow:"hidden",background:"#161b22",border:`1px solid ${Ir.border}`,borderRadius:"10px",padding:"14px",display:"flex",flexDirection:"column",position:"relative"},header:{display:"flex",alignItems:"center",gap:"8px"},name:{fontSize:"13px",fontWeight:700,color:Ir.ink,textDecoration:"none",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},repo:{marginLeft:"auto",fontSize:"10px",fontFamily:"monospace",color:Ir.faint,flexShrink:0},label:{fontSize:"10px",letterSpacing:"0.06em",textTransform:"uppercase",color:Ir.faint},tile:{flex:1,minWidth:0,background:"rgba(230,237,243,0.04)",border:`1px solid ${Ir.border}`,borderRadius:"6px",padding:"5px 7px"},tileName:{fontSize:"11px",color:Ir.ink,margin:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},chip:{display:"flex",alignItems:"center",gap:"6px",textDecoration:"none",fontSize:"11px",fontFamily:"monospace",color:Ir.muted,borderRadius:"5px",padding:"3px 7px"},quick:{display:"flex",alignItems:"center",gap:"6px",textDecoration:"none",background:"rgba(230,237,243,0.05)",border:`1px solid ${Ir.border}`,borderRadius:"6px",color:Ir.ink},line:{display:"flex",alignItems:"center",gap:"6px",margin:"0 0 2px",fontSize:"11px",color:Ir.muted,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},pulse:{width:"5px",height:"5px",borderRadius:"50%",background:"#79c0ff",flexShrink:0}};function ES(t,e=Date.now()){const r=Math.max(0,Math.round((e-t)/1e3));return r<60?`${r}s`:r<3600?`${Math.floor(r/60)}m`:r<86400?`${Math.floor(r/3600)}h`:`${Math.floor(r/86400)}d`}function op({title:t,children:e}){return y.jsxs("div",{style:{marginTop:"10px",minHeight:"46px"},children:[y.jsx("p",{style:{...En.label,margin:"0 0 4px"},children:t}),e]})}function lp({text:t}){return y.jsx("p",{style:{fontSize:"11px",color:Ir.faint,margin:0},children:t})}function LN({projectId:t,name:e,kind:r,head:n,when:i}){return y.jsxs("div",{"data-testid":"doc-tile","data-doc-kind":r,style:En.tile,children:[y.jsxs("p",{style:En.tileName,children:[y.jsx("span",{"aria-hidden":!0,style:{marginRight:"4px"},children:r==="demo"?"▶":"▤"}),e]}),y.jsx("p",{style:{fontSize:"10px",color:Ir.faint,margin:"2px 0 0",fontFamily:"monospace"},children:Number.isNaN(i)?"not yet edited":`${ES(i)} ago`}),y.jsx(SS,{projectId:t,docId:e,version:n,compact:!0})]})}function DN({view:t}){const e=nN(t);return y.jsxs("p",{"data-testid":"live-line","data-run-id":t.session.id,title:e,style:En.line,children:[y.jsx("span",{"aria-hidden":!0,style:En.pulse}),e]})}function AN({item:t,navigate:e}){const{project:r,repo:n,runs:i,docs:a,attention:s}=t,o=Un(p=>p.gates),l=Wn(p=>p.docActivity[r.id]),u=i.filter(QT),c=i.length===0&&a.length===0,d=p=>({href:p,onClick:f=>{f.preventDefault(),e(p)}});return y.jsxs("section",{"data-testid":"project-card","data-project-id":r.id,"data-attention":s,style:En.card,children:[y.jsx(Cv,{state:n1(i.map(p=>p.session.status))}),y.jsxs("div",{style:En.header,children:[y.jsx("span",{"data-testid":"project-status-dot","aria-hidden":!0,style:{width:"8px",height:"8px",borderRadius:"50%",background:NN[s],flexShrink:0}}),y.jsx("a",{...d(Tn(r.id,"build")),style:En.name,children:r.name}),y.jsx("span",{"data-testid":"project-repo",style:En.repo,children:n??"no repo"})]}),y.jsx(op,{title:"Documents",children:a.length===0?y.jsx(lp,{text:"No documents yet."}):y.jsxs("div",{style:{display:"flex",gap:"6px",alignItems:"stretch"},children:[a.slice(0,ip).map(p=>y.jsx(LN,{projectId:r.id,name:p.name,kind:p.kind,head:p.head,when:l!==void 0&&l.docId===p.name?l.at:p.updated_at===null?NaN:Date.parse(p.updated_at)},p.name)),a.length>ip&&y.jsxs("span",{"data-testid":"doc-overflow",style:{alignSelf:"center",fontSize:"11px",color:Ir.muted,flexShrink:0},children:[a.length-ip," more"]})]})}),y.jsx(op,{title:"Live activity",children:u.length===0&&l===void 0?y.jsx(lp,{text:"Nothing running."}):y.jsxs("div",{"data-testid":"live-activity",children:[u.slice(0,sp).map(p=>y.jsx(DN,{view:p},p.session.id)),l!==void 0&&y.jsxs("p",{"data-testid":"doc-activity",title:l.message,style:En.line,children:[y.jsx("span",{"aria-hidden":!0,style:{flexShrink:0},children:"▤"}),l.message]}),u.length>sp&&y.jsxs("span",{"data-testid":"live-overflow",style:{fontSize:"11px",color:Ir.muted},children:[u.length-sp," more running"]})]})}),y.jsx(op,{title:"Crew runs",children:i.length===0?y.jsx(lp,{text:"No runs yet."}):y.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[i.slice(0,ap).map(({session:p,units:f})=>{var b,w;const x=CS[p.status],S=o[p.id],v=((b=f[p.unit_ix])==null?void 0:b.stage)??((w=f[f.length-1])==null?void 0:w.stage)??"planning",m=p.status==="awaiting_human";return y.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[y.jsxs("a",{...d(Tn(r.id,"build",p.id)),"data-testid":"run-chip","data-run-id":p.id,"data-status":p.status,style:{...En.chip,flex:1,minWidth:0,overflow:"hidden",position:"relative",paddingLeft:"10px",border:`1px solid ${m?"rgba(255,218,25,0.3)":Ir.border}`,background:m?"rgba(255,218,25,0.1)":"transparent"},children:[y.jsx(Cv,{state:n1([p.status])}),y.jsx("span",{style:{color:(x==null?void 0:x.color)??Ir.faint},children:v}),y.jsx("span",{style:{marginLeft:"auto",overflow:"hidden",textOverflow:"ellipsis"},children:m?S?`waiting ${ES(S.receivedAt)}`:"needs you":(x==null?void 0:x.label)??p.status})]}),m&&y.jsx(CN,{runId:p.id,projectId:r.id,gate:S,navigate:e})]},p.id)}),i.length>ap&&y.jsxs("span",{"data-testid":"run-overflow",style:{fontSize:"11px",color:Ir.muted},children:[i.length-ap," more"]})]})}),c&&y.jsx("p",{style:{...En.label,margin:"10px 0 0"},children:"Start here"}),y.jsx("div",{"data-testid":"quick-actions",style:{marginTop:"auto",paddingTop:c?"4px":"10px",display:"grid",gap:"6px",gridTemplateColumns:c?"1fr 1fr":"repeat(4, minmax(0,1fr))"},children:RN.map(p=>y.jsxs("a",{...d(Tn(r.id,p.mode)),"data-testid":"quick-action","data-mode":p.mode,style:{...En.quick,justifyContent:c?"flex-start":"center",padding:c?"10px 12px":"6px 8px",fontSize:c?"12px":"11px",fontWeight:c?600:400},children:[y.jsx("span",{"aria-hidden":!0,children:p.glyph})," ",p.label]},p.mode))})]})}const up=14,PN=320,i1=1,MN=1200,ON=900,Ya={ink:"#e6edf3",muted:"rgba(230,237,243,0.55)",faint:"rgba(230,237,243,0.3)",red:"#f85149"};function jN({runs:t,navigate:e}){const{items:r,loading:n,error:i}=$T(t),a=K.useRef(null),[s,o]=K.useState({w:0,h:0}),[l,u]=K.useState(0);K.useEffect(()=>{const b=a.current;if(b===null)return;const w=()=>o({w:b.clientWidth,h:b.clientHeight});return w(),window.addEventListener("resize",w),()=>window.removeEventListener("resize",w)},[]);const c=K.useCallback(b=>{u(b.currentTarget.scrollTop)},[]),d=Math.max(1,Math.floor((s.w||MN)/(PN+up))),p=kS+up,f=Math.ceil(r.length/d),x=s.h||ON,S=Math.max(0,Math.floor(l/p)-i1),v=Math.min(f-1,Math.ceil((l+x)/p)+i1),m=r.slice(S*d,(v+1)*d);return y.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[y.jsxs("header",{style:{display:"flex",alignItems:"baseline",gap:"12px",flexShrink:0,padding:"20px 24px 12px"},children:[y.jsx("h1",{style:{fontSize:"16px",fontWeight:700,color:Ya.ink,margin:0},children:"Projects"}),y.jsx("p",{style:{fontSize:"12px",color:Ya.muted,margin:0},children:"Sorted by what needs you first."}),y.jsx("a",{href:"/runs",onClick:b=>{b.preventDefault(),e("/runs")},"data-testid":"all-runs-link",style:{marginLeft:"auto",fontSize:"12px",color:Ya.muted},children:"All runs ›"})]}),y.jsxs("div",{ref:a,onScroll:c,"data-testid":"project-board","data-total":r.length,"data-rendered":m.length,style:{flex:1,overflowY:"auto",padding:"0 24px 24px"},children:[n&&y.jsx("p",{style:{fontSize:"13px",color:Ya.faint,fontFamily:"monospace"},children:"Loading projects…"}),!n&&i!==null&&y.jsxs("p",{style:{fontSize:"13px",color:Ya.red},children:["Could not load projects: ",i]}),!n&&i===null&&r.length===0&&y.jsxs("div",{style:{padding:"40px 0"},children:[y.jsx("p",{style:{fontSize:"14px",color:Ya.muted,margin:"0 0 4px"},children:"No projects yet"}),y.jsx("a",{href:"/projects",onClick:b=>{b.preventDefault(),e("/projects")},"data-testid":"create-first-project",style:{fontSize:"12px",color:Ya.ink},children:"Create your first project ›"})]}),r.length>0&&y.jsx("div",{style:{position:"relative",height:`${f*p}px`},children:y.jsx("div",{style:{position:"absolute",top:`${S*p}px`,left:0,right:0,display:"grid",gap:`${up}px`,gridTemplateColumns:`repeat(${d}, minmax(0, 1fr))`},children:m.map(b=>y.jsx(AN,{item:b,navigate:e},b.project.id))})})]})]})}const Wd=si(t=>({status:"connecting",setStatus:e=>t({status:e})})),cp=10;function dp(){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 nd=si(t=>({notifications:[],markRead:e=>t(r=>{const n=r.notifications.findIndex(s=>s.id===e);if(n===-1)return r;const i=r.notifications[n];if(!i||i.read)return r;const a=[...r.notifications];return a[n]={...i,read:!0},{notifications:a}}),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:dp(),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,cp)};case"sessionFailed":return{notifications:[{id:dp(),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,cp)};case"agentMessage":return{notifications:[{id:dp(),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,cp)};default:return n}})}})),kn={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 IN(t){switch(t){case"gate":return"Awaiting review";case"run_failed":return"Run failed";case"steer_requested":return"Steer requested";default:return"Notification"}}function a1(t){switch(t){case"gate":return kn.accent;case"run_failed":return kn.danger;case"steer_requested":return kn.link;default:return kn.muted}}function BN(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 FN(){return y.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:y.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 zN({navigate:t,collapsed:e=!1}){const r=nd(c=>c.notifications),n=nd(c=>c.markRead),i=nd(c=>c.markAllRead),[a,s]=K.useState(!1),o=K.useRef(null),l=r.filter(c=>!c.read).length;K.useEffect(()=>{if(!a)return;function c(d){o.current&&!o.current.contains(d.target)&&s(!1)}return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[a]);function u(c,d){n(c),s(!1),t(`/runs/${encodeURIComponent(d)}`)}return y.jsxs("div",{ref:o,style:{position:"relative"},children:[y.jsxs("button",{type:"button","aria-label":l>0?`${l} unread notification${l>1?"s":""}`:"Notifications","aria-expanded":a,"aria-haspopup":"true",title:"Notifications",onClick:()=>s(c=>!c),className:"relative flex items-center rounded transition-opacity hover:opacity-70",style:{gap:e?0:"6px",justifyContent:e?"center":"flex-start",width:e?"28px":"auto",height:"28px",color:l>0?kn.accent:kn.faint,background:"transparent",padding:e?0:"0 6px 0 4px"},children:[y.jsx(FN,{}),!e&&y.jsx("span",{style:{fontSize:"11px",fontFamily:"monospace",color:kn.faint},children:"Notifications"}),l>0&&y.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:kn.accent,color:kn.accentInk},children:l>9?"9+":l})]}),a&&y.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:[y.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 14px 8px",borderBottom:"1px solid rgba(230,237,243,0.08)"},children:[y.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&&y.jsx("button",{type:"button",onClick:i,style:{background:"transparent",border:"none",cursor:"pointer",fontSize:"10px",fontFamily:"monospace",color:kn.link,padding:0},children:"Mark all read"})]}),r.length===0?y.jsx("p",{style:{padding:"16px 14px",fontSize:"11px",fontFamily:"monospace",color:kn.faint,margin:0},children:"No notifications"}):y.jsx("ul",{style:{listStyle:"none",margin:0,padding:0},children:r.map(c=>y.jsx("li",{children:y.jsxs("button",{type:"button",role:"menuitem",onClick:()=>u(c.id,c.runId),className:"focus-visible:outline focus-visible:outline-2 focus-visible:outline-[#79c0ff]",style:{width:"100%",textAlign:"left",background:c.read?"transparent":"rgba(255,218,25,0.04)",border:"none",borderBottom:"1px solid rgba(230,237,243,0.06)",padding:"10px 14px",cursor:"pointer",display:"block"},onMouseEnter:d=>{d.currentTarget.style.background=kn.hover},onMouseLeave:d=>{d.currentTarget.style.background=c.read?"transparent":"rgba(255,218,25,0.04)"},children:[y.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"3px"},children:[y.jsxs("span",{style:{fontSize:"10px",fontWeight:600,fontFamily:"monospace",color:a1(c.kind),display:"flex",alignItems:"center",gap:"4px"},children:[!c.read&&y.jsx("span",{style:{width:"5px",height:"5px",borderRadius:"50%",background:a1(c.kind),display:"inline-block",flexShrink:0}}),IN(c.kind)]}),y.jsx("span",{style:{fontSize:"9px",fontFamily:"monospace",color:"rgba(230,237,243,0.3)",whiteSpace:"nowrap",marginLeft:"8px"},children:BN(c.ts)})]}),y.jsx("p",{style:{fontSize:"11px",color:"rgba(230,237,243,0.65)",margin:"0 0 3px",overflow:"hidden",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},children:c.message}),y.jsxs("span",{style:{fontSize:"10px",fontFamily:"monospace",color:kn.link},children:[c.runId.slice(0,8)," → Review"]})]})},c.id))})]})]})}function $N(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 s1=35;function ji({view:t,selectedRunId:e,onSelect:r}){const{session:n,units:i}=t,a=e===n.id,s=n.problem.length>s1?n.problem.slice(0,s1)+"…":n.problem,o=i.length,l=n.status==="awaiting_human"||n.status==="executing"||n.status==="distributing"||n.status==="planning";return y.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 ${a?"bg-black/35":"bg-transparent hover:bg-black/20 focus-visible:bg-black/20"}`,children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("span",{className:"flex-1 truncate text-xs leading-tight font-mono",style:{color:a?"#e6edf3":"rgba(230,237,243,0.7)"},title:n.problem,children:s}),y.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${l?"animate-pulse":""}`,style:{background:$N(n.status)}})]}),y.jsxs("p",{className:"text-[10px] mt-0.5 font-mono",style:{color:"rgba(230,237,243,0.3)"},children:[o," task",o===1?"":"s"," · ",n.id.slice(0,8)]})]})}const HN=[{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 UN({onNavigate:t,onClose:e}){const r=K.useRef(null);return K.useEffect(()=>{function n(i){r.current&&!r.current.contains(i.target)&&e()}return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[e]),y.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:HN.map(n=>y.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 WN({size:t=28,className:e=""}){return y.jsxs("svg",{width:t,height:t,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:[y.jsx("rect",{width:"32",height:"32",rx:"7",fill:"#ffda19"}),y.jsx("path",{d:"M6 10L10.5 24L16 13L21.5 24L26 10",stroke:"#0d1117",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round"})]})}const gr={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"},Gs=4;function VN(){return y.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:y.jsx("path",{d:"M13 2 3 14h9l-1 8 10-12h-9l1-8z"})})}function GN(){return y.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:y.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 qN(){return y.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:y.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 YN(){return y.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5","aria-hidden":!0,children:[y.jsx("circle",{cx:"10",cy:"10",r:"7"}),y.jsx("line",{x1:"15.5",y1:"15.5",x2:"21",y2:"21"})]})}function hp({icon:t,label:e,testId:r,onClick:n,collapsed:i}){return y.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:gr.accent,background:"transparent"},children:[t,!i&&y.jsx("span",{children:e})]})}function Ac({label:t,asLink:e,onClick:r,withSearch:n,searchActive:i,onToggleSearch:a}){const s=y.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-widest font-mono select-none",style:{color:e?gr.link:gr.muted},children:[t,e&&y.jsx("span",{className:"ml-1 opacity-70",children:"›"})]});return y.jsxs("div",{className:"flex items-center px-3 pt-3 pb-1",children:[e&&r?y.jsx("button",{type:"button",onClick:r,className:"transition-opacity hover:opacity-80",style:{background:"transparent"},children:s}):s,n&&y.jsx("button",{type:"button",onClick:a,"aria-label":"Search",className:"ml-auto transition-opacity hover:opacity-100",style:{color:i?gr.accent:gr.faint},children:y.jsx(YN,{})})]})}function KN(){const t=Wd(c=>c.status),[e,r]=K.useState(!1),[n,i]=K.useState(null),[a,s]=K.useState(!1),o=K.useRef(null);K.useEffect(()=>{e&&(i(null),s(!1),Ue.getHealth().then(c=>i(c)).catch(()=>s(!0)))},[e]),K.useEffect(()=>{if(!e)return;function c(d){o.current&&!o.current.contains(d.target)&&r(!1)}return document.addEventListener("click",c),()=>document.removeEventListener("click",c)},[e]);const l=t==="connected"?"#3fb950":t==="connecting"?"#ffda19":"#f85149",u=t==="connected"?"Connected":t==="connecting"?"Connecting":"Disconnected";return y.jsxs("div",{ref:o,style:{position:"relative"},children:[y.jsxs("button",{type:"button",onClick:()=>r(c=>!c),title:"Connection status",style:{display:"flex",alignItems:"center",gap:"5px",background:"rgba(0,0,0,0.25)",border:"1px solid rgba(230,237,243,0.1)",borderRadius:"20px",padding:"2px 8px 2px 6px",cursor:"pointer"},children:[y.jsx("span",{style:{width:"7px",height:"7px",borderRadius:"50%",background:l,flexShrink:0,boxShadow:t==="connected"?`0 0 5px ${l}`:"none"}}),y.jsx("span",{style:{fontSize:"10px",fontFamily:"monospace",color:l,whiteSpace:"nowrap"},children:u}),y.jsx("span",{style:{fontSize:"9px",color:"rgba(230,237,243,0.35)",marginLeft:"1px"},children:"▾"})]}),e&&y.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:[y.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"}),y.jsx(vl,{label:"WebSocket",ok:t==="connected",detail:u}),a?y.jsx(vl,{label:"API server",ok:!1,detail:"unreachable"}):n?y.jsxs(y.Fragment,{children:[y.jsx(vl,{label:"API server",ok:n.status==="ok",detail:n.status}),y.jsx(vl,{label:"wicked-core",ok:!0,detail:n.version})]}):y.jsx(vl,{label:"API server",ok:null,detail:"checking…"})]})]})}function vl({label:t,ok:e,detail:r}){const n=e===null?"·":e?"✓":"✗",i=e===null?"rgba(230,237,243,0.3)":e?"#3fb950":"#f85149";return y.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"5px"},children:[y.jsx("span",{style:{width:"12px",fontSize:"11px",color:i,fontFamily:"monospace",flexShrink:0},children:n}),y.jsx("span",{style:{fontSize:"11px",color:"#e6edf3",fontFamily:"monospace",flex:1},children:t}),y.jsx("span",{style:{fontSize:"10px",color:"rgba(230,237,243,0.45)",fontFamily:"monospace"},children:r})]})}function XN({runs:t,selectedRunId:e,onSelectRun:r,navigate:n}){const[i,a]=K.useState(!1),[s,o]=K.useState(!1),[l,u]=K.useState(!1),[c,d]=K.useState(!1),[p,f]=K.useState(""),[x,S]=K.useState([]),v=!i||s;K.useEffect(()=>{let E=!1,k=!1;function L(){k||(k=!0,Ue.listRepos().then(({repos:M})=>{if(E)return;const O=[...M].sort(($,D)=>D.registered_at-$.registered_at);S(O)}).catch(()=>{}).finally(()=>{k=!1}))}L();const A=setInterval(L,5e3);return()=>{E=!0,clearInterval(A)}},[]);const m=[],b=[];for(const E of t)!E.session.workflow_id||E.session.workflow_id==="chat"?m.push(E):b.push(E);const w=p.trim().toLowerCase(),_=w?x.filter(E=>E.name.toLowerCase().includes(w)):x,T=w?m.filter(E=>E.session.problem.toLowerCase().includes(w)):m,N=w?b.filter(E=>E.session.problem.toLowerCase().includes(w)):b;return y.jsxs("div",{className:`flex flex-col shrink-0 transition-all duration-200 ${v?"w-[280px]":"w-14"}`,style:{background:gr.bg,borderRight:`1px solid ${gr.border}`},onMouseEnter:()=>{i&&o(!0)},onMouseLeave:()=>o(!1),children:[y.jsxs("div",{className:"flex items-center gap-2 px-4 pt-5 pb-3 shrink-0",children:[y.jsx("button",{type:"button",onClick:()=>n("/"),className:"shrink-0","aria-label":"Home",children:y.jsx(WN,{size:26})}),v&&y.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:gr.ink,background:"transparent"},children:"wicked-crew studio"}),y.jsx("button",{type:"button",onClick:()=>a(E=>!E),"aria-label":i?"Expand sidebar":"Collapse sidebar",className:`text-xs font-mono shrink-0 leading-none ${v?"ml-auto":""}`,style:{color:gr.faint},children:i?"»":"«"})]}),v&&y.jsx("div",{className:"px-4 pt-1 pb-3",children:y.jsx(KN,{})}),y.jsx("div",{className:v?"px-4 pb-2":"flex justify-center pb-2",children:y.jsx(zN,{navigate:n,collapsed:!v})}),y.jsxs("div",{className:`flex flex-col ${v?"px-5 pt-1 pb-1 gap-1":"px-2 items-center gap-2 mt-1"}`,children:[y.jsx(hp,{icon:y.jsx(VN,{}),label:"Do Work",testId:"new-run",onClick:()=>n("/runs/new"),collapsed:!v}),y.jsx(hp,{icon:y.jsx(GN,{}),label:"New Chat",onClick:()=>n("/chat/new"),collapsed:!v}),y.jsx(hp,{icon:y.jsx(qN,{}),label:"New Repository",onClick:()=>n("/repos/new"),collapsed:!v})]}),y.jsx("div",{className:"flex-1 overflow-y-auto flex flex-col min-h-0 mt-2",children:v?y.jsxs(y.Fragment,{children:[c&&y.jsx("div",{className:"px-4 pb-2",children:y.jsx("input",{type:"text",value:p,onChange:E=>f(E.target.value),placeholder:"Search…",autoFocus:!0,className:"w-full bg-transparent text-xs font-mono outline-none border-b",style:{color:gr.ink,borderColor:gr.faint,caretColor:gr.accent}})}),y.jsx(Ac,{label:"Projects",asLink:!0,onClick:()=>n("/projects")}),y.jsx(Ac,{label:"Repositories",withSearch:!0,searchActive:c,onToggleSearch:()=>{d(E=>!E),c&&f("")}}),y.jsx(fp,{empty:"No repositories yet",viewAllPath:"/repos",navigate:n,children:_.slice(0,Gs).map(E=>y.jsxs("button",{type:"button",onClick:()=>n(`/repo-detail/${encodeURIComponent(E.id)}`),title:E.root_path,className:"w-full text-left px-3 py-2 rounded-md transition-colors",style:{background:"transparent"},onMouseEnter:k=>{k.currentTarget.style.background=gr.hover},onMouseLeave:k=>{k.currentTarget.style.background="transparent"},children:[y.jsx("div",{className:"flex items-center gap-2",children:y.jsx("span",{className:"flex-1 truncate text-xs leading-tight font-mono",style:{color:"rgba(230,237,243,0.7)"},children:E.name})}),y.jsx("p",{className:"text-[10px] mt-0.5 font-mono truncate",style:{color:"rgba(230,237,243,0.3)"},children:E.root_path})]},E.id))}),_.length>Gs&&y.jsx(pp,{onClick:()=>n("/repos")}),y.jsx(Ac,{label:"Chats"}),y.jsx(fp,{empty:"No chats yet",viewAllPath:"/chats",navigate:n,children:T.slice(0,Gs).map(E=>y.jsx(ji,{view:E,selectedRunId:e,onSelect:r},E.session.id))}),T.length>Gs&&y.jsx(pp,{onClick:()=>n("/chats")}),y.jsx(Ac,{label:"Work"}),y.jsx(fp,{empty:"No work yet",viewAllPath:"/work",navigate:n,children:N.slice(0,Gs).map(E=>y.jsx(ji,{view:E,selectedRunId:e,onSelect:r},E.session.id))}),N.length>Gs&&y.jsx(pp,{onClick:()=>n("/work")})]}):y.jsx("div",{className:"px-2 flex flex-col gap-0.5 mt-1",children:t.map(E=>y.jsx("button",{type:"button",onClick:()=>r(E.session.id),"aria-label":E.session.problem,title:E.session.problem,className:"w-9 h-9 mx-auto flex items-center justify-center rounded-md transition-colors",style:{background:e===E.session.id?gr.active:"transparent"},onMouseEnter:k=>{e!==E.session.id&&(k.currentTarget.style.background=gr.hover)},onMouseLeave:k=>{e!==E.session.id&&(k.currentTarget.style.background="transparent")},children:y.jsx(QN,{status:E.session.status})},E.session.id))})}),y.jsx("div",{className:`px-2 pb-3 shrink-0 ${v?"":"flex flex-col items-center gap-1"}`,children:y.jsxs("div",{className:"relative",children:[y.jsxs("button",{type:"button",onClick:()=>u(E=>!E),onMouseDown:E=>E.stopPropagation(),"aria-label":"Settings",className:`rounded transition-colors ${v?"w-full flex items-center gap-2 px-2 py-1.5 text-xs":"w-9 h-9 flex items-center justify-center text-base"}`,style:{color:gr.faint},onMouseEnter:E=>{E.currentTarget.style.background=gr.hover,E.currentTarget.style.color=gr.ink},onMouseLeave:E=>{E.currentTarget.style.background="",E.currentTarget.style.color=gr.faint},children:[y.jsx("span",{children:"⚙"}),v&&y.jsxs(y.Fragment,{children:[y.jsx("span",{children:"Settings"}),y.jsx("span",{className:"ml-auto text-[10px] font-mono",style:{color:"rgba(230,237,243,0.25)"},children:"v0.3.2"})]})]}),l&&y.jsx(UN,{onNavigate:n,onClose:()=>u(!1)})]})})]})}function fp({children:t,empty:e,viewAllPath:r,navigate:n}){const i=Array.isArray(t)?t.filter(Boolean):t?[t]:[];return y.jsx("div",{className:"px-2 flex flex-col gap-0.5",children:i.length===0?y.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:gr.faint},children:e}):i})}function pp({onClick:t}){return y.jsx("button",{type:"button",onClick:t,className:"mx-4 mb-1 text-left text-[11px] font-mono transition-opacity hover:opacity-80",style:{color:gr.link},children:"view all"})}function QN({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 y.jsx("span",{className:`w-2.5 h-2.5 rounded-full ${r?"animate-pulse":""}`,style:{background:e}})}function TS(t,e,r){return{left:t.left-(r.scrollX-e.scrollX),top:t.top-(r.scrollY-e.scrollY),width:t.width,height:t.height}}function ZN(t,e,r,n){let i=null,a=1/0;for(const[s,o]of Object.entries(t)){const l=TS(o,e,r);if(n.x<l.left||n.x>l.left+l.width||n.y<l.top||n.y>l.top+l.height)continue;const u=l.width*l.height;u<a&&(i=s,a=u)}return i}function Fn(t){return typeof t=="number"&&isFinite(t)}function JN(t){if(typeof t!="object"||t===null)return!1;const e=t;return Fn(e.x)&&Fn(e.y)&&Fn(e.width)&&Fn(e.height)&&Fn(e.top)&&Fn(e.left)&&Fn(e.right)&&Fn(e.bottom)}function eR(t){if(typeof t!="object"||t===null)return null;const e=t;if(e.v!==1)return null;const r=e.type;if(r==="wid-inventory"){const n=e.widMap,i=e.scrollX,a=e.scrollY;if(typeof n!="object"||n===null||!Fn(i)||!Fn(a))return null;const s={};for(const[o,l]of Object.entries(n)){if(!JN(l))return null;s[o]=l}return{v:1,type:"wid-inventory",widMap:s,scrollX:i,scrollY:a}}if(r==="scroll-state"){const n=e.scrollX,i=e.scrollY;return!Fn(n)||!Fn(i)?null:{v:1,type:"scroll-state",scrollX:n,scrollY:i}}if(r==="scroll-ack"){const n=e.wid;return typeof n!="string"||n===""?null:{v:1,type:"scroll-ack",wid:n}}return null}const tR=Object.freeze({v:1,type:"request-inventory"});function rR(t){return{v:1,type:"scroll-to-wid",wid:t}}const nR="wicked.interactive.feedback.submitted";function iR(t,e="this document"){return[`Feedback on ${t.length===1?"1 place":`${t.length} places`} in ${e}:`,...t.map((n,i)=>`${i+1}. [${n.wid}] ${n.text}`)].join(`
|
|
48
|
+
`)}async function NS({projectId:t,docId:e,version:r,items:n,subject:i,target:a}){const s=iR(n,i),o=tn(),l=ii(t,e);await Ud(t,{event_type:nR,payload:{document_id:e,version:r,source_message_id:o,...a===void 0?{}:{target:a},items:n.map(c=>({wid:c.wid,comment:c.text}))}});const u=an.getState();u.addUserMsg(l,o,s,n);try{return await xd(t,e,s,o),{msgId:o,text:s,recorded:!0}}catch{return u.markNotRecorded(l,o,!0),{msgId:o,text:s,recorded:!1}}}async function aR(t,e,r,n){await xd(t,e,n,r),an.getState().markNotRecorded(ii(t,e),r,!1)}let po=null;function sR(t){return po=t,()=>{po===t&&(po=null)}}function oR(t){po==null||po(t)}const jr={card:"#161b22",border:"rgba(230,237,243,0.1)",ink:"#e6edf3",muted:"rgba(230,237,243,0.55)",accent:"#ffda19",live:"#79c0ff",danger:"#f85149"},lR=[0,250,750,1500],uR=3e3,o1=132,cR=260,l1=4,dR="Point-and-comment is unavailable: this document did not answer the instrument bridge. The document still renders, versions and exports normally.";function hR({frame:t,loadNonce:e,projectId:r,docId:n,version:i}){const[a,s]=K.useState(null),[o,l]=K.useState({scrollX:0,scrollY:0}),[u,c]=K.useState(!1),[d,p]=K.useState(!1),[f,x]=K.useState(null),[S,v]=K.useState(null),[m,b]=K.useState([]),[w,_]=K.useState(!1),[T,N]=K.useState(null),E=K.useRef(null),k=K.useCallback(I=>{var U;(U=t==null?void 0:t.contentWindow)==null||U.postMessage(I,"*")},[t]);K.useEffect(()=>{if(t===null)return;s(null),c(!1),l({scrollX:0,scrollY:0}),p(!1),x(null),v(null),b([]),N(null);function I(P){if(t===null||P.source!==t.contentWindow)return;const H=eR(P.data);if(H!==null)if(H.type==="wid-inventory"){const W={scrollX:H.scrollX,scrollY:H.scrollY};s({widMap:H.widMap,measured:W}),l(W)}else H.type==="scroll-state"&&l({scrollX:H.scrollX,scrollY:H.scrollY})}window.addEventListener("message",I);const U=lR.map(P=>window.setTimeout(()=>k(tR),P)),F=window.setTimeout(()=>c(!0),uR);return()=>{window.removeEventListener("message",I),U.forEach(window.clearTimeout),window.clearTimeout(F)}},[t,e,k]),K.useEffect(()=>sR(I=>k(rR(I))),[k]);const L=a!==null,A=I=>{const U=a==null?void 0:a.widMap[I];return U===void 0||a===null?null:TS(U,a.measured,o)},M=I=>{const U=I.currentTarget.getBoundingClientRect();return{x:I.clientX-U.left,y:I.clientY-U.top}},O=I=>a===null?null:ZN(a.widMap,a.measured,o,M(I));function $(){S===null||S.text.trim()===""||(b(I=>[...I,{wid:S.wid,text:S.text.trim()}]),v(null))}async function D(){if(!(m.length===0||w)){_(!0),N(null);try{await NS({projectId:r,docId:n,version:i,items:m}),b([]),v(null),p(!1)}catch(I){N(I instanceof Error?I.message:String(I))}finally{_(!1)}}}const B=f===null||S!==null?null:A(f),j=S===null?null:A(S.wid);return y.jsxs("div",{"data-testid":"feedback-overlay","data-ready":String(L),style:{inset:0,pointerEvents:"none",position:"absolute",zIndex:2},children:[d&&L&&y.jsx("div",{ref:E,"data-testid":"feedback-hitlayer",style:{cursor:"crosshair",inset:0,pointerEvents:"auto",position:"absolute"},onMouseMove:I=>x(O(I)),onMouseLeave:()=>x(null),onClick:I=>{const U=O(I);U!==null&&(v({wid:U,text:""}),x(null))}}),B!==null&&y.jsx("div",{"data-testid":"feedback-hover","data-wid":f,style:{...fR(B),position:"absolute",pointerEvents:"none",border:`2px solid ${jr.accent}`,borderRadius:"3px",background:"rgba(255,218,25,0.08)"}}),m.map((I,U)=>{const F=A(I.wid);return F===null?null:y.jsx("span",{"data-testid":"feedback-pin","data-wid":I.wid,title:I.text,style:{position:"absolute",left:`${Math.max(0,F.left-18)}px`,top:`${F.top}px`,background:jr.accent,borderRadius:"9px",color:"#0d1117",fontSize:"10px",fontWeight:700,padding:"1px 6px",pointerEvents:"none"},children:U+1},`${I.wid}-${U}`)}),S!==null&&j!==null&&y.jsxs("div",{"data-testid":"feedback-comment","data-wid":S.wid,style:{...pR(j,(t==null?void 0:t.clientHeight)??0),position:"absolute",pointerEvents:"auto",width:`${cR}px`,background:jr.card,border:`1px solid ${jr.border}`,borderRadius:"10px",display:"flex",flexDirection:"column",gap:"6px",padding:"10px"},children:[y.jsx("span",{style:{color:jr.muted,fontFamily:"monospace",fontSize:"10px"},children:S.wid}),y.jsx("textarea",{"data-testid":"feedback-comment-input",autoFocus:!0,rows:3,value:S.text,placeholder:"What should change here?",onChange:I=>v({wid:S.wid,text:I.target.value}),onKeyDown:I=>{I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),$()),I.key==="Escape"&&v(null)},style:{background:"transparent",border:`1px solid ${jr.border}`,borderRadius:"6px",color:jr.ink,fontFamily:"inherit",fontSize:"12px",padding:"6px",resize:"none"}}),y.jsxs("div",{style:{display:"flex",gap:"6px"},children:[y.jsx("button",{type:"button","data-testid":"feedback-comment-add",onClick:$,disabled:S.text.trim()==="",style:{...Pc,background:jr.accent,color:"#0d1117"},children:"Add to batch"}),y.jsx("button",{type:"button","data-testid":"feedback-comment-cancel",onClick:()=>v(null),style:{...Pc,background:"transparent",border:`1px solid ${jr.border}`,color:jr.muted},children:"Cancel"})]})]}),y.jsxs("div",{"data-testid":"feedback-toolbar",style:{position:"absolute",top:"10px",right:"10px",pointerEvents:"auto",display:"flex",alignItems:"center",gap:"6px"},children:[T!==null&&y.jsx("span",{"data-testid":"feedback-error",style:{color:jr.danger,fontFamily:"monospace",fontSize:"10px"},children:T}),m.length>0&&y.jsx("button",{type:"button","data-testid":"feedback-submit",onClick:()=>void D(),disabled:w,title:`Send all ${m.length} comments as one message`,style:{...Pc,background:jr.accent,color:"#0d1117"},children:w?"…":`Send ${m.length} comment${m.length===1?"":"s"}`}),y.jsx("button",{type:"button","data-testid":"feedback-toggle","data-active":String(d),"data-count":String(m.length),disabled:!L,title:L?"Point at anything in the document and comment on it":u?dR:"Connecting to the document…",onClick:()=>{p(I=>!I),v(null),x(null)},style:{...Pc,background:d?jr.live:"rgba(13,17,23,0.75)",border:`1px solid ${d?jr.live:jr.border}`,color:d?"#0d1117":L?jr.ink:jr.muted,cursor:L?"pointer":"not-allowed",opacity:L?1:.5},children:d?"Done":"Comment"})]})]})}const Pc={border:"none",borderRadius:"7px",cursor:"pointer",fontSize:"11px",fontWeight:600,padding:"4px 10px"};function fR(t){return{left:`${t.left}px`,top:`${t.top}px`,width:`${t.width}px`,height:`${t.height}px`}}function pR(t,e){const r=t.top+t.height+l1,n=e===0||r+o1<=e;return{left:`${t.left}px`,top:`${n?r:Math.max(0,t.top-o1-l1)}px`}}const Je={card:"#161b22",border:"rgba(230,237,243,0.1)",ink:"#e6edf3",muted:"rgba(230,237,243,0.55)",accent:"#ffda19",label:"rgba(230,237,243,0.3)"},cs={background:Je.card,border:`1px solid ${Je.border}`,borderRadius:"10px",padding:"20px 22px",maxWidth:"640px"};function gR(t){return t instanceof gm?{message:t.message,hint:t.hint}:{message:t instanceof Error?t.message:String(t)}}function Vl({surface:t,subject:e}){return y.jsxs("div",{"data-testid":`${t}-canvas-loading`,style:{padding:"32px",color:Je.muted,fontSize:"13px"},children:["Loading ",e,"…"]})}function Vd({surface:t,subject:e,failure:r,onRetry:n}){return y.jsx("div",{"data-testid":`${t}-canvas-error`,style:{padding:"32px"},children:y.jsxs("div",{style:cs,children:[y.jsxs("p",{style:{fontSize:"13px",color:Je.ink,margin:"0 0 10px"},children:["Could not load ",e,"."]}),y.jsx("p",{"data-testid":r.hint?`${t}-bridge-hint`:`${t}-error-detail`,style:{fontSize:"13px",color:r.hint?Je.ink:Je.muted,margin:"0 0 14px",lineHeight:1.5,borderLeft:`2px solid ${Je.accent}`,paddingLeft:"10px"},children:r.hint?y.jsxs(y.Fragment,{children:[y.jsx("strong",{children:"To fix:"})," ",r.hint]}):r.message}),y.jsx("button",{type:"button","data-testid":`${t}-canvas-retry`,onClick:n,style:{background:"transparent",border:`1px solid ${Je.border}`,borderRadius:"6px",color:Je.ink,cursor:"pointer",fontSize:"12px",padding:"6px 12px"},children:"Retry"})]})})}function go(t,e){const[r,n]=K.useState(0),[i,a]=K.useState(null),[s,o]=K.useState(null);return K.useEffect(()=>{let l=!1;return a(null),o(null),t().then(u=>{l||a(u)},u=>{l||o(gR(u))}),()=>{l=!0}},[...e,r]),[i,s,K.useCallback(()=>n(l=>l+1),[])]}function vR(t){return`[data-message-id=${JSON.stringify(t)}]`}function u1(t){const e=document.querySelector('[data-testid="thread"]');if(e===null)return!1;const r=e.querySelector(vR(t));return r instanceof HTMLElement?(r.scrollIntoView({block:"center"}),r.hasAttribute("tabindex")||r.setAttribute("tabindex","-1"),r.focus({preventScroll:!0}),!0):!1}const gn={bar:"#0f1419",border:"rgba(230,237,243,0.1)",ink:"#e6edf3",muted:"rgba(230,237,243,0.55)",faint:"rgba(230,237,243,0.3)",accent:"#ffda19",selected:"rgba(255,218,25,0.1)",danger:"#f85149"},mR="This version was committed without a source message, so there is nothing to scroll to. Documents created before the merge have no anchor.";function yR(t){const e=new Date(t);return Number.isNaN(e.getTime())?t:e.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function xR(t,e){return t.version-e.version}function bR(t){return t.parent!==null&&t.parent!==t.version-1?t.parent:null}function c1(t){var e;return((e=t.meta)==null?void 0:e.sourceMessageId)??null}const d1={background:"transparent",border:`1px solid ${gn.border}`,borderRadius:"5px",color:gn.muted,cursor:"pointer",fontSize:"10px",lineHeight:1.6,padding:"1px 6px"};function wR({projectId:t,docId:e,manifest:r,selected:n,navigate:i,onForked:a}){const[s,o]=K.useState(null),[l,u]=K.useState(null);function c(p){i(wd(t,e,p.version));const f=c1(p);f!==null&&u1(f)}async function d(p){o(p.version),u(null);try{const f=await gS(t,e,p.version);a(f)}catch(f){u(f instanceof Error?f.message:String(f))}finally{o(null)}}return y.jsxs("div",{"data-testid":"version-strip",style:{alignItems:"stretch",background:gn.bar,borderTop:`1px solid ${gn.border}`,display:"flex",flexShrink:0,gap:"8px",padding:"10px 12px"},children:[y.jsxs("div",{style:{alignItems:"stretch",display:"flex",flex:1,gap:"8px",minWidth:0,overflowX:"auto"},children:[y.jsx("span",{style:{alignSelf:"center",color:gn.faint,flexShrink:0,fontSize:"10px",fontWeight:600,letterSpacing:"0.06em",paddingRight:"2px",textTransform:"uppercase"},children:"Versions"}),[...r.versions].sort(xR).map(p=>{const f=p.version===n,x=bR(p),S=c1(p);return y.jsxs("div",{"data-testid":"version-entry","data-version":p.version,"data-parent":p.parent===null?"":p.parent,"data-selected":f?"true":"false",style:{background:f?gn.selected:"transparent",border:`1px solid ${f?gn.accent:gn.border}`,borderRadius:"7px",display:"flex",flexDirection:"column",flexShrink:0,gap:"4px",minWidth:"124px",padding:"6px 9px"},children:[y.jsxs("button",{type:"button","data-testid":"version-select","aria-current":f?"true":void 0,onClick:()=>c(p),title:`Show version ${p.version}`,style:{background:"transparent",border:"none",color:gn.ink,cursor:"pointer",display:"flex",flexDirection:"column",gap:"2px",padding:0,textAlign:"left"},children:[y.jsxs("span",{style:{color:f?gn.accent:gn.ink,fontSize:"12px",fontWeight:600},children:["v",p.version]}),y.jsx("span",{"data-testid":"version-stamp",style:{color:gn.muted,fontSize:"10px"},children:yR(p.created_at)})]}),x!==null&&y.jsxs("span",{"data-testid":"version-lineage",style:{color:gn.accent,fontSize:"10px"},children:["continues from v",x]}),y.jsxs("div",{style:{display:"flex",gap:"5px"},children:[y.jsx("button",{type:"button","data-testid":"version-fork",onClick:()=>void d(p),disabled:s!==null,title:`Fork a new version from v${p.version} — the original stays untouched`,style:{...d1,opacity:s!==null?.5:1},children:s===p.version?"Forking…":"Fork"}),y.jsx("button",{type:"button","data-testid":"version-scroll",onClick:()=>{S!==null&&u1(S)},disabled:S===null,title:S===null?mR:"Scroll the thread to the message that produced this version",style:{...d1,cursor:S===null?"not-allowed":"pointer",opacity:S===null?.4:1},children:"In thread"})]})]},p.version)}),l!==null&&y.jsxs("span",{"data-testid":"version-fork-error",style:{alignSelf:"center",color:gn.danger,fontSize:"11px",paddingLeft:"4px"},children:["Fork failed: ",l," — the document is unchanged; try again."]})]}),y.jsx(SS,{projectId:t,docId:e,version:n})]})}function SR(t,e){return(e.updated_at??"").localeCompare(t.updated_at??"")}function _R({projectId:t,navigate:e}){const[r,n,i]=go(()=>vm(t),[t]);return n?y.jsx(Vd,{surface:"doc",subject:"this project's documents",failure:n,onRetry:i}):r===null?y.jsx(Vl,{surface:"doc",subject:"this project's documents"}):r.length===0?y.jsx("div",{"data-testid":"doc-picker-empty",style:{padding:"32px"},children:y.jsxs("div",{style:cs,children:[y.jsx("h2",{style:{fontSize:"15px",fontWeight:700,color:Je.ink,margin:"0 0 8px"},children:"No documents in this project yet"}),y.jsx("p",{style:{fontSize:"13px",color:Je.muted,margin:0,lineHeight:1.5},children:"Ask for one in the thread — “make me a deck for the Q3 review”, “write this up as a report” — and it appears here, with its versions, as soon as it exists."})]})}):y.jsxs("div",{style:{padding:"32px",overflowY:"auto"},children:[y.jsx("p",{style:{fontSize:"11px",fontWeight:600,color:Je.label,margin:"0 0 10px",textTransform:"uppercase",letterSpacing:"0.06em"},children:"Documents"}),y.jsx("div",{"data-testid":"doc-picker",style:{...cs,padding:0,overflow:"hidden"},children:[...r].sort(SR).map((a,s,o)=>y.jsxs("button",{type:"button","data-testid":"doc-picker-row","data-doc-id":a.name,onClick:()=>e(Tn(t,"document",a.name)),style:{display:"flex",alignItems:"center",gap:"12px",width:"100%",textAlign:"left",background:"transparent",border:"none",borderBottom:s<o.length-1?`1px solid ${Je.border}`:"none",color:Je.ink,cursor:"pointer",fontSize:"13px",padding:"12px 16px"},children:[y.jsx("span",{style:{flex:1,fontWeight:500},children:a.name}),y.jsxs("span",{style:{color:Je.muted,flexShrink:0,fontSize:"12px"},children:[a.kind," · v",a.head]})]},a.name))})]})}function CR(t,e){return e!==null&&t.versions.some(r=>r.version===e)?e:t.head}function kR({projectId:t,docId:e,version:r,navigate:n}){const[i,a,s]=go(()=>mm(t,e),[t,e]),[o,l]=K.useState(!1),[u,c]=K.useState(null),[d,p]=K.useState(0);K.useEffect(()=>{l(!1)},[t,e,r]);const f=`“${e}”`;if(a)return y.jsx(Vd,{surface:"doc",subject:f,failure:a,onRetry:s});if(i===null)return y.jsx(Vl,{surface:"doc",subject:f});const x=CR(i,r),S=fo(t,`/d/${encodeURIComponent(e)}/doc/${x}`),v=m=>{s(),n(wd(t,e,m.version))};return y.jsxs(y.Fragment,{children:[y.jsxs("div",{style:{flex:1,position:"relative",overflow:"hidden"},children:[y.jsx("iframe",{ref:c,"data-testid":"doc-canvas","data-doc-id":e,"data-version":x,src:S,title:`Document ${e}, version ${x}`,onLoad:()=>{l(!0),p(m=>m+1)},sandbox:"allow-scripts",style:{border:"none",display:"block",height:"100%",width:"100%"}},x),o?null:y.jsx("div",{style:{background:"#0d1117",inset:0,position:"absolute"},children:y.jsx(Vl,{surface:"doc",subject:f})}),y.jsx(hR,{frame:u,loadNonce:d,projectId:t,docId:e,version:x})]}),y.jsx(wR,{projectId:t,docId:e,manifest:i,selected:x,navigate:n,onForked:v})]})}function ER({projectId:t,docId:e,version:r=null,navigate:n}){return y.jsx("div",{style:{display:"flex",flex:1,flexDirection:"column",overflow:"hidden"},children:e===null?y.jsx(_R,{projectId:t,navigate:n}):y.jsx(kR,{projectId:t,docId:e,version:r,navigate:n},`${t}/${e}`)})}const TR=["url","pdf","image"],gp={url:{noun:"website",placeholder:"https://example.com"},pdf:{noun:"PDF file",placeholder:"/path/to/brand-guide.pdf"},image:{noun:"image file",placeholder:"/path/to/screenshot.png"}};function NR(t,e){const r=e.trim();return t==="url"?{kind:t,url:r}:{kind:t,path:r}}function h1(t,e){const r=e.trim();return t==="url"?/^https?:\/\/\S+/i.test(r):r!==""}function RR(t,e){return t==="url"?`Learn a theme from ${e.trim()}.`:`Learn a theme from the ${t==="pdf"?"PDF":"image"} at ${e.trim()}.`}function LR(t,e){const r=e.trim();return t==="url"?`Learning a theme from ${r} — the service opens it in a headless browser and the agent reads the design back from what rendered.`:`Learning a theme from ${r} — read in place on this machine. The file is not uploaded.`}function RS(t){return(t instanceof Error?t.message:String(t)).replace(/^API \d{3}: /,"")}function LS(t,e,r){const n=t.trim();return e.includes(n)?e:`${n} ${r}: ${e}`}function DR(t,e){return e instanceof Hd?e.hint:t==="url"?"Use a public http(s) address the service can reach, or learn the theme from a PDF or image instead — those are read from this machine.":"Check the path exists and the service can read it, then submit it again."}async function AR({projectId:t,docId:e,kind:r,value:n}){const i=ii(t,e),a=an.getState();a.addUserMsg(i,tn(),RR(r,n)),a.addNarration(i,LR(r,n));try{const s=await NT(t,NR(r,n));return a.addNarration(i,s.message??`Queued “${s.theme_id}” — it joins the theme library once the agent has read the design.`),{ok:!0,themeId:s.theme_id}}catch(s){const o=RS(s);return a.addActionable(i,LS(n,o,"was not learned from"),DR(r,s)),{ok:!1,reason:o}}}function PR(t){return`Use ${t.trim()} as reference.`}function MR(t){return`Attaching ${t.trim()} as a reference source — the service reads it in place on this machine. Nothing is uploaded.`}function OR(t){return t.status==="indexed"?`“${t.path}” is indexed — the next generation can use what is in it.`:`“${t.path}” is being indexed on the service — it becomes usable as it lands.`}async function jR({projectId:t,docId:e,path:r}){const n=ii(t,e),i=an.getState();i.addUserMsg(n,tn(),PR(r)),i.addNarration(n,MR(r));try{const a=await RT(t,e,r.trim());return a.status==="error"?(i.addActionable(n,`“${a.path}” was attached but could not be read, so nothing in it is available to the next generation.`,"Check the path exists and the service can read it, then attach it again."),{ok:!1,reason:"the service could not read it"}):(i.addNarration(n,OR(a)),{ok:!0,entry:a})}catch(a){const s=RS(a);return i.addActionable(n,LS(r,s,"was not attached"),a instanceof Hd?a.hint:"Check the path exists and the service can read it, then attach it again."),{ok:!1,reason:s}}}function DS(t,e){return`${t}:${e??""}`}const ts=si(t=>({theme:{},sources:{},pickTheme:(e,r)=>t(n=>{const i={...n.theme};return r===null||r===""?delete i[e]:i[e]=r,{theme:i}}),addSource:(e,r)=>t(n=>{const i=n.sources[e]??[];return i.includes(r)?n:{sources:{...n.sources,[e]:[...i,r]}}}),removeSource:(e,r)=>t(n=>({sources:{...n.sources,[e]:(n.sources[e]??[]).filter(i=>i!==r)}})),clear:e=>t(r=>{const n={...r.theme};delete n[e];const i={...r.sources};return delete i[e],{theme:n,sources:i}})})),vn={ink:"#e6edf3",faint:"rgba(230,237,243,0.35)",muted:"rgba(230,237,243,0.55)",accent:"#ffda19",card:"#1b222e",border:"rgba(230,237,243,0.1)",danger:"#f85149"},AS={background:"rgba(255,218,25,0.1)",color:vn.accent,border:"1px solid rgba(255,218,25,0.25)"},f1={background:"transparent",color:vn.muted,border:`1px solid ${vn.border}`,cursor:"pointer"},p1={background:"transparent",color:vn.ink,border:`1px solid ${vn.border}`,borderRadius:"8px",outline:"none"},g1={background:vn.accent,color:"#0d1117",border:"none",cursor:"pointer"},vp={background:vn.card,border:`1px solid ${vn.border}`},mp="flex flex-col gap-1.5 rounded-xl px-2.5 py-2",PS="rounded-full px-2.5 py-0.5 text-[10px] font-mono",v1="px-2 py-1 text-[11px] font-mono",m1="self-start rounded-lg px-2.5 py-1 text-[11px] font-semibold disabled:opacity-40",yp="text-[10px] font-mono",IR=[{panel:"learn",testId:"context-learn",label:"learn a theme",needsDoc:!0,title:"Teach the agent a theme from a website, a PDF or an image"},{panel:"library",testId:"context-library",label:"theme library",needsDoc:!1,title:"Pick a theme for the next generation"},{panel:"sources",testId:"context-sources",label:"attach sources",needsDoc:!0,title:"Point at a folder or file the service reads in place — nothing uploads"}];function y1({kind:t,value:e,label:r,onRemove:n}){return y.jsxs("span",{"data-testid":"context-chip","data-chip-kind":t,"data-chip-value":e,className:`flex items-center gap-1 max-w-full ${PS}`,style:AS,children:[y.jsx("span",{className:"truncate",children:r}),y.jsx("button",{type:"button","data-testid":"context-chip-remove","aria-label":`Remove ${r}`,onClick:n,className:"shrink-0 leading-none",style:{background:"none",border:"none",color:"inherit",cursor:"pointer"},children:"×"})]})}function BR({projectId:t,docId:e}){const r=DS(t,e),n=ts(E=>E.theme[r]),i=ts(E=>E.sources[r]??FR),[a,s]=K.useState(null),[o,l]=K.useState("url"),[u,c]=K.useState(""),[d,p]=K.useState(""),[f,x]=K.useState(!1),[S,v]=K.useState(null),[m,b]=K.useState(null);function w(E){const k=a!==E;s(k?E:null),!(!k||E!=="library")&&(b(null),TT(t).then(v).catch(L=>b(L instanceof Error?L.message:String(L))))}async function _(){if(e===null||f||!h1(o,u))return;x(!0);const E=await AR({projectId:t,docId:e,kind:o,value:u});x(!1),E.ok&&(c(""),s(null),v(null))}async function T(){if(e===null||f||d.trim()==="")return;x(!0);const E=await jR({projectId:t,docId:e,path:d});x(!1),E.ok&&(ts.getState().addSource(r,E.entry.path),p(""),s(null))}const N=m!==null?{testId:"theme-library-error",danger:!0,text:`${m} — no theme was picked; the next generation uses the default.`}:S===null?{testId:"theme-library-loading",danger:!1,text:"Loading the theme library…"}:S.length===0?{testId:"theme-library-empty",danger:!1,text:"No themes yet — learn one from a website, a PDF or an image."}:null;return y.jsxs("div",{"data-testid":"thread-context",className:"flex flex-col gap-1.5",children:[(n!==void 0||i.length>0)&&y.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[n!==void 0&&y.jsx(y1,{kind:"theme",value:n,label:`theme: ${n}`,onRemove:()=>ts.getState().pickTheme(r,null)}),i.map(E=>y.jsx(y1,{kind:"source",value:E,label:E,onRemove:()=>ts.getState().removeSource(r,E)},E))]}),y.jsx("div",{className:"flex flex-wrap gap-1.5",children:IR.filter(E=>e!==null||!E.needsDoc).map(E=>y.jsx("button",{type:"button","data-testid":E.testId,title:E.title,"aria-expanded":a===E.panel,onClick:()=>w(E.panel),className:PS,style:f1,children:E.label},E.panel))}),a==="learn"&&e!==null&&y.jsxs("div",{"data-testid":"learn-panel",className:mp,style:vp,children:[y.jsx("div",{className:"flex gap-1.5",children:TR.map(E=>y.jsx("button",{type:"button","data-testid":"learn-kind","data-kind":E,"aria-pressed":o===E,onClick:()=>l(E),className:"rounded-full px-2 py-0.5 text-[10px] font-mono",style:o===E?AS:f1,children:E},E))}),y.jsx("input",{"data-testid":"learn-input",className:v1,style:p1,"aria-label":`Theme source ${gp[o].noun}`,placeholder:gp[o].placeholder,value:u,onChange:E=>c(E.target.value),onKeyDown:E=>{E.key==="Enter"&&(E.preventDefault(),_())}}),o!=="url"&&y.jsx("p",{"data-testid":"learn-no-upload",className:yp,style:{color:vn.faint,margin:0},children:"Read in place — the file is not uploaded."}),y.jsx("button",{type:"button","data-testid":"learn-submit",className:m1,style:g1,disabled:f||!h1(o,u),onClick:()=>void _(),children:f?"Submitting…":`Learn from this ${gp[o].noun}`})]}),a==="library"&&y.jsxs("div",{"data-testid":"theme-library",className:`${mp} gap-1 max-h-40 overflow-y-auto`,style:vp,children:[N!==null&&y.jsx("p",{"data-testid":N.testId,className:yp,style:{color:N.danger?vn.danger:vn.faint,margin:0},children:N.text}),(S??[]).map(E=>y.jsxs("button",{type:"button","data-testid":"theme-row","data-theme":E.name,"aria-pressed":n===E.name,onClick:()=>{ts.getState().pickTheme(r,E.name),s(null)},className:"flex items-baseline justify-between gap-2 rounded-lg px-2 py-1 text-left text-[11px] font-mono",style:{background:n===E.name?"rgba(255,218,25,0.1)":"transparent",color:vn.ink,border:"none",cursor:"pointer"},children:[y.jsx("span",{className:"truncate",children:E.name}),y.jsx("span",{className:"shrink-0 text-[10px]",style:{color:vn.faint},children:E.source??"built-in"})]},E.name))]}),a==="sources"&&e!==null&&y.jsxs("div",{"data-testid":"sources-panel",className:mp,style:vp,children:[y.jsx("input",{"data-testid":"source-input",className:v1,style:p1,"aria-label":"Reference folder or file path",placeholder:"/path/to/reference-folder",value:d,onChange:E=>p(E.target.value),onKeyDown:E=>{E.key==="Enter"&&(E.preventDefault(),T())}}),y.jsx("p",{"data-testid":"source-no-upload",className:yp,style:{color:vn.faint,margin:0},children:"The service reads it where it is — nothing is uploaded from this page."}),y.jsx("button",{type:"button","data-testid":"source-attach",className:m1,style:g1,disabled:f||d.trim()==="",onClick:()=>void T(),children:f?"Attaching…":"Attach"})]})]})}const FR=[];function zR(t){return`step-${t}`}function kv(t){return t.subject.trim()!==""&&t.action.trim()!==""}function x1(t){return t.name.trim()!==""&&/^https?:\/\/\S+/i.test(t.targetUrl.trim())&&t.steps.length>0&&t.steps.every(kv)}function MS(t){return`${t.subject.trim()} — ${t.action.trim()}`}function OS(t){return[`Record a demo of ${t.targetUrl.trim()}:`,...t.steps.map((e,r)=>`${r+1}. ${MS(e)}`)].join(`
|
|
49
|
+
`)}function $R(t,e,r){const n=e.steps.map((i,a)=>({index:a,subject:i.subject.trim(),action:i.action.trim()}));return{name:e.name.trim(),kind:"demo",url:e.targetUrl.trim(),brief:OS(e),demo_steps:n,project:t,source_message_id:r}}async function HR(t,e,r){const n=OS(e),i=await pS(t,$R(t,e,r)),a=ii(t,i.name),s=an.getState();return s.addUserMsg(a,r,n),s.addNarration(a,`Authored “${i.name}” — ${e.steps.length} ${e.steps.length===1?"step":"steps"} against ${e.targetUrl.trim()}. Recording runs them in a real browser.`),{name:i.name,text:n}}function jS(t,e,r){if(e===void 0)return`Recording “${t}” — running its authored steps in a real browser.`;const n=`${e} ${e===1?"step":"steps"}`;return r===void 0?`Recording “${t}” — ${n}, in a real browser.`:`Recording “${t}” — ${n}, starting at “${r}”.`}async function IS({projectId:t,demoId:e,ask:r,steps:n,first:i}){const a=ii(t,e),s=an.getState();s.addUserMsg(a,tn(),r),s.addNarration(a,jS(e,n,i)),s.setGenState(a,"generating");try{await MT(t,e)}catch(o){throw s.setGenState(a,"terminal"),o}}function UR(t,e,r,n){return NS({projectId:t,docId:e,version:r,items:n.map(i=>({wid:zR(i.index),text:i.text.trim()})),subject:"this demo",target:"demo_step"})}const xp={background:"rgba(13,17,23,0.6)",border:`1px solid ${Je.border}`,borderRadius:"6px",color:Je.ink,fontFamily:"inherit",fontSize:"12px",padding:"6px 8px",width:"100%"},Mc={border:"none",borderRadius:"7px",cursor:"pointer",fontSize:"11px",fontWeight:600,padding:"5px 11px"};function WR({projectId:t,seed:e,msgId:r,onCancel:n,onCreated:i}){const[a,s]=K.useState({name:e,targetUrl:"",steps:[]}),[o,l]=K.useState({subject:"",action:""}),[u,c]=K.useState(!1),[d,p]=K.useState(null),f=a.targetUrl.trim()!=="";function x(){kv(o)&&(s(v=>({...v,steps:[...v.steps,{...o}]})),l({subject:"",action:""}))}async function S(){if(!(!x1(a)||u)){c(!0),p(null);try{const{name:v}=await HR(t,a,r);i(v)}catch(v){p(v instanceof Error?v.message:String(v))}finally{c(!1)}}}return y.jsxs("div",{"data-testid":"demo-wizard","data-stage":f?"steps":"target","data-steps":String(a.steps.length),className:"absolute inset-0 z-10 flex flex-col gap-2.5 overflow-y-auto p-3.5",style:{background:Je.card},children:[y.jsx("p",{className:"text-xs font-semibold",style:{color:Je.ink,margin:0},children:"Author the demo — the service records exactly these steps, in this order."}),y.jsxs("label",{className:"text-[10px] font-mono uppercase tracking-wide",style:{color:Je.label},children:["Target URL",y.jsx("input",{"data-testid":"wizard-target",style:xp,placeholder:"https://shop.example/",value:a.targetUrl,onChange:v=>s(m=>({...m,targetUrl:v.target.value}))})]}),f&&y.jsxs(y.Fragment,{children:[y.jsx("ol",{"data-testid":"wizard-steps",className:"flex flex-col gap-1 pl-0",style:{listStyle:"none",margin:0},children:a.steps.map((v,m)=>y.jsxs("li",{"data-testid":"wizard-step","data-index":String(m),className:"flex items-center gap-2 rounded-md px-2 py-1 text-[11px]",style:{background:"rgba(13,17,23,0.6)",border:`1px solid ${Je.border}`,color:Je.ink},children:[y.jsx("span",{className:"font-mono",style:{color:Je.accent},children:m+1}),y.jsx("span",{className:"flex-1",children:MS(v)}),y.jsx("button",{type:"button","data-testid":"wizard-step-remove",onClick:()=>s(b=>({...b,steps:b.steps.filter((w,_)=>_!==m)})),style:{...Mc,background:"transparent",color:Je.muted,padding:"2px 6px"},children:"Remove"})]},`${v.subject}-${m}`))}),y.jsxs("div",{className:"flex flex-col gap-1.5",children:[y.jsx("input",{"data-testid":"wizard-step-subject",style:xp,placeholder:"Subject — “the cart”",value:o.subject,onChange:v=>l(m=>({...m,subject:v.target.value}))}),y.jsx("input",{"data-testid":"wizard-step-action",style:xp,placeholder:"Action — “add a hoodie to it”",value:o.action,onChange:v=>l(m=>({...m,action:v.target.value})),onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),x())}}),y.jsxs("button",{type:"button","data-testid":"wizard-step-add",disabled:!kv(o),onClick:x,className:"self-start disabled:opacity-40",style:{...Mc,background:"transparent",border:`1px solid ${Je.border}`,color:Je.ink},children:["Add step ",a.steps.length+1]})]})]}),y.jsxs("div",{className:"mt-auto flex items-center gap-2 pt-2",children:[y.jsx("button",{type:"button","data-testid":"wizard-create",disabled:!x1(a)||u,onClick:()=>void S(),className:"disabled:opacity-40",style:{...Mc,background:Je.accent,color:"#0d1117"},children:u?"Authoring…":`Create demo (${a.steps.length} steps)`}),y.jsx("button",{type:"button","data-testid":"wizard-cancel",onClick:n,style:{...Mc,background:"transparent",border:`1px solid ${Je.border}`,color:Je.muted},children:"Cancel"})]}),d!==null&&y.jsxs("p",{"data-testid":"wizard-error",className:"text-[11px] font-mono",style:{color:"#f85149",margin:0},children:[d," — nothing was created; fix it and submit again."]})]})}const Lt={panel:"#161b22",border:"rgba(230,237,243,0.1)",ink:"#e6edf3",muted:"rgba(230,237,243,0.55)",faint:"rgba(230,237,243,0.35)",accent:"#ffda19",user:"#224a5e",card:"#1b222e",footer:"#161c26",live:"#79c0ff",danger:"#f85149"},VR={idle:{placeholder:"Describe the document you want…",submit:"Create"},generating:{placeholder:"Steer the document agent…",submit:"Send"},gated:{placeholder:"Answer the question above…",submit:"Answer"},terminal:{placeholder:"Ask for a change — it lands as a new version…",submit:"Send"}};function GR({msg:t,projectId:e,docId:r}){return t.kind==="user"?y.jsx("div",{className:"flex justify-end",children:y.jsxs("div",{"data-testid":"doc-message","data-message-id":t.id,"data-version":t.version===void 0?void 0:String(t.version),"data-items":t.items===void 0?void 0:String(t.items.length),className:"max-w-[85%] rounded-2xl px-3.5 py-2.5 text-sm leading-relaxed whitespace-pre-wrap",style:{background:Lt.user,color:Lt.ink,border:`1px solid ${Lt.border}`},children:[t.text,t.items!==void 0&&t.items.length>0&&y.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:t.items.map((n,i)=>y.jsxs("button",{type:"button","data-testid":"feedback-item-link","data-wid":n.wid,title:`Show “${n.wid}” in the document`,onClick:()=>oR(n.wid),className:"rounded-full px-2 py-0.5 text-[10px] font-mono",style:{background:"rgba(255,218,25,0.1)",color:Lt.accent,border:"1px solid rgba(255,218,25,0.25)",cursor:"pointer"},children:[i+1,". ",n.wid]},`${n.wid}-${i}`))}),t.notRecorded===!0&&r!==null&&y.jsx(YR,{projectId:e,docId:r,msgId:t.id,text:t.text})]})}):t.kind==="narration"?y.jsxs("div",{className:"flex items-start gap-2 text-xs font-mono","data-testid":"doc-narration",style:{color:Lt.faint},children:[y.jsx("span",{className:"mt-1.5 w-1.5 h-1.5 rounded-full shrink-0",style:{background:Lt.live}}),y.jsx("span",{children:t.text})]}):t.kind==="divider"?y.jsxs("div",{className:"flex items-center gap-2","data-testid":"version-divider","data-version":String(t.version),children:[y.jsx("span",{className:"flex-1 h-px",style:{background:Lt.border}}),y.jsxs("span",{className:"text-[10px] font-mono shrink-0",style:{color:Lt.faint},children:["continues as v",t.version]}),y.jsx("span",{className:"flex-1 h-px",style:{background:Lt.border}})]}):t.kind==="actionable"?y.jsx(qR,{msg:t,projectId:e,docId:r}):t.kind==="agent"||t.kind==="verdict"?y.jsxs("div",{className:"self-start max-w-[90%] flex flex-col gap-1","data-testid":`doc-${t.kind}`,children:[y.jsx("span",{className:"text-[10px] font-mono uppercase tracking-wide",style:{color:Lt.faint},children:t.kind==="verdict"?`${t.author} · review`:t.author}),y.jsxs("div",{className:"rounded-2xl px-3.5 py-2.5 text-sm leading-relaxed whitespace-pre-wrap",style:{background:Lt.card,border:`1px solid ${Lt.border}`,color:Lt.ink},children:[t.text,t.kind==="agent"&&t.href!==void 0&&y.jsxs("a",{"data-testid":"doc-artifact-download",href:fo(e,t.href),download:t.file??!0,className:"block mt-2 text-xs font-mono underline",style:{color:Lt.accent},children:["Download ",t.file??""]})]})]}):null}function qR({msg:t,projectId:e,docId:r}){const[n,i]=K.useState(!1),a=t.retry;return y.jsxs("div",{"data-testid":"doc-actionable",className:"rounded-xl px-3.5 py-3 flex flex-col gap-2",style:{background:"rgba(255,218,25,0.06)",border:"1px solid rgba(255,218,25,0.2)"},children:[y.jsx("p",{className:"text-sm leading-relaxed",style:{color:Lt.ink,margin:0},children:t.text}),y.jsx("code",{"data-testid":"doc-actionable-hint",className:"text-[11px] font-mono whitespace-pre-wrap",style:{color:Lt.accent},children:t.hint}),a!==void 0&&r!==null&&y.jsx("button",{type:"button","data-testid":"doc-actionable-retry",disabled:n,onClick:()=>{i(!0),wS({projectId:e,docId:r,version:a.version,format:a.format}).finally(()=>i(!1))},className:"self-start rounded-lg px-2.5 py-1 text-xs font-medium disabled:opacity-40",style:{background:Lt.accent,color:"#0d1117",border:"none",cursor:"pointer"},children:n?"Exporting…":`Export ${a.format.toUpperCase()} again`})]})}function YR({projectId:t,docId:e,msgId:r,text:n}){const[i,a]=K.useState(!1);return y.jsx("button",{type:"button","data-testid":"feedback-not-recorded",disabled:i,onClick:()=>{a(!0),aR(t,e,r,n).catch(()=>{}).finally(()=>a(!1))},className:"mt-2 block rounded-full px-2 py-0.5 text-[10px] font-mono disabled:opacity-40",style:{background:"rgba(248,81,73,0.1)",color:Lt.danger,border:"1px solid rgba(248,81,73,0.3)",cursor:"pointer"},children:i?"retrying…":"not recorded in the run — retry"})}function KR({msg:t,projectId:e,docId:r,onAnswered:n}){const[i,a]=K.useState(!1),[s,o]=K.useState(null);async function l(u){if(!(i||u.trim()==="")){a(!0),o(null);try{await Ud(e,{event_type:"wicked.interactive.question.answered",payload:{request_id:t.requestId,answer:u.trim(),document_id:r}}),n()}catch(c){o(c instanceof Error?c.message:String(c))}finally{a(!1)}}}return y.jsxs("div",{"data-testid":"doc-gate","data-request-id":t.requestId,className:"rounded-xl px-3.5 py-3 flex flex-col gap-2",style:{background:"rgba(255,218,25,0.06)",border:"1px solid rgba(255,218,25,0.2)"},children:[y.jsx("p",{className:"text-sm",style:{color:Lt.accent,margin:0},children:t.question}),t.options.length>0&&y.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.options.map(u=>y.jsx("button",{type:"button","data-testid":"doc-gate-option",disabled:i,onClick:()=>void l(u),className:"rounded-lg px-2.5 py-1 text-xs font-medium disabled:opacity-40",style:{background:Lt.accent,color:"#0d1117",border:"none",cursor:"pointer"},children:u},u))}),s!==null&&y.jsxs("p",{"data-testid":"doc-gate-error",className:"text-[11px] font-mono",style:{color:Lt.danger,margin:0},children:["Not sent: ",s," — the question is still open; answer again."]})]})}function b1({projectId:t,docId:e,selectedVersion:r,navigate:n,mode:i="document"}){const a=e===null?null:ii(t,e),s=an(k=>a===null?w1:k.messages[a]??w1),o=an(k=>a===null?void 0:k.genState[a]),l=e===null?"idle":o??"terminal",u=ts(k=>k.theme[DS(t,e)]),[c,d]=K.useState(""),[p,f]=K.useState(!1),[x,S]=K.useState(null),[v,m]=K.useState(null),b=K.useRef(null);K.useEffect(()=>{var k;(k=b.current)==null||k.scrollIntoView({block:"end"})},[s.length]);const w=l==="gated"?[...s].reverse().find(k=>k.kind==="gate")??null:null;async function _(){const k=c.trim();if(k===""||p)return;const L=an.getState(),A=tn();f(!0),S(null);try{if((e===null||a===null)&&i==="video"){m({seed:k,msgId:A}),d("");return}if(e===null||a===null){const M=await pS(t,{name:XR(k),kind:"source",brief:k,project:t,source_message_id:A,...u===void 0?{}:{theme_id:u}}),O=ii(t,M.name);L.addUserMsg(O,A,k),L.addNarration(O,`Generating “${M.name}” from your brief.`),L.setGenState(O,"generating"),d(""),n(wd(t,M.name,null));return}if(l==="terminal"){const M=r??(await mm(t,e)).head,O=await gS(t,e,M,A);L.addDivider(a,O.version),L.addUserMsg(a,A,k),L.setGenState(a,"generating"),await xd(t,e,k,A,u),d(""),n(wd(t,e,O.version));return}L.addUserMsg(a,A,k),l==="gated"&&w!==null?(await Ud(t,{event_type:"wicked.interactive.question.answered",payload:{request_id:w.requestId,answer:k,document_id:e}}),L.setGenState(a,"generating")):await xd(t,e,k,A,u),d("")}catch(M){S(M instanceof Error?M.message:String(M))}finally{f(!1)}}const{placeholder:T,submit:N}=VR[l],E=i==="video"&&l==="idle"?"Describe the demo you want to record…":T;return y.jsxs("div",{"data-testid":"thread","data-composer-state":l,className:"flex flex-col shrink-0 relative",style:{width:"340px",background:Lt.panel,borderLeft:`1px solid ${Lt.border}`},children:[v!==null&&y.jsx(WR,{projectId:t,seed:v.seed,msgId:v.msgId,onCancel:()=>m(null),onCreated:k=>{m(null),n(Tn(t,"video",k))}}),y.jsxs("div",{className:"flex-1 overflow-y-auto px-3.5 py-4 flex flex-col gap-3",children:[s.length===0&&y.jsx("p",{className:"text-xs leading-relaxed",style:{color:Lt.muted},children:e===null?i==="video"?"Describe the demo you want — “a walkthrough of the checkout flow” — and its steps are authored from there, in order.":"Describe the document you want — “a deck for the Q3 review”, “write this up as a report” — and it is created from that message.":"Ask for a change and it lands as a new version. Everything the agent says about this document appears here."}),s.map(k=>k.kind==="gate"?e!==null&&a!==null&&y.jsx(KR,{msg:k,projectId:t,docId:e,onAnswered:()=>an.getState().setGenState(a,"generating")},k.id)||null:y.jsx(GR,{msg:k,projectId:t,docId:e},k.id)),y.jsx("div",{ref:b})]}),y.jsxs("div",{className:"shrink-0 px-3.5 py-3 flex flex-col gap-2",style:{borderTop:`1px solid ${Lt.border}`,background:Lt.footer},children:[i==="video"&&e!==null&&l!=="generating"&&y.jsx("button",{type:"button","data-testid":"thread-record",disabled:p,onClick:()=>{f(!0),S(null),IS({projectId:t,demoId:e,ask:`Record “${e}”.`}).catch(k=>S(k instanceof Error?k.message:String(k))).finally(()=>f(!1))},className:"self-start rounded-full px-2.5 py-0.5 text-[10px] font-mono disabled:opacity-40",style:{background:"rgba(255,218,25,0.1)",color:Lt.accent,border:"1px solid rgba(255,218,25,0.25)",cursor:"pointer"},children:"record this demo"}),i==="document"&&y.jsx(BR,{projectId:t,docId:e}),l==="generating"&&y.jsxs("span",{"data-testid":"steering-chip",className:"self-start flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-[10px] font-mono",style:{background:"rgba(121,192,255,0.08)",color:Lt.live,border:"1px solid rgba(121,192,255,0.2)"},children:[y.jsx("span",{className:"w-1 h-1 rounded-full shrink-0",style:{background:Lt.live}}),"steering the live ",i==="video"?"demo":"document"," run"]}),y.jsxs("div",{className:"flex items-end gap-2 rounded-2xl px-3 py-2",style:{background:Lt.card,border:`1px solid ${Lt.border}`},children:[y.jsx("textarea",{"data-testid":"doc-composer",className:"flex-1 resize-none text-sm outline-none border-0 bg-transparent leading-6",style:{color:Lt.ink,fontFamily:"inherit",minHeight:"28px"},placeholder:E,value:c,rows:1,disabled:p,onChange:k=>d(k.target.value),onKeyDown:k=>{k.key==="Enter"&&!k.shiftKey&&(k.preventDefault(),_())}}),y.jsx("button",{type:"button","data-testid":"doc-composer-submit",onClick:()=>void _(),disabled:p||c.trim()==="",className:"shrink-0 rounded-xl px-3 py-1.5 text-xs font-semibold disabled:opacity-40",style:{background:Lt.accent,color:"#0d1117",border:"none",cursor:"pointer"},children:p?"…":N})]}),x!==null&&y.jsxs("p",{"data-testid":"doc-composer-error",className:"text-[11px] font-mono",style:{color:Lt.danger,margin:0},children:[x," — nothing was sent; edit and try again."]})]})]})}const w1=[];function XR(t){return t.split(/\s+/).slice(0,6).join(" ").slice(0,60)}const QR="install ffmpeg (macOS: `brew install ffmpeg`, Debian/Ubuntu: `sudo apt install ffmpeg`), then record again — the demo itself is unaffected.";function bp(t){const e=Number.isFinite(t)&&t>0?Math.floor(t):0;return`${Math.floor(e/60)}:${String(e%60).padStart(2,"0")}`}function ZR(t,e){const r=Number(t.timestamp),n=Number.isFinite(r)&&r>0?r:0;return Number.isFinite(e)&&e>0?Math.min(n,e):n}function JR(t,e,r){if(e!=null&&e.ffmpeg_absent)return{kind:"missing",ffmpeg:!0,hint:e.ffmpeg_hint||QR};if(e!=null&&e.video_url)return{kind:"video",src:fo(t,e.video_url),poster:e.poster_url?fo(t,e.poster_url):void 0};if(e!=null&&e.gif_url)return{kind:"gif",src:fo(t,e.gif_url)};if(r){const n=/ffmpeg/i.test(r.message)||/ffmpeg/i.test(r.hint??"");return{kind:"missing",ffmpeg:n,hint:r.hint||(n?r.message:void 0)}}return{kind:"missing",ffmpeg:!1}}const eL=[],ml={border:"none",borderRadius:"6px",cursor:"pointer",flexShrink:0,fontSize:"11px",fontWeight:600,padding:"5px 11px"},tL={alignItems:"center",background:"#0f1419",borderTop:`1px solid ${Je.border}`,display:"flex",flexShrink:0,gap:"8px",padding:"8px 12px"};function rL(t,e){return(e.updated_at??"").localeCompare(t.updated_at??"")}function nL({projectId:t,navigate:e}){const[r,n,i]=go(()=>DT(t),[t]);return n?y.jsx(Vd,{surface:"video",subject:"this project's demos",failure:n,onRetry:i}):r===null?y.jsx(Vl,{surface:"video",subject:"this project's demos"}):r.length===0?y.jsx("div",{"data-testid":"demo-picker-empty",style:{padding:"32px"},children:y.jsxs("div",{style:cs,children:[y.jsx("h2",{style:{fontSize:"15px",fontWeight:700,color:Je.ink,margin:"0 0 8px"},children:"No demos in this project yet"}),y.jsx("p",{style:{fontSize:"13px",color:Je.muted,margin:0,lineHeight:1.5},children:"A demo is a set of steps the agent authors and the service records. Ask for a walkthrough in the thread — “a demo of the checkout flow” — and it appears here as a storyboard with its player as soon as the spec exists."})]})}):y.jsxs("div",{style:{padding:"32px",overflowY:"auto"},children:[y.jsx("p",{style:{fontSize:"11px",fontWeight:600,color:Je.label,margin:"0 0 10px",textTransform:"uppercase",letterSpacing:"0.06em"},children:"Demos"}),y.jsx("div",{"data-testid":"demo-picker",style:{...cs,padding:0,overflow:"hidden"},children:[...r].sort(rL).map((a,s,o)=>y.jsxs("button",{type:"button","data-testid":"demo-picker-row","data-demo-id":a.name,onClick:()=>e(Tn(t,"video",a.name)),style:{display:"flex",alignItems:"center",gap:"12px",width:"100%",textAlign:"left",background:"transparent",border:"none",borderBottom:s<o.length-1?`1px solid ${Je.border}`:"none",color:Je.ink,cursor:"pointer",fontSize:"13px",padding:"12px 16px"},children:[y.jsx("span",{style:{flex:1,fontWeight:500},children:a.name}),y.jsxs("span",{style:{color:Je.muted,flexShrink:0,fontSize:"12px"},children:["v",a.head]})]},a.name))})]})}function iL({demoId:t,state:e,record:r}){const[n,i]=K.useState(!1),[a,s]=K.useState(!1),[o,l]=K.useState(null);async function u(){s(!0),l(null);try{await r(`Record “${t}”.`),i(!0)}catch(c){l(c instanceof Error?c.message:String(c))}finally{s(!1)}}return y.jsx("div",{"data-testid":"demo-no-recording","data-ffmpeg-absent":String(e.ffmpeg),style:{padding:"32px"},children:y.jsxs("div",{style:cs,children:[y.jsx("h2",{style:{fontSize:"15px",fontWeight:700,color:Je.ink,margin:"0 0 8px"},children:e.ffmpeg?`“${t}” recorded, but the video could not be converted`:`“${t}” has no recording yet`}),e.hint?y.jsxs("p",{"data-testid":"demo-ffmpeg-hint",style:{fontSize:"13px",color:Je.ink,margin:"0 0 14px",lineHeight:1.5,borderLeft:`2px solid ${Je.accent}`,paddingLeft:"10px"},children:[y.jsx("strong",{children:"To fix:"})," ",e.hint]}):y.jsx("p",{style:{fontSize:"13px",color:Je.muted,margin:"0 0 14px",lineHeight:1.5},children:"The steps below are the spec the agent authored. Recording runs them in a real browser and captures the result."}),y.jsx("button",{type:"button","data-testid":"demo-record",disabled:a||n,onClick:()=>void u(),style:{background:"transparent",border:`1px solid ${Je.border}`,borderRadius:"6px",color:n?Je.muted:Je.ink,cursor:a||n?"default":"pointer",fontSize:"12px",padding:"6px 12px"},children:n?"Recording queued":a?`Asking the recorder to run “${t}”…`:"Record this demo"}),n?y.jsxs("p",{"data-testid":"demo-record-queued",style:{fontSize:"12px",color:Je.muted,margin:"10px 0 0"},children:["The recorder is running “",t,"” — the player appears here when the version lands."]}):null,o!==null?y.jsxs("p",{"data-testid":"demo-record-error",style:{fontSize:"12px",color:Je.ink,margin:"10px 0 0"},children:["Could not queue the recording: ",o,". Try again, or ask in the thread."]}):null]})})}function aL({projectId:t,demoId:e}){var V,re;const r=ii(t,e),n=an(J=>J.landed[r]),i=an(J=>J.genState[r])==="generating",a=an(J=>J.messages[r]??eL),[s,o]=K.useState(0),l=`${n??0}:${s}`,[u,c,d]=go(()=>AT(t,e),[t,e,l]),[p,f]=go(()=>PT(t,e),[t,e,l]),[x]=go(()=>mm(t,e),[t,e,l]),[S,v]=K.useState(0),[m,b]=K.useState(0),[w,_]=K.useState(null),[T,N]=K.useState([]),[E,k]=K.useState(!1),[L,A]=K.useState(!1),[M,O]=K.useState(null),$=K.useRef(null),D=`“${e}”`;if(c)return y.jsx(Vd,{surface:"video",subject:D,failure:c,onRetry:d});if(u===null)return y.jsx(Vl,{surface:"video",subject:D});const B=[...u.steps??[]].sort((J,ne)=>J.index-ne.index),j=JR(t,p,f),I=(x==null?void 0:x.head)??(p==null?void 0:p.version)??null,U=qT(a.filter(J=>J.kind==="narration").map(J=>J.text),jS(e,B.length,(V=B[0])==null?void 0:V.title));async function F(J){var ne;k(!1),await IS({projectId:t,demoId:e,ask:J,steps:B.length,first:(ne=B[0])==null?void 0:ne.title})}function P(J,ne){var Y;v(J.index);const X=$.current,q=ZR(J,X==null?void 0:X.duration);b(q),X?X.currentTime=q:(Y=ne==null?void 0:ne.scrollIntoView)==null||Y.call(ne,{block:"nearest",inline:"center"})}function H(){w===null||w.text.trim()===""||(N(J=>[...J,{index:w.index,text:w.text.trim()}]),_(null))}async function W(){if(!(T.length===0||I===null||L)){A(!0),O(null);try{await UR(t,e,I,T),N([]),_(null),k(!0),o(J=>J+1)}catch(J){O(J instanceof Error?J.message:String(J))}finally{A(!1)}}}return y.jsxs("div",{style:{display:"flex",flex:1,flexDirection:"column",overflow:"hidden"},children:[y.jsx("div",{"data-testid":"demo-player","data-chapter":String(S),"data-position":String(m),"data-player-kind":j.kind,style:{flex:1,overflow:"auto",background:"#0d1117"},children:j.kind==="video"?y.jsx("video",{ref:$,"data-testid":"demo-video",src:j.src,poster:j.poster,controls:!0,onTimeUpdate:J=>b(J.currentTarget.currentTime),style:{display:"block",height:"100%",width:"100%"}}):j.kind==="gif"?y.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px",padding:"16px"},children:[y.jsx("img",{"data-testid":"demo-gif",src:j.src,alt:`Recording of ${e}`,style:{maxWidth:"100%"}}),y.jsx("p",{"data-testid":"demo-position",style:{fontSize:"12px",color:Je.muted,margin:0},children:B.length>0?`Chapter ${S+1} of ${B.length}, at ${bp(m)} — this recording is a looping GIF with no timeline, so the chapter is shown rather than played to.`:"This recording is a looping GIF of the whole demo."})]}):y.jsx(iL,{demoId:e,state:j,record:F})}),y.jsx("div",{"data-testid":"demo-storyboard","data-steps":String(B.length),style:{display:"flex",flexShrink:0,gap:"8px",overflowX:"auto",padding:"10px 12px",background:"#0f1419",borderTop:`1px solid ${Je.border}`},children:B.length===0?y.jsxs("p",{"data-testid":"demo-storyboard-empty",style:{fontSize:"12px",color:Je.muted,margin:0},children:[D," has no steps yet — the agent is still authoring the spec."]}):B.map(J=>y.jsxs("button",{type:"button","data-testid":"chapter-card","data-index":String(J.index),"data-timestamp":String(J.timestamp),"data-selected":String(J.index===S),"data-comments":String(T.filter(ne=>ne.index===J.index).length),title:`Chapter ${J.index+1}: ${J.title} — ${j.kind==="video"?"seeks to":"starts at"} ${bp(J.timestamp)}`,onClick:ne=>P(J,ne.currentTarget),style:{background:J.index===S?"rgba(255,218,25,0.1)":"transparent",border:`1px solid ${J.index===S||T.some(ne=>ne.index===J.index)?Je.accent:Je.border}`,borderRadius:"8px",color:Je.ink,cursor:"pointer",flexShrink:0,padding:"8px",textAlign:"left",width:"160px"},children:[J.thumbnail?y.jsx("img",{"data-testid":"chapter-thumbnail",src:fo(t,J.thumbnail),alt:"",style:{display:"block",borderRadius:"4px",marginBottom:"6px",width:"100%"}}):null,y.jsxs("span",{style:{display:"block",fontSize:"12px",fontWeight:600},children:[J.index+1,". ",J.title]}),y.jsx("span",{style:{display:"block",color:Je.muted,fontSize:"11px"},children:bp(J.timestamp)})]},J.index))}),B.length>0&&y.jsxs("div",{"data-testid":"demo-actions",style:tL,children:[i?y.jsx("span",{"data-testid":"demo-record-status",style:{color:Je.ink,fontSize:"12px"},children:U}):w!==null?y.jsxs(y.Fragment,{children:[y.jsxs("span",{style:{color:Je.muted,fontFamily:"monospace",fontSize:"10px",flexShrink:0},children:["step ",w.index+1]}),y.jsx("textarea",{"data-testid":"step-comment-input",autoFocus:!0,rows:1,value:w.text,placeholder:`What should “${((re=B.find(J=>J.index===w.index))==null?void 0:re.title)??""}” do instead?`,onChange:J=>_({index:w.index,text:J.target.value}),onKeyDown:J=>{J.key==="Enter"&&!J.shiftKey&&(J.preventDefault(),H()),J.key==="Escape"&&_(null)},style:{background:"transparent",border:`1px solid ${Je.border}`,borderRadius:"6px",color:Je.ink,flex:1,fontFamily:"inherit",fontSize:"12px",padding:"5px 7px",resize:"none"}}),y.jsx("button",{type:"button","data-testid":"step-comment-add",onClick:H,disabled:w.text.trim()==="",style:{...ml,background:Je.accent,color:"#0d1117"},children:"Add to batch"}),y.jsx("button",{type:"button","data-testid":"step-comment-cancel",onClick:()=>_(null),style:{...ml,background:"transparent",border:`1px solid ${Je.border}`,color:Je.muted},children:"Cancel"})]}):y.jsxs(y.Fragment,{children:[y.jsxs("button",{type:"button","data-testid":"step-comment-open","data-index":String(S),onClick:()=>{_({index:S,text:""}),k(!1)},style:{...ml,background:"transparent",border:`1px solid ${Je.border}`,color:Je.ink},children:["Comment on step ",S+1]}),E&&y.jsxs(y.Fragment,{children:[y.jsxs("span",{style:{color:Je.ink,fontSize:"12px"},children:["“",e,"” was re-authored from your comments — record it again to see the change."]}),y.jsx("button",{type:"button","data-testid":"demo-rerecord",onClick:()=>void F(`Re-record “${e}” with the updated steps.`),style:{...ml,background:Je.accent,color:"#0d1117"},children:"Re-record"})]}),T.length>0&&y.jsx("button",{type:"button","data-testid":"step-feedback-submit","data-count":String(T.length),disabled:L||I===null,title:I===null?"This demo has no version to comment on yet.":"One message, one re-authoring",onClick:()=>void W(),style:{...ml,background:Je.accent,color:"#0d1117",marginLeft:"auto"},children:L?"Sending…":`Send ${T.length} comment${T.length===1?"":"s"}`})]}),M!==null&&y.jsxs("span",{"data-testid":"step-feedback-error",style:{color:"#f85149",fontFamily:"monospace",fontSize:"11px"},children:[M," — nothing was sent; try again."]})]})]})}function sL({projectId:t,demoId:e,navigate:r}){return y.jsx("div",{style:{display:"flex",flex:1,flexDirection:"column",overflow:"hidden"},children:e===null?y.jsx(nL,{projectId:t,navigate:r}):y.jsx(aL,{projectId:t,demoId:e},`${t}/${e}`)})}const oL={deny:"#f85149",allow_with_conditions:"#ffda19",allow:"#3fb950"},lL={high:"#f85149",medium:"#ffda19",low:"rgba(230,237,243,0.4)"},uL={id:"",kind:"output",applies_to:[],effect:"deny",trigger:{contains:""},obligations:[],criteria:"",severity:"high",rule:""};function cL({policy:t,onEdit:e,onRetire:r}){const[n,i]=K.useState(!1),[a,s]=K.useState(!1),o=t.retired===!0;return y.jsxs("tr",{className:"text-[11px]",style:{borderBottom:"1px solid rgba(230,237,243,0.06)",opacity:o?.45:1},children:[y.jsxs("td",{className:"px-3 py-2 font-mono",style:{color:"rgba(230,237,243,0.7)"},children:[t.id,o&&y.jsx("span",{className:"ml-2 inline-flex rounded px-1.5 py-0.5 text-[9px] font-semibold uppercase tracking-wider",style:{background:"rgba(230,237,243,0.06)",color:"rgba(230,237,243,0.45)"},children:"retired"})]}),y.jsx("td",{className:"px-3 py-2",style:{color:"rgba(230,237,243,0.45)"},children:t.kind}),y.jsx("td",{className:"px-3 py-2",children:y.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:oL[t.effect]??"rgba(230,237,243,0.5)"},children:t.effect})}),y.jsx("td",{className:"px-3 py-2 text-[11px] font-semibold",style:{color:lL[t.severity]??"rgba(230,237,243,0.5)"},children:t.severity}),y.jsx("td",{className:"px-3 py-2 truncate max-w-xs",style:{color:"rgba(230,237,243,0.5)"},children:t.rule}),y.jsx("td",{className:"px-3 py-2",children:y.jsxs("div",{className:"flex items-center gap-3",children:[y.jsx("button",{type:"button",onClick:()=>e(t),className:"text-[10px] hover:underline",style:{color:"#79c0ff"},children:"Edit"}),!o&&y.jsx("button",{type:"button",disabled:a,onClick:()=>{if(!n){i(!0);return}s(!0),r(t.id).finally(()=>{s(!1),i(!1)})},className:"text-[10px] hover:underline disabled:opacity-50",style:{color:n?"#f85149":"rgba(230,237,243,0.4)"},children:a?"Retiring…":n?"Confirm retire":"Retire"})]})})]})}function dL(){const[t,e]=K.useState([]),[r,n]=K.useState(!0),[i,a]=K.useState(null),[s,o]=K.useState(""),[l,u]=K.useState("idle"),[c,d]=K.useState(null),[p,f]=K.useState(null),x=K.useCallback(async()=>{n(!0),a(null);try{const{policies:w}=await Ue.listPolicies();e(w)}catch(w){a(w instanceof Error?w.message:String(w))}finally{n(!1)}},[]);K.useEffect(()=>{x()},[x]);const S=K.useCallback(async w=>{a(null);try{await Ue.retirePolicy(w),await x()}catch(_){a(_ instanceof Error?_.message:String(_))}},[x]),v=w=>{o(JSON.stringify(w??uL,null,2)),f(null),u("idle"),d(null)},m=w=>{o(w);try{JSON.parse(w),f(null)}catch(_){f(_ instanceof Error?_.message:String(_))}},b=async()=>{if(p)return;let w;try{w=JSON.parse(s)}catch(_){f(_ instanceof Error?_.message:String(_));return}u("saving"),d(null);try{await Ue.upsertPolicy(w),u("ok"),await x()}catch(_){u("error"),d(_ instanceof Error?_.message:String(_))}};return y.jsxs("div",{className:"flex flex-col gap-4",children:[y.jsxs("div",{className:"flex items-center gap-3",children:[y.jsx("h2",{className:"text-sm font-semibold",style:{color:"#e6edf3"},children:"Policies"}),y.jsx("button",{type:"button",onClick:()=>void x(),className:"text-[10px] hover:underline",style:{color:"rgba(230,237,243,0.4)"},children:"Refresh"}),y.jsx("button",{type:"button",onClick:()=>v(),className:"ml-auto rounded px-2 py-1 text-[11px] font-semibold",style:{background:"#ffda19",color:"#0d1117"},children:"+ New policy"})]}),i&&y.jsx("p",{className:"rounded px-2 py-1 text-xs",style:{background:"rgba(248,81,73,0.08)",color:"#f85149"},children:i}),r?y.jsx("p",{className:"text-xs",style:{color:"rgba(230,237,243,0.4)"},children:"Loading policies…"}):y.jsx("div",{className:"overflow-x-auto rounded",style:{border:"1px solid rgba(230,237,243,0.08)"},children:y.jsxs("table",{className:"w-full text-[11px]",children:[y.jsx("thead",{children:y.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:[y.jsx("th",{className:"px-3 py-2 text-left",children:"ID"}),y.jsx("th",{className:"px-3 py-2 text-left",children:"Kind"}),y.jsx("th",{className:"px-3 py-2 text-left",children:"Effect"}),y.jsx("th",{className:"px-3 py-2 text-left",children:"Severity"}),y.jsx("th",{className:"px-3 py-2 text-left",children:"Rule"}),y.jsx("th",{className:"px-3 py-2"})]})}),y.jsx("tbody",{children:t.length===0?y.jsx("tr",{children:y.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(w=>y.jsx(cL,{policy:w,onEdit:v,onRetire:S},w.id))})]})}),s!==""&&y.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:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("span",{className:"text-[11px] font-semibold",style:{color:"#ffda19"},children:"Policy JSON"}),y.jsx("button",{type:"button",onClick:()=>{o(""),u("idle")},className:"ml-auto text-[10px] hover:underline",style:{color:"rgba(230,237,243,0.4)"},children:"Cancel"})]}),y.jsx("textarea",{"aria-label":"Policy JSON editor",value:s,onChange:w=>m(w.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)"}}),p&&y.jsx("p",{className:"text-[10px]",style:{color:"#f85149"},children:p}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("button",{type:"button",onClick:()=>void b(),disabled:!!p||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"&&y.jsx("span",{className:"text-[10px]",style:{color:"#3fb950"},children:"Saved."}),l==="error"&&y.jsx("span",{className:"text-[10px]",style:{color:"#f85149"},children:c})]})]})]})}const hL=new Set(["garden","wicked-garden"]);function Oc(t){return typeof t=="object"&&t!==null}function yl(t){return typeof t=="boolean"?t:null}function wp(t){return typeof t=="string"&&t.trim()!==""?t.trim():null}function fL(t,e){const r=yl(e.ok)??yl(e.installed)??yl(e.present)??!0,n=yl(e.optional),i=yl(e.required)??(n===null?null:!n);return{name:t,ok:r,install:wp(e.install)??wp(e.hint)??wp(e.command),hard:i??hL.has(t)}}function pL(t){if(!Oc(t))return[];const e=t.deps??t;return(Array.isArray(e)?e.map(n=>[Oc(n)&&typeof n.name=="string"?n.name:"",n]):Oc(e)?Object.entries(e):[]).filter(n=>n[0]!==""&&Oc(n[1])).map(([n,i])=>fL(n,i))}const Ev={bridge:"unknown",bridgeHint:null,deps:[],continued:!1},BS=["document","video"];function FS(t,e){return t.continued||!e?[]:t.deps.filter(r=>r.hard&&!r.ok).map(r=>({subject:r.name,install:r.install}))}function gL(t,e,r){return BS.includes(t)?FS(e,r):[]}function vL(t,e,r){if(!BS.includes(t)||e.continued||!r)return null;if(e.bridge==="unavailable")return e.bridgeHint??"the document service is not running";const[n]=FS(e,r);return n?n.install?`needs ${n.subject} — ${n.install}`:`needs ${n.subject}`:null}const Gl=si(t=>({byProject:{},attempt:0,report:(e,r)=>t(n=>({byProject:{...n.byProject,[e]:{...Ev,...n.byProject[e],...r}}})),continueAnyway:e=>t(r=>({byProject:{...r.byProject,[e]:{...Ev,...r.byProject[e],continued:!0}}})),recheck:()=>t(e=>({attempt:e.attempt+1}))}));function mL(t){return Gl(e=>e.byProject[t]??Ev)}function yL(t){const e=Gl(n=>n.report),r=Gl(n=>n.attempt);K.useEffect(()=>{let n=!1;return LT(t).then(i=>{n||e(t,{bridge:"ready",bridgeHint:null,deps:pL(i)})},i=>{n||!(i instanceof gm)||e(t,{bridge:"unavailable",bridgeHint:i.hint,deps:[]})}),()=>{n=!0}},[t,r,e])}const Sd=si(t=>({projects:[],loading:!1,error:null,load:async()=>{t({loading:!0,error:null});try{const{projects:e}=await Ue.listProjects();t({projects:e,loading:!1})}catch(e){t({loading:!1,error:e instanceof Error?e.message:String(e)})}},addProject:e=>t(r=>({projects:[e,...r.projects.filter(n=>n.id!==e.id)]})),updateProject:e=>t(r=>({projects:r.projects.map(n=>n.id===e.id?e:n)}))})),xl={bar:"#161c26",border:"rgba(230,237,243,0.1)",ink:"#e6edf3",muted:"rgba(230,237,243,0.55)",accent:"#ffda19"},zS={chat:{label:"Chat",summary:"Talk to an agent with no artifact committed yet — and choose a mode by conversation."},build:{label:"Build",summary:"Governed code work: units, phases, gates and evidence, on a crew run."},document:{label:"Document",summary:"Document mode is where the interactive canvas lands: an HTML doc, deck or report, its version strip, and point-and-comment feedback — all against this project’s one thread."},video:{label:"Video",summary:"Video mode is the demo storyboard and player: chapters derived from the spec’s steps, recorded and re-recorded from the same thread."}};function xL({mode:t,onSelect:e,unavailable:r}){return y.jsx("div",{role:"tablist","aria-label":"Project mode","data-testid":"mode-switcher",style:{display:"flex",gap:"2px",padding:"0 12px",flexShrink:0,background:xl.bar,borderBottom:`1px solid ${xl.border}`},children:xm.map(n=>{const i=zS[n],a=n===t,s=(r==null?void 0:r[n])??null;return y.jsx("button",{type:"button",role:"tab","aria-selected":a,"data-testid":`mode-tab-${n}`,"data-mode":n,"data-unavailable":s!==null?"true":void 0,title:s!==null?`${i.summary}
|
|
50
|
+
${i.label} ${s}`:i.summary,onClick:()=>e(n),style:{background:"transparent",border:"none",borderBottom:`2px solid ${a?xl.accent:"transparent"}`,color:a?xl.ink:xl.muted,cursor:"pointer",fontSize:"13px",fontWeight:a?700:500,opacity:s!==null&&!a?.45:1,padding:"10px 14px"},children:i.label},n)})})}const bL={background:"#0d1117",border:`1px solid ${Je.border}`,borderRadius:"6px",color:Je.ink,display:"block",fontFamily:"ui-monospace, monospace",fontSize:"12px",margin:"6px 0 0",padding:"8px 10px",userSelect:"all",whiteSpace:"pre-wrap"},S1={background:"transparent",border:`1px solid ${Je.border}`,borderRadius:"6px",color:Je.ink,cursor:"pointer",fontSize:"12px",padding:"6px 12px"};function wL({mode:t,blockers:e,onContinue:r,onRecheck:n}){const i=zS[t].label,a=e.map(s=>s.subject).join(", ");return y.jsx("div",{"data-testid":"install-gate","data-mode":t,style:{flex:1,overflowY:"auto",padding:"32px"},children:y.jsxs("div",{style:cs,children:[y.jsxs("h2",{style:{fontSize:"15px",fontWeight:700,color:Je.ink,margin:"0 0 8px"},children:[i," mode needs ",a]}),y.jsxs("p",{style:{fontSize:"13px",color:Je.muted,margin:"0 0 14px",lineHeight:1.5},children:[i," runs on this project’s document service, and the service reports the dependency below as missing. Install it, then re-check — or continue anyway and find out where it bites."]}),e.map(s=>y.jsxs("div",{"data-testid":"install-gate-dep","data-dep":s.subject,style:{margin:"0 0 14px"},children:[y.jsxs("p",{style:{fontSize:"13px",color:Je.ink,margin:0},children:[y.jsx("strong",{children:s.subject})," is not installed."]}),s.install?y.jsx("code",{"data-testid":"install-gate-command",style:bL,children:s.install}):y.jsx("p",{"data-testid":"install-gate-no-command",style:{fontSize:"13px",color:Je.muted,margin:"6px 0 0"},children:"The service named no install command for it — see this project’s setup notes."})]},s.subject)),y.jsxs("div",{style:{display:"flex",gap:"8px"},children:[y.jsx("button",{type:"button","data-testid":"install-gate-recheck",onClick:n,style:S1,children:"Re-check"}),y.jsx("button",{type:"button","data-testid":"install-gate-continue",onClick:r,style:{...S1,borderColor:Je.accent,color:Je.accent},children:"Continue anyway"})]})]})})}const jc={bar:"#161c26",border:"rgba(230,237,243,0.1)",ink:"#e6edf3",muted:"rgba(230,237,243,0.55)"};function SL({projectId:t,mode:e,artifactId:r,navigate:n,children:i}){var v;const a=Sd(m=>m.projects),s=Sd(m=>m.load);K.useEffect(()=>{a.length===0&&s()},[a.length,s]);const o=K.useRef({});r&&(o.current[e]=r),K.useEffect(()=>{oN(t,e)},[t,e]);const l=K.useCallback(m=>n(Tn(t,m,o.current[m]??null)),[n,t]),u=((v=a.find(m=>m.id===t))==null?void 0:v.name)??t;yL(t);const c=mL(t),d=Wd(m=>m.status==="connected"),p=Gl(m=>m.continueAnyway),f=Gl(m=>m.recheck),x=gL(e,c,d),S=Object.fromEntries(xm.map(m=>[m,vL(m,c,d)]));return y.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden","data-testid":"project-shell","data-project-id":t,children:[y.jsxs("header",{style:{display:"flex",alignItems:"center",gap:"8px",flexShrink:0,padding:"10px 14px 8px",background:jc.bar,borderBottom:`1px solid ${jc.border}`},children:[y.jsx("button",{type:"button",onClick:()=>n("/"),title:"All projects",style:{background:"transparent",border:"none",color:jc.muted,cursor:"pointer",fontSize:"12px",padding:0},children:"‹ Projects"}),y.jsx("h1",{"data-testid":"project-name",style:{fontSize:"13px",fontWeight:700,color:jc.ink,margin:0},children:u})]}),y.jsx(xL,{mode:e,onSelect:l,unavailable:S}),y.jsx("div",{className:"flex flex-1 overflow-hidden","data-testid":"mode-surface","data-mode":e,children:x.length>0?y.jsx(wL,{mode:e,blockers:x,onContinue:()=>p(t),onRecheck:f}):i})]})}const wt={card:"#161b22",border:"rgba(230,237,243,0.1)",ink:"#e6edf3",muted:"rgba(230,237,243,0.55)",faint:"rgba(230,237,243,0.3)",accent:"#ffda19",red:"#f85149",hover:"rgba(230,237,243,0.04)"};function _1(){return y.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5","aria-hidden":!0,children:y.jsx("polyline",{points:"15 18 9 12 15 6"})})}function Tv({label:t,color:e}){return y.jsx("span",{style:{fontSize:"10px",fontFamily:"monospace",color:e,border:`1px solid ${e}`,borderRadius:"4px",padding:"1px 5px"},children:t})}function _L({kind:t}){const r={"crew.run":"#79c0ff","crew.chat":"#a5d6ff","crew.repo":"#7ee787","crew.workflow":"#ffa657","interactive.doc":"#d2a8ff"}[t]??wt.faint;return y.jsx(Tv,{label:t,color:r})}function CL({entry:t}){const e=new Date(t.ts);return y.jsxs("div",{style:{display:"flex",gap:"12px",padding:"10px 0",borderBottom:`1px solid ${wt.border}`,alignItems:"flex-start"},children:[y.jsx("span",{style:{fontSize:"10px",fontFamily:"monospace",color:wt.faint,flexShrink:0,paddingTop:"1px"},children:e.toLocaleTimeString()}),y.jsxs("div",{style:{flex:1,minWidth:0},children:[y.jsxs("p",{style:{fontSize:"12px",color:wt.muted,margin:0,marginBottom:"2px"},children:[y.jsx("span",{style:{color:wt.faint,fontFamily:"monospace"},children:t.kind})," ",y.jsx("span",{style:{color:wt.ink},children:t.summary})]}),y.jsx("span",{style:{fontSize:"10px",fontFamily:"monospace",color:wt.faint},children:t.ref})]}),y.jsx("span",{style:{fontSize:"10px",fontFamily:"monospace",flexShrink:0,color:t.source==="crew"?"#79c0ff":"#d2a8ff"},children:t.source})]})}function kL({member:t,onDetach:e}){const[r,n]=K.useState(!1),[i,a]=K.useState(!1);async function s(){n(!0),e(t.id)}return y.jsxs("div",{onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),style:{display:"flex",alignItems:"center",gap:"10px",padding:"10px 12px",borderRadius:"7px",background:i?wt.hover:"transparent",transition:"background 0.1s"},children:[y.jsx(_L,{kind:t.member_kind}),y.jsx("span",{style:{fontSize:"12px",fontFamily:"monospace",color:wt.muted,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.member_ref}),y.jsxs("span",{style:{fontSize:"10px",color:wt.faint,flexShrink:0},children:[t.attached_by," · ",new Date(t.attached_at).toLocaleDateString()]}),i&&y.jsx("button",{type:"button",onClick:()=>void s(),disabled:r,style:{background:"transparent",border:`1px solid ${wt.red}`,color:wt.red,borderRadius:"5px",padding:"3px 8px",fontSize:"11px",cursor:"pointer",flexShrink:0},children:r?"…":"Detach"})]})}function EL({projectId:t,navigate:e}){const{updateProject:r}=Sd(),[n,i]=K.useState(null),[a,s]=K.useState([]),[o,l]=K.useState(!0),[u,c]=K.useState(null),[d,p]=K.useState(!1),[f,x]=K.useState(""),[S,v]=K.useState(""),[m,b]=K.useState(!1),[w,_]=K.useState(null),[T,N]=K.useState(!1),E=t==="default",k=(n==null?void 0:n.project)??null,L=(n==null?void 0:n.members)??[],A=K.useCallback(async()=>{l(!0),c(null);try{const[B,j]=await Promise.all([Ue.getProject(t),Ue.getProjectActivity(t).catch(()=>({entries:[],nextCursor:null,projectId:t}))]);i(B),s(j.entries)}catch(B){c(B instanceof Error?B.message:String(B))}finally{l(!1)}},[t]);K.useEffect(()=>{A()},[A]);function M(){k&&(x(k.name),v(k.description??""),_(null),p(!0))}async function O(){if(!k)return;const B=f.trim();if(B){b(!0),_(null);try{const{project:j}=await Ue.updateProject(k.id,{name:B,description:S.trim()});i(I=>I&&{...I,project:j}),r(j),p(!1)}catch(j){_(j instanceof Error?j.message:String(j))}finally{b(!1)}}}async function $(){if(!(!k||E)){N(!0);try{const B=k.status==="active"?"archived":"active",{project:j}=await Ue.updateProject(k.id,{status:B});i(I=>I&&{...I,project:j}),r(j)}catch{}finally{N(!1)}}}function D(B){k&&(Ue.detachProjectMember(k.id,B).catch(()=>{}),i(j=>j&&{...j,members:j.members.filter(I=>I.id!==B)}))}return o?y.jsx("div",{style:{padding:"28px 32px"},children:y.jsx("p",{style:{fontSize:"13px",color:wt.faint,fontFamily:"monospace"},children:"Loading…"})}):u||!k?y.jsxs("div",{style:{padding:"28px 32px"},children:[y.jsxs("button",{type:"button",onClick:()=>e("/projects"),style:{display:"flex",alignItems:"center",gap:"6px",background:"transparent",border:"none",cursor:"pointer",color:wt.muted,fontSize:"13px",marginBottom:"16px",padding:0},children:[y.jsx(_1,{})," Projects"]}),y.jsx("p",{style:{fontSize:"13px",color:wt.red},children:u??"Project not found."})]}):y.jsxs("div",{style:{padding:"28px 32px",maxWidth:"800px"},children:[y.jsxs("button",{type:"button",onClick:()=>e("/projects"),style:{display:"flex",alignItems:"center",gap:"6px",background:"transparent",border:"none",cursor:"pointer",color:wt.muted,fontSize:"12px",marginBottom:"20px",padding:0},children:[y.jsx(_1,{})," All projects"]}),d?y.jsxs("div",{style:{marginBottom:"24px"},children:[y.jsx("input",{type:"text",value:f,maxLength:120,onChange:B=>x(B.target.value),autoFocus:!0,style:{width:"100%",background:"rgba(255,255,255,0.05)",border:`1px solid ${wt.border}`,borderRadius:"6px",padding:"8px 10px",fontSize:"18px",fontWeight:700,color:wt.ink,outline:"none",marginBottom:"8px",boxSizing:"border-box"}}),y.jsx("textarea",{value:S,onChange:B=>v(B.target.value),rows:2,placeholder:"Description (optional)",style:{width:"100%",background:"rgba(255,255,255,0.05)",border:`1px solid ${wt.border}`,borderRadius:"6px",padding:"8px 10px",fontSize:"13px",color:wt.ink,outline:"none",resize:"vertical",marginBottom:"10px",boxSizing:"border-box",fontFamily:"inherit"}}),w&&y.jsx("p",{style:{fontSize:"12px",color:wt.red,marginBottom:"8px"},children:w}),y.jsxs("div",{style:{display:"flex",gap:"8px"},children:[y.jsx("button",{type:"button",onClick:()=>void O(),disabled:m||!f.trim(),style:{background:wt.accent,color:"#0d1117",border:"none",borderRadius:"6px",padding:"6px 14px",fontSize:"12px",fontWeight:700,cursor:"pointer",opacity:m?.5:1},children:m?"Saving…":"Save"}),y.jsx("button",{type:"button",onClick:()=>p(!1),style:{background:"transparent",color:wt.muted,border:`1px solid ${wt.border}`,borderRadius:"6px",padding:"6px 12px",fontSize:"12px",cursor:"pointer"},children:"Cancel"})]})]}):y.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",marginBottom:"24px",gap:"16px"},children:[y.jsxs("div",{style:{flex:1,minWidth:0},children:[y.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",marginBottom:"6px"},children:[y.jsx("h1",{style:{fontSize:"20px",fontWeight:700,color:wt.ink,margin:0},children:k.name}),k.status==="archived"&&y.jsx(Tv,{label:"archived",color:wt.faint}),E&&y.jsx(Tv,{label:"default",color:wt.faint})]}),k.description&&y.jsx("p",{style:{fontSize:"13px",color:wt.muted,margin:0},children:k.description}),k.created_at>0&&y.jsxs("p",{style:{fontSize:"11px",color:wt.faint,margin:0,marginTop:"6px",fontFamily:"monospace"},children:["Created ",new Date(k.created_at).toLocaleDateString(),k.updated_at!==k.created_at&&y.jsxs(y.Fragment,{children:[" · Updated ",new Date(k.updated_at).toLocaleDateString()]})]})]}),!E&&y.jsxs("div",{style:{display:"flex",gap:"6px",flexShrink:0},children:[y.jsx("button",{type:"button",onClick:M,style:{background:"transparent",color:wt.muted,border:`1px solid ${wt.border}`,borderRadius:"6px",padding:"6px 12px",fontSize:"12px",cursor:"pointer"},children:"Edit"}),y.jsx("button",{type:"button",onClick:()=>void $(),disabled:T,style:{background:"transparent",color:wt.faint,border:`1px solid ${wt.border}`,borderRadius:"6px",padding:"6px 12px",fontSize:"12px",cursor:"pointer",opacity:T?.5:1},children:k.status==="active"?"Archive":"Restore"})]})]}),y.jsxs("section",{style:{marginBottom:"28px"},children:[y.jsxs("h2",{style:{fontSize:"13px",fontWeight:600,color:wt.muted,margin:0,marginBottom:"10px",textTransform:"uppercase",letterSpacing:"0.06em",fontFamily:"monospace"},children:["Members (",L.length,")"]}),L.length===0?y.jsx("p",{style:{fontSize:"13px",color:wt.faint},children:"No members attached yet."}):y.jsx("div",{style:{background:wt.card,border:`1px solid ${wt.border}`,borderRadius:"10px",overflow:"hidden",padding:"4px"},children:L.map(B=>y.jsx(kL,{member:B,onDetach:D},B.id))})]}),y.jsxs("section",{children:[y.jsx("h2",{style:{fontSize:"13px",fontWeight:600,color:wt.muted,margin:0,marginBottom:"10px",textTransform:"uppercase",letterSpacing:"0.06em",fontFamily:"monospace"},children:"Activity"}),a.length===0?y.jsx("p",{style:{fontSize:"13px",color:wt.faint},children:"No activity yet."}):y.jsx("div",{style:{background:wt.card,border:`1px solid ${wt.border}`,borderRadius:"10px",padding:"0 12px"},children:a.map(B=>y.jsx(CL,{entry:B},B.id))})]})]})}const Dt={card:"#161b22",border:"rgba(230,237,243,0.1)",ink:"#e6edf3",muted:"rgba(230,237,243,0.55)",faint:"rgba(230,237,243,0.3)",accent:"#ffda19",red:"#f85149"};function $S(){return y.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:y.jsx("path",{d:"M10 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"})})}function TL(){return y.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:y.jsx("path",{d:"M20 3H4c-1.1 0-2 .9-2 2v2c0 .75.41 1.39 1 1.73V19c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V8.73c.59-.34 1-.99 1-1.73V5c0-1.1-.9-2-2-2zm-5 12H9v-2h6v2zm5-7H4V5h16v3z"})})}function NL(){return y.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:y.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 RL({onCreated:t,onCancel:e}){const[r,n]=K.useState(""),[i,a]=K.useState(""),[s,o]=K.useState(!1),[l,u]=K.useState(null),c=K.useRef(null);K.useEffect(()=>{var p;(p=c.current)==null||p.focus()},[]);async function d(){const p=r.trim();if(p){o(!0),u(null);try{const f=i.trim()?{name:p,description:i.trim()}:{name:p},{project:x}=await Ue.createProject(f);t(x)}catch(f){u(f instanceof Error?f.message:String(f)),o(!1)}}}return y.jsxs("div",{style:{background:Dt.card,border:`1px solid ${Dt.border}`,borderRadius:"10px",padding:"20px",marginBottom:"16px"},children:[y.jsx("p",{style:{fontSize:"13px",fontWeight:600,color:Dt.ink,marginBottom:"14px"},children:"New project"}),y.jsx("input",{ref:c,type:"text",placeholder:"Project name",value:r,maxLength:120,onChange:p=>n(p.target.value),onKeyDown:p=>{p.key==="Enter"&&d(),p.key==="Escape"&&e()},style:{width:"100%",background:"rgba(255,255,255,0.05)",border:`1px solid ${Dt.border}`,borderRadius:"6px",padding:"8px 10px",fontSize:"13px",color:Dt.ink,outline:"none",marginBottom:"8px",boxSizing:"border-box"}}),y.jsx("textarea",{placeholder:"Description (optional)",value:i,onChange:p=>a(p.target.value),rows:2,style:{width:"100%",background:"rgba(255,255,255,0.05)",border:`1px solid ${Dt.border}`,borderRadius:"6px",padding:"8px 10px",fontSize:"13px",color:Dt.ink,outline:"none",resize:"vertical",marginBottom:"12px",boxSizing:"border-box",fontFamily:"inherit"}}),l&&y.jsx("p",{style:{fontSize:"12px",color:Dt.red,marginBottom:"10px"},children:l}),y.jsxs("div",{style:{display:"flex",gap:"8px"},children:[y.jsx("button",{type:"button",onClick:()=>void d(),disabled:s||!r.trim(),style:{background:Dt.accent,color:"#0d1117",border:"none",borderRadius:"6px",padding:"7px 16px",fontSize:"12px",fontWeight:700,cursor:s?"default":"pointer",opacity:s||!r.trim()?.5:1},children:s?"Creating…":"Create project"}),y.jsx("button",{type:"button",onClick:e,style:{background:"transparent",color:Dt.muted,border:`1px solid ${Dt.border}`,borderRadius:"6px",padding:"7px 14px",fontSize:"12px",cursor:"pointer"},children:"Cancel"})]})]})}function C1({project:t,onClick:e}){const[r,n]=K.useState(!1),i=t.status==="archived",a=t.id==="default";return y.jsx("button",{type:"button",onClick:e,onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),style:{display:"block",width:"100%",textAlign:"left",background:r?"rgba(230,237,243,0.04)":Dt.card,border:`1px solid ${Dt.border}`,borderRadius:"10px",padding:"16px",cursor:"pointer",transition:"background 0.1s"},children:y.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"12px"},children:[y.jsx("span",{style:{color:i?Dt.faint:Dt.accent,marginTop:"1px",flexShrink:0},children:y.jsx($S,{})}),y.jsxs("div",{style:{flex:1,minWidth:0},children:[y.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"4px"},children:[y.jsx("span",{style:{fontSize:"14px",fontWeight:600,color:i?Dt.muted:Dt.ink,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.name}),i&&y.jsx("span",{style:{fontSize:"10px",fontFamily:"monospace",color:Dt.faint,border:`1px solid ${Dt.faint}`,borderRadius:"4px",padding:"1px 5px",flexShrink:0},children:"archived"}),a&&y.jsx("span",{style:{fontSize:"10px",fontFamily:"monospace",color:Dt.faint,border:`1px solid ${Dt.faint}`,borderRadius:"4px",padding:"1px 5px",flexShrink:0},children:"default"})]}),t.description&&y.jsx("p",{style:{fontSize:"12px",color:Dt.muted,margin:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.description}),t.created_at>0&&y.jsxs("p",{style:{fontSize:"11px",color:Dt.faint,margin:0,marginTop:"6px",fontFamily:"monospace"},children:["Created ",new Date(t.created_at).toLocaleDateString()]})]})]})})}function LL({navigate:t}){const{projects:e,loading:r,error:n,load:i,addProject:a}=Sd(),[s,o]=K.useState(!1),[l,u]=K.useState(!1);K.useEffect(()=>{i()},[i]);const c=e.filter(f=>f.status==="active"),d=e.filter(f=>f.status==="archived");function p(f){a(f),o(!1)}return y.jsxs("div",{style:{padding:"28px 32px",maxWidth:"760px"},children:[y.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"24px"},children:[y.jsxs("div",{children:[y.jsx("h1",{style:{fontSize:"20px",fontWeight:700,color:Dt.ink,margin:0,marginBottom:"4px"},children:"Projects"}),y.jsx("p",{style:{fontSize:"13px",color:Dt.muted,margin:0},children:"Group runs, chats, and repos into named containers."})]}),y.jsxs("button",{type:"button",onClick:()=>o(!0),style:{display:"flex",alignItems:"center",gap:"6px",background:Dt.accent,color:"#0d1117",border:"none",borderRadius:"7px",padding:"8px 14px",fontSize:"12px",fontWeight:700,cursor:"pointer",flexShrink:0},children:[y.jsx(NL,{})," New project"]})]}),s&&y.jsx(RL,{onCreated:p,onCancel:()=>o(!1)}),r&&y.jsx("p",{style:{fontSize:"13px",color:Dt.faint,fontFamily:"monospace"},children:"Loading…"}),!r&&n&&y.jsx("p",{style:{fontSize:"13px",color:Dt.red},children:n}),!r&&!n&&c.length===0&&!s&&y.jsxs("div",{style:{textAlign:"center",padding:"48px 24px",background:Dt.card,border:`1px solid ${Dt.border}`,borderRadius:"12px"},children:[y.jsx("span",{style:{color:Dt.faint,display:"block",marginBottom:"10px"},children:y.jsx($S,{})}),y.jsx("p",{style:{fontSize:"14px",color:Dt.muted,margin:0,marginBottom:"4px"},children:"No projects yet"}),y.jsx("p",{style:{fontSize:"12px",color:Dt.faint,margin:0},children:"Create a project to group your runs, chats, and repos."})]}),c.length>0&&y.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px",marginBottom:"16px"},children:c.map(f=>y.jsx(C1,{project:f,onClick:()=>t(`/projects/${encodeURIComponent(f.id)}`)},f.id))}),d.length>0&&y.jsxs("div",{style:{marginTop:"16px"},children:[y.jsxs("button",{type:"button",onClick:()=>u(f=>!f),style:{display:"flex",alignItems:"center",gap:"6px",background:"transparent",border:"none",cursor:"pointer",fontSize:"12px",color:Dt.faint,padding:"4px 0",marginBottom:"8px"},children:[y.jsx(TL,{}),l?"Hide":"Show"," ",d.length," archived project",d.length!==1?"s":""]}),l&&y.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:d.map(f=>y.jsx(C1,{project:f,onClick:()=>t(`/projects/${encodeURIComponent(f.id)}`)},f.id))})]})]})}const DL=new Set(["completed","cancelled","failed"]);function AL(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 Ic={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 Sp({label:t,value:e,hint:r}){return y.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:[y.jsx("p",{className:"text-[10px] font-mono uppercase tracking-widest",style:{color:"rgba(230,237,243,0.4)"},children:t}),y.jsx("p",{className:"text-3xl font-mono font-bold",style:{color:"#e6edf3"},children:e}),r&&y.jsx("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.35)"},children:r})]})}function PL({onSelectRun:t,autoShowRegister:e,navigate:r}){const[n,i]=K.useState([]),[a,s]=K.useState([]),[o,l]=K.useState(!0),[u,c]=K.useState(null),[d,p]=K.useState(""),[f,x]=K.useState(0),[S,v]=K.useState({}),[m,b]=K.useState({}),[w,_]=K.useState(e??!1),[T,N]=K.useState("local"),[E,k]=K.useState(""),[L,A]=K.useState(""),[M,O]=K.useState(""),[$,D]=K.useState(""),[B,j]=K.useState(null),[I,U]=K.useState(!1),F=K.useRef(!1);K.useEffect(()=>{l(!0),Promise.all([Ue.listRepos(),Ue.listRuns()]).then(([{repos:X},{runs:q}])=>{i(X),s(q)}).catch(X=>c(X instanceof Error?X.message:String(X))).finally(()=>l(!1))},[]),K.useEffect(()=>{if(n.length===0){x(0);return}let X=!1;return Promise.all(n.map(q=>Ue.getRepoGraph(q.id).then(({graph:Y})=>Y!=null).catch(()=>!1))).then(q=>{X||x(q.filter(Boolean).length)}),()=>{X=!0}},[n]);function P(X){if(F.current)return;const q=X.replace(/\.git$/,"").split(/[/\\:]/).filter(Boolean).pop()??"";q&&k(q)}async function H(X){v(q=>({...q,[X]:!0})),b(q=>({...q,[X]:""}));try{const{runId:q}=await Ue.rerunOnboarding(X);t==null||t(q)}catch(q){b(Y=>({...Y,[X]:q instanceof Error?q.message:String(q)}))}finally{v(q=>({...q,[X]:!1}))}}async function W(){const X=E.trim(),q=T==="remote",Y=q?M.trim():L.trim();if(!(!X||!Y)){j(null),U(!0);try{const{repo:Q}=q?await Ue.cloneAndRegisterRepo(X,Y,$.trim()||void 0):await Ue.registerRepo(X,Y);i(te=>[...te,Q]),_(!1),k(""),A(""),O(""),D(""),N("local"),F.current=!1,r("/repo-detail/"+encodeURIComponent(Q.id))}catch(Q){j(Q instanceof Error?Q.message:String(Q))}finally{U(!1)}}}const V=!!(E.trim()&&(T==="remote"?M.trim():L.trim())),re=a.filter(X=>!DL.has(X.session.status)),J=d.trim()===""?n:n.filter(X=>X.name.toLowerCase().includes(d.trim().toLowerCase()));function ne(X){return re.filter(q=>q.session.repo_ref===X).length}return y.jsxs("div",{className:"h-full overflow-y-auto",children:[y.jsxs("div",{className:"px-8 pt-8 pb-4",children:[y.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[y.jsx("h1",{className:"text-base font-bold font-mono flex-1",style:{color:"#e6edf3",letterSpacing:"-0.01em"},children:"Repositories"}),y.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:d,onChange:X=>p(X.target.value)}),y.jsx("button",{type:"button",onClick:()=>{w?(_(!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:w?"rgba(230,237,243,0.1)":"#ffda19",color:w?"#e6edf3":"#0d1117"},children:w?"Cancel":"+ Add Repository"})]}),w&&y.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:[y.jsx("div",{role:"group","aria-label":"Repository source",className:"flex gap-1",children:["local","remote"].map(X=>y.jsx("button",{type:"button","aria-pressed":T===X,onClick:()=>N(X),className:"rounded-md px-3 py-1 text-[11px] font-mono font-medium transition-colors",style:T===X?{background:"rgba(230,237,243,0.12)",color:"#e6edf3"}:{color:"rgba(230,237,243,0.4)"},children:X==="local"?"Local path":"Remote URL"},X))}),y.jsx("input",{style:Ic,placeholder:"Repo name",value:E,onChange:X=>{k(X.target.value),F.current=!!X.target.value.trim()}}),T==="local"?y.jsx("input",{style:Ic,placeholder:"Absolute path to git repo",value:L,onChange:X=>{A(X.target.value),P(X.target.value)}}):y.jsxs(y.Fragment,{children:[y.jsx("input",{style:Ic,placeholder:"https://github.com/org/repo or git@github.com:org/repo",value:M,onChange:X=>{O(X.target.value),P(X.target.value)}}),y.jsxs("div",{className:"flex flex-col gap-1",children:[y.jsx("label",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Clone to (optional)"}),y.jsx("input",{style:Ic,placeholder:`~/.wicked/repos/${E||"<name>"}`,value:$,onChange:X=>D(X.target.value)})]})]}),y.jsx("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:T==="remote"?`Clones to ${$.trim()||`~/.wicked/repos/${E||"<name>"}`}, then runs the onboarding workflow as a governed run.`:"Runs the onboarding workflow (index → annotate → domain) as a governed run."}),B&&y.jsx("p",{className:"text-[11px] font-mono",style:{color:"#f85149"},children:B}),y.jsx("button",{type:"button",onClick:()=>void W(),disabled:I||!V,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:I?T==="remote"?"Cloning…":"Registering…":T==="remote"?"Clone & onboard":"Register & onboard"})]})]}),y.jsxs("div",{className:"px-8 pb-10",children:[!o&&!u&&y.jsxs("div",{className:"grid grid-cols-3 gap-4 mb-6",children:[y.jsx(Sp,{label:"Total Repos",value:n.length,hint:"registered with wicked-crew"}),y.jsx(Sp,{label:"Active Runs",value:re.length,hint:re.length===1?"1 run in progress":`${re.length} runs in progress`}),y.jsx(Sp,{label:"Tracked",value:f,hint:"onboarded and graph-indexed"})]}),o?y.jsx("p",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Loading repositories…"}):u?y.jsx("p",{className:"text-xs font-mono",style:{color:"#f85149"},children:u}):n.length===0?y.jsx("div",{className:"flex flex-col items-center justify-center py-24 text-center",children:y.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:[y.jsx("p",{className:"text-2xl font-mono font-bold",style:{color:"rgba(230,237,243,0.15)"},children:"No repositories"}),y.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."}),y.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"})]})}):J.length===0?y.jsxs("p",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.4)"},children:["No repos match “",d,"”."]}):y.jsx("div",{className:"grid grid-cols-2 gap-4",children:J.map(X=>{const q=ne(X.id),Y=S[X.id]??!1,Q=m[X.id];return y.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(X.id)),role:"button",tabIndex:0,onKeyDown:te=>{(te.key==="Enter"||te.key===" ")&&r("/repo-detail/"+encodeURIComponent(X.id))},children:[y.jsxs("div",{className:"flex items-start justify-between gap-2",children:[y.jsxs("div",{className:"flex-1 min-w-0",children:[y.jsx("p",{className:"text-sm font-bold font-mono truncate",style:{color:"#e6edf3"},children:X.name}),y.jsx("p",{className:"text-[11px] font-mono mt-0.5 truncate",style:{color:"rgba(230,237,243,0.4)"},title:X.root_path,children:X.root_path})]}),y.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[q>0&&y.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"]}),y.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:X.default_branch})]})]}),y.jsx("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.3)"},children:AL(X.registered_at)}),Q&&y.jsx("p",{className:"text-[11px] font-mono",style:{color:"#f85149"},children:Q}),y.jsxs("div",{className:"flex items-center justify-between mt-auto",onClick:te=>te.stopPropagation(),onKeyDown:te=>te.stopPropagation(),role:"presentation",children:[y.jsx("button",{type:"button",onClick:()=>r("/repo-detail/"+encodeURIComponent(X.id)),className:"text-xs font-mono hover:underline",style:{color:"#79c0ff"},children:"View →"}),y.jsx("button",{type:"button",disabled:Y,onClick:()=>void H(X.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:Y?"Starting…":"Onboard"})]})]},X.id)})})]})]})}const qe={canvas2:"#121826",surface:"#151b2c",surface2:"#161d2f",ink:"#e6edf3",muted:"rgba(230,237,243,0.6)",faint:"rgba(230,237,243,0.35)",hairline:"rgba(230,237,243,0.08)",hairlineS:"rgba(230,237,243,0.14)",ok:"#3fb950",deny:"#f85149",link:"#79c0ff",accent:"#ffda19"},Ka=50;function ML({repoId:t,repoName:e,onClose:r,onNavigateComponent:n}){const[i,a]=K.useState(""),[s,o]=K.useState("all"),[l,u]=K.useState("functional"),[c,d]=K.useState(0),[p,f]=K.useState(null),[x,S]=K.useState(null),[v,m]=K.useState(null),b=K.useRef(null),w=K.useCallback((L,A,M,O)=>{const $={offset:O,limit:Ka};L.trim()!==""&&($.q=L.trim()),A!=="all"&&($.risk=A),M!=="all"&&($.category=M),Ue.listRequirements(t,$).then(D=>{f(D),S(null)}).catch(D=>S(D instanceof Error?D.message:String(D)))},[t]);K.useEffect(()=>(b.current!==null&&clearTimeout(b.current),b.current=setTimeout(()=>w(i,s,l,c),250),()=>{b.current!==null&&clearTimeout(b.current)}),[i,s,l,c,w]);function _(L){o(L),d(0)}function T(L){u(L),d(0)}function N(L){f(A=>A===null?A:{...A,items:A.items.map(M=>M.key===L.key?{...M,...OL(L)}:M)})}const E=p!==null?Math.max(1,Math.ceil(p.total/Ka)):1,k=Math.floor(c/Ka)+1;return y.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"rgba(0,0,0,0.6)"},children:y.jsxs("div",{className:"w-[92vw] h-[92vh] rounded-2xl flex flex-col overflow-hidden border",style:{background:qe.surface,border:`1px solid ${qe.hairlineS}`},children:[y.jsxs("div",{className:"flex items-center gap-3 px-5 py-3 border-b shrink-0",style:{borderColor:qe.hairline,background:qe.canvas2},children:[y.jsx("span",{className:"font-mono text-sm font-semibold",style:{color:qe.ink},children:e}),y.jsx("span",{className:"font-mono text-[11px] px-2 py-0.5 rounded",style:{background:qe.surface2,color:qe.muted},children:"requirements"}),p!==null&&y.jsx("span",{className:"font-mono text-[11px]",style:{color:qe.faint},children:p.total===p.corpus?`${p.corpus} total`:`${p.total} matching · ${p.corpus} total`}),y.jsx("button",{type:"button",onClick:r,"aria-label":"Close requirements",className:"ml-auto text-lg px-2",style:{color:qe.muted},children:"×"})]}),y.jsxs("div",{className:"flex items-center gap-3 px-5 py-2.5 border-b shrink-0",style:{borderColor:qe.hairline},children:[y.jsx("input",{type:"text",value:i,onChange:L=>{a(L.target.value),d(0)},placeholder:"Search requirements (server-side: id, domain, title, description)…",className:"flex-1 text-[12px] font-mono px-3 py-1.5 rounded-lg border outline-none",style:{border:`1px solid ${qe.hairlineS}`,background:qe.canvas2,color:qe.ink}}),y.jsx("div",{className:"flex items-center gap-1",role:"group","aria-label":"Category filter",children:["functional","config-data","all"].map(L=>y.jsx("button",{type:"button",onClick:()=>T(L),"aria-pressed":l===L,className:"px-2.5 py-1 rounded-lg text-[11px] font-mono font-semibold",style:{background:l===L?qe.surface2:"transparent",color:l===L?qe.ink:qe.faint,border:`1px solid ${l===L?qe.hairlineS:"transparent"}`},children:L==="functional"?"Functional":L==="config-data"?"Config & data":"All"},L))}),y.jsx("div",{className:"w-px h-4",style:{background:qe.hairline}}),y.jsx("div",{className:"flex items-center gap-1",role:"group","aria-label":"Risk filter",children:["all","risk","no-risk"].map(L=>y.jsx("button",{type:"button",onClick:()=>_(L),"aria-pressed":s===L,className:"px-2.5 py-1 rounded-lg text-[11px] font-mono font-semibold",style:{background:s===L?L==="risk"?"rgba(248,81,73,0.18)":qe.surface2:"transparent",color:s===L?L==="risk"?qe.deny:qe.ink:qe.faint,border:`1px solid ${s===L?qe.hairlineS:"transparent"}`},children:L==="all"?"All":L==="risk"?"Risk":"No risk"},L))})]}),y.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[y.jsxs("div",{className:"flex-1 overflow-y-auto",children:[x!==null?y.jsx("p",{className:"text-[12px] font-mono p-6",style:{color:qe.deny},children:x}):p===null?y.jsx("p",{className:"text-[12px] font-mono p-6",style:{color:qe.faint},children:"Loading…"}):p.corpus===0?y.jsxs("div",{className:"p-6 space-y-1",children:[y.jsx("p",{className:"text-[12px] font-mono",style:{color:qe.ink},children:"No requirements have been extracted for this repo."}),y.jsx("p",{className:"text-[12px] font-mono",style:{color:qe.faint},children:"Run domain extraction on it to populate this view."})]}):p.items.length===0?y.jsx("p",{className:"text-[12px] font-mono p-6",style:{color:qe.faint},children:"No requirements match."}):y.jsx("div",{className:"divide-y",style:{borderColor:qe.hairline},children:p.items.map(L=>y.jsx(jL,{req:L,selected:v===L.key,onSelect:()=>m(L.key)},L.key))}),p!==null&&p.total>Ka&&y.jsxs("div",{className:"flex items-center justify-center gap-4 py-3",children:[y.jsx("button",{type:"button",disabled:c===0,onClick:()=>d(Math.max(0,c-Ka)),className:"text-[11px] font-mono px-3 py-1 rounded disabled:opacity-40",style:{color:qe.link},children:"← Prev"}),y.jsxs("span",{className:"text-[11px] font-mono",style:{color:qe.faint},children:["page ",k," of ",E]}),y.jsx("button",{type:"button",disabled:c+Ka>=p.total,onClick:()=>d(c+Ka),className:"text-[11px] font-mono px-3 py-1 rounded disabled:opacity-40",style:{color:qe.link},children:"Next →"})]})]}),v!==null&&y.jsx(IL,{repoId:t,reqKey:v,onClose:()=>m(null),onSaved:N,onNavigateComponent:n})]})]})})}function OL(t){return{key:t.key,domain:t.domain,reqId:t.reqId,title:t.title,category:t.category,statement:t.statement,status:t.status,risk:t.risk,riskSource:t.riskSource,edited:t.edited}}function jL({req:t,selected:e,onSelect:r}){return y.jsxs("button",{type:"button",onClick:r,className:"w-full text-left px-5 py-2.5 flex items-center gap-3 shrink-0",style:{background:e?qe.canvas2:"transparent",borderColor:qe.hairline},children:[y.jsx("span",{className:"text-[10px] font-mono shrink-0 w-16",style:{color:qe.faint},children:t.reqId}),y.jsxs("span",{className:"flex-1 min-w-0",children:[y.jsx("span",{className:"block text-[12px] truncate",style:{color:qe.ink},children:t.title}),t.statement.trim()!==""&&y.jsx("span",{className:"block text-[11px] truncate",style:{color:qe.muted},children:t.statement.trim()}),y.jsx("span",{className:"block text-[10px] font-mono truncate",style:{color:qe.faint},children:t.domain})]}),t.edited&&y.jsx("span",{className:"text-[9px] uppercase font-mono px-1.5 py-0.5 rounded shrink-0",style:{background:qe.surface2,color:qe.link},children:"edited"}),t.risk&&y.jsxs("span",{className:"text-[9px] uppercase font-semibold font-mono px-1.5 py-0.5 rounded shrink-0",style:{background:"rgba(248,81,73,0.15)",color:qe.deny},title:t.riskSource==="operator"?"Marked risk by operator":"Risk derived from business rules",children:["risk",t.riskSource==="operator"?" ●":""]}),y.jsx("span",{className:"text-[9px] uppercase font-mono px-1.5 py-0.5 rounded shrink-0",style:{background:t.status==="active"?"rgba(63,185,80,0.12)":t.status==="deprecated"?"rgba(248,81,73,0.12)":qe.surface2,color:t.status==="active"?qe.ok:t.status==="deprecated"?qe.deny:qe.muted},children:t.status})]})}function IL({repoId:t,reqKey:e,onClose:r,onSaved:n,onNavigateComponent:i}){const[a,s]=K.useState(null),[o,l]=K.useState(""),[u,c]=K.useState(""),[d,p]=K.useState("active"),[f,x]=K.useState(!1),[S,v]=K.useState(null),[m,b]=K.useState(null);K.useEffect(()=>{s(null),v(null),b(null),Ue.getRequirement(t,e).then(({requirement:T})=>{s(T),l(T.title),c(T.notes),p(T.status==="deprecated"||T.status==="review"?T.status:"active")}).catch(T=>b(T instanceof Error?T.message:String(T)))},[t,e]);function w(T){if(a===null)return;const N={...T};o!==a.title&&(N.title=o),u!==a.notes&&(N.notes=u),d!==a.status&&(N.status=d),Object.keys(N).length!==0&&(x(!0),b(null),Ue.patchRequirement(t,e,N).then(({requirement:E})=>{s(E),l(E.title),c(E.notes),p(E.status==="deprecated"||E.status==="review"?E.status:"active"),n(E),v(Date.now())}).catch(E=>b(E instanceof Error?E.message:String(E))).finally(()=>x(!1)))}function _(){a!==null&&(x(!0),b(null),Ue.patchRequirement(t,e,{risk:!a.risk}).then(({requirement:T})=>{s(T),n(T),v(Date.now())}).catch(T=>b(T instanceof Error?T.message:String(T))).finally(()=>x(!1)))}return y.jsxs("div",{className:"w-[420px] shrink-0 border-l flex flex-col",style:{borderColor:qe.hairlineS,background:qe.surface2},children:[y.jsxs("div",{className:"px-4 py-2.5 border-b flex items-center gap-2 shrink-0",style:{borderColor:qe.hairline,background:qe.canvas2},children:[y.jsx("span",{className:"text-[11px] font-mono truncate",style:{color:qe.ink},children:e}),y.jsx("button",{type:"button",onClick:r,"aria-label":"Close requirement editor",className:"ml-auto text-sm px-1 shrink-0",style:{color:qe.muted},children:"×"})]}),m!==null&&y.jsx("p",{className:"text-[11px] font-mono px-4 py-2",style:{color:qe.deny},children:m}),a===null&&m===null?y.jsx("p",{className:"text-[11px] font-mono px-4 py-3",style:{color:qe.faint},children:"Loading…"}):a!==null?y.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-3 flex flex-col gap-3",children:[y.jsxs("label",{className:"flex flex-col gap-1",children:[y.jsx("span",{className:"text-[10px] font-mono uppercase",style:{color:qe.faint},children:"Title"}),y.jsx("input",{type:"text",value:o,onChange:T=>l(T.target.value),className:"text-[12px] font-mono px-3 py-1.5 rounded-lg border outline-none",style:{border:`1px solid ${qe.hairlineS}`,background:qe.canvas2,color:qe.ink}})]}),a.title!==a.sourceTitle&&y.jsxs("p",{className:"text-[10px] font-mono",style:{color:qe.faint},children:["source title: ",a.sourceTitle]}),y.jsxs("div",{children:[y.jsx("span",{className:"text-[10px] font-mono uppercase",style:{color:qe.faint},children:"Description (source)"}),y.jsx("p",{className:"text-[11px] mt-1 whitespace-pre-wrap",style:{color:qe.muted},children:a.description===""?"(none recorded)":a.description.slice(0,1200)})]}),y.jsxs("label",{className:"flex flex-col gap-1",children:[y.jsx("span",{className:"text-[10px] font-mono uppercase",style:{color:qe.faint},children:"Notes (operator)"}),y.jsx("textarea",{value:u,onChange:T=>c(T.target.value),rows:4,className:"text-[11px] font-mono px-3 py-1.5 rounded-lg border outline-none resize-y",style:{border:`1px solid ${qe.hairlineS}`,background:qe.canvas2,color:qe.ink}})]}),y.jsxs("div",{className:"flex items-center gap-3",children:[y.jsxs("label",{className:"flex items-center gap-2",children:[y.jsx("span",{className:"text-[10px] font-mono uppercase",style:{color:qe.faint},children:"Status"}),y.jsxs("select",{value:d,onChange:T=>p(T.target.value),className:"text-[11px] font-mono px-2 py-1 rounded-lg border outline-none",style:{border:`1px solid ${qe.hairlineS}`,background:qe.canvas2,color:qe.ink},children:[y.jsx("option",{value:"active",children:"active"}),y.jsx("option",{value:"review",children:"review"}),y.jsx("option",{value:"deprecated",children:"deprecated"})]})]}),y.jsx("button",{type:"button",onClick:_,disabled:f,className:"text-[11px] font-mono font-semibold px-3 py-1 rounded-lg disabled:opacity-50",style:{background:a.risk?"rgba(248,81,73,0.18)":qe.canvas2,color:a.risk?qe.deny:qe.muted,border:`1px solid ${qe.hairlineS}`},children:a.risk?"⚑ Risk (clear)":"⚑ Mark as risk"})]}),a.riskSource==="data"&&y.jsx("p",{className:"text-[10px] font-mono",style:{color:qe.faint},children:"risk derived from business rules — an operator toggle overrides it"}),a.businessRules.length>0&&y.jsxs("div",{children:[y.jsx("span",{className:"text-[10px] font-mono uppercase",style:{color:qe.faint},children:"Business rules"}),y.jsx("ol",{className:"mt-1 flex flex-col gap-1.5",children:a.businessRules.map((T,N)=>{const E=T,k=typeof E.statement=="string"?E.statement.trim():"",L=k!==""?k:JSON.stringify(T),A=typeof E.confidence=="number"?E.confidence:null;return y.jsxs("li",{className:"text-[11px] leading-snug",style:{color:qe.ink},children:[L,A!==null&&y.jsxs("span",{className:"text-[9px] font-mono ml-1.5",style:{color:qe.faint},children:["conf ",A]})]},N)})})]}),y.jsxs("div",{className:"text-[10px] font-mono flex gap-3 flex-wrap",style:{color:qe.faint},children:[y.jsxs("span",{children:[a.ruleCount," rules"]}),y.jsxs("span",{children:[a.componentCount," components"]}),y.jsxs("span",{children:[a.validationCount," validations"]}),y.jsxs("span",{children:[a.errorPathCount," error paths"]})]}),a.legacyComponents.length>0&&y.jsxs("div",{children:[y.jsx("span",{className:"text-[10px] font-mono uppercase",style:{color:qe.faint},children:"Components"}),y.jsx("ul",{className:"mt-1 flex flex-col gap-0.5",children:a.legacyComponents.map((T,N)=>{const E=typeof T=="string"?T:JSON.stringify(T),k=typeof T=="string"?T.includes("#")?T.split("#")[1]:T:"";return y.jsx("li",{className:"text-[10px] font-mono truncate",children:i!==void 0&&k!==""?y.jsxs("button",{type:"button",onClick:()=>i(k),className:"hover:underline text-left truncate w-full",style:{color:qe.link},title:`Open ${E} in the code graph`,children:[E," →"]}):y.jsx("span",{style:{color:qe.muted},children:E})},N)})})]}),y.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[y.jsx("button",{type:"button",onClick:()=>w(),disabled:f,className:"px-4 py-1.5 rounded-lg text-[12px] font-mono font-semibold disabled:opacity-50",style:{background:qe.accent,color:"#0d1117"},children:f?"Saving…":"Save"}),S!==null&&!f&&y.jsx("span",{className:"text-[10px] font-mono",style:{color:qe.ok},children:"saved ✓"})]})]}):null]})}const BL=new Set(["completed","failed","cancelled"]);function FL({repoId:t,onSelectRun:e,navigate:r,onOpenGraph:n}){const[i,a]=K.useState(!1),[s,o]=K.useState(null),[l,u]=K.useState([]),[c,d]=K.useState(null),[p,f]=K.useState(null),[x,S]=K.useState(null),[v,m]=K.useState(!0),[b,w]=K.useState(null),[_,T]=K.useState(!1),[N,E]=K.useState(!1),[k,L]=K.useState(null);if(K.useEffect(()=>{let I=!1;return m(!0),w(null),T(!1),f(null),S(null),Promise.all([Ue.listRepos().then(({repos:U})=>U.find(F=>F.id===t)??null),Ue.listRuns().then(({runs:U})=>U.filter(F=>F.session.repo_ref===t)).catch(()=>[]),Ue.getRepoGraph(t).then(({graph:U})=>U).catch(()=>null)]).then(([U,F,P])=>{I||(o(U),u(F),d(P))}).catch(U=>{I||w(U instanceof Error?U.message:"Failed to load repo")}).finally(()=>{I||m(!1)}),Ue.getRepoGitHistory(t).then(({commits:U})=>{I||f(U)}).catch(()=>{}),Ue.getRepoContributors(t).then(({contributors:U})=>{I||S(U)}).catch(()=>{}),()=>{I=!0}},[t]),v)return y.jsx("div",{className:"p-8 font-mono text-sm",style:{color:"rgba(230,237,243,0.4)"},children:"Loading…"});if(b)return y.jsx("div",{className:"p-8 font-mono text-sm",style:{color:"#f85149"},children:b});if(!s)return y.jsx("div",{className:"p-8 font-mono text-sm",style:{color:"#f85149"},children:"Repo not found."});const A=l.filter(I=>!BL.has(I.session.status)),M=l.filter(I=>I.session.status==="completed"),O=l.filter(I=>I.session.status==="failed"||I.session.status==="cancelled"),$=c?[...c.nodes].filter(I=>I.file&&!I.file.startsWith("node_modules/")).sort((I,U)=>U.inDeg-I.inDeg).slice(0,5):[],D=_?l:l.slice(0,10),B=c==null?void 0:c.stats;async function j(){E(!0),L(null);try{const{runId:I}=await Ue.rerunOnboarding(t);e(I)}catch(I){L(I instanceof Error?I.message:String(I))}finally{E(!1)}}return y.jsxs("div",{className:"flex flex-col gap-6 p-8",style:{color:"#e6edf3"},children:[y.jsxs("div",{className:"flex flex-col gap-3",children:[y.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"}),y.jsxs("div",{className:"flex items-start gap-4 flex-wrap",children:[y.jsxs("div",{className:"flex-1 min-w-0",children:[y.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[y.jsx("h1",{className:"text-2xl font-semibold font-mono",children:s.name}),y.jsx("button",{type:"button",onClick:()=>void j(),disabled:N,className:"px-3 py-1 rounded-lg text-xs font-semibold font-mono transition-opacity disabled:opacity-50",style:{background:"#ffda19",color:"#0d1117"},children:N?"Starting…":"↺ Run Onboarding"}),y.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 →"}),y.jsx("button",{type:"button",onClick:()=>a(!0),className:"px-3 py-1 rounded-lg text-xs font-semibold font-mono transition-opacity hover:opacity-80",style:{background:"rgba(63,185,80,0.12)",color:"#3fb950",border:"1px solid rgba(63,185,80,0.2)"},children:"Open Requirements →"})]}),k&&y.jsx("p",{className:"text-[11px] font-mono mt-1",style:{color:"#f85149"},children:k}),y.jsx("p",{className:"text-xs font-mono mt-1 break-all",style:{color:"rgba(230,237,243,0.4)"},children:s.root_path}),s.git_url&&(/^https?:\/\//i.test(s.git_url)?y.jsx("a",{href:s.git_url,target:"_blank",rel:"noopener noreferrer",className:"text-[11px] font-mono mt-0.5 block truncate hover:underline",style:{color:"#79c0ff"},title:s.git_url,children:s.git_url}):y.jsx("span",{className:"text-[11px] font-mono mt-0.5 block truncate",style:{color:"#79c0ff"},title:s.git_url,children:s.git_url}))]}),y.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:s.default_branch})]})]}),y.jsx("div",{className:"grid grid-cols-4 gap-4",children:[{label:"Total Runs",value:l.length,accent:void 0},{label:"Active",value:A.length,accent:A.length>0?"#79c0ff":void 0},{label:"Completed",value:M.length,accent:M.length>0?"#3fb950":void 0},{label:"Failed",value:O.length,accent:O.length>0?"#f85149":void 0}].map(I=>y.jsxs("div",{className:"rounded-2xl px-6 py-4",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.07)"},children:[y.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest font-mono",style:{color:"rgba(230,237,243,0.4)"},children:I.label}),y.jsx("p",{className:"text-3xl font-semibold mt-1",style:{color:I.accent??"#e6edf3"},children:I.value})]},I.label))}),A.length>0&&y.jsx(qs,{title:"Active Now",children:y.jsx("div",{className:"flex flex-col gap-1",children:A.map(I=>y.jsx(ji,{view:I,selectedRunId:null,onSelect:e},I.session.id))})}),y.jsxs("div",{className:"grid gap-6 grid-cols-1 md:grid-cols-2",children:[y.jsxs("div",{className:"flex flex-col gap-6",children:[l.length>0&&y.jsxs(qs,{title:"Work & Chats",children:[y.jsx("div",{className:"flex flex-col gap-1",children:D.map(I=>y.jsx(ji,{view:I,selectedRunId:null,onSelect:e},I.session.id))}),l.length>10&&y.jsx("button",{type:"button",onClick:()=>T(I=>!I),className:"mt-3 text-xs font-mono hover:underline",style:{color:"rgba(230,237,243,0.4)"},children:_?"↑ show less":`↓ show all ${l.length} runs`})]}),y.jsx(qs,{title:"Code Hotspots",children:$.length===0?y.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."}):y.jsxs("div",{className:"flex flex-col gap-2",children:[$.map((I,U)=>y.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:[y.jsx("span",{className:"text-[10px] font-mono w-4 text-right shrink-0",style:{color:"rgba(230,237,243,0.3)"},children:U+1}),y.jsx("span",{className:"flex-1 text-xs font-mono truncate",style:{color:"rgba(230,237,243,0.75)"},title:I.file,children:I.file}),y.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"]}),y.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)),y.jsx("button",{type:"button",onClick:()=>n(),className:"mt-2 self-start text-xs font-mono hover:underline",style:{color:"#79c0ff"},children:"Open full graph →"})]})})]}),y.jsxs("div",{className:"flex flex-col gap-6",children:[y.jsx(qs,{title:"Code Graph",children:B?y.jsxs("div",{className:"flex flex-col gap-3",children:[[{label:"Symbols",value:B.nodeCount},{label:"Edges",value:B.edgeCount},{label:"Files indexed",value:B.fileCount}].map(I=>y.jsxs("div",{className:"flex items-center justify-between",children:[y.jsx("span",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.5)"},children:I.label}),y.jsx("span",{className:"text-sm font-semibold font-mono",style:{color:"#e6edf3"},children:I.value.toLocaleString()})]},I.label)),y.jsx("button",{type:"button",onClick:()=>n(),className:"mt-2 self-start text-xs font-mono hover:underline",style:{color:"#79c0ff"},children:"Browse full graph →"})]}):y.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."})}),y.jsx(qs,{title:"Git History",children:p===null?y.jsx(zL,{count:6,widths:["w-14","w-16","flex-1","w-12"]}):p.length===0?y.jsx("p",{className:"text-sm font-mono italic",style:{color:"rgba(230,237,243,0.35)"},children:"No commits yet."}):y.jsx("div",{className:"flex flex-col gap-2",children:p.map(I=>y.jsxs("div",{className:"flex items-start gap-2 min-w-0",children:[s.git_url&&/^https:\/\//i.test(s.git_url)?y.jsx("a",{href:`${s.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}):y.jsx("span",{className:"shrink-0 text-[10px] font-mono",style:{color:"#79c0ff",marginTop:"1px"},children:I.shortSha}),y.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}),y.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}),y.jsx("span",{className:"shrink-0 text-[9px] font-mono",style:{color:"rgba(230,237,243,0.3)"},children:I.date})]},I.sha))})}),y.jsx(qs,{title:"Contributors",children:x===null?y.jsx($L,{count:4}):x.length===0?y.jsx("p",{className:"text-sm font-mono italic",style:{color:"rgba(230,237,243,0.35)"},children:"No contributors found."}):y.jsx("div",{className:"flex flex-col gap-2",children:x.map((I,U)=>{const F=I.name.split(" ").map(P=>P[0]??"").join("").slice(0,2).toUpperCase();return y.jsxs("div",{className:"flex items-center gap-2",children:[y.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:F}),y.jsx("span",{className:"flex-1 text-xs font-mono truncate",style:{color:"rgba(230,237,243,0.8)"},children:I.name}),y.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}`)})})})]})]}),i&&s&&y.jsx(ML,{repoId:t,repoName:s.name,onClose:()=>a(!1),onNavigateComponent:I=>{a(!1),n(I)}})]})}const HS="rgba(230,237,243,0.06)";function Nv({className:t}){return y.jsx("span",{className:`inline-block rounded animate-pulse ${t}`,style:{background:HS}})}function zL({count:t,widths:e}){return y.jsx("div",{className:"flex flex-col gap-2.5",children:Array.from({length:t},(r,n)=>y.jsx("div",{className:"flex items-center gap-2 min-w-0",style:{opacity:Math.max(.15,1-n*.12)},children:e.map((i,a)=>y.jsx(Nv,{className:`h-2.5 ${i}`},a))},n))})}function $L({count:t}){return y.jsx("div",{className:"flex flex-col gap-2.5",children:Array.from({length:t},(e,r)=>y.jsxs("div",{className:"flex items-center gap-2",style:{opacity:Math.max(.15,1-r*.18)},children:[y.jsx("span",{className:"shrink-0 w-6 h-6 rounded-full animate-pulse",style:{background:HS}}),y.jsx(Nv,{className:"h-2.5 w-28"}),y.jsx(Nv,{className:"h-2 w-14 ml-auto"})]},r))})}function qs({title:t,children:e}){return y.jsxs("div",{className:"rounded-2xl p-6",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.07)"},children:[y.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 Rv(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 HL(t){if(Array.isArray(t))return t}function UL(t){if(Array.isArray(t))return Rv(t)}function Ta(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function WL(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,WS(n.key),n)}}function Na(t,e,r){return e&&WL(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function yn(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=bm(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.
|
|
51
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,s=!0,o=!1;return{s:function(){r=r.call(t)},n:function(){var l=r.next();return s=l.done,l},e:function(l){o=!0,a=l},f:function(){try{s||r.return==null||r.return()}finally{if(o)throw a}}}}function US(t,e,r){return(e=WS(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function VL(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function GL(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,a,s,o=[],l=!0,u=!1;try{if(a=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=a.call(r)).done)&&(o.push(n.value),o.length!==e);l=!0);}catch(c){u=!0,i=c}finally{try{if(!l&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw i}}return o}}function qL(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
52
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function YL(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
53
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function br(t,e){return HL(t)||GL(t,e)||bm(t,e)||qL()}function _d(t){return UL(t)||VL(t)||bm(t)||YL()}function KL(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 WS(t){var e=KL(t,"string");return typeof e=="symbol"?e:e+""}function kr(t){"@babel/helpers - typeof";return kr=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},kr(t)}function bm(t,e){if(t){if(typeof t=="string")return Rv(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)?Rv(t,e):void 0}}var _r=typeof window>"u"?null:window,k1=_r?_r.navigator:null;_r&&_r.document;var XL=kr(""),VS=kr({}),QL=kr(function(){}),ZL=typeof HTMLElement>"u"?"undefined":kr(HTMLElement),su=function(e){return e&&e.instanceString&&cr(e.instanceString)?e.instanceString():null},ht=function(e){return e!=null&&kr(e)==XL},cr=function(e){return e!=null&&kr(e)===QL},Yt=function(e){return!Nn(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},Ot=function(e){return e!=null&&kr(e)===VS&&!Yt(e)&&e.constructor===Object},JL=function(e){return e!=null&&kr(e)===VS},Ke=function(e){return e!=null&&kr(e)===kr(1)&&!isNaN(e)},GS=function(e){return Ke(e)&&Math.floor(e)===e},Cd=function(e){if(ZL!=="undefined")return e!=null&&e instanceof HTMLElement},Nn=function(e){return ou(e)||qS(e)},ou=function(e){return su(e)==="collection"&&e._private.single},qS=function(e){return su(e)==="collection"&&!e._private.single},wm=function(e){return su(e)==="core"},YS=function(e){return su(e)==="stylesheet"},eD=function(e){return su(e)==="event"},xa=function(e){return e==null?!0:!!(e===""||e.match(/^\s+$/))},tD=function(e){return typeof HTMLElement>"u"?!1:e instanceof HTMLElement},rD=function(e){return Ot(e)&&Ke(e.x1)&&Ke(e.x2)&&Ke(e.y1)&&Ke(e.y2)},nD=function(e){return JL(e)&&cr(e.then)},iD=function(){return k1&&k1.userAgent.match(/msie|trident|edge/i)},bo=function(e,r){r||(r=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var a=[],s=0;s<arguments.length;s++)a.push(arguments[s]);return a.join("$")});var n=function(){var a=this,s=arguments,o,l=r.apply(a,s),u=n.cache;return(o=u[l])||(o=u[l]=e.apply(a,s)),o};return n.cache={},n},Sm=bo(function(t){return t.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),Gd=bo(function(t){return t.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),KS=bo(function(t,e){return t+e[0].toUpperCase()+e.substring(1)},function(t,e){return t+"$"+e}),E1=function(e){return xa(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},pa=function(e,r){return e.slice(-1*r.length)===r},Cr="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",aD="rgb[a]?\\(("+Cr+"[%]?)\\s*,\\s*("+Cr+"[%]?)\\s*,\\s*("+Cr+"[%]?)(?:\\s*,\\s*("+Cr+"))?\\)",sD="rgb[a]?\\((?:"+Cr+"[%]?)\\s*,\\s*(?:"+Cr+"[%]?)\\s*,\\s*(?:"+Cr+"[%]?)(?:\\s*,\\s*(?:"+Cr+"))?\\)",oD="hsl[a]?\\(("+Cr+")\\s*,\\s*("+Cr+"[%])\\s*,\\s*("+Cr+"[%])(?:\\s*,\\s*("+Cr+"))?\\)",lD="hsl[a]?\\((?:"+Cr+")\\s*,\\s*(?:"+Cr+"[%])\\s*,\\s*(?:"+Cr+"[%])(?:\\s*,\\s*(?:"+Cr+"))?\\)",uD="\\#[0-9a-fA-F]{3}",cD="\\#[0-9a-fA-F]{6}",XS=function(e,r){return e<r?-1:e>r?1:0},dD=function(e,r){return-1*XS(e,r)},mt=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),a=0;a<i.length;a++){var s=i[a];t[s]=n[s]}}return t},hD=function(e){if(!(!(e.length===4||e.length===7)||e[0]!=="#")){var r=e.length===4,n,i,a,s=16;return r?(n=parseInt(e[1]+e[1],s),i=parseInt(e[2]+e[2],s),a=parseInt(e[3]+e[3],s)):(n=parseInt(e[1]+e[2],s),i=parseInt(e[3]+e[4],s),a=parseInt(e[5]+e[6],s)),[n,i,a]}},fD=function(e){var r,n,i,a,s,o,l,u;function c(x,S,v){return v<0&&(v+=1),v>1&&(v-=1),v<1/6?x+(S-x)*6*v:v<1/2?S:v<2/3?x+(S-x)*(2/3-v)*6:x}var d=new RegExp("^"+oD+"$").exec(e);if(d){if(n=parseInt(d[1]),n<0?n=(360- -1*n%360)%360:n>360&&(n=n%360),n/=360,i=parseFloat(d[2]),i<0||i>100||(i=i/100,a=parseFloat(d[3]),a<0||a>100)||(a=a/100,s=d[4],s!==void 0&&(s=parseFloat(s),s<0||s>1)))return;if(i===0)o=l=u=Math.round(a*255);else{var p=a<.5?a*(1+i):a+i-a*i,f=2*a-p;o=Math.round(255*c(f,p,n+1/3)),l=Math.round(255*c(f,p,n)),u=Math.round(255*c(f,p,n-1/3))}r=[o,l,u,s]}return r},pD=function(e){var r,n=new RegExp("^"+aD+"$").exec(e);if(n){r=[];for(var i=[],a=1;a<=3;a++){var s=n[a];if(s[s.length-1]==="%"&&(i[a]=!0),s=parseFloat(s),i[a]&&(s=s/100*255),s<0||s>255)return;r.push(Math.floor(s))}var o=i[1]||i[2]||i[3],l=i[1]&&i[2]&&i[3];if(o&&!l)return;var u=n[4];if(u!==void 0){if(u=parseFloat(u),u<0||u>1)return;r.push(u)}}return r},gD=function(e){return vD[e.toLowerCase()]},QS=function(e){return(Yt(e)?e:null)||gD(e)||hD(e)||pD(e)||fD(e)},vD={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]},ZS=function(e){for(var r=e.map,n=e.keys,i=n.length,a=0;a<i;a++){var s=n[a];if(Ot(s))throw Error("Tried to set map with object key");a<n.length-1?(r[s]==null&&(r[s]={}),r=r[s]):r[s]=e.value}},JS=function(e){for(var r=e.map,n=e.keys,i=n.length,a=0;a<i;a++){var s=n[a];if(Ot(s))throw Error("Tried to get map with object key");if(r=r[s],r==null)return r}return r},Bc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function lu(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var _p,T1;function uu(){if(T1)return _p;T1=1;function t(e){var r=typeof e;return e!=null&&(r=="object"||r=="function")}return _p=t,_p}var Cp,N1;function mD(){if(N1)return Cp;N1=1;var t=typeof Bc=="object"&&Bc&&Bc.Object===Object&&Bc;return Cp=t,Cp}var kp,R1;function qd(){if(R1)return kp;R1=1;var t=mD(),e=typeof self=="object"&&self&&self.Object===Object&&self,r=t||e||Function("return this")();return kp=r,kp}var Ep,L1;function yD(){if(L1)return Ep;L1=1;var t=qd(),e=function(){return t.Date.now()};return Ep=e,Ep}var Tp,D1;function xD(){if(D1)return Tp;D1=1;var t=/\s/;function e(r){for(var n=r.length;n--&&t.test(r.charAt(n)););return n}return Tp=e,Tp}var Np,A1;function bD(){if(A1)return Np;A1=1;var t=xD(),e=/^\s+/;function r(n){return n&&n.slice(0,t(n)+1).replace(e,"")}return Np=r,Np}var Rp,P1;function _m(){if(P1)return Rp;P1=1;var t=qd(),e=t.Symbol;return Rp=e,Rp}var Lp,M1;function wD(){if(M1)return Lp;M1=1;var t=_m(),e=Object.prototype,r=e.hasOwnProperty,n=e.toString,i=t?t.toStringTag:void 0;function a(s){var o=r.call(s,i),l=s[i];try{s[i]=void 0;var u=!0}catch{}var c=n.call(s);return u&&(o?s[i]=l:delete s[i]),c}return Lp=a,Lp}var Dp,O1;function SD(){if(O1)return Dp;O1=1;var t=Object.prototype,e=t.toString;function r(n){return e.call(n)}return Dp=r,Dp}var Ap,j1;function e_(){if(j1)return Ap;j1=1;var t=_m(),e=wD(),r=SD(),n="[object Null]",i="[object Undefined]",a=t?t.toStringTag:void 0;function s(o){return o==null?o===void 0?i:n:a&&a in Object(o)?e(o):r(o)}return Ap=s,Ap}var Pp,I1;function _D(){if(I1)return Pp;I1=1;function t(e){return e!=null&&typeof e=="object"}return Pp=t,Pp}var Mp,B1;function cu(){if(B1)return Mp;B1=1;var t=e_(),e=_D(),r="[object Symbol]";function n(i){return typeof i=="symbol"||e(i)&&t(i)==r}return Mp=n,Mp}var Op,F1;function CD(){if(F1)return Op;F1=1;var t=bD(),e=uu(),r=cu(),n=NaN,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,s=/^0o[0-7]+$/i,o=parseInt;function l(u){if(typeof u=="number")return u;if(r(u))return n;if(e(u)){var c=typeof u.valueOf=="function"?u.valueOf():u;u=e(c)?c+"":c}if(typeof u!="string")return u===0?u:+u;u=t(u);var d=a.test(u);return d||s.test(u)?o(u.slice(2),d?2:8):i.test(u)?n:+u}return Op=l,Op}var jp,z1;function kD(){if(z1)return jp;z1=1;var t=uu(),e=yD(),r=CD(),n="Expected a function",i=Math.max,a=Math.min;function s(o,l,u){var c,d,p,f,x,S,v=0,m=!1,b=!1,w=!0;if(typeof o!="function")throw new TypeError(n);l=r(l)||0,t(u)&&(m=!!u.leading,b="maxWait"in u,p=b?i(r(u.maxWait)||0,l):p,w="trailing"in u?!!u.trailing:w);function _($){var D=c,B=d;return c=d=void 0,v=$,f=o.apply(B,D),f}function T($){return v=$,x=setTimeout(k,l),m?_($):f}function N($){var D=$-S,B=$-v,j=l-D;return b?a(j,p-B):j}function E($){var D=$-S,B=$-v;return S===void 0||D>=l||D<0||b&&B>=p}function k(){var $=e();if(E($))return L($);x=setTimeout(k,N($))}function L($){return x=void 0,w&&c?_($):(c=d=void 0,f)}function A(){x!==void 0&&clearTimeout(x),v=0,c=S=d=x=void 0}function M(){return x===void 0?f:L(e())}function O(){var $=e(),D=E($);if(c=arguments,d=this,S=$,D){if(x===void 0)return T(S);if(b)return clearTimeout(x),x=setTimeout(k,l),_(S)}return x===void 0&&(x=setTimeout(k,l)),f}return O.cancel=A,O.flush=M,O}return jp=s,jp}var ED=kD(),du=lu(ED),Ip=_r?_r.performance:null,t_=Ip&&Ip.now?function(){return Ip.now()}:function(){return Date.now()},TD=(function(){if(_r){if(_r.requestAnimationFrame)return function(t){_r.requestAnimationFrame(t)};if(_r.mozRequestAnimationFrame)return function(t){_r.mozRequestAnimationFrame(t)};if(_r.webkitRequestAnimationFrame)return function(t){_r.webkitRequestAnimationFrame(t)};if(_r.msRequestAnimationFrame)return function(t){_r.msRequestAnimationFrame(t)}}return function(t){t&&setTimeout(function(){t(t_())},1e3/60)}})(),kd=function(e){return TD(e)},Bi=t_,as=9261,r_=65599,so=5381,n_=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:as,n=r,i;i=e.next(),!i.done;)n=n*r_+i.value|0;return n},ql=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:as;return r*r_+e|0},Yl=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:so;return(r<<5)+r+e|0},ND=function(e,r){return e*2097152+r},ca=function(e){return e[0]*2097152+e[1]},Fc=function(e,r){return[ql(e[0],r[0]),Yl(e[1],r[1])]},$1=function(e,r){var n={value:0,done:!1},i=0,a=e.length,s={next:function(){return i<a?n.value=e[i++]:n.done=!0,n}};return n_(s,r)},ds=function(e,r){var n={value:0,done:!1},i=0,a=e.length,s={next:function(){return i<a?n.value=e.charCodeAt(i++):n.done=!0,n}};return n_(s,r)},i_=function(){return RD(arguments)},RD=function(e){for(var r,n=0;n<e.length;n++){var i=e[n];n===0?r=ds(i):r=ds(i,r)}return r};function LD(t,e,r,n,i){var a=i*Math.PI/180,s=Math.cos(a)*(t-r)-Math.sin(a)*(e-n)+r,o=Math.sin(a)*(t-r)+Math.cos(a)*(e-n)+n;return{x:s,y:o}}var DD=function(e,r,n,i,a,s){return{x:(e-n)*a+n,y:(r-i)*s+i}};function AD(t,e,r){if(r===0)return t;var n=(e.x1+e.x2)/2,i=(e.y1+e.y2)/2,a=e.w/e.h,s=1/a,o=LD(t.x,t.y,n,i,r),l=DD(o.x,o.y,n,i,a,s);return{x:l.x,y:l.y}}var H1=!0,PD=console.warn!=null,MD=console.trace!=null,Cm=Number.MAX_SAFE_INTEGER||9007199254740991,a_=function(){return!0},Ed=function(){return!1},U1=function(){return 0},km=function(){},sr=function(e){throw new Error(e)},s_=function(e){if(e!==void 0)H1=!!e;else return H1},Ht=function(e){s_()&&(PD?console.warn(e):(console.log(e),MD&&console.trace()))},OD=function(e){return mt({},e)},bi=function(e){return e==null?e:Yt(e)?e.slice():Ot(e)?OD(e):e},jD=function(e){return e.slice()},o_=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},ID={},l_=function(){return ID},zr=function(e){var r=Object.keys(e);return function(n){for(var i={},a=0;a<r.length;a++){var s=r[a],o=n==null?void 0:n[s];i[s]=o===void 0?e[s]:o}return i}},ba=function(e,r,n){for(var i=e.length-1;i>=0;i--)e[i]===r&&e.splice(i,1)},Em=function(e){e.splice(0,e.length)},BD=function(e,r){for(var n=0;n<r.length;n++){var i=r[n];e.push(i)}},rn=function(e,r,n){return n&&(r=KS(n,r)),e[r]},xi=function(e,r,n,i){n&&(r=KS(n,r)),e[r]=i},FD=(function(){function t(){Ta(this,t),this._obj={}}return Na(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]}}])})(),Ii=typeof Map<"u"?Map:FD,zD="undefined",$D=(function(){function t(e){if(Ta(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 Na(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)}}])})(),Eo=(typeof Set>"u"?"undefined":kr(Set))!==zD?Set:$D,Yd=function(e,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||r===void 0||!wm(e)){sr("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"){sr("An element must be of type `nodes` or `edges`; you specified `"+i+"`");return}this.length=1,this[0]=this;var a=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 Eo,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(a.position.x==null&&(a.position.x=0),a.position.y==null&&(a.position.y=0),r.renderedPosition){var s=r.renderedPosition,o=e.pan(),l=e.zoom();a.position={x:(s.x-o.x)/l,y:(s.y-o.y)/l}}var u=[];Yt(r.classes)?u=r.classes:ht(r.classes)&&(u=r.classes.split(/\s+/));for(var c=0,d=u.length;c<d;c++){var p=u[c];!p||p===""||a.classes.add(p)}this.createEmitter(),(n===void 0||n)&&this.restore();var f=r.style||r.css;f&&(Ht("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(f))},W1=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(n,i,a){var s;Ot(n)&&!Nn(n)&&(s=n,n=s.roots||s.root,i=s.visit,a=s.directed),a=arguments.length===2&&!cr(i)?i:a,i=cr(i)?i:function(){};for(var o=this._private.cy,l=n=ht(n)?this.filter(n):n,u=[],c=[],d={},p={},f={},x=0,S,v=this.byGroup(),m=v.nodes,b=v.edges,w=0;w<l.length;w++){var _=l[w],T=_.id();_.isNode()&&(u.unshift(_),e.bfs&&(f[T]=!0,c.push(_)),p[T]=0)}for(var N=function(){var $=e.bfs?u.shift():u.pop(),D=$.id();if(e.dfs){if(f[D])return 0;f[D]=!0,c.push($)}var B=p[D],j=d[D],I=j!=null?j.source():null,U=j!=null?j.target():null,F=j==null?void 0:$.same(I)?U[0]:I[0],P;if(P=i($,j,F,x++,B),P===!0)return S=$,1;if(P===!1)return 1;for(var H=$.connectedEdges().filter(function(ne){return(!a||ne.source().same($))&&b.has(ne)}),W=0;W<H.length;W++){var V=H[W],re=V.connectedNodes().filter(function(ne){return!ne.same($)&&m.has(ne)}),J=re.id();re.length!==0&&!f[J]&&(re=re[0],u.push(re),e.bfs&&(f[J]=!0,c.push(re)),d[J]=V,p[J]=p[D]+1)}},E;u.length!==0&&(E=N(),!(E!==0&&E===1)););for(var k=o.collection(),L=0;L<c.length;L++){var A=c[L],M=d[A.id()];M!=null&&k.push(M),k.push(A)}return{path:o.collection(k),found:o.collection(S)}}},Kl={breadthFirstSearch:W1({bfs:!0}),depthFirstSearch:W1({dfs:!0})};Kl.bfs=Kl.breadthFirstSearch;Kl.dfs=Kl.depthFirstSearch;var id={exports:{}},HD=id.exports,V1;function UD(){return V1||(V1=1,(function(t,e){(function(){var r,n,i,a,s,o,l,u,c,d,p,f,x,S,v;i=Math.floor,d=Math.min,n=function(m,b){return m<b?-1:m>b?1:0},c=function(m,b,w,_,T){var N;if(w==null&&(w=0),T==null&&(T=n),w<0)throw new Error("lo must be non-negative");for(_==null&&(_=m.length);w<_;)N=i((w+_)/2),T(b,m[N])<0?_=N:w=N+1;return[].splice.apply(m,[w,w-w].concat(b)),b},o=function(m,b,w){return w==null&&(w=n),m.push(b),S(m,0,m.length-1,w)},s=function(m,b){var w,_;return b==null&&(b=n),w=m.pop(),m.length?(_=m[0],m[0]=w,v(m,0,b)):_=w,_},u=function(m,b,w){var _;return w==null&&(w=n),_=m[0],m[0]=b,v(m,0,w),_},l=function(m,b,w){var _;return w==null&&(w=n),m.length&&w(m[0],b)<0&&(_=[m[0],b],b=_[0],m[0]=_[1],v(m,0,w)),b},a=function(m,b){var w,_,T,N,E,k;for(b==null&&(b=n),N=(function(){k=[];for(var L=0,A=i(m.length/2);0<=A?L<A:L>A;0<=A?L++:L--)k.push(L);return k}).apply(this).reverse(),E=[],_=0,T=N.length;_<T;_++)w=N[_],E.push(v(m,w,b));return E},x=function(m,b,w){var _;if(w==null&&(w=n),_=m.indexOf(b),_!==-1)return S(m,0,_,w),v(m,_,w)},p=function(m,b,w){var _,T,N,E,k;if(w==null&&(w=n),T=m.slice(0,b),!T.length)return T;for(a(T,w),k=m.slice(b),N=0,E=k.length;N<E;N++)_=k[N],l(T,_,w);return T.sort(w).reverse()},f=function(m,b,w){var _,T,N,E,k,L,A,M,O;if(w==null&&(w=n),b*10<=m.length){if(N=m.slice(0,b).sort(w),!N.length)return N;for(T=N[N.length-1],A=m.slice(b),E=0,L=A.length;E<L;E++)_=A[E],w(_,T)<0&&(c(N,_,0,null,w),N.pop(),T=N[N.length-1]);return N}for(a(m,w),O=[],k=0,M=d(b,m.length);0<=M?k<M:k>M;0<=M?++k:--k)O.push(s(m,w));return O},S=function(m,b,w,_){var T,N,E;for(_==null&&(_=n),T=m[w];w>b;){if(E=w-1>>1,N=m[E],_(T,N)<0){m[w]=N,w=E;continue}break}return m[w]=T},v=function(m,b,w){var _,T,N,E,k;for(w==null&&(w=n),T=m.length,k=b,N=m[b],_=2*b+1;_<T;)E=_+1,E<T&&!(w(m[_],m[E])<0)&&(_=E),m[b]=m[_],b=_,_=2*b+1;return m[b]=N,S(m,k,b,w)},r=(function(){m.push=o,m.pop=s,m.replace=u,m.pushpop=l,m.heapify=a,m.updateItem=x,m.nlargest=p,m.nsmallest=f;function m(b){this.cmp=b??n,this.nodes=[]}return m.prototype.push=function(b){return o(this.nodes,b,this.cmp)},m.prototype.pop=function(){return s(this.nodes,this.cmp)},m.prototype.peek=function(){return this.nodes[0]},m.prototype.contains=function(b){return this.nodes.indexOf(b)!==-1},m.prototype.replace=function(b){return u(this.nodes,b,this.cmp)},m.prototype.pushpop=function(b){return l(this.nodes,b,this.cmp)},m.prototype.heapify=function(){return a(this.nodes,this.cmp)},m.prototype.updateItem=function(b){return x(this.nodes,b,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 b;return b=new m,b.nodes=this.nodes.slice(0),b},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,b){return t.exports=b()})(this,function(){return r})}).call(HD)})(id)),id.exports}var Bp,G1;function WD(){return G1||(G1=1,Bp=UD()),Bp}var VD=WD(),hu=lu(VD),GD=zr({root:null,weight:function(e){return 1},directed:!1}),qD={dijkstra:function(e){if(!Ot(e)){var r=arguments;e={root:r[0],weight:r[1],directed:r[2]}}var n=GD(e),i=n.root,a=n.weight,s=n.directed,o=this,l=a,u=ht(i)?this.filter(i)[0]:i[0],c={},d={},p={},f=this.byGroup(),x=f.nodes,S=f.edges;S.unmergeBy(function(B){return B.isLoop()});for(var v=function(j){return c[j.id()]},m=function(j,I){c[j.id()]=I,b.updateItem(j)},b=new hu(function(B,j){return v(B)-v(j)}),w=0;w<x.length;w++){var _=x[w];c[_.id()]=_.same(u)?0:1/0,b.push(_)}for(var T=function(j,I){for(var U=(s?j.edgesTo(I):j.edgesWith(I)).intersect(S),F=1/0,P,H=0;H<U.length;H++){var W=U[H],V=l(W);(V<F||!P)&&(F=V,P=W)}return{edge:P,dist:F}};b.size()>0;){var N=b.pop(),E=v(N),k=N.id();if(p[k]=E,E!==1/0)for(var L=N.neighborhood().intersect(x),A=0;A<L.length;A++){var M=L[A],O=M.id(),$=T(N,M),D=E+$.dist;D<v(M)&&(m(M,D),d[O]={node:N,edge:$.edge})}}return{distanceTo:function(j){var I=ht(j)?x.filter(j)[0]:j[0];return p[I.id()]},pathTo:function(j){var I=ht(j)?x.filter(j)[0]:j[0],U=[],F=I,P=F.id();if(I.length>0)for(U.unshift(I);d[P];){var H=d[P];U.unshift(H.edge),U.unshift(H.node),F=H.node,P=F.id()}return o.spawn(U)}}}},YD={kruskal:function(e){e=e||function(w){return 1};for(var r=this.byGroup(),n=r.nodes,i=r.edges,a=n.length,s=new Array(a),o=n,l=function(_){for(var T=0;T<s.length;T++){var N=s[T];if(N.has(_))return T}},u=0;u<a;u++)s[u]=this.spawn(n[u]);for(var c=i.sort(function(w,_){return e(w)-e(_)}),d=0;d<c.length;d++){var p=c[d],f=p.source()[0],x=p.target()[0],S=l(f),v=l(x),m=s[S],b=s[v];S!==v&&(o.merge(p),m.merge(b),s.splice(v,1))}return o}},KD=zr({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),XD={aStar:function(e){var r=this.cy(),n=KD(e),i=n.root,a=n.goal,s=n.heuristic,o=n.directed,l=n.weight;i=r.collection(i)[0],a=r.collection(a)[0];var u=i.id(),c=a.id(),d={},p={},f={},x=new hu(function(P,H){return p[P.id()]-p[H.id()]}),S=new Eo,v={},m={},b=function(H,W){x.push(H),S.add(W)},w,_,T=function(){w=x.pop(),_=w.id(),S.delete(_)},N=function(H){return S.has(H)};b(i,u),d[u]=0,p[u]=s(i);for(var E=0;x.size()>0;){if(T(),E++,_===c){for(var k=[],L=a,A=c,M=m[A];k.unshift(L),M!=null&&k.unshift(M),L=v[A],L!=null;)A=L.id(),M=m[A];return{found:!0,distance:d[_],path:this.spawn(k),steps:E}}f[_]=!0;for(var O=w._private.edges,$=0;$<O.length;$++){var D=O[$];if(this.hasElementWithId(D.id())&&!(o&&D.data("source")!==_)){var B=D.source(),j=D.target(),I=B.id()!==_?B:j,U=I.id();if(this.hasElementWithId(U)&&!f[U]){var F=d[_]+l(D);if(!N(U)){d[U]=F,p[U]=F+s(I),b(I,U),v[U]=w,m[U]=D;continue}F<d[U]&&(d[U]=F,p[U]=F+s(I),x.updateItem(I),v[U]=w,m[U]=D)}}}}return{found:!1,distance:void 0,path:void 0,steps:E}}},QD=zr({weight:function(e){return 1},directed:!1}),ZD={floydWarshall:function(e){for(var r=this.cy(),n=QD(e),i=n.weight,a=n.directed,s=i,o=this.byGroup(),l=o.nodes,u=o.edges,c=l.length,d=c*c,p=function(V){return l.indexOf(V)},f=function(V){return l[V]},x=new Array(d),S=0;S<d;S++){var v=S%c,m=(S-v)/c;m===v?x[S]=0:x[S]=1/0}for(var b=new Array(d),w=new Array(d),_=0;_<u.length;_++){var T=u[_],N=T.source()[0],E=T.target()[0];if(N!==E){var k=p(N),L=p(E),A=k*c+L,M=s(T);if(x[A]>M&&(x[A]=M,b[A]=L,w[A]=T),!a){var O=L*c+k;!a&&x[O]>M&&(x[O]=M,b[O]=k,w[O]=T)}}}for(var $=0;$<c;$++)for(var D=0;D<c;D++)for(var B=D*c+$,j=0;j<c;j++){var I=D*c+j,U=$*c+j;x[B]+x[U]<x[I]&&(x[I]=x[B]+x[U],b[I]=b[B])}var F=function(V){return(ht(V)?r.filter(V):V)[0]},P=function(V){return p(F(V))},H={distance:function(V,re){var J=P(V),ne=P(re);return x[J*c+ne]},path:function(V,re){var J=P(V),ne=P(re),X=f(J);if(J===ne)return X.collection();if(b[J*c+ne]==null)return r.collection();var q=r.collection(),Y=J,Q;for(q.merge(X);J!==ne;)Y=J,J=b[J*c+ne],Q=w[Y*c+J],q.merge(Q),q.merge(f(J));return q}};return H}},JD=zr({weight:function(e){return 1},directed:!1,root:null}),eA={bellmanFord:function(e){var r=this,n=JD(e),i=n.weight,a=n.directed,s=n.root,o=i,l=this,u=this.cy(),c=this.byGroup(),d=c.edges,p=c.nodes,f=p.length,x=new Ii,S=!1,v=[];s=u.collection(s)[0],d.unmergeBy(function(Se){return Se.isLoop()});for(var m=d.length,b=function(Te){var Ae=x.get(Te.id());return Ae||(Ae={},x.set(Te.id(),Ae)),Ae},w=function(Te){return(ht(Te)?u.$(Te):Te)[0]},_=function(Te){return b(w(Te)).dist},T=function(Te){for(var Ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:s,Ne=w(Te),Pe=[],ze=Ne;;){if(ze==null)return r.spawn();var Ie=b(ze),$e=Ie.edge,Ge=Ie.pred;if(Pe.unshift(ze[0]),ze.same(Ae)&&Pe.length>0)break;$e!=null&&Pe.unshift($e),ze=Ge}return l.spawn(Pe)},N=0;N<f;N++){var E=p[N],k=b(E);E.same(s)?k.dist=0:k.dist=1/0,k.pred=null,k.edge=null}for(var L=!1,A=function(Te,Ae,Ne,Pe,ze,Ie){var $e=Pe.dist+Ie;$e<ze.dist&&!Ne.same(Pe.edge)&&(ze.dist=$e,ze.pred=Te,ze.edge=Ne,L=!0)},M=1;M<f;M++){L=!1;for(var O=0;O<m;O++){var $=d[O],D=$.source(),B=$.target(),j=o($),I=b(D),U=b(B);A(D,B,$,I,U,j),a||A(B,D,$,U,I,j)}if(!L)break}if(L)for(var F=[],P=0;P<m;P++){var H=d[P],W=H.source(),V=H.target(),re=o(H),J=b(W).dist,ne=b(V).dist;if(J+re<ne||!a&&ne+re<J)if(S||(Ht("Graph contains a negative weight cycle for Bellman-Ford"),S=!0),e.findNegativeWeightCycles!==!1){var X=[];J+re<ne&&X.push(W),!a&&ne+re<J&&X.push(V);for(var q=X.length,Y=0;Y<q;Y++){var Q=X[Y],te=[Q];te.push(b(Q).edge);for(var ie=b(Q).pred;te.indexOf(ie)===-1;)te.push(ie),te.push(b(ie).edge),ie=b(ie).pred;te=te.slice(te.indexOf(ie));for(var le=te[0].id(),pe=0,Le=2;Le<te.length;Le+=2)te[Le].id()<le&&(le=te[Le].id(),pe=Le);te=te.slice(pe).concat(te.slice(0,pe)),te.push(te[0]);var je=te.map(function(Se){return Se.id()}).join(",");F.indexOf(je)===-1&&(v.push(l.spawn(te)),F.push(je))}}else break}return{distanceTo:_,pathTo:T,hasNegativeWeightCycle:S,negativeWeightCycles:v}}},tA=Math.sqrt(2),rA=function(e,r,n){n.length===0&&sr("Karger-Stein must be run on a connected (sub)graph");for(var i=n[e],a=i[1],s=i[2],o=r[a],l=r[s],u=n,c=u.length-1;c>=0;c--){var d=u[c],p=d[1],f=d[2];(r[p]===o&&r[f]===l||r[p]===l&&r[f]===o)&&u.splice(c,1)}for(var x=0;x<u.length;x++){var S=u[x];S[1]===l?(u[x]=S.slice(),u[x][1]=o):S[2]===l&&(u[x]=S.slice(),u[x][2]=o)}for(var v=0;v<r.length;v++)r[v]===l&&(r[v]=o);return u},Fp=function(e,r,n,i){for(;n>i;){var a=Math.floor(Math.random()*r.length);r=rA(a,e,r),n--}return r},nA={kargerStein:function(){var e=this,r=this.byGroup(),n=r.nodes,i=r.edges;i.unmergeBy(function(U){return U.isLoop()});var a=n.length,s=i.length,o=Math.ceil(Math.pow(Math.log(a)/Math.LN2,2)),l=Math.floor(a/tA);if(a<2){sr("At least 2 nodes are required for Karger-Stein algorithm");return}for(var u=[],c=0;c<s;c++){var d=i[c];u.push([c,n.indexOf(d.source()),n.indexOf(d.target())])}for(var p=1/0,f=[],x=new Array(a),S=new Array(a),v=new Array(a),m=function(F,P){for(var H=0;H<a;H++)P[H]=F[H]},b=0;b<=o;b++){for(var w=0;w<a;w++)S[w]=w;var _=Fp(S,u.slice(),a,l),T=_.slice();m(S,v);var N=Fp(S,_,l,2),E=Fp(v,T,l,2);N.length<=E.length&&N.length<p?(p=N.length,f=N,m(S,x)):E.length<=N.length&&E.length<p&&(p=E.length,f=E,m(v,x))}for(var k=this.spawn(f.map(function(U){return i[U[0]]})),L=this.spawn(),A=this.spawn(),M=x[0],O=0;O<x.length;O++){var $=x[O],D=n[O];$===M?L.merge(D):A.merge(D)}var B=function(F){var P=e.spawn();return F.forEach(function(H){P.merge(H),H.connectedEdges().forEach(function(W){e.contains(W)&&!k.contains(W)&&P.merge(W)})}),P},j=[B(L),B(A)],I={cut:k,components:j,partition1:L,partition2:A};return I}},zp,iA=function(e){return{x:e.x,y:e.y}},Kd=function(e,r,n){return{x:e.x*r+n.x,y:e.y*r+n.y}},u_=function(e,r,n){return{x:(e.x-n.x)/r,y:(e.y-n.y)/r}},lo=function(e){return{x:e[0],y:e[1]}},aA=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,a=r;a<n;a++){var s=e[a];isFinite(s)&&(i=Math.min(s,i))}return i},sA=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,a=r;a<n;a++){var s=e[a];isFinite(s)&&(i=Math.max(s,i))}return i},oA=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,a=0,s=r;s<n;s++){var o=e[s];isFinite(o)&&(i+=o,a++)}return i/a},lA=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,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;i?e=e.slice(r,n):(n<e.length&&e.splice(n,e.length-n),r>0&&e.splice(0,r));for(var o=0,l=e.length-1;l>=0;l--){var u=e[l];s?isFinite(u)||(e[l]=-1/0,o++):e.splice(l,1)}a&&e.sort(function(p,f){return p-f});var c=e.length,d=Math.floor(c/2);return c%2!==0?e[d+1+o]:(e[d-1+o]+e[d+o])/2},c_=function(e,r){return r===0?e:c_(r,e%r)},uA=function(e){for(var r=e[0],n=0;n<e.length;n++)if(GS(e[n]))n>0&&(r=c_(r,e[n]));else return 0;return r},cA=function(e){return Math.PI*e/180},zc=function(e,r){return Math.atan2(r,e)-Math.PI/2},Tm=Math.log2||function(t){return Math.log(t)/Math.log(2)},Nm=function(e){return e>0?1:e<0?-1:0},hs=function(e,r){return Math.sqrt(rs(e,r))},rs=function(e,r){var n=r.x-e.x,i=r.y-e.y;return n*n+i*i},dA=function(e){for(var r=e.length,n=0,i=0;i<r;i++)n+=e[i];for(var a=0;a<r;a++)e[a]=e[a]/n;return e},Dr=function(e,r,n,i){return(1-i)*(1-i)*e+2*(1-i)*i*r+i*i*n},vo=function(e,r,n,i){return{x:Dr(e.x,r.x,n.x,i),y:Dr(e.y,r.y,n.y,i)}},hA=function(e,r,n,i){var a={x:r.x-e.x,y:r.y-e.y},s=hs(e,r),o={x:a.x/s,y:a.y/s};return n=n??0,i=i??n*s,{x:e.x+o.x*i,y:e.y+o.y*i}},Xl=function(e,r,n){return Math.max(e,Math.min(n,r))},sn=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}}},fA=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},pA=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},gA=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},d_=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},ad=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},sd=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],n,i,a,s;if(r.length===1)n=i=a=s=r[0];else if(r.length===2)n=a=r[0],s=i=r[1];else if(r.length===4){var o=br(r,4);n=o[0],i=o[1],a=o[2],s=o[3]}return e.x1-=s,e.x2+=i,e.y1-=n,e.y2+=a,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},q1=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},Rm=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)},ga=function(e,r,n){return e.x1<=r&&r<=e.x2&&e.y1<=n&&n<=e.y2},Y1=function(e,r){return ga(e,r.x,r.y)},h_=function(e,r){return ga(e,r.x1,r.y1)&&ga(e,r.x2,r.y2)},vA=(zp=Math.hypot)!==null&&zp!==void 0?zp:function(t,e){return Math.sqrt(t*t+e*e)};function mA(t,e){if(t.length<3)throw new Error("Need at least 3 vertices");var r=function(k,L){return{x:k.x+L.x,y:k.y+L.y}},n=function(k,L){return{x:k.x-L.x,y:k.y-L.y}},i=function(k,L){return{x:k.x*L,y:k.y*L}},a=function(k,L){return k.x*L.y-k.y*L.x},s=function(k){var L=vA(k.x,k.y);return L===0?{x:0,y:0}:{x:k.x/L,y:k.y/L}},o=function(k){for(var L=0,A=0;A<k.length;A++){var M=k[A],O=k[(A+1)%k.length];L+=M.x*O.y-O.x*M.y}return L/2},l=function(k,L,A,M){var O=n(L,k),$=n(M,A),D=a(O,$);if(Math.abs(D)<1e-9)return r(k,i(O,.5));var B=a(n(A,k),$)/D;return r(k,i(O,B))},u=t.map(function(E){return{x:E.x,y:E.y}});o(u)<0&&u.reverse();for(var c=u.length,d=[],p=0;p<c;p++){var f=u[p],x=u[(p+1)%c],S=n(x,f),v=s({x:S.y,y:-S.x});d.push(v)}for(var m=d.map(function(E,k){var L=r(u[k],i(E,e)),A=r(u[(k+1)%c],i(E,e));return{p1:L,p2:A}}),b=[],w=0;w<c;w++){var _=m[(w-1+c)%c],T=m[w],N=l(_.p1,_.p2,T.p1,T.p2);b.push(N)}return b}function yA(t,e,r,n,i,a){var s=TA(t,e,r,n,i),o=mA(s,a),l=sn();return o.forEach(function(u){return d_(l,u.x,u.y)}),l}var f_=function(e,r,n,i,a,s,o){var l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:"auto",u=l==="auto"?wa(a,s):l,c=a/2,d=s/2;u=Math.min(u,c,d);var p=u!==c,f=u!==d,x;if(p){var S=n-c+u-o,v=i-d-o,m=n+c-u+o,b=v;if(x=va(e,r,n,i,S,v,m,b,!1),x.length>0)return x}if(f){var w=n+c+o,_=i-d+u-o,T=w,N=i+d-u+o;if(x=va(e,r,n,i,w,_,T,N,!1),x.length>0)return x}if(p){var E=n-c+u-o,k=i+d+o,L=n+c-u+o,A=k;if(x=va(e,r,n,i,E,k,L,A,!1),x.length>0)return x}if(f){var M=n-c-o,O=i-d+u-o,$=M,D=i+d-u+o;if(x=va(e,r,n,i,M,O,$,D,!1),x.length>0)return x}var B;{var j=n-c+u,I=i-d+u;if(B=Ml(e,r,n,i,j,I,u+o),B.length>0&&B[0]<=j&&B[1]<=I)return[B[0],B[1]]}{var U=n+c-u,F=i-d+u;if(B=Ml(e,r,n,i,U,F,u+o),B.length>0&&B[0]>=U&&B[1]<=F)return[B[0],B[1]]}{var P=n+c-u,H=i+d-u;if(B=Ml(e,r,n,i,P,H,u+o),B.length>0&&B[0]>=P&&B[1]>=H)return[B[0],B[1]]}{var W=n-c+u,V=i+d-u;if(B=Ml(e,r,n,i,W,V,u+o),B.length>0&&B[0]<=W&&B[1]>=V)return[B[0],B[1]]}return[]},xA=function(e,r,n,i,a,s,o){var l=o,u=Math.min(n,a),c=Math.max(n,a),d=Math.min(i,s),p=Math.max(i,s);return u-l<=e&&e<=c+l&&d-l<=r&&r<=p+l},bA=function(e,r,n,i,a,s,o,l,u){var c={x1:Math.min(n,o,a)-u,x2:Math.max(n,o,a)+u,y1:Math.min(i,l,s)-u,y2:Math.max(i,l,s)+u};return!(e<c.x1||e>c.x2||r<c.y1||r>c.y2)},wA=function(e,r,n,i){n-=i;var a=r*r-4*e*n;if(a<0)return[];var s=Math.sqrt(a),o=2*e,l=(-r+s)/o,u=(-r-s)/o;return[l,u]},SA=function(e,r,n,i,a){var s=1e-5;e===0&&(e=s),r/=e,n/=e,i/=e;var o,l,u,c,d,p,f,x;if(l=(3*n-r*r)/9,u=-(27*i)+r*(9*n-2*(r*r)),u/=54,o=l*l*l+u*u,a[1]=0,f=r/3,o>0){d=u+Math.sqrt(o),d=d<0?-Math.pow(-d,1/3):Math.pow(d,1/3),p=u-Math.sqrt(o),p=p<0?-Math.pow(-p,1/3):Math.pow(p,1/3),a[0]=-f+d+p,f+=(d+p)/2,a[4]=a[2]=-f,f=Math.sqrt(3)*(-p+d)/2,a[3]=f,a[5]=-f;return}if(a[5]=a[3]=0,o===0){x=u<0?-Math.pow(-u,1/3):Math.pow(u,1/3),a[0]=-f+2*x,a[4]=a[2]=-(x+f);return}l=-l,c=l*l*l,c=Math.acos(u/Math.sqrt(c)),x=2*Math.sqrt(l),a[0]=-f+x*Math.cos(c/3),a[2]=-f+x*Math.cos((c+2*Math.PI)/3),a[4]=-f+x*Math.cos((c+4*Math.PI)/3)},_A=function(e,r,n,i,a,s,o,l){var u=1*n*n-4*n*a+2*n*o+4*a*a-4*a*o+o*o+i*i-4*i*s+2*i*l+4*s*s-4*s*l+l*l,c=9*n*a-3*n*n-3*n*o-6*a*a+3*a*o+9*i*s-3*i*i-3*i*l-6*s*s+3*s*l,d=3*n*n-6*n*a+n*o-n*e+2*a*a+2*a*e-o*e+3*i*i-6*i*s+i*l-i*r+2*s*s+2*s*r-l*r,p=1*n*a-n*n+n*e-a*e+i*s-i*i+i*r-s*r,f=[];SA(u,c,d,p,f);for(var x=1e-7,S=[],v=0;v<6;v+=2)Math.abs(f[v+1])<x&&f[v]>=0&&f[v]<=1&&S.push(f[v]);S.push(1),S.push(0);for(var m=-1,b,w,_,T=0;T<S.length;T++)b=Math.pow(1-S[T],2)*n+2*(1-S[T])*S[T]*a+S[T]*S[T]*o,w=Math.pow(1-S[T],2)*i+2*(1-S[T])*S[T]*s+S[T]*S[T]*l,_=Math.pow(b-e,2)+Math.pow(w-r,2),m>=0?_<m&&(m=_):m=_;return m},CA=function(e,r,n,i,a,s){var o=[e-n,r-i],l=[a-n,s-i],u=l[0]*l[0]+l[1]*l[1],c=o[0]*o[0]+o[1]*o[1],d=o[0]*l[0]+o[1]*l[1],p=d*d/u;return d<0?c:p>u?(e-a)*(e-a)+(r-s)*(r-s):c-p},mn=function(e,r,n){for(var i,a,s,o,l,u=0,c=0;c<n.length/2;c++)if(i=n[c*2],a=n[c*2+1],c+1<n.length/2?(s=n[(c+1)*2],o=n[(c+1)*2+1]):(s=n[(c+1-n.length/2)*2],o=n[(c+1-n.length/2)*2+1]),!(i==e&&s==e))if(i>=e&&e>=s||i<=e&&e<=s)l=(e-i)/(s-i)*(o-a)+a,l>r&&u++;else continue;return u%2!==0},Fi=function(e,r,n,i,a,s,o,l,u){var c=new Array(n.length),d;l[0]!=null?(d=Math.atan(l[1]/l[0]),l[0]<0?d=d+Math.PI/2:d=-d-Math.PI/2):d=l;for(var p=Math.cos(-d),f=Math.sin(-d),x=0;x<c.length/2;x++)c[x*2]=s/2*(n[x*2]*p-n[x*2+1]*f),c[x*2+1]=o/2*(n[x*2+1]*p+n[x*2]*f),c[x*2]+=i,c[x*2+1]+=a;var S;if(u>0){var v=Nd(c,-u);S=Td(v)}else S=c;return mn(e,r,S)},kA=function(e,r,n,i,a,s,o,l){for(var u=new Array(n.length*2),c=0;c<l.length;c++){var d=l[c];u[c*4+0]=d.startX,u[c*4+1]=d.startY,u[c*4+2]=d.stopX,u[c*4+3]=d.stopY;var p=Math.pow(d.cx-e,2)+Math.pow(d.cy-r,2);if(p<=Math.pow(d.radius,2))return!0}return mn(e,r,u)},Td=function(e){for(var r=new Array(e.length/2),n,i,a,s,o,l,u,c,d=0;d<e.length/4;d++){n=e[d*4],i=e[d*4+1],a=e[d*4+2],s=e[d*4+3],d<e.length/4-1?(o=e[(d+1)*4],l=e[(d+1)*4+1],u=e[(d+1)*4+2],c=e[(d+1)*4+3]):(o=e[0],l=e[1],u=e[2],c=e[3]);var p=va(n,i,a,s,o,l,u,c,!0);r[d*2]=p[0],r[d*2+1]=p[1]}return r},Nd=function(e,r){for(var n=new Array(e.length*2),i,a,s,o,l=0;l<e.length/2;l++){i=e[l*2],a=e[l*2+1],l<e.length/2-1?(s=e[(l+1)*2],o=e[(l+1)*2+1]):(s=e[0],o=e[1]);var u=o-a,c=-(s-i),d=Math.sqrt(u*u+c*c),p=u/d,f=c/d;n[l*4]=i+p*r,n[l*4+1]=a+f*r,n[l*4+2]=s+p*r,n[l*4+3]=o+f*r}return n},EA=function(e,r,n,i,a,s){var o=n-e,l=i-r;o/=a,l/=s;var u=Math.sqrt(o*o+l*l),c=u-1;if(c<0)return[];var d=c/u;return[(n-e)*d+e,(i-r)*d+r]},ls=function(e,r,n,i,a,s,o){return e-=a,r-=s,e/=n/2+o,r/=i/2+o,e*e+r*r<=1},Ml=function(e,r,n,i,a,s,o){var l=[n-e,i-r],u=[e-a,r-s],c=l[0]*l[0]+l[1]*l[1],d=2*(u[0]*l[0]+u[1]*l[1]),p=u[0]*u[0]+u[1]*u[1]-o*o,f=d*d-4*c*p;if(f<0)return[];var x=(-d+Math.sqrt(f))/(2*c),S=(-d-Math.sqrt(f))/(2*c),v=Math.min(x,S),m=Math.max(x,S),b=[];if(v>=0&&v<=1&&b.push(v),m>=0&&m<=1&&b.push(m),b.length===0)return[];var w=b[0]*l[0]+e,_=b[0]*l[1]+r;if(b.length>1){if(b[0]==b[1])return[w,_];var T=b[1]*l[0]+e,N=b[1]*l[1]+r;return[w,_,T,N]}else return[w,_]},$p=function(e,r,n){return r<=e&&e<=n||n<=e&&e<=r?e:e<=r&&r<=n||n<=r&&r<=e?r:n},va=function(e,r,n,i,a,s,o,l,u){var c=e-a,d=n-e,p=o-a,f=r-s,x=i-r,S=l-s,v=p*f-S*c,m=d*f-x*c,b=S*d-p*x;if(b!==0){var w=v/b,_=m/b,T=.001,N=0-T,E=1+T;return N<=w&&w<=E&&N<=_&&_<=E?[e+w*d,r+w*x]:u?[e+w*d,r+w*x]:[]}else return v===0||m===0?$p(e,n,o)===o?[o,l]:$p(e,n,a)===a?[a,s]:$p(a,o,n)===n?[n,i]:[]:[]},TA=function(e,r,n,i,a){var s=[],o=i/2,l=a/2,u=r,c=n;s.push({x:u+o*e[0],y:c+l*e[1]});for(var d=1;d<e.length/2;d++)s.push({x:u+o*e[d*2],y:c+l*e[d*2+1]});return s},Ql=function(e,r,n,i,a,s,o,l){var u=[],c,d=new Array(n.length),p=!0;s==null&&(p=!1);var f;if(p){for(var x=0;x<d.length/2;x++)d[x*2]=n[x*2]*s+i,d[x*2+1]=n[x*2+1]*o+a;if(l>0){var S=Nd(d,-l);f=Td(S)}else f=d}else f=n;for(var v,m,b,w,_=0;_<f.length/2;_++)v=f[_*2],m=f[_*2+1],_<f.length/2-1?(b=f[(_+1)*2],w=f[(_+1)*2+1]):(b=f[0],w=f[1]),c=va(e,r,i,a,v,m,b,w),c.length!==0&&u.push(c[0],c[1]);return u},NA=function(e,r,n,i,a,s,o,l,u){var c=[],d,p=new Array(n.length*2);u.forEach(function(b,w){w===0?(p[p.length-2]=b.startX,p[p.length-1]=b.startY):(p[w*4-2]=b.startX,p[w*4-1]=b.startY),p[w*4]=b.stopX,p[w*4+1]=b.stopY,d=Ml(e,r,i,a,b.cx,b.cy,b.radius),d.length!==0&&c.push(d[0],d[1])});for(var f=0;f<p.length/4;f++)d=va(e,r,i,a,p[f*4],p[f*4+1],p[f*4+2],p[f*4+3],!1),d.length!==0&&c.push(d[0],d[1]);if(c.length>2){for(var x=[c[0],c[1]],S=Math.pow(x[0]-e,2)+Math.pow(x[1]-r,2),v=1;v<c.length/2;v++){var m=Math.pow(c[v*2]-e,2)+Math.pow(c[v*2+1]-r,2);m<=S&&(x[0]=c[v*2],x[1]=c[v*2+1],S=m)}return x}return c},$c=function(e,r,n){var i=[e[0]-r[0],e[1]-r[1]],a=Math.sqrt(i[0]*i[0]+i[1]*i[1]),s=(a-n)/a;return s<0&&(s=1e-5),[r[0]+s*i[0],r[1]+s*i[1]]},en=function(e,r){var n=Lv(e,r);return n=p_(n),n},p_=function(e){for(var r,n,i=e.length/2,a=1/0,s=1/0,o=-1/0,l=-1/0,u=0;u<i;u++)r=e[2*u],n=e[2*u+1],a=Math.min(a,r),o=Math.max(o,r),s=Math.min(s,n),l=Math.max(l,n);for(var c=2/(o-a),d=2/(l-s),p=0;p<i;p++)r=e[2*p]=e[2*p]*c,n=e[2*p+1]=e[2*p+1]*d,a=Math.min(a,r),o=Math.max(o,r),s=Math.min(s,n),l=Math.max(l,n);if(s<-1)for(var f=0;f<i;f++)n=e[2*f+1]=e[2*f+1]+(-1-s);return e},Lv=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 a=new Array(e*2),s,o=0;o<e;o++)s=o*n+i,a[2*o]=Math.cos(s),a[2*o+1]=Math.sin(-s);return a},wa=function(e,r){return Math.min(e/4,r/4,8)},g_=function(e,r){return Math.min(e/10,r/10,8)},Lm=function(){return 8},RA=function(e,r,n){return[e-2*r+n,2*(r-e),e]},Dv=function(e,r){return{heightOffset:Math.min(15,.05*r),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}};function Hp(t,e){function r(d){for(var p=[],f=0;f<d.length;f++){var x=d[f],S=d[(f+1)%d.length],v={x:S.x-x.x,y:S.y-x.y},m={x:-v.y,y:v.x},b=Math.sqrt(m.x*m.x+m.y*m.y);p.push({x:m.x/b,y:m.y/b})}return p}function n(d,p){var f=1/0,x=-1/0,S=yn(d),v;try{for(S.s();!(v=S.n()).done;){var m=v.value,b=m.x*p.x+m.y*p.y;f=Math.min(f,b),x=Math.max(x,b)}}catch(w){S.e(w)}finally{S.f()}return{min:f,max:x}}function i(d,p){return!(d.max<p.min||p.max<d.min)}var a=[].concat(_d(r(t)),_d(r(e))),s=yn(a),o;try{for(s.s();!(o=s.n()).done;){var l=o.value,u=n(t,l),c=n(e,l);if(!i(u,c))return!1}}catch(d){s.e(d)}finally{s.f()}return!0}var LA=zr({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),DA={pageRank:function(e){for(var r=LA(e),n=r.dampingFactor,i=r.precision,a=r.iterations,s=r.weight,o=this._private.cy,l=this.byGroup(),u=l.nodes,c=l.edges,d=u.length,p=d*d,f=c.length,x=new Array(p),S=new Array(d),v=(1-n)/d,m=0;m<d;m++){for(var b=0;b<d;b++){var w=m*d+b;x[w]=0}S[m]=0}for(var _=0;_<f;_++){var T=c[_],N=T.data("source"),E=T.data("target");if(N!==E){var k=u.indexOfId(N),L=u.indexOfId(E),A=s(T),M=L*d+k;x[M]+=A,S[k]+=A}}for(var O=1/d+v,$=0;$<d;$++)if(S[$]===0)for(var D=0;D<d;D++){var B=D*d+$;x[B]=O}else for(var j=0;j<d;j++){var I=j*d+$;x[I]=x[I]/S[$]+v}for(var U=new Array(d),F=new Array(d),P,H=0;H<d;H++)U[H]=1;for(var W=0;W<a;W++){for(var V=0;V<d;V++)F[V]=0;for(var re=0;re<d;re++)for(var J=0;J<d;J++){var ne=re*d+J;F[re]+=x[ne]*U[J]}dA(F),P=U,U=F,F=P;for(var X=0,q=0;q<d;q++){var Y=P[q]-U[q];X+=Y*Y}if(X<i)break}var Q={rank:function(ie){return ie=o.collection(ie)[0],U[u.indexOf(ie)]}};return Q}},K1=zr({root:null,weight:function(e){return 1},directed:!1,alpha:0}),mo={degreeCentralityNormalized:function(e){e=K1(e);var r=this.cy(),n=this.nodes(),i=n.length;if(e.directed){for(var c={},d={},p=0,f=0,x=0;x<i;x++){var S=n[x],v=S.id();e.root=S;var m=this.degreeCentrality(e);p<m.indegree&&(p=m.indegree),f<m.outdegree&&(f=m.outdegree),c[v]=m.indegree,d[v]=m.outdegree}return{indegree:function(w){return p==0?0:(ht(w)&&(w=r.filter(w)),c[w.id()]/p)},outdegree:function(w){return f===0?0:(ht(w)&&(w=r.filter(w)),d[w.id()]/f)}}}else{for(var a={},s=0,o=0;o<i;o++){var l=n[o];e.root=l;var u=this.degreeCentrality(e);s<u.degree&&(s=u.degree),a[l.id()]=u.degree}return{degree:function(w){return s===0?0:(ht(w)&&(w=r.filter(w)),a[w.id()]/s)}}}},degreeCentrality:function(e){e=K1(e);var r=this.cy(),n=this,i=e,a=i.root,s=i.weight,o=i.directed,l=i.alpha;if(a=r.collection(a)[0],o){for(var f=a.connectedEdges(),x=f.filter(function(N){return N.target().same(a)&&n.has(N)}),S=f.filter(function(N){return N.source().same(a)&&n.has(N)}),v=x.length,m=S.length,b=0,w=0,_=0;_<x.length;_++)b+=s(x[_]);for(var T=0;T<S.length;T++)w+=s(S[T]);return{indegree:Math.pow(v,1-l)*Math.pow(b,l),outdegree:Math.pow(m,1-l)*Math.pow(w,l)}}else{for(var u=a.connectedEdges().intersection(n),c=u.length,d=0,p=0;p<u.length;p++)d+=s(u[p]);return{degree:Math.pow(c,1-l)*Math.pow(d,l)}}}};mo.dc=mo.degreeCentrality;mo.dcn=mo.degreeCentralityNormalised=mo.degreeCentralityNormalized;var X1=zr({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),yo={closenessCentralityNormalized:function(e){for(var r=X1(e),n=r.harmonic,i=r.weight,a=r.directed,s=this.cy(),o={},l=0,u=this.nodes(),c=this.floydWarshall({weight:i,directed:a}),d=0;d<u.length;d++){for(var p=0,f=u[d],x=0;x<u.length;x++)if(d!==x){var S=c.distance(f,u[x]);n?p+=1/S:p+=S}n||(p=1/p),l<p&&(l=p),o[f.id()]=p}return{closeness:function(m){return l==0?0:(ht(m)?m=s.filter(m)[0].id():m=m.id(),o[m]/l)}}},closenessCentrality:function(e){var r=X1(e),n=r.root,i=r.weight,a=r.directed,s=r.harmonic;n=this.filter(n)[0];for(var o=this.dijkstra({root:n,weight:i,directed:a}),l=0,u=this.nodes(),c=0;c<u.length;c++){var d=u[c];if(!d.same(n)){var p=o.distanceTo(d);s?l+=1/p:l+=p}}return s?l:1/l}};yo.cc=yo.closenessCentrality;yo.ccn=yo.closenessCentralityNormalised=yo.closenessCentralityNormalized;var AA=zr({weight:null,directed:!1}),Av={betweennessCentrality:function(e){for(var r=AA(e),n=r.directed,i=r.weight,a=i!=null,s=this.cy(),o=this.nodes(),l={},u={},c=0,d={set:function(w,_){u[w]=_,_>c&&(c=_)},get:function(w){return u[w]}},p=0;p<o.length;p++){var f=o[p],x=f.id();n?l[x]=f.outgoers().nodes():l[x]=f.openNeighborhood().nodes(),d.set(x,0)}for(var S=function(){for(var w=o[v].id(),_=[],T={},N={},E={},k=new hu(function(re,J){return E[re]-E[J]}),L=0;L<o.length;L++){var A=o[L].id();T[A]=[],N[A]=0,E[A]=1/0}for(N[w]=1,E[w]=0,k.push(w);!k.empty();){var M=k.pop();if(_.push(M),a)for(var O=0;O<l[M].length;O++){var $=l[M][O],D=s.getElementById(M),B=void 0;D.edgesTo($).length>0?B=D.edgesTo($)[0]:B=$.edgesTo(D)[0];var j=i(B);$=$.id(),E[$]>E[M]+j&&(E[$]=E[M]+j,k.nodes.indexOf($)<0?k.push($):k.updateItem($),N[$]=0,T[$]=[]),E[$]==E[M]+j&&(N[$]=N[$]+N[M],T[$].push(M))}else for(var I=0;I<l[M].length;I++){var U=l[M][I].id();E[U]==1/0&&(k.push(U),E[U]=E[M]+1),E[U]==E[M]+1&&(N[U]=N[U]+N[M],T[U].push(M))}}for(var F={},P=0;P<o.length;P++)F[o[P].id()]=0;for(;_.length>0;){for(var H=_.pop(),W=0;W<T[H].length;W++){var V=T[H][W];F[V]=F[V]+N[V]/N[H]*(1+F[H])}H!=o[v].id()&&d.set(H,d.get(H)+F[H])}},v=0;v<o.length;v++)S();var m={betweenness:function(w){var _=s.collection(w).id();return d.get(_)},betweennessNormalized:function(w){if(c==0)return 0;var _=s.collection(w).id();return d.get(_)/c}};return m.betweennessNormalised=m.betweennessNormalized,m}};Av.bc=Av.betweennessCentrality;var PA=zr({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(t){return 1}]}),MA=function(e){return PA(e)},OA=function(e,r){for(var n=0,i=0;i<r.length;i++)n+=r[i](e);return n},jA=function(e,r,n){for(var i=0;i<r;i++)e[i*r+i]=n},v_=function(e,r){for(var n,i=0;i<r;i++){n=0;for(var a=0;a<r;a++)n+=e[a*r+i];for(var s=0;s<r;s++)e[s*r+i]=e[s*r+i]/n}},IA=function(e,r,n){for(var i=new Array(n*n),a=0;a<n;a++){for(var s=0;s<n;s++)i[a*n+s]=0;for(var o=0;o<n;o++)for(var l=0;l<n;l++)i[a*n+l]+=e[a*n+o]*r[o*n+l]}return i},BA=function(e,r,n){for(var i=e.slice(0),a=1;a<n;a++)e=IA(e,i,r);return e},FA=function(e,r,n){for(var i=new Array(r*r),a=0;a<r*r;a++)i[a]=Math.pow(e[a],n);return v_(i,r),i},zA=function(e,r,n,i){for(var a=0;a<n;a++){var s=Math.round(e[a]*Math.pow(10,i))/Math.pow(10,i),o=Math.round(r[a]*Math.pow(10,i))/Math.pow(10,i);if(s!==o)return!1}return!0},$A=function(e,r,n,i){for(var a=[],s=0;s<r;s++){for(var o=[],l=0;l<r;l++)Math.round(e[s*r+l]*1e3)/1e3>0&&o.push(n[l]);o.length!==0&&a.push(i.collection(o))}return a},HA=function(e,r){for(var n=0;n<e.length;n++)if(!r[n]||e[n].id()!==r[n].id())return!1;return!0},UA=function(e){for(var r=0;r<e.length;r++)for(var n=0;n<e.length;n++)r!=n&&HA(e[r],e[n])&&e.splice(n,1);return e},Q1=function(e){for(var r=this.nodes(),n=this.edges(),i=this.cy(),a=MA(e),s={},o=0;o<r.length;o++)s[r[o].id()]=o;for(var l=r.length,u=l*l,c=new Array(u),d,p=0;p<u;p++)c[p]=0;for(var f=0;f<n.length;f++){var x=n[f],S=s[x.source().id()],v=s[x.target().id()],m=OA(x,a.attributes);c[S*l+v]+=m,c[v*l+S]+=m}jA(c,l,a.multFactor),v_(c,l);for(var b=!0,w=0;b&&w<a.maxIterations;)b=!1,d=BA(c,l,a.expandFactor),c=FA(d,l,a.inflateFactor),zA(c,d,u,4)||(b=!0),w++;var _=$A(c,l,r,i);return _=UA(_),_},WA={markovClustering:Q1,mcl:Q1},VA=function(e){return e},m_=function(e,r){return Math.abs(r-e)},Z1=function(e,r,n){return e+m_(r,n)},J1=function(e,r,n){return e+Math.pow(n-r,2)},GA=function(e){return Math.sqrt(e)},qA=function(e,r,n){return Math.max(e,m_(r,n))},bl=function(e,r,n,i,a){for(var s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:VA,o=i,l,u,c=0;c<e;c++)l=r(c),u=n(c),o=a(o,l,u);return s(o)},wo={euclidean:function(e,r,n){return e>=2?bl(e,r,n,0,J1,GA):bl(e,r,n,0,Z1)},squaredEuclidean:function(e,r,n){return bl(e,r,n,0,J1)},manhattan:function(e,r,n){return bl(e,r,n,0,Z1)},max:function(e,r,n){return bl(e,r,n,-1/0,qA)}};wo["squared-euclidean"]=wo.squaredEuclidean;wo.squaredeuclidean=wo.squaredEuclidean;function Xd(t,e,r,n,i,a){var s;return cr(t)?s=t:s=wo[t]||wo.euclidean,e===0&&cr(t)?s(i,a):s(e,r,n,i,a)}var YA=zr({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),Dm=function(e){return YA(e)},Rd=function(e,r,n,i,a){var s=a!=="kMedoids",o=s?function(d){return n[d]}:function(d){return i[d](n)},l=function(p){return i[p](r)},u=n,c=r;return Xd(e,i.length,o,l,u,c)},Up=function(e,r,n){for(var i=n.length,a=new Array(i),s=new Array(i),o=new Array(r),l=null,u=0;u<i;u++)a[u]=e.min(n[u]).value,s[u]=e.max(n[u]).value;for(var c=0;c<r;c++){l=[];for(var d=0;d<i;d++)l[d]=Math.random()*(s[d]-a[d])+a[d];o[c]=l}return o},y_=function(e,r,n,i,a){for(var s=1/0,o=0,l=0;l<r.length;l++){var u=Rd(n,e,r[l],i,a);u<s&&(s=u,o=l)}return o},x_=function(e,r,n){for(var i=[],a=null,s=0;s<r.length;s++)a=r[s],n[a.id()]===e&&i.push(a);return i},KA=function(e,r,n){return Math.abs(r-e)<=n},XA=function(e,r,n){for(var i=0;i<e.length;i++)for(var a=0;a<e[i].length;a++){var s=Math.abs(e[i][a]-r[i][a]);if(s>n)return!1}return!0},QA=function(e,r,n){for(var i=0;i<n;i++)if(e===r[i])return!0;return!1},eb=function(e,r){var n=new Array(r);if(e.length<50)for(var i=0;i<r;i++){for(var a=e[Math.floor(Math.random()*e.length)];QA(a,n,i);)a=e[Math.floor(Math.random()*e.length)];n[i]=a}else for(var s=0;s<r;s++)n[s]=e[Math.floor(Math.random()*e.length)];return n},tb=function(e,r,n){for(var i=0,a=0;a<r.length;a++)i+=Rd("manhattan",r[a],e,n,"kMedoids");return i},ZA=function(e){var r=this.cy(),n=this.nodes(),i=null,a=Dm(e),s=new Array(a.k),o={},l;a.testMode?typeof a.testCentroids=="number"?(a.testCentroids,l=Up(n,a.k,a.attributes)):kr(a.testCentroids)==="object"?l=a.testCentroids:l=Up(n,a.k,a.attributes):l=Up(n,a.k,a.attributes);for(var u=!0,c=0;u&&c<a.maxIterations;){for(var d=0;d<n.length;d++)i=n[d],o[i.id()]=y_(i,l,a.distance,a.attributes,"kMeans");u=!1;for(var p=0;p<a.k;p++){var f=x_(p,n,o);if(f.length!==0){for(var x=a.attributes.length,S=l[p],v=new Array(x),m=new Array(x),b=0;b<x;b++){m[b]=0;for(var w=0;w<f.length;w++)i=f[w],m[b]+=a.attributes[b](i);v[b]=m[b]/f.length,KA(v[b],S[b],a.sensitivityThreshold)||(u=!0)}l[p]=v,s[p]=r.collection(f)}}c++}return s},JA=function(e){var r=this.cy(),n=this.nodes(),i=null,a=Dm(e),s=new Array(a.k),o,l={},u,c=new Array(a.k);a.testMode?typeof a.testCentroids=="number"||(kr(a.testCentroids)==="object"?o=a.testCentroids:o=eb(n,a.k)):o=eb(n,a.k);for(var d=!0,p=0;d&&p<a.maxIterations;){for(var f=0;f<n.length;f++)i=n[f],l[i.id()]=y_(i,o,a.distance,a.attributes,"kMedoids");d=!1;for(var x=0;x<o.length;x++){var S=x_(x,n,l);if(S.length!==0){c[x]=tb(o[x],S,a.attributes);for(var v=0;v<S.length;v++)u=tb(S[v],S,a.attributes),u<c[x]&&(c[x]=u,o[x]=S[v],d=!0);s[x]=r.collection(S)}}p++}return s},e5=function(e,r,n,i,a){for(var s,o,l=0;l<r.length;l++)for(var u=0;u<e.length;u++)i[l][u]=Math.pow(n[l][u],a.m);for(var c=0;c<e.length;c++)for(var d=0;d<a.attributes.length;d++){s=0,o=0;for(var p=0;p<r.length;p++)s+=i[p][c]*a.attributes[d](r[p]),o+=i[p][c];e[c][d]=s/o}},t5=function(e,r,n,i,a){for(var s=0;s<e.length;s++)r[s]=e[s].slice();for(var o,l,u,c=2/(a.m-1),d=0;d<n.length;d++)for(var p=0;p<i.length;p++){o=0;for(var f=0;f<n.length;f++)l=Rd(a.distance,i[p],n[d],a.attributes,"cmeans"),u=Rd(a.distance,i[p],n[f],a.attributes,"cmeans"),o+=Math.pow(l/u,c);e[p][d]=1/o}},r5=function(e,r,n,i){for(var a=new Array(n.k),s=0;s<a.length;s++)a[s]=[];for(var o,l,u=0;u<r.length;u++){o=-1/0,l=-1;for(var c=0;c<r[0].length;c++)r[u][c]>o&&(o=r[u][c],l=c);a[l].push(e[u])}for(var d=0;d<a.length;d++)a[d]=i.collection(a[d]);return a},rb=function(e){var r=this.cy(),n=this.nodes(),i=Dm(e),a,s,o,l,u;l=new Array(n.length);for(var c=0;c<n.length;c++)l[c]=new Array(i.k);o=new Array(n.length);for(var d=0;d<n.length;d++)o[d]=new Array(i.k);for(var p=0;p<n.length;p++){for(var f=0,x=0;x<i.k;x++)o[p][x]=Math.random(),f+=o[p][x];for(var S=0;S<i.k;S++)o[p][S]=o[p][S]/f}s=new Array(i.k);for(var v=0;v<i.k;v++)s[v]=new Array(i.attributes.length);u=new Array(n.length);for(var m=0;m<n.length;m++)u[m]=new Array(i.k);for(var b=!0,w=0;b&&w<i.maxIterations;)b=!1,e5(s,n,o,u,i),t5(o,l,s,n,i),XA(o,l,i.sensitivityThreshold)||(b=!0),w++;return a=r5(n,o,i,r),{clusters:a,degreeOfMembership:o}},n5={kMeans:ZA,kMedoids:JA,fuzzyCMeans:rb,fcm:rb},i5=zr({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),a5={single:"min",complete:"max"},s5=function(e){var r=i5(e),n=a5[r.linkage];return n!=null&&(r.linkage=n),r},nb=function(e,r,n,i,a){for(var s=0,o=1/0,l,u=a.attributes,c=function(L,A){return Xd(a.distance,u.length,function(M){return u[M](L)},function(M){return u[M](A)},L,A)},d=0;d<e.length;d++){var p=e[d].key,f=n[p][i[p]];f<o&&(s=p,o=f)}if(a.mode==="threshold"&&o>=a.threshold||a.mode==="dendrogram"&&e.length===1)return!1;var x=r[s],S=r[i[s]],v;a.mode==="dendrogram"?v={left:x,right:S,key:x.key}:v={value:x.value.concat(S.value),key:x.key},e[x.index]=v,e.splice(S.index,1),r[x.key]=v;for(var m=0;m<e.length;m++){var b=e[m];x.key===b.key?l=1/0:a.linkage==="min"?(l=n[x.key][b.key],n[x.key][b.key]>n[S.key][b.key]&&(l=n[S.key][b.key])):a.linkage==="max"?(l=n[x.key][b.key],n[x.key][b.key]<n[S.key][b.key]&&(l=n[S.key][b.key])):a.linkage==="mean"?l=(n[x.key][b.key]*x.size+n[S.key][b.key]*S.size)/(x.size+S.size):a.mode==="dendrogram"?l=c(b.value,x.value):l=c(b.value[0],x.value[0]),n[x.key][b.key]=n[b.key][x.key]=l}for(var w=0;w<e.length;w++){var _=e[w].key;if(i[_]===x.key||i[_]===S.key){for(var T=_,N=0;N<e.length;N++){var E=e[N].key;n[_][E]<n[_][T]&&(T=E)}i[_]=T}e[w].index=w}return x.key=S.key=x.index=S.index=null,!0},uo=function(e,r,n){e&&(e.value?r.push(e.value):(e.left&&uo(e.left,r),e.right&&uo(e.right,r)))},Pv=function(e,r){if(!e)return"";if(e.left&&e.right){var n=Pv(e.left,r),i=Pv(e.right,r),a=r.add({group:"nodes",data:{id:n+","+i}});return r.add({group:"edges",data:{source:n,target:a.id()}}),r.add({group:"edges",data:{source:i,target:a.id()}}),a.id()}else if(e.value)return e.value.id()},Mv=function(e,r,n){if(!e)return[];var i=[],a=[],s=[];return r===0?(e.left&&uo(e.left,i),e.right&&uo(e.right,a),s=i.concat(a),[n.collection(s)]):r===1?e.value?[n.collection(e.value)]:(e.left&&uo(e.left,i),e.right&&uo(e.right,a),[n.collection(i),n.collection(a)]):e.value?[n.collection(e.value)]:(e.left&&(i=Mv(e.left,r-1,n)),e.right&&(a=Mv(e.right,r-1,n)),i.concat(a))},ib=function(e){for(var r=this.cy(),n=this.nodes(),i=s5(e),a=i.attributes,s=function(w,_){return Xd(i.distance,a.length,function(T){return a[T](w)},function(T){return a[T](_)},w,_)},o=[],l=[],u=[],c=[],d=0;d<n.length;d++){var p={value:i.mode==="dendrogram"?n[d]:[n[d]],key:d,index:d};o[d]=p,c[d]=p,l[d]=[],u[d]=0}for(var f=0;f<o.length;f++)for(var x=0;x<=f;x++){var S=void 0;i.mode==="dendrogram"?S=f===x?1/0:s(o[f].value,o[x].value):S=f===x?1/0:s(o[f].value[0],o[x].value[0]),l[f][x]=S,l[x][f]=S,S<l[f][u[f]]&&(u[f]=x)}for(var v=nb(o,c,l,u,i);v;)v=nb(o,c,l,u,i);var m;return i.mode==="dendrogram"?(m=Mv(o[0],i.dendrogramDepth,r),i.addDendrogram&&Pv(o[0],r)):(m=new Array(o.length),o.forEach(function(b,w){b.key=b.index=null,m[w]=r.collection(b.value)})),m},o5={hierarchicalClustering:ib,hca:ib},l5=zr({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),u5=function(e){var r=e.damping,n=e.preference;.5<=r&&r<1||sr("Damping must range on [0.5, 1). Got: ".concat(r));var i=["median","mean","min","max"];return i.some(function(a){return a===n})||Ke(n)||sr("Preference must be one of [".concat(i.map(function(a){return"'".concat(a,"'")}).join(", "),"] or a number. Got: ").concat(n)),l5(e)},c5=function(e,r,n,i){var a=function(o,l){return i[l](o)};return-Xd(e,i.length,function(s){return a(r,s)},function(s){return a(n,s)},r,n)},d5=function(e,r){var n=null;return r==="median"?n=lA(e):r==="mean"?n=oA(e):r==="min"?n=aA(e):r==="max"?n=sA(e):n=r,n},h5=function(e,r,n){for(var i=[],a=0;a<e;a++)r[a*e+a]+n[a*e+a]>0&&i.push(a);return i},ab=function(e,r,n){for(var i=[],a=0;a<e;a++){for(var s=-1,o=-1/0,l=0;l<n.length;l++){var u=n[l];r[a*e+u]>o&&(s=u,o=r[a*e+u])}s>0&&i.push(s)}for(var c=0;c<n.length;c++)i[n[c]]=n[c];return i},f5=function(e,r,n){for(var i=ab(e,r,n),a=0;a<n.length;a++){for(var s=[],o=0;o<i.length;o++)i[o]===n[a]&&s.push(o);for(var l=-1,u=-1/0,c=0;c<s.length;c++){for(var d=0,p=0;p<s.length;p++)d+=r[s[p]*e+s[c]];d>u&&(l=c,u=d)}n[a]=s[l]}return i=ab(e,r,n),i},sb=function(e){for(var r=this.cy(),n=this.nodes(),i=u5(e),a={},s=0;s<n.length;s++)a[n[s].id()]=s;var o,l,u,c,d,p;o=n.length,l=o*o,u=new Array(l);for(var f=0;f<l;f++)u[f]=-1/0;for(var x=0;x<o;x++)for(var S=0;S<o;S++)x!==S&&(u[x*o+S]=c5(i.distance,n[x],n[S],i.attributes));c=d5(u,i.preference);for(var v=0;v<o;v++)u[v*o+v]=c;d=new Array(l);for(var m=0;m<l;m++)d[m]=0;p=new Array(l);for(var b=0;b<l;b++)p[b]=0;for(var w=new Array(o),_=new Array(o),T=new Array(o),N=0;N<o;N++)w[N]=0,_[N]=0,T[N]=0;for(var E=new Array(o*i.minIterations),k=0;k<E.length;k++)E[k]=0;var L;for(L=0;L<i.maxIterations;L++){for(var A=0;A<o;A++){for(var M=-1/0,O=-1/0,$=-1,D=0,B=0;B<o;B++)w[B]=d[A*o+B],D=p[A*o+B]+u[A*o+B],D>=M?(O=M,M=D,$=B):D>O&&(O=D);for(var j=0;j<o;j++)d[A*o+j]=(1-i.damping)*(u[A*o+j]-M)+i.damping*w[j];d[A*o+$]=(1-i.damping)*(u[A*o+$]-O)+i.damping*w[$]}for(var I=0;I<o;I++){for(var U=0,F=0;F<o;F++)w[F]=p[F*o+I],_[F]=Math.max(0,d[F*o+I]),U+=_[F];U-=_[I],_[I]=d[I*o+I],U+=_[I];for(var P=0;P<o;P++)p[P*o+I]=(1-i.damping)*Math.min(0,U-_[P])+i.damping*w[P];p[I*o+I]=(1-i.damping)*(U-_[I])+i.damping*w[I]}for(var H=0,W=0;W<o;W++){var V=p[W*o+W]+d[W*o+W]>0?1:0;E[L%i.minIterations*o+W]=V,H+=V}if(H>0&&(L>=i.minIterations-1||L==i.maxIterations-1)){for(var re=0,J=0;J<o;J++){T[J]=0;for(var ne=0;ne<i.minIterations;ne++)T[J]+=E[ne*o+J];(T[J]===0||T[J]===i.minIterations)&&re++}if(re===o)break}}for(var X=h5(o,d,p),q=f5(o,u,X),Y={},Q=0;Q<X.length;Q++)Y[X[Q]]=[];for(var te=0;te<n.length;te++){var ie=a[n[te].id()],le=q[ie];le!=null&&Y[le].push(n[te])}for(var pe=new Array(X.length),Le=0;Le<X.length;Le++)pe[Le]=r.collection(Y[X[Le]]);return pe},p5={affinityPropagation:sb,ap:sb},g5=zr({root:void 0,directed:!1}),v5={hierholzer:function(e){if(!Ot(e)){var r=arguments;e={root:r[0],directed:r[1]}}var n=g5(e),i=n.root,a=n.directed,s=this,o=!1,l,u,c;i&&(c=ht(i)?this.filter(i)[0].id():i[0].id());var d={},p={};a?s.forEach(function(b){var w=b.id();if(b.isNode()){var _=b.indegree(!0),T=b.outdegree(!0),N=_-T,E=T-_;N==1?l?o=!0:l=w:E==1?u?o=!0:u=w:(E>1||N>1)&&(o=!0),d[w]=[],b.outgoers().forEach(function(k){k.isEdge()&&d[w].push(k.id())})}else p[w]=[void 0,b.target().id()]}):s.forEach(function(b){var w=b.id();if(b.isNode()){var _=b.degree(!0);_%2&&(l?u?o=!0:u=w:l=w),d[w]=[],b.connectedEdges().forEach(function(T){return d[w].push(T.id())})}else p[w]=[b.source().id(),b.target().id()]});var f={found:!1,trail:void 0};if(o)return f;if(u&&l)if(a){if(c&&u!=c)return f;c=u}else{if(c&&u!=c&&l!=c)return f;c||(c=u)}else c||(c=s[0].id());var x=function(w){for(var _=w,T=[w],N,E,k;d[_].length;)N=d[_].shift(),E=p[N][0],k=p[N][1],_!=k?(d[k]=d[k].filter(function(L){return L!=N}),_=k):!a&&_!=E&&(d[E]=d[E].filter(function(L){return L!=N}),_=E),T.unshift(N),T.unshift(_);return T},S=[],v=[];for(v=x(c);v.length!=1;)d[v[0]].length==0?(S.unshift(s.getElementById(v.shift())),S.unshift(s.getElementById(v.shift()))):v=x(v.shift()).concat(v);S.unshift(s.getElementById(v.shift()));for(var m in d)if(d[m].length)return f;return f.found=!0,f.trail=this.spawn(S,!0),f}},Hc=function(){var e=this,r={},n=0,i=0,a=[],s=[],o={},l=function(p,f){for(var x=s.length-1,S=[],v=e.spawn();s[x].x!=p||s[x].y!=f;)S.push(s.pop().edge),x--;S.push(s.pop().edge),S.forEach(function(m){var b=m.connectedNodes().intersection(e);v.merge(m),b.forEach(function(w){var _=w.id(),T=w.connectedEdges().intersection(e);v.merge(w),r[_].cutVertex?v.merge(T.filter(function(N){return N.isLoop()})):v.merge(T)})}),a.push(v)},u=function(p,f,x){p===x&&(i+=1),r[f]={id:n,low:n++,cutVertex:!1};var S=e.getElementById(f).connectedEdges().intersection(e);if(S.size()===0)a.push(e.spawn(e.getElementById(f)));else{var v,m,b,w;S.forEach(function(_){v=_.source().id(),m=_.target().id(),b=v===f?m:v,b!==x&&(w=_.id(),o[w]||(o[w]=!0,s.push({x:f,y:b,edge:_})),b in r?r[f].low=Math.min(r[f].low,r[b].id):(u(p,b,f),r[f].low=Math.min(r[f].low,r[b].low),r[f].id<=r[b].low&&(r[f].cutVertex=!0,l(f,b))))})}};e.forEach(function(d){if(d.isNode()){var p=d.id();p in r||(i=0,u(p,p),r[p].cutVertex=i>1)}});var c=Object.keys(r).filter(function(d){return r[d].cutVertex}).map(function(d){return e.getElementById(d)});return{cut:e.spawn(c),components:a}},m5={hopcroftTarjanBiconnected:Hc,htbc:Hc,htb:Hc,hopcroftTarjanBiconnectedComponents:Hc},Uc=function(){var e=this,r={},n=0,i=[],a=[],s=e.spawn(e),o=function(u){a.push(u),r[u]={index:n,low:n++,explored:!1};var c=e.getElementById(u).connectedEdges().intersection(e);if(c.forEach(function(S){var v=S.target().id();v!==u&&(v in r||o(v),r[v].explored||(r[u].low=Math.min(r[u].low,r[v].low)))}),r[u].index===r[u].low){for(var d=e.spawn();;){var p=a.pop();if(d.merge(e.getElementById(p)),r[p].low=r[u].index,r[p].explored=!0,p===u)break}var f=d.edgesWith(d),x=d.merge(f);i.push(x),s=s.difference(x)}};return e.forEach(function(l){if(l.isNode()){var u=l.id();u in r||o(u)}}),{cut:s,components:i}},y5={tarjanStronglyConnected:Uc,tsc:Uc,tscc:Uc,tarjanStronglyConnectedComponents:Uc},b_={};[Kl,qD,YD,XD,ZD,eA,nA,DA,mo,yo,Av,WA,n5,o5,p5,v5,m5,y5].forEach(function(t){mt(b_,t)});/*!
|
|
54
|
+
Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable
|
|
55
|
+
Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com)
|
|
56
|
+
Licensed under The MIT License (http://opensource.org/licenses/MIT)
|
|
57
|
+
*/var w_=0,S_=1,__=2,ai=function(e){if(!(this instanceof ai))return new ai(e);this.id="Thenable/1.0.7",this.state=w_,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))};ai.prototype={fulfill:function(e){return ob(this,S_,"fulfillValue",e)},reject:function(e){return ob(this,__,"rejectReason",e)},then:function(e,r){var n=this,i=new ai;return n.onFulfilled.push(ub(e,i,"fulfill")),n.onRejected.push(ub(r,i,"reject")),C_(n),i.proxy}};var ob=function(e,r,n,i){return e.state===w_&&(e.state=r,e[n]=i,C_(e)),e},C_=function(e){e.state===S_?lb(e,"onFulfilled",e.fulfillValue):e.state===__&&lb(e,"onRejected",e.rejectReason)},lb=function(e,r,n){if(e[r].length!==0){var i=e[r];e[r]=[];var a=function(){for(var o=0;o<i.length;o++)i[o](n)};typeof setImmediate=="function"?setImmediate(a):setTimeout(a,0)}},ub=function(e,r,n){return function(i){if(typeof e!="function")r[n].call(r,i);else{var a;try{a=e(i)}catch(s){r.reject(s);return}k_(r,a)}}},k_=function(e,r){if(e===r||e.proxy===r){e.reject(new TypeError("cannot resolve promise with itself"));return}var n;if(kr(r)==="object"&&r!==null||typeof r=="function")try{n=r.then}catch(a){e.reject(a);return}if(typeof n=="function"){var i=!1;try{n.call(r,function(a){i||(i=!0,a===r?e.reject(new TypeError("circular thenable chain")):k_(e,a))},function(a){i||(i=!0,e.reject(a))})}catch(a){i||e.reject(a)}return}e.fulfill(r)};ai.all=function(t){return new ai(function(e,r){for(var n=new Array(t.length),i=0,a=function(l,u){n[l]=u,i++,i===t.length&&e(n)},s=0;s<t.length;s++)(function(o){var l=t[o],u=l!=null&&l.then!=null;if(u)l.then(function(d){a(o,d)},function(d){r(d)});else{var c=l;a(o,c)}})(s)})};ai.resolve=function(t){return new ai(function(e,r){e(t)})};ai.reject=function(t){return new ai(function(e,r){r(t)})};var To=typeof Promise<"u"?Promise:ai,Ov=function(e,r,n){var i=wm(e),a=!i,s=this._private=mt({duration:1e3},r,n);if(s.target=e,s.style=s.style||s.css,s.started=!1,s.playing=!1,s.hooked=!1,s.applying=!1,s.progress=0,s.completes=[],s.frames=[],s.complete&&cr(s.complete)&&s.completes.push(s.complete),a){var o=e.position();s.startPosition=s.startPosition||{x:o.x,y:o.y},s.startStyle=s.startStyle||e.cy().style().getAnimationStartStyle(e,s.style)}if(i){var l=e.pan();s.startPan={x:l.x,y:l.y},s.startZoom=e.zoom()}this.length=1,this[0]=this},fs=Ov.prototype;mt(fs,{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),Nn(e.target)&&e.target.cy().addToAnimationPool(e.target),e.hooked=!0}return this},play:function(){var e=this._private;return e.progress===1&&(e.progress=0),e.playing=!0,e.started=!1,e.stopped=!1,this.hook(),this},playing:function(){return this._private.playing},apply:function(){var e=this._private;return e.applying=!0,e.started=!1,e.stopped=!1,this.hook(),this},applying:function(){return this._private.applying},pause:function(){var e=this._private;return e.playing=!1,e.started=!1,this},stop:function(){var e=this._private;return e.playing=!1,e.started=!1,e.stopped=!0,this},rewind:function(){return this.progress(0)},fastforward:function(){return this.progress(1)},time:function(e){var r=this._private;return e===void 0?r.progress*r.duration:this.progress(e/r.duration)},progress:function(e){var r=this._private,n=r.playing;return e===void 0?r.progress:(n&&this.pause(),r.progress=e,r.started=!1,n&&this.play(),this)},completed:function(){return this._private.progress===1},reverse:function(){var e=this._private,r=e.playing;r&&this.pause(),e.progress=1-e.progress,e.started=!1;var n=function(u,c){var d=e[u];d!=null&&(e[u]=e[c],e[c]=d)};if(n("zoom","startZoom"),n("pan","startPan"),n("position","startPosition"),e.style)for(var i=0;i<e.style.length;i++){var a=e.style[i],s=a.name,o=e.startStyle[s];e.startStyle[s]=a,e.style[i]=o}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 To(function(i,a){n.push(function(){i()})})}});fs.complete=fs.completed;fs.run=fs.play;fs.running=fs.playing;var x5={animated:function(){return function(){var r=this,n=r.length!==void 0,i=n?r:[r],a=this._private.cy||this;if(!a.styleEnabled())return!1;var s=i[0];if(s)return s._private.animation.current.length>0}},clearQueue:function(){return function(){var r=this,n=r.length!==void 0,i=n?r:[r],a=this._private.cy||this;if(!a.styleEnabled())return this;for(var s=0;s<i.length;s++){var o=i[s];o._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,a=i.length!==void 0,s=a?i:[i],o=this._private.cy||this,l=!a,u=!l;if(!o.styleEnabled())return this;var c=o.style();r=mt({},r,n);var d=Object.keys(r).length===0;if(d)return new Ov(s[0],r);switch(r.duration===void 0&&(r.duration=400),r.duration){case"slow":r.duration=600;break;case"fast":r.duration=200;break}if(u&&(r.style=c.getPropsList(r.style||r.css),r.css=void 0),u&&r.renderedPosition!=null){var p=r.renderedPosition,f=o.pan(),x=o.zoom();r.position=u_(p,x,f)}if(l&&r.panBy!=null){var S=r.panBy,v=o.pan();r.pan={x:v.x+S.x,y:v.y+S.y}}var m=r.center||r.centre;if(l&&m!=null){var b=o.getCenterPan(m.eles,r.zoom);b!=null&&(r.pan=b)}if(l&&r.fit!=null){var w=r.fit,_=o.getFitViewport(w.eles||w.boundingBox,w.padding);_!=null&&(r.pan=_.pan,r.zoom=_.zoom)}if(l&&Ot(r.zoom)){var T=o.getZoomedViewport(r.zoom);T!=null?(T.zoomed&&(r.zoom=T.zoom),T.panned&&(r.pan=T.pan)):r.zoom=null}return new Ov(s[0],r)}},animate:function(){return function(r,n){var i=this,a=i.length!==void 0,s=a?i:[i],o=this._private.cy||this;if(!o.styleEnabled())return this;n&&(r=mt({},r,n));for(var l=0;l<s.length;l++){var u=s[l],c=u.animated()&&(r.queue===void 0||r.queue),d=u.animation(r,c?{queue:!0}:void 0);d.play()}return this}},stop:function(){return function(r,n){var i=this,a=i.length!==void 0,s=a?i:[i],o=this._private.cy||this;if(!o.styleEnabled())return this;for(var l=0;l<s.length;l++){for(var u=s[l],c=u._private,d=c.animation.current,p=0;p<d.length;p++){var f=d[p],x=f._private;n&&(x.duration=0)}r&&(c.animation.queue=[]),n||(c.animation.current=[])}return o.notify("draw"),this}}},Wp,cb;function Qd(){if(cb)return Wp;cb=1;var t=Array.isArray;return Wp=t,Wp}var Vp,db;function b5(){if(db)return Vp;db=1;var t=Qd(),e=cu(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(a,s){if(t(a))return!1;var o=typeof a;return o=="number"||o=="symbol"||o=="boolean"||a==null||e(a)?!0:n.test(a)||!r.test(a)||s!=null&&a in Object(s)}return Vp=i,Vp}var Gp,hb;function w5(){if(hb)return Gp;hb=1;var t=e_(),e=uu(),r="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function s(o){if(!e(o))return!1;var l=t(o);return l==n||l==i||l==r||l==a}return Gp=s,Gp}var qp,fb;function S5(){if(fb)return qp;fb=1;var t=qd(),e=t["__core-js_shared__"];return qp=e,qp}var Yp,pb;function _5(){if(pb)return Yp;pb=1;var t=S5(),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 Yp=r,Yp}var Kp,gb;function C5(){if(gb)return Kp;gb=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 Kp=r,Kp}var Xp,vb;function k5(){if(vb)return Xp;vb=1;var t=w5(),e=_5(),r=uu(),n=C5(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,s=Function.prototype,o=Object.prototype,l=s.toString,u=o.hasOwnProperty,c=RegExp("^"+l.call(u).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function d(p){if(!r(p)||e(p))return!1;var f=t(p)?c:a;return f.test(n(p))}return Xp=d,Xp}var Qp,mb;function E5(){if(mb)return Qp;mb=1;function t(e,r){return e==null?void 0:e[r]}return Qp=t,Qp}var Zp,yb;function Am(){if(yb)return Zp;yb=1;var t=k5(),e=E5();function r(n,i){var a=e(n,i);return t(a)?a:void 0}return Zp=r,Zp}var Jp,xb;function Zd(){if(xb)return Jp;xb=1;var t=Am(),e=t(Object,"create");return Jp=e,Jp}var eg,bb;function T5(){if(bb)return eg;bb=1;var t=Zd();function e(){this.__data__=t?t(null):{},this.size=0}return eg=e,eg}var tg,wb;function N5(){if(wb)return tg;wb=1;function t(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r}return tg=t,tg}var rg,Sb;function R5(){if(Sb)return rg;Sb=1;var t=Zd(),e="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function i(a){var s=this.__data__;if(t){var o=s[a];return o===e?void 0:o}return n.call(s,a)?s[a]:void 0}return rg=i,rg}var ng,_b;function L5(){if(_b)return ng;_b=1;var t=Zd(),e=Object.prototype,r=e.hasOwnProperty;function n(i){var a=this.__data__;return t?a[i]!==void 0:r.call(a,i)}return ng=n,ng}var ig,Cb;function D5(){if(Cb)return ig;Cb=1;var t=Zd(),e="__lodash_hash_undefined__";function r(n,i){var a=this.__data__;return this.size+=this.has(n)?0:1,a[n]=t&&i===void 0?e:i,this}return ig=r,ig}var ag,kb;function A5(){if(kb)return ag;kb=1;var t=T5(),e=N5(),r=R5(),n=L5(),i=D5();function a(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var u=s[o];this.set(u[0],u[1])}}return a.prototype.clear=t,a.prototype.delete=e,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,ag=a,ag}var sg,Eb;function P5(){if(Eb)return sg;Eb=1;function t(){this.__data__=[],this.size=0}return sg=t,sg}var og,Tb;function E_(){if(Tb)return og;Tb=1;function t(e,r){return e===r||e!==e&&r!==r}return og=t,og}var lg,Nb;function Jd(){if(Nb)return lg;Nb=1;var t=E_();function e(r,n){for(var i=r.length;i--;)if(t(r[i][0],n))return i;return-1}return lg=e,lg}var ug,Rb;function M5(){if(Rb)return ug;Rb=1;var t=Jd(),e=Array.prototype,r=e.splice;function n(i){var a=this.__data__,s=t(a,i);if(s<0)return!1;var o=a.length-1;return s==o?a.pop():r.call(a,s,1),--this.size,!0}return ug=n,ug}var cg,Lb;function O5(){if(Lb)return cg;Lb=1;var t=Jd();function e(r){var n=this.__data__,i=t(n,r);return i<0?void 0:n[i][1]}return cg=e,cg}var dg,Db;function j5(){if(Db)return dg;Db=1;var t=Jd();function e(r){return t(this.__data__,r)>-1}return dg=e,dg}var hg,Ab;function I5(){if(Ab)return hg;Ab=1;var t=Jd();function e(r,n){var i=this.__data__,a=t(i,r);return a<0?(++this.size,i.push([r,n])):i[a][1]=n,this}return hg=e,hg}var fg,Pb;function B5(){if(Pb)return fg;Pb=1;var t=P5(),e=M5(),r=O5(),n=j5(),i=I5();function a(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var u=s[o];this.set(u[0],u[1])}}return a.prototype.clear=t,a.prototype.delete=e,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,fg=a,fg}var pg,Mb;function F5(){if(Mb)return pg;Mb=1;var t=Am(),e=qd(),r=t(e,"Map");return pg=r,pg}var gg,Ob;function z5(){if(Ob)return gg;Ob=1;var t=A5(),e=B5(),r=F5();function n(){this.size=0,this.__data__={hash:new t,map:new(r||e),string:new t}}return gg=n,gg}var vg,jb;function $5(){if(jb)return vg;jb=1;function t(e){var r=typeof e;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?e!=="__proto__":e===null}return vg=t,vg}var mg,Ib;function eh(){if(Ib)return mg;Ib=1;var t=$5();function e(r,n){var i=r.__data__;return t(n)?i[typeof n=="string"?"string":"hash"]:i.map}return mg=e,mg}var yg,Bb;function H5(){if(Bb)return yg;Bb=1;var t=eh();function e(r){var n=t(this,r).delete(r);return this.size-=n?1:0,n}return yg=e,yg}var xg,Fb;function U5(){if(Fb)return xg;Fb=1;var t=eh();function e(r){return t(this,r).get(r)}return xg=e,xg}var bg,zb;function W5(){if(zb)return bg;zb=1;var t=eh();function e(r){return t(this,r).has(r)}return bg=e,bg}var wg,$b;function V5(){if($b)return wg;$b=1;var t=eh();function e(r,n){var i=t(this,r),a=i.size;return i.set(r,n),this.size+=i.size==a?0:1,this}return wg=e,wg}var Sg,Hb;function G5(){if(Hb)return Sg;Hb=1;var t=z5(),e=H5(),r=U5(),n=W5(),i=V5();function a(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var u=s[o];this.set(u[0],u[1])}}return a.prototype.clear=t,a.prototype.delete=e,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,Sg=a,Sg}var _g,Ub;function q5(){if(Ub)return _g;Ub=1;var t=G5(),e="Expected a function";function r(n,i){if(typeof n!="function"||i!=null&&typeof i!="function")throw new TypeError(e);var a=function(){var s=arguments,o=i?i.apply(this,s):s[0],l=a.cache;if(l.has(o))return l.get(o);var u=n.apply(this,s);return a.cache=l.set(o,u)||l,u};return a.cache=new(r.Cache||t),a}return r.Cache=t,_g=r,_g}var Cg,Wb;function Y5(){if(Wb)return Cg;Wb=1;var t=q5(),e=500;function r(n){var i=t(n,function(s){return a.size===e&&a.clear(),s}),a=i.cache;return i}return Cg=r,Cg}var kg,Vb;function T_(){if(Vb)return kg;Vb=1;var t=Y5(),e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,n=t(function(i){var a=[];return i.charCodeAt(0)===46&&a.push(""),i.replace(e,function(s,o,l,u){a.push(l?u.replace(r,"$1"):o||s)}),a});return kg=n,kg}var Eg,Gb;function N_(){if(Gb)return Eg;Gb=1;function t(e,r){for(var n=-1,i=e==null?0:e.length,a=Array(i);++n<i;)a[n]=r(e[n],n,e);return a}return Eg=t,Eg}var Tg,qb;function K5(){if(qb)return Tg;qb=1;var t=_m(),e=N_(),r=Qd(),n=cu(),i=t?t.prototype:void 0,a=i?i.toString:void 0;function s(o){if(typeof o=="string")return o;if(r(o))return e(o,s)+"";if(n(o))return a?a.call(o):"";var l=o+"";return l=="0"&&1/o==-1/0?"-0":l}return Tg=s,Tg}var Ng,Yb;function R_(){if(Yb)return Ng;Yb=1;var t=K5();function e(r){return r==null?"":t(r)}return Ng=e,Ng}var Rg,Kb;function L_(){if(Kb)return Rg;Kb=1;var t=Qd(),e=b5(),r=T_(),n=R_();function i(a,s){return t(a)?a:e(a,s)?[a]:r(n(a))}return Rg=i,Rg}var Lg,Xb;function Pm(){if(Xb)return Lg;Xb=1;var t=cu();function e(r){if(typeof r=="string"||t(r))return r;var n=r+"";return n=="0"&&1/r==-1/0?"-0":n}return Lg=e,Lg}var Dg,Qb;function X5(){if(Qb)return Dg;Qb=1;var t=L_(),e=Pm();function r(n,i){i=t(i,n);for(var a=0,s=i.length;n!=null&&a<s;)n=n[e(i[a++])];return a&&a==s?n:void 0}return Dg=r,Dg}var Ag,Zb;function Q5(){if(Zb)return Ag;Zb=1;var t=X5();function e(r,n,i){var a=r==null?void 0:t(r,n);return a===void 0?i:a}return Ag=e,Ag}var Z5=Q5(),J5=lu(Z5),Pg,Jb;function e4(){if(Jb)return Pg;Jb=1;var t=Am(),e=(function(){try{var r=t(Object,"defineProperty");return r({},"",{}),r}catch{}})();return Pg=e,Pg}var Mg,ew;function t4(){if(ew)return Mg;ew=1;var t=e4();function e(r,n,i){n=="__proto__"&&t?t(r,n,{configurable:!0,enumerable:!0,value:i,writable:!0}):r[n]=i}return Mg=e,Mg}var Og,tw;function r4(){if(tw)return Og;tw=1;var t=t4(),e=E_(),r=Object.prototype,n=r.hasOwnProperty;function i(a,s,o){var l=a[s];(!(n.call(a,s)&&e(l,o))||o===void 0&&!(s in a))&&t(a,s,o)}return Og=i,Og}var jg,rw;function n4(){if(rw)return jg;rw=1;var t=9007199254740991,e=/^(?:0|[1-9]\d*)$/;function r(n,i){var a=typeof n;return i=i??t,!!i&&(a=="number"||a!="symbol"&&e.test(n))&&n>-1&&n%1==0&&n<i}return jg=r,jg}var Ig,nw;function i4(){if(nw)return Ig;nw=1;var t=r4(),e=L_(),r=n4(),n=uu(),i=Pm();function a(s,o,l,u){if(!n(s))return s;o=e(o,s);for(var c=-1,d=o.length,p=d-1,f=s;f!=null&&++c<d;){var x=i(o[c]),S=l;if(x==="__proto__"||x==="constructor"||x==="prototype")return s;if(c!=p){var v=f[x];S=u?u(v,x,f):void 0,S===void 0&&(S=n(v)?v:r(o[c+1])?[]:{})}t(f,x,S),f=f[x]}return s}return Ig=a,Ig}var Bg,iw;function a4(){if(iw)return Bg;iw=1;var t=i4();function e(r,n,i){return r==null?r:t(r,n,i)}return Bg=e,Bg}var s4=a4(),o4=lu(s4),Fg,aw;function l4(){if(aw)return Fg;aw=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 Fg=t,Fg}var zg,sw;function u4(){if(sw)return zg;sw=1;var t=N_(),e=l4(),r=Qd(),n=cu(),i=T_(),a=Pm(),s=R_();function o(l){return r(l)?t(l,a):n(l)?[l]:e(i(s(l)))}return zg=o,zg}var c4=u4(),d4=lu(c4),h4={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,a){},onSet:function(i){},canSet:function(i){return!0}};return e=mt({},r,e),function(i,a){var s=e,o=this,l=o.length!==void 0,u=l?o:[o],c=l?o[0]:o;if(ht(i)){var d=i.indexOf(".")!==-1,p=d&&d4(i);if(s.allowGetting&&a===void 0){var f;return c&&(s.beforeGet(c),p&&c._private[s.field][i]===void 0?f=J5(c._private[s.field],p):f=c._private[s.field][i]),f}else if(s.allowSetting&&a!==void 0){var x=!s.immutableKeys[i];if(x){var S=US({},i,a);s.beforeSet(o,S);for(var v=0,m=u.length;v<m;v++){var b=u[v];s.canSet(b)&&(p&&c._private[s.field][i]===void 0?o4(b._private[s.field],p,a):b._private[s.field][i]=a)}s.updateStyle&&o.updateStyle(),s.onSet(o),s.settingTriggersEvent&&o[s.triggerFnName](s.settingEvent)}}}else if(s.allowSetting&&Ot(i)){var w=i,_,T,N=Object.keys(w);s.beforeSet(o,w);for(var E=0;E<N.length;E++){_=N[E],T=w[_];var k=!s.immutableKeys[_];if(k)for(var L=0;L<u.length;L++){var A=u[L];s.canSet(A)&&(A._private[s.field][_]=T)}}s.updateStyle&&o.updateStyle(),s.onSet(o),s.settingTriggersEvent&&o[s.triggerFnName](s.settingEvent)}else if(s.allowBinding&&cr(i)){var M=i;o.on(s.bindingEvent,M)}else if(s.allowGetting&&i===void 0){var O;return c&&(s.beforeGet(c),O=c._private[s.field]),O}return o}},removeData:function(e){var r={field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}};return e=mt({},r,e),function(i){var a=e,s=this,o=s.length!==void 0,l=o?s:[s];if(ht(i)){for(var u=i.split(/\s+/),c=u.length,d=0;d<c;d++){var p=u[d];if(!xa(p)){var f=!a.immutableKeys[p];if(f)for(var x=0,S=l.length;x<S;x++)l[x]._private[a.field][p]=void 0}}a.triggerEvent&&s[a.triggerFnName](a.event)}else if(i===void 0){for(var v=0,m=l.length;v<m;v++)for(var b=l[v]._private[a.field],w=Object.keys(b),_=0;_<w.length;_++){var T=w[_],N=!a.immutableKeys[T];N&&(b[T]=void 0)}a.triggerEvent&&s[a.triggerFnName](a.event)}return s}}},f4={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 a=this,s=Array.prototype.slice.call(arguments,0);return new To(function(o,l){var u=function(f){a.off.apply(a,d),o(f)},c=s.concat([u]),d=c.concat([]);a.on.apply(a,c)})}}},$t={};[x5,h4,f4].forEach(function(t){mt($t,t)});var p4={animate:$t.animate(),animation:$t.animation(),animated:$t.animated(),clearQueue:$t.clearQueue(),delay:$t.delay(),delayAnimation:$t.delayAnimation(),stop:$t.stop()},od={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 Yt(e)||(e=(e||"").match(/\S+/g)||[]);for(var i=[],a=new Eo(e),s=0;s<r.length;s++){for(var o=r[s],l=o._private,u=l.classes,c=!1,d=0;d<e.length;d++){var p=e[d],f=u.has(p);if(!f){c=!0;break}}c||(c=u.size!==e.length),c&&(l.classes=a,i.push(o))}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){Yt(e)||(e=e.match(/\S+/g)||[]);for(var n=this,i=r===void 0,a=[],s=0,o=n.length;s<o;s++)for(var l=n[s],u=l._private.classes,c=!1,d=0;d<e.length;d++){var p=e[d],f=u.has(p),x=!1;r||i&&!f?(u.add(p),x=!0):(!r||i&&f)&&(u.delete(p),x=!0),!c&&x&&(a.push(l),c=!0)}return a.length>0&&this.spawn(a).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}};od.className=od.classNames=od.classes;var Mt={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:Cr,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};Mt.variable="(?:[\\w-.]|(?:\\\\"+Mt.metaChar+"))+";Mt.className="(?:[\\w-]|(?:\\\\"+Mt.metaChar+"))+";Mt.value=Mt.string+"|"+Mt.number;Mt.id=Mt.variable;(function(){var t,e,r;for(t=Mt.comparatorOp.split("|"),r=0;r<t.length;r++)e=t[r],Mt.comparatorOp+="|@"+e;for(t=Mt.comparatorOp.split("|"),r=0;r<t.length;r++)e=t[r],!(e.indexOf("!")>=0)&&e!=="="&&(Mt.comparatorOp+="|\\!"+e)})();var Wt=function(){return{checks:[]}},it={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},jv=[{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 dD(t.selector,e.selector)}),g4=(function(){for(var t={},e,r=0;r<jv.length;r++)e=jv[r],t[e.selector]=e.matches;return t})(),v4=function(e,r){return g4[e](r)},m4="("+jv.map(function(t){return t.selector}).join("|")+")",Ys=function(e){return e.replace(new RegExp("\\\\("+Mt.metaChar+")","g"),function(r,n){return n})},da=function(e,r,n){e[e.length-1]=n},Iv=[{name:"group",query:!0,regex:"("+Mt.group+")",populate:function(e,r,n){var i=br(n,1),a=i[0];r.checks.push({type:it.GROUP,value:a==="*"?a:a+"s"})}},{name:"state",query:!0,regex:m4,populate:function(e,r,n){var i=br(n,1),a=i[0];r.checks.push({type:it.STATE,value:a})}},{name:"id",query:!0,regex:"\\#("+Mt.id+")",populate:function(e,r,n){var i=br(n,1),a=i[0];r.checks.push({type:it.ID,value:Ys(a)})}},{name:"className",query:!0,regex:"\\.("+Mt.className+")",populate:function(e,r,n){var i=br(n,1),a=i[0];r.checks.push({type:it.CLASS,value:Ys(a)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+Mt.variable+")\\s*\\]",populate:function(e,r,n){var i=br(n,1),a=i[0];r.checks.push({type:it.DATA_EXIST,field:Ys(a)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+Mt.variable+")\\s*("+Mt.comparatorOp+")\\s*("+Mt.value+")\\s*\\]",populate:function(e,r,n){var i=br(n,3),a=i[0],s=i[1],o=i[2],l=new RegExp("^"+Mt.string+"$").exec(o)!=null;l?o=o.substring(1,o.length-1):o=parseFloat(o),r.checks.push({type:it.DATA_COMPARE,field:Ys(a),operator:s,value:o})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+Mt.boolOp+")\\s*("+Mt.variable+")\\s*\\]",populate:function(e,r,n){var i=br(n,2),a=i[0],s=i[1];r.checks.push({type:it.DATA_BOOL,field:Ys(s),operator:a})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+Mt.meta+")\\s*("+Mt.comparatorOp+")\\s*("+Mt.number+")\\s*\\]\\]",populate:function(e,r,n){var i=br(n,3),a=i[0],s=i[1],o=i[2];r.checks.push({type:it.META_COMPARE,field:Ys(a),operator:s,value:parseFloat(o)})}},{name:"nextQuery",separator:!0,regex:Mt.separator,populate:function(e,r){var n=e.currentSubject,i=e.edgeCount,a=e.compoundCount,s=e[e.length-1];n!=null&&(s.subject=n,e.currentSubject=null),s.edgeCount=i,s.compoundCount=a,e.edgeCount=0,e.compoundCount=0;var o=e[e.length++]=Wt();return o}},{name:"directedEdge",separator:!0,regex:Mt.directedEdge,populate:function(e,r){if(e.currentSubject==null){var n=Wt(),i=r,a=Wt();return n.checks.push({type:it.DIRECTED_EDGE,source:i,target:a}),da(e,r,n),e.edgeCount++,a}else{var s=Wt(),o=r,l=Wt();return s.checks.push({type:it.NODE_SOURCE,source:o,target:l}),da(e,r,s),e.edgeCount++,l}}},{name:"undirectedEdge",separator:!0,regex:Mt.undirectedEdge,populate:function(e,r){if(e.currentSubject==null){var n=Wt(),i=r,a=Wt();return n.checks.push({type:it.UNDIRECTED_EDGE,nodes:[i,a]}),da(e,r,n),e.edgeCount++,a}else{var s=Wt(),o=r,l=Wt();return s.checks.push({type:it.NODE_NEIGHBOR,node:o,neighbor:l}),da(e,r,s),l}}},{name:"child",separator:!0,regex:Mt.child,populate:function(e,r){if(e.currentSubject==null){var n=Wt(),i=Wt(),a=e[e.length-1];return n.checks.push({type:it.CHILD,parent:a,child:i}),da(e,r,n),e.compoundCount++,i}else if(e.currentSubject===r){var s=Wt(),o=e[e.length-1],l=Wt(),u=Wt(),c=Wt(),d=Wt();return s.checks.push({type:it.COMPOUND_SPLIT,left:o,right:l,subject:u}),u.checks=r.checks,r.checks=[{type:it.TRUE}],d.checks.push({type:it.TRUE}),l.checks.push({type:it.PARENT,parent:d,child:c}),da(e,o,s),e.currentSubject=u,e.compoundCount++,c}else{var p=Wt(),f=Wt(),x=[{type:it.PARENT,parent:p,child:f}];return p.checks=r.checks,r.checks=x,e.compoundCount++,f}}},{name:"descendant",separator:!0,regex:Mt.descendant,populate:function(e,r){if(e.currentSubject==null){var n=Wt(),i=Wt(),a=e[e.length-1];return n.checks.push({type:it.DESCENDANT,ancestor:a,descendant:i}),da(e,r,n),e.compoundCount++,i}else if(e.currentSubject===r){var s=Wt(),o=e[e.length-1],l=Wt(),u=Wt(),c=Wt(),d=Wt();return s.checks.push({type:it.COMPOUND_SPLIT,left:o,right:l,subject:u}),u.checks=r.checks,r.checks=[{type:it.TRUE}],d.checks.push({type:it.TRUE}),l.checks.push({type:it.ANCESTOR,ancestor:d,descendant:c}),da(e,o,s),e.currentSubject=u,e.compoundCount++,c}else{var p=Wt(),f=Wt(),x=[{type:it.ANCESTOR,ancestor:p,descendant:f}];return p.checks=r.checks,r.checks=x,e.compoundCount++,f}}},{name:"subject",modifier:!0,regex:Mt.subject,populate:function(e,r){if(e.currentSubject!=null&&e.currentSubject!==r)return Ht("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=r;var n=e[e.length-1],i=n.checks[0],a=i==null?null:i.type;a===it.DIRECTED_EDGE?i.type=it.NODE_TARGET:a===it.UNDIRECTED_EDGE&&(i.type=it.NODE_NEIGHBOR,i.node=i.nodes[1],i.neighbor=i.nodes[0],i.nodes=null)}}];Iv.forEach(function(t){return t.regexObj=new RegExp("^"+t.regex)});var y4=function(e){for(var r,n,i,a=0;a<Iv.length;a++){var s=Iv[a],o=s.name,l=e.match(s.regexObj);if(l!=null){n=l,r=s,i=o;var u=l[0];e=e.substring(u.length);break}}return{expr:r,match:n,name:i,remaining:e}},x4=function(e){var r=e.match(/^\s+/);if(r){var n=r[0];e=e.substring(n.length)}return e},b4=function(e){var r=this,n=r.inputText=e,i=r[0]=Wt();for(r.length=1,n=x4(n);;){var a=y4(n);if(a.expr==null)return Ht("The selector `"+e+"`is invalid"),!1;var s=a.match.slice(1),o=a.expr.populate(r,i,s);if(o===!1)return!1;if(o!=null&&(i=o),n=a.remaining,n.match(/^\s*$/))break}var l=r[r.length-1];r.currentSubject!=null&&(l.subject=r.currentSubject),l.edgeCount=r.edgeCount,l.compoundCount=r.compoundCount;for(var u=0;u<r.length;u++){var c=r[u];if(c.compoundCount>0&&c.edgeCount>0)return Ht("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(c.edgeCount>1)return Ht("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;c.edgeCount===1&&Ht("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},w4=function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(c){return c??""},r=function(c){return ht(c)?'"'+c+'"':e(c)},n=function(c){return" "+c+" "},i=function(c,d){var p=c.type,f=c.value;switch(p){case it.GROUP:{var x=e(f);return x.substring(0,x.length-1)}case it.DATA_COMPARE:{var S=c.field,v=c.operator;return"["+S+n(e(v))+r(f)+"]"}case it.DATA_BOOL:{var m=c.operator,b=c.field;return"["+e(m)+b+"]"}case it.DATA_EXIST:{var w=c.field;return"["+w+"]"}case it.META_COMPARE:{var _=c.operator,T=c.field;return"[["+T+n(e(_))+r(f)+"]]"}case it.STATE:return f;case it.ID:return"#"+f;case it.CLASS:return"."+f;case it.PARENT:case it.CHILD:return a(c.parent,d)+n(">")+a(c.child,d);case it.ANCESTOR:case it.DESCENDANT:return a(c.ancestor,d)+" "+a(c.descendant,d);case it.COMPOUND_SPLIT:{var N=a(c.left,d),E=a(c.subject,d),k=a(c.right,d);return N+(N.length>0?" ":"")+E+k}case it.TRUE:return""}},a=function(c,d){return c.checks.reduce(function(p,f,x){return p+(d===c&&x===0?"$":"")+i(f,d)},"")},s="",o=0;o<this.length;o++){var l=this[o];s+=a(l,l.subject),this.length>1&&o<this.length-1&&(s+=", ")}return this.toStringCache=s,s},S4={parse:b4,toString:w4},D_=function(e,r,n){var i,a=ht(e),s=Ke(e),o=ht(n),l,u,c=!1,d=!1,p=!1;switch(r.indexOf("!")>=0&&(r=r.replace("!",""),d=!0),r.indexOf("@")>=0&&(r=r.replace("@",""),c=!0),(a||o||c)&&(l=!a&&!s?"":""+e,u=""+n),c&&(e=l=l.toLowerCase(),n=u=u.toLowerCase()),r){case"*=":i=l.indexOf(u)>=0;break;case"$=":i=l.indexOf(u,l.length-u.length)>=0;break;case"^=":i=l.indexOf(u)===0;break;case"=":i=e===n;break;case">":p=!0,i=e>n;break;case">=":p=!0,i=e>=n;break;case"<":p=!0,i=e<n;break;case"<=":p=!0,i=e<=n;break;default:i=!1;break}return d&&(e!=null||!p)&&(i=!i),i},_4=function(e,r){switch(r){case"?":return!!e;case"!":return!e;case"^":return e===void 0}},C4=function(e){return e!==void 0},Mm=function(e,r){return e.data(r)},k4=function(e,r){return e[r]()},fr=[],nr=function(e,r){return e.checks.every(function(n){return fr[n.type](n,r)})};fr[it.GROUP]=function(t,e){var r=t.value;return r==="*"||r===e.group()};fr[it.STATE]=function(t,e){var r=t.value;return v4(r,e)};fr[it.ID]=function(t,e){var r=t.value;return e.id()===r};fr[it.CLASS]=function(t,e){var r=t.value;return e.hasClass(r)};fr[it.META_COMPARE]=function(t,e){var r=t.field,n=t.operator,i=t.value;return D_(k4(e,r),n,i)};fr[it.DATA_COMPARE]=function(t,e){var r=t.field,n=t.operator,i=t.value;return D_(Mm(e,r),n,i)};fr[it.DATA_BOOL]=function(t,e){var r=t.field,n=t.operator;return _4(Mm(e,r),n)};fr[it.DATA_EXIST]=function(t,e){var r=t.field;return t.operator,C4(Mm(e,r))};fr[it.UNDIRECTED_EDGE]=function(t,e){var r=t.nodes[0],n=t.nodes[1],i=e.source(),a=e.target();return nr(r,i)&&nr(n,a)||nr(n,i)&&nr(r,a)};fr[it.NODE_NEIGHBOR]=function(t,e){return nr(t.node,e)&&e.neighborhood().some(function(r){return r.isNode()&&nr(t.neighbor,r)})};fr[it.DIRECTED_EDGE]=function(t,e){return nr(t.source,e.source())&&nr(t.target,e.target())};fr[it.NODE_SOURCE]=function(t,e){return nr(t.source,e)&&e.outgoers().some(function(r){return r.isNode()&&nr(t.target,r)})};fr[it.NODE_TARGET]=function(t,e){return nr(t.target,e)&&e.incomers().some(function(r){return r.isNode()&&nr(t.source,r)})};fr[it.CHILD]=function(t,e){return nr(t.child,e)&&nr(t.parent,e.parent())};fr[it.PARENT]=function(t,e){return nr(t.parent,e)&&e.children().some(function(r){return nr(t.child,r)})};fr[it.DESCENDANT]=function(t,e){return nr(t.descendant,e)&&e.ancestors().some(function(r){return nr(t.ancestor,r)})};fr[it.ANCESTOR]=function(t,e){return nr(t.ancestor,e)&&e.descendants().some(function(r){return nr(t.descendant,r)})};fr[it.COMPOUND_SPLIT]=function(t,e){return nr(t.subject,e)&&nr(t.left,e)&&nr(t.right,e)};fr[it.TRUE]=function(){return!0};fr[it.COLLECTION]=function(t,e){var r=t.value;return r.has(e)};fr[it.FILTER]=function(t,e){var r=t.value;return r(e)};var E4=function(e){var r=this;if(r.length===1&&r[0].checks.length===1&&r[0].checks[0].type===it.ID)return e.getElementById(r[0].checks[0].value).collection();var n=function(a){for(var s=0;s<r.length;s++){var o=r[s];if(nr(o,a))return!0}return!1};return r.text()==null&&(n=function(){return!0}),e.filter(n)},T4=function(e){for(var r=this,n=0;n<r.length;n++){var i=r[n];if(nr(i,e))return!0}return!1},N4={matches:T4,filter:E4},Sa=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,e==null||ht(e)&&e.match(/^\s*$/)||(Nn(e)?this.addQuery({checks:[{type:it.COLLECTION,value:e.collection()}]}):cr(e)?this.addQuery({checks:[{type:it.FILTER,value:e}]}):ht(e)?this.parse(e)||(this.invalid=!0):sr("A selector must be created from a string; found "))},_a=Sa.prototype;[S4,N4].forEach(function(t){return mt(_a,t)});_a.text=function(){return this.inputText};_a.size=function(){return this.length};_a.eq=function(t){return this[t]};_a.sameText=function(t){return!this.invalid&&!t.invalid&&this.text()===t.text()};_a.addQuery=function(t){this[this.length++]=t};_a.selector=_a.toString;var ma={allAre:function(e){var r=new Sa(e);return this.every(function(n){return r.matches(n)})},is:function(e){var r=new Sa(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())})}};ma.allAreNeighbours=ma.allAreNeighbors;ma.has=ma.contains;ma.equal=ma.equals=ma.same;var Hn=function(e,r){return function(i,a,s,o){var l=i,u=this,c;if(l==null?c="":Nn(l)&&l.length===1&&(c=l.id()),u.length===1&&c){var d=u[0]._private,p=d.traversalCache=d.traversalCache||{},f=p[r]=p[r]||[],x=ds(c),S=f[x];return S||(f[x]=e.call(u,i,a,s,o))}else return e.call(u,i,a,s,o)}},So={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 a=this[i],s=a._private.parent;s&&r.push(s)}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 a=n[i];r.push(a)}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],a=i.parents();r=r||a,r=r.intersect(a)}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:Hn(function(t){for(var e=[],r=0;r<this.length;r++)for(var n=this[r],i=n._private.children,a=0;a<i.length;a++)e.push(i[a]);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 a=0;a<i.length;a++){var s=i[a];r.push(s),s.children().nonempty()&&n(s.children())}}return n(this.children()),this.spawn(r,!0).filter(e)}};function Om(t,e,r,n){for(var i=[],a=new Eo,s=t.cy(),o=s.hasCompoundNodes(),l=0;l<t.length;l++){var u=t[l];r?i.push(u):o&&n(i,a,u)}for(;i.length>0;){var c=i.shift();e(c),a.add(c.id()),o&&n(i,a,c)}return t}function A_(t,e,r){if(r.isParent())for(var n=r._private.children,i=0;i<n.length;i++){var a=n[i];e.has(a.id())||t.push(a)}}So.forEachDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Om(this,t,e,A_)};function P_(t,e,r){if(r.isChild()){var n=r._private.parent;e.has(n.id())||t.push(n)}}So.forEachUp=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Om(this,t,e,P_)};function R4(t,e,r){P_(t,e,r),A_(t,e,r)}So.forEachUpAndDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Om(this,t,e,R4)};So.ancestors=So.parents;var Zl,M_;Zl=M_={data:$t.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:$t.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:$t.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:$t.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:$t.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:$t.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}};Zl.attr=Zl.data;Zl.removeAttr=Zl.removeData;var L4=M_,th={};function $g(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],a=i._private.edges,s=0;s<a.length;s++){var o=a[s];!e&&o.isLoop()||(n+=t(i,o))}return n}else return}}mt(th,{degree:$g(function(t,e){return e.source().same(e.target())?2:1}),indegree:$g(function(t,e){return e.target().same(t)?1:0}),outdegree:$g(function(t,e){return e.source().same(t)?1:0})});function Ks(t,e){return function(r){for(var n,i=this.nodes(),a=0;a<i.length;a++){var s=i[a],o=s[t](r);o!==void 0&&(n===void 0||e(o,n))&&(n=o)}return n}}mt(th,{minDegree:Ks("degree",function(t,e){return t<e}),maxDegree:Ks("degree",function(t,e){return t>e}),minIndegree:Ks("indegree",function(t,e){return t<e}),maxIndegree:Ks("indegree",function(t,e){return t>e}),minOutdegree:Ks("outdegree",function(t,e){return t<e}),maxOutdegree:Ks("outdegree",function(t,e){return t>e})});mt(th,{totalDegree:function(e){for(var r=0,n=this.nodes(),i=0;i<n.length;i++)r+=n[i].degree(e);return r}});var ri,O_,j_=function(e,r,n){for(var i=0;i<e.length;i++){var a=e[i];if(!a.locked()){var s=a._private.position,o={x:r.x!=null?r.x-s.x:0,y:r.y!=null?r.y-s.y:0};a.isParent()&&!(o.x===0&&o.y===0)&&a.children().shift(o,n),a.dirtyBoundingBoxCache()}}},ow={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){j_(e,r,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};ri=O_={position:$t.data(ow),silentPosition:$t.data(mt({},ow,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,r){j_(e,r,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,r){if(Ot(e))r?this.silentPosition(e):this.position(e);else if(cr(e)){var n=e,i=this.cy();i.startBatch();for(var a=0;a<this.length;a++){var s=this[a],o=void 0;(o=n(s,a))&&(r?s.silentPosition(o):s.position(o))}i.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,r,n){var i;if(Ot(e)?(i={x:Ke(e.x)?e.x:0,y:Ke(e.y)?e.y:0},n=r):ht(e)&&Ke(r)&&(i={x:0,y:0},i[e]=r),i!=null){var a=this.cy();a.startBatch();for(var s=0;s<this.length;s++){var o=this[s];if(!(a.hasCompoundNodes()&&o.isChild()&&o.ancestors().anySame(this))){var l=o.position(),u={x:l.x+i.x,y:l.y+i.y};n?o.silentPosition(u):o.position(u)}}a.endBatch()}return this},silentShift:function(e,r){return Ot(e)?this.shift(e,!0):ht(e)&&Ke(r)&&this.shift(e,r,!0),this},renderedPosition:function(e,r){var n=this[0],i=this.cy(),a=i.zoom(),s=i.pan(),o=Ot(e)?e:void 0,l=o!==void 0||r!==void 0&&ht(e);if(n&&n.isNode())if(l)for(var u=0;u<this.length;u++){var c=this[u];r!==void 0?c.position(e,(r-s[e])/a):o!==void 0&&c.position(u_(o,a,s))}else{var d=n.position();return o=Kd(d,a,s),e===void 0?o:o[e]}else if(!l)return;return this},relativePosition:function(e,r){var n=this[0],i=this.cy(),a=Ot(e)?e:void 0,s=a!==void 0||r!==void 0&&ht(e),o=i.hasCompoundNodes();if(n&&n.isNode())if(s)for(var l=0;l<this.length;l++){var u=this[l],c=o?u.parent():null,d=c&&c.length>0,p=d;d&&(c=c[0]);var f=p?c.position():{x:0,y:0};r!==void 0?u.position(e,r+f[e]):a!==void 0&&u.position({x:a.x+f.x,y:a.y+f.y})}else{var x=n.position(),S=o?n.parent():null,v=S&&S.length>0,m=v;v&&(S=S[0]);var b=m?S.position():{x:0,y:0};return a={x:x.x-b.x,y:x.y-b.y},e===void 0?a:a[e]}else if(!s)return;return this}};ri.modelPosition=ri.point=ri.position;ri.modelPositions=ri.points=ri.positions;ri.renderedPoint=ri.renderedPosition;ri.relativePoint=ri.relativePosition;var D4=O_,_o=function(e){switch(e){case"left":case"right-inside":return"left";case"right":case"left-inside":return"right";default:return"center"}},Co=function(e){switch(e){case"top":case"bottom-inside":return"top";case"bottom":case"top-inside":return"bottom";default:return"center"}},A4=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"}},xo,Ra;xo=Ra={};Ra.renderedBoundingBox=function(t){var e=this.boundingBox(t),r=this.cy(),n=r.zoom(),i=r.pan(),a=e.x1*n+i.x,s=e.x2*n+i.x,o=e.y1*n+i.y,l=e.y2*n+i.y;return{x1:a,x2:s,y1:o,y2:l,w:s-a,h:l-o}};Ra.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)};Ra.updateCompoundBounds=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();if(!e.styleEnabled()||!e.hasCompoundNodes())return this;if(!t&&e.batching())return this;function r(s){if(!s.isParent())return;var o=s._private,l=s.children(),u=s.pstyle("compound-sizing-wrt-labels").value==="include",c={width:{val:s.pstyle("min-width").pfValue,left:s.pstyle("min-width-bias-left"),right:s.pstyle("min-width-bias-right")},height:{val:s.pstyle("min-height").pfValue,top:s.pstyle("min-height-bias-top"),bottom:s.pstyle("min-height-bias-bottom")}},d=l.boundingBox({includeLabels:u,includeOverlays:!1,useCache:!1}),p=o.position;(d.w===0||d.h===0)&&(d={w:s.pstyle("width").pfValue,h:s.pstyle("height").pfValue},d.x1=p.x-d.w/2,d.x2=p.x+d.w/2,d.y1=p.y-d.h/2,d.y2=p.y+d.h/2);function f(L,A,M){var O=0,$=0,D=A+M;return L>0&&D>0&&(O=A/D*L,$=M/D*L),{biasDiff:O,biasComplementDiff:$}}function x(L,A,M,O){if(M.units==="%")switch(O){case"width":return L>0?M.pfValue*L:0;case"height":return A>0?M.pfValue*A:0;case"average":return L>0&&A>0?M.pfValue*(L+A)/2:0;case"min":return L>0&&A>0?L>A?M.pfValue*A:M.pfValue*L:0;case"max":return L>0&&A>0?L>A?M.pfValue*L:M.pfValue*A:0;default:return 0}else return M.units==="px"?M.pfValue:0}var S=c.width.left.value;c.width.left.units==="px"&&c.width.val>0&&(S=S*100/c.width.val);var v=c.width.right.value;c.width.right.units==="px"&&c.width.val>0&&(v=v*100/c.width.val);var m=c.height.top.value;c.height.top.units==="px"&&c.height.val>0&&(m=m*100/c.height.val);var b=c.height.bottom.value;c.height.bottom.units==="px"&&c.height.val>0&&(b=b*100/c.height.val);var w=f(c.width.val-d.w,S,v),_=w.biasDiff,T=w.biasComplementDiff,N=f(c.height.val-d.h,m,b),E=N.biasDiff,k=N.biasComplementDiff;o.autoPadding=x(d.w,d.h,s.pstyle("padding"),s.pstyle("padding-relative-to").value),o.autoWidth=Math.max(d.w,c.width.val),p.x=(-_+d.x1+d.x2+T)/2,o.autoHeight=Math.max(d.h,c.height.val),p.y=(-E+d.y1+d.y2+k)/2}for(var n=0;n<this.length;n++){var i=this[n],a=i._private;(!a.compoundBoundsClean||t)&&(r(i),e.batching()||(a.compoundBoundsClean=!0))}return this};var zn=function(e){return e===1/0||e===-1/0?0:e},ti=function(e,r,n,i,a){i-r===0||a-n===0||r==null||n==null||i==null||a==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=a>e.y2?a:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},fa=function(e,r){return r==null?e:ti(e,r.x1,r.y1,r.x2,r.y2)},wl=function(e,r,n){return rn(e,r,n)},Wc=function(e,r,n){if(!r.cy().headless()){var i=r._private,a=i.rstyle,s=a.arrowWidth/2,o=r.pstyle(n+"-arrow-shape").value,l,u;if(o!=="none"){n==="source"?(l=a.srcX,u=a.srcY):n==="target"?(l=a.tgtX,u=a.tgtY):(l=a.midX,u=a.midY);var c=i.arrowBounds=i.arrowBounds||{},d=c[n]=c[n]||{};d.x1=l-s,d.y1=u-s,d.x2=l+s,d.y2=u+s,d.w=d.x2-d.x1,d.h=d.y2-d.y1,ad(d,1),ti(e,d.x1,d.y1,d.x2,d.y2)}}},Hg=function(e,r,n){if(!r.cy().headless()){var i;n?i=n+"-":i="";var a=r._private,s=a.rstyle,o=r.pstyle(i+"label").strValue;if(o){var l=r.pstyle("text-halign"),u=r.pstyle("text-valign"),c=wl(s,"labelWidth",n),d=wl(s,"labelHeight",n),p=wl(s,"labelX",n),f=wl(s,"labelY",n),x=r.pstyle(i+"text-margin-x").pfValue,S=r.pstyle(i+"text-margin-y").pfValue,v=r.isEdge(),m=r.pstyle(i+"text-rotation"),b=r.pstyle("text-outline-width").pfValue,w=r.pstyle("text-border-width").pfValue,_=w/2,T=r.pstyle("text-background-padding").pfValue,N=2,E=d,k=c,L=k/2,A=E/2,M,O,$,D;if(v)M=p-L,O=p+L,$=f-A,D=f+A;else{switch(_o(l.value)){case"left":M=p-k,O=p;break;case"center":M=p-L,O=p+L;break;case"right":M=p,O=p+k;break}switch(Co(u.value)){case"top":$=f-E,D=f;break;case"center":$=f-A,D=f+A;break;case"bottom":$=f,D=f+E;break}}var B=x-Math.max(b,_)-T-N,j=x+Math.max(b,_)+T+N,I=S-Math.max(b,_)-T-N,U=S+Math.max(b,_)+T+N;M+=B,O+=j,$+=I,D+=U;var F=n||"main",P=a.labelBounds,H=P[F]=P[F]||{};H.x1=M,H.y1=$,H.x2=O,H.y2=D,H.w=O-M,H.h=D-$,H.leftPad=B,H.rightPad=j,H.topPad=I,H.botPad=U;var W=v&&m.strValue==="autorotate",V=m.pfValue!=null&&m.pfValue!==0;if(W||V){var re=W?wl(a.rstyle,"labelAngle",n):m.pfValue,J=Math.cos(re),ne=Math.sin(re),X=(M+O)/2,q=($+D)/2;if(!v){switch(_o(l.value)){case"left":X=O;break;case"right":X=M;break}switch(Co(u.value)){case"top":q=D;break;case"bottom":q=$;break}}var Y=function(Se,Te){return Se=Se-X,Te=Te-q,{x:Se*J-Te*ne+X,y:Se*ne+Te*J+q}},Q=Y(M,$),te=Y(M,D),ie=Y(O,$),le=Y(O,D);M=Math.min(Q.x,te.x,ie.x,le.x),O=Math.max(Q.x,te.x,ie.x,le.x),$=Math.min(Q.y,te.y,ie.y,le.y),D=Math.max(Q.y,te.y,ie.y,le.y)}var pe=F+"Rot",Le=P[pe]=P[pe]||{};Le.x1=M,Le.y1=$,Le.x2=O,Le.y2=D,Le.w=O-M,Le.h=D-$,ti(e,M,$,O,D),ti(a.labelBounds.all,M,$,O,D)}return e}},lw=function(e,r){if(!r.cy().headless()){var n=r.pstyle("outline-opacity").value,i=r.pstyle("outline-width").value,a=r.pstyle("outline-offset").value,s=i+a;I_(e,r,n,s,"outside",s/2)}},I_=function(e,r,n,i,a,s){if(!(n===0||i<=0||a==="inside")){var o=r.cy(),l=o.renderer(),u=l.nodeShapes[l.getNodeShape(r)];if(u){var c=r.position(),d=c.x,p=c.y,f=r.width(),x=r.height();if(u.hasMiterBounds){a==="center"&&(i/=2);var S=u.miterBounds(d,p,f,x,i);fa(e,S)}else s!=null&&s>0&&sd(e,[s,s,s,s])}}},P4=function(e,r){if(!r.cy().headless()){var n=r.pstyle("border-opacity").value,i=r.pstyle("border-width").pfValue,a=r.pstyle("border-position").value;I_(e,r,n,i,a)}},M4=function(e,r){var n=e._private.cy,i=n.styleEnabled(),a=n.headless(),s=sn(),o=e._private,l=e.isNode(),u=e.isEdge(),c,d,p,f,x,S,v=o.rstyle,m=l&&i?e.pstyle("bounds-expansion").pfValue:[0],b=function(je){return je.pstyle("display").value!=="none"},w=!i||b(e)&&(!u||b(e.source())&&b(e.target()));if(w){var _=0,T=0;i&&r.includeOverlays&&(_=e.pstyle("overlay-opacity").value,_!==0&&(T=e.pstyle("overlay-padding").value));var N=0,E=0;i&&r.includeUnderlays&&(N=e.pstyle("underlay-opacity").value,N!==0&&(E=e.pstyle("underlay-padding").value));var k=Math.max(T,E),L=0,A=0;if(i&&(L=e.pstyle("width").pfValue,A=L/2),l&&r.includeNodes){var M=e.position();x=M.x,S=M.y;var O=e.outerWidth(),$=O/2,D=e.outerHeight(),B=D/2;c=x-$,d=x+$,p=S-B,f=S+B,ti(s,c,p,d,f),i&&lw(s,e),i&&r.includeOutlines&&!a&&lw(s,e),i&&P4(s,e)}else if(u&&r.includeEdges)if(i&&!a){var j=e.pstyle("curve-style").strValue;if(c=Math.min(v.srcX,v.midX,v.tgtX),d=Math.max(v.srcX,v.midX,v.tgtX),p=Math.min(v.srcY,v.midY,v.tgtY),f=Math.max(v.srcY,v.midY,v.tgtY),c-=A,d+=A,p-=A,f+=A,ti(s,c,p,d,f),j==="haystack"){var I=v.haystackPts;if(I&&I.length===2){if(c=I[0].x,p=I[0].y,d=I[1].x,f=I[1].y,c>d){var U=c;c=d,d=U}if(p>f){var F=p;p=f,f=F}ti(s,c-A,p-A,d+A,f+A)}}else if(j==="bezier"||j==="unbundled-bezier"||pa(j,"segments")||pa(j,"taxi")){var P;switch(j){case"bezier":case"unbundled-bezier":P=v.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":P=v.linePts;break}if(P!=null)for(var H=0;H<P.length;H++){var W=P[H];c=W.x-A,d=W.x+A,p=W.y-A,f=W.y+A,ti(s,c,p,d,f)}}}else{var V=e.source(),re=V.position(),J=e.target(),ne=J.position();if(c=re.x,d=ne.x,p=re.y,f=ne.y,c>d){var X=c;c=d,d=X}if(p>f){var q=p;p=f,f=q}c-=A,d+=A,p-=A,f+=A,ti(s,c,p,d,f)}if(i&&r.includeEdges&&u&&(Wc(s,e,"mid-source"),Wc(s,e,"mid-target"),Wc(s,e,"source"),Wc(s,e,"target")),i){var Y=e.pstyle("ghost").value==="yes";if(Y){var Q=e.pstyle("ghost-offset-x").pfValue,te=e.pstyle("ghost-offset-y").pfValue;ti(s,s.x1+Q,s.y1+te,s.x2+Q,s.y2+te)}}var ie=o.bodyBounds=o.bodyBounds||{};q1(ie,s),sd(ie,m),ad(ie,1),i&&(c=s.x1,d=s.x2,p=s.y1,f=s.y2,ti(s,c-k,p-k,d+k,f+k));var le=o.overlayBounds=o.overlayBounds||{};q1(le,s),sd(le,m),ad(le,1);var pe=o.labelBounds=o.labelBounds||{};pe.all!=null?pA(pe.all):pe.all=sn(),i&&r.includeLabels&&(r.includeMainLabels&&Hg(s,e,null),u&&(r.includeSourceLabels&&Hg(s,e,"source"),r.includeTargetLabels&&Hg(s,e,"target")))}return s.x1=zn(s.x1),s.y1=zn(s.y1),s.x2=zn(s.x2),s.y2=zn(s.y2),s.w=zn(s.x2-s.x1),s.h=zn(s.y2-s.y1),s.w>0&&s.h>0&&w&&(sd(s,m),ad(s,1)),s},B_=function(e){var r=0,n=function(s){return(s?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},F_=function(e){var r=function(o){return Math.round(o)};if(e.isEdge()){var n=e.source().position(),i=e.target().position();return $1([r(n.x),r(n.y),r(i.x),r(i.y)])}else{var a=e.position();return $1([r(a.x),r(a.y)])}},uw=function(e,r){var n=e._private,i,a=e.isEdge(),s=r==null?cw:B_(r),o=s===cw;if(n.bbCache==null?(i=M4(e,Jl),n.bbCache=i,n.bbCachePosKey=F_(e)):i=n.bbCache,!o){var l=e.isNode();i=sn(),(r.includeNodes&&l||r.includeEdges&&!l)&&(r.includeOverlays?fa(i,n.overlayBounds):fa(i,n.bodyBounds)),r.includeLabels&&(r.includeMainLabels&&(!a||r.includeSourceLabels&&r.includeTargetLabels)?fa(i,n.labelBounds.all):(r.includeMainLabels&&fa(i,n.labelBounds.mainRot),r.includeSourceLabels&&fa(i,n.labelBounds.sourceRot),r.includeTargetLabels&&fa(i,n.labelBounds.targetRot))),i.w=i.x2-i.x1,i.h=i.y2-i.y1}return i},Jl={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},cw=B_(Jl),dw=zr(Jl);Ra.boundingBox=function(t){var e,r=t===void 0||t.useCache===void 0||t.useCache===!0,n=bo(function(c){var d=c._private;return d.bbCache==null||d.styleDirty||d.bbCachePosKey!==F_(c)},function(c){return c.id()});if(r&&this.length===1&&!n(this[0]))t===void 0?t=Jl:t=dw(t),e=uw(this[0],t);else{e=sn(),t=t||Jl;var i=dw(t),a=this,s=a.cy(),o=s.styleEnabled();this.edges().forEach(n),this.nodes().forEach(n),o&&this.recalculateRenderedStyle(r),this.updateCompoundBounds(!r);for(var l=0;l<a.length;l++){var u=a[l];n(u)&&u.dirtyBoundingBoxCache(),fa(e,uw(u,i))}}return e.x1=zn(e.x1),e.y1=zn(e.y1),e.x2=zn(e.x2),e.y2=zn(e.y2),e.w=zn(e.x2-e.x1),e.h=zn(e.y2-e.y1),e};Ra.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};Ra.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)),Ot(t)){var a=t;t=function(){return a}}var s=function(c,d){return c._private.bbAtOldPos=t(c,d)},o=function(c){return c._private.bbAtOldPos};r.startBatch(),e.forEach(s).silentPositions(t),n&&(i.dirtyCompoundBoundsCache(),i.dirtyBoundingBoxCache(),i.updateCompoundBounds(!0));var l=fA(this.boundingBox({useCache:!1}));return e.silentPositions(o),n&&(i.dirtyCompoundBoundsCache(),i.dirtyBoundingBoxCache(),i.updateCompoundBounds(!0)),r.endBatch(),l};xo.boundingbox=xo.bb=xo.boundingBox;xo.renderedBoundingbox=xo.renderedBoundingBox;var O4=Ra,Ol,fu;Ol=fu={};var z_=function(e){e.uppercaseName=E1(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=E1(e.outerName),Ol[e.name]=function(){var n=this[0],i=n._private,a=i.cy,s=a._private.styleEnabled;if(n)if(s){if(n.isParent())return n.updateCompoundBounds(),i[e.autoName]||0;var o=n.pstyle(e.name);switch(o.strValue){case"label":return n.recalculateRenderedStyle(),i.rstyle[e.labelName]||0;default:return o.pfValue}}else return 1},Ol["outer"+e.uppercaseName]=function(){var n=this[0],i=n._private,a=i.cy,s=a._private.styleEnabled;if(n)if(s){var o=n[e.name](),l=n.pstyle("border-position").value,u;l==="center"?u=n.pstyle("border-width").pfValue:l==="outside"?u=2*n.pstyle("border-width").pfValue:u=0;var c=2*n.padding();return o+u+c}else return 1},Ol["rendered"+e.uppercaseName]=function(){var n=this[0];if(n){var i=n[e.name]();return i*this.cy().zoom()}},Ol["rendered"+e.uppercaseOuterName]=function(){var n=this[0];if(n){var i=n[e.outerName]();return i*this.cy().zoom()}}};z_({name:"width"});z_({name:"height"});fu.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};fu.paddedHeight=function(){var t=this[0];return t.height()+2*t.padding()};fu.paddedWidth=function(){var t=this[0];return t.width()+2*t.padding()};var j4=fu,I4=function(e,r){if(e.isEdge()&&e.takesUpSpace())return r(e)},B4=function(e,r){if(e.isEdge()&&e.takesUpSpace()){var n=e.cy();return Kd(r(e),n.zoom(),n.pan())}},F4=function(e,r){if(e.isEdge()&&e.takesUpSpace()){var n=e.cy(),i=n.pan(),a=n.zoom();return r(e).map(function(s){return Kd(s,a,i)})}},z4=function(e){return e.renderer().getControlPoints(e)},$4=function(e){return e.renderer().getSegmentPoints(e)},H4=function(e){return e.renderer().getSourceEndpoint(e)},U4=function(e){return e.renderer().getTargetEndpoint(e)},W4=function(e){return e.renderer().getEdgeMidpoint(e)},hw={controlPoints:{get:z4,mult:!0},segmentPoints:{get:$4,mult:!0},sourceEndpoint:{get:H4},targetEndpoint:{get:U4},midpoint:{get:W4}},V4=function(e){return"rendered"+e[0].toUpperCase()+e.substr(1)},G4=Object.keys(hw).reduce(function(t,e){var r=hw[e],n=V4(e);return t[e]=function(){return I4(this,r.get)},r.mult?t[n]=function(){return F4(this,r.get)}:t[n]=function(){return B4(this,r.get)},t},{}),q4=mt({},D4,O4,j4,G4);/*!
|
|
58
|
+
Event object based on jQuery events, MIT license
|
|
59
|
+
|
|
60
|
+
https://jquery.org/license/
|
|
61
|
+
https://tldrlegal.com/license/mit-license
|
|
62
|
+
https://github.com/jquery/jquery/blob/master/src/event.js
|
|
63
|
+
*/var $_=function(e,r){this.recycle(e,r)};function Sl(){return!1}function Vc(){return!0}$_.prototype={instanceString:function(){return"event"},recycle:function(e,r){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=Sl,e!=null&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?Vc:Sl):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(),a=this.cy.pan();this.renderedPosition={x:n.x*i+a.x,y:n.y*i+a.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=Vc;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=Vc;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Vc,this.stopPropagation()},isDefaultPrevented:Sl,isPropagationStopped:Sl,isImmediatePropagationStopped:Sl};var H_=/^([^.]+)(\.(?:[^.]+))?$/,Y4=".*",U_={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},fw=Object.keys(U_),K4={};function rh(){for(var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:K4,e=arguments.length>1?arguments[1]:void 0,r=0;r<fw.length;r++){var n=fw[r];this[n]=t[n]||U_[n]}this.context=e||this.context,this.listeners=[],this.emitting=0}var Ca=rh.prototype,W_=function(e,r,n,i,a,s,o){cr(i)&&(a=i,i=null),o&&(s==null?s=o:s=mt({},s,o));for(var l=Yt(n)?n:n.split(/\s+/),u=0;u<l.length;u++){var c=l[u];if(!xa(c)){var d=c.match(H_);if(d){var p=d[1],f=d[2]?d[2]:null,x=r(e,c,p,f,i,a,s);if(x===!1)break}}}},pw=function(e,r){return e.addEventFields(e.context,r),new $_(r.type,r)},X4=function(e,r,n){if(eD(n)){r(e,n);return}else if(Ot(n)){r(e,pw(e,n));return}for(var i=Yt(n)?n:n.split(/\s+/),a=0;a<i.length;a++){var s=i[a];if(!xa(s)){var o=s.match(H_);if(o){var l=o[1],u=o[2]?o[2]:null,c=pw(e,{type:l,namespace:u,target:e.context});r(e,c)}}}};Ca.on=Ca.addListener=function(t,e,r,n,i){return W_(this,function(a,s,o,l,u,c,d){cr(c)&&a.listeners.push({event:s,callback:c,type:o,namespace:l,qualifier:u,conf:d})},t,e,r,n,i),this};Ca.one=function(t,e,r,n){return this.on(t,e,r,n,{one:!0})};Ca.removeListener=Ca.off=function(t,e,r,n){var i=this;this.emitting!==0&&(this.listeners=jD(this.listeners));for(var a=this.listeners,s=function(u){var c=a[u];W_(i,function(d,p,f,x,S,v){if((c.type===f||t==="*")&&(!x&&c.namespace!==".*"||c.namespace===x)&&(!S||d.qualifierCompare(c.qualifier,S))&&(!v||c.callback===v))return a.splice(u,1),!1},t,e,r,n)},o=a.length-1;o>=0;o--)s(o);return this};Ca.removeAllListeners=function(){return this.removeListener("*")};Ca.emit=Ca.trigger=function(t,e,r){var n=this.listeners,i=n.length;return this.emitting++,Yt(e)||(e=[e]),X4(this,function(a,s){r!=null&&(n=[{event:s.event,type:s.type,namespace:s.namespace,callback:r}],i=n.length);for(var o=function(){var c=n[l];if(c.type===s.type&&(!c.namespace||c.namespace===s.namespace||c.namespace===Y4)&&a.eventMatches(a.context,c,s)){var d=[s];e!=null&&BD(d,e),a.beforeEmit(a.context,c,s),c.conf&&c.conf.one&&(a.listeners=a.listeners.filter(function(x){return x!==c}));var p=a.callbackContext(a.context,c,s),f=c.callback.apply(p,d);a.afterEmit(a.context,c,s),f===!1&&(s.stopPropagation(),s.preventDefault())}},l=0;l<i;l++)o();a.bubble(a.context)&&!s.isPropagationStopped()&&a.parent(a.context).emit(s,e)},t),this.emitting--,this};var Q4={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&&ou(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()}},Gc=function(e){return ht(e)?new Sa(e):e},V_={createEmitter:function(){for(var e=0;e<this.length;e++){var r=this[e],n=r._private;n.emitter||(n.emitter=new rh(Q4,r))}return this},emitter:function(){return this._private.emitter},on:function(e,r,n){for(var i=Gc(r),a=0;a<this.length;a++){var s=this[a];s.emitter().on(e,i,n)}return this},removeListener:function(e,r,n){for(var i=Gc(r),a=0;a<this.length;a++){var s=this[a];s.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=Gc(r),a=0;a<this.length;a++){var s=this[a];s.emitter().one(e,i,n)}return this},once:function(e,r,n){for(var i=Gc(r),a=0;a<this.length;a++){var s=this[a];s.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}};$t.eventAliasesOn(V_);var G_={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(ht(e)||Nn(e))return new Sa(e).filter(this);if(cr(e)){for(var n=this.spawn(),i=this,a=0;a<i.length;a++){var s=i[a],o=r?e.apply(r,[s,a,i]):e(s,a,i);o&&n.push(s)}return n}return this.spawn()},not:function(e){if(e){ht(e)&&(e=this.filter(e));for(var r=this.spawn(),n=0;n<this.length;n++){var i=this[n],a=e.has(i);a||r.push(i)}return r}else return this},absoluteComplement:function(){var e=this.cy();return e.mutableElements().not(this)},intersect:function(e){if(ht(e)){var r=e;return this.filter(r)}for(var n=this.spawn(),i=this,a=e,s=this.length<e.length,o=s?i:a,l=s?a:i,u=0;u<o.length;u++){var c=o[u];l.has(c)&&n.push(c)}return n},xor:function(e){var r=this._private.cy;ht(e)&&(e=r.$(e));var n=this.spawn(),i=this,a=e,s=function(l,u){for(var c=0;c<l.length;c++){var d=l[c],p=d._private.data.id,f=u.hasElementWithId(p);f||n.push(d)}};return s(i,a),s(a,i),n},diff:function(e){var r=this._private.cy;ht(e)&&(e=r.$(e));var n=this.spawn(),i=this.spawn(),a=this.spawn(),s=this,o=e,l=function(c,d,p){for(var f=0;f<c.length;f++){var x=c[f],S=x._private.data.id,v=d.hasElementWithId(S);v?a.merge(x):p.push(x)}};return l(s,o,n),l(o,s,i),{left:n,right:i,both:a}},add:function(e){var r=this._private.cy;if(!e)return this;if(ht(e)){var n=e;e=r.mutableElements().filter(n)}for(var i=this.spawnSelf(),a=0;a<e.length;a++){var s=e[a],o=!this.has(s);o&&i.push(s)}return i},merge:function(e){var r=this._private,n=r.cy;if(!e)return this;if(e&&ht(e)){var i=e;e=n.mutableElements().filter(i)}for(var a=r.map,s=0;s<e.length;s++){var o=e[s],l=o._private.data.id,u=!a.has(l);if(u){var c=this.length++;this[c]=o,a.set(l,{ele:o,index:c})}}return this},unmergeAt:function(e){var r=this[e],n=r.id(),i=this._private,a=i.map;this[e]=void 0,a.delete(n);var s=e===this.length-1;if(this.length>1&&!s){var o=this.length-1,l=this[o],u=l._private.data.id;this[o]=void 0,this[e]=l,a.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,a=i.get(n);if(!a)return this;var s=a.index;return this.unmergeAt(s),this},unmerge:function(e){var r=this._private.cy;if(!e)return this;if(e&&ht(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,a=0;a<i.length;a++){var s=i[a],o=r?e.apply(r,[s,a,i]):e(s,a,i);n.push(o)}return n},reduce:function(e,r){for(var n=r,i=this,a=0;a<i.length;a++)n=e(n,i[a],a,i);return n},max:function(e,r){for(var n=-1/0,i,a=this,s=0;s<a.length;s++){var o=a[s],l=r?e.apply(r,[o,s,a]):e(o,s,a);l>n&&(n=l,i=o)}return{value:n,ele:i}},min:function(e,r){for(var n=1/0,i,a=this,s=0;s<a.length;s++){var o=a[s],l=r?e.apply(r,[o,s,a]):e(o,s,a);l<n&&(n=l,i=o)}return{value:n,ele:i}}},Bt=G_;Bt.u=Bt["|"]=Bt["+"]=Bt.union=Bt.or=Bt.add;Bt["\\"]=Bt["!"]=Bt["-"]=Bt.difference=Bt.relativeComplement=Bt.subtract=Bt.not;Bt.n=Bt["&"]=Bt["."]=Bt.and=Bt.intersection=Bt.intersect;Bt["^"]=Bt["(+)"]=Bt["(-)"]=Bt.symmetricDifference=Bt.symdiff=Bt.xor;Bt.fnFilter=Bt.filterFn=Bt.stdFilter=Bt.filter;Bt.complement=Bt.abscomp=Bt.absoluteComplement;var Z4={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}},q_=function(e,r){var n=e.cy(),i=n.hasCompoundNodes();function a(c){var d=c.pstyle("z-compound-depth");return d.value==="auto"?i?c.zDepth():0:d.value==="bottom"?-1:d.value==="top"?Cm:0}var s=a(e)-a(r);if(s!==0)return s;function o(c){var d=c.pstyle("z-index-compare");return d.value==="auto"&&c.isNode()?1:0}var l=o(e)-o(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()},Ld={forEach:function(e,r){if(cr(e))for(var n=this.length,i=0;i<n;i++){var a=this[i],s=r?e.apply(r,[a,i,this]):e(a,i,this);if(s===!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 a=e;a>=0&&a<r&&a<i;a++)n.push(this[a]);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(!cr(e))return this;var r=this.toArray().sort(e);return this.spawn(r)},sortByZIndex:function(){return this.sort(q_)},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:Cm-1}else{var a=r.source,s=r.target,o=a.zDepth(),l=s.zDepth();return Math.max(o,l,0)}}}};Ld.each=Ld.forEach;var J4=function(){var e="undefined",r=(typeof Symbol>"u"?"undefined":kr(Symbol))!=e&&kr(Symbol.iterator)!=e;r&&(Ld[Symbol.iterator]=function(){var n=this,i={value:void 0,done:!1},a=0,s=this.length;return US({next:function(){return a<s?i.value=n[a++]:(i.value=void 0,i.done=!0),i}},Symbol.iterator,function(){return this})})};J4();var eP=zr({nodeDimensionsIncludeLabels:!1}),ld={layoutDimensions:function(e){e=eP(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(T){return!T.isParent()}),a=this.cy(),s=r.eles,o=function(N){return N.id()},l=bo(n,o);e.emit({type:"layoutstart",layout:e}),e.animations=[];var u=function(N,E,k){var L={x:E.x1+E.w/2,y:E.y1+E.h/2},A={x:(k.x-L.x)*N,y:(k.y-L.y)*N};return{x:L.x+A.x,y:L.y+A.y}},c=r.spacingFactor&&r.spacingFactor!==1,d=function(){if(!c)return null;for(var N=sn(),E=0;E<i.length;E++){var k=i[E],L=l(k,E);d_(N,L.x,L.y)}return N},p=d(),f=bo(function(T,N){var E=l(T,N);if(c){var k=Math.abs(r.spacingFactor);E=u(k,p,E)}return r.transform!=null&&(E=r.transform(T,E)),E},o);if(r.animate){for(var x=0;x<i.length;x++){var S=i[x],v=f(S,x),m=r.animateFilter==null||r.animateFilter(S,x);if(m){var b=S.animation({position:v,duration:r.animationDuration,easing:r.animationEasing});e.animations.push(b)}else S.position(v)}if(r.fit){var w=a.animation({fit:{boundingBox:s.boundingBoxAt(f),padding:r.padding},duration:r.animationDuration,easing:r.animationEasing});e.animations.push(w)}else if(r.zoom!==void 0&&r.pan!==void 0){var _=a.animation({zoom:r.zoom,pan:r.pan,duration:r.animationDuration,easing:r.animationEasing});e.animations.push(_)}e.animations.forEach(function(T){return T.play()}),e.one("layoutready",r.ready),e.emit({type:"layoutready",layout:e}),To.all(e.animations.map(function(T){return T.promise()})).then(function(){e.one("layoutstop",r.stop),e.emit({type:"layoutstop",layout:e})})}else i.positions(f),r.fit&&a.fit(r.eles,r.padding),r.zoom!=null&&a.zoom(r.zoom),r.pan&&a.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(mt({},e,{eles:this}))}};ld.createLayout=ld.makeLayout=ld.layout;function Y_(t,e,r){var n=r._private,i=n.styleCache=n.styleCache||[],a;return(a=i[t])!=null||(a=i[t]=e(r)),a}function nh(t,e){return t=ds(t),function(n){return Y_(t,e,n)}}function ih(t,e){t=ds(t);var r=function(i){return e.call(i)};return function(){var i=this[0];if(i)return Y_(t,r,i)}}var Br={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(a){return a._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(),a=this;e=!!(e||e===void 0),i&&(a=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var s=a;return e?s.emitAndNotify("style"):s.emit("style"),a.forEach(function(o){return o._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 a=n._private.style[e];return a??(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,a=n.style();if(Ot(e)){var s=e;a.applyBypass(this,s,i),this.emitAndNotify("style")}else if(ht(e))if(r===void 0){var o=this[0];return o?a.getStylePropertyValue(o,e):void 0}else a.applyBypass(this,e,r,i),this.emitAndNotify("style");else if(e===void 0){var l=this[0];return l?a.getRawStyle(l):void 0}return this},removeStyle:function(e){var r=this.cy();if(!r.styleEnabled())return this;var n=!1,i=r.style(),a=this;if(e===void 0)for(var s=0;s<a.length;s++){var o=a[s];i.removeAllBypasses(o,n)}else{e=e.split(/\s+/);for(var l=0;l<a.length;l++){var u=a[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,a=n.pstyle("opacity").value;if(!r)return a;var s=i.data.parent?n.parents():null;if(s)for(var o=0;o<s.length;o++){var l=s[o],u=l.pstyle("opacity").value;a=u*a}return a}},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 Ug(t,e){var r=t._private,n=r.data.parent?t.parents():null;if(n)for(var i=0;i<n.length;i++){var a=n[i];if(!e(a))return!1}return!0}function jm(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 a=this[0],s=i.hasCompoundNodes();if(a){var o=a._private;if(!e(a))return!1;if(a.isNode())return!s||Ug(a,n);var l=o.source,u=o.target;return r(l)&&(!s||Ug(l,r))&&(l===u||r(u)&&(!s||Ug(u,r)))}}}var No=nh("eleTakesUpSpace",function(t){return t.pstyle("display").value==="element"&&t.width()!==0&&(t.isNode()?t.height()!==0:!0)});Br.takesUpSpace=ih("takesUpSpace",jm({ok:No}));var tP=nh("eleInteractive",function(t){return t.pstyle("events").value==="yes"&&t.pstyle("visibility").value==="visible"&&No(t)}),rP=nh("parentInteractive",function(t){return t.pstyle("visibility").value==="visible"&&No(t)});Br.interactive=ih("interactive",jm({ok:tP,parentOk:rP,edgeOkViaNode:No}));Br.noninteractive=function(){var t=this[0];if(t)return!t.interactive()};var nP=nh("eleVisible",function(t){return t.pstyle("visibility").value==="visible"&&t.pstyle("opacity").pfValue!==0&&No(t)}),iP=No;Br.visible=ih("visible",jm({ok:nP,edgeOkViaNode:iP}));Br.hidden=function(){var t=this[0];if(t)return!t.visible()};Br.isBundledBezier=ih("isBundledBezier",function(){return this.cy().styleEnabled()?!this.removed()&&this.pstyle("curve-style").value==="bezier"&&this.takesUpSpace():!1});Br.bypass=Br.css=Br.style;Br.renderedCss=Br.renderedStyle;Br.removeBypass=Br.removeCss=Br.removeStyle;Br.pstyle=Br.parsedStyle;var ya={};function gw(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&&cr(e[0])){var a=e[0];this.on(t.event,a)}else if(e.length===0||e.length===1&&Yt(e[0])){for(var s=e.length===1?e[0]:null,o=0;o<this.length;o++){var l=this[o],u=!t.ableField||l._private[t.ableField],c=l._private[t.field]!=t.value;if(t.overrideAble){var d=t.overrideAble(l);if(d!==void 0&&(u=d,!d))return this}u&&(l._private[t.field]=t.value,c&&r.push(l))}var p=this.spawn(r);p.updateStyle(),p.emit(t.event),s&&p.emit(s)}return this}}function Ro(t){ya[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]}},ya[t.on]=gw({event:t.on,field:t.field,ableField:t.ableField,overrideAble:t.overrideAble,value:!0}),ya[t.off]=gw({event:t.off,field:t.field,ableField:t.ableField,overrideAble:t.overrideAble,value:!1})}Ro({field:"locked",overrideField:function(e){return e.cy().autolock()?!0:void 0},on:"lock",off:"unlock"});Ro({field:"grabbable",overrideField:function(e){return e.cy().autoungrabify()||e.pannable()?!1:void 0},on:"grabify",off:"ungrabify"});Ro({field:"selected",ableField:"selectable",overrideAble:function(e){return e.cy().autounselectify()?!1:void 0},on:"select",off:"unselect"});Ro({field:"selectable",overrideField:function(e){return e.cy().autounselectify()?!1:void 0},on:"selectify",off:"unselectify"});ya.deselect=ya.unselect;ya.grabbed=function(){var t=this[0];if(t)return t._private.grabbed};Ro({field:"active",on:"activate",off:"unactivate"});Ro({field:"pannable",on:"panify",off:"unpanify"});ya.inactive=function(){var t=this[0];if(t)return!t._private.active};var qr={},vw=function(e){return function(n){for(var i=this,a=[],s=0;s<i.length;s++){var o=i[s];if(o.isNode()){for(var l=!1,u=o.connectedEdges(),c=0;c<u.length;c++){var d=u[c],p=d.source(),f=d.target();if(e.noIncomingEdges&&f===o&&p!==o||e.noOutgoingEdges&&p===o&&f!==o){l=!0;break}}l||a.push(o)}}return this.spawn(a,!0).filter(n)}},mw=function(e){return function(r){for(var n=this,i=[],a=0;a<n.length;a++){var s=n[a];if(s.isNode())for(var o=s.connectedEdges(),l=0;l<o.length;l++){var u=o[l],c=u.source(),d=u.target();e.outgoing&&c===s?(i.push(u),i.push(d)):e.incoming&&d===s&&(i.push(u),i.push(c))}}return this.spawn(i,!0).filter(r)}},yw=function(e){return function(r){for(var n=this,i=[],a={};;){var s=e.outgoing?n.outgoers():n.incomers();if(s.length===0)break;for(var o=!1,l=0;l<s.length;l++){var u=s[l],c=u.id();a[c]||(a[c]=!0,i.push(u),o=!0)}if(!o)break;n=s}return this.spawn(i,!0).filter(r)}};qr.clearTraversalCache=function(){for(var t=0;t<this.length;t++)this[t]._private.traversalCache=null};mt(qr,{roots:vw({noIncomingEdges:!0}),leaves:vw({noOutgoingEdges:!0}),outgoers:Hn(mw({outgoing:!0}),"outgoers"),successors:yw({outgoing:!0}),incomers:Hn(mw({incoming:!0}),"incomers"),predecessors:yw({})});mt(qr,{neighborhood:Hn(function(t){for(var e=[],r=this.nodes(),n=0;n<r.length;n++)for(var i=r[n],a=i.connectedEdges(),s=0;s<a.length;s++){var o=a[s],l=o.source(),u=o.target(),c=i===l?u:l;c.length>0&&e.push(c[0]),e.push(o[0])}return this.spawn(e,!0).filter(t)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}});qr.neighbourhood=qr.neighborhood;qr.closedNeighbourhood=qr.closedNeighborhood;qr.openNeighbourhood=qr.openNeighborhood;mt(qr,{source:Hn(function(e){var r=this[0],n;return r&&(n=r._private.source||r.cy().collection()),n&&e?n.filter(e):n},"source"),target:Hn(function(e){var r=this[0],n;return r&&(n=r._private.target||r.cy().collection()),n&&e?n.filter(e):n},"target"),sources:xw({attr:"source"}),targets:xw({attr:"target"})});function xw(t){return function(r){for(var n=[],i=0;i<this.length;i++){var a=this[i],s=a._private[t.attr];s&&n.push(s)}return this.spawn(n,!0).filter(r)}}mt(qr,{edgesWith:Hn(bw(),"edgesWith"),edgesTo:Hn(bw({thisIsSrc:!0}),"edgesTo")});function bw(t){return function(r){var n=[],i=this._private.cy,a=t||{};ht(r)&&(r=i.$(r));for(var s=0;s<r.length;s++)for(var o=r[s]._private.edges,l=0;l<o.length;l++){var u=o[l],c=u._private.data,d=this.hasElementWithId(c.source)&&r.hasElementWithId(c.target),p=r.hasElementWithId(c.source)&&this.hasElementWithId(c.target),f=d||p;f&&((a.thisIsSrc||a.thisIsTgt)&&(a.thisIsSrc&&!d||a.thisIsTgt&&!p)||n.push(u))}return this.spawn(n,!0)}}mt(qr,{connectedEdges:Hn(function(t){for(var e=[],r=this,n=0;n<r.length;n++){var i=r[n];if(i.isNode())for(var a=i._private.edges,s=0;s<a.length;s++){var o=a[s];e.push(o)}}return this.spawn(e,!0).filter(t)},"connectedEdges"),connectedNodes:Hn(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:Hn(ww(),"parallelEdges"),codirectedEdges:Hn(ww({codirected:!0}),"codirectedEdges")});function ww(t){var e={codirected:!1};return t=mt({},e,t),function(n){for(var i=[],a=this.edges(),s=t,o=0;o<a.length;o++)for(var l=a[o],u=l._private,c=u.source,d=c._private.data.id,p=u.data.target,f=c._private.edges,x=0;x<f.length;x++){var S=f[x],v=S._private.data,m=v.target,b=v.source,w=m===p&&b===d,_=d===m&&p===b;(s.codirected&&w||!s.codirected&&(w||_))&&i.push(S)}return this.spawn(i,!0).filter(n)}}mt(qr,{components:function(e){var r=this,n=r.cy(),i=n.collection(),a=e==null?r.nodes():e.nodes(),s=[];e!=null&&a.empty()&&(a=e.sources());var o=function(c,d){i.merge(c),a.unmerge(c),d.merge(c)};if(a.empty())return r.spawn();var l=function(){var c=n.collection();s.push(c);var d=a[0];o(d,c),r.bfs({directed:!1,roots:d,visit:function(f){return o(f,c)}}),c.forEach(function(p){p.connectedEdges().forEach(function(f){r.has(f)&&c.has(f.source())&&c.has(f.target())&&c.merge(f)})})};do l();while(a.length>0);return s},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}});qr.componentsOf=qr.components;var Fr=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){sr("A collection must have a reference to the core");return}var a=new Ii,s=!1;if(!r)r=[];else if(r.length>0&&Ot(r[0])&&!ou(r[0])){s=!0;for(var o=[],l=new Eo,u=0,c=r.length;u<c;u++){var d=r[u];d.data==null&&(d.data={});var p=d.data;if(p.id==null)p.id=o_();else if(e.hasElementWithId(p.id)||l.has(p.id))continue;var f=new Yd(e,d,!1);o.push(f),l.add(p.id)}r=o}this.length=0;for(var x=0,S=r.length;x<S;x++){var v=r[x][0];if(v!=null){var m=v._private.data.id;(!n||!a.has(m))&&(n&&a.set(m,{index:this.length,ele:v}),this[this.length]=v,this.length++)}}this._private={eles:this,cy:e,get map(){return this.lazyMap==null&&this.rebuildMap(),this.lazyMap},set map(b){this.lazyMap=b},rebuildMap:function(){for(var w=this.lazyMap=new Ii,_=this.eles,T=0;T<_.length;T++){var N=_[T];w.set(N.id(),{index:T,ele:N})}}},n&&(this._private.map=a),s&&!i&&this.restore()},er=Yd.prototype=Fr.prototype=Object.create(Array.prototype);er.instanceString=function(){return"collection"};er.spawn=function(t,e){return new Fr(this.cy(),t,e)};er.spawnSelf=function(){return this.spawn(this)};er.cy=function(){return this._private.cy};er.renderer=function(){return this._private.cy.renderer()};er.element=function(){return this[0]};er.collection=function(){return qS(this)?this:new Fr(this._private.cy,[this])};er.unique=function(){return new Fr(this._private.cy,this,!0)};er.hasElementWithId=function(t){return t=""+t,this._private.map.has(t)};er.getElementById=function(t){t=""+t;var e=this._private.cy,r=this._private.map.get(t);return r?r.ele:new Fr(e)};er.$id=er.getElementById;er.poolIndex=function(){var t=this._private.cy,e=t._private.elements,r=this[0]._private.data.id;return e._private.map.get(r).index};er.indexOf=function(t){var e=t[0]._private.data.id;return this._private.map.get(e).index};er.indexOfId=function(t){return t=""+t,this._private.map.get(t).index};er.json=function(t){var e=this.element(),r=this.cy();if(e==null&&t)return this;if(e!=null){var n=e._private;if(Ot(t)){if(r.startBatch(),t.data){e.data(t.data);var i=n.data;if(e.isEdge()){var a=!1,s={},o=t.data.source,l=t.data.target;o!=null&&o!=i.source&&(s.source=""+o,a=!0),l!=null&&l!=i.target&&(s.target=""+l,a=!0),a&&(e=e.move(s))}else{var u="parent"in t.data,c=t.data.parent;u&&(c!=null||i.parent!=null)&&c!=i.parent&&(c===void 0&&(c=null),c!=null&&(c=""+c),e=e.move({parent:c}))}}t.position&&e.position(t.position);var d=function(S,v,m){var b=t[S];b!=null&&b!==n[S]&&(b?e[v]():e[m]())};return d("removed","remove","restore"),d("selected","select","unselect"),d("selectable","selectify","unselectify"),d("locked","lock","unlock"),d("grabbable","grabify","ungrabify"),d("pannable","panify","unpanify"),t.classes!=null&&e.classes(t.classes),r.endBatch(),this}else if(t===void 0){var p={data:bi(n.data),position:bi(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};p.classes="";var f=0;return n.classes.forEach(function(x){return p.classes+=f++===0?x:" "+x}),p}}};er.jsons=function(){for(var t=[],e=0;e<this.length;e++){var r=this[e],n=r.json();t.push(n)}return t};er.clone=function(){for(var t=this.cy(),e=[],r=0;r<this.length;r++){var n=this[r],i=n.json(),a=new Yd(t,i,!1);e.push(a)}return new Fr(t,e)};er.copy=er.clone;er.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,a=[],s=[],o,l=0,u=r.length;l<u;l++){var c=r[l];e&&!c.removed()||(c.isNode()?a.push(c):s.push(c))}o=a.concat(s);var d,p=function(){o.splice(d,1),d--};for(d=0;d<o.length;d++){var f=o[d],x=f._private,S=x.data;if(f.clearTraversalCache(),!(!e&&!x.removed)){if(S.id===void 0)S.id=o_();else if(Ke(S.id))S.id=""+S.id;else if(xa(S.id)||!ht(S.id)){sr("Can not create element with invalid string ID `"+S.id+"`"),p();continue}else if(n.hasElementWithId(S.id)){sr("Can not create second element with ID `"+S.id+"`"),p();continue}}var v=S.id;if(f.isNode()){var m=x.position;m.x==null&&(m.x=0),m.y==null&&(m.y=0)}if(f.isEdge()){for(var b=f,w=["source","target"],_=w.length,T=!1,N=0;N<_;N++){var E=w[N],k=S[E];Ke(k)&&(k=S[E]=""+S[E]),k==null||k===""?(sr("Can not create edge `"+v+"` with unspecified "+E),T=!0):n.hasElementWithId(k)||(sr("Can not create edge `"+v+"` with nonexistent "+E+" `"+k+"`"),T=!0)}if(T){p();continue}var L=n.getElementById(S.source),A=n.getElementById(S.target);L.same(A)?L._private.edges.push(b):(L._private.edges.push(b),A._private.edges.push(b)),b._private.source=L,b._private.target=A}x.map=new Ii,x.map.set(v,{ele:f,index:0}),x.removed=!1,e&&n.addToPool(f)}for(var M=0;M<a.length;M++){var O=a[M],$=O._private.data;Ke($.parent)&&($.parent=""+$.parent);var D=$.parent,B=D!=null;if(B||O._private.parent){var j=O._private.parent?n.collection().merge(O._private.parent):n.getElementById(D);if(j.empty())$.parent=void 0;else if(j[0].removed())Ht("Node added with missing parent, reference to parent removed"),$.parent=void 0,O._private.parent=null;else{for(var I=!1,U=j;!U.empty();){if(O.same(U)){I=!0,$.parent=void 0;break}U=U.parent()}I||(j[0]._private.children.push(O),O._private.parent=j[0],i.hasCompoundNodes=!0)}}}if(o.length>0){for(var F=o.length===r.length?r:new Fr(n,o),P=0;P<F.length;P++){var H=F[P];H.isNode()||(H.parallelEdges().clearTraversalCache(),H.source().clearTraversalCache(),H.target().clearTraversalCache())}var W;i.hasCompoundNodes?W=n.collection().merge(F).merge(F.connectedNodes()).merge(F.parent()):W=F,W.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(t),t?F.emitAndNotify("add"):e&&F.emit("add")}return r};er.removed=function(){var t=this[0];return t&&t._private.removed};er.inside=function(){var t=this[0];return t&&!t._private.removed};er.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={},a=r._private.cy;function s(D){for(var B=D._private.edges,j=0;j<B.length;j++)l(B[j])}function o(D){for(var B=D._private.children,j=0;j<B.length;j++)l(B[j])}function l(D){var B=i[D.id()];e&&D.removed()||B||(i[D.id()]=!0,D.isNode()?(n.push(D),s(D),o(D)):n.unshift(D))}for(var u=0,c=r.length;u<c;u++){var d=r[u];l(d)}function p(D,B){var j=D._private.edges;ba(j,B),D.clearTraversalCache()}function f(D){D.clearTraversalCache()}var x=[];x.ids={};function S(D,B){B=B[0],D=D[0];var j=D._private.children,I=D.id();ba(j,B),B._private.parent=null,x.ids[I]||(x.ids[I]=!0,x.push(D))}r.dirtyCompoundBoundsCache(),e&&a.removeFromPool(n);for(var v=0;v<n.length;v++){var m=n[v];if(m.isEdge()){var b=m.source()[0],w=m.target()[0];p(b,m),p(w,m);for(var _=m.parallelEdges(),T=0;T<_.length;T++){var N=_[T];f(N),N.isBundledBezier()&&N.dirtyBoundingBoxCache()}}else{var E=m.parent();E.length!==0&&S(E,m)}e&&(m._private.removed=!0)}var k=a._private.elements;a._private.hasCompoundNodes=!1;for(var L=0;L<k.length;L++){var A=k[L];if(A.isParent()){a._private.hasCompoundNodes=!0;break}}var M=new Fr(this.cy(),n);M.size()>0&&(t?M.emitAndNotify("remove"):e&&M.emit("remove"));for(var O=0;O<x.length;O++){var $=x[O];(!e||!$.removed())&&$.updateStyle()}return M};er.move=function(t){var e=this._private.cy,r=this,n=!1,i=!1,a=function(x){return x==null?x:""+x};if(t.source!==void 0||t.target!==void 0){var s=a(t.source),o=a(t.target),l=s!=null&&e.hasElementWithId(s),u=o!=null&&e.hasElementWithId(o);(l||u)&&(e.batch(function(){r.remove(n,i),r.emitAndNotify("moveout");for(var f=0;f<r.length;f++){var x=r[f],S=x._private.data;x.isEdge()&&(l&&(S.source=s),u&&(S.target=o))}r.restore(n,i)}),r.emitAndNotify("move"))}else if(t.parent!==void 0){var c=a(t.parent),d=c===null||e.hasElementWithId(c);if(d){var p=c===null?void 0:c;e.batch(function(){var f=r.remove(n,i);f.emitAndNotify("moveout");for(var x=0;x<r.length;x++){var S=r[x],v=S._private.data;S.isNode()&&(v.parent=p)}f.restore(n,i)}),r.emitAndNotify("move")}}return this};[b_,p4,od,ma,So,L4,th,q4,V_,G_,Z4,Ld,ld,Br,ya,qr].forEach(function(t){mt(er,t)});var aP={add:function(e){var r,n=this;if(Nn(e)){var i=e;if(i._private.cy===n)r=i.restore();else{for(var a=[],s=0;s<i.length;s++){var o=i[s];a.push(o.json())}r=new Fr(n,a)}}else if(Yt(e)){var l=e;r=new Fr(n,l)}else if(Ot(e)&&(Yt(e.nodes)||Yt(e.edges))){for(var u=e,c=[],d=["nodes","edges"],p=0,f=d.length;p<f;p++){var x=d[p],S=u[x];if(Yt(S))for(var v=0,m=S.length;v<m;v++){var b=mt({group:x},S[v]);c.push(b)}}r=new Fr(n,c)}else{var w=e;r=new Yd(n,w).collection()}return r},remove:function(e){if(!Nn(e)){if(ht(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 sP(t,e,r,n){var i=4,a=.001,s=1e-7,o=10,l=11,u=1/(l-1),c=typeof Float32Array<"u";if(arguments.length!==4)return!1;for(var d=0;d<4;++d)if(typeof arguments[d]!="number"||isNaN(arguments[d])||!isFinite(arguments[d]))return!1;t=Math.min(t,1),r=Math.min(r,1),t=Math.max(t,0),r=Math.max(r,0);var p=c?new Float32Array(l):new Array(l);function f(A,M){return 1-3*M+3*A}function x(A,M){return 3*M-6*A}function S(A){return 3*A}function v(A,M,O){return((f(M,O)*A+x(M,O))*A+S(M))*A}function m(A,M,O){return 3*f(M,O)*A*A+2*x(M,O)*A+S(M)}function b(A,M){for(var O=0;O<i;++O){var $=m(M,t,r);if($===0)return M;var D=v(M,t,r)-A;M-=D/$}return M}function w(){for(var A=0;A<l;++A)p[A]=v(A*u,t,r)}function _(A,M,O){var $,D,B=0;do D=M+(O-M)/2,$=v(D,t,r)-A,$>0?O=D:M=D;while(Math.abs($)>s&&++B<o);return D}function T(A){for(var M=0,O=1,$=l-1;O!==$&&p[O]<=A;++O)M+=u;--O;var D=(A-p[O])/(p[O+1]-p[O]),B=M+D*u,j=m(B,t,r);return j>=a?b(A,B):j===0?B:_(A,M,M+u)}var N=!1;function E(){N=!0,(t!==e||r!==n)&&w()}var k=function(M){return N||E(),t===e&&r===n?M:M===0?0:M===1?1:v(T(M),e,n)};k.getControlPoints=function(){return[{x:t,y:e},{x:r,y:n}]};var L="generateBezier("+[t,e,r,n]+")";return k.toString=function(){return L},k}/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */var oP=(function(){function t(n){return-n.tension*n.x-n.friction*n.v}function e(n,i,a){var s={x:n.x+a.dx*i,v:n.v+a.dv*i,tension:n.tension,friction:n.friction};return{dx:s.v,dv:t(s)}}function r(n,i){var a={dx:n.v,dv:t(n)},s=e(n,i*.5,a),o=e(n,i*.5,s),l=e(n,i,o),u=1/6*(a.dx+2*(s.dx+o.dx)+l.dx),c=1/6*(a.dv+2*(s.dv+o.dv)+l.dv);return n.x=n.x+u*i,n.v=n.v+c*i,n}return function n(i,a,s){var o={x:-1,v:0,tension:null,friction:null},l=[0],u=0,c=1/1e4,d=16/1e3,p,f,x;for(i=parseFloat(i)||500,a=parseFloat(a)||20,s=s||null,o.tension=i,o.friction=a,p=s!==null,p?(u=n(i,a),f=u/s*d):f=d;x=r(x||o,f),l.push(1+x.x),u+=16,Math.abs(x.x)>c&&Math.abs(x.v)>c;);return p?function(S){return l[S*(l.length-1)|0]}:u}})(),Jt=function(e,r,n,i){var a=sP(e,r,n,i);return function(s,o,l){return s+(o-s)*a(l)}},ud={linear:function(e,r,n){return e+(r-e)*n},ease:Jt(.25,.1,.25,1),"ease-in":Jt(.42,0,1,1),"ease-out":Jt(0,0,.58,1),"ease-in-out":Jt(.42,0,.58,1),"ease-in-sine":Jt(.47,0,.745,.715),"ease-out-sine":Jt(.39,.575,.565,1),"ease-in-out-sine":Jt(.445,.05,.55,.95),"ease-in-quad":Jt(.55,.085,.68,.53),"ease-out-quad":Jt(.25,.46,.45,.94),"ease-in-out-quad":Jt(.455,.03,.515,.955),"ease-in-cubic":Jt(.55,.055,.675,.19),"ease-out-cubic":Jt(.215,.61,.355,1),"ease-in-out-cubic":Jt(.645,.045,.355,1),"ease-in-quart":Jt(.895,.03,.685,.22),"ease-out-quart":Jt(.165,.84,.44,1),"ease-in-out-quart":Jt(.77,0,.175,1),"ease-in-quint":Jt(.755,.05,.855,.06),"ease-out-quint":Jt(.23,1,.32,1),"ease-in-out-quint":Jt(.86,0,.07,1),"ease-in-expo":Jt(.95,.05,.795,.035),"ease-out-expo":Jt(.19,1,.22,1),"ease-in-out-expo":Jt(1,0,0,1),"ease-in-circ":Jt(.6,.04,.98,.335),"ease-out-circ":Jt(.075,.82,.165,1),"ease-in-out-circ":Jt(.785,.135,.15,.86),spring:function(e,r,n){if(n===0)return ud.linear;var i=oP(e,r,n);return function(a,s,o){return a+(s-a)*i(o)}},"cubic-bezier":Jt};function Sw(t,e,r,n,i){if(n===1||e===r)return r;var a=i(e,r,n);return t==null||((t.roundValue||t.color)&&(a=Math.round(a)),t.min!==void 0&&(a=Math.max(a,t.min)),t.max!==void 0&&(a=Math.min(a,t.max))),a}function _w(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 a=i!=null?i.type:null;r<0?r=0:r>1&&(r=1);var s=_w(t,i),o=_w(e,i);if(Ke(s)&&Ke(o))return Sw(a,s,o,r,n);if(Yt(s)&&Yt(o)){for(var l=[],u=0;u<o.length;u++){var c=s[u],d=o[u];if(c!=null&&d!=null){var p=Sw(a,c,d,r,n);l.push(p)}else l.push(d)}return l}}function lP(t,e,r,n){var i=!n,a=t._private,s=e._private,o=s.easing,l=s.startTime,u=n?t:t.cy(),c=u.style();if(!s.easingImpl)if(o==null)s.easingImpl=ud.linear;else{var d;if(ht(o)){var p=c.parse("transition-timing-function",o);d=p.value}else d=o;var f,x;ht(d)?(f=d,x=[]):(f=d[1],x=d.slice(2).map(function(F){return+F})),x.length>0?(f==="spring"&&x.push(s.duration),s.easingImpl=ud[f].apply(null,x)):s.easingImpl=ud[f]}var S=s.easingImpl,v;if(s.duration===0?v=1:v=(r-l)/s.duration,s.applying&&(v=s.progress),v<0?v=0:v>1&&(v=1),s.delay==null){var m=s.startPosition,b=s.position;if(b&&i&&!t.locked()){var w={};_l(m.x,b.x)&&(w.x=Xs(m.x,b.x,v,S)),_l(m.y,b.y)&&(w.y=Xs(m.y,b.y,v,S)),t.position(w)}var _=s.startPan,T=s.pan,N=a.pan,E=T!=null&&n;E&&(_l(_.x,T.x)&&(N.x=Xs(_.x,T.x,v,S)),_l(_.y,T.y)&&(N.y=Xs(_.y,T.y,v,S)),t.emit("pan"));var k=s.startZoom,L=s.zoom,A=L!=null&&n;A&&(_l(k,L)&&(a.zoom=Xl(a.minZoom,Xs(k,L,v,S),a.maxZoom)),t.emit("zoom")),(E||A)&&t.emit("viewport");var M=s.style;if(M&&M.length>0&&i){for(var O=0;O<M.length;O++){var $=M[O],D=$.name,B=$,j=s.startStyle[D],I=c.properties[j.name],U=Xs(j,B,v,S,I);c.overrideBypass(t,D,U)}t.emit("style")}}return s.progress=v,v}function _l(t,e){return t==null||e==null?!1:Ke(t)&&Ke(e)?!0:!!(t&&e)}function uP(t,e,r,n){var i=e._private;i.started=!0,i.startTime=r-i.progress*i.duration}function Cw(t,e){var r=e._private.aniEles,n=[];function i(c,d){var p=c._private,f=p.animation.current,x=p.animation.queue,S=!1;if(f.length===0){var v=x.shift();v&&f.push(v)}for(var m=function(N){for(var E=N.length-1;E>=0;E--){var k=N[E];k()}N.splice(0,N.length)},b=f.length-1;b>=0;b--){var w=f[b],_=w._private;if(_.stopped){f.splice(b,1),_.hooked=!1,_.playing=!1,_.started=!1,m(_.frames);continue}!_.playing&&!_.applying||(_.playing&&_.applying&&(_.applying=!1),_.started||uP(c,w,t),lP(c,w,t,d),_.applying&&(_.applying=!1),m(_.frames),_.step!=null&&_.step(t),w.completed()&&(f.splice(b,1),_.hooked=!1,_.playing=!1,_.started=!1,m(_.completes)),S=!0)}return!d&&f.length===0&&x.length===0&&n.push(c),S}for(var a=!1,s=0;s<r.length;s++){var o=r[s],l=i(o);a=a||l}var u=i(e,!0);(a||u)&&(r.length>0?e.notify("draw",r):e.notify("draw")),r.unmerge(n),e.emit("step")}var cP={animate:$t.animate(),animation:$t.animation(),animated:$t.animated(),clearQueue:$t.clearQueue(),delay:$t.delay(),delayAnimation:$t.delayAnimation(),stop:$t.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&&kd(function(a){Cw(a,e),r()})}var n=e.renderer();n&&n.beforeRender?n.beforeRender(function(a,s){Cw(s,e)},n.beforeRenderPriorities.animations):r()}},dP={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&&ou(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}},qc=function(e){return ht(e)?new Sa(e):e},K_={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new rh(dP,this)),this},emitter:function(){return this._private.emitter},on:function(e,r,n){return this.emitter().on(e,qc(r),n),this},removeListener:function(e,r,n){return this.emitter().removeListener(e,qc(r),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,r,n){return this.emitter().one(e,qc(r),n),this},once:function(e,r,n){return this.emitter().one(e,qc(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}};$t.eventAliasesOn(K_);var Bv={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)}};Bv.jpeg=Bv.jpg;var cd={layout:function(e){var r=this;if(e==null){sr("Layout options must be specified to make a layout");return}if(e.name==null){sr("A `name` must be specified to make a layout");return}var n=e.name,i=r.extension("layout",n);if(i==null){sr("No such layout `"+n+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var a;ht(e.eles)?a=r.$(e.eles):a=e.eles!=null?e.eles:r.$();var s=new i(mt({},e,{cy:r,eles:a}));return s}};cd.createLayout=cd.makeLayout=cd.layout;var hP={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 a=this.renderer();this.destroyed()||!a||a.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 a=n[i],s=e[a],o=r.getElementById(a);o.data(s)}})}},fP=zr({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]}),Fv={renderTo:function(e,r,n,i){var a=this._private.renderer;return a.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){sr("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&&Ht("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=fP(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)}};Fv.invalidateDimensions=Fv.resize;var dd={collection:function(e,r){return ht(e)?this.$(e):Nn(e)?e.collection():Yt(e)?(r||(r={}),new Fr(this,e,r.unique,r.removed)):new Fr(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}};dd.elements=dd.filter=dd.$;var Pr={},Bl="t",pP="f";Pr.apply=function(t){for(var e=this,r=e._private,n=r.cy,i=n.collection(),a=0;a<t.length;a++){var s=t[a],o=e.getContextMeta(s);if(!o.empty){var l=e.getContextStyle(o),u=e.applyContextStyle(o,l,s);s._private.appliedInitStyle?e.updateTransitions(s,u.diffProps):s._private.appliedInitStyle=!0;var c=e.updateStyleHints(s);c&&i.push(s)}}return i};Pr.getPropertiesDiff=function(t,e){var r=this,n=r._private.propDiffs=r._private.propDiffs||{},i=t+"-"+e,a=n[i];if(a)return a;for(var s=[],o={},l=0;l<r.length;l++){var u=r[l],c=t[l]===Bl,d=e[l]===Bl,p=c!==d,f=u.mappedProperties.length>0;if(p||d&&f){var x=void 0;p&&f||p?x=u.properties:f&&(x=u.mappedProperties);for(var S=0;S<x.length;S++){for(var v=x[S],m=v.name,b=!1,w=l+1;w<r.length;w++){var _=r[w],T=e[w]===Bl;if(T&&(b=_.properties[v.name]!=null,b))break}!o[m]&&!b&&(o[m]=!0,s.push(m))}}}return n[i]=s,s};Pr.getContextMeta=function(t){for(var e=this,r="",n,i=t._private.styleCxtKey||"",a=0;a<e.length;a++){var s=e[a],o=s.selector&&s.selector.matches(t);o?r+=Bl:r+=pP}return n=e.getPropertiesDiff(i,r),t._private.styleCxtKey=r,{key:r,diffPropNames:n,empty:n.length===0}};Pr.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}},a=0;a<r.length;a++){var s=r[a],o=e[a]===Bl;if(o)for(var l=0;l<s.properties.length;l++){var u=s.properties[l];i[u.name]=u}}return n[e]=i,i};Pr.applyContextStyle=function(t,e,r){for(var n=this,i=t.diffPropNames,a={},s=n.types,o=0;o<i.length;o++){var l=i[o],u=e[l],c=r.pstyle(l);if(!u)if(c)c.bypass?u={name:l,deleteBypassed:!0}:u={name:l,delete:!0};else continue;if(c!==u){if(u.mapped===s.fn&&c!=null&&c.mapping!=null&&c.mapping.value===u.value){var d=c.mapping,p=d.fnValue=u.value(r);if(p===d.prevFnValue)continue}var f=a[l]={prev:c};n.applyParsedProperty(r,u),f.next=r.pstyle(l),f.next&&f.next.bypass&&(f.next=f.next.bypassed)}}return{diffProps:a}};Pr.updateStyleHints=function(t){var e=t._private,r=this,n=r.propertyGroupNames,i=r.propertyGroupKeys,a=function(ie,le,pe){return r.getPropertiesHash(ie,le,pe)},s=e.styleKey;if(t.removed())return!1;var o=e.group==="nodes",l=t._private.style;n=Object.keys(l);for(var u=0;u<i.length;u++){var c=i[u];e.styleKeys[c]=[as,so]}for(var d=function(ie,le){return e.styleKeys[le][0]=ql(ie,e.styleKeys[le][0])},p=function(ie,le){return e.styleKeys[le][1]=Yl(ie,e.styleKeys[le][1])},f=function(ie,le){d(ie,le),p(ie,le)},x=function(ie,le){for(var pe=0;pe<ie.length;pe++){var Le=ie.charCodeAt(pe);d(Le,le),p(Le,le)}},S=2e9,v=function(ie){return-128<ie&&ie<128&&Math.floor(ie)!==ie?S-(ie*1024|0):ie},m=0;m<n.length;m++){var b=n[m],w=l[b];if(w!=null){var _=this.properties[b],T=_.type,N=_.groupKey,E=void 0;_.hashOverride!=null?E=_.hashOverride(t,w):w.pfValue!=null&&(E=w.pfValue);var k=_.enums==null?w.value:null,L=E!=null,A=k!=null,M=L||A,O=w.units;if(T.number&&M&&!T.multiple){var $=L?E:k;f(v($),N),!L&&O!=null&&x(O,N)}else x(w.strValue,N)}}for(var D=[as,so],B=0;B<i.length;B++){var j=i[B],I=e.styleKeys[j];D[0]=ql(I[0],D[0]),D[1]=Yl(I[1],D[1])}e.styleKey=ND(D[0],D[1]);var U=e.styleKeys;e.labelDimsKey=ca(U.labelDimensions);var F=a(t,["label"],U.labelDimensions);if(e.labelKey=ca(F),e.labelStyleKey=ca(Fc(U.commonLabel,F)),!o){var P=a(t,["source-label"],U.labelDimensions);e.sourceLabelKey=ca(P),e.sourceLabelStyleKey=ca(Fc(U.commonLabel,P));var H=a(t,["target-label"],U.labelDimensions);e.targetLabelKey=ca(H),e.targetLabelStyleKey=ca(Fc(U.commonLabel,H))}if(o){var W=e.styleKeys,V=W.nodeBody,re=W.nodeBorder,J=W.nodeOutline,ne=W.backgroundImage,X=W.compound,q=W.pie,Y=W.stripe,Q=[V,re,J,ne,X,q,Y].filter(function(te){return te!=null}).reduce(Fc,[as,so]);e.nodeKey=ca(Q),e.hasPie=q!=null&&q[0]!==as&&q[1]!==so,e.hasStripe=Y!=null&&Y[0]!==as&&Y[1]!==so}return s!==e.styleKey};Pr.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};Pr.applyParsedProperty=function(t,e){var r=this,n=e,i=t._private.style,a,s=r.types,o=r.properties[n.name].type,l=n.bypass,u=i[n.name],c=u&&u.bypass,d=t._private,p="mapping",f=function(V){return V==null?null:V.pfValue!=null?V.pfValue:V.value},x=function(){var V=f(u),re=f(n);r.checkTriggers(t,n.name,V,re)};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 S=function(){Ht("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 s.mapData:{for(var v=n.field.split("."),m=d.data,b=0;b<v.length&&m;b++){var w=v[b];m=m[w]}if(m==null)return S(),!1;var _;if(Ke(m)){var T=n.fieldMax-n.fieldMin;T===0?_=0:_=(m-n.fieldMin)/T}else return Ht("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),o.color){var N=n.valueMin[0],E=n.valueMax[0],k=n.valueMin[1],L=n.valueMax[1],A=n.valueMin[2],M=n.valueMax[2],O=n.valueMin[3]==null?1:n.valueMin[3],$=n.valueMax[3]==null?1:n.valueMax[3],D=[Math.round(N+(E-N)*_),Math.round(k+(L-k)*_),Math.round(A+(M-A)*_),Math.round(O+($-O)*_)];a={bypass:n.bypass,name:n.name,value:D,strValue:"rgb("+D[0]+", "+D[1]+", "+D[2]+")"}}else if(o.number){var B=n.valueMin+(n.valueMax-n.valueMin)*_;a=this.parse(n.name,B,n.bypass,p)}else return!1;if(!a)return S(),!1;a.mapping=n,n=a;break}case s.data:{for(var j=n.field.split("."),I=d.data,U=0;U<j.length&&I;U++){var F=j[U];I=I[F]}if(I!=null&&(a=this.parse(n.name,I,n.bypass,p)),!a)return S(),!1;a.mapping=n,n=a;break}case s.fn:{var P=n.value,H=n.fnValue!=null?n.fnValue:P(t);if(n.prevFnValue=H,H==null)return Ht("Custom function mappers may not return null (i.e. `"+n.name+"` for ele `"+t.id()+"` is null)"),!1;if(a=this.parse(n.name,H,n.bypass,p),!a)return Ht("Custom function mappers may not return invalid values for the property type (i.e. `"+n.name+"` for ele `"+t.id()+"` is invalid)"),!1;a.mapping=bi(n),n=a;break}case void 0:break;default:return!1}return l?(c?n.bypassed=u.bypassed:n.bypassed=u,i[n.name]=n):c?u.bypassed=n:i[n.name]=n,x(),!0};Pr.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,a=Object.keys(i),s=0;s<a.length;s++){var o=a[s],l=i[o];l!=null&&(l.bypass?l.bypassed=null:i[o]=null)}}};Pr.update=function(){var t=this._private.cy,e=t.mutableElements();e.updateStyle()};Pr.updateTransitions=function(t,e){var r=this,n=t._private,i=t.pstyle("transition-property").value,a=t.pstyle("transition-duration").pfValue,s=t.pstyle("transition-delay").pfValue;if(i.length>0&&a>0){for(var o={},l=!1,u=0;u<i.length;u++){var c=i[u],d=t.pstyle(c),p=e[c];if(p){var f=p.prev,x=f,S=p.next!=null?p.next:d,v=!1,m=void 0,b=1e-6;x&&(Ke(x.pfValue)&&Ke(S.pfValue)?(v=S.pfValue-x.pfValue,m=x.pfValue+b*v):Ke(x.value)&&Ke(S.value)?(v=S.value-x.value,m=x.value+b*v):Yt(x.value)&&Yt(S.value)&&(v=x.value[0]!==S.value[0]||x.value[1]!==S.value[1]||x.value[2]!==S.value[2],m=x.strValue),v&&(o[c]=S.strValue,this.applyBypass(t,c,m),l=!0))}}if(!l)return;n.transitioning=!0,new To(function(w){s>0?t.delayAnimation(s).play().promise().then(w):w()}).then(function(){return t.animation({style:o,duration:a,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)};Pr.checkTrigger=function(t,e,r,n,i,a){var s=this.properties[e],o=i(s);t.removed()||o!=null&&o(r,n,t)&&a(s)};Pr.checkZOrderTrigger=function(t,e,r,n){var i=this;this.checkTrigger(t,e,r,n,function(a){return a.triggersZOrder},function(){i._private.cy.notify("zorder",t)})};Pr.checkBoundsTrigger=function(t,e,r,n){this.checkTrigger(t,e,r,n,function(i){return i.triggersBounds},function(i){t.dirtyCompoundBoundsCache(),t.dirtyBoundingBoxCache()})};Pr.checkConnectedEdgesBoundsTrigger=function(t,e,r,n){this.checkTrigger(t,e,r,n,function(i){return i.triggersBoundsOfConnectedEdges},function(i){t.connectedEdges().forEach(function(a){a.dirtyBoundingBoxCache()})})};Pr.checkParallelEdgesBoundsTrigger=function(t,e,r,n){this.checkTrigger(t,e,r,n,function(i){return i.triggersBoundsOfParallelEdges},function(i){t.parallelEdges().forEach(function(a){a.dirtyBoundingBoxCache()})})};Pr.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 pu={};pu.applyBypass=function(t,e,r,n){var i=this,a=[],s=!0;if(e==="*"||e==="**"){if(r!==void 0)for(var o=0;o<i.properties.length;o++){var l=i.properties[o],u=l.name,c=this.parse(u,r,!0);c&&a.push(c)}}else if(ht(e)){var d=this.parse(e,r,!0);d&&a.push(d)}else if(Ot(e)){var p=e;n=r;for(var f=Object.keys(p),x=0;x<f.length;x++){var S=f[x],v=p[S];if(v===void 0&&(v=p[Gd(S)]),v!==void 0){var m=this.parse(S,v,!0);m&&a.push(m)}}}else return!1;if(a.length===0)return!1;for(var b=!1,w=0;w<t.length;w++){for(var _=t[w],T={},N=void 0,E=0;E<a.length;E++){var k=a[E];if(n){var L=_.pstyle(k.name);N=T[k.name]={prev:L}}b=this.applyParsedProperty(_,bi(k))||b,n&&(N.next=_.pstyle(k.name))}b&&this.updateStyleHints(_),n&&this.updateTransitions(_,T,s)}return b};pu.overrideBypass=function(t,e,r){e=Sm(e);for(var n=0;n<t.length;n++){var i=t[n],a=i._private.style[e],s=this.properties[e].type,o=s.color,l=s.mutiple,u=a?a.pfValue!=null?a.pfValue:a.value:null;!a||!a.bypass?this.applyBypass(i,e,r):(a.value=r,a.pfValue!=null&&(a.pfValue=r),o?a.strValue="rgb("+r.join(",")+")":l?a.strValue=r.join(" "):a.strValue=""+r,this.updateStyleHints(i)),this.checkTriggers(i,e,u,r)}};pu.removeAllBypasses=function(t,e){return this.removeBypasses(t,this.propertyNames,e)};pu.removeBypasses=function(t,e,r){for(var n=!0,i=0;i<t.length;i++){for(var a=t[i],s={},o=0;o<e.length;o++){var l=e[o],u=this.properties[l],c=a.pstyle(u.name);if(!(!c||!c.bypass)){var d="",p=this.parse(l,d,!0),f=s[u.name]={prev:c};this.applyParsedProperty(a,p),f.next=a.pstyle(u.name)}}this.updateStyleHints(a),r&&this.updateTransitions(a,s,n)}};var Im={};Im.getEmSizeInPixels=function(){var t=this.containerCss("font-size");return t!=null?parseFloat(t):1};Im.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 wi={};wi.getRenderedStyle=function(t,e){return e?this.getStylePropertyValue(t,e,!0):this.getRawStyle(t,!0)};wi.getRawStyle=function(t,e){var r=this;if(t=t[0],t){for(var n={},i=0;i<r.properties.length;i++){var a=r.properties[i],s=r.getStylePropertyValue(t,a.name,e);s!=null&&(n[a.name]=s,n[Gd(a.name)]=s)}return n}};wi.getIndexedStyle=function(t,e,r,n){var i=t.pstyle(e)[r][n];return i??t.cy().style().getDefaultProperty(e)[r][0]};wi.getStylePropertyValue=function(t,e,r){var n=this;if(t=t[0],t){var i=n.properties[e];i.alias&&(i=i.pointsTo);var a=i.type,s=t.pstyle(i.name);if(s){var o=s.value,l=s.units,u=s.strValue;if(r&&a.number&&o!=null&&Ke(o)){var c=t.cy().zoom(),d=function(v){return v*c},p=function(v,m){return d(v)+m},f=Yt(o),x=f?l.every(function(S){return S!=null}):l!=null;return x?f?o.map(function(S,v){return p(S,l[v])}).join(" "):p(o,l):f?o.map(function(S){return ht(S)?S:""+d(S)}).join(" "):""+d(o)}else if(u!=null)return u}return null}};wi.getAnimationStartStyle=function(t,e){for(var r={},n=0;n<e.length;n++){var i=e[n],a=i.name,s=t.pstyle(a);s!==void 0&&(Ot(s)?s=this.parse(a,s.strValue):s=this.parse(a,s)),s&&(r[a]=s)}return r};wi.getPropsList=function(t){var e=this,r=[],n=t,i=e.properties;if(n)for(var a=Object.keys(n),s=0;s<a.length;s++){var o=a[s],l=n[o],u=i[o]||i[Sm(o)],c=this.parse(u.name,l);c&&r.push(c)}return r};wi.getNonDefaultPropertiesHash=function(t,e,r){var n=r.slice(),i,a,s,o,l,u;for(l=0;l<e.length;l++)if(i=e[l],a=t.pstyle(i,!1),a!=null)if(a.pfValue!=null)n[0]=ql(o,n[0]),n[1]=Yl(o,n[1]);else for(s=a.strValue,u=0;u<s.length;u++)o=s.charCodeAt(u),n[0]=ql(o,n[0]),n[1]=Yl(o,n[1]);return n};wi.getPropertiesHash=wi.getNonDefaultPropertiesHash;var ah={};ah.appendFromJson=function(t){for(var e=this,r=0;r<t.length;r++){var n=t[r],i=n.selector,a=n.style||n.css,s=Object.keys(a);e.selector(i);for(var o=0;o<s.length;o++){var l=s[o],u=a[l];e.css(l,u)}}return e};ah.fromJson=function(t){var e=this;return e.resetToDefault(),e.appendFromJson(t),e};ah.json=function(){for(var t=[],e=this.defaultLength;e<this.length;e++){for(var r=this[e],n=r.selector,i=r.properties,a={},s=0;s<i.length;s++){var o=i[s];a[o.name]=o.strValue}t.push({selector:n?n.toString():"core",style:a})}return t};var Bm={};Bm.appendFromString=function(t){var e=this,r=this,n=""+t,i,a,s;n=n.replace(/[/][*](\s|.)+?[*][/]/g,"");function o(){n.length>i.length?n=n.substr(i.length):n=""}function l(){a.length>s.length?a=a.substr(s.length):a=""}for(;;){var u=n.match(/^\s*$/);if(u)break;var c=n.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!c){Ht("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+n);break}i=c[0];var d=c[1];if(d!=="core"){var p=new Sa(d);if(p.invalid){Ht("Skipping parsing of block: Invalid selector found in string stylesheet: "+d),o();continue}}var f=c[2],x=!1;a=f;for(var S=[];;){var v=a.match(/^\s*$/);if(v)break;var m=a.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!m){Ht("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+f),x=!0;break}s=m[0];var b=m[1],w=m[2],_=e.properties[b];if(!_){Ht("Skipping property: Invalid property name in: "+s),l();continue}var T=r.parse(b,w);if(!T){Ht("Skipping property: Invalid property definition in: "+s),l();continue}S.push({name:b,val:w}),l()}if(x){o();break}r.selector(d);for(var N=0;N<S.length;N++){var E=S[N];r.css(E.name,E.val)}o()}return r};Bm.fromString=function(t){var e=this;return e.resetToDefault(),e.appendFromString(t),e};var xr={};(function(){var t=Cr,e=sD,r=lD,n=uD,i=cD,a=function(te){return"^"+te+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},s=function(te){var ie=t+"|\\w+|"+e+"|"+r+"|"+n+"|"+i;return"^"+te+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+t+")\\s*\\,\\s*("+t+")\\s*,\\s*("+ie+")\\s*\\,\\s*("+ie+")\\)$"},o=[`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`,"^(none)$","^(.+)$"];xr.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:a("data")},layoutData:{mapping:!0,regex:a("layoutData")},scratch:{mapping:!0,regex:a("scratch")},mapData:{mapping:!0,regex:s("mapData")},mapLayoutData:{mapping:!0,regex:s("mapLayoutData")},mapScratch:{mapping:!0,regex:s("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:o,singleRegexMatchValue:!0},urls:{regexes:o,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(te,ie){switch(te.length){case 2:return ie[0]!=="deg"&&ie[0]!=="rad"&&ie[1]!=="deg"&&ie[1]!=="rad";case 1:return ht(te[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(te){var ie=te.length;return ie===1||ie===2||ie===4}}};var l={zeroNonZero:function(te,ie){return(te==null||ie==null)&&te!==ie||te==0&&ie!=0?!0:te!=0&&ie==0},any:function(te,ie){return te!=ie},emptyNonEmpty:function(te,ie){var le=xa(te),pe=xa(ie);return le&&!pe||!le&&pe}},u=xr.types,c=[{name:"label",type:u.text,triggersBounds:l.any,triggersZOrder:l.emptyNonEmpty},{name:"text-rotation",type:u.textRotation,triggersBounds:l.any},{name:"text-margin-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"text-margin-y",type:u.bidirectionalSize,triggersBounds:l.any}],d=[{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}],p=[{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}],f=[{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}],S=[{name:"events",type:u.bool,triggersZOrder:l.any},{name:"text-events",type:u.bool,triggersZOrder:l.any},{name:"box-selection",type:u.boxSelection,triggersZOrder:l.any}],v=[{name:"display",type:u.display,triggersZOrder:l.any,triggersBounds:l.any,triggersBoundsOfConnectedEdges:l.any,triggersBoundsOfParallelEdges:function(te,ie,le){return te===ie?!1:le.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}],b=[{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}],w=[{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(te,ie){return ie.value==="label"?-te.poolIndex():ie.pfValue},T=[{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}],N=[{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}],E=[{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}],L=[{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}],A=[{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(te,ie){return te===ie?!1:te==="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}],M=[{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}],O=[{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}],$=[];xr.pieBackgroundN=16,$.push({name:"pie-size",type:u.sizeMaybePercent}),$.push({name:"pie-hole",type:u.sizeMaybePercent}),$.push({name:"pie-start-angle",type:u.angle});for(var D=1;D<=xr.pieBackgroundN;D++)$.push({name:"pie-"+D+"-background-color",type:u.color}),$.push({name:"pie-"+D+"-background-size",type:u.percent}),$.push({name:"pie-"+D+"-background-opacity",type:u.zeroOneNumber});var B=[];xr.stripeBackgroundN=16,B.push({name:"stripe-size",type:u.sizeMaybePercent}),B.push({name:"stripe-direction",type:u.axisDirectionPrimary});for(var j=1;j<=xr.stripeBackgroundN;j++)B.push({name:"stripe-"+j+"-background-color",type:u.color}),B.push({name:"stripe-"+j+"-background-size",type:u.percent}),B.push({name:"stripe-"+j+"-background-opacity",type:u.zeroOneNumber});var I=[],U=xr.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(Q){U.forEach(function(te){var ie=te+"-"+Q.name,le=Q.type,pe=Q.triggersBounds;I.push({name:ie,type:le,triggersBounds:pe})})},{});var F=xr.properties=[].concat(S,w,v,m,b,M,x,f,c,d,p,T,N,E,k,$,B,L,A,I,O),P=xr.propertyGroups={behavior:S,transition:w,visibility:v,overlay:m,underlay:b,ghost:M,commonLabel:x,labelDimensions:f,mainLabel:c,sourceLabel:d,targetLabel:p,nodeBody:T,nodeBorder:N,nodeOutline:E,backgroundImage:k,pie:$,stripe:B,compound:L,edgeLine:A,edgeArrow:I,core:O},H=xr.propertyGroupNames={},W=xr.propertyGroupKeys=Object.keys(P);W.forEach(function(Q){H[Q]=P[Q].map(function(te){return te.name}),P[Q].forEach(function(te){return te.groupKey=Q})});var V=xr.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"}];xr.propertyNames=F.map(function(Q){return Q.name});for(var re=0;re<F.length;re++){var J=F[re];F[J.name]=J}for(var ne=0;ne<V.length;ne++){var X=V[ne],q=F[X.pointsTo],Y={name:X.name,alias:!0,pointsTo:q};F.push(Y),F[X.name]=Y}})();xr.getDefaultProperty=function(t){return this.getDefaultProperties()[t]};xr.getDefaultProperties=function(){var t=this._private;if(t.defaultProperties!=null)return t.defaultProperties;for(var e=mt({"selection-box-color":"#ddd","selection-box-opacity":.65,"selection-box-border-color":"#aaa","selection-box-border-width":1,"active-bg-color":"black","active-bg-opacity":.15,"active-bg-size":30,"outside-texture-bg-color":"#000","outside-texture-bg-opacity":.125,events:"yes","text-events":"no","text-valign":"top","text-halign":"center","text-justification":"auto","line-height":1,color:"#000","box-selection":"contain","text-outline-color":"#000","text-outline-width":0,"text-outline-opacity":1,"text-opacity":1,"text-decoration":"none","text-transform":"none","text-wrap":"none","text-overflow-wrap":"whitespace","text-max-width":9999,"text-background-color":"#000","text-background-opacity":0,"text-background-shape":"rectangle","text-background-padding":0,"text-border-opacity":0,"text-border-width":0,"text-border-style":"solid","text-border-color":"#000","font-family":"Helvetica Neue, Helvetica, sans-serif","font-style":"normal","font-weight":"normal","font-size":16,"min-zoomed-font-size":0,"text-rotation":"none","source-text-rotation":"none","target-text-rotation":"none",visibility:"visible",display:"element",opacity:1,"z-compound-depth":"auto","z-index-compare":"auto","z-index":0,label:"","text-margin-x":0,"text-margin-y":0,"source-label":"","source-text-offset":0,"source-text-margin-x":0,"source-text-margin-y":0,"target-label":"","target-text-offset":0,"target-text-margin-x":0,"target-text-margin-y":0,"overlay-opacity":0,"overlay-color":"#000","overlay-padding":10,"overlay-shape":"round-rectangle","overlay-corner-radius":"auto","underlay-opacity":0,"underlay-color":"#000","underlay-padding":10,"underlay-shape":"round-rectangle","underlay-corner-radius":"auto","text-metrics":"font","transition-property":"none","transition-duration":0,"transition-delay":0,"transition-timing-function":"linear","box-select-labels":"no","background-blacken":0,"background-color":"#999","background-fill":"solid","background-opacity":1,"background-image":"none","background-image-crossorigin":"anonymous","background-image-opacity":1,"background-image-containment":"inside","background-image-smoothing":"yes","background-position-x":"50%","background-position-y":"50%","background-offset-x":0,"background-offset-y":0,"background-width-relative-to":"include-padding","background-height-relative-to":"include-padding","background-repeat":"no-repeat","background-fit":"none","background-clip":"node","background-width":"auto","background-height":"auto","border-color":"#000","border-opacity":1,"border-width":0,"border-style":"solid","border-dash-pattern":[4,2],"border-dash-offset":0,"border-cap":"butt","border-join":"miter","border-position":"center","outline-color":"#999","outline-opacity":1,"outline-width":0,"outline-offset":0,"outline-style":"solid",height:30,width:30,shape:"ellipse","shape-polygon-points":"-1, -1, 1, -1, 1, 1, -1, 1","corner-radius":"auto","bounds-expansion":0,"background-gradient-direction":"to-bottom","background-gradient-stop-colors":"#999","background-gradient-stop-positions":"0%",ghost:"no","ghost-offset-y":0,"ghost-offset-x":0,"ghost-opacity":0,padding:0,"padding-relative-to":"width",position:"origin","compound-sizing-wrt-labels":"include","min-width":0,"min-width-bias-left":0,"min-width-bias-right":0,"min-height":0,"min-height-bias-top":0,"min-height-bias-bottom":0},{"pie-size":"100%","pie-hole":0,"pie-start-angle":"0deg"},[{name:"pie-{{i}}-background-color",value:"black"},{name:"pie-{{i}}-background-size",value:"0%"},{name:"pie-{{i}}-background-opacity",value:1}].reduce(function(l,u){for(var c=1;c<=xr.pieBackgroundN;c++){var d=u.name.replace("{{i}}",c),p=u.value;l[d]=p}return l},{}),{"stripe-size":"100%","stripe-direction":"horizontal"},[{name:"stripe-{{i}}-background-color",value:"black"},{name:"stripe-{{i}}-background-size",value:"0%"},{name:"stripe-{{i}}-background-opacity",value:1}].reduce(function(l,u){for(var c=1;c<=xr.stripeBackgroundN;c++){var d=u.name.replace("{{i}}",c),p=u.value;l[d]=p}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 xr.arrowPrefixes.forEach(function(c){var d=c+"-"+u.name,p=u.value;l[d]=p}),l},{})),r={},n=0;n<this.properties.length;n++){var i=this.properties[n];if(!i.pointsTo){var a=i.name,s=e[a],o=this.parse(a,s);r[a]=o}}return t.defaultProperties=r,t.defaultProperties};xr.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 sh={};sh.parse=function(t,e,r,n){var i=this;if(cr(e))return i.parseImplWarn(t,e,r,n);var a=n==="mapping"||n===!0||n===!1||n==null?"dontcare":n,s=r?"t":"f",o=""+e,l=i_(t,o,s,a),u=i.propCache=i.propCache||[],c;return(c=u[l])||(c=u[l]=i.parseImplWarn(t,e,r,n)),(r||n==="mapping")&&(c=bi(c),c&&(c.value=bi(c.value))),c};sh.parseImplWarn=function(t,e,r,n){var i=this.parseImpl(t,e,r,n);return!i&&e!=null&&Ht("The style property `".concat(t,": ").concat(e,"` is invalid")),i&&(i.name==="width"||i.name==="height")&&e==="label"&&Ht("The style value of `label` is deprecated for `"+i.name+"`"),i};sh.parseImpl=function(t,e,r,n){var i=this;t=Sm(t);var a=i.properties[t],s=e,o=i.types;if(!a||e===void 0)return null;a.alias&&(a=a.pointsTo,t=a.name);var l=ht(e);l&&(e=e.trim());var u=a.type;if(!u)return null;if(r&&(e===""||e===null))return{name:t,value:e,bypass:!0,deleteBypass:!0};if(cr(e))return{name:t,value:e,strValue:"fn",mapped:o.fn,bypass:r};var c,d;if(!(!l||n||e.length<7||e[1]!=="a")){if(e.length>=7&&e[0]==="d"&&(c=new RegExp(o.data.regex).exec(e))){if(r)return!1;var p=o.data;return{name:t,value:c,strValue:""+e,mapped:p,field:c[1],bypass:r}}else if(e.length>=10&&e[0]==="m"&&(d=new RegExp(o.mapData.regex).exec(e))){if(r||u.multiple)return!1;var f=o.mapData;if(!(u.color||u.number))return!1;var x=this.parse(t,d[4]);if(!x||x.mapped)return!1;var S=this.parse(t,d[5]);if(!S||S.mapped)return!1;if(x.pfValue===S.pfValue||x.strValue===S.strValue)return Ht("`"+t+": "+e+"` is not a valid mapper because the output range is zero; converting to `"+t+": "+x.strValue+"`"),this.parse(t,x.strValue);if(u.color){var v=x.value,m=S.value,b=v[0]===m[0]&&v[1]===m[1]&&v[2]===m[2]&&(v[3]===m[3]||(v[3]==null||v[3]===1)&&(m[3]==null||m[3]===1));if(b)return!1}return{name:t,value:d,strValue:""+e,mapped:f,field:d[1],fieldMin:parseFloat(d[2]),fieldMax:parseFloat(d[3]),valueMin:x.value,valueMax:S.value,bypass:r}}}if(u.multiple&&n!=="multiple"){var w;if(l?w=e.split(/\s+/):Yt(e)?w=e:w=[e],u.evenMultiple&&w.length%2!==0)return null;for(var _=[],T=[],N=[],E="",k=!1,L=0;L<w.length;L++){var A=i.parse(t,w[L],r,"multiple");k=k||ht(A.value),_.push(A.value),N.push(A.pfValue!=null?A.pfValue:A.value),T.push(A.units),E+=(L>0?" ":"")+A.strValue}return u.validate&&!u.validate(_,T)?null:u.singleEnum&&k?_.length===1&&ht(_[0])?{name:t,value:_[0],strValue:_[0],bypass:r}:null:{name:t,value:_,pfValue:N,strValue:E,bypass:r,units:T}}var M=function(){for(var Y=0;Y<u.enums.length;Y++){var Q=u.enums[Y];if(Q===e)return{name:t,value:e,strValue:""+e,bypass:r}}return null};if(u.number){var O,$="px";if(u.units&&(O=u.units),u.implicitUnits&&($=u.implicitUnits),!u.unitless)if(l){var D="px|em"+(u.allowPercent?"|\\%":"");O&&(D=O);var B=e.match("^("+Cr+")("+D+")?$");B&&(e=B[1],O=B[2]||$)}else(!O||u.implicitUnits)&&(O=$);if(e=parseFloat(e),isNaN(e)&&u.enums===void 0)return null;if(isNaN(e)&&u.enums!==void 0)return e=s,M();if(u.integer&&!GS(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 j={name:t,value:e,strValue:""+e+(O||""),units:O,bypass:r};return u.unitless||O!=="px"&&O!=="em"?j.pfValue=e:j.pfValue=O==="px"||!O?e:this.getEmSizeInPixels()*e,(O==="ms"||O==="s")&&(j.pfValue=O==="ms"?e:1e3*e),(O==="deg"||O==="rad")&&(j.pfValue=O==="rad"?e:cA(e)),O==="%"&&(j.pfValue=e/100),j}else if(u.propList){var I=[],U=""+e;if(U!=="none"){for(var F=U.split(/\s*,\s*|\s+/),P=0;P<F.length;P++){var H=F[P].trim();i.properties[H]?I.push(H):Ht("`"+H+"` is not a valid property name")}if(I.length===0)return null}return{name:t,value:I,strValue:I.length===0?"none":I.join(" "),bypass:r}}else if(u.color){var W=QS(e);return W?{name:t,value:W,pfValue:W,strValue:"rgb("+W[0]+","+W[1]+","+W[2]+")",bypass:r}:null}else if(u.regex||u.regexes){if(u.enums){var V=M();if(V)return V}for(var re=u.regexes?u.regexes:[u.regex],J=0;J<re.length;J++){var ne=new RegExp(re[J]),X=ne.exec(e);if(X)return{name:t,value:u.singleRegexMatchValue?X[1]:X,strValue:""+e,bypass:r}}return null}else return u.string?{name:t,value:""+e,strValue:""+e,bypass:r}:u.enums?M():null};var Ar=function(e){if(!(this instanceof Ar))return new Ar(e);if(!wm(e)){sr("A style must have a core reference");return}this._private={cy:e,coreStyle:{}},this.length=0,this.resetToDefault()},Yr=Ar.prototype;Yr.instanceString=function(){return"style"};Yr.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 a=i[0]._private;a.styleDirty=!0,a.appliedInitStyle=!1}),this};Yr.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this};Yr.core=function(t){return this._private.coreStyle[t]||this.getDefaultProperty(t)};Yr.selector=function(t){var e=t==="core"?null:new Sa(t),r=this.length++;return this[r]={selector:e,properties:[],mappedProperties:[],index:r},this};Yr.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],a=r[i.name];a===void 0&&(a=r[Gd(i.name)]),a!==void 0&&this.cssRule(i.name,a)}else e.length===2&&this.cssRule(e[0],e[1]);return this};Yr.style=Yr.css;Yr.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};Yr.append=function(t){return YS(t)?t.appendToStyle(this):Yt(t)?this.appendFromJson(t):ht(t)&&this.appendFromString(t),this};Ar.fromJson=function(t,e){var r=new Ar(t);return r.fromJson(e),r};Ar.fromString=function(t,e){return new Ar(t).fromString(e)};[Pr,pu,Im,wi,ah,Bm,xr,sh].forEach(function(t){mt(Yr,t)});Ar.types=Yr.types;Ar.properties=Yr.properties;Ar.propertyGroups=Yr.propertyGroups;Ar.propertyGroupNames=Yr.propertyGroupNames;Ar.propertyGroupKeys=Yr.propertyGroupKeys;var gP={style:function(e){if(e){var r=this.setStyle(e);r.update()}return this._private.style},setStyle:function(e){var r=this._private;return YS(e)?r.style=e.generateStyle(this):Yt(e)?r.style=Ar.fromJson(this,e):ht(e)?r.style=Ar.fromString(this,e):r.style=Ar(this),r.style},updateStyle:function(){this.mutableElements().updateStyle()}},vP="single",ps={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=vP),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,a,s,o;switch(e.length){case 0:return r;case 1:if(ht(e[0]))return n=e[0],r[n];if(Ot(e[0])){if(!this._private.panningEnabled)return this;a=e[0],s=a.x,o=a.y,Ke(s)&&(r.x=s),Ke(o)&&(r.y=o),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;n=e[0],i=e[1],(n==="x"||n==="y")&&Ke(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,a,s,o,l,u;if(!this._private.panningEnabled)return this;switch(n.length){case 1:Ot(e)&&(o=n[0],l=o.x,u=o.y,Ke(l)&&(i.x+=l),Ke(u)&&(i.y+=u),this.emit("pan viewport"));break;case 2:a=e,s=r,(a==="x"||a==="y")&&Ke(s)&&(i[a]+=s),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(Ke(e)&&r===void 0&&(r=e,e=void 0),!(!this._private.panningEnabled||!this._private.zoomingEnabled)){var n;if(ht(e)){var i=e;e=this.$(i)}else if(rD(e)){var a=e;n={x1:a.x1,y1:a.y1,x2:a.x2,y2:a.y2},n.w=n.x2-n.x1,n.h=n.y2-n.y1}else Nn(e)||(e=this.mutableElements());if(!(Nn(e)&&e.empty())){n=n||e.boundingBox();var s=this.width(),o=this.height(),l;if(r=Ke(r)?r:0,!isNaN(s)&&!isNaN(o)&&s>0&&o>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0){l=Math.min((s-2*r)/n.w,(o-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:(s-l*(n.x1+n.x2))/2,y:(o-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 Ke(e)&&Ke(r)&&e<=r?(n.minZoom=e,n.maxZoom=r):Ke(e)&&r===void 0&&e<=n.maxZoom?n.minZoom=e:Ke(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,a,s,o=!1;if(r.zoomingEnabled||(o=!0),Ke(e)?s=e:Ot(e)&&(s=e.level,e.position!=null?a=Kd(e.position,i,n):e.renderedPosition!=null&&(a=e.renderedPosition),a!=null&&!r.panningEnabled&&(o=!0)),s=s>r.maxZoom?r.maxZoom:s,s=s<r.minZoom?r.minZoom:s,o||!Ke(s)||s===i||a!=null&&(!Ke(a.x)||!Ke(a.y)))return null;if(a!=null){var l=n,u=i,c=s,d={x:-c/u*(a.x-l.x)+a.x,y:-c/u*(a.y-l.y)+a.y};return{zoomed:!0,panned:!0,zoom:c,pan:d}}else return{zoomed:!0,panned:!1,zoom:s,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,a=[],s=!1,o=!1;if(!e)return this;if(Ke(e.zoom)||(n=!1),Ot(e.pan)||(i=!1),!n&&!i)return this;if(n){var l=e.zoom;l<r.minZoom||l>r.maxZoom||!r.zoomingEnabled?s=!0:(r.zoom=l,a.push("zoom"))}if(i&&(!s||!e.cancelOnFailedZoom)&&r.panningEnabled){var u=e.pan;Ke(u.x)&&(r.pan.x=u.x,o=!1),Ke(u.y)&&(r.pan.y=u.y,o=!1),o||a.push("pan")}return a.length>0&&(a.push("viewport"),this.emit(a.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(ht(e)){var n=e;e=this.mutableElements().filter(n)}else Nn(e)||(e=this.mutableElements());if(e.length!==0){var i=e.boundingBox(),a=this.width(),s=this.height();r=r===void 0?this._private.zoom:r;var o={x:(a-r*(i.x1+i.x2))/2,y:(s-r*(i.y1+i.y2))/2};return o}}},reset:function(){return!this._private.panningEnabled||!this._private.zoomingEnabled?this:(this.viewport({pan:{x:0,y:0},zoom:1}),this)},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e=this._private,r=e.container,n=this;return e.sizeCache=e.sizeCache||(r?(function(){var i=n.window().getComputedStyle(r),a=function(o){return parseFloat(i.getPropertyValue(o))};return{width:r.clientWidth-a("padding-left")-a("padding-right"),height:r.clientHeight-a("padding-top")-a("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}};ps.centre=ps.center;ps.autolockNodes=ps.autolock;ps.autoungrabifyNodes=ps.autoungrabify;var eu={data:$t.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:$t.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:$t.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:$t.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};eu.attr=eu.data;eu.removeAttr=eu.removeData;var tu=function(e){var r=this;e=mt({},e);var n=e.container;n&&!Cd(n)&&Cd(n[0])&&(n=n[0]);var i=n?n._cyreg:null;i=i||{},i&&i.cy&&(i.cy.destroy(),i={});var a=i.readies=i.readies||[];n&&(n._cyreg=i),i.cy=r;var s=_r!==void 0&&n!==void 0&&!e.headless,o=e;o.layout=mt({name:s?"grid":"null"},o.layout),o.renderer=mt({name:s?"canvas":"null"},o.renderer);var l=function(x,S,v){return S!==void 0?S:v!==void 0?v:x},u=this._private={container:n,ready:!1,options:o,elements:new Fr(this),listeners:[],aniEles:new Fr(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:l(!0,o.zoomingEnabled),userZoomingEnabled:l(!0,o.userZoomingEnabled),panningEnabled:l(!0,o.panningEnabled),userPanningEnabled:l(!0,o.userPanningEnabled),boxSelectionEnabled:l(!0,o.boxSelectionEnabled),autolock:l(!1,o.autolock,o.autolockNodes),autoungrabify:l(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:l(!1,o.autounselectify),styleEnabled:o.styleEnabled===void 0?s:o.styleEnabled,zoom:Ke(o.zoom)?o.zoom:1,pan:{x:Ot(o.pan)&&Ke(o.pan.x)?o.pan.x:0,y:Ot(o.pan)&&Ke(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:l(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom});var c=function(x,S){var v=x.some(nD);if(v)return To.all(x).then(S);S(x)};u.styleEnabled&&r.setStyle([]);var d=mt({},o,o.renderer);r.initRenderer(d);var p=function(x,S,v){r.notifications(!1);var m=r.mutableElements();m.length>0&&m.remove(),x!=null&&(Ot(x)||Yt(x))&&r.add(x),r.one("layoutready",function(w){r.notifications(!0),r.emit(w),r.one("load",S),r.emitAndNotify("load")}).one("layoutstop",function(){r.one("done",v),r.emit("done")});var b=mt({},r._private.options.layout);b.eles=r.elements(),r.layout(b).run()};c([o.style,o.elements],function(f){var x=f[0],S=f[1];u.styleEnabled&&r.style().append(x),p(S,function(){r.startAnimationLoop(),u.ready=!0,cr(o.ready)&&r.on("ready",o.ready);for(var v=0;v<a.length;v++){var m=a[v];r.on("ready",m)}i&&(i.readies=[]),r.emit("ready")},o.done)})},Dd=tu.prototype;mt(Dd,{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 _r;var r=this._private.container.ownerDocument;return r===void 0||r==null?_r:r.defaultView||_r},mount:function(e){if(e!=null){var r=this,n=r._private,i=n.options;return!Cd(e)&&Cd(e[0])&&(e=e[0]),r.stopAnimationLoop(),r.destroyRenderer(),n.container=e,n.styleEnabled=!0,r.invalidateSize(),r.initRenderer(mt({},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 bi(this._private.options)},json:function(e){var r=this,n=r._private,i=r.mutableElements(),a=function(_){return r.getElementById(_.id())};if(Ot(e)){if(r.startBatch(),e.elements){var s={},o=function(_,T){for(var N=[],E=[],k=0;k<_.length;k++){var L=_[k];if(!L.data.id){Ht("cy.json() cannot handle elements without an ID attribute");continue}var A=""+L.data.id,M=r.getElementById(A);s[A]=!0,M.length!==0?E.push({ele:M,json:L}):(T&&(L.group=T),N.push(L))}r.add(N);for(var O=0;O<E.length;O++){var $=E[O],D=$.ele,B=$.json;D.json(B)}};if(Yt(e.elements))o(e.elements);else for(var l=["nodes","edges"],u=0;u<l.length;u++){var c=l[u],d=e.elements[c];Yt(d)&&o(d,c)}var p=r.collection();i.filter(function(w){return!s[w.id()]}).forEach(function(w){w.isParent()?p.merge(w):w.remove()}),p.forEach(function(w){return w.children().move({parent:null})}),p.forEach(function(w){return a(w).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 f=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],x=0;x<f.length;x++){var S=f[x];e[S]!=null&&r[S](e[S])}return r.endBatch(),this}else{var v=!!e,m={};v?m.elements=this.elements().map(function(w){return w.json()}):(m.elements={},i.forEach(function(w){var _=w.group();m.elements[_]||(m.elements[_]=[]),m.elements[_].push(w.json())})),this._private.styleEnabled&&(m.style=r.style().json()),m.data=bi(r.data());var b=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=bi(n.pan),m.boxSelectionEnabled=n.boxSelectionEnabled,m.renderer=bi(b.renderer),m.hideEdgesOnViewport=b.hideEdgesOnViewport,m.textureOnViewport=b.textureOnViewport,m.wheelSensitivity=b.wheelSensitivity,m.motionBlur=b.motionBlur,m.multiClickDebounceTime=b.multiClickDebounceTime,m}}});Dd.$id=Dd.getElementById;[aP,cP,K_,Bv,cd,hP,Fv,dd,gP,ps,eu].forEach(function(t){mt(Dd,t)});var mP={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}},yP={maximal:!1,acyclic:!1},Qs=function(e){return e.scratch("breadthfirst")},kw=function(e,r){return e.scratch("breadthfirst",r)};function X_(t){this.options=mt({},mP,yP,t)}X_.prototype.run=function(){var t=this.options,e=t.cy,r=t.eles,n=r.nodes().filter(function(Ae){return Ae.isChildless()}),i=r,a=t.directed,s=t.acyclic||t.maximal||t.maximalAdjustments>0,o=!!t.boundingBox,l=sn(o?t.boundingBox:structuredClone(e.extent())),u;if(Nn(t.roots))u=t.roots;else if(Yt(t.roots)){for(var c=[],d=0;d<t.roots.length;d++){var p=t.roots[d],f=e.getElementById(p);c.push(f)}u=e.collection(c)}else if(ht(t.roots))u=e.$(t.roots);else if(a)u=n.roots();else{var x=r.components();u=e.collection();for(var S=function(){var Ne=x[v],Pe=Ne.maxDegree(!1),ze=Ne.filter(function(Ie){return Ie.degree(!1)===Pe});u=u.add(ze)},v=0;v<x.length;v++)S()}var m=[],b={},w=function(Ne,Pe){m[Pe]==null&&(m[Pe]=[]);var ze=m[Pe].length;m[Pe].push(Ne),kw(Ne,{index:ze,depth:Pe})},_=function(Ne,Pe){var ze=Qs(Ne),Ie=ze.depth,$e=ze.index;m[Ie][$e]=null,Ne.isChildless()&&w(Ne,Pe)};i.bfs({roots:u,directed:t.directed,visit:function(Ne,Pe,ze,Ie,$e){var Ge=Ne[0],ve=Ge.id();Ge.isChildless()&&w(Ge,$e),b[ve]=!0}});for(var T=[],N=0;N<n.length;N++){var E=n[N];b[E.id()]||T.push(E)}var k=function(Ne){for(var Pe=m[Ne],ze=0;ze<Pe.length;ze++){var Ie=Pe[ze];if(Ie==null){Pe.splice(ze,1),ze--;continue}kw(Ie,{depth:Ne,index:ze})}},L=function(Ne,Pe){for(var ze=Qs(Ne),Ie=Ne.incomers().filter(function(ee){return ee.isNode()&&r.has(ee)}),$e=-1,Ge=Ne.id(),ve=0;ve<Ie.length;ve++){var Ee=Ie[ve],Me=Qs(Ee);$e=Math.max($e,Me.depth)}if(ze.depth<=$e){if(!t.acyclic&&Pe[Ge])return null;var ye=$e+1;return _(Ne,ye),Pe[Ge]=ye,!0}return!1};if(a&&s){var A=[],M={},O=function(Ne){return A.push(Ne)},$=function(){return A.shift()};for(n.forEach(function(Ae){return A.push(Ae)});A.length>0;){var D=$(),B=L(D,M);if(B)D.outgoers().filter(function(Ae){return Ae.isNode()&&r.has(Ae)}).forEach(O);else if(B===null){Ht("Detected double maximal shift for node `"+D.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var j=0;if(t.avoidOverlap)for(var I=0;I<n.length;I++){var U=n[I],F=U.layoutDimensions(t),P=F.w,H=F.h;j=Math.max(j,P,H)}var W={},V=function(Ne){if(W[Ne.id()])return W[Ne.id()];for(var Pe=Qs(Ne).depth,ze=Ne.neighborhood(),Ie=0,$e=0,Ge=0;Ge<ze.length;Ge++){var ve=ze[Ge];if(!(ve.isEdge()||ve.isParent()||!n.has(ve))){var Ee=Qs(ve);if(Ee!=null){var Me=Ee.index,ye=Ee.depth;if(!(Me==null||ye==null)){var ee=m[ye].length;ye<Pe&&(Ie+=Me/ee,$e++)}}}}return $e=Math.max(1,$e),Ie=Ie/$e,$e===0&&(Ie=0),W[Ne.id()]=Ie,Ie},re=function(Ne,Pe){var ze=V(Ne),Ie=V(Pe),$e=ze-Ie;return $e===0?XS(Ne.id(),Pe.id()):$e};t.depthSort!==void 0&&(re=t.depthSort);for(var J=m.length,ne=0;ne<J;ne++)m[ne].sort(re),k(ne);for(var X=[],q=0;q<T.length;q++)X.push(T[q]);var Y=function(){for(var Ne=0;Ne<J;Ne++)k(Ne)};X.length&&(m.unshift(X),J=m.length,Y());for(var Q=0,te=0;te<J;te++)Q=Math.max(m[te].length,Q);var ie={x:l.x1+l.w/2,y:l.y1+l.h/2},le=n.reduce(function(Ae,Ne){return(function(Pe){return{w:Ae.w===-1?Pe.w:(Ae.w+Pe.w)/2,h:Ae.h===-1?Pe.h:(Ae.h+Pe.h)/2}})(Ne.boundingBox({includeLabels:t.nodeDimensionsIncludeLabels}))},{w:-1,h:-1}),pe=Math.max(J===1?0:o?(l.h-t.padding*2-le.h)/(J-1):(l.h-t.padding*2-le.h)/(J+1),j),Le=m.reduce(function(Ae,Ne){return Math.max(Ae,Ne.length)},0),je=function(Ne){var Pe=Qs(Ne),ze=Pe.depth,Ie=Pe.index;if(t.circle){var $e=Math.min(l.w/2/J,l.h/2/J);$e=Math.max($e,j);var Ge=$e*ze+$e-(J>0&&m[0].length<=3?$e/2:0),ve=2*Math.PI/m[ze].length*Ie;return ze===0&&m[0].length===1&&(Ge=1),{x:ie.x+Ge*Math.cos(ve),y:ie.y+Ge*Math.sin(ve)}}else{var Ee=m[ze].length,Me=Math.max(Ee===1?0:o?(l.w-t.padding*2-le.w)/((t.grid?Le:Ee)-1):(l.w-t.padding*2-le.w)/((t.grid?Le:Ee)+1),j),ye={x:ie.x+(Ie+1-(Ee+1)/2)*Me,y:ie.y+(ze+1-(J+1)/2)*pe};return ye}},Se={downward:0,leftward:90,upward:180,rightward:-90};Object.keys(Se).indexOf(t.direction)===-1&&sr("Invalid direction '".concat(t.direction,"' specified for breadthfirst layout. Valid values are: ").concat(Object.keys(Se).join(", ")));var Te=function(Ne){return AD(je(Ne),l,Se[t.direction])};return r.nodes().layoutPositions(this,t,Te),this};var xP={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 Q_(t){this.options=mt({},xP,t)}Q_.prototype.run=function(){var t=this.options,e=t,r=t.cy,n=e.eles,i=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,a=n.nodes().not(":parent");e.sort&&(a=a.sort(e.sort));for(var s=sn(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),o={x:s.x1+s.w/2,y:s.y1+s.h/2},l=e.sweep===void 0?2*Math.PI-2*Math.PI/a.length:e.sweep,u=l/Math.max(1,a.length-1),c,d=0,p=0;p<a.length;p++){var f=a[p],x=f.layoutDimensions(e),S=x.w,v=x.h;d=Math.max(d,S,v)}if(Ke(e.radius)?c=e.radius:a.length<=1?c=0:c=Math.min(s.h,s.w)/2-d,a.length>1&&e.avoidOverlap){d*=1.75;var m=Math.cos(u)-Math.cos(0),b=Math.sin(u)-Math.sin(0),w=Math.sqrt(d*d/(m*m+b*b));c=Math.max(w,c)}var _=function(N,E){var k=e.startAngle+E*u*(i?1:-1),L=c*Math.cos(k),A=c*Math.sin(k),M={x:o.x+L,y:o.y+A};return M};return n.nodes().layoutPositions(this,e,_),this};var bP={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 Z_(t){this.options=mt({},bP,t)}Z_.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,a=i.nodes().not(":parent"),s=sn(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),o={x:s.x1+s.w/2,y:s.y1+s.h/2},l=[],u=0,c=0;c<a.length;c++){var d=a[c],p=void 0;p=e.concentric(d),l.push({value:p,node:d}),d._private.scratch.concentric=p}a.updateStyle();for(var f=0;f<a.length;f++){var x=a[f],S=x.layoutDimensions(e);u=Math.max(u,S.w,S.h)}l.sort(function(pe,Le){return Le.value-pe.value});for(var v=e.levelWidth(a),m=[[]],b=m[0],w=0;w<l.length;w++){var _=l[w];if(b.length>0){var T=Math.abs(b[0].value-_.value);T>=v&&(b=[],m.push(b))}b.push(_)}var N=u+e.minNodeSpacing;if(!e.avoidOverlap){var E=m.length>0&&m[0].length>1,k=Math.min(s.w,s.h)/2-N,L=k/(m.length+E?1:0);N=Math.min(N,L)}for(var A=0,M=0;M<m.length;M++){var O=m[M],$=e.sweep===void 0?2*Math.PI-2*Math.PI/O.length:e.sweep,D=O.dTheta=$/Math.max(1,O.length-1);if(O.length>1&&e.avoidOverlap){var B=Math.cos(D)-Math.cos(0),j=Math.sin(D)-Math.sin(0),I=Math.sqrt(N*N/(B*B+j*j));A=Math.max(I,A)}O.r=A,A+=N}if(e.equidistant){for(var U=0,F=0,P=0;P<m.length;P++){var H=m[P],W=H.r-F;U=Math.max(U,W)}F=0;for(var V=0;V<m.length;V++){var re=m[V];V===0&&(F=re.r),re.r=F,F+=U}}for(var J={},ne=0;ne<m.length;ne++)for(var X=m[ne],q=X.dTheta,Y=X.r,Q=0;Q<X.length;Q++){var te=X[Q],ie=e.startAngle+(r?1:-1)*q*Q,le={x:o.x+Y*Math.cos(ie),y:o.y+Y*Math.sin(ie)};J[te.node.id()]=le}return i.nodes().layoutPositions(this,e,function(pe){var Le=pe.id();return J[Le]}),this};var Wg,wP={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 oh(t){this.options=mt({},wP,t),this.options.layout=this;var e=this.options.eles.nodes(),r=this.options.eles.edges(),n=r.filter(function(i){var a=i.source().data("id"),s=i.target().data("id"),o=e.some(function(u){return u.data("id")===a}),l=e.some(function(u){return u.data("id")===s});return!o||!l});this.options.eles=this.options.eles.not(n)}oh.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?Wg=!0:Wg=!1;var n=SP(e,r,t);Wg&&CP(n),t.randomize&&kP(n);var i=Bi(),a=function(){EP(n,e,t),t.fit===!0&&e.fit(t.padding)},s=function(p){return!(r.stopped||p>=t.numIter||(TP(n,t),n.temperature=n.temperature*t.coolingFactor,n.temperature<t.minTemp))},o=function(){if(t.animate===!0||t.animate===!1)a(),r.one("layoutstop",t.stop),r.emit({type:"layoutstop",layout:r});else{var p=t.eles.nodes(),f=eC(n,t,p);p.layoutPositions(r,t,f)}},l=0,u=!0;if(t.animate===!0){var c=function(){for(var p=0;u&&p<t.refresh;)u=s(l),l++,p++;if(!u)Tw(n,t),o();else{var f=Bi();f-i>=t.animationThreshold&&a(),kd(c)}};c()}else{for(;u;)u=s(l),l++;Tw(n,t),o()}return this};oh.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this};oh.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var SP=function(e,r,n){for(var i=n.eles.edges(),a=n.eles.nodes(),s=sn(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:a.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:i.size(),temperature:n.initialTemp,clientWidth:s.w,clientHeight:s.h,boundingBox:s},l=n.eles.components(),u={},c=0;c<l.length;c++)for(var d=l[c],p=0;p<d.length;p++){var f=d[p];u[f.id()]=c}for(var c=0;c<o.nodeSize;c++){var x=a[c],S=x.layoutDimensions(n),v={};v.isLocked=x.locked(),v.id=x.data("id"),v.parentId=x.data("parent"),v.cmptId=u[x.id()],v.children=[],v.positionX=x.position("x"),v.positionY=x.position("y"),v.offsetX=0,v.offsetY=0,v.height=S.w,v.width=S.h,v.maxX=v.positionX+v.width/2,v.minX=v.positionX-v.width/2,v.maxY=v.positionY+v.height/2,v.minY=v.positionY-v.height/2,v.padLeft=parseFloat(x.style("padding")),v.padRight=parseFloat(x.style("padding")),v.padTop=parseFloat(x.style("padding")),v.padBottom=parseFloat(x.style("padding")),v.nodeRepulsion=cr(n.nodeRepulsion)?n.nodeRepulsion(x):n.nodeRepulsion,o.layoutNodes.push(v),o.idToIndex[v.id]=c}for(var m=[],b=0,w=-1,_=[],c=0;c<o.nodeSize;c++){var x=o.layoutNodes[c],T=x.parentId;T!=null?o.layoutNodes[o.idToIndex[T]].children.push(x.id):(m[++w]=x.id,_.push(x.id))}for(o.graphSet.push(_);b<=w;){var N=m[b++],E=o.idToIndex[N],f=o.layoutNodes[E],k=f.children;if(k.length>0){o.graphSet.push(k);for(var c=0;c<k.length;c++)m[++w]=k[c]}}for(var c=0;c<o.graphSet.length;c++)for(var L=o.graphSet[c],p=0;p<L.length;p++){var A=o.idToIndex[L[p]];o.indexToGraph[A]=c}for(var c=0;c<o.edgeSize;c++){var M=i[c],O={};O.id=M.data("id"),O.sourceId=M.data("source"),O.targetId=M.data("target");var $=cr(n.idealEdgeLength)?n.idealEdgeLength(M):n.idealEdgeLength,D=cr(n.edgeElasticity)?n.edgeElasticity(M):n.edgeElasticity,B=o.idToIndex[O.sourceId],j=o.idToIndex[O.targetId],I=o.indexToGraph[B],U=o.indexToGraph[j];if(I!=U){for(var F=_P(O.sourceId,O.targetId,o),P=o.graphSet[F],H=0,v=o.layoutNodes[B];P.indexOf(v.id)===-1;)v=o.layoutNodes[o.idToIndex[v.parentId]],H++;for(v=o.layoutNodes[j];P.indexOf(v.id)===-1;)v=o.layoutNodes[o.idToIndex[v.parentId]],H++;$*=H*n.nestingFactor}O.idealLength=$,O.elasticity=D,o.layoutEdges.push(O)}return o},_P=function(e,r,n){var i=J_(e,r,0,n);return 2>i.count?0:i.graph},J_=function(e,r,n,i){var a=i.graphSet[n];if(-1<a.indexOf(e)&&-1<a.indexOf(r))return{count:2,graph:n};for(var s=0,o=0;o<a.length;o++){var l=a[o],u=i.idToIndex[l],c=i.layoutNodes[u].children;if(c.length!==0){var d=i.indexToGraph[i.idToIndex[c[0]]],p=J_(e,r,d,i);if(p.count!==0)if(p.count===1){if(s++,s===2)break}else return p}}return{count:s,graph:n}},CP,kP=function(e,r){for(var n=e.clientWidth,i=e.clientHeight,a=0;a<e.nodeSize;a++){var s=e.layoutNodes[a];s.children.length===0&&!s.isLocked&&(s.positionX=Math.random()*n,s.positionY=Math.random()*i)}},eC=function(e,r,n){var i=e.boundingBox,a={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return r.boundingBox&&(n.forEach(function(s){var o=e.layoutNodes[e.idToIndex[s.data("id")]];a.x1=Math.min(a.x1,o.positionX),a.x2=Math.max(a.x2,o.positionX),a.y1=Math.min(a.y1,o.positionY),a.y2=Math.max(a.y2,o.positionY)}),a.w=a.x2-a.x1,a.h=a.y2-a.y1),function(s,o){var l=e.layoutNodes[e.idToIndex[s.data("id")]];if(r.boundingBox){var u=a.w===0?.5:(l.positionX-a.x1)/a.w,c=a.h===0?.5:(l.positionY-a.y1)/a.h;return{x:i.x1+u*i.w,y:i.y1+c*i.h}}else return{x:l.positionX,y:l.positionY}}},EP=function(e,r,n){var i=n.layout,a=n.eles.nodes(),s=eC(e,n,a);a.positions(s),e.ready!==!0&&(e.ready=!0,i.one("layoutready",n.ready),i.emit({type:"layoutready",layout:this}))},TP=function(e,r,n){NP(e,r),DP(e),AP(e,r),PP(e),MP(e)},NP=function(e,r){for(var n=0;n<e.graphSet.length;n++)for(var i=e.graphSet[n],a=i.length,s=0;s<a;s++)for(var o=e.layoutNodes[e.idToIndex[i[s]]],l=s+1;l<a;l++){var u=e.layoutNodes[e.idToIndex[i[l]]];RP(o,u,e,r)}},Ew=function(e){return-e+2*e*Math.random()},RP=function(e,r,n,i){var a=e.cmptId,s=r.cmptId;if(!(a!==s&&!n.isCompound)){var o=r.positionX-e.positionX,l=r.positionY-e.positionY,u=1;o===0&&l===0&&(o=Ew(u),l=Ew(u));var c=LP(e,r,o,l);if(c>0)var d=i.nodeOverlap*c,p=Math.sqrt(o*o+l*l),f=d*o/p,x=d*l/p;else var S=Ad(e,o,l),v=Ad(r,-1*o,-1*l),m=v.x-S.x,b=v.y-S.y,w=m*m+b*b,p=Math.sqrt(w),d=(e.nodeRepulsion+r.nodeRepulsion)/w,f=d*m/p,x=d*b/p;e.isLocked||(e.offsetX-=f,e.offsetY-=x),r.isLocked||(r.offsetX+=f,r.offsetY+=x)}},LP=function(e,r,n,i){if(n>0)var a=e.maxX-r.minX;else var a=r.maxX-e.minX;if(i>0)var s=e.maxY-r.minY;else var s=r.maxY-e.minY;return a>=0&&s>=0?Math.sqrt(a*a+s*s):0},Ad=function(e,r,n){var i=e.positionX,a=e.positionY,s=e.height||1,o=e.width||1,l=n/r,u=s/o,c={};return r===0&&0<n||r===0&&0>n?(c.x=i,c.y=a+s/2,c):0<r&&-1*u<=l&&l<=u?(c.x=i+o/2,c.y=a+o*n/2/r,c):0>r&&-1*u<=l&&l<=u?(c.x=i-o/2,c.y=a-o*n/2/r,c):0<n&&(l<=-1*u||l>=u)?(c.x=i+s*r/2/n,c.y=a+s/2,c):(0>n&&(l<=-1*u||l>=u)&&(c.x=i-s*r/2/n,c.y=a-s/2),c)},DP=function(e,r){for(var n=0;n<e.edgeSize;n++){var i=e.layoutEdges[n],a=e.idToIndex[i.sourceId],s=e.layoutNodes[a],o=e.idToIndex[i.targetId],l=e.layoutNodes[o],u=l.positionX-s.positionX,c=l.positionY-s.positionY;if(!(u===0&&c===0)){var d=Ad(s,u,c),p=Ad(l,-1*u,-1*c),f=p.x-d.x,x=p.y-d.y,S=Math.sqrt(f*f+x*x),v=Math.pow(i.idealLength-S,2)/i.elasticity;if(S!==0)var m=v*f/S,b=v*x/S;else var m=0,b=0;s.isLocked||(s.offsetX+=m,s.offsetY+=b),l.isLocked||(l.offsetX-=m,l.offsetY-=b)}}},AP=function(e,r){if(r.gravity!==0)for(var n=1,i=0;i<e.graphSet.length;i++){var a=e.graphSet[i],s=a.length;if(i===0)var o=e.clientHeight/2,l=e.clientWidth/2;else var u=e.layoutNodes[e.idToIndex[a[0]]],c=e.layoutNodes[e.idToIndex[u.parentId]],o=c.positionX,l=c.positionY;for(var d=0;d<s;d++){var p=e.layoutNodes[e.idToIndex[a[d]]];if(!p.isLocked){var f=o-p.positionX,x=l-p.positionY,S=Math.sqrt(f*f+x*x);if(S>n){var v=r.gravity*f/S,m=r.gravity*x/S;p.offsetX+=v,p.offsetY+=m}}}}},PP=function(e,r){var n=[],i=0,a=-1;for(n.push.apply(n,e.graphSet[0]),a+=e.graphSet[0].length;i<=a;){var s=n[i++],o=e.idToIndex[s],l=e.layoutNodes[o],u=l.children;if(0<u.length&&!l.isLocked){for(var c=l.offsetX,d=l.offsetY,p=0;p<u.length;p++){var f=e.layoutNodes[e.idToIndex[u[p]]];f.offsetX+=c,f.offsetY+=d,n[++a]=u[p]}l.offsetX=0,l.offsetY=0}}},MP=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 a=OP(i.offsetX,i.offsetY,e.temperature);i.positionX+=a.x,i.positionY+=a.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,tC(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)}},OP=function(e,r,n){var i=Math.sqrt(e*e+r*r);if(i>n)var a={x:n*e/i,y:n*r/i};else var a={x:e,y:r};return a},tC=function(e,r){var n=e.parentId;if(n!=null){var i=r.layoutNodes[r.idToIndex[n]],a=!1;if((i.maxX==null||e.maxX+i.padRight>i.maxX)&&(i.maxX=e.maxX+i.padRight,a=!0),(i.minX==null||e.minX-i.padLeft<i.minX)&&(i.minX=e.minX-i.padLeft,a=!0),(i.maxY==null||e.maxY+i.padBottom>i.maxY)&&(i.maxY=e.maxY+i.padBottom,a=!0),(i.minY==null||e.minY-i.padTop<i.minY)&&(i.minY=e.minY-i.padTop,a=!0),a)return tC(i,r)}},Tw=function(e,r){for(var n=e.layoutNodes,i=[],a=0;a<n.length;a++){var s=n[a],o=s.cmptId,l=i[o]=i[o]||[];l.push(s)}for(var u=0,a=0;a<i.length;a++){var c=i[a];if(c){c.x1=1/0,c.x2=-1/0,c.y1=1/0,c.y2=-1/0;for(var d=0;d<c.length;d++){var p=c[d];c.x1=Math.min(c.x1,p.positionX-p.width/2),c.x2=Math.max(c.x2,p.positionX+p.width/2),c.y1=Math.min(c.y1,p.positionY-p.height/2),c.y2=Math.max(c.y2,p.positionY+p.height/2)}c.w=c.x2-c.x1,c.h=c.y2-c.y1,u+=c.w*c.h}}i.sort(function(b,w){return w.w*w.h-b.w*b.h});for(var f=0,x=0,S=0,v=0,m=Math.sqrt(u)*e.clientWidth/e.clientHeight,a=0;a<i.length;a++){var c=i[a];if(c){for(var d=0;d<c.length;d++){var p=c[d];p.isLocked||(p.positionX+=f-c.x1,p.positionY+=x-c.y1)}f+=c.w+r.componentSpacing,S+=c.w+r.componentSpacing,v=Math.max(v,c.h),S>m&&(x+=v+r.componentSpacing,f=0,S=0,v=0)}}},jP={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 rC(t){this.options=mt({},jP,t)}rC.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 a=sn(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(a.h===0||a.w===0)n.nodes().layoutPositions(this,e,function(V){return{x:a.x1,y:a.y1}});else{var s=i.size(),o=Math.sqrt(s*a.h/a.w),l=Math.round(o),u=Math.round(a.w/a.h*o),c=function(re){if(re==null)return Math.min(l,u);var J=Math.min(l,u);J==l?l=re:u=re},d=function(re){if(re==null)return Math.max(l,u);var J=Math.max(l,u);J==l?l=re:u=re},p=e.rows,f=e.cols!=null?e.cols:e.columns;if(p!=null&&f!=null)l=p,u=f;else if(p!=null&&f==null)l=p,u=Math.ceil(s/l);else if(p==null&&f!=null)u=f,l=Math.ceil(s/u);else if(u*l>s){var x=c(),S=d();(x-1)*S>=s?c(x-1):(S-1)*x>=s&&d(S-1)}else for(;u*l<s;){var v=c(),m=d();(m+1)*v>=s?d(m+1):c(v+1)}var b=a.w/u,w=a.h/l;if(e.condense&&(b=0,w=0),e.avoidOverlap)for(var _=0;_<i.length;_++){var T=i[_],N=T._private.position;(N.x==null||N.y==null)&&(N.x=0,N.y=0);var E=T.layoutDimensions(e),k=e.avoidOverlapPadding,L=E.w+k,A=E.h+k;b=Math.max(b,L),w=Math.max(w,A)}for(var M={},O=function(re,J){return!!M["c-"+re+"-"+J]},$=function(re,J){M["c-"+re+"-"+J]=!0},D=0,B=0,j=function(){B++,B>=u&&(B=0,D++)},I={},U=0;U<i.length;U++){var F=i[U],P=e.position(F);if(P&&(P.row!==void 0||P.col!==void 0)){var H={row:P.row,col:P.col};if(H.col===void 0)for(H.col=0;O(H.row,H.col);)H.col++;else if(H.row===void 0)for(H.row=0;O(H.row,H.col);)H.row++;I[F.id()]=H,$(H.row,H.col)}}var W=function(re,J){var ne,X;if(re.locked()||re.isParent())return!1;var q=I[re.id()];if(q)ne=q.col*b+b/2+a.x1,X=q.row*w+w/2+a.y1;else{for(;O(D,B);)j();ne=B*b+b/2+a.x1,X=D*w+w/2+a.y1,$(D,B),j()}return{x:ne,y:X}};i.layoutPositions(this,e,W)}return this};var IP={ready:function(){},stop:function(){}};function Fm(t){this.options=mt({},IP,t)}Fm.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};Fm.prototype.stop=function(){return this};var BP={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 nC(t){this.options=mt({},BP,t)}nC.prototype.run=function(){var t=this.options,e=t.eles,r=e.nodes(),n=cr(t.positions);function i(a){if(t.positions==null)return iA(a.position());if(n)return t.positions(a);var s=t.positions[a._private.data.id];return s??null}return r.layoutPositions(this,t,function(a,s){var o=i(a);return a.locked()||o==null?!1:o}),this};var FP={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 iC(t){this.options=mt({},FP,t)}iC.prototype.run=function(){var t=this.options,e=t.cy,r=t.eles,n=sn(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),i=function(s,o){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 zP=[{name:"breadthfirst",impl:X_},{name:"circle",impl:Q_},{name:"concentric",impl:Z_},{name:"cose",impl:oh},{name:"grid",impl:rC},{name:"null",impl:Fm},{name:"preset",impl:nC},{name:"random",impl:iC}];function aC(t){this.options=t,this.notifications=0}var Nw=function(){},Rw=function(){throw new Error("A headless instance can not render images")};aC.prototype={recalculateRenderedStyle:Nw,notify:function(){this.notifications++},init:Nw,isHeadless:function(){return!0},png:Rw,jpg:Rw};var zm={};zm.arrowShapeWidth=.3;zm.registerArrowShapes=function(){var t=this.arrowShapes={},e=this,r=function(u,c,d,p,f,x,S){var v=f.x-d/2-S,m=f.x+d/2+S,b=f.y-d/2-S,w=f.y+d/2+S,_=v<=u&&u<=m&&b<=c&&c<=w;return _},n=function(u,c,d,p,f){var x=u*Math.cos(p)-c*Math.sin(p),S=u*Math.sin(p)+c*Math.cos(p),v=x*d,m=S*d,b=v+f.x,w=m+f.y;return{x:b,y:w}},i=function(u,c,d,p){for(var f=[],x=0;x<u.length;x+=2){var S=u[x],v=u[x+1];f.push(n(S,v,c,d,p))}return f},a=function(u){for(var c=[],d=0;d<u.length;d++){var p=u[d];c.push(p.x,p.y)}return c},s=function(u){return u.pstyle("width").pfValue*u.pstyle("arrow-scale").pfValue*2},o=function(u,c){ht(c)&&(c=t[c]),t[u]=mt({name:u,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(p,f,x,S,v,m){var b=a(i(this.points,x+2*m,S,v)),w=mn(p,f,b);return w},roughCollide:r,draw:function(p,f,x,S){var v=i(this.points,f,x,S);e.arrowShapeImpl("polygon")(p,v)},spacing:function(p){return 0},gap:s},c)};o("none",{collide:Ed,roughCollide:Ed,draw:km,spacing:U1,gap:U1}),o("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),o("arrow","triangle"),o("triangle-backcurve",{points:t.triangle.points,controlPoint:[0,-.15],roughCollide:r,draw:function(u,c,d,p,f){var x=i(this.points,c,d,p),S=this.controlPoint,v=n(S[0],S[1],c,d,p);e.arrowShapeImpl(this.name)(u,x,v)},gap:function(u){return s(u)*.8}}),o("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(u,c,d,p,f,x,S){var v=a(i(this.points,d+2*S,p,f)),m=a(i(this.pointsTee,d+2*S,p,f)),b=mn(u,c,v)||mn(u,c,m);return b},draw:function(u,c,d,p,f){var x=i(this.points,c,d,p),S=i(this.pointsTee,c,d,p);e.arrowShapeImpl(this.name)(u,x,S)}}),o("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(u,c,d,p,f,x,S){var v=f,m=Math.pow(v.x-u,2)+Math.pow(v.y-c,2)<=Math.pow((d+2*S)*this.radius,2),b=a(i(this.points,d+2*S,p,f));return mn(u,c,b)||m},draw:function(u,c,d,p,f){var x=i(this.pointsTr,c,d,p);e.arrowShapeImpl(this.name)(u,x,p.x,p.y,this.radius*c)},spacing:function(u){return e.getArrowWidth(u.pstyle("width").pfValue,u.pstyle("arrow-scale").value)*this.radius}}),o("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(u,c){var d=this.baseCrossLinePts.slice(),p=c/u,f=3,x=5;return d[f]=d[f]-p,d[x]=d[x]-p,d},collide:function(u,c,d,p,f,x,S){var v=a(i(this.points,d+2*S,p,f)),m=a(i(this.crossLinePts(d,x),d+2*S,p,f)),b=mn(u,c,v)||mn(u,c,m);return b},draw:function(u,c,d,p,f){var x=i(this.points,c,d,p),S=i(this.crossLinePts(c,f),c,d,p);e.arrowShapeImpl(this.name)(u,x,S)}}),o("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(u){return s(u)*.525}}),o("circle",{radius:.15,collide:function(u,c,d,p,f,x,S){var v=f,m=Math.pow(v.x-u,2)+Math.pow(v.y-c,2)<=Math.pow((d+2*S)*this.radius,2);return m},draw:function(u,c,d,p,f){e.arrowShapeImpl(this.name)(u,p.x,p.y,this.radius*c)},spacing:function(u){return e.getArrowWidth(u.pstyle("width").pfValue,u.pstyle("arrow-scale").value)*this.radius}}),o("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(u){return 1},gap:function(u){return 1}}),o("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),o("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(u){return u.pstyle("width").pfValue*u.pstyle("arrow-scale").value}}),o("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 xs={};xs.projectIntoViewport=function(t,e){var r=this.cy,n=this.findContainerClientCoords(),i=n[0],a=n[1],s=n[4],o=r.pan(),l=r.zoom(),u=((t-i)/s-o.x)/l,c=((e-a)/s-o.y)/l;return[u,c]};xs.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")},a={left:n("border-left-width"),right:n("border-right-width"),top:n("border-top-width"),bottom:n("border-bottom-width")},s=t.clientWidth,o=t.clientHeight,l=i.left+i.right,u=i.top+i.bottom,c=a.left+a.right,d=e.width/(s+c),p=s-l,f=o-u,x=e.left+i.left+a.left,S=e.top+i.top+a.top;return this.containerBB=[x,S,p,f,d]};xs.invalidateContainerClientCoordsCache=function(){this.containerBB=null};xs.findNearestElement=function(t,e,r,n){return this.findNearestElements(t,e,r,n)[0]};xs.findNearestElements=function(t,e,r,n){var i=this,a=this,s=a.getCachedZSortedEles(),o=[],l=a.cy.zoom(),u=a.cy.hasCompoundNodes(),c=(n?24:8)/l,d=(n?8:2)/l,p=(n?8:2)/l,f=1/0,x,S;r&&(s=s.interactive);function v(E,k){if(E.isNode()){if(S)return;S=E,o.push(E)}if(E.isEdge()&&(k==null||k<f))if(x){if(x.pstyle("z-compound-depth").value===E.pstyle("z-compound-depth").value&&x.pstyle("z-compound-depth").value===E.pstyle("z-compound-depth").value){for(var L=0;L<o.length;L++)if(o[L].isEdge()){o[L]=E,x=E,f=k??f;break}}}else o.push(E),x=E,f=k??f}function m(E){var k=E.outerWidth()+2*d,L=E.outerHeight()+2*d,A=k/2,M=L/2,O=E.position(),$=E.pstyle("corner-radius").value==="auto"?"auto":E.pstyle("corner-radius").pfValue,D=E._private.rscratch;if(O.x-A<=t&&t<=O.x+A&&O.y-M<=e&&e<=O.y+M){var B=a.nodeShapes[i.getNodeShape(E)];if(B.checkPoint(t,e,0,k,L,O.x,O.y,$,D))return v(E,0),!0}}function b(E){var k=E._private,L=k.rscratch,A=E.pstyle("width").pfValue,M=E.pstyle("arrow-scale").value,O=A/2+c,$=O*O,D=O*2,U=k.source,F=k.target,B;if(L.edgeType==="segments"||L.edgeType==="straight"||L.edgeType==="haystack"){for(var j=L.allpts,I=0;I+3<j.length;I+=2)if(xA(t,e,j[I],j[I+1],j[I+2],j[I+3],D)&&$>(B=CA(t,e,j[I],j[I+1],j[I+2],j[I+3])))return v(E,B),!0}else if(L.edgeType==="bezier"||L.edgeType==="multibezier"||L.edgeType==="self"||L.edgeType==="compound"){for(var j=L.allpts,I=0;I+5<L.allpts.length;I+=4)if(bA(t,e,j[I],j[I+1],j[I+2],j[I+3],j[I+4],j[I+5],D)&&$>(B=_A(t,e,j[I],j[I+1],j[I+2],j[I+3],j[I+4],j[I+5])))return v(E,B),!0}for(var U=U||k.source,F=F||k.target,P=i.getArrowWidth(A,M),H=[{name:"source",x:L.arrowStartX,y:L.arrowStartY,angle:L.srcArrowAngle},{name:"target",x:L.arrowEndX,y:L.arrowEndY,angle:L.tgtArrowAngle},{name:"mid-source",x:L.midX,y:L.midY,angle:L.midsrcArrowAngle},{name:"mid-target",x:L.midX,y:L.midY,angle:L.midtgtArrowAngle}],I=0;I<H.length;I++){var W=H[I],V=a.arrowShapes[E.pstyle(W.name+"-arrow-shape").value],re=E.pstyle("width").pfValue;if(V.roughCollide(t,e,P,W.angle,{x:W.x,y:W.y},re,c)&&V.collide(t,e,P,W.angle,{x:W.x,y:W.y},re,c))return v(E),!0}u&&o.length>0&&(m(U),m(F))}function w(E,k,L){return rn(E,k,L)}function _(E,k){var L=E._private,A=p,M;k?M=k+"-":M="",E.boundingBox();var O=L.labelBounds[k||"main"],$=E.pstyle(M+"label").value,D=E.pstyle("text-events").strValue==="yes";if(!(!D||!$)){var B=w(L.rscratch,"labelX",k),j=w(L.rscratch,"labelY",k),I=w(L.rscratch,"labelAngle",k),U=E.pstyle(M+"text-margin-x").pfValue,F=E.pstyle(M+"text-margin-y").pfValue,P=O.x1-A-U,H=O.x2+A-U,W=O.y1-A-F,V=O.y2+A-F;if(I){var re=Math.cos(I),J=Math.sin(I),ne=function(le,pe){return le=le-B,pe=pe-j,{x:le*re-pe*J+B,y:le*J+pe*re+j}},X=ne(P,W),q=ne(P,V),Y=ne(H,W),Q=ne(H,V),te=[X.x+U,X.y+F,Y.x+U,Y.y+F,Q.x+U,Q.y+F,q.x+U,q.y+F];if(mn(t,e,te))return v(E),!0}else if(ga(O,t,e))return v(E),!0}}for(var T=s.length-1;T>=0;T--){var N=s[T];N.isNode()?m(N)||_(N):b(N)||_(N)||_(N,"source")||_(N,"target")}return o};xs.getAllInBox=function(t,e,r,n){var i=this.getCachedZSortedEles().interactive,a=this.cy.zoom(),s=2/a,o=[],l=Math.min(t,r),u=Math.max(t,r),c=Math.min(e,n),d=Math.max(e,n);t=l,r=u,e=c,n=d;var p=sn({x1:t,y1:e,x2:r,y2:n}),f=[{x:p.x1,y:p.y1},{x:p.x2,y:p.y1},{x:p.x2,y:p.y2},{x:p.x1,y:p.y2}],x=[[f[0],f[1]],[f[1],f[2]],[f[2],f[3]],[f[3],f[0]]];function S(le,pe,Le){return rn(le,pe,Le)}function v(le,pe){var Le=le._private,je=s,Se="";le.boundingBox();var Te=Le.labelBounds.main;if(!Te)return null;var Ae=S(Le.rscratch,"labelX",pe),Ne=S(Le.rscratch,"labelY",pe),Pe=S(Le.rscratch,"labelAngle",pe),ze=le.pstyle(Se+"text-margin-x").pfValue,Ie=le.pstyle(Se+"text-margin-y").pfValue,$e=Te.x1-je-ze,Ge=Te.x2+je-ze,ve=Te.y1-je-Ie,Ee=Te.y2+je-Ie;if(Pe){var Me=Math.cos(Pe),ye=Math.sin(Pe),ee=function(ae,se){return ae=ae-Ae,se=se-Ne,{x:ae*Me-se*ye+Ae,y:ae*ye+se*Me+Ne}};return[ee($e,ve),ee(Ge,ve),ee(Ge,Ee),ee($e,Ee)]}else return[{x:$e,y:ve},{x:Ge,y:ve},{x:Ge,y:Ee},{x:$e,y:Ee}]}function m(le,pe,Le,je){function Se(Te,Ae,Ne){return(Ne.y-Te.y)*(Ae.x-Te.x)>(Ae.y-Te.y)*(Ne.x-Te.x)}return Se(le,Le,je)!==Se(pe,Le,je)&&Se(le,pe,Le)!==Se(le,pe,je)}for(var b=0;b<i.length;b++){var w=i[b];if(w.isNode()){var _=w,T=_.pstyle("text-events").strValue==="yes",N=_.pstyle("box-selection").strValue,E=_.pstyle("box-select-labels").strValue==="yes";if(N==="none")continue;var k=(N==="overlap"||E)&&T,L=_.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:k});if(N==="contain"){var A=!1;if(E&&T){var M=v(_);M&&Hp(M,f)&&(o.push(_),A=!0)}!A&&h_(p,L)&&o.push(_)}else if(N==="overlap"&&Rm(p,L)){var O=_.boundingBox({includeNodes:!0,includeEdges:!0,includeLabels:!1,includeMainLabels:!1,includeSourceLabels:!1,includeTargetLabels:!1}),$=[{x:O.x1,y:O.y1},{x:O.x2,y:O.y1},{x:O.x2,y:O.y2},{x:O.x1,y:O.y2}];if(Hp($,f))o.push(_);else{var D=v(_);D&&Hp(D,f)&&o.push(_)}}}else{var B=w,j=B._private,I=j.rscratch,U=B.pstyle("box-selection").strValue;if(U==="none")continue;if(U==="contain"){if(I.startX!=null&&I.startY!=null&&!ga(p,I.startX,I.startY)||I.endX!=null&&I.endY!=null&&!ga(p,I.endX,I.endY))continue;if(I.edgeType==="bezier"||I.edgeType==="multibezier"||I.edgeType==="self"||I.edgeType==="compound"||I.edgeType==="segments"||I.edgeType==="haystack"){for(var F=j.rstyle.bezierPts||j.rstyle.linePts||j.rstyle.haystackPts,P=!0,H=0;H<F.length;H++)if(!Y1(p,F[H])){P=!1;break}P&&o.push(B)}else I.edgeType==="straight"&&o.push(B)}else if(U==="overlap"){var W=!1;if(I.startX!=null&&I.startY!=null&&I.endX!=null&&I.endY!=null&&(ga(p,I.startX,I.startY)||ga(p,I.endX,I.endY)))o.push(B),W=!0;else if(!W&&I.edgeType==="haystack"){for(var V=j.rstyle.haystackPts,re=0;re<V.length;re++)if(Y1(p,V[re])){o.push(B),W=!0;break}}if(!W){var J=j.rstyle.bezierPts||j.rstyle.linePts||j.rstyle.haystackPts;if((!J||J.length<2)&&I.edgeType==="straight"&&I.startX!=null&&I.startY!=null&&I.endX!=null&&I.endY!=null&&(J=[{x:I.startX,y:I.startY},{x:I.endX,y:I.endY}]),!J||J.length<2)continue;for(var ne=0;ne<J.length-1;ne++){for(var X=J[ne],q=J[ne+1],Y=0;Y<x.length;Y++){var Q=br(x[Y],2),te=Q[0],ie=Q[1];if(m(X,q,te,ie)){o.push(B),W=!0;break}}if(W)break}}}}}return o};var Pd={};Pd.calculateArrowAngles=function(t){var e=t._private.rscratch,r=e.edgeType==="haystack",n=e.edgeType==="bezier",i=e.edgeType==="multibezier",a=e.edgeType==="segments",s=e.edgeType==="compound",o=e.edgeType==="self",l,u,c,d,p,f,m,b;if(r?(c=e.haystackPts[0],d=e.haystackPts[1],p=e.haystackPts[2],f=e.haystackPts[3]):(c=e.arrowStartX,d=e.arrowStartY,p=e.arrowEndX,f=e.arrowEndY),m=e.midX,b=e.midY,a)l=c-e.segpts[0],u=d-e.segpts[1];else if(i||s||o||n){var x=e.allpts,S=Dr(x[0],x[2],x[4],.1),v=Dr(x[1],x[3],x[5],.1);l=c-S,u=d-v}else l=c-m,u=d-b;e.srcArrowAngle=zc(l,u);var m=e.midX,b=e.midY;if(r&&(m=(c+p)/2,b=(d+f)/2),l=p-c,u=f-d,a){var x=e.allpts;if(x.length/2%2===0){var w=x.length/2,_=w-2;l=x[w]-x[_],u=x[w+1]-x[_+1]}else if(e.isRound)l=e.midVector[1],u=-e.midVector[0];else{var w=x.length/2-1,_=w-2;l=x[w]-x[_],u=x[w+1]-x[_+1]}}else if(i||s||o){var x=e.allpts,T=e.ctrlpts,N,E,k,L;if(T.length/2%2===0){var A=x.length/2-1,M=A+2,O=M+2;N=Dr(x[A],x[M],x[O],0),E=Dr(x[A+1],x[M+1],x[O+1],0),k=Dr(x[A],x[M],x[O],1e-4),L=Dr(x[A+1],x[M+1],x[O+1],1e-4)}else{var M=x.length/2-1,A=M-2,O=M+2;N=Dr(x[A],x[M],x[O],.4999),E=Dr(x[A+1],x[M+1],x[O+1],.4999),k=Dr(x[A],x[M],x[O],.5),L=Dr(x[A+1],x[M+1],x[O+1],.5)}l=k-N,u=L-E}if(e.midtgtArrowAngle=zc(l,u),e.midDispX=l,e.midDispY=u,l*=-1,u*=-1,a){var x=e.allpts;if(x.length/2%2!==0){if(!e.isRound){var w=x.length/2-1,$=w+2;l=-(x[$]-x[w]),u=-(x[$+1]-x[w+1])}}}if(e.midsrcArrowAngle=zc(l,u),a)l=p-e.segpts[e.segpts.length-2],u=f-e.segpts[e.segpts.length-1];else if(i||s||o||n){var x=e.allpts,D=x.length,S=Dr(x[D-6],x[D-4],x[D-2],.9),v=Dr(x[D-5],x[D-3],x[D-1],.9);l=p-S,u=f-v}else l=p-m,u=f-b;e.tgtArrowAngle=zc(l,u)};Pd.getArrowWidth=Pd.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 zv,$v,mi={},Bn={},Lw,Dw,ss,hd,Oi,Xa,ns,gi,Zs,Yc,sC,oC,Hv,Uv,Aw,Pw=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)},$P=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},HP=function(e,r,n,i,a){if(e!==Aw?Pw(r,e,mi):$P(Bn,mi),Pw(r,n,Bn),Lw=mi.nx*Bn.ny-mi.ny*Bn.nx,Dw=mi.nx*Bn.nx-mi.ny*-Bn.ny,Oi=Math.asin(Math.max(-1,Math.min(1,Lw))),Math.abs(Oi)<1e-6){zv=r.x,$v=r.y,ns=Zs=0;return}ss=1,hd=!1,Dw<0?Oi<0?Oi=Math.PI+Oi:(Oi=Math.PI-Oi,ss=-1,hd=!0):Oi>0&&(ss=-1,hd=!0),r.radius!==void 0?Zs=r.radius:Zs=i,Xa=Oi/2,Yc=Math.min(mi.len/2,Bn.len/2),a?(gi=Math.abs(Math.cos(Xa)*Zs/Math.sin(Xa)),gi>Yc?(gi=Yc,ns=Math.abs(gi*Math.sin(Xa)/Math.cos(Xa))):ns=Zs):(gi=Math.min(Yc,Zs),ns=Math.abs(gi*Math.sin(Xa)/Math.cos(Xa))),Hv=r.x+Bn.nx*gi,Uv=r.y+Bn.ny*gi,zv=Hv-Bn.ny*ns*ss,$v=Uv+Bn.nx*ns*ss,sC=r.x+mi.nx*gi,oC=r.y+mi.ny*gi,Aw=r};function lC(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 $m(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}:(HP(t,e,r,n,i),{cx:zv,cy:$v,radius:ns,startX:sC,startY:oC,stopX:Hv,stopY:Uv,startAngle:mi.ang+Math.PI/2*ss,endAngle:Bn.ang-Math.PI/2*ss,counterClockwise:hd})}var ru=.01,UP=Math.sqrt(2*ru),Kr={};Kr.findMidptPtsEtc=function(t,e){var r=e.posPts,n=e.intersectionPts,i=e.vectorNormInverse,a,s=t.pstyle("source-endpoint"),o=t.pstyle("target-endpoint"),l=s.units!=null&&o.units!=null,u=function(T,N,E,k){var L=k-N,A=E-T,M=Math.sqrt(A*A+L*L);return{x:-L/M,y:A/M}},c=t.pstyle("edge-distances").value;switch(c){case"node-position":a=r;break;case"intersection":a=n;break;case"endpoints":{if(l){var d=this.manualEndptToPx(t.source()[0],s),p=br(d,2),f=p[0],x=p[1],S=this.manualEndptToPx(t.target()[0],o),v=br(S,2),m=v[0],b=v[1],w={x1:f,y1:x,x2:m,y2:b};i=u(f,x,m,b),a=w}else Ht("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).")),a=n;break}}return{midptPts:a,vectorNormInverse:i}};Kr.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 a=Math.random()*2*Math.PI;i.source={x:Math.cos(a),y:Math.sin(a)},a=Math.random()*2*Math.PI,i.target={x:Math.cos(a),y:Math.sin(a)}}var s=n.source,o=n.target,l=s.position(),u=o.position(),c=s.width(),d=o.width(),p=s.height(),f=o.height(),x=r.pstyle("haystack-radius").value,S=x/2;i.haystackPts=i.allpts=[i.source.x*c*S+l.x,i.source.y*p*S+l.y,i.target.x*d*S+u.x,i.target.y*f*S+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)}};Kr.findSegmentsPoints=function(t,e){var r=t._private.rscratch,n=t.pstyle("segment-weights"),i=t.pstyle("segment-distances"),a=t.pstyle("segment-radii"),s=t.pstyle("radius-type"),o=Math.min(n.pfValue.length,i.pfValue.length),l=a.pfValue[a.pfValue.length-1],u=s.pfValue[s.pfValue.length-1];r.edgeType="segments",r.segpts=[],r.radii=[],r.isArcRadius=[];for(var c=0;c<o;c++){var d=n.pfValue[c],p=i.pfValue[c],f=1-d,x=d,S=this.findMidptPtsEtc(t,e),v=S.midptPts,m=S.vectorNormInverse,b={x:v.x1*f+v.x2*x,y:v.y1*f+v.y2*x};r.segpts.push(b.x+m.x*p,b.y+m.y*p),r.radii.push(a.pfValue[c]!==void 0?a.pfValue[c]:l),r.isArcRadius.push((s.pfValue[c]!==void 0?s.pfValue[c]:u)==="arc-radius")}};Kr.findLoopPoints=function(t,e,r,n){var i=t._private.rscratch,a=e.dirCounts,s=e.srcPos,o=t.pstyle("control-point-distances"),l=o?o.pfValue[0]:void 0,u=t.pstyle("loop-direction").pfValue,c=t.pstyle("loop-sweep").pfValue,d=t.pstyle("control-point-step-size").pfValue;i.edgeType="self";var p=r,f=d;n&&(p=0,f=l);var x=u-Math.PI/2,S=x-c/2,v=x+c/2,m=u+"_"+c;p=a[m]===void 0?a[m]=0:++a[m],i.ctrlpts=[s.x+Math.cos(S)*1.4*f*(p/3+1),s.y+Math.sin(S)*1.4*f*(p/3+1),s.x+Math.cos(v)*1.4*f*(p/3+1),s.y+Math.sin(v)*1.4*f*(p/3+1)]};Kr.findCompoundLoopPoints=function(t,e,r,n){var i=t._private.rscratch;i.edgeType="compound";var a=e.srcPos,s=e.tgtPos,o=e.srcW,l=e.srcH,u=e.tgtW,c=e.tgtH,d=t.pstyle("control-point-step-size").pfValue,p=t.pstyle("control-point-distances"),f=p?p.pfValue[0]:void 0,x=r,S=d;n&&(x=0,S=f);var v=50,m={x:a.x-o/2,y:a.y-l/2},b={x:s.x-u/2,y:s.y-c/2},w={x:Math.min(m.x,b.x),y:Math.min(m.y,b.y)},_=.5,T=Math.max(_,Math.log(o*ru)),N=Math.max(_,Math.log(u*ru));i.ctrlpts=[w.x,w.y-(1+Math.pow(v,1.12)/100)*S*(x/3+1)*T,w.x-(1+Math.pow(v,1.12)/100)*S*(x/3+1)*N,w.y]};Kr.findStraightEdgePoints=function(t){t._private.rscratch.edgeType="straight"};Kr.findBezierPoints=function(t,e,r,n,i){var a=t._private.rscratch,s=t.pstyle("control-point-step-size").pfValue,o=t.pstyle("control-point-distances"),l=t.pstyle("control-point-weights"),u=o&&l?Math.min(o.value.length,l.value.length):1,c=o?o.pfValue[0]:void 0,d=l.value[0],p=n;a.edgeType=p?"multibezier":"bezier",a.ctrlpts=[];for(var f=0;f<u;f++){var x=(.5-e.eles.length/2+r)*s*(i?-1:1),S=void 0,v=Nm(x);p&&(c=o?o.pfValue[f]:s,d=l.value[f]),n?S=c:S=c!==void 0?v*c:void 0;var m=S!==void 0?S:x,b=1-d,w=d,_=this.findMidptPtsEtc(t,e),T=_.midptPts,N=_.vectorNormInverse,E={x:T.x1*b+T.x2*w,y:T.y1*b+T.y2*w};a.ctrlpts.push(E.x+N.x*m,E.y+N.y*m)}};Kr.findTaxiPoints=function(t,e){var r=t._private.rscratch;r.edgeType="segments";var n="vertical",i="horizontal",a="leftward",s="rightward",o="downward",l="upward",u="auto",c=e.posPts,d=e.srcW,p=e.srcH,f=e.tgtW,x=e.tgtH,S=t.pstyle("edge-distances").value,v=S!=="node-position",m=t.pstyle("taxi-direction").value,b=m,w=t.pstyle("taxi-turn"),_=w.units==="%",T=w.pfValue,N=T<0,E=t.pstyle("taxi-turn-min-distance").pfValue,k=v?(d+f)/2:0,L=v?(p+x)/2:0,A=c.x2-c.x1,M=c.y2-c.y1,O=function(se,ce){return se>0?Math.max(se-ce,0):Math.min(se+ce,0)},$=O(A,k),D=O(M,L),B=!1;b===u?m=Math.abs($)>Math.abs(D)?i:n:b===l||b===o?(m=n,B=!0):(b===a||b===s)&&(m=i,B=!0);var j=m===n,I=j?D:$,U=j?M:A,F=Nm(U),P=!1;!(B&&(_||N))&&(b===o&&U<0||b===l&&U>0||b===a&&U>0||b===s&&U<0)&&(F*=-1,I=F*Math.abs(I),P=!0);var H;if(_){var W=T<0?1+T:T;H=W*I}else{var V=T<0?I:0;H=V+T*F}var re=function(se){return Math.abs(se)<E||Math.abs(se)>=Math.abs(I)},J=re(H),ne=re(Math.abs(I)-Math.abs(H)),X=J||ne;if(X&&!P)if(j){var q=Math.abs(U)<=p/2,Y=Math.abs(A)<=f/2;if(q){var Q=(c.x1+c.x2)/2,te=c.y1,ie=c.y2;r.segpts=[Q,te,Q,ie]}else if(Y){var le=(c.y1+c.y2)/2,pe=c.x1,Le=c.x2;r.segpts=[pe,le,Le,le]}else r.segpts=[c.x1,c.y2]}else{var je=Math.abs(U)<=d/2,Se=Math.abs(M)<=x/2;if(je){var Te=(c.y1+c.y2)/2,Ae=c.x1,Ne=c.x2;r.segpts=[Ae,Te,Ne,Te]}else if(Se){var Pe=(c.x1+c.x2)/2,ze=c.y1,Ie=c.y2;r.segpts=[Pe,ze,Pe,Ie]}else r.segpts=[c.x2,c.y1]}else if(j){var $e=c.y1+H+(v?p/2*F:0),Ge=c.x1,ve=c.x2;r.segpts=[Ge,$e,ve,$e]}else{var Ee=c.x1+H+(v?d/2*F:0),Me=c.y1,ye=c.y2;r.segpts=[Ee,Me,Ee,ye]}if(r.isRound){var ee=t.pstyle("taxi-radius").value,ue=t.pstyle("radius-type").value[0]==="arc-radius";r.radii=new Array(r.segpts.length/2).fill(ee),r.isArcRadius=new Array(r.segpts.length/2).fill(ue)}};Kr.tryToCorrectInvalidPoints=function(t,e){var r=t._private.rscratch;if(r.edgeType==="bezier"){var n=e.srcPos,i=e.tgtPos,a=e.srcW,s=e.srcH,o=e.tgtW,l=e.tgtH,u=e.srcShape,c=e.tgtShape,d=e.srcCornerRadius,p=e.tgtCornerRadius,f=e.srcRs,x=e.tgtRs,S=!Ke(r.startX)||!Ke(r.startY),v=!Ke(r.arrowStartX)||!Ke(r.arrowStartY),m=!Ke(r.endX)||!Ke(r.endY),b=!Ke(r.arrowEndX)||!Ke(r.arrowEndY),w=3,_=this.getArrowWidth(t.pstyle("width").pfValue,t.pstyle("arrow-scale").value)*this.arrowShapeWidth,T=w*_,N=hs({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.startX,y:r.startY}),E=N<T,k=hs({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.endX,y:r.endY}),L=k<T,A=!1;if(S||v||E){A=!0;var M={x:r.ctrlpts[0]-n.x,y:r.ctrlpts[1]-n.y},O=Math.sqrt(M.x*M.x+M.y*M.y),$={x:M.x/O,y:M.y/O},D=Math.max(a,s),B={x:r.ctrlpts[0]+$.x*2*D,y:r.ctrlpts[1]+$.y*2*D},j=u.intersectLine(n.x,n.y,a,s,B.x,B.y,0,d,f);E?(r.ctrlpts[0]=r.ctrlpts[0]+$.x*(T-N),r.ctrlpts[1]=r.ctrlpts[1]+$.y*(T-N)):(r.ctrlpts[0]=j[0]+$.x*T,r.ctrlpts[1]=j[1]+$.y*T)}if(m||b||L){A=!0;var I={x:r.ctrlpts[0]-i.x,y:r.ctrlpts[1]-i.y},U=Math.sqrt(I.x*I.x+I.y*I.y),F={x:I.x/U,y:I.y/U},P=Math.max(a,s),H={x:r.ctrlpts[0]+F.x*2*P,y:r.ctrlpts[1]+F.y*2*P},W=c.intersectLine(i.x,i.y,o,l,H.x,H.y,0,p,x);L?(r.ctrlpts[0]=r.ctrlpts[0]+F.x*(T-k),r.ctrlpts[1]=r.ctrlpts[1]+F.y*(T-k)):(r.ctrlpts[0]=W[0]+F.x*T,r.ctrlpts[1]=W[1]+F.y*T)}A&&this.findEndpoints(t)}};Kr.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=Dr(e.allpts[n],e.allpts[n+2],e.allpts[n+4],i),e.midY=Dr(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 a=2;a+3<e.allpts.length;a+=2){var s=e.radii[a/2-1],o=e.isArcRadius[a/2-1];e.roundCorners.push($m({x:e.allpts[a-2],y:e.allpts[a-1]},{x:e.allpts[a],y:e.allpts[a+1],radius:s},{x:e.allpts[a+2],y:e.allpts[a+3]},s,o))}}if(e.segpts.length%4===0){var l=e.segpts.length/2,u=l-2;e.midX=(e.segpts[u]+e.segpts[l])/2,e.midY=(e.segpts[u+1]+e.segpts[l+1])/2}else{var c=e.segpts.length/2-1;if(!e.isRound)e.midX=e.segpts[c],e.midY=e.segpts[c+1];else{var d={x:e.segpts[c],y:e.segpts[c+1]},p=e.roundCorners[c/2];if(p.radius===0){var f={x:e.segpts[c+2],y:e.segpts[c+3]};e.midX=d.x,e.midY=d.y,e.midVector=[d.y-f.y,f.x-d.x]}else{var x=[d.x-p.cx,d.y-p.cy],S=p.radius/Math.sqrt(Math.pow(x[0],2)+Math.pow(x[1],2));x=x.map(function(v){return v*S}),e.midX=p.cx+x[0],e.midY=p.cy+x[1],e.midVector=x}}}}};Kr.checkForInvalidEdgeWarning=function(t){var e=t[0]._private.rscratch;e.nodesOverlap||Ke(e.startX)&&Ke(e.startY)&&Ke(e.endX)&&Ke(e.endY)?e.loggedErr=!1:e.loggedErr||(e.loggedErr=!0,Ht("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."))};Kr.findEdgeControlPoints=function(t){var e=this;if(!(!t||t.length===0)){for(var r=this,n=r.cy,i=n.hasCompoundNodes(),a=new Ii,s=function(L,A){return[].concat(_d(L),[A?1:0]).join("-")},o=[],l=[],u=0;u<t.length;u++){var c=t[u],d=c._private,p=c.pstyle("curve-style").value;if(!(c.removed()||!c.takesUpSpace())){if(p==="haystack"){l.push(c);continue}var f=p==="unbundled-bezier"||pa(p,"segments")||p==="straight"||p==="straight-triangle"||pa(p,"taxi"),x=p==="unbundled-bezier"||p==="bezier",S=d.source,v=d.target,m=S.poolIndex(),b=v.poolIndex(),w=[m,b].sort(),_=s(w,f),T=a.get(_);T==null&&(T={eles:[]},o.push({pairId:w,edgeIsUnbundled:f}),a.set(_,T)),T.eles.push(c),f&&(T.hasUnbundled=!0),x&&(T.hasBezier=!0)}}for(var N=function(){var L=o[E],A=L.pairId,M=L.edgeIsUnbundled,O=s(A,M),$=a.get(O),D;if(!$.hasUnbundled){var B=$.eles[0].parallelEdges().filter(function(ue){return ue.isBundledBezier()});Em($.eles),B.forEach(function(ue){return $.eles.push(ue)}),$.eles.sort(function(ue,ae){return ue.poolIndex()-ae.poolIndex()})}var j=$.eles[0],I=j.source(),U=j.target();if(I.poolIndex()>U.poolIndex()){var F=I;I=U,U=F}var P=$.srcPos=I.position(),H=$.tgtPos=U.position(),W=$.srcW=I.outerWidth(),V=$.srcH=I.outerHeight(),re=$.tgtW=U.outerWidth(),J=$.tgtH=U.outerHeight(),ne=$.srcShape=r.nodeShapes[e.getNodeShape(I)],X=$.tgtShape=r.nodeShapes[e.getNodeShape(U)],q=$.srcCornerRadius=I.pstyle("corner-radius").value==="auto"?"auto":I.pstyle("corner-radius").pfValue,Y=$.tgtCornerRadius=U.pstyle("corner-radius").value==="auto"?"auto":U.pstyle("corner-radius").pfValue,Q=$.tgtRs=U._private.rscratch,te=$.srcRs=I._private.rscratch;$.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var ie=0;ie<$.eles.length;ie++){var le=$.eles[ie],pe=le[0]._private.rscratch,Le=le.pstyle("curve-style").value,je=Le==="unbundled-bezier"||pa(Le,"segments")||pa(Le,"taxi"),Se=!I.same(le.source());if(!$.calculatedIntersection&&I!==U&&($.hasBezier||$.hasUnbundled)){$.calculatedIntersection=!0;var Te=ne.intersectLine(P.x,P.y,W,V,H.x,H.y,0,q,te),Ae=$.srcIntn=Te,Ne=X.intersectLine(H.x,H.y,re,J,P.x,P.y,0,Y,Q),Pe=$.tgtIntn=Ne,ze=$.intersectionPts={x1:Te[0],x2:Ne[0],y1:Te[1],y2:Ne[1]},Ie=$.posPts={x1:P.x,x2:H.x,y1:P.y,y2:H.y},$e=Ne[1]-Te[1],Ge=Ne[0]-Te[0],ve=Math.sqrt(Ge*Ge+$e*$e);Ke(ve)&&ve>=UP||(ve=Math.sqrt(Math.max(Ge*Ge,ru)+Math.max($e*$e,ru)));var Ee=$.vector={x:Ge,y:$e},Me=$.vectorNorm={x:Ee.x/ve,y:Ee.y/ve},ye={x:-Me.y,y:Me.x};$.nodesOverlap=!Ke(ve)||X.checkPoint(Te[0],Te[1],0,re,J,H.x,H.y,Y,Q)||ne.checkPoint(Ne[0],Ne[1],0,W,V,P.x,P.y,q,te),$.vectorNormInverse=ye,D={nodesOverlap:$.nodesOverlap,dirCounts:$.dirCounts,calculatedIntersection:!0,hasBezier:$.hasBezier,hasUnbundled:$.hasUnbundled,eles:$.eles,srcPos:H,srcRs:Q,tgtPos:P,tgtRs:te,srcW:re,srcH:J,tgtW:W,tgtH:V,srcIntn:Pe,tgtIntn:Ae,srcShape:X,tgtShape:ne,posPts:{x1:Ie.x2,y1:Ie.y2,x2:Ie.x1,y2:Ie.y1},intersectionPts:{x1:ze.x2,y1:ze.y2,x2:ze.x1,y2:ze.y1},vector:{x:-Ee.x,y:-Ee.y},vectorNorm:{x:-Me.x,y:-Me.y},vectorNormInverse:{x:-ye.x,y:-ye.y}}}var ee=Se?D:$;pe.nodesOverlap=ee.nodesOverlap,pe.srcIntn=ee.srcIntn,pe.tgtIntn=ee.tgtIntn,pe.isRound=Le.startsWith("round"),i&&(I.isParent()||I.isChild()||U.isParent()||U.isChild())&&(I.parents().anySame(U)||U.parents().anySame(I)||I.same(U)&&I.isParent())?e.findCompoundLoopPoints(le,ee,ie,je):I===U?e.findLoopPoints(le,ee,ie,je):Le.endsWith("segments")?e.findSegmentsPoints(le,ee):Le.endsWith("taxi")?e.findTaxiPoints(le,ee):Le==="straight"||!je&&$.eles.length%2===1&&ie===Math.floor($.eles.length/2)?e.findStraightEdgePoints(le):e.findBezierPoints(le,ee,ie,je,Se),e.findEndpoints(le),e.tryToCorrectInvalidPoints(le,ee),e.checkForInvalidEdgeWarning(le),e.storeAllpts(le),e.storeEdgeProjections(le),e.calculateArrowAngles(le),e.recalculateEdgeLabelProjections(le),e.calculateLabelAngles(le)}},E=0;E<o.length;E++)N();this.findHaystackPoints(l)}};function uC(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}}Kr.getSegmentPoints=function(t){var e=t[0]._private.rscratch;this.recalculateRenderedStyle(t);var r=e.edgeType;if(r==="segments")return uC(e.segpts)};Kr.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 uC(e.ctrlpts)};Kr.getEdgeMidpoint=function(t){var e=t[0]._private.rscratch;return this.recalculateRenderedStyle(t),{x:e.midX,y:e.midY}};var gu={};gu.manualEndptToPx=function(t,e){var r=this,n=t.position(),i=t.outerWidth(),a=t.outerHeight(),s=t._private.rscratch;if(e.value.length===2){var o=[e.pfValue[0],e.pfValue[1]];return e.units[0]==="%"&&(o[0]=o[0]*i),e.units[1]==="%"&&(o[1]=o[1]*a),o[0]+=n.x,o[1]+=n.y,o}else{var l=e.pfValue[0];l=-Math.PI/2+l;var u=2*Math.max(i,a),c=[n.x+Math.cos(l)*u,n.y+Math.sin(l)*u];return r.nodeShapes[this.getNodeShape(t)].intersectLine(n.x,n.y,i,a,c[0],c[1],0,t.pstyle("corner-radius").value==="auto"?"auto":t.pstyle("corner-radius").pfValue,s)}};gu.findEndpoints=function(t){var e,r,n,i,a=this,s,o=t.source()[0],l=t.target()[0],u=o.position(),c=l.position(),d=t.pstyle("target-arrow-shape").value,p=t.pstyle("source-arrow-shape").value,f=t.pstyle("target-distance-from-node").pfValue,x=t.pstyle("source-distance-from-node").pfValue,S=o._private.rscratch,v=l._private.rscratch,m=t.pstyle("curve-style").value,b=t._private.rscratch,w=b.edgeType,_=pa(m,"taxi"),T=w==="self"||w==="compound",N=w==="bezier"||w==="multibezier"||T,E=w!=="bezier",k=w==="straight"||w==="segments",L=w==="segments",A=N||E||k,M=T||_,O=t.pstyle("source-endpoint"),$=M?"outside-to-node":O.value,D=o.pstyle("corner-radius").value==="auto"?"auto":o.pstyle("corner-radius").pfValue,B=t.pstyle("target-endpoint"),j=M?"outside-to-node":B.value,I=l.pstyle("corner-radius").value==="auto"?"auto":l.pstyle("corner-radius").pfValue;b.srcManEndpt=O,b.tgtManEndpt=B;var U,F,P,H,W=(e=(B==null||(r=B.pfValue)===null||r===void 0?void 0:r.length)===2?B.pfValue:null)!==null&&e!==void 0?e:[0,0],V=(n=(O==null||(i=O.pfValue)===null||i===void 0?void 0:i.length)===2?O.pfValue:null)!==null&&n!==void 0?n:[0,0];if(N){var re=[b.ctrlpts[0],b.ctrlpts[1]],J=E?[b.ctrlpts[b.ctrlpts.length-2],b.ctrlpts[b.ctrlpts.length-1]]:re;U=J,F=re}else if(k){var ne=L?b.segpts.slice(0,2):[c.x+W[0],c.y+W[1]],X=L?b.segpts.slice(b.segpts.length-2):[u.x+V[0],u.y+V[1]];U=X,F=ne}if(j==="inside-to-node")s=[c.x,c.y];else if(B.units)s=this.manualEndptToPx(l,B);else if(j==="outside-to-line")s=b.tgtIntn;else if(j==="outside-to-node"||j==="outside-to-node-or-label"?P=U:(j==="outside-to-line"||j==="outside-to-line-or-label")&&(P=[u.x,u.y]),s=a.nodeShapes[this.getNodeShape(l)].intersectLine(c.x,c.y,l.outerWidth(),l.outerHeight(),P[0],P[1],0,I,v),j==="outside-to-node-or-label"||j==="outside-to-line-or-label"){var q=l._private.rscratch,Y=q.labelWidth,Q=q.labelHeight,te=q.labelX,ie=q.labelY,le=Y/2,pe=Q/2,Le=l.pstyle("text-valign").value;Le=Co(Le),Le==="top"?ie-=pe:Le==="bottom"&&(ie+=pe);var je=l.pstyle("text-halign").value;je=_o(je),je==="left"?te-=le:je==="right"&&(te+=le);var Se=Ql(P[0],P[1],[te-le,ie-pe,te+le,ie-pe,te+le,ie+pe,te-le,ie+pe],c.x,c.y);if(Se.length>0){var Te=u,Ae=rs(Te,lo(s)),Ne=rs(Te,lo(Se)),Pe=Ae;if(Ne<Ae&&(s=Se,Pe=Ne),Se.length>2){var ze=rs(Te,{x:Se[2],y:Se[3]});ze<Pe&&(s=[Se[2],Se[3]])}}}var Ie=$c(s,U,a.arrowShapes[d].spacing(t)+f),$e=$c(s,U,a.arrowShapes[d].gap(t)+f);if(b.endX=$e[0],b.endY=$e[1],b.arrowEndX=Ie[0],b.arrowEndY=Ie[1],$==="inside-to-node")s=[u.x,u.y];else if(O.units)s=this.manualEndptToPx(o,O);else if($==="outside-to-line")s=b.srcIntn;else if($==="outside-to-node"||$==="outside-to-node-or-label"?H=F:($==="outside-to-line"||$==="outside-to-line-or-label")&&(H=[c.x,c.y]),s=a.nodeShapes[this.getNodeShape(o)].intersectLine(u.x,u.y,o.outerWidth(),o.outerHeight(),H[0],H[1],0,D,S),$==="outside-to-node-or-label"||$==="outside-to-line-or-label"){var Ge=o._private.rscratch,ve=Ge.labelWidth,Ee=Ge.labelHeight,Me=Ge.labelX,ye=Ge.labelY,ee=ve/2,ue=Ee/2,ae=o.pstyle("text-valign").value;ae=Co(ae),ae==="top"?ye-=ue:ae==="bottom"&&(ye+=ue);var se=o.pstyle("text-halign").value;se=_o(se),se==="left"?Me-=ee:se==="right"&&(Me+=ee);var ce=Ql(H[0],H[1],[Me-ee,ye-ue,Me+ee,ye-ue,Me+ee,ye+ue,Me-ee,ye+ue],u.x,u.y);if(ce.length>0){var be=c,he=rs(be,lo(s)),de=rs(be,lo(ce)),me=he;if(de<he&&(s=[ce[0],ce[1]],me=de),ce.length>2){var ke=rs(be,{x:ce[2],y:ce[3]});ke<me&&(s=[ce[2],ce[3]])}}}var Re=$c(s,F,a.arrowShapes[p].spacing(t)+x),Ce=$c(s,F,a.arrowShapes[p].gap(t)+x);b.startX=Ce[0],b.startY=Ce[1],b.arrowStartX=Re[0],b.arrowStartY=Re[1],A&&(!Ke(b.startX)||!Ke(b.startY)||!Ke(b.endX)||!Ke(b.endY)?b.badLine=!0:b.badLine=!1)};gu.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}}};gu.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 Hm={};function WP(t,e,r){for(var n=function(u,c,d,p){return Dr(u,c,d,p)},i=e._private,a=i.rstyle.bezierPts,s=0;s<t.bezierProjPcts.length;s++){var o=t.bezierProjPcts[s];a.push({x:n(r[0],r[2],r[4],o),y:n(r[1],r[3],r[5],o)})}}Hm.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)WP(this,t,r.allpts.slice(i,i+6))}else if(n==="segments")for(var a=e.rstyle.linePts=[],i=0;i+1<r.allpts.length;i+=2)a.push({x:r.allpts[i],y:r.allpts[i+1]});else if(n==="haystack"){var s=r.haystackPts;e.rstyle.haystackPts=[{x:s[0],y:s[1]},{x:s[2],y:s[3]}]}e.rstyle.arrowWidth=this.getArrowWidth(t.pstyle("width").pfValue,t.pstyle("arrow-scale").value)*this.arrowShapeWidth};Hm.recalculateEdgeProjections=function(t){this.findEdgeControlPoints(t)};var Si={};Si.recalculateNodeLabelProjection=function(t){var e=t.pstyle("label").strValue;if(!xa(e)){var r,n,i=t._private,a=t.width(),s=t.height(),o=t.padding(),l=t.position(),u=t.pstyle("text-halign").strValue,c=t.pstyle("text-valign").strValue,d=i.rscratch,p=i.rstyle;switch(u){case"left":r=l.x-a/2-o;break;case"left-inside":r=l.x-a/2+o;break;case"right":r=l.x+a/2+o;break;case"right-inside":r=l.x+a/2-o;break;default:r=l.x}switch(c){case"top":n=l.y-s/2-o;break;case"top-inside":n=l.y-s/2+o;break;case"bottom":n=l.y+s/2+o;break;case"bottom-inside":n=l.y+s/2-o;break;default:n=l.y}d.labelX=r,d.labelY=n,p.labelX=r,p.labelY=n,this.calculateLabelAngles(t),this.applyLabelDimensions(t)}};var cC=function(e,r){var n=Math.atan(r/e);return e===0&&n<0&&(n=n*-1),n},dC=function(e,r){var n=r.x-e.x,i=r.y-e.y;return cC(n,i)},VP=function(e,r,n,i){var a=Xl(0,i-.001,1),s=Xl(0,i+.001,1),o=vo(e,r,n,a),l=vo(e,r,n,s);return dC(o,l)};Si.recalculateEdgeLabelProjections=function(t){var e,r=t._private,n=r.rscratch,i=this,a={mid:t.pstyle("label").strValue,source:t.pstyle("source-label").strValue,target:t.pstyle("target-label").strValue};if(a.mid||a.source||a.target){e={x:n.midX,y:n.midY};var s=function(d,p,f){xi(r.rscratch,d,p,f),xi(r.rstyle,d,p,f)};s("labelX",null,e.x),s("labelY",null,e.y);var o=cC(n.midDispX,n.midDispY);s("labelAutoAngle",null,o);var l=function(){if(l.cache)return l.cache;for(var d=[],p=0;p+5<n.allpts.length;p+=4){var f={x:n.allpts[p],y:n.allpts[p+1]},x={x:n.allpts[p+2],y:n.allpts[p+3]},S={x:n.allpts[p+4],y:n.allpts[p+5]};d.push({p0:f,p1:x,p2:S,startDist:0,length:0,segments:[]})}var v=r.rstyle.bezierPts,m=i.bezierProjPcts.length;function b(E,k,L,A,M){var O=hs(k,L),$=E.segments[E.segments.length-1],D={p0:k,p1:L,t0:A,t1:M,startDist:$?$.startDist+$.length:0,length:O};E.segments.push(D),E.length+=O}for(var w=0;w<d.length;w++){var _=d[w],T=d[w-1];T&&(_.startDist=T.startDist+T.length),b(_,_.p0,v[w*m],0,i.bezierProjPcts[0]);for(var N=0;N<m-1;N++)b(_,v[w*m+N],v[w*m+N+1],i.bezierProjPcts[N],i.bezierProjPcts[N+1]);b(_,v[w*m+m-1],_.p2,i.bezierProjPcts[m-1],1)}return l.cache=d},u=function(d){var p,f=d==="source";if(a[d]){var x=t.pstyle(d+"-text-offset").pfValue;switch(n.edgeType){case"self":case"compound":case"bezier":case"multibezier":{for(var S=l(),v,m=0,b=0,w=0;w<S.length;w++){for(var _=S[f?w:S.length-1-w],T=0;T<_.segments.length;T++){var N=_.segments[f?T:_.segments.length-1-T],E=w===S.length-1&&T===_.segments.length-1;if(m=b,b+=N.length,b>=x||E){v={cp:_,segment:N};break}}if(v)break}var k=v.cp,L=v.segment,A=(x-m)/L.length,M=L.t1-L.t0,O=f?L.t0+M*A:L.t1-M*A;O=Xl(0,O,1),e=vo(k.p0,k.p1,k.p2,O),p=VP(k.p0,k.p1,k.p2,O);break}case"straight":case"segments":case"haystack":{for(var $=0,D,B,j,I,U=n.allpts.length,F=0;F+3<U&&(f?(j={x:n.allpts[F],y:n.allpts[F+1]},I={x:n.allpts[F+2],y:n.allpts[F+3]}):(j={x:n.allpts[U-2-F],y:n.allpts[U-1-F]},I={x:n.allpts[U-4-F],y:n.allpts[U-3-F]}),D=hs(j,I),B=$,$+=D,!($>=x));F+=2);var P=x-B,H=P/D;H=Xl(0,H,1),e=hA(j,I,H),p=dC(j,I);break}}s("labelX",d,e.x),s("labelY",d,e.y),s("labelAutoAngle",d,p)}};u("source"),u("target"),this.applyLabelDimensions(t)}};Si.applyLabelDimensions=function(t){this.applyPrefixedLabelDimensions(t),t.isEdge()&&(this.applyPrefixedLabelDimensions(t,"source"),this.applyPrefixedLabelDimensions(t,"target"))};Si.applyPrefixedLabelDimensions=function(t,e){var r=t._private,n=this.getLabelText(t,e),i=ds(n,t._private.labelDimsKey);if(rn(r.rscratch,"prefixedLabelDimsKey",e)!==i){xi(r.rscratch,"prefixedLabelDimsKey",e,i);var a=this.calculateLabelDimensions(t,n),s=t.pstyle("line-height").pfValue,o=t.pstyle("font-size").pfValue,l=t.pstyle("text-wrap").strValue,u=rn(r.rscratch,"labelWrapCachedLines",e)||[],c=l!=="wrap"?1:Math.max(u.length,1),d=o*s,p=a.width,f=a.height+(c-1)*(s-1)*o;xi(r.rstyle,"labelWidth",e,p),xi(r.rscratch,"labelWidth",e,p),xi(r.rstyle,"labelHeight",e,f),xi(r.rscratch,"labelHeight",e,f),xi(r.rscratch,"labelLineHeight",e,d),xi(r.rscratch,"labelActualDescent",e,a.labelActualDescent)}};Si.getLabelText=function(t,e){var r=t._private,n=e?e+"-":"",i=t.pstyle(n+"label").strValue,a=t.pstyle("text-transform").value,s=function(V,re){return re?(xi(r.rscratch,V,e,re),re):rn(r.rscratch,V,e)};if(!i)return"";a=="none"||(a=="uppercase"?i=i.toUpperCase():a=="lowercase"&&(i=i.toLowerCase()));var o=t.pstyle("text-wrap").value;if(o==="wrap"){var l=s("labelKey");if(l!=null&&s("labelWrapKey")===l)return s("labelWrapCachedText");for(var u="",c=i.split(`
|
|
64
|
+
`),d=t.pstyle("text-max-width").pfValue,p=t.pstyle("text-overflow-wrap").value,f=p==="anywhere",x=[],S=/[\s\u200b]+|$/g,v=0;v<c.length;v++){var m=c[v],b=this.calculateLabelDimensions(t,m),w=b.width;if(f){var _=m.split("").join(u);m=_}if(w>d){var T=m.matchAll(S),N="",E=0,k=yn(T),L;try{for(k.s();!(L=k.n()).done;){var A=L.value,M=A[0],O=m.substring(E,A.index);E=A.index+M.length;var $=N.length===0?O:N+O+M,D=this.calculateLabelDimensions(t,$),B=D.width;B<=d?N+=O+M:(N&&x.push(N),N=O+M)}}catch(W){k.e(W)}finally{k.f()}N.match(/^[\s\u200b]+$/)||x.push(N)}else x.push(m)}s("labelWrapCachedLines",x),i=s("labelWrapCachedText",x.join(`
|
|
65
|
+
`)),s("labelWrapKey",l)}else if(o==="ellipsis"){var j=t.pstyle("text-max-width").pfValue,I="",U="…",F=!1;if(this.calculateLabelDimensions(t,i).width<j)return i;for(var P=0;P<i.length;P++){var H=this.calculateLabelDimensions(t,I+i[P]+U).width;if(H>j)break;I+=i[P],P===i.length-1&&(F=!0)}return F||(I+=U),I}return i};Si.getLabelJustification=function(t){var e=t.pstyle("text-justification").strValue,r=t.pstyle("text-halign").strValue;return e==="auto"?t.isNode()?A4(r):"center":e};Si.calculateLabelDimensions=function(t,e){var r=this,n=r.cy.window(),i=n.document,a=0,s=t.pstyle("font-style").strValue,o=t.pstyle("font-size").pfValue,l=t.pstyle("font-family").strValue,u=t.pstyle("font-weight").strValue,c=t.pstyle("text-metrics").strValue||"font",d=this.labelCalcCanvas,p=this.labelCalcCanvasContext;if(!d){d=this.labelCalcCanvas=i.createElement("canvas"),p=this.labelCalcCanvasContext=d.getContext("2d");var f=d.style;f.position="absolute",f.left="-9999px",f.top="-9999px",f.zIndex="-1",f.visibility="hidden",f.pointerEvents="none"}p.font="".concat(s," ").concat(u," ").concat(o,"px ").concat(l);for(var x=0,S=0,v=e.split(`
|
|
66
|
+
`),m=v.length,b=0,w=0,_=0;_<m;_++){var T=v[_],N=p.measureText(T),E=Math.ceil(N.width),k=o;c==="glyph"&&(_===0&&(w=N.actualBoundingBoxAscent),_===m-1&&(b=N.actualBoundingBoxDescent)),x=Math.max(E,x),S+=k}return c==="glyph"&&(S-=o-w-b),x+=a,S+=a,{width:x,height:S,labelActualAscent:w,labelActualDescent:b}};Si.calculateLabelAngle=function(t,e){var r=t._private,n=r.rscratch,i=t.isEdge(),a=e?e+"-":"",s=t.pstyle(a+"text-rotation"),o=s.strValue;return o==="none"?0:i&&o==="autorotate"?n.labelAutoAngle:o==="autorotate"?0:s.pfValue};Si.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 hC={},Mw=28,Ow=!1;hC.getNodeShape=function(t){var e=this,r=t.pstyle("shape").value;if(r==="cutrectangle"&&(t.width()<Mw||t.height()<Mw))return Ow||(Ht("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),Ow=!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 lh={};lh.registerCalculationListeners=function(){var t=this.cy,e=t.collection(),r=this,n=function(s){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e.merge(s),o)for(var l=0;l<s.length;l++){var u=s[l],c=u._private,d=c.rstyle;d.clean=!1,d.cleanConnected=!1}};r.binder(t).on("bounds.* dirty.*",function(s){var o=s.target;n(o)}).on("style.* background.*",function(s){var o=s.target;n(o,!1)});var i=function(s){if(s){var o=r.onUpdateEleCalcsFns;e.cleanStyle();for(var l=0;l<e.length;l++){var u=e[l],c=u._private.rstyle;u.isNode()&&!c.cleanConnected&&(n(u.connectedEdges()),c.cleanConnected=!0)}if(o)for(var d=0;d<o.length;d++){var p=o[d];p(s,e)}r.recalculateRenderedStyle(e),e=t.collection()}};r.flushRenderedStyleQueue=function(){i(!0)},r.beforeRender(i,r.beforeRenderPriorities.eleCalcs)};lh.onUpdateEleCalcs=function(t){var e=this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[];e.push(t)};lh.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 a=0;a<t.length;a++){var s=t[a],o=s._private,l=o.rstyle;s.isEdge()&&(!r(s.source())||!r(s.target()))&&(l.clean=!1),s.isEdge()&&s.isBundledBezier()&&s.parallelEdges().some(function(w){return!w._private.rstyle.clean&&w.isBundledBezier()})&&(l.clean=!1),!(e&&l.clean||s.removed())&&s.pstyle("display").value!=="none"&&(o.group==="nodes"?i.push(s):n.push(s),l.clean=!0)}for(var u=0;u<i.length;u++){var c=i[u],d=c._private,p=d.rstyle,f=c.position();this.recalculateNodeLabelProjection(c),p.nodeX=f.x,p.nodeY=f.y,p.nodeW=c.pstyle("width").pfValue,p.nodeH=c.pstyle("height").pfValue}this.recalculateEdgeProjections(n);for(var x=0;x<n.length;x++){var S=n[x],v=S._private,m=v.rstyle,b=v.rscratch;m.srcX=b.arrowStartX,m.srcY=b.arrowStartY,m.tgtX=b.arrowEndX,m.tgtY=b.arrowEndY,m.midX=b.midX,m.midY=b.midY,m.labelAngle=b.labelAngle,m.sourceLabelAngle=b.sourceLabelAngle,m.targetLabelAngle=b.targetLabelAngle}}}};var uh={};uh.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)}}};uh.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null};uh.getCachedZSortedEles=function(t){if(t||!this.cachedZSortedEles){var e=this.cy.mutableElements().toArray();e.sort(q_),e.interactive=e.filter(function(r){return r.interactive()}),this.cachedZSortedEles=e,this.updateCachedGrabbedEles()}else e=this.cachedZSortedEles;return e};var fC={};[xs,Pd,Kr,gu,Hm,Si,hC,lh,uh].forEach(function(t){mt(fC,t)});var pC={};pC.getCachedImage=function(t,e,r){var n=this,i=n.imageCache=n.imageCache||{},a=i[t];if(a)return a.image.complete||a.image.addEventListener("load",r),a.image;a=i[t]=i[t]||{};var s=a.image=new Image;s.addEventListener("load",r),s.addEventListener("error",function(){s.error=!0});var o="data:",l=t.substring(0,o.length).toLowerCase()===o;return l||(e=e==="null"?null:e,s.crossOrigin=e),s.src=t,s};var gC=function(e,r){var n=e[0];!n||n._private.grabbed===r||(n._private.grabbed=r,e.updateStyle(!1))},GP=function(e){gC(e,!0)},qP=function(e){gC(e,!1)},Lo={};Lo.registerBinding=function(t,e,r,n){var i=Array.prototype.slice.apply(arguments,[1]);if(Array.isArray(t)){for(var a=[],s=0;s<t.length;s++){var o=t[s];if(o!==void 0){var l=this.binder(o);a.push(l.on.apply(l,i))}}return a}var l=this.binder(t);return l.on.apply(l,i)};Lo.binder=function(t){var e=this,r=e.cy.window(),n=t===r||t===r.document||t===r.document.body||tD(t);if(e.supportsPassiveEvents==null){var i=!1;try{var a=Object.defineProperty({},"passive",{get:function(){return i=!0,!0}});r.addEventListener("test",null,a)}catch{}e.supportsPassiveEvents=i}var s=function(l,u,c){var d=Array.prototype.slice.call(arguments);return n&&e.supportsPassiveEvents&&(d[2]={capture:c??!1,passive:!1,once:!1}),e.bindings.push({target:t,args:d}),(t.addEventListener||t.on).apply(t,d),this};return{on:s,addEventListener:s,addListener:s,bind:s}};Lo.nodeIsDraggable=function(t){return t&&t.isNode()&&!t.locked()&&t.grabbable()};Lo.nodeIsGrabbable=function(t){return this.nodeIsDraggable(t)&&t.interactive()};Lo.load=function(){var t=this,e=t.cy.window(),r=function(ee){return ee.selected()},n=function(ee){var ue=ee.getRootNode();if(ue&&ue.nodeType===11&&ue.host!==void 0)return ue},i=function(ee,ue,ae,se){ee==null&&(ee=t.cy);for(var ce=0;ce<ue.length;ce++){var be=ue[ce];ee.emit({originalEvent:ae,type:be,position:se})}},a=function(ee){return ee.shiftKey||ee.metaKey||ee.ctrlKey},s=function(ee,ue){var ae=!0;if(t.cy.hasCompoundNodes()&&ee&&ee.pannable())for(var se=0;ue&&se<ue.length;se++){var ee=ue[se];if(ee.isNode()&&ee.isParent()&&!ee.pannable()){ae=!1;break}}else ae=!0;return ae},o=function(ee){ee[0]._private.rscratch.inDragLayer=!0},l=function(ee){ee[0]._private.rscratch.inDragLayer=!1},u=function(ee){ee[0]._private.rscratch.isGrabTarget=!0},c=function(ee){ee[0]._private.rscratch.isGrabTarget=!1},d=function(ee,ue){var ae=ue.addToList,se=ae.has(ee);!se&&ee.grabbable()&&!ee.locked()&&(ae.merge(ee),GP(ee))},p=function(ee,ue){if(ee.cy().hasCompoundNodes()&&!(ue.inDragLayer==null&&ue.addToList==null)){var ae=ee.descendants();ue.inDragLayer&&(ae.forEach(o),ae.connectedEdges().forEach(o)),ue.addToList&&d(ae,ue)}},f=function(ee,ue){ue=ue||{};var ae=ee.cy().hasCompoundNodes();ue.inDragLayer&&(ee.forEach(o),ee.neighborhood().stdFilter(function(se){return!ae||se.isEdge()}).forEach(o)),ue.addToList&&ee.forEach(function(se){d(se,ue)}),p(ee,ue),v(ee,{inDragLayer:ue.inDragLayer}),t.updateCachedGrabbedEles()},x=f,S=function(ee){ee&&(t.getCachedZSortedEles().forEach(function(ue){qP(ue),l(ue),c(ue)}),t.updateCachedGrabbedEles())},v=function(ee,ue){if(!(ue.inDragLayer==null&&ue.addToList==null)&&ee.cy().hasCompoundNodes()){var ae=ee.ancestors().orphans();if(!ae.same(ee)){var se=ae.descendants().spawnSelf().merge(ae).unmerge(ee).unmerge(ee.descendants()),ce=se.connectedEdges();ue.inDragLayer&&(ce.forEach(o),se.forEach(o)),ue.addToList&&se.forEach(function(be){d(be,ue)})}}},m=function(){document.activeElement!=null&&document.activeElement.blur!=null&&document.activeElement.blur()},b=typeof MutationObserver<"u",w=typeof ResizeObserver<"u";b?(t.removeObserver=new MutationObserver(function(ye){for(var ee=0;ee<ye.length;ee++){var ue=ye[ee],ae=ue.removedNodes;if(ae)for(var se=0;se<ae.length;se++){var ce=ae[se];if(ce===t.container){t.destroy();break}}}}),t.container.parentNode&&t.removeObserver.observe(t.container.parentNode,{childList:!0})):t.registerBinding(t.container,"DOMNodeRemoved",function(ye){t.destroy()});var _=du(function(){t.cy.resize()},100);b&&(t.styleObserver=new MutationObserver(_),t.styleObserver.observe(t.container,{attributes:!0})),t.registerBinding(e,"resize",_),w&&(t.resizeObserver=new ResizeObserver(_),t.resizeObserver.observe(t.container));var T=function(ee,ue){for(;ee!=null;)ue(ee),ee=ee.parentNode},N=function(){t.invalidateContainerClientCoordsCache()};T(t.container,function(ye){t.registerBinding(ye,"transitionend",N),t.registerBinding(ye,"animationend",N),t.registerBinding(ye,"scroll",N)}),t.registerBinding(t.container,"contextmenu",function(ye){ye.preventDefault()});var E=function(){return t.selection[4]!==0},k=function(ee){for(var ue=t.findContainerClientCoords(),ae=ue[0],se=ue[1],ce=ue[2],be=ue[3],he=ee.touches?ee.touches:[ee],de=!1,me=0;me<he.length;me++){var ke=he[me];if(ae<=ke.clientX&&ke.clientX<=ae+ce&&se<=ke.clientY&&ke.clientY<=se+be){de=!0;break}}if(!de)return!1;for(var Re=t.container,Ce=ee.target,De=Ce.parentNode,Qe=!1;De;){if(De===Re){Qe=!0;break}De=De.parentNode}return!!Qe};t.registerBinding(t.container,"mousedown",function(ee){if(k(ee)&&!(t.hoverData.which===1&&ee.which!==1)){ee.preventDefault(),m(),t.hoverData.capture=!0,t.hoverData.which=ee.which;var ue=t.cy,ae=[ee.clientX,ee.clientY],se=t.projectIntoViewport(ae[0],ae[1]),ce=t.selection,be=t.findNearestElements(se[0],se[1],!0,!1),he=be[0],de=t.dragData.possibleDragElements;t.hoverData.mdownPos=se,t.hoverData.mdownGPos=ae;var me=function(Xe){return{originalEvent:ee,type:Xe,position:{x:se[0],y:se[1]}}},ke=function(){t.hoverData.tapholdCancelled=!1,clearTimeout(t.hoverData.tapholdTimeout),t.hoverData.tapholdTimeout=setTimeout(function(){if(!t.hoverData.tapholdCancelled){var Xe=t.hoverData.down;Xe?Xe.emit(me("taphold")):ue.emit(me("taphold"))}},t.tapholdDuration)};if(ee.which==3){t.hoverData.cxtStarted=!0;var Re={originalEvent:ee,type:"cxttapstart",position:{x:se[0],y:se[1]}};he?(he.activate(),he.emit(Re),t.hoverData.down=he):ue.emit(Re),t.hoverData.downTime=new Date().getTime(),t.hoverData.cxtDragged=!1}else if(ee.which==1){he&&he.activate();{if(he!=null&&t.nodeIsGrabbable(he)){var Ce=function(Xe){Xe.emit(me("grab"))};if(u(he),!he.selected())de=t.dragData.possibleDragElements=ue.collection(),x(he,{addToList:de}),he.emit(me("grabon")).emit(me("grab"));else{de=t.dragData.possibleDragElements=ue.collection();var De=ue.$(function(Qe){return Qe.isNode()&&Qe.selected()&&t.nodeIsGrabbable(Qe)});f(De,{addToList:de}),he.emit(me("grabon")),De.forEach(Ce)}t.redrawHint("eles",!0),t.redrawHint("drag",!0)}t.hoverData.down=he,t.hoverData.downs=be,t.hoverData.downTime=new Date().getTime()}i(he,["mousedown","tapstart","vmousedown"],ee,{x:se[0],y:se[1]}),he==null?(ce[4]=1,t.data.bgActivePosistion={x:se[0],y:se[1]},t.redrawHint("select",!0),t.redraw()):he.pannable()&&(ce[4]=1),ke()}ce[0]=ce[2]=se[0],ce[1]=ce[3]=se[1]}},!1);var L=n(t.container);t.registerBinding([e,L],"mousemove",function(ee){var ue=t.hoverData.capture;if(!(!ue&&!k(ee))){var ae=!1,se=t.cy,ce=se.zoom(),be=[ee.clientX,ee.clientY],he=t.projectIntoViewport(be[0],be[1]),de=t.hoverData.mdownPos,me=t.hoverData.mdownGPos,ke=t.selection,Re=null;!t.hoverData.draggingEles&&!t.hoverData.dragging&&!t.hoverData.selecting&&(Re=t.findNearestElement(he[0],he[1],!0,!1));var Ce=t.hoverData.last,De=t.hoverData.down,Qe=[he[0]-ke[2],he[1]-ke[3]],Xe=t.dragData.possibleDragElements,yt;if(me){var et=be[0]-me[0],Ze=et*et,ct=be[1]-me[1],tt=ct*ct,Ye=Ze+tt;t.hoverData.isOverThresholdDrag=yt=Ye>=t.desktopTapThreshold2}var kt=a(ee);yt&&(t.hoverData.tapholdCancelled=!0);var ft=function(){var dr=t.hoverData.dragDelta=t.hoverData.dragDelta||[];dr.length===0?(dr.push(Qe[0]),dr.push(Qe[1])):(dr[0]+=Qe[0],dr[1]+=Qe[1])};ae=!0,i(Re,["mousemove","vmousemove","tapdrag"],ee,{x:he[0],y:he[1]});var ut=function(dr){return{originalEvent:ee,type:dr,position:{x:he[0],y:he[1]}}},Ft=function(){t.data.bgActivePosistion=void 0,t.hoverData.selecting||se.emit(ut("boxstart")),ke[4]=1,t.hoverData.selecting=!0,t.redrawHint("select",!0),t.redraw()};if(t.hoverData.which===3){if(yt){var Tt=ut("cxtdrag");De?De.emit(Tt):se.emit(Tt),t.hoverData.cxtDragged=!0,(!t.hoverData.cxtOver||Re!==t.hoverData.cxtOver)&&(t.hoverData.cxtOver&&t.hoverData.cxtOver.emit(ut("cxtdragout")),t.hoverData.cxtOver=Re,Re&&Re.emit(ut("cxtdragover")))}}else if(t.hoverData.dragging){if(ae=!0,se.panningEnabled()&&se.userPanningEnabled()){var Vt;if(t.hoverData.justStartedPan){var jt=t.hoverData.mdownPos;Vt={x:(he[0]-jt[0])*ce,y:(he[1]-jt[1])*ce},t.hoverData.justStartedPan=!1}else Vt={x:Qe[0]*ce,y:Qe[1]*ce};se.panBy(Vt),se.emit(ut("dragpan")),t.hoverData.dragged=!0}he=t.projectIntoViewport(ee.clientX,ee.clientY)}else if(ke[4]==1&&(De==null||De.pannable())){if(yt){if(!t.hoverData.dragging&&se.boxSelectionEnabled()&&(kt||!se.panningEnabled()||!se.userPanningEnabled()))Ft();else if(!t.hoverData.selecting&&se.panningEnabled()&&se.userPanningEnabled()){var vr=s(De,t.hoverData.downs);vr&&(t.hoverData.dragging=!0,t.hoverData.justStartedPan=!0,ke[4]=0,t.data.bgActivePosistion=lo(de),t.redrawHint("select",!0),t.redraw())}De&&De.pannable()&&De.active()&&De.unactivate()}}else{if(De&&De.pannable()&&De.active()&&De.unactivate(),(!De||!De.grabbed())&&Re!=Ce&&(Ce&&i(Ce,["mouseout","tapdragout"],ee,{x:he[0],y:he[1]}),Re&&i(Re,["mouseover","tapdragover"],ee,{x:he[0],y:he[1]}),t.hoverData.last=Re),De)if(yt){if(se.boxSelectionEnabled()&&kt)De&&De.grabbed()&&(S(Xe),De.emit(ut("freeon")),Xe.emit(ut("free")),t.dragData.didDrag&&(De.emit(ut("dragfreeon")),Xe.emit(ut("dragfree")))),Ft();else if(De&&De.grabbed()&&t.nodeIsDraggable(De)){var or=!t.dragData.didDrag;or&&t.redrawHint("eles",!0),t.dragData.didDrag=!0,t.hoverData.draggingEles||f(Xe,{inDragLayer:!0});var ir={x:0,y:0};if(Ke(Qe[0])&&Ke(Qe[1])&&(ir.x+=Qe[0],ir.y+=Qe[1],or)){var zt=t.hoverData.dragDelta;zt&&Ke(zt[0])&&Ke(zt[1])&&(ir.x+=zt[0],ir.y+=zt[1])}t.hoverData.draggingEles=!0,Xe.silentShift(ir).emit(ut("position")).emit(ut("drag")),t.redrawHint("drag",!0),t.redraw()}}else ft();ae=!0}if(ke[2]=he[0],ke[3]=he[1],ae)return ee.stopPropagation&&ee.stopPropagation(),ee.preventDefault&&ee.preventDefault(),!1}},!1);var A,M,O;t.registerBinding(e,"mouseup",function(ee){if(!(t.hoverData.which===1&&ee.which!==1&&t.hoverData.capture)){var ue=t.hoverData.capture;if(ue){t.hoverData.capture=!1;var ae=t.cy,se=t.projectIntoViewport(ee.clientX,ee.clientY),ce=t.selection,be=t.findNearestElement(se[0],se[1],!0,!1),he=t.dragData.possibleDragElements,de=t.hoverData.down,me=a(ee);t.data.bgActivePosistion&&(t.redrawHint("select",!0),t.redraw()),t.hoverData.tapholdCancelled=!0,t.data.bgActivePosistion=void 0,de&&de.unactivate();var ke=function(et){return{originalEvent:ee,type:et,position:{x:se[0],y:se[1]}}};if(t.hoverData.which===3){var Re=ke("cxttapend");if(de?de.emit(Re):ae.emit(Re),!t.hoverData.cxtDragged){var Ce=ke("cxttap");de?de.emit(Ce):ae.emit(Ce)}t.hoverData.cxtDragged=!1,t.hoverData.which=null}else if(t.hoverData.which===1){if(i(be,["mouseup","tapend","vmouseup"],ee,{x:se[0],y:se[1]}),!t.dragData.didDrag&&!t.hoverData.dragged&&!t.hoverData.selecting&&!t.hoverData.isOverThresholdDrag&&(i(de,["click","tap","vclick"],ee,{x:se[0],y:se[1]}),M=!1,ee.timeStamp-O<=ae.multiClickDebounceTime()?(A&&clearTimeout(A),M=!0,O=null,i(de,["dblclick","dbltap","vdblclick"],ee,{x:se[0],y:se[1]})):(A=setTimeout(function(){M||i(de,["oneclick","onetap","voneclick"],ee,{x:se[0],y:se[1]})},ae.multiClickDebounceTime()),O=ee.timeStamp)),de==null&&!t.dragData.didDrag&&!t.hoverData.selecting&&!t.hoverData.dragged&&!a(ee)&&(ae.$(r).unselect(["tapunselect"]),he.length>0&&t.redrawHint("eles",!0),t.dragData.possibleDragElements=he=ae.collection()),be==de&&!t.dragData.didDrag&&!t.hoverData.selecting&&be!=null&&be._private.selectable&&(t.hoverData.dragging||(ae.selectionType()==="additive"||me?be.selected()?be.unselect(["tapunselect"]):be.select(["tapselect"]):me||(ae.$(r).unmerge(be).unselect(["tapunselect"]),be.select(["tapselect"]))),t.redrawHint("eles",!0)),t.hoverData.selecting){var De=ae.collection(t.getAllInBox(ce[0],ce[1],ce[2],ce[3]));t.redrawHint("select",!0),De.length>0&&t.redrawHint("eles",!0),ae.emit(ke("boxend"));var Qe=function(et){return et.selectable()&&!et.selected()};ae.selectionType()==="additive"||me||ae.$(r).unmerge(De).unselect(),De.emit(ke("box")).stdFilter(Qe).select().emit(ke("boxselect")),t.redraw()}if(t.hoverData.dragging&&(t.hoverData.dragging=!1,t.redrawHint("select",!0),t.redrawHint("eles",!0),t.redraw()),!ce[4]){t.redrawHint("drag",!0),t.redrawHint("eles",!0);var Xe=de&&de.grabbed();S(he),Xe&&(de.emit(ke("freeon")),he.emit(ke("free")),t.dragData.didDrag&&(de.emit(ke("dragfreeon")),he.emit(ke("dragfree"))))}}ce[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 $=[],D=4,B,j=1e5,I=function(ee){for(var ue=Math.abs(ee[0]),ae=1;ae<ee.length;ae++)if(Math.abs(ee[ae])!==ue)return!1;return!0},U=function(ee){var ue=!1,ae=ee.deltaY;if(ae==null&&(ee.wheelDeltaY!=null?ae=ee.wheelDeltaY/4:ee.wheelDelta!=null&&(ae=ee.wheelDelta/4)),ae!==0){if(B==null)if($.length>=D){B=!1;var se=$;if(se[0]>=5){var ce;I(se)?ce=se[0]:ce=uA(se),ce>1&&(B=!0,j=ce)}}else $.push(Math.abs(ae)),ue=!0;else B&&(j=Math.min(Math.abs(ae),j));if(!t.scrollingPage){var be=t.cy,he=be.zoom(),de=be.pan(),me=t.projectIntoViewport(ee.clientX,ee.clientY),ke=[me[0]*he+de.x,me[1]*he+de.y];if(t.hoverData.draggingEles||t.hoverData.dragging||t.hoverData.cxtStarted||E()){ee.preventDefault();return}if(be.panningEnabled()&&be.userPanningEnabled()&&be.zoomingEnabled()&&be.userZoomingEnabled()){ee.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 Re;ue&&Math.abs(ae)>5&&(ae=Nm(ae)*5),Re=ae/-250,B&&(Re/=j,Re*=3),Re=Re*t.wheelSensitivity;var Ce=ee.deltaMode===1;Ce&&(Re*=33);var De=be.zoom()*Math.pow(10,Re);ee.type==="gesturechange"&&(De=t.gestureStartZoom*ee.scale),be.zoom({level:De,renderedPosition:{x:ke[0],y:ke[1]}}),be.emit({type:ee.type==="gesturechange"?"pinchzoom":"scrollzoom",originalEvent:ee,position:{x:me[0],y:me[1]}})}}}};t.registerBinding(t.container,"wheel",U,!0),t.registerBinding(e,"scroll",function(ee){t.scrollingPage=!0,clearTimeout(t.scrollingPageTimeout),t.scrollingPageTimeout=setTimeout(function(){t.scrollingPage=!1},250)},!0),t.registerBinding(t.container,"gesturestart",function(ee){t.gestureStartZoom=t.cy.zoom(),t.hasTouchStarted||ee.preventDefault()},!0),t.registerBinding(t.container,"gesturechange",function(ye){t.hasTouchStarted||U(ye)},!0),t.registerBinding(t.container,"mouseout",function(ee){var ue=t.projectIntoViewport(ee.clientX,ee.clientY);t.cy.emit({originalEvent:ee,type:"mouseout",position:{x:ue[0],y:ue[1]}})},!1),t.registerBinding(t.container,"mouseover",function(ee){var ue=t.projectIntoViewport(ee.clientX,ee.clientY);t.cy.emit({originalEvent:ee,type:"mouseover",position:{x:ue[0],y:ue[1]}})},!1);var F,P,H,W,V,re,J,ne,X,q,Y,Q,te,ie=function(ee,ue,ae,se){return Math.sqrt((ae-ee)*(ae-ee)+(se-ue)*(se-ue))},le=function(ee,ue,ae,se){return(ae-ee)*(ae-ee)+(se-ue)*(se-ue)},pe;t.registerBinding(t.container,"touchstart",pe=function(ee){if(t.hasTouchStarted=!0,!!k(ee)){m(),t.touchData.capture=!0,t.data.bgActivePosistion=void 0;var ue=t.cy,ae=t.touchData.now,se=t.touchData.earlier;if(ee.touches[0]){var ce=t.projectIntoViewport(ee.touches[0].clientX,ee.touches[0].clientY);ae[0]=ce[0],ae[1]=ce[1]}if(ee.touches[1]){var ce=t.projectIntoViewport(ee.touches[1].clientX,ee.touches[1].clientY);ae[2]=ce[0],ae[3]=ce[1]}if(ee.touches[2]){var ce=t.projectIntoViewport(ee.touches[2].clientX,ee.touches[2].clientY);ae[4]=ce[0],ae[5]=ce[1]}var be=function(kt){return{originalEvent:ee,type:kt,position:{x:ae[0],y:ae[1]}}};if(ee.touches[1]){t.touchData.singleTouchMoved=!0,S(t.dragData.touchDragEles);var he=t.findContainerClientCoords();X=he[0],q=he[1],Y=he[2],Q=he[3],F=ee.touches[0].clientX-X,P=ee.touches[0].clientY-q,H=ee.touches[1].clientX-X,W=ee.touches[1].clientY-q,te=0<=F&&F<=Y&&0<=H&&H<=Y&&0<=P&&P<=Q&&0<=W&&W<=Q;var de=ue.pan(),me=ue.zoom();V=ie(F,P,H,W),re=le(F,P,H,W),J=[(F+H)/2,(P+W)/2],ne=[(J[0]-de.x)/me,(J[1]-de.y)/me];var ke=200,Re=ke*ke;if(re<Re&&!ee.touches[2]){var Ce=t.findNearestElement(ae[0],ae[1],!0,!0),De=t.findNearestElement(ae[2],ae[3],!0,!0);Ce&&Ce.isNode()?(Ce.activate().emit(be("cxttapstart")),t.touchData.start=Ce):De&&De.isNode()?(De.activate().emit(be("cxttapstart")),t.touchData.start=De):ue.emit(be("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(ee.touches[2])ue.boxSelectionEnabled()&&ee.preventDefault();else if(!ee.touches[1]){if(ee.touches[0]){var Qe=t.findNearestElements(ae[0],ae[1],!0,!0),Xe=Qe[0];if(Xe!=null&&(Xe.activate(),t.touchData.start=Xe,t.touchData.starts=Qe,t.nodeIsGrabbable(Xe))){var yt=t.dragData.touchDragEles=ue.collection(),et=null;t.redrawHint("eles",!0),t.redrawHint("drag",!0),Xe.selected()?(et=ue.$(function(Ye){return Ye.selected()&&t.nodeIsGrabbable(Ye)}),f(et,{addToList:yt})):x(Xe,{addToList:yt}),u(Xe),Xe.emit(be("grabon")),et?et.forEach(function(Ye){Ye.emit(be("grab"))}):Xe.emit(be("grab"))}i(Xe,["touchstart","tapstart","vmousedown"],ee,{x:ae[0],y:ae[1]}),Xe==null&&(t.data.bgActivePosistion={x:ce[0],y:ce[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"],ee,{x:ae[0],y:ae[1]})},t.tapholdDuration)}}if(ee.touches.length>=1){for(var Ze=t.touchData.startPosition=[null,null,null,null,null,null],ct=0;ct<ae.length;ct++)Ze[ct]=se[ct]=ae[ct];var tt=ee.touches[0];t.touchData.startGPosition=[tt.clientX,tt.clientY]}}},!1);var Le;t.registerBinding(e,"touchmove",Le=function(ee){var ue=t.touchData.capture;if(!(!ue&&!k(ee))){var ae=t.selection,se=t.cy,ce=t.touchData.now,be=t.touchData.earlier,he=se.zoom();if(ee.touches[0]){var de=t.projectIntoViewport(ee.touches[0].clientX,ee.touches[0].clientY);ce[0]=de[0],ce[1]=de[1]}if(ee.touches[1]){var de=t.projectIntoViewport(ee.touches[1].clientX,ee.touches[1].clientY);ce[2]=de[0],ce[3]=de[1]}if(ee.touches[2]){var de=t.projectIntoViewport(ee.touches[2].clientX,ee.touches[2].clientY);ce[4]=de[0],ce[5]=de[1]}var me=function(_s){return{originalEvent:ee,type:_s,position:{x:ce[0],y:ce[1]}}},ke=t.touchData.startGPosition,Re;if(ue&&ee.touches[0]&&ke){for(var Ce=[],De=0;De<ce.length;De++)Ce[De]=ce[De]-be[De];var Qe=ee.touches[0].clientX-ke[0],Xe=Qe*Qe,yt=ee.touches[0].clientY-ke[1],et=yt*yt,Ze=Xe+et;Re=Ze>=t.touchTapThreshold2}if(ue&&t.touchData.cxt){ee.preventDefault();var ct=ee.touches[0].clientX-X,tt=ee.touches[0].clientY-q,Ye=ee.touches[1].clientX-X,kt=ee.touches[1].clientY-q,ft=le(ct,tt,Ye,kt),ut=ft/re,Ft=150,Tt=Ft*Ft,Vt=1.5,jt=Vt*Vt;if(ut>=jt||ft>=Tt){t.touchData.cxt=!1,t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var vr=me("cxttapend");t.touchData.start?(t.touchData.start.unactivate().emit(vr),t.touchData.start=null):se.emit(vr)}}if(ue&&t.touchData.cxt){var vr=me("cxtdrag");t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.touchData.start?t.touchData.start.emit(vr):se.emit(vr),t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxtDragged=!0;var or=t.findNearestElement(ce[0],ce[1],!0,!0);(!t.touchData.cxtOver||or!==t.touchData.cxtOver)&&(t.touchData.cxtOver&&t.touchData.cxtOver.emit(me("cxtdragout")),t.touchData.cxtOver=or,or&&or.emit(me("cxtdragover")))}else if(ue&&ee.touches[2]&&se.boxSelectionEnabled())ee.preventDefault(),t.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,t.touchData.selecting||se.emit(me("boxstart")),t.touchData.selecting=!0,t.touchData.didSelect=!0,ae[4]=1,!ae||ae.length===0||ae[0]===void 0?(ae[0]=(ce[0]+ce[2]+ce[4])/3,ae[1]=(ce[1]+ce[3]+ce[5])/3,ae[2]=(ce[0]+ce[2]+ce[4])/3+1,ae[3]=(ce[1]+ce[3]+ce[5])/3+1):(ae[2]=(ce[0]+ce[2]+ce[4])/3,ae[3]=(ce[1]+ce[3]+ce[5])/3),t.redrawHint("select",!0),t.redraw();else if(ue&&ee.touches[1]&&!t.touchData.didSelect&&se.zoomingEnabled()&&se.panningEnabled()&&se.userZoomingEnabled()&&se.userPanningEnabled()){ee.preventDefault(),t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var ir=t.dragData.touchDragEles;if(ir){t.redrawHint("drag",!0);for(var zt=0;zt<ir.length;zt++){var Qr=ir[zt]._private;Qr.grabbed=!1,Qr.rscratch.inDragLayer=!1}}var dr=t.touchData.start,ct=ee.touches[0].clientX-X,tt=ee.touches[0].clientY-q,Ye=ee.touches[1].clientX-X,kt=ee.touches[1].clientY-q,Dn=ie(ct,tt,Ye,kt),ki=Dn/V;if(te){var Vn=ct-F,Gn=tt-P,Pa=Ye-H,Ma=kt-W,Ss=(Vn+Pa)/2,Gt=(Gn+Ma)/2,Ei=se.zoom(),qn=Ei*ki,oi=se.pan(),li=ne[0]*Ei+oi.x,Ui=ne[1]*Ei+oi.y,Oa={x:-qn/Ei*(li-oi.x-Ss)+li,y:-qn/Ei*(Ui-oi.y-Gt)+Ui};if(dr&&dr.active()){var ir=t.dragData.touchDragEles;S(ir),t.redrawHint("drag",!0),t.redrawHint("eles",!0),dr.unactivate().emit(me("freeon")),ir&&ir.emit(me("free")),t.dragData.didDrag&&(dr.emit(me("dragfreeon")),ir&&ir.emit(me("dragfree")))}se.viewport({zoom:qn,pan:Oa,cancelOnFailedZoom:!0}),se.emit(me("pinchzoom")),V=Dn,F=ct,P=tt,H=Ye,W=kt,t.pinching=!0}if(ee.touches[0]){var de=t.projectIntoViewport(ee.touches[0].clientX,ee.touches[0].clientY);ce[0]=de[0],ce[1]=de[1]}if(ee.touches[1]){var de=t.projectIntoViewport(ee.touches[1].clientX,ee.touches[1].clientY);ce[2]=de[0],ce[3]=de[1]}if(ee.touches[2]){var de=t.projectIntoViewport(ee.touches[2].clientX,ee.touches[2].clientY);ce[4]=de[0],ce[5]=de[1]}}else if(ee.touches[0]&&!t.touchData.didSelect){var Nt=t.touchData.start,dt=t.touchData.last,or;if(!t.hoverData.draggingEles&&!t.swipePanning&&(or=t.findNearestElement(ce[0],ce[1],!0,!0)),ue&&Nt!=null&&ee.preventDefault(),ue&&Nt!=null&&t.nodeIsDraggable(Nt))if(Re){var ir=t.dragData.touchDragEles,Rt=!t.dragData.didDrag;Rt&&f(ir,{inDragLayer:!0}),t.dragData.didDrag=!0;var Xt={x:0,y:0};if(Ke(Ce[0])&&Ke(Ce[1])&&(Xt.x+=Ce[0],Xt.y+=Ce[1],Rt)){t.redrawHint("eles",!0);var Qt=t.touchData.dragDelta;Qt&&Ke(Qt[0])&&Ke(Qt[1])&&(Xt.x+=Qt[0],Xt.y+=Qt[1])}t.hoverData.draggingEles=!0,ir.silentShift(Xt).emit(me("position")).emit(me("drag")),t.redrawHint("drag",!0),t.touchData.startPosition[0]==be[0]&&t.touchData.startPosition[1]==be[1]&&t.redrawHint("eles",!0),t.redraw()}else{var Qt=t.touchData.dragDelta=t.touchData.dragDelta||[];Qt.length===0?(Qt.push(Ce[0]),Qt.push(Ce[1])):(Qt[0]+=Ce[0],Qt[1]+=Ce[1])}if(i(Nt||or,["touchmove","tapdrag","vmousemove"],ee,{x:ce[0],y:ce[1]}),(!Nt||!Nt.grabbed())&&or!=dt&&(dt&&dt.emit(me("tapdragout")),or&&or.emit(me("tapdragover"))),t.touchData.last=or,ue)for(var zt=0;zt<ce.length;zt++)ce[zt]&&t.touchData.startPosition[zt]&&Re&&(t.touchData.singleTouchMoved=!0);if(ue&&(Nt==null||Nt.pannable())&&se.panningEnabled()&&se.userPanningEnabled()){var vh=s(Nt,t.touchData.starts);vh&&(ee.preventDefault(),t.data.bgActivePosistion||(t.data.bgActivePosistion=lo(t.touchData.startPosition)),t.swipePanning?(se.panBy({x:Ce[0]*he,y:Ce[1]*he}),se.emit(me("dragpan"))):Re&&(t.swipePanning=!0,se.panBy({x:Qe*he,y:yt*he}),se.emit(me("dragpan")),Nt&&(Nt.unactivate(),t.redrawHint("select",!0),t.touchData.start=null)));var de=t.projectIntoViewport(ee.touches[0].clientX,ee.touches[0].clientY);ce[0]=de[0],ce[1]=de[1]}}for(var De=0;De<ce.length;De++)be[De]=ce[De];ue&&ee.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 je;t.registerBinding(e,"touchcancel",je=function(ee){var ue=t.touchData.start;t.touchData.capture=!1,ue&&ue.unactivate()});var Se,Te,Ae,Ne;if(t.registerBinding(e,"touchend",Se=function(ee){var ue=t.touchData.start,ae=t.touchData.capture;if(ae)ee.touches.length===0&&(t.touchData.capture=!1),ee.preventDefault();else return;var se=t.selection;t.swipePanning=!1,t.hoverData.draggingEles=!1;var ce=t.cy,be=ce.zoom(),he=t.touchData.now,de=t.touchData.earlier;if(ee.touches[0]){var me=t.projectIntoViewport(ee.touches[0].clientX,ee.touches[0].clientY);he[0]=me[0],he[1]=me[1]}if(ee.touches[1]){var me=t.projectIntoViewport(ee.touches[1].clientX,ee.touches[1].clientY);he[2]=me[0],he[3]=me[1]}if(ee.touches[2]){var me=t.projectIntoViewport(ee.touches[2].clientX,ee.touches[2].clientY);he[4]=me[0],he[5]=me[1]}var ke=function(Tt){return{originalEvent:ee,type:Tt,position:{x:he[0],y:he[1]}}};ue&&ue.unactivate();var Re;if(t.touchData.cxt){if(Re=ke("cxttapend"),ue?ue.emit(Re):ce.emit(Re),!t.touchData.cxtDragged){var Ce=ke("cxttap");ue?ue.emit(Ce):ce.emit(Ce)}t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxt=!1,t.touchData.start=null,t.redraw();return}if(!ee.touches[2]&&ce.boxSelectionEnabled()&&t.touchData.selecting){t.touchData.selecting=!1;var De=ce.collection(t.getAllInBox(se[0],se[1],se[2],se[3]));se[0]=void 0,se[1]=void 0,se[2]=void 0,se[3]=void 0,se[4]=0,t.redrawHint("select",!0),ce.emit(ke("boxend"));var Qe=function(Tt){return Tt.selectable()&&!Tt.selected()};De.emit(ke("box")).stdFilter(Qe).select().emit(ke("boxselect")),De.nonempty()&&t.redrawHint("eles",!0),t.redraw()}if(ue!=null&&ue.unactivate(),ee.touches[2])t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);else if(!ee.touches[1]){if(!ee.touches[0]){if(!ee.touches[0]){t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var Xe=t.dragData.touchDragEles;if(ue!=null){var yt=ue._private.grabbed;S(Xe),t.redrawHint("drag",!0),t.redrawHint("eles",!0),yt&&(ue.emit(ke("freeon")),Xe.emit(ke("free")),t.dragData.didDrag&&(ue.emit(ke("dragfreeon")),Xe.emit(ke("dragfree")))),i(ue,["touchend","tapend","vmouseup","tapdragout"],ee,{x:he[0],y:he[1]}),ue.unactivate(),t.touchData.start=null}else{var et=t.findNearestElement(he[0],he[1],!0,!0);i(et,["touchend","tapend","vmouseup","tapdragout"],ee,{x:he[0],y:he[1]})}var Ze=t.touchData.startPosition[0]-he[0],ct=Ze*Ze,tt=t.touchData.startPosition[1]-he[1],Ye=tt*tt,kt=ct+Ye,ft=kt*be*be;t.touchData.singleTouchMoved||(ue||ce.$(":selected").unselect(["tapunselect"]),i(ue,["tap","vclick"],ee,{x:he[0],y:he[1]}),Te=!1,ee.timeStamp-Ne<=ce.multiClickDebounceTime()?(Ae&&clearTimeout(Ae),Te=!0,Ne=null,i(ue,["dbltap","vdblclick"],ee,{x:he[0],y:he[1]})):(Ae=setTimeout(function(){Te||i(ue,["onetap","voneclick"],ee,{x:he[0],y:he[1]})},ce.multiClickDebounceTime()),Ne=ee.timeStamp)),ue!=null&&!t.dragData.didDrag&&ue._private.selectable&&ft<t.touchTapThreshold2&&!t.pinching&&(ce.selectionType()==="single"?(ce.$(r).unmerge(ue).unselect(["tapunselect"]),ue.select(["tapselect"])):ue.selected()?ue.unselect(["tapunselect"]):ue.select(["tapselect"]),t.redrawHint("eles",!0)),t.touchData.singleTouchMoved=!0}}}for(var ut=0;ut<he.length;ut++)de[ut]=he[ut];t.dragData.didDrag=!1,ee.touches.length===0&&(t.touchData.dragDelta=[],t.touchData.startPosition=[null,null,null,null,null,null],t.touchData.startGPosition=null,t.touchData.didSelect=!1),ee.touches.length<2&&(ee.touches.length===1&&(t.touchData.startGPosition=[ee.touches[0].clientX,ee.touches[0].clientY]),t.pinching=!1,t.redrawHint("eles",!0),t.redraw())},!1),typeof TouchEvent>"u"){var Pe=[],ze=function(ee){return{clientX:ee.clientX,clientY:ee.clientY,force:1,identifier:ee.pointerId,pageX:ee.pageX,pageY:ee.pageY,radiusX:ee.width/2,radiusY:ee.height/2,screenX:ee.screenX,screenY:ee.screenY,target:ee.target}},Ie=function(ee){return{event:ee,touch:ze(ee)}},$e=function(ee){Pe.push(Ie(ee))},Ge=function(ee){for(var ue=0;ue<Pe.length;ue++){var ae=Pe[ue];if(ae.event.pointerId===ee.pointerId){Pe.splice(ue,1);return}}},ve=function(ee){var ue=Pe.filter(function(ae){return ae.event.pointerId===ee.pointerId})[0];ue.event=ee,ue.touch=ze(ee)},Ee=function(ee){ee.touches=Pe.map(function(ue){return ue.touch})},Me=function(ee){return ee.pointerType==="mouse"||ee.pointerType===4};t.registerBinding(t.container,"pointerdown",function(ye){Me(ye)||(ye.preventDefault(),$e(ye),Ee(ye),pe(ye))}),t.registerBinding(t.container,"pointerup",function(ye){Me(ye)||(Ge(ye),Ee(ye),Se(ye))}),t.registerBinding(t.container,"pointercancel",function(ye){Me(ye)||(Ge(ye),Ee(ye),je(ye))}),t.registerBinding(t.container,"pointermove",function(ye){Me(ye)||(ye.preventDefault(),ve(ye),Ee(ye),Le(ye))})}};var zi={};zi.generatePolygon=function(t,e){return this.nodeShapes[t]={renderer:this,name:t,points:e,draw:function(n,i,a,s,o,l){this.renderer.nodeShapeImpl("polygon",n,i,a,s,o,this.points)},intersectLine:function(n,i,a,s,o,l,u,c){return Ql(o,l,this.points,n,i,a/2,s/2,u)},checkPoint:function(n,i,a,s,o,l,u,c){return Fi(n,i,this.points,l,u,s,o,[0,-1],a)},hasMiterBounds:t!=="rectangle",miterBounds:function(n,i,a,s,o,l){return yA(this.points,n,i,a,s,o)}}};zi.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,r,n,i,a,s){this.renderer.nodeShapeImpl(this.name,e,r,n,i,a)},intersectLine:function(e,r,n,i,a,s,o,l){return EA(a,s,e,r,n/2+o,i/2+o)},checkPoint:function(e,r,n,i,a,s,o,l){return ls(e,r,i,a,s,o,n)}}};zi.generateRoundPolygon=function(t,e){return this.nodeShapes[t]={renderer:this,name:t,points:e,getOrCreateCorners:function(n,i,a,s,o,l,u){if(l[u]!==void 0&&l[u+"-cx"]===n&&l[u+"-cy"]===i&&l[u+"-w"]===a&&l[u+"-h"]===s&&l[u+"-corner-radius"]===o)return l[u];l[u]=new Array(e.length/2),l[u+"-cx"]=n,l[u+"-cy"]=i,l[u+"-w"]=a,l[u+"-h"]=s,l[u+"-corner-radius"]=o;var c=a/2,d=s/2;o=o==="auto"?g_(a,s):o;for(var p=new Array(e.length/2),f=0;f<e.length/2;f++)p[f]={x:n+c*e[f*2],y:i+d*e[f*2+1]};var x,S,v,m,b=p.length;for(S=p[b-1],x=0;x<b;x++)v=p[x%b],m=p[(x+1)%b],l[u][x]=$m(S,v,m,o),S=v,v=m;return l[u]},draw:function(n,i,a,s,o,l,u){this.renderer.nodeShapeImpl("round-polygon",n,i,a,s,o,this.points,this.getOrCreateCorners(i,a,s,o,l,u,"drawCorners"))},intersectLine:function(n,i,a,s,o,l,u,c,d){return NA(o,l,this.points,n,i,a,s,u,this.getOrCreateCorners(n,i,a,s,c,d,"corners"))},checkPoint:function(n,i,a,s,o,l,u,c,d){return kA(n,i,this.points,l,u,s,o,this.getOrCreateCorners(l,u,s,o,c,d,"corners"))}}};zi.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:en(4,0),draw:function(e,r,n,i,a,s){this.renderer.nodeShapeImpl(this.name,e,r,n,i,a,this.points,s)},intersectLine:function(e,r,n,i,a,s,o,l){return f_(a,s,e,r,n,i,o,l)},checkPoint:function(e,r,n,i,a,s,o,l){var u=i/2,c=a/2;l=l==="auto"?wa(i,a):l,l=Math.min(u,c,l);var d=l*2;return!!(Fi(e,r,this.points,s,o,i,a-d,[0,-1],n)||Fi(e,r,this.points,s,o,i-d,a,[0,-1],n)||ls(e,r,d,d,s-u+l,o-c+l,n)||ls(e,r,d,d,s+u-l,o-c+l,n)||ls(e,r,d,d,s+u-l,o+c-l,n)||ls(e,r,d,d,s-u+l,o+c-l,n))}}};zi.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:Lm(),points:en(4,0),draw:function(e,r,n,i,a,s){this.renderer.nodeShapeImpl(this.name,e,r,n,i,a,null,s)},generateCutTrianglePts:function(e,r,n,i,a){var s=a==="auto"?this.cornerLength:a,o=r/2,l=e/2,u=n-l,c=n+l,d=i-o,p=i+o;return{topLeft:[u,d+s,u+s,d,u+s,d+s],topRight:[c-s,d,c,d+s,c-s,d+s],bottomRight:[c,p-s,c-s,p,c-s,p-s],bottomLeft:[u+s,p,u,p-s,u+s,p-s]}},intersectLine:function(e,r,n,i,a,s,o,l){var u=this.generateCutTrianglePts(n+2*o,i+2*o,e,r,l),c=[].concat.apply([],[u.topLeft.splice(0,4),u.topRight.splice(0,4),u.bottomRight.splice(0,4),u.bottomLeft.splice(0,4)]);return Ql(a,s,c,e,r)},checkPoint:function(e,r,n,i,a,s,o,l){var u=l==="auto"?this.cornerLength:l;if(Fi(e,r,this.points,s,o,i,a-2*u,[0,-1],n)||Fi(e,r,this.points,s,o,i-2*u,a,[0,-1],n))return!0;var c=this.generateCutTrianglePts(i,a,s,o);return mn(e,r,c.topLeft)||mn(e,r,c.topRight)||mn(e,r,c.bottomRight)||mn(e,r,c.bottomLeft)}}};zi.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:en(4,0),draw:function(e,r,n,i,a,s){this.renderer.nodeShapeImpl(this.name,e,r,n,i,a)},intersectLine:function(e,r,n,i,a,s,o,l){var u=.15,c=.5,d=.85,p=this.generateBarrelBezierPts(n+2*o,i+2*o,e,r),f=function(v){var m=vo({x:v[0],y:v[1]},{x:v[2],y:v[3]},{x:v[4],y:v[5]},u),b=vo({x:v[0],y:v[1]},{x:v[2],y:v[3]},{x:v[4],y:v[5]},c),w=vo({x:v[0],y:v[1]},{x:v[2],y:v[3]},{x:v[4],y:v[5]},d);return[v[0],v[1],m.x,m.y,b.x,b.y,w.x,w.y,v[4],v[5]]},x=[].concat(f(p.topLeft),f(p.topRight),f(p.bottomRight),f(p.bottomLeft));return Ql(a,s,x,e,r)},generateBarrelBezierPts:function(e,r,n,i){var a=r/2,s=e/2,o=n-s,l=n+s,u=i-a,c=i+a,d=Dv(e,r),p=d.heightOffset,f=d.widthOffset,x=d.ctrlPtOffsetPct*e,S={topLeft:[o,u+p,o+x,u,o+f,u],topRight:[l-f,u,l-x,u,l,u+p],bottomRight:[l,c-p,l-x,c,l-f,c],bottomLeft:[o+f,c,o+x,c,o,c-p]};return S.topLeft.isTop=!0,S.topRight.isTop=!0,S.bottomLeft.isBottom=!0,S.bottomRight.isBottom=!0,S},checkPoint:function(e,r,n,i,a,s,o,l){var u=Dv(i,a),c=u.heightOffset,d=u.widthOffset;if(Fi(e,r,this.points,s,o,i,a-2*c,[0,-1],n)||Fi(e,r,this.points,s,o,i-2*d,a,[0,-1],n))return!0;for(var p=this.generateBarrelBezierPts(i,a,s,o),f=function(k,L,A){var M=A[4],O=A[2],$=A[0],D=A[5],B=A[1],j=Math.min(M,$),I=Math.max(M,$),U=Math.min(D,B),F=Math.max(D,B);if(j<=k&&k<=I&&U<=L&&L<=F){var P=RA(M,O,$),H=wA(P[0],P[1],P[2],k),W=H.filter(function(V){return 0<=V&&V<=1});if(W.length>0)return W[0]}return null},x=Object.keys(p),S=0;S<x.length;S++){var v=x[S],m=p[v],b=f(e,r,m);if(b!=null){var w=m[5],_=m[3],T=m[1],N=Dr(w,_,T,b);if(m.isTop&&N<=r||m.isBottom&&r<=N)return!0}}return!1}}};zi.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:en(4,0),draw:function(e,r,n,i,a,s){this.renderer.nodeShapeImpl(this.name,e,r,n,i,a,this.points,s)},intersectLine:function(e,r,n,i,a,s,o,l){var u=e-(n/2+o),c=r-(i/2+o),d=c,p=e+(n/2+o),f=va(a,s,e,r,u,c,p,d,!1);return f.length>0?f:f_(a,s,e,r,n,i,o,l)},checkPoint:function(e,r,n,i,a,s,o,l){l=l==="auto"?wa(i,a):l;var u=2*l;if(Fi(e,r,this.points,s,o,i,a-u,[0,-1],n)||Fi(e,r,this.points,s,o,i-u,a,[0,-1],n))return!0;var c=i/2+2*n,d=a/2+2*n,p=[s-c,o-d,s-c,o,s+c,o,s+c,o-d];return!!(mn(e,r,p)||ls(e,r,u,u,s+i/2-l,o+a/2-l,n)||ls(e,r,u,u,s-i/2+l,o+a/2-l,n))}}};zi.registerNodeShapes=function(){var t=this.nodeShapes={},e=this;this.generateEllipse(),this.generatePolygon("triangle",en(3,0)),this.generateRoundPolygon("round-triangle",en(3,0)),this.generatePolygon("rectangle",en(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",en(5,0)),this.generateRoundPolygon("round-pentagon",en(5,0)),this.generatePolygon("hexagon",en(6,0)),this.generateRoundPolygon("round-hexagon",en(6,0)),this.generatePolygon("heptagon",en(7,0)),this.generateRoundPolygon("round-heptagon",en(7,0)),this.generatePolygon("octagon",en(8,0)),this.generateRoundPolygon("round-octagon",en(8,0));var n=new Array(20);{var i=Lv(5,0),a=Lv(5,Math.PI/5),s=.5*(3-Math.sqrt(5));s*=1.57;for(var o=0;o<a.length/2;o++)a[o*2]*=s,a[o*2+1]*=s;for(var o=0;o<20/4;o++)n[o*4]=i[o*2],n[o*4+1]=i[o*2+1],n[o*4+2]=a[o*2],n[o*4+3]=a[o*2+1]}n=p_(n),this.generatePolygon("star",n),this.generatePolygon("vee",[-1,-1,0,-.333,1,-1,0,1]),this.generatePolygon("rhomboid",[-1,-1,.333,-1,1,1,-.333,1]),this.generatePolygon("right-rhomboid",[-.333,-1,1,-1,.333,1,-1,1]),this.nodeShapes.concavehexagon=this.generatePolygon("concave-hexagon",[-1,-.95,-.75,0,-1,.95,1,.95,.75,0,1,-.95]);{var l=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",l),this.generateRoundPolygon("round-tag",l)}t.makePolygon=function(u){var c=u.join("$"),d="polygon-"+c,p;return(p=this[d])?p:e.generatePolygon(d,u)}};var vu={};vu.timeToRender=function(){return this.redrawTotalTime/this.redrawCount};vu.redraw=function(t){t=t||l_();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};vu.beforeRender=function(t,e){if(!this.destroyed){e==null&&sr("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 jw=function(e,r,n){for(var i=e.beforeRenderCallbacks,a=0;a<i.length;a++)i[a].fn(r,n)};vu.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){jw(t,!0,i);var a=Bi();t.render(t.renderOptions);var s=t.lastDrawTime=Bi();t.averageRedrawTime===void 0&&(t.averageRedrawTime=s-a),t.redrawCount===void 0&&(t.redrawCount=0),t.redrawCount++,t.redrawTotalTime===void 0&&(t.redrawTotalTime=0);var o=s-a;t.redrawTotalTime+=o,t.lastRedrawTime=o,t.averageRedrawTime=t.averageRedrawTime/2+o/2,t.requestedFrame=!1}else jw(t,!1,i);t.skipFrame=!1,kd(r)}};kd(r)}};var YP=function(e){this.init(e)},vC=YP,Do=vC.prototype;Do.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"];Do.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,a=i.head,s="__________cytoscape_stylesheet",o="__________cytoscape_container",l=i.getElementById(s)!=null;if(r.className.indexOf(o)<0&&(r.className=(r.className||"")+" "+o),!l){var u=i.createElement("style");u.id=s,u.textContent="."+o+" { position: relative; }",a.insertBefore(u,a.children[0])}var c=n.getComputedStyle(r),d=c.getPropertyValue("position");d==="static"&&Ht("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=Ke(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()};Do.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()}};Do.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{}};Do.isHeadless=function(){return!1};[zm,fC,pC,Lo,zi,vu].forEach(function(t){mt(Do,t)});var Vg=1e3/60,mC={setupDequeueing:function(e){return function(){var n=this,i=this.renderer;if(!n.dequeueingSetup){n.dequeueingSetup=!0;var a=du(function(){i.redrawHint("eles",!0),i.redrawHint("drag",!0),i.redraw()},e.deqRedrawThreshold),s=function(u,c){var d=Bi(),p=i.averageRedrawTime,f=i.lastRedrawTime,x=[],S=i.cy.extent(),v=i.getPixelRatio();for(u||i.flushRenderedStyleQueue();;){var m=Bi(),b=m-d,w=m-c;if(f<Vg){var _=Vg-(u?p:0);if(w>=e.deqFastCost*_)break}else if(u){if(b>=e.deqCost*f||b>=e.deqAvgCost*p)break}else if(w>=e.deqNoDrawCost*Vg)break;var T=e.deq(n,v,S);if(T.length>0)for(var N=0;N<T.length;N++)x.push(T[N]);else break}x.length>0&&(e.onDeqd(n,x),!u&&e.shouldRedraw(n,x,v,S)&&a())},o=e.priority||km;i.beforeRender(s,o(n))}}}},KP=(function(){function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ed;Ta(this,t),this.idsByKey=new Ii,this.keyForId=new Ii,this.cachesByLvl=new Ii,this.lvls=[],this.getKey=e,this.doesEleInvalidateKey=r}return Na(t,[{key:"getIdsFor",value:function(r){r==null&&sr("Can not get id list for null key");var n=this.idsByKey,i=this.idsByKey.get(r);return i||(i=new Eo,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),a=this.getKey(r);this.deleteIdForKey(i,n),this.addIdForKey(a,n),this.keyForId.set(n,a)}},{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),a=this.getKey(r);return i!==a}},{key:"isInvalid",value:function(r){return this.keyHasChangedFor(r)||this.doesEleInvalidateKey(r)}},{key:"getCachesAt",value:function(r){var n=this.cachesByLvl,i=this.lvls,a=n.get(r);return a||(a=new Ii,n.set(r,a),i.push(r)),a}},{key:"getCache",value:function(r,n){return this.getCachesAt(n).get(r)}},{key:"get",value:function(r,n){var i=this.getKey(r),a=this.getCache(i,n);return a!=null&&this.updateKeyMappingFor(r),a}},{key:"getForCachedKey",value:function(r,n){var i=this.keyForId.get(r.id()),a=this.getCache(i,n);return a}},{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 a=this.getKey(r);this.setCache(a,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 a=this.doesEleInvalidateKey(r);return a&&this.invalidateKey(i),a||this.getNumberOfIdsForKey(i)===0}}])})(),Iw=25,Kc=50,fd=-4,Wv=3,yC=7.99,XP=8,QP=1024,ZP=1024,JP=1024,eM=.2,tM=.8,rM=10,nM=.15,iM=.1,aM=.9,sM=.9,oM=100,lM=1,co={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},uM=zr({getKey:null,doesEleInvalidateKey:Ed,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:a_,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),jl=function(e,r){var n=this;n.renderer=e,n.onDequeues=[];var i=uM(r);mt(n,i),n.lookup=new KP(i.getKey,i.doesEleInvalidateKey),n.setupDequeueing()},Er=jl.prototype;Er.reasons=co;Er.getTextureQueue=function(t){var e=this;return e.eleImgCaches=e.eleImgCaches||{},e.eleImgCaches[t]=e.eleImgCaches[t]||[]};Er.getRetiredTextureQueue=function(t){var e=this,r=e.eleImgCaches.retired=e.eleImgCaches.retired||{},n=r[t]=r[t]||[];return n};Er.getElementQueue=function(){var t=this,e=t.eleCacheQueue=t.eleCacheQueue||new hu(function(r,n){return n.reqs-r.reqs});return e};Er.getElementKeyToQueue=function(){var t=this,e=t.eleKeyToCacheQueue=t.eleKeyToCacheQueue||{};return e};Er.getElement=function(t,e,r,n,i){var a=this,s=this.renderer,o=s.cy.zoom(),l=this.lookup;if(!e||e.w===0||e.h===0||isNaN(e.w)||isNaN(e.h)||!t.visible()||t.removed()||!a.allowEdgeTxrCaching&&t.isEdge()||!a.allowParentTxrCaching&&t.isParent())return null;if(n==null&&(n=Math.ceil(Tm(o*r))),n<fd)n=fd;else if(o>=yC||n>Wv)return null;var u=Math.pow(2,n),c=e.h*u,d=e.w*u,p=s.eleTextBiggerThanMin(t,u);if(!this.isVisible(t,p))return null;var f=l.get(t,n);if(f&&f.invalidated&&(f.invalidated=!1,f.texture.invalidatedWidth-=f.width),f)return f;var x;if(c<=Iw?x=Iw:c<=Kc?x=Kc:x=Math.ceil(c/Kc)*Kc,c>JP||d>ZP)return null;var S=a.getTextureQueue(x),v=S[S.length-2],m=function(){return a.recycleTexture(x,d)||a.addTexture(x,d)};v||(v=S[S.length-1]),v||(v=m()),v.width-v.usedWidth<d&&(v=m());for(var b=function(j){return j&&j.scaledLabelShown===p},w=i&&i===co.dequeue,_=i&&i===co.highQuality,T=i&&i===co.downscale,N,E=n+1;E<=Wv;E++){var k=l.get(t,E);if(k){N=k;break}}var L=N&&N.level===n+1?N:null,A=function(){v.context.drawImage(L.texture.canvas,L.x,0,L.width,L.height,v.usedWidth,0,d,c)};if(v.context.setTransform(1,0,0,1,0,0),v.context.clearRect(v.usedWidth,0,d,x),b(L))A();else if(b(N))if(_){for(var M=N.level;M>n;M--)L=a.getElement(t,e,r,M,co.downscale);A()}else return a.queueElement(t,N.level-1),N;else{var O;if(!w&&!_&&!T)for(var $=n-1;$>=fd;$--){var D=l.get(t,$);if(D){O=D;break}}if(b(O))return a.queueElement(t,n),O;v.context.translate(v.usedWidth,0),v.context.scale(u,u),this.drawElement(v.context,t,e,p,!1),v.context.scale(1/u,1/u),v.context.translate(-v.usedWidth,0)}return f={x:v.usedWidth,texture:v,level:n,scale:u,width:d,height:c,scaledLabelShown:p},v.usedWidth+=Math.ceil(d+XP),v.eleCaches.push(f),l.set(t,n,f),a.checkTextureFullness(v),f};Er.invalidateElements=function(t){for(var e=0;e<t.length;e++)this.invalidateElement(t[e])};Er.invalidateElement=function(t){var e=this,r=e.lookup,n=[],i=r.isInvalid(t);if(i){for(var a=fd;a<=Wv;a++){var s=r.getForCachedKey(t,a);s&&n.push(s)}var o=r.invalidate(t);if(o)for(var l=0;l<n.length;l++){var u=n[l],c=u.texture;c.invalidatedWidth+=u.width,u.invalidated=!0,e.checkTextureUtility(c)}e.removeFromQueue(t)}};Er.checkTextureUtility=function(t){t.invalidatedWidth>=eM*t.width&&this.retireTexture(t)};Er.checkTextureFullness=function(t){var e=this,r=e.getTextureQueue(t.height);t.usedWidth/t.width>tM&&t.fullnessChecks>=rM?ba(r,t):t.fullnessChecks++};Er.retireTexture=function(t){var e=this,r=t.height,n=e.getTextureQueue(r),i=this.lookup;ba(n,t),t.retired=!0;for(var a=t.eleCaches,s=0;s<a.length;s++){var o=a[s];i.deleteCache(o.key,o.level)}Em(a);var l=e.getRetiredTextureQueue(r);l.push(t)};Er.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(QP,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};Er.recycleTexture=function(t,e){for(var r=this,n=r.getTextureQueue(t),i=r.getRetiredTextureQueue(t),a=0;a<i.length;a++){var s=i[a];if(s.width>=e)return s.retired=!1,s.usedWidth=0,s.invalidatedWidth=0,s.fullnessChecks=0,Em(s.eleCaches),s.context.setTransform(1,0,0,1,0,0),s.context.clearRect(0,0,s.width,s.height),ba(i,s),n.push(s),s}};Er.queueElement=function(t,e){var r=this,n=r.getElementQueue(),i=r.getElementKeyToQueue(),a=this.getKey(t),s=i[a];if(s)s.level=Math.max(s.level,e),s.eles.merge(t),s.reqs++,n.updateItem(s);else{var o={eles:t.spawn().merge(t),level:e,reqs:1,key:a};n.push(o),i[a]=o}};Er.dequeue=function(t){for(var e=this,r=e.getElementQueue(),n=e.getElementKeyToQueue(),i=[],a=e.lookup,s=0;s<lM&&r.size()>0;s++){var o=r.pop(),l=o.key,u=o.eles[0],c=a.hasCache(u,o.level);if(n[l]=null,c)continue;i.push(o);var d=e.getBoundingBox(u);e.getElement(u,d,t,o.level,co.dequeue)}return i};Er.removeFromQueue=function(t){var e=this,r=e.getElementQueue(),n=e.getElementKeyToQueue(),i=this.getKey(t),a=n[i];a!=null&&(a.eles.length===1?(a.reqs=Cm,r.updateItem(a),r.pop(),n[i]=null):a.eles.unmerge(t))};Er.onDequeue=function(t){this.onDequeues.push(t)};Er.offDequeue=function(t){ba(this.onDequeues,t)};Er.setupDequeueing=mC.setupDequeueing({deqRedrawThreshold:oM,deqCost:nM,deqAvgCost:iM,deqNoDrawCost:aM,deqFastCost:sM,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 a=0;a<r.length;a++)for(var s=r[a].eles,o=0;o<s.length;o++){var l=s[o].boundingBox();if(Rm(l,i))return!0}return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var cM=1,Fl=-4,Md=2,dM=3.99,hM=50,fM=50,pM=.15,gM=.1,vM=.9,mM=.9,yM=1,Bw=250,xM=4e3*4e3,Fw=32767,bM=!0,xC=function(e){var r=this,n=r.renderer=e,i=n.cy;r.layersByLevel={},r.firstGet=!0,r.lastInvalidationTime=Bi()-2*Bw,r.skipping=!1,r.eleTxrDeqs=i.collection(),r.scheduleElementRefinement=du(function(){r.refineElementTextures(r.eleTxrDeqs),r.eleTxrDeqs.unmerge(r.eleTxrDeqs)},fM),n.beforeRender(function(s,o){o-r.lastInvalidationTime<=Bw?r.skipping=!0:r.skipping=!1},n.beforeRenderPriorities.lyrTxrSkip);var a=function(o,l){return l.reqs-o.reqs};r.layersQueue=new hu(a),r.setupDequeueing()},$r=xC.prototype,zw=0,wM=Math.pow(2,53)-1;$r.makeLayer=function(t,e){var r=Math.pow(2,e),n=Math.ceil(t.w*r),i=Math.ceil(t.h*r),a=this.renderer.makeOffscreenCanvas(n,i),s={id:zw=++zw%wM,bb:t,level:e,width:n,height:i,canvas:a,context:a.getContext("2d"),eles:[],elesQueue:[],reqs:0},o=s.context,l=-s.bb.x1,u=-s.bb.y1;return o.scale(r,r),o.translate(l,u),s};$r.getLayers=function(t,e,r){var n=this,i=n.renderer,a=i.cy,s=a.zoom(),o=n.firstGet;if(n.firstGet=!1,r==null){if(r=Math.ceil(Tm(s*e)),r<Fl)r=Fl;else if(s>=dM||r>Md)return null}n.validateLayersElesOrdering(r,t);var l=n.layersByLevel,u=Math.pow(2,r),c=l[r]=l[r]||[],d,p=n.levelIsComplete(r,t),f,x=function(){var A=function(B){if(n.validateLayersElesOrdering(B,t),n.levelIsComplete(B,t))return f=l[B],!0},M=function(B){if(!f)for(var j=r+B;Fl<=j&&j<=Md&&!A(j);j+=B);};M(1),M(-1);for(var O=c.length-1;O>=0;O--){var $=c[O];$.invalid&&ba(c,$)}};if(!p)x();else return c;var S=function(){if(!d){d=sn();for(var A=0;A<t.length;A++)gA(d,t[A].boundingBox())}return d},v=function(A){A=A||{};var M=A.after;S();var O=Math.ceil(d.w*u),$=Math.ceil(d.h*u);if(O>Fw||$>Fw)return null;var D=O*$;if(D>xM)return null;var B=n.makeLayer(d,r);if(M!=null){var j=c.indexOf(M)+1;c.splice(j,0,B)}else(A.insert===void 0||A.insert)&&c.unshift(B);return B};if(n.skipping&&!o)return null;for(var m=null,b=t.length/cM,w=!o,_=0;_<t.length;_++){var T=t[_],N=T._private.rscratch,E=N.imgLayerCaches=N.imgLayerCaches||{},k=E[r];if(k){m=k;continue}if((!m||m.eles.length>=b||!h_(m.bb,T.boundingBox()))&&(m=v({insert:!0,after:m}),!m))return null;f||w?n.queueLayer(m,T):n.drawEleInLayer(m,T,r,e),m.eles.push(T),E[r]=m}return f||(w?null:c)};$r.getEleLevelForLayerLevel=function(t,e){return t};$r.drawEleInLayer=function(t,e,r,n){var i=this,a=this.renderer,s=t.context,o=e.boundingBox();o.w===0||o.h===0||!e.visible()||(r=i.getEleLevelForLayerLevel(r,n),a.setImgSmoothing(s,!1),a.drawCachedElement(s,e,null,null,r,bM),a.setImgSmoothing(s,!0))};$r.levelIsComplete=function(t,e){var r=this,n=r.layersByLevel[t];if(!n||n.length===0)return!1;for(var i=0,a=0;a<n.length;a++){var s=n[a];if(s.reqs>0||s.invalid)return!1;i+=s.eles.length}return i===e.length};$r.validateLayersElesOrdering=function(t,e){var r=this.layersByLevel[t];if(r)for(var n=0;n<r.length;n++){for(var i=r[n],a=-1,s=0;s<e.length;s++)if(i.eles[0]===e[s]){a=s;break}if(a<0){this.invalidateLayer(i);continue}for(var o=a,s=0;s<i.eles.length;s++)if(i.eles[s]!==e[o+s]){this.invalidateLayer(i);break}}};$r.updateElementsInLayers=function(t,e){for(var r=this,n=ou(t[0]),i=0;i<t.length;i++)for(var a=n?null:t[i],s=n?t[i]:t[i].ele,o=s._private.rscratch,l=o.imgLayerCaches=o.imgLayerCaches||{},u=Fl;u<=Md;u++){var c=l[u];c&&(a&&r.getEleLevelForLayerLevel(c.level)!==a.level||e(c,s,a))}};$r.haveLayers=function(){for(var t=this,e=!1,r=Fl;r<=Md;r++){var n=t.layersByLevel[r];if(n&&n.length>0){e=!0;break}}return e};$r.invalidateElements=function(t){var e=this;t.length!==0&&(e.lastInvalidationTime=Bi(),!(t.length===0||!e.haveLayers())&&e.updateElementsInLayers(t,function(n,i,a){e.invalidateLayer(n)}))};$r.invalidateLayer=function(t){if(this.lastInvalidationTime=Bi(),!t.invalid){var e=t.level,r=t.eles,n=this.layersByLevel[e];ba(n,t),t.elesQueue=[],t.invalid=!0,t.replacement&&(t.replacement.invalid=!0);for(var i=0;i<r.length;i++){var a=r[i]._private.rscratch.imgLayerCaches;a&&(a[e]=null)}}};$r.refineElementTextures=function(t){var e=this;e.updateElementsInLayers(t,function(n,i,a){var s=n.replacement;if(s||(s=n.replacement=e.makeLayer(n.bb,n.level),s.replaces=n,s.eles=n.eles),!s.reqs)for(var o=0;o<s.eles.length;o++)e.queueLayer(s,s.eles[o])})};$r.enqueueElementRefinement=function(t){this.eleTxrDeqs.merge(t),this.scheduleElementRefinement()};$r.queueLayer=function(t,e){var r=this,n=r.layersQueue,i=t.elesQueue,a=i.hasId=i.hasId||{};if(!t.replacement){if(e){if(a[e.id()])return;i.push(e),a[e.id()]=!0}t.reqs?(t.reqs++,n.updateItem(t)):(t.reqs=1,n.push(t))}};$r.dequeue=function(t){for(var e=this,r=e.layersQueue,n=[],i=0;i<yM&&r.size()!==0;){var a=r.peek();if(a.replacement){r.pop();continue}if(a.replaces&&a!==a.replaces.replacement){r.pop();continue}if(a.invalid){r.pop();continue}var s=a.elesQueue.shift();s&&(e.drawEleInLayer(a,s,a.level,t),i++),n.length===0&&n.push(!0),a.elesQueue.length===0&&(r.pop(),a.reqs=0,a.replaces&&e.applyLayerReplacement(a),e.requestRedraw())}return n};$r.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 a=0;a<t.eles.length;a++){var s=t.eles[a]._private,o=s.imgLayerCaches=s.imgLayerCaches||{};o&&(o[t.level]=t)}e.requestRedraw()}};$r.requestRedraw=du(function(){var t=this.renderer;t.redrawHint("eles",!0),t.redrawHint("drag",!0),t.redraw()},100);$r.setupDequeueing=mC.setupDequeueing({deqRedrawThreshold:hM,deqCost:pM,deqAvgCost:gM,deqNoDrawCost:vM,deqFastCost:mM,deq:function(e,r){return e.dequeue(r)},onDeqd:km,shouldRedraw:a_,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var bC={},$w;function SM(t,e){for(var r=0;r<e.length;r++){var n=e[r];t.lineTo(n.x,n.y)}}function _M(t,e,r){for(var n,i=0;i<e.length;i++){var a=e[i];i===0&&(n=a),t.lineTo(a.x,a.y)}t.quadraticCurveTo(r.x,r.y,n.x,n.y)}function Hw(t,e,r){t.beginPath&&t.beginPath();for(var n=e,i=0;i<n.length;i++){var a=n[i];t.lineTo(a.x,a.y)}var s=r,o=r[0];t.moveTo(o.x,o.y);for(var i=1;i<s.length;i++){var a=s[i];t.lineTo(a.x,a.y)}t.closePath&&t.closePath()}function CM(t,e,r,n,i){t.beginPath&&t.beginPath(),t.arc(r,n,i,0,Math.PI*2,!1);var a=e,s=a[0];t.moveTo(s.x,s.y);for(var o=0;o<a.length;o++){var l=a[o];t.lineTo(l.x,l.y)}t.closePath&&t.closePath()}function kM(t,e,r,n){t.arc(e,r,n,0,Math.PI*2,!1)}bC.arrowShapeImpl=function(t){return($w||($w={polygon:SM,"triangle-backcurve":_M,"triangle-tee":Hw,"circle-triangle":CM,"triangle-cross":Hw,circle:kM}))[t]};var _i={};_i.drawElement=function(t,e,r,n,i,a){var s=this;e.isNode()?s.drawNode(t,e,r,n,i,a):s.drawEdge(t,e,r,n,i,a)};_i.drawElementOverlay=function(t,e){var r=this;e.isNode()?r.drawNodeOverlay(t,e):r.drawEdgeOverlay(t,e)};_i.drawElementUnderlay=function(t,e){var r=this;e.isNode()?r.drawNodeUnderlay(t,e):r.drawEdgeUnderlay(t,e)};_i.drawCachedElementPortion=function(t,e,r,n,i,a,s,o){var l=this,u=r.getBoundingBox(e);if(!(u.w===0||u.h===0)){var c=r.getElement(e,u,n,i,a);if(c!=null){var d=o(l,e);if(d===0)return;var p=s(l,e),f=u.x1,x=u.y1,S=u.w,v=u.h,m,b,w,_,T;if(p!==0){var N=r.getRotationPoint(e);w=N.x,_=N.y,t.translate(w,_),t.rotate(p),T=l.getImgSmoothing(t),T||l.setImgSmoothing(t,!0);var E=r.getRotationOffset(e);m=E.x,b=E.y}else m=f,b=x;var k;d!==1&&(k=t.globalAlpha,t.globalAlpha=k*d),t.drawImage(c.texture.canvas,c.x,0,c.width,c.height,m,b,S,v),d!==1&&(t.globalAlpha=k),p!==0&&(t.rotate(-p),t.translate(-w,-_),T||l.setImgSmoothing(t,!1))}else r.drawElement(t,e)}};var EM=function(){return 0},TM=function(e,r){return e.getTextAngle(r,null)},NM=function(e,r){return e.getTextAngle(r,"source")},RM=function(e,r){return e.getTextAngle(r,"target")},LM=function(e,r){return r.effectiveOpacity()},Gg=function(e,r){return r.pstyle("text-opacity").pfValue*r.effectiveOpacity()};_i.drawCachedElement=function(t,e,r,n,i,a){var s=this,o=s.data,l=o.eleTxrCache,u=o.lblTxrCache,c=o.slbTxrCache,d=o.tlbTxrCache,p=e.boundingBox(),f=a===!0?l.reasons.highQuality:null;if(!(p.w===0||p.h===0||!e.visible())&&(!n||Rm(p,n))){var x=e.isEdge(),S=e.element()._private.rscratch.badLine;s.drawElementUnderlay(t,e),s.drawCachedElementPortion(t,e,l,r,i,f,EM,LM),(!x||!S)&&s.drawCachedElementPortion(t,e,u,r,i,f,TM,Gg),x&&!S&&(s.drawCachedElementPortion(t,e,c,r,i,f,NM,Gg),s.drawCachedElementPortion(t,e,d,r,i,f,RM,Gg)),s.drawElementOverlay(t,e)}};_i.drawElements=function(t,e){for(var r=this,n=0;n<e.length;n++){var i=e[n];r.drawElement(t,i)}};_i.drawCachedElements=function(t,e,r,n){for(var i=this,a=0;a<e.length;a++){var s=e[a];i.drawCachedElement(t,s,r,n)}};_i.drawCachedNodes=function(t,e,r,n){for(var i=this,a=0;a<e.length;a++){var s=e[a];s.isNode()&&i.drawCachedElement(t,s,r,n)}};_i.drawLayeredElements=function(t,e,r,n){var i=this,a=i.data.lyrTxrCache.getLayers(e,r);if(a)for(var s=0;s<a.length;s++){var o=a[s],l=o.bb;l.w===0||l.h===0||t.drawImage(o.canvas,l.x1,l.y1,l.w,l.h)}else i.drawCachedElements(t,e,r,n)};var $i={};$i.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,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this,o=e._private.rscratch;if(!(a&&!e.visible())&&!(o.badLine||o.allpts==null||isNaN(o.allpts[0]))){var l;r&&(l=r,t.translate(-l.x1,-l.y1));var u=a?e.pstyle("opacity").value:1,c=a?e.pstyle("line-opacity").value:1,d=e.pstyle("curve-style").value,p=e.pstyle("line-style").value,f=e.pstyle("width").pfValue,x=e.pstyle("line-cap").value,S=e.pstyle("line-outline-width").value,v=e.pstyle("line-outline-color").value,m=u*c,b=u*c,w=function(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:m;d==="straight-triangle"?(s.eleStrokeStyle(t,e,B),s.drawEdgeTrianglePath(e,t,o.allpts)):(t.lineWidth=f,t.lineCap=x,s.eleStrokeStyle(t,e,B),s.drawEdgePath(e,t,o.allpts,p),t.lineCap="butt")},_=function(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:m;if(t.lineWidth=f+S,t.lineCap=x,S>0)s.colorStrokeStyle(t,v[0],v[1],v[2],B);else{t.lineCap="butt";return}d==="straight-triangle"?s.drawEdgeTrianglePath(e,t,o.allpts):(s.drawEdgePath(e,t,o.allpts,p),t.lineCap="butt")},T=function(){i&&s.drawEdgeOverlay(t,e)},N=function(){i&&s.drawEdgeUnderlay(t,e)},E=function(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:b;s.drawArrowheads(t,e,B)},k=function(){s.drawElementText(t,e,null,n)};t.lineJoin="round";var L=e.pstyle("ghost").value==="yes";if(L){var A=e.pstyle("ghost-offset-x").pfValue,M=e.pstyle("ghost-offset-y").pfValue,O=e.pstyle("ghost-opacity").value,$=m*O;t.translate(A,M),w($),E($),t.translate(-A,-M)}else _();N(),w(),E(),T(),k(),r&&t.translate(l.x1,l.y1)}};var wC=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 a=this,s=a.usePaths(),o=n._private.rscratch,l=n.pstyle("".concat(e,"-padding")).pfValue,u=2*l,c=n.pstyle("".concat(e,"-color")).value;r.lineWidth=u,o.edgeType==="self"&&!s?r.lineCap="butt":r.lineCap="round",a.colorStrokeStyle(r,c[0],c[1],c[2],i),a.drawEdgePath(n,r,o.allpts,"solid")}}}};$i.drawEdgeOverlay=wC("overlay");$i.drawEdgeUnderlay=wC("underlay");$i.drawEdgePath=function(t,e,r,n){var i=t._private.rscratch,a=e,s,o=!1,l=this.usePaths(),u=t.pstyle("line-dash-pattern").pfValue,c=t.pstyle("line-dash-offset").pfValue;if(l){var d=r.join("$"),p=i.pathCacheKey&&i.pathCacheKey===d;p?(s=e=i.pathCache,o=!0):(s=e=new Path2D,i.pathCacheKey=d,i.pathCache=s)}if(a.setLineDash)switch(n){case"dotted":a.setLineDash([1,1]);break;case"dashed":a.setLineDash(u),a.lineDashOffset=c;break;case"solid":a.setLineDash([]);break}if(!o&&!i.badLine)switch(e.beginPath&&e.beginPath(),e.moveTo(r[0],r[1]),i.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var f=2;f+3<r.length;f+=4)e.quadraticCurveTo(r[f],r[f+1],r[f+2],r[f+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 S=yn(i.roundCorners),v;try{for(S.s();!(v=S.n()).done;){var m=v.value;lC(e,m)}}catch(w){S.e(w)}finally{S.f()}e.lineTo(r[r.length-2],r[r.length-1])}else for(var b=2;b+1<r.length;b+=2)e.lineTo(r[b],r[b+1]);break}e=a,l?e.stroke(s):e.stroke(),e.setLineDash&&e.setLineDash([])};$i.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 a=[r[i+2]-r[i],r[i+3]-r[i+1]],s=Math.sqrt(a[0]*a[0]+a[1]*a[1]),o=[a[1]/s,-a[0]/s],l=[o[0]*n/2,o[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()}};$i.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)};$i.drawArrowhead=function(t,e,r,n,i,a,s){if(!(isNaN(n)||n==null||isNaN(i)||i==null||isNaN(a)||a==null)){var o=this,l=e.pstyle(r+"-arrow-shape").value;if(l!=="none"){var u=e.pstyle(r+"-arrow-fill").value==="hollow"?"both":"filled",c=e.pstyle(r+"-arrow-fill").value,d=e.pstyle("width").pfValue,p=e.pstyle(r+"-arrow-width"),f=p.value==="match-line"?d:p.pfValue;p.units==="%"&&(f*=d);var x=e.pstyle("opacity").value;s===void 0&&(s=x);var S=t.globalCompositeOperation;(s!==1||c==="hollow")&&(t.globalCompositeOperation="destination-out",o.colorFillStyle(t,255,255,255,1),o.colorStrokeStyle(t,255,255,255,1),o.drawArrowShape(e,t,u,d,l,f,n,i,a),t.globalCompositeOperation=S);var v=e.pstyle(r+"-arrow-color").value;o.colorFillStyle(t,v[0],v[1],v[2],s),o.colorStrokeStyle(t,v[0],v[1],v[2],s),o.drawArrowShape(e,t,c,d,l,f,n,i,a)}}};$i.drawArrowShape=function(t,e,r,n,i,a,s,o,l){var u=this,c=this.usePaths()&&i!=="triangle-cross",d=!1,p,f=e,x={x:s,y:o},S=t.pstyle("arrow-scale").value,v=this.getArrowWidth(n,S),m=u.arrowShapes[i];if(c){var b=u.arrowPathCache=u.arrowPathCache||[],w=ds(i),_=b[w];_!=null?(p=e=_,d=!0):(p=e=new Path2D,b[w]=p)}d||(e.beginPath&&e.beginPath(),c?m.draw(e,1,0,{x:0,y:0},1):m.draw(e,v,l,x,n),e.closePath&&e.closePath()),e=f,c&&(e.translate(s,o),e.rotate(l),e.scale(v,v)),(r==="filled"||r==="both")&&(c?e.fill(p):e.fill()),(r==="hollow"||r==="both")&&(e.lineWidth=a/(c?v:1),e.lineJoin="miter",c?e.stroke(p):e.stroke()),c&&(e.scale(1/v,1/v),e.rotate(-l),e.translate(-s,-o))};var Um={};Um.safeDrawImage=function(t,e,r,n,i,a,s,o,l,u){if(!(i<=0||a<=0||l<=0||u<=0))try{t.drawImage(e,r,n,i,a,s,o,l,u)}catch(c){Ht(c)}};Um.drawInscribedImage=function(t,e,r,n,i){var a=this,s=r.position(),o=s.x,l=s.y,u=r.cy().style(),c=u.getIndexedStyle.bind(u),d=c(r,"background-fit","value",n),p=c(r,"background-repeat","value",n),f=r.width(),x=r.height(),S=r.padding()*2,v=f+(c(r,"background-width-relative-to","value",n)==="inner"?0:S),m=x+(c(r,"background-height-relative-to","value",n)==="inner"?0:S),b=r._private.rscratch,w=c(r,"background-clip","value",n),_=w==="node",T=c(r,"background-image-opacity","value",n)*i,N=c(r,"background-image-smoothing","value",n),E=r.pstyle("corner-radius").value;E!=="auto"&&(E=r.pstyle("corner-radius").pfValue);var k=e.width||e.cachedW,L=e.height||e.cachedH;(k==null||L==null)&&(document.body.appendChild(e),k=e.cachedW=e.width||e.offsetWidth,L=e.cachedH=e.height||e.offsetHeight,document.body.removeChild(e));var A=k,M=L;if(c(r,"background-width","value",n)!=="auto"&&(c(r,"background-width","units",n)==="%"?A=c(r,"background-width","pfValue",n)*v:A=c(r,"background-width","pfValue",n)),c(r,"background-height","value",n)!=="auto"&&(c(r,"background-height","units",n)==="%"?M=c(r,"background-height","pfValue",n)*m:M=c(r,"background-height","pfValue",n)),!(A===0||M===0)){if(d==="contain"){var O=Math.min(v/A,m/M);A*=O,M*=O}else if(d==="cover"){var O=Math.max(v/A,m/M);A*=O,M*=O}var $=o-v/2,D=c(r,"background-position-x","units",n),B=c(r,"background-position-x","pfValue",n);D==="%"?$+=(v-A)*B:$+=B;var j=c(r,"background-offset-x","units",n),I=c(r,"background-offset-x","pfValue",n);j==="%"?$+=(v-A)*I:$+=I;var U=l-m/2,F=c(r,"background-position-y","units",n),P=c(r,"background-position-y","pfValue",n);F==="%"?U+=(m-M)*P:U+=P;var H=c(r,"background-offset-y","units",n),W=c(r,"background-offset-y","pfValue",n);H==="%"?U+=(m-M)*W:U+=W,b.pathCache&&($-=o,U-=l,o=0,l=0);var V=t.globalAlpha;t.globalAlpha=T;var re=a.getImgSmoothing(t),J=!1;if(N==="no"&&re?(a.setImgSmoothing(t,!1),J=!0):N==="yes"&&!re&&(a.setImgSmoothing(t,!0),J=!0),p==="no-repeat")_&&(t.save(),b.pathCache?t.clip(b.pathCache):(a.nodeShapes[a.getNodeShape(r)].draw(t,o,l,v,m,E,b),t.clip())),a.safeDrawImage(t,e,0,0,k,L,$,U,A,M),_&&t.restore();else{var ne=t.createPattern(e,p);t.fillStyle=ne,a.nodeShapes[a.getNodeShape(r)].draw(t,o,l,v,m,E,b),t.translate($,U),t.fill(),t.translate(-$,-U)}t.globalAlpha=V,J&&a.setImgSmoothing(t,re)}};var bs={};bs.eleTextBiggerThanMin=function(t,e){if(!e){var r=t.cy().zoom(),n=this.getPixelRatio(),i=Math.ceil(Tm(r*n));e=Math.pow(2,i)}var a=t.pstyle("font-size").pfValue*e,s=t.pstyle("min-zoomed-font-size").pfValue;return!(a<s)};bs.drawElementText=function(t,e,r,n,i){var a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this;if(n==null){if(a&&!s.eleTextBiggerThanMin(e))return}else if(n===!1)return;if(e.isNode()){var o=e.pstyle("label");if(!o||!o.value)return;var l=s.getLabelJustification(e),u=e.pstyle("text-metrics").strValue==="glyph";t.textAlign=l,t.textBaseline=u?"alphabetic":"bottom"}else{var c=e.element()._private.rscratch.badLine,d=e.pstyle("label"),p=e.pstyle("source-label"),f=e.pstyle("target-label");if(c||(!d||!d.value)&&(!p||!p.value)&&(!f||!f.value))return;t.textAlign="center",t.textBaseline="bottom"}var x=!r,S;r&&(S=r,t.translate(-S.x1,-S.y1)),i==null?(s.drawText(t,e,null,x,a),e.isEdge()&&(s.drawText(t,e,"source",x,a),s.drawText(t,e,"target",x,a))):s.drawText(t,e,i,x,a),r&&t.translate(S.x1,S.y1)};bs.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};bs.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",a=e.pstyle("font-family").strValue,s=e.pstyle("font-weight").strValue,o=r?e.effectiveOpacity()*e.pstyle("text-opacity").value:1,l=e.pstyle("text-outline-opacity").value*o,u=e.pstyle("color").value,c=e.pstyle("text-outline-color").value;t.font=n+" "+s+" "+i+" "+a,t.lineJoin="round",this.colorFillStyle(t,u[0],u[1],u[2],o),this.colorStrokeStyle(t,c[0],c[1],c[2],l)};function DM(t,e,r,n,i){var a=Math.min(n,i),s=a/2,o=e+n/2,l=r+i/2;t.beginPath(),t.arc(o,l,s,0,Math.PI*2),t.closePath()}function Uw(t,e,r,n,i){var a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,s=Math.min(a,n/2,i/2);t.beginPath(),t.moveTo(e+s,r),t.lineTo(e+n-s,r),t.quadraticCurveTo(e+n,r,e+n,r+s),t.lineTo(e+n,r+i-s),t.quadraticCurveTo(e+n,r+i,e+n-s,r+i),t.lineTo(e+s,r+i),t.quadraticCurveTo(e,r+i,e,r+i-s),t.lineTo(e,r+s),t.quadraticCurveTo(e,r,e+s,r),t.closePath()}bs.getTextAngle=function(t,e){var r,n=t._private,i=n.rscratch,a=e?e+"-":"",s=t.pstyle(a+"text-rotation");if(s.strValue==="autorotate"){var o=rn(i,"labelAngle",e);r=t.isEdge()?o:0}else s.strValue==="none"?r=0:r=s.pfValue;return r};bs.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,a=e._private,s=a.rscratch,o=i?e.effectiveOpacity():1;if(!(i&&(o===0||e.pstyle("text-opacity").value===0))){r==="main"&&(r=null);var l=rn(s,"labelX",r),u=rn(s,"labelY",r),c,d,p=this.getLabelText(e,r);if(p!=null&&p!==""&&!isNaN(l)&&!isNaN(u)){this.setupTextStyle(t,e,i);var f=r?r+"-":"",x=rn(s,"labelWidth",r),S=rn(s,"labelHeight",r),v=rn(s,"labelActualDescent",r),m=e.pstyle(f+"text-margin-x").pfValue,b=e.pstyle(f+"text-margin-y").pfValue,w=e.isEdge(),_=e.pstyle("text-halign").value,T=e.pstyle("text-valign").value;w&&(_="center",T="center"),l+=m,u+=b;var N;n?N=this.getTextAngle(e,r):N=0,N!==0&&(c=l,d=u,t.translate(c,d),t.rotate(N),l=0,u=0);var E=_o(_),k=Co(T);switch(k){case"top":break;case"center":u+=S/2;break;case"bottom":u+=S;break}var L=e.pstyle("text-background-opacity").value,A=e.pstyle("text-border-opacity").value,M=e.pstyle("text-border-width").pfValue,O=e.pstyle("text-background-padding").pfValue,$=e.pstyle("text-background-shape").strValue,D=$==="round-rectangle"||$==="roundrectangle",B=$==="circle",j=2;if(L>0||M>0&&A>0){var I=t.fillStyle,U=t.strokeStyle,F=t.lineWidth,P=e.pstyle("text-background-color").value,H=e.pstyle("text-border-color").value,W=e.pstyle("text-border-style").value,V=L>0,re=M>0&&A>0,J=l-O;switch(E){case"left":J-=x;break;case"center":J-=x/2;break}var ne=u-S-O,X=x+2*O,q=S+2*O;if(V&&(t.fillStyle="rgba(".concat(P[0],",").concat(P[1],",").concat(P[2],",").concat(L*o,")")),re&&(t.strokeStyle="rgba(".concat(H[0],",").concat(H[1],",").concat(H[2],",").concat(A*o,")"),t.lineWidth=M,t.setLineDash))switch(W){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"double":t.lineWidth=M/4,t.setLineDash([]);break;case"solid":default:t.setLineDash([]);break}if(D?(t.beginPath(),Uw(t,J,ne,X,q,j)):B?(t.beginPath(),DM(t,J,ne,X,q)):(t.beginPath(),t.rect(J,ne,X,q)),V&&t.fill(),re&&t.stroke(),re&&W==="double"){var Y=M/2;t.beginPath(),D?Uw(t,J+Y,ne+Y,X-2*Y,q-2*Y,j):t.rect(J+Y,ne+Y,X-2*Y,q-2*Y),t.stroke()}t.fillStyle=I,t.strokeStyle=U,t.lineWidth=F,t.setLineDash&&t.setLineDash([])}var Q=2*e.pstyle("text-outline-width").pfValue;if(Q>0&&(t.lineWidth=Q),u-=v,e.pstyle("text-wrap").value==="wrap"){var te=rn(s,"labelWrapCachedLines",r),ie=rn(s,"labelLineHeight",r),le=x/2,pe=this.getLabelJustification(e);switch(pe==="auto"||(E==="left"?pe==="left"?l+=-x:pe==="center"&&(l+=-le):E==="center"?pe==="left"?l+=-le:pe==="right"&&(l+=le):E==="right"&&(pe==="center"?l+=le:pe==="right"&&(l+=x))),k){case"top":u-=(te.length-1)*ie;break;case"center":case"bottom":u-=(te.length-1)*ie;break}for(var Le=0;Le<te.length;Le++)Q>0&&t.strokeText(te[Le],l,u),t.fillText(te[Le],l,u),u+=ie}else Q>0&&t.strokeText(p,l,u),t.fillText(p,l,u);N!==0&&(t.rotate(-N),t.translate(-c,-d))}}};var La={};La.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,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this,o,l,u=e._private,c=u.rscratch,d=e.position();if(!(!Ke(d.x)||!Ke(d.y))&&!(a&&!e.visible())){var p=a?e.effectiveOpacity():1,f=s.usePaths(),x,S=!1,v=e.padding();o=e.width()+2*v,l=e.height()+2*v;var m;r&&(m=r,t.translate(-m.x1,-m.y1));for(var b=e.pstyle("background-image"),w=b.value,_=new Array(w.length),T=new Array(w.length),N=0,E=0;E<w.length;E++){var k=w[E],L=_[E]=k!=null&&k!=="none";if(L){var A=e.cy().style().getIndexedStyle(e,"background-image-crossorigin","value",E);N++,T[E]=s.getCachedImage(k,A,function(){u.backgroundTimestamp=Date.now(),e.emitAndNotify("background")})}}var M=e.pstyle("background-blacken").value,O=e.pstyle("border-width").pfValue,$=e.pstyle("background-opacity").value*p,D=e.pstyle("border-color").value,B=e.pstyle("border-style").value,j=e.pstyle("border-join").value,I=e.pstyle("border-cap").value,U=e.pstyle("border-position").value,F=e.pstyle("border-dash-pattern").pfValue,P=e.pstyle("border-dash-offset").pfValue,H=e.pstyle("border-opacity").value*p,W=e.pstyle("outline-width").pfValue,V=e.pstyle("outline-color").value,re=e.pstyle("outline-style").value,J=e.pstyle("outline-opacity").value*p,ne=e.pstyle("outline-offset").value,X=e.pstyle("corner-radius").value;X!=="auto"&&(X=e.pstyle("corner-radius").pfValue);var q=function(){var ue=arguments.length>0&&arguments[0]!==void 0?arguments[0]:$;s.eleFillStyle(t,e,ue)},Y=function(){var ue=arguments.length>0&&arguments[0]!==void 0?arguments[0]:H;s.colorStrokeStyle(t,D[0],D[1],D[2],ue)},Q=function(){var ue=arguments.length>0&&arguments[0]!==void 0?arguments[0]:J;s.colorStrokeStyle(t,V[0],V[1],V[2],ue)},te=function(ue,ae,se,ce){var be=s.nodePathCache=s.nodePathCache||[],he=i_(se==="polygon"?se+","+ce.join(","):se,""+ae,""+ue,""+X),de=be[he],me,ke=!1;return de!=null?(me=de,ke=!0,c.pathCache=me):(me=new Path2D,be[he]=c.pathCache=me),{path:me,cacheHit:ke}},ie=e.pstyle("shape").strValue,le=e.pstyle("shape-polygon-points").pfValue;if(f){t.translate(d.x,d.y);var pe=te(o,l,ie,le);x=pe.path,S=pe.cacheHit}var Le=function(){if(!S){var ue=d;f&&(ue={x:0,y:0}),s.nodeShapes[s.getNodeShape(e)].draw(x||t,ue.x,ue.y,o,l,X,c)}f?t.fill(x):t.fill()},je=function(){for(var ue=arguments.length>0&&arguments[0]!==void 0?arguments[0]:p,ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,se=u.backgrounding,ce=0,be=0;be<T.length;be++){var he=e.cy().style().getIndexedStyle(e,"background-image-containment","value",be);if(ae&&he==="over"||!ae&&he==="inside"){ce++;continue}_[be]&&T[be].complete&&!T[be].error&&(ce++,s.drawInscribedImage(t,T[be],e,be,ue))}u.backgrounding=ce!==N,se!==u.backgrounding&&e.updateStyle(!1)},Se=function(){var ue=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:p;s.hasPie(e)&&(s.drawPie(t,e,ae),ue&&(f||s.nodeShapes[s.getNodeShape(e)].draw(t,d.x,d.y,o,l,X,c)))},Te=function(){var ue=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:p;s.hasStripe(e)&&(t.save(),f?t.clip(c.pathCache):(s.nodeShapes[s.getNodeShape(e)].draw(t,d.x,d.y,o,l,X,c),t.clip()),s.drawStripe(t,e,ae),t.restore(),ue&&(f||s.nodeShapes[s.getNodeShape(e)].draw(t,d.x,d.y,o,l,X,c)))},Ae=function(){var ue=arguments.length>0&&arguments[0]!==void 0?arguments[0]:p,ae=(M>0?M:-M)*ue,se=M>0?0:255;M!==0&&(s.colorFillStyle(t,se,se,se,ae),f?t.fill(x):t.fill())},Ne=function(){if(O>0){if(t.lineWidth=O,t.lineCap=I,t.lineJoin=j,t.setLineDash)switch(B){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash(F),t.lineDashOffset=P;break;case"solid":case"double":t.setLineDash([]);break}if(U!=="center"){if(t.save(),t.lineWidth*=2,U==="inside")f?t.clip(x):t.clip();else{var ue=new Path2D;ue.rect(-o/2-O,-l/2-O,o+2*O,l+2*O),ue.addPath(x),t.clip(ue,"evenodd")}f?t.stroke(x):t.stroke(),t.restore()}else f?t.stroke(x):t.stroke();if(B==="double"){t.lineWidth=O/3;var ae=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",f?t.stroke(x):t.stroke(),t.globalCompositeOperation=ae}t.setLineDash&&t.setLineDash([])}},Pe=function(){if(W>0){if(t.lineWidth=W,t.lineCap="butt",t.setLineDash)switch(re){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"solid":case"double":t.setLineDash([]);break}var ue=d;f&&(ue={x:0,y:0});var ae=s.getNodeShape(e),se=O;U==="inside"&&(se=0),U==="outside"&&(se*=2);var ce=(o+se+(W+ne))/o,be=(l+se+(W+ne))/l,he=o*ce,de=l*be,me=s.nodeShapes[ae].points,ke;if(f){var Re=te(he,de,ae,me);ke=Re.path}if(ae==="ellipse")s.drawEllipsePath(ke||t,ue.x,ue.y,he,de);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(ae)){var Ce=0,De=0,Qe=0;ae==="round-diamond"?Ce=(se+ne+W)*1.4:ae==="round-heptagon"?(Ce=(se+ne+W)*1.075,Qe=-(se/2+ne+W)/35):ae==="round-hexagon"?Ce=(se+ne+W)*1.12:ae==="round-pentagon"?(Ce=(se+ne+W)*1.13,Qe=-(se/2+ne+W)/15):ae==="round-tag"?(Ce=(se+ne+W)*1.12,De=(se/2+W+ne)*.07):ae==="round-triangle"&&(Ce=(se+ne+W)*(Math.PI/2),Qe=-(se+ne/2+W)/Math.PI),Ce!==0&&(ce=(o+Ce)/o,he=o*ce,["round-hexagon","round-tag"].includes(ae)||(be=(l+Ce)/l,de=l*be)),X=X==="auto"?g_(he,de):X;for(var Xe=he/2,yt=de/2,et=X+(se+W+ne)/2,Ze=new Array(me.length/2),ct=new Array(me.length/2),tt=0;tt<me.length/2;tt++)Ze[tt]={x:ue.x+De+Xe*me[tt*2],y:ue.y+Qe+yt*me[tt*2+1]};var Ye,kt,ft,ut,Ft=Ze.length;for(kt=Ze[Ft-1],Ye=0;Ye<Ft;Ye++)ft=Ze[Ye%Ft],ut=Ze[(Ye+1)%Ft],ct[Ye]=$m(kt,ft,ut,et),kt=ft,ft=ut;s.drawRoundPolygonPath(ke||t,ue.x+De,ue.y+Qe,o*ce,l*be,me,ct)}else if(["roundrectangle","round-rectangle"].includes(ae))X=X==="auto"?wa(he,de):X,s.drawRoundRectanglePath(ke||t,ue.x,ue.y,he,de,X+(se+W+ne)/2);else if(["cutrectangle","cut-rectangle"].includes(ae))X=X==="auto"?Lm():X,s.drawCutRectanglePath(ke||t,ue.x,ue.y,he,de,null,X+(se+W+ne)/4);else if(["bottomroundrectangle","bottom-round-rectangle"].includes(ae))X=X==="auto"?wa(he,de):X,s.drawBottomRoundRectanglePath(ke||t,ue.x,ue.y,he,de,X+(se+W+ne)/2);else if(ae==="barrel")s.drawBarrelPath(ke||t,ue.x,ue.y,he,de);else if(ae.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(ae)){var Tt=(se+W+ne)/o;me=Td(Nd(me,Tt)),s.drawPolygonPath(ke||t,ue.x,ue.y,o,l,me)}else{var Vt=(se+W+ne)/o;me=Td(Nd(me,-Vt)),s.drawPolygonPath(ke||t,ue.x,ue.y,o,l,me)}if(f?t.stroke(ke):t.stroke(),re==="double"){t.lineWidth=se/3;var jt=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",f?t.stroke(ke):t.stroke(),t.globalCompositeOperation=jt}t.setLineDash&&t.setLineDash([])}},ze=function(){i&&s.drawNodeOverlay(t,e,d,o,l)},Ie=function(){i&&s.drawNodeUnderlay(t,e,d,o,l)},$e=function(){s.drawElementText(t,e,null,n)},Ge=e.pstyle("ghost").value==="yes";if(Ge){var ve=e.pstyle("ghost-offset-x").pfValue,Ee=e.pstyle("ghost-offset-y").pfValue,Me=e.pstyle("ghost-opacity").value,ye=Me*p;t.translate(ve,Ee),Q(),Pe(),q(Me*$),Le(),je(ye,!0),Y(Me*H),Ne(),Se(M!==0||O!==0),Te(M!==0||O!==0),je(ye,!1),Ae(ye),t.translate(-ve,-Ee)}f&&t.translate(-d.x,-d.y),Ie(),f&&t.translate(d.x,d.y),Q(),Pe(),q(),Le(),je(p,!0),Y(),Ne(),Se(M!==0||O!==0),Te(M!==0||O!==0),je(p,!1),Ae(),f&&t.translate(-d.x,-d.y),$e(),ze(),r&&t.translate(m.x1,m.y1)}};var SC=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(r,n,i,a,s){var o=this;if(n.visible()){var l=n.pstyle("".concat(e,"-padding")).pfValue,u=n.pstyle("".concat(e,"-opacity")).value,c=n.pstyle("".concat(e,"-color")).value,d=n.pstyle("".concat(e,"-shape")).value,p=n.pstyle("".concat(e,"-corner-radius")).value;if(u>0){if(i=i||n.position(),a==null||s==null){var f=n.padding();a=n.width()+2*f,s=n.height()+2*f}o.colorFillStyle(r,c[0],c[1],c[2],u),o.nodeShapes[d].draw(r,i.x,i.y,a+l*2,s+l*2,p),r.fill()}}}};La.drawNodeOverlay=SC("overlay");La.drawNodeUnderlay=SC("underlay");La.hasPie=function(t){return t=t[0],t._private.hasPie};La.hasStripe=function(t){return t=t[0],t._private.hasStripe};La.drawPie=function(t,e,r,n){e=e[0],n=n||e.position();var i=e.cy().style(),a=e.pstyle("pie-size"),s=e.pstyle("pie-hole"),o=e.pstyle("pie-start-angle").pfValue,l=n.x,u=n.y,c=e.width(),d=e.height(),p=Math.min(c,d)/2,f,x=0,S=this.usePaths();if(S&&(l=0,u=0),a.units==="%"?p=p*a.pfValue:a.pfValue!==void 0&&(p=a.pfValue/2),s.units==="%"?f=p*s.pfValue:s.pfValue!==void 0&&(f=s.pfValue/2),!(f>=p))for(var v=1;v<=i.pieBackgroundN;v++){var m=e.pstyle("pie-"+v+"-background-size").value,b=e.pstyle("pie-"+v+"-background-color").value,w=e.pstyle("pie-"+v+"-background-opacity").value*r,_=m/100;_+x>1&&(_=1-x);var T=1.5*Math.PI+2*Math.PI*x;T+=o;var N=2*Math.PI*_,E=T+N;m===0||x>=1||x+_>1||(f===0?(t.beginPath(),t.moveTo(l,u),t.arc(l,u,p,T,E),t.closePath()):(t.beginPath(),t.arc(l,u,p,T,E),t.arc(l,u,f,E,T,!0),t.closePath()),this.colorFillStyle(t,b[0],b[1],b[2],w),t.fill(),x+=_)}};La.drawStripe=function(t,e,r,n){e=e[0],n=n||e.position();var i=e.cy().style(),a=n.x,s=n.y,o=e.width(),l=e.height(),u=0,c=this.usePaths();t.save();var d=e.pstyle("stripe-direction").value,p=e.pstyle("stripe-size");switch(d){case"vertical":break;case"righward":t.rotate(-Math.PI/2);break}var f=o,x=l;p.units==="%"?(f=f*p.pfValue,x=x*p.pfValue):p.pfValue!==void 0&&(f=p.pfValue,x=p.pfValue),c&&(a=0,s=0),s-=f/2,a-=x/2;for(var S=1;S<=i.stripeBackgroundN;S++){var v=e.pstyle("stripe-"+S+"-background-size").value,m=e.pstyle("stripe-"+S+"-background-color").value,b=e.pstyle("stripe-"+S+"-background-opacity").value*r,w=v/100;w+u>1&&(w=1-u),!(v===0||u>=1||u+w>1)&&(t.beginPath(),t.rect(a,s+x*u,f,x*w),t.closePath(),this.colorFillStyle(t,m[0],m[1],m[2],b),t.fill(),u+=w)}t.restore()};var on={},AM=100;on.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};on.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};on.createGradientStyleFor=function(t,e,r,n,i){var a,s=this.usePaths(),o=r.pstyle(e+"-gradient-stop-colors").value,l=r.pstyle(e+"-gradient-stop-positions").pfValue;if(n==="radial-gradient")if(r.isEdge()){var u=r.sourceEndpoint(),c=r.targetEndpoint(),d=r.midpoint(),p=hs(u,d),f=hs(c,d);a=t.createRadialGradient(d.x,d.y,0,d.x,d.y,Math.max(p,f))}else{var x=s?{x:0,y:0}:r.position(),S=r.paddedWidth(),v=r.paddedHeight();a=t.createRadialGradient(x.x,x.y,0,x.x,x.y,Math.max(S,v))}else if(r.isEdge()){var m=r.sourceEndpoint(),b=r.targetEndpoint();a=t.createLinearGradient(m.x,m.y,b.x,b.y)}else{var w=s?{x:0,y:0}:r.position(),_=r.paddedWidth(),T=r.paddedHeight(),N=_/2,E=T/2,k=r.pstyle("background-gradient-direction").value;switch(k){case"to-bottom":a=t.createLinearGradient(w.x,w.y-E,w.x,w.y+E);break;case"to-top":a=t.createLinearGradient(w.x,w.y+E,w.x,w.y-E);break;case"to-left":a=t.createLinearGradient(w.x+N,w.y,w.x-N,w.y);break;case"to-right":a=t.createLinearGradient(w.x-N,w.y,w.x+N,w.y);break;case"to-bottom-right":case"to-right-bottom":a=t.createLinearGradient(w.x-N,w.y-E,w.x+N,w.y+E);break;case"to-top-right":case"to-right-top":a=t.createLinearGradient(w.x-N,w.y+E,w.x+N,w.y-E);break;case"to-bottom-left":case"to-left-bottom":a=t.createLinearGradient(w.x+N,w.y-E,w.x-N,w.y+E);break;case"to-top-left":case"to-left-top":a=t.createLinearGradient(w.x+N,w.y+E,w.x-N,w.y-E);break}}if(!a)return null;for(var L=l.length===o.length,A=o.length,M=0;M<A;M++)a.addColorStop(L?l[M]:M/(A-1),"rgba("+o[M][0]+","+o[M][1]+","+o[M][2]+","+i+")");return a};on.gradientFillStyle=function(t,e,r,n){var i=this.createGradientStyleFor(t,"background",e,r,n);if(!i)return null;t.fillStyle=i};on.colorFillStyle=function(t,e,r,n,i){t.fillStyle="rgba("+e+","+r+","+n+","+i+")"};on.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)}};on.gradientStrokeStyle=function(t,e,r,n){var i=this.createGradientStyleFor(t,"line",e,r,n);if(!i)return null;t.strokeStyle=i};on.colorStrokeStyle=function(t,e,r,n,i){t.strokeStyle="rgba("+e+","+r+","+n+","+i+")"};on.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)}};on.matchCanvasSize=function(t){var e=this,r=e.data,n=e.findContainerClientCoords(),i=n[2],a=n[3],s=e.getPixelRatio(),o=e.motionBlurPxRatio;(t===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE]||t===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG])&&(s=o);var l=i*s,u=a*s,c;if(!(l===e.canvasWidth&&u===e.canvasHeight)){e.fontCaches=null;var d=r.canvasContainer;d.style.width=i+"px",d.style.height=a+"px";for(var p=0;p<e.CANVAS_LAYERS;p++)c=r.canvases[p],c.width=l,c.height=u,c.style.width=i+"px",c.style.height=a+"px";for(var p=0;p<e.BUFFER_COUNT;p++)c=r.bufferCanvases[p],c.width=l,c.height=u,c.style.width=i+"px",c.style.height=a+"px";e.textureMult=1,s<=1&&(c=r.bufferCanvases[e.TEXTURE_BUFFER],e.textureMult=2,c.width=l*e.textureMult,c.height=u*e.textureMult),e.canvasWidth=l,e.canvasHeight=u,e.pixelRatio=s}};on.renderTo=function(t,e,r,n){this.render({forcedContext:t,forcedZoom:e,forcedPan:r,drawAllLayers:!0,forcedPxRatio:n})};on.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])};on.render=function(t){var e=this;t=t||l_();var r=e.cy,n=t.forcedContext,i=t.drawAllLayers,a=t.drawOnlyNodeLayer,s=t.forcedZoom,o=t.forcedPan,l=t.forcedPxRatio===void 0?this.getPixelRatio():t.forcedPxRatio,u=e.data,c=u.canvasNeedsRedraw,d=e.textureOnViewport&&!n&&(e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming),p=t.motionBlur!==void 0?t.motionBlur:e.motionBlur,f=e.motionBlurPxRatio,x=r.hasCompoundNodes(),S=e.hoverData.draggingEles,v=!!(e.hoverData.selecting||e.touchData.selecting);p=p&&!n&&e.motionBlurEnabled&&!v;var m=p;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),p&&(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&&!d&&(c[e.NODE]=!0,c[e.SELECT_BOX]=!0);var b=r.style(),w=r.zoom(),_=s!==void 0?s:w,T=r.pan(),N={x:T.x,y:T.y},E={zoom:w,pan:{x:T.x,y:T.y}},k=e.prevViewport,L=k===void 0||E.zoom!==k.zoom||E.pan.x!==k.pan.x||E.pan.y!==k.pan.y;!L&&!(S&&!x)&&(e.motionBlurPxRatio=1),o&&(N=o),_*=l,N.x*=l,N.y*=l;var A=e.getCachedZSortedEles();function M(Y,Q,te,ie,le){var pe=Y.globalCompositeOperation;Y.globalCompositeOperation="destination-out",e.colorFillStyle(Y,255,255,255,e.motionBlurTransparency),Y.fillRect(Q,te,ie,le),Y.globalCompositeOperation=pe}function O(Y,Q){var te,ie,le,pe;!e.clearingMotionBlur&&(Y===u.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]||Y===u.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG])?(te={x:T.x*f,y:T.y*f},ie=w*f,le=e.canvasWidth*f,pe=e.canvasHeight*f):(te=N,ie=_,le=e.canvasWidth,pe=e.canvasHeight),Y.setTransform(1,0,0,1,0,0),Q==="motionBlur"?M(Y,0,0,le,pe):!n&&(Q===void 0||Q)&&Y.clearRect(0,0,le,pe),i||(Y.translate(te.x,te.y),Y.scale(ie,ie)),o&&Y.translate(o.x,o.y),s&&Y.scale(s,s)}if(d||(e.textureDrawLastFrame=!1),d){if(e.textureDrawLastFrame=!0,!e.textureCache){e.textureCache={},e.textureCache.bb=r.mutableElements().boundingBox(),e.textureCache.texture=e.data.bufferCanvases[e.TEXTURE_BUFFER];var $=e.data.bufferContexts[e.TEXTURE_BUFFER];$.setTransform(1,0,0,1,0,0),$.clearRect(0,0,e.canvasWidth*e.textureMult,e.canvasHeight*e.textureMult),e.render({forcedContext:$,drawOnlyNodeLayer:!0,forcedPxRatio:l*e.textureMult});var E=e.textureCache.viewport={zoom:r.zoom(),pan:r.pan(),width:e.canvasWidth,height:e.canvasHeight};E.mpan={x:(0-E.pan.x)/E.zoom,y:(0-E.pan.y)/E.zoom}}c[e.DRAG]=!1,c[e.NODE]=!1;var D=u.contexts[e.NODE],B=e.textureCache.texture,E=e.textureCache.viewport;D.setTransform(1,0,0,1,0,0),p?M(D,0,0,E.width,E.height):D.clearRect(0,0,E.width,E.height);var j=b.core("outside-texture-bg-color").value,I=b.core("outside-texture-bg-opacity").value;e.colorFillStyle(D,j[0],j[1],j[2],I),D.fillRect(0,0,E.width,E.height);var w=r.zoom();O(D,!1),D.clearRect(E.mpan.x,E.mpan.y,E.width/E.zoom/l,E.height/E.zoom/l),D.drawImage(B,E.mpan.x,E.mpan.y,E.width/E.zoom/l,E.height/E.zoom/l)}else e.textureOnViewport&&!n&&(e.textureCache=null);var U=r.extent(),F=e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming||e.hoverData.draggingEles||e.cy.animated(),P=e.hideEdgesOnViewport&&F,H=[];if(H[e.NODE]=!c[e.NODE]&&p&&!e.clearedForMotionBlur[e.NODE]||e.clearingMotionBlur,H[e.NODE]&&(e.clearedForMotionBlur[e.NODE]=!0),H[e.DRAG]=!c[e.DRAG]&&p&&!e.clearedForMotionBlur[e.DRAG]||e.clearingMotionBlur,H[e.DRAG]&&(e.clearedForMotionBlur[e.DRAG]=!0),c[e.NODE]||i||a||H[e.NODE]){var W=p&&!H[e.NODE]&&f!==1,D=n||(W?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]:u.contexts[e.NODE]),V=p&&!W?"motionBlur":void 0;O(D,V),P?e.drawCachedNodes(D,A.nondrag,l,U):e.drawLayeredElements(D,A.nondrag,l,U),e.debug&&e.drawDebugPoints(D,A.nondrag),!i&&!p&&(c[e.NODE]=!1)}if(!a&&(c[e.DRAG]||i||H[e.DRAG])){var W=p&&!H[e.DRAG]&&f!==1,D=n||(W?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG]:u.contexts[e.DRAG]);O(D,p&&!W?"motionBlur":void 0),P?e.drawCachedNodes(D,A.drag,l,U):e.drawCachedElements(D,A.drag,l,U),e.debug&&e.drawDebugPoints(D,A.drag),!i&&!p&&(c[e.DRAG]=!1)}if(this.drawSelectionRectangle(t,O),p&&f!==1){var re=u.contexts[e.NODE],J=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE],ne=u.contexts[e.DRAG],X=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG],q=function(Q,te,ie){Q.setTransform(1,0,0,1,0,0),ie||!m?Q.clearRect(0,0,e.canvasWidth,e.canvasHeight):M(Q,0,0,e.canvasWidth,e.canvasHeight);var le=f;Q.drawImage(te,0,0,e.canvasWidth*le,e.canvasHeight*le,0,0,e.canvasWidth,e.canvasHeight)};(c[e.NODE]||H[e.NODE])&&(q(re,J,H[e.NODE]),c[e.NODE]=!1),(c[e.DRAG]||H[e.DRAG])&&(q(ne,X,H[e.DRAG]),c[e.DRAG]=!1)}e.prevViewport=E,e.clearingMotionBlur&&(e.clearingMotionBlur=!1,e.motionBlurCleared=!0,e.motionBlur=!0),p&&(e.motionBlurTimeout=setTimeout(function(){e.motionBlurTimeout=null,e.clearedForMotionBlur[e.NODE]=!1,e.clearedForMotionBlur[e.DRAG]=!1,e.motionBlur=!1,e.clearingMotionBlur=!d,e.mbFrames=0,c[e.NODE]=!0,c[e.DRAG]=!0,e.redraw()},AM)),n||r.emit("render")};var Cl;on.drawSelectionRectangle=function(t,e){var r=this,n=r.cy,i=r.data,a=n.style(),s=t.drawOnlyNodeLayer,o=t.drawAllLayers,l=i.canvasNeedsRedraw,u=t.forcedContext;if(r.showFps||!s&&l[r.SELECT_BOX]&&!o){var c=u||i.contexts[r.SELECT_BOX];if(e(c),r.selection[4]==1&&(r.hoverData.selecting||r.touchData.selecting)){var d=r.cy.zoom(),p=a.core("selection-box-border-width").value/d;c.lineWidth=p,c.fillStyle="rgba("+a.core("selection-box-color").value[0]+","+a.core("selection-box-color").value[1]+","+a.core("selection-box-color").value[2]+","+a.core("selection-box-opacity").value+")",c.fillRect(r.selection[0],r.selection[1],r.selection[2]-r.selection[0],r.selection[3]-r.selection[1]),p>0&&(c.strokeStyle="rgba("+a.core("selection-box-border-color").value[0]+","+a.core("selection-box-border-color").value[1]+","+a.core("selection-box-border-color").value[2]+","+a.core("selection-box-opacity").value+")",c.strokeRect(r.selection[0],r.selection[1],r.selection[2]-r.selection[0],r.selection[3]-r.selection[1]))}if(i.bgActivePosistion&&!r.hoverData.selecting){var d=r.cy.zoom(),f=i.bgActivePosistion;c.fillStyle="rgba("+a.core("active-bg-color").value[0]+","+a.core("active-bg-color").value[1]+","+a.core("active-bg-color").value[2]+","+a.core("active-bg-opacity").value+")",c.beginPath(),c.arc(f.x,f.y,a.core("active-bg-size").pfValue/d,0,2*Math.PI),c.fill()}var x=r.lastRedrawTime;if(r.showFps&&x){x=Math.round(x);var S=Math.round(1e3/x),v="1 frame = "+x+" ms = "+S+" fps";if(c.setTransform(1,0,0,1,0,0),c.fillStyle="rgba(255, 0, 0, 0.75)",c.strokeStyle="rgba(255, 0, 0, 0.75)",c.font="30px Arial",!Cl){var m=c.measureText(v);Cl=m.actualBoundingBoxAscent}c.fillText(v,0,Cl);var b=60;c.strokeRect(0,Cl+10,250,20),c.fillRect(0,Cl+10,250*Math.min(S/b,1),20)}o||(l[r.SELECT_BOX]=!1)}};function Ww(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 PM(t,e,r){var n=Ww(t,t.VERTEX_SHADER,e),i=Ww(t,t.FRAGMENT_SHADER,r),a=t.createProgram();if(t.attachShader(a,n),t.attachShader(a,i),t.linkProgram(a),!t.getProgramParameter(a,t.LINK_STATUS))throw new Error("Could not initialize shaders");return a}function MM(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 Wm(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 OM(t){var e=t.pixelRatio,r=t.cy.zoom();return r*e}function jM(t,e,r,n,i){var a=n*r+e.x,s=i*r+e.y;return s=Math.round(t.canvasHeight-s),[a,s]}function IM(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 BM(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 Qa(t,e,r){var n=t[0]/255,i=t[1]/255,a=t[2]/255,s=e,o=r||new Array(4);return o[0]=n*s,o[1]=i*s,o[2]=a*s,o[3]=s,o}function Js(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 FM(t){return t[0]+(t[1]<<8)+(t[2]<<16)+(t[3]<<24)}function zM(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 _C(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 CC(t,e,r){switch(e){case t.FLOAT:return new Float32Array(r);case t.INT:return new Int32Array(r)}}function $M(t,e,r,n,i,a){switch(e){case t.FLOAT:return new Float32Array(r.buffer,a*n,i);case t.INT:return new Int32Array(r.buffer,a*n,i)}}function HM(t,e,r,n){var i=_C(t,e),a=br(i,2),s=a[0],o=a[1],l=CC(t,o,n),u=t.createBuffer();return t.bindBuffer(t.ARRAY_BUFFER,u),t.bufferData(t.ARRAY_BUFFER,l,t.STATIC_DRAW),o===t.FLOAT?t.vertexAttribPointer(r,s,o,!1,0,0):o===t.INT&&t.vertexAttribIPointer(r,s,o,0,0),t.enableVertexAttribArray(r),t.bindBuffer(t.ARRAY_BUFFER,null),u}function vi(t,e,r,n){var i=_C(t,r),a=br(i,3),s=a[0],o=a[1],l=a[2],u=CC(t,o,e*s),c=s*l,d=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,d),t.bufferData(t.ARRAY_BUFFER,e*c,t.DYNAMIC_DRAW),t.enableVertexAttribArray(n),o===t.FLOAT?t.vertexAttribPointer(n,s,o,!1,c,0):o===t.INT&&t.vertexAttribIPointer(n,s,o,c,0),t.vertexAttribDivisor(n,1),t.bindBuffer(t.ARRAY_BUFFER,null);for(var p=new Array(e),f=0;f<e;f++)p[f]=$M(t,o,u,c,s,f);return d.dataArray=u,d.stride=c,d.size=s,d.getView=function(x){return p[x]},d.setPoint=function(x,S,v){var m=p[x];m[0]=S,m[1]=v},d.bufferSubData=function(x){t.bindBuffer(t.ARRAY_BUFFER,d),x?t.bufferSubData(t.ARRAY_BUFFER,0,u,0,x*s):t.bufferSubData(t.ARRAY_BUFFER,0,u)},d}function UM(t,e,r){for(var n=9,i=new Float32Array(e*n),a=new Array(e),s=0;s<e;s++){var o=s*n*4;a[s]=new Float32Array(i.buffer,o,n)}var l=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,l),t.bufferData(t.ARRAY_BUFFER,i.byteLength,t.DYNAMIC_DRAW);for(var u=0;u<3;u++){var c=r+u;t.enableVertexAttribArray(c),t.vertexAttribPointer(c,3,t.FLOAT,!1,36,u*12),t.vertexAttribDivisor(c,1)}return t.bindBuffer(t.ARRAY_BUFFER,null),l.getMatrixView=function(d){return a[d]},l.setData=function(d,p){a[p].set(d,0)},l.bufferSubData=function(){t.bindBuffer(t.ARRAY_BUFFER,l),t.bufferSubData(t.ARRAY_BUFFER,0,i)},l}function WM(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 Vw=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 qg(){var t=new Vw(9);return Vw!=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 Gw(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 VM(t,e,r){var n=e[0],i=e[1],a=e[2],s=e[3],o=e[4],l=e[5],u=e[6],c=e[7],d=e[8],p=r[0],f=r[1],x=r[2],S=r[3],v=r[4],m=r[5],b=r[6],w=r[7],_=r[8];return t[0]=p*n+f*s+x*u,t[1]=p*i+f*o+x*c,t[2]=p*a+f*l+x*d,t[3]=S*n+v*s+m*u,t[4]=S*i+v*o+m*c,t[5]=S*a+v*l+m*d,t[6]=b*n+w*s+_*u,t[7]=b*i+w*o+_*c,t[8]=b*a+w*l+_*d,t}function pd(t,e,r){var n=e[0],i=e[1],a=e[2],s=e[3],o=e[4],l=e[5],u=e[6],c=e[7],d=e[8],p=r[0],f=r[1];return t[0]=n,t[1]=i,t[2]=a,t[3]=s,t[4]=o,t[5]=l,t[6]=p*n+f*s+u,t[7]=p*i+f*o+c,t[8]=p*a+f*l+d,t}function qw(t,e,r){var n=e[0],i=e[1],a=e[2],s=e[3],o=e[4],l=e[5],u=e[6],c=e[7],d=e[8],p=Math.sin(r),f=Math.cos(r);return t[0]=f*n+p*s,t[1]=f*i+p*o,t[2]=f*a+p*l,t[3]=f*s-p*n,t[4]=f*o-p*i,t[5]=f*l-p*a,t[6]=u,t[7]=c,t[8]=d,t}function Vv(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 GM(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 qM=(function(){function t(e,r,n,i){Ta(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 Na(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,a=this.texHeight,s=this.texSize,o=a/i,l=n*o,u=i*o;return l>s&&(o=s/n,l=n*o,u=i*o),{scale:o,texW:l,texH:u}}},{key:"draw",value:function(r,n,i){var a=this;if(this.locked)throw new Error("can't draw, atlas is locked");var s=this.texSize,o=this.texRows,l=this.texHeight,u=this.getScale(n),c=u.scale,d=u.texW,p=u.texH,f=function(w,_){if(i&&_){var T=_.context,N=w.x,E=w.row,k=N,L=l*E;T.save(),T.translate(k,L),T.scale(c,c),i(T,n),T.restore()}},x=[null,null],S=function(){f(a.freePointer,a.canvas),x[0]={x:a.freePointer.x,y:a.freePointer.row*l,w:d,h:p},x[1]={x:a.freePointer.x+d,y:a.freePointer.row*l,w:0,h:p},a.freePointer.x+=d,a.freePointer.x==s&&(a.freePointer.x=0,a.freePointer.row++)},v=function(){var w=a.scratch,_=a.canvas;w.clear(),f({x:0,row:0},w);var T=s-a.freePointer.x,N=d-T,E=l;{var k=a.freePointer.x,L=a.freePointer.row*l,A=T;_.context.drawImage(w,0,0,A,E,k,L,A,E),x[0]={x:k,y:L,w:A,h:p}}{var M=T,O=(a.freePointer.row+1)*l,$=N;_&&_.context.drawImage(w,M,0,$,E,0,O,$,E),x[1]={x:0,y:O,w:$,h:p}}a.freePointer.x=N,a.freePointer.row++},m=function(){a.freePointer.x=0,a.freePointer.row++};if(this.freePointer.x+d<=s)S();else{if(this.freePointer.row>=o-1)return!1;this.freePointer.x===s?(m(),S()):this.enableWrapping?v():(m(),S())}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,a=this.getScale(r),s=a.texW;return this.freePointer.x+s>n?this.freePointer.row<i-1:!0}},{key:"bufferIfNeeded",value:function(r){this.texture||(this.texture=zM(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}}])})(),YM=(function(){function t(e,r,n,i){Ta(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 Na(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,a=this.createTextureCanvas;return new qM(r,n,i,a)}},{key:"_getScratchCanvas",value:function(){if(!this.scratch){var r=this.r,n=this.texSize,i=this.texRows,a=this.createTextureCanvas,s=Math.floor(n/i);this.scratch=a(r,n,s,"scratch")}return this.scratch}},{key:"draw",value:function(r,n,i){var a=this.styleKeyToAtlas.get(r);return a||(a=this.atlases[this.atlases.length-1],(!a||!a.canFit(n))&&(a&&a.lock(),a=this._createAtlas(),this.atlases.push(a)),a.draw(r,n,i),this.styleKeyToAtlas.set(r,a)),a}},{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=[],a=new Map,s=null,o=yn(this.atlases),l;try{var u=function(){var d=l.value,p=d.getKeys(),f=KM(n,p);if(f.size===0)return i.push(d),p.forEach(function(T){return a.set(T,d)}),1;s||(s=r._createAtlas(),i.push(s));var x=yn(p),S;try{for(x.s();!(S=x.n()).done;){var v=S.value;if(!f.has(v)){var m=d.getOffsets(v),b=br(m,2),w=b[0],_=b[1];s.canFit({w:w.w+_.w,h:w.h})||(s.lock(),s=r._createAtlas(),i.push(s)),d.canvas&&(r._copyTextureToNewAtlas(v,d,s),a.set(v,s))}}}catch(T){x.e(T)}finally{x.f()}d.dispose()};for(o.s();!(l=o.n()).done;)u()}catch(c){o.e(c)}finally{o.f()}this.atlases=i,this.styleKeyToAtlas=a,this.markedKeys=new Set}},{key:"_copyTextureToNewAtlas",value:function(r,n,i){var a=n.getOffsets(r),s=br(a,2),o=s[0],l=s[1];if(l.w===0)i.draw(r,o,function(p){p.drawImage(n.canvas,o.x,o.y,o.w,o.h,0,0,o.w,o.h)});else{var u=this._getScratchCanvas();u.clear(),u.context.drawImage(n.canvas,o.x,o.y,o.w,o.h,0,0,o.w,o.h),u.context.drawImage(n.canvas,l.x,l.y,l.w,l.h,o.w,0,l.w,l.h);var c=o.w+l.w,d=o.h;i.draw(r,{w:c,h:d},function(p){p.drawImage(u,0,0,c,d,0,0,c,d)})}}},{key:"getCounts",value:function(){return{keyCount:this.styleKeyToAtlas.size,atlasCount:new Set(this.styleKeyToAtlas.values()).size}}}])})();function KM(t,e){return t.intersection?t.intersection(e):new Set(_d(t).filter(function(r){return e.has(r)}))}var XM=(function(){function t(e,r){Ta(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 Na(t,[{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"addAtlasCollection",value:function(r,n){var i=this.globalOptions,a=i.webglTexSize,s=i.createTextureCanvas,o=n.texRows,l=this._cacheScratchCanvas(s),u=new YM(this.r,a,o,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 a=this.collections.get(i),s=mt({type:r,atlasCollection:a},n);this.renderTypes.set(r,s)}},{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,a=null;return function(s,o,l,u){return u?((!a||o!=n||l!=i)&&(n=o,i=l,a=r(s,o,l)),a):r(s,o,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]:{},a=i.forceRedraw,s=a===void 0?!1:a,o=i.filterEle,l=o===void 0?function(){return!0}:o,u=i.filterType,c=u===void 0?function(){return!0}:u,d=!1,p=!1,f=yn(r),x;try{for(f.s();!(x=f.n()).done;){var S=x.value;if(l(S)){var v=yn(this.renderTypes.values()),m;try{var b=function(){var _=m.value,T=_.type;if(c(T)){var N=n.collections.get(_.collection),E=_.getKey(S),k=Array.isArray(E)?E:[E];if(s)k.forEach(function(O){return N.markKeyForGC(O)}),p=!0;else{var L=_.getID?_.getID(S):S.id(),A=n._key(T,L),M=n.typeAndIdToKey.get(A);M!==void 0&&!BM(k,M)&&(d=!0,n.typeAndIdToKey.delete(A),M.forEach(function(O){return N.markKeyForGC(O)}))}}};for(v.s();!(m=v.n()).done;)b()}catch(w){v.e(w)}finally{v.f()}}}}catch(w){f.e(w)}finally{f.f()}return p&&(this.gc(),d=!1),d}},{key:"gc",value:function(){var r=yn(this.collections.values()),n;try{for(r.s();!(n=r.n()).done;){var i=n.value;i.gc()}}catch(a){r.e(a)}finally{r.f()}}},{key:"getOrCreateAtlas",value:function(r,n,i,a){var s=this.renderTypes.get(n),o=this.collections.get(s.collection),l=!1,u=o.draw(a,i,function(p){s.drawClipped?(p.save(),p.beginPath(),p.rect(0,0,i.w,i.h),p.clip(),s.drawElement(p,r,i,!0,!0),p.restore()):s.drawElement(p,r,i,!0,!0),l=!0});if(l){var c=s.getID?s.getID(r):r.id(),d=this._key(n,c);this.typeAndIdToKey.has(d)?this.typeAndIdToKey.get(d).push(a):this.typeAndIdToKey.set(d,[a])}return u}},{key:"getAtlasInfo",value:function(r,n){var i=this,a=this.renderTypes.get(n),s=a.getKey(r),o=Array.isArray(s)?s:[s];return o.map(function(l){var u=a.getBoundingBox(r,l),c=i.getOrCreateAtlas(r,n,u,l),d=c.getOffsets(l),p=br(d,2),f=p[0],x=p[1];return{atlas:c,tex:f,tex1:f,tex2:x,bb:u}})}},{key:"getDebugInfo",value:function(){var r=[],n=yn(this.collections),i;try{for(n.s();!(i=n.n()).done;){var a=br(i.value,2),s=a[0],o=a[1],l=o.getCounts(),u=l.keyCount,c=l.atlasCount;r.push({type:s,keyCount:u,atlasCount:c})}}catch(d){n.e(d)}finally{n.f()}return r}}])})(),QM=(function(){function t(e){Ta(this,t),this.globalOptions=e,this.atlasSize=e.webglTexSize,this.maxAtlasesPerBatch=e.webglTexPerBatch,this.batchAtlases=[]}return Na(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}}])})(),ZM=`
|
|
67
|
+
float circleSD(vec2 p, float r) {
|
|
68
|
+
return distance(vec2(0), p) - r; // signed distance
|
|
69
|
+
}
|
|
70
|
+
`,JM=`
|
|
71
|
+
float rectangleSD(vec2 p, vec2 b) {
|
|
72
|
+
vec2 d = abs(p)-b;
|
|
73
|
+
return distance(vec2(0),max(d,0.0)) + min(max(d.x,d.y),0.0);
|
|
74
|
+
}
|
|
75
|
+
`,eO=`
|
|
76
|
+
float roundRectangleSD(vec2 p, vec2 b, vec4 cr) {
|
|
77
|
+
cr.xy = (p.x > 0.0) ? cr.xy : cr.zw;
|
|
78
|
+
cr.x = (p.y > 0.0) ? cr.x : cr.y;
|
|
79
|
+
vec2 q = abs(p) - b + cr.x;
|
|
80
|
+
return min(max(q.x, q.y), 0.0) + distance(vec2(0), max(q, 0.0)) - cr.x;
|
|
81
|
+
}
|
|
82
|
+
`,tO=`
|
|
83
|
+
float ellipseSD(vec2 p, vec2 ab) {
|
|
84
|
+
p = abs( p ); // symmetry
|
|
85
|
+
|
|
86
|
+
// find root with Newton solver
|
|
87
|
+
vec2 q = ab*(p-ab);
|
|
88
|
+
float w = (q.x<q.y)? 1.570796327 : 0.0;
|
|
89
|
+
for( int i=0; i<5; i++ ) {
|
|
90
|
+
vec2 cs = vec2(cos(w),sin(w));
|
|
91
|
+
vec2 u = ab*vec2( cs.x,cs.y);
|
|
92
|
+
vec2 v = ab*vec2(-cs.y,cs.x);
|
|
93
|
+
w = w + dot(p-u,v)/(dot(p-u,u)+dot(v,v));
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// compute final point and distance
|
|
97
|
+
float d = length(p-ab*vec2(cos(w),sin(w)));
|
|
98
|
+
|
|
99
|
+
// return signed distance
|
|
100
|
+
return (dot(p/ab,p/ab)>1.0) ? d : -d;
|
|
101
|
+
}
|
|
102
|
+
`,zl={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},Od={IGNORE:1,USE_BB:2},Yg=0,Yw=1,Kw=2,Kg=3,eo=4,Xc=5,kl=6,El=7,rO=(function(){function t(e,r,n){Ta(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=MM,this.atlasManager=new XM(e,n),this.batchManager=new QM(n),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(zl.SCREEN),this.pickingProgram=this._createShaderProgram(zl.PICKING),this.vao=this._createVAO()}return Na(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,a=this.atlasManager;return i?a.invalidate(r,{filterType:function(o){return o===i},forceRedraw:!0}):a.invalidate(r)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"_createShaderProgram",value:function(r){var n=this.gl,i=`#version 300 es
|
|
103
|
+
precision highp float;
|
|
104
|
+
|
|
105
|
+
uniform mat3 uPanZoomMatrix;
|
|
106
|
+
uniform int uAtlasSize;
|
|
107
|
+
|
|
108
|
+
// instanced
|
|
109
|
+
in vec2 aPosition; // a vertex from the unit square
|
|
110
|
+
|
|
111
|
+
in mat3 aTransform; // used to transform verticies, eg into a bounding box
|
|
112
|
+
in int aVertType; // the type of thing we are rendering
|
|
113
|
+
|
|
114
|
+
// the z-index that is output when using picking mode
|
|
115
|
+
in vec4 aIndex;
|
|
116
|
+
|
|
117
|
+
// For textures
|
|
118
|
+
in int aAtlasId; // which shader unit/atlas to use
|
|
119
|
+
in vec4 aTex; // x/y/w/h of texture in atlas
|
|
120
|
+
|
|
121
|
+
// for edges
|
|
122
|
+
in vec4 aPointAPointB;
|
|
123
|
+
in vec4 aPointCPointD;
|
|
124
|
+
in vec2 aLineWidth; // also used for node border width
|
|
125
|
+
|
|
126
|
+
// simple shapes
|
|
127
|
+
in vec4 aCornerRadius; // for round-rectangle [top-right, bottom-right, top-left, bottom-left]
|
|
128
|
+
in vec4 aColor; // also used for edges
|
|
129
|
+
in vec4 aBorderColor; // aLineWidth is used for border width
|
|
130
|
+
|
|
131
|
+
// output values passed to the fragment shader
|
|
132
|
+
out vec2 vTexCoord;
|
|
133
|
+
out vec4 vColor;
|
|
134
|
+
out vec2 vPosition;
|
|
135
|
+
// flat values are not interpolated
|
|
136
|
+
flat out int vAtlasId;
|
|
137
|
+
flat out int vVertType;
|
|
138
|
+
flat out vec2 vTopRight;
|
|
139
|
+
flat out vec2 vBotLeft;
|
|
140
|
+
flat out vec4 vCornerRadius;
|
|
141
|
+
flat out vec4 vBorderColor;
|
|
142
|
+
flat out vec2 vBorderWidth;
|
|
143
|
+
flat out vec4 vIndex;
|
|
144
|
+
|
|
145
|
+
void main(void) {
|
|
146
|
+
int vid = gl_VertexID;
|
|
147
|
+
vec2 position = aPosition; // TODO make this a vec3, simplifies some code below
|
|
148
|
+
|
|
149
|
+
if(aVertType == `.concat(Yg,`) {
|
|
150
|
+
float texX = aTex.x; // texture coordinates
|
|
151
|
+
float texY = aTex.y;
|
|
152
|
+
float texW = aTex.z;
|
|
153
|
+
float texH = aTex.w;
|
|
154
|
+
|
|
155
|
+
if(vid == 1 || vid == 2 || vid == 4) {
|
|
156
|
+
texX += texW;
|
|
157
|
+
}
|
|
158
|
+
if(vid == 2 || vid == 4 || vid == 5) {
|
|
159
|
+
texY += texH;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
float d = float(uAtlasSize);
|
|
163
|
+
vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1
|
|
164
|
+
|
|
165
|
+
gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
|
|
166
|
+
}
|
|
167
|
+
else if(aVertType == `).concat(eo," || aVertType == ").concat(El,`
|
|
168
|
+
|| aVertType == `).concat(Xc," || aVertType == ").concat(kl,`) { // simple shapes
|
|
169
|
+
|
|
170
|
+
// the bounding box is needed by the fragment shader
|
|
171
|
+
vBotLeft = (aTransform * vec3(0, 0, 1)).xy; // flat
|
|
172
|
+
vTopRight = (aTransform * vec3(1, 1, 1)).xy; // flat
|
|
173
|
+
vPosition = (aTransform * vec3(position, 1)).xy; // will be interpolated
|
|
174
|
+
|
|
175
|
+
// calculations are done in the fragment shader, just pass these along
|
|
176
|
+
vColor = aColor;
|
|
177
|
+
vCornerRadius = aCornerRadius;
|
|
178
|
+
vBorderColor = aBorderColor;
|
|
179
|
+
vBorderWidth = aLineWidth;
|
|
180
|
+
|
|
181
|
+
gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
|
|
182
|
+
}
|
|
183
|
+
else if(aVertType == `).concat(Yw,`) {
|
|
184
|
+
vec2 source = aPointAPointB.xy;
|
|
185
|
+
vec2 target = aPointAPointB.zw;
|
|
186
|
+
|
|
187
|
+
// adjust the geometry so that the line is centered on the edge
|
|
188
|
+
position.y = position.y - 0.5;
|
|
189
|
+
|
|
190
|
+
// stretch the unit square into a long skinny rectangle
|
|
191
|
+
vec2 xBasis = target - source;
|
|
192
|
+
vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));
|
|
193
|
+
vec2 point = source + xBasis * position.x + yBasis * aLineWidth[0] * position.y;
|
|
194
|
+
|
|
195
|
+
gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);
|
|
196
|
+
vColor = aColor;
|
|
197
|
+
}
|
|
198
|
+
else if(aVertType == `).concat(Kw,`) {
|
|
199
|
+
vec2 pointA = aPointAPointB.xy;
|
|
200
|
+
vec2 pointB = aPointAPointB.zw;
|
|
201
|
+
vec2 pointC = aPointCPointD.xy;
|
|
202
|
+
vec2 pointD = aPointCPointD.zw;
|
|
203
|
+
|
|
204
|
+
// adjust the geometry so that the line is centered on the edge
|
|
205
|
+
position.y = position.y - 0.5;
|
|
206
|
+
|
|
207
|
+
vec2 p0, p1, p2, pos;
|
|
208
|
+
if(position.x == 0.0) { // The left side of the unit square
|
|
209
|
+
p0 = pointA;
|
|
210
|
+
p1 = pointB;
|
|
211
|
+
p2 = pointC;
|
|
212
|
+
pos = position;
|
|
213
|
+
} else { // The right side of the unit square, use same approach but flip the geometry upside down
|
|
214
|
+
p0 = pointD;
|
|
215
|
+
p1 = pointC;
|
|
216
|
+
p2 = pointB;
|
|
217
|
+
pos = vec2(0.0, -position.y);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
vec2 p01 = p1 - p0;
|
|
221
|
+
vec2 p12 = p2 - p1;
|
|
222
|
+
vec2 p21 = p1 - p2;
|
|
223
|
+
|
|
224
|
+
// Find the normal vector.
|
|
225
|
+
vec2 tangent = normalize(normalize(p12) + normalize(p01));
|
|
226
|
+
vec2 normal = vec2(-tangent.y, tangent.x);
|
|
227
|
+
|
|
228
|
+
// Find the vector perpendicular to p0 -> p1.
|
|
229
|
+
vec2 p01Norm = normalize(vec2(-p01.y, p01.x));
|
|
230
|
+
|
|
231
|
+
// Determine the bend direction.
|
|
232
|
+
float sigma = sign(dot(p01 + p21, normal));
|
|
233
|
+
float width = aLineWidth[0];
|
|
234
|
+
|
|
235
|
+
if(sign(pos.y) == -sigma) {
|
|
236
|
+
// This is an intersecting vertex. Adjust the position so that there's no overlap.
|
|
237
|
+
vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);
|
|
238
|
+
gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
|
|
239
|
+
} else {
|
|
240
|
+
// This is a non-intersecting vertex. Treat it like a mitre join.
|
|
241
|
+
vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);
|
|
242
|
+
gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
vColor = aColor;
|
|
246
|
+
}
|
|
247
|
+
else if(aVertType == `).concat(Kg,` && vid < 3) {
|
|
248
|
+
// massage the first triangle into an edge arrow
|
|
249
|
+
if(vid == 0)
|
|
250
|
+
position = vec2(-0.15, -0.3);
|
|
251
|
+
if(vid == 1)
|
|
252
|
+
position = vec2( 0.0, 0.0);
|
|
253
|
+
if(vid == 2)
|
|
254
|
+
position = vec2( 0.15, -0.3);
|
|
255
|
+
|
|
256
|
+
gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
|
|
257
|
+
vColor = aColor;
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
vAtlasId = aAtlasId;
|
|
264
|
+
vVertType = aVertType;
|
|
265
|
+
vIndex = aIndex;
|
|
266
|
+
}
|
|
267
|
+
`),a=this.batchManager.getIndexArray(),s=`#version 300 es
|
|
268
|
+
precision highp float;
|
|
269
|
+
|
|
270
|
+
// declare texture unit for each texture atlas in the batch
|
|
271
|
+
`.concat(a.map(function(u){return"uniform sampler2D uTexture".concat(u,";")}).join(`
|
|
272
|
+
`),`
|
|
273
|
+
|
|
274
|
+
uniform vec4 uBGColor;
|
|
275
|
+
uniform float uZoom;
|
|
276
|
+
|
|
277
|
+
in vec2 vTexCoord;
|
|
278
|
+
in vec4 vColor;
|
|
279
|
+
in vec2 vPosition; // model coordinates
|
|
280
|
+
|
|
281
|
+
flat in int vAtlasId;
|
|
282
|
+
flat in vec4 vIndex;
|
|
283
|
+
flat in int vVertType;
|
|
284
|
+
flat in vec2 vTopRight;
|
|
285
|
+
flat in vec2 vBotLeft;
|
|
286
|
+
flat in vec4 vCornerRadius;
|
|
287
|
+
flat in vec4 vBorderColor;
|
|
288
|
+
flat in vec2 vBorderWidth;
|
|
289
|
+
|
|
290
|
+
out vec4 outColor;
|
|
291
|
+
|
|
292
|
+
`).concat(ZM,`
|
|
293
|
+
`).concat(JM,`
|
|
294
|
+
`).concat(eO,`
|
|
295
|
+
`).concat(tO,`
|
|
296
|
+
|
|
297
|
+
vec4 blend(vec4 top, vec4 bot) { // blend colors with premultiplied alpha
|
|
298
|
+
return vec4(
|
|
299
|
+
top.rgb + (bot.rgb * (1.0 - top.a)),
|
|
300
|
+
top.a + (bot.a * (1.0 - top.a))
|
|
301
|
+
);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
vec4 distInterp(vec4 cA, vec4 cB, float d) { // interpolate color using Signed Distance
|
|
305
|
+
// scale to the zoom level so that borders don't look blurry when zoomed in
|
|
306
|
+
// note 1.5 is an aribitrary value chosen because it looks good
|
|
307
|
+
return mix(cA, cB, 1.0 - smoothstep(0.0, 1.5 / uZoom, abs(d)));
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
void main(void) {
|
|
311
|
+
if(vVertType == `).concat(Yg,`) {
|
|
312
|
+
// look up the texel from the texture unit
|
|
313
|
+
`).concat(a.map(function(u){return"if(vAtlasId == ".concat(u,") outColor = texture(uTexture").concat(u,", vTexCoord);")}).join(`
|
|
314
|
+
else `),`
|
|
315
|
+
}
|
|
316
|
+
else if(vVertType == `).concat(Kg,`) {
|
|
317
|
+
// mimics how canvas renderer uses context.globalCompositeOperation = 'destination-out';
|
|
318
|
+
outColor = blend(vColor, uBGColor);
|
|
319
|
+
outColor.a = 1.0; // make opaque, masks out line under arrow
|
|
320
|
+
}
|
|
321
|
+
else if(vVertType == `).concat(eo,` && vBorderWidth == vec2(0.0)) { // simple rectangle with no border
|
|
322
|
+
outColor = vColor; // unit square is already transformed to the rectangle, nothing else needs to be done
|
|
323
|
+
}
|
|
324
|
+
else if(vVertType == `).concat(eo," || vVertType == ").concat(El,`
|
|
325
|
+
|| vVertType == `).concat(Xc," || vVertType == ").concat(kl,`) { // use SDF
|
|
326
|
+
|
|
327
|
+
float outerBorder = vBorderWidth[0];
|
|
328
|
+
float innerBorder = vBorderWidth[1];
|
|
329
|
+
float borderPadding = outerBorder * 2.0;
|
|
330
|
+
float w = vTopRight.x - vBotLeft.x - borderPadding;
|
|
331
|
+
float h = vTopRight.y - vBotLeft.y - borderPadding;
|
|
332
|
+
vec2 b = vec2(w/2.0, h/2.0); // half width, half height
|
|
333
|
+
vec2 p = vPosition - vec2(vTopRight.x - b[0] - outerBorder, vTopRight.y - b[1] - outerBorder); // translate to center
|
|
334
|
+
|
|
335
|
+
float d; // signed distance
|
|
336
|
+
if(vVertType == `).concat(eo,`) {
|
|
337
|
+
d = rectangleSD(p, b);
|
|
338
|
+
} else if(vVertType == `).concat(El,` && w == h) {
|
|
339
|
+
d = circleSD(p, b.x); // faster than ellipse
|
|
340
|
+
} else if(vVertType == `).concat(El,`) {
|
|
341
|
+
d = ellipseSD(p, b);
|
|
342
|
+
} else {
|
|
343
|
+
d = roundRectangleSD(p, b, vCornerRadius.wzyx);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
// use the distance to interpolate a color to smooth the edges of the shape, doesn't need multisampling
|
|
347
|
+
// we must smooth colors inwards, because we can't change pixels outside the shape's bounding box
|
|
348
|
+
if(d > 0.0) {
|
|
349
|
+
if(d > outerBorder) {
|
|
350
|
+
discard;
|
|
351
|
+
} else {
|
|
352
|
+
outColor = distInterp(vBorderColor, vec4(0), d - outerBorder);
|
|
353
|
+
}
|
|
354
|
+
} else {
|
|
355
|
+
if(d > innerBorder) {
|
|
356
|
+
vec4 outerColor = outerBorder == 0.0 ? vec4(0) : vBorderColor;
|
|
357
|
+
vec4 innerBorderColor = blend(vBorderColor, vColor);
|
|
358
|
+
outColor = distInterp(innerBorderColor, outerColor, d);
|
|
359
|
+
}
|
|
360
|
+
else {
|
|
361
|
+
vec4 outerColor;
|
|
362
|
+
if(innerBorder == 0.0 && outerBorder == 0.0) {
|
|
363
|
+
outerColor = vec4(0);
|
|
364
|
+
} else if(innerBorder == 0.0) {
|
|
365
|
+
outerColor = vBorderColor;
|
|
366
|
+
} else {
|
|
367
|
+
outerColor = blend(vBorderColor, vColor);
|
|
368
|
+
}
|
|
369
|
+
outColor = distInterp(vColor, outerColor, d - innerBorder);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
else {
|
|
374
|
+
outColor = vColor;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
`).concat(r.picking?`if(outColor.a == 0.0) discard;
|
|
378
|
+
else outColor = vIndex;`:"",`
|
|
379
|
+
}
|
|
380
|
+
`),o=PM(n,i,s);o.aPosition=n.getAttribLocation(o,"aPosition"),o.aIndex=n.getAttribLocation(o,"aIndex"),o.aVertType=n.getAttribLocation(o,"aVertType"),o.aTransform=n.getAttribLocation(o,"aTransform"),o.aAtlasId=n.getAttribLocation(o,"aAtlasId"),o.aTex=n.getAttribLocation(o,"aTex"),o.aPointAPointB=n.getAttribLocation(o,"aPointAPointB"),o.aPointCPointD=n.getAttribLocation(o,"aPointCPointD"),o.aLineWidth=n.getAttribLocation(o,"aLineWidth"),o.aColor=n.getAttribLocation(o,"aColor"),o.aCornerRadius=n.getAttribLocation(o,"aCornerRadius"),o.aBorderColor=n.getAttribLocation(o,"aBorderColor"),o.uPanZoomMatrix=n.getUniformLocation(o,"uPanZoomMatrix"),o.uAtlasSize=n.getUniformLocation(o,"uAtlasSize"),o.uBGColor=n.getUniformLocation(o,"uBGColor"),o.uZoom=n.getUniformLocation(o,"uZoom"),o.uTextures=[];for(var l=0;l<this.batchManager.getMaxAtlasesPerBatch();l++)o.uTextures.push(n.getUniformLocation(o,"uTexture".concat(l)));return o}},{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,a=this.program,s=i.createVertexArray();return i.bindVertexArray(s),HM(i,"vec2",a.aPosition,r),this.transformBuffer=UM(i,n,a.aTransform),this.indexBuffer=vi(i,n,"vec4",a.aIndex),this.vertTypeBuffer=vi(i,n,"int",a.aVertType),this.atlasIdBuffer=vi(i,n,"int",a.aAtlasId),this.texBuffer=vi(i,n,"vec4",a.aTex),this.pointAPointBBuffer=vi(i,n,"vec4",a.aPointAPointB),this.pointCPointDBuffer=vi(i,n,"vec4",a.aPointCPointD),this.lineWidthBuffer=vi(i,n,"vec2",a.aLineWidth),this.colorBuffer=vi(i,n,"vec4",a.aColor),this.cornerRadiusBuffer=vi(i,n,"vec4",a.aCornerRadius),this.borderColorBuffer=vi(i,n,"vec4",a.aBorderColor),i.bindVertexArray(null),s}},{key:"buffers",get:function(){var r=this;return this._buffers||(this._buffers=Object.keys(this).filter(function(n){return pa(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]:zl.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 a=this.atlasManager,s=this.batchManager,o=a.getRenderTypeOpts(i);if(this._isVisible(r,o)&&!(r.isEdge()&&!this._isValidEdge(r))){if(this.renderTarget.picking&&o.getTexPickingMode){var l=o.getTexPickingMode(r);if(l===Od.IGNORE)return;if(l==Od.USE_BB){this.drawPickingRectangle(r,n,i);return}}var u=a.getAtlasInfo(r,i),c=yn(u),d;try{for(c.s();!(d=c.n()).done;){var p=d.value,f=p.atlas,x=p.tex1,S=p.tex2;s.canAddToCurrentBatch(f)||this.endBatch();for(var v=s.getAtlasIndexForBatch(f),m=0,b=[[x,!0],[S,!1]];m<b.length;m++){var w=br(b[m],2),_=w[0],T=w[1];if(_.w!=0){var N=this.instanceCount;this.vertTypeBuffer.getView(N)[0]=Yg;var E=this.indexBuffer.getView(N);Js(n,E);var k=this.atlasIdBuffer.getView(N);k[0]=v;var L=this.texBuffer.getView(N);L[0]=_.x,L[1]=_.y,L[2]=_.w,L[3]=_.h;var A=this.transformBuffer.getMatrixView(N);this.setTransformMatrix(r,A,o,p,T),this.instanceCount++,T||this.wrappedCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}catch(M){c.e(M)}finally{c.f()}}}},{key:"setTransformMatrix",value:function(r,n,i,a){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=0;if(i.shapeProps&&i.shapeProps.padding&&(o=r.pstyle(i.shapeProps.padding).pfValue),a){var l=a.bb,u=a.tex1,c=a.tex2,d=u.w/(u.w+c.w);s||(d=1-d);var p=this._getAdjustedBB(l,o,s,d);this._applyTransformMatrix(n,p,i,r)}else{var f=i.getBoundingBox(r),x=this._getAdjustedBB(f,o,!0,1);this._applyTransformMatrix(n,x,i,r)}}},{key:"_applyTransformMatrix",value:function(r,n,i,a){var s,o;Gw(r);var l=i.getRotation?i.getRotation(a):0;if(l!==0){var u=i.getRotationPoint(a),c=u.x,d=u.y;pd(r,r,[c,d]),qw(r,r,l);var p=i.getRotationOffset(a);s=p.x+(n.xOffset||0),o=p.y+(n.yOffset||0)}else s=n.x1,o=n.y1;pd(r,r,[s,o]),Vv(r,r,[n.w,n.h])}},{key:"_getAdjustedBB",value:function(r,n,i,a){var s=r.x1,o=r.y1,l=r.w,u=r.h,c=r.yOffset;n&&(s-=n,o-=n,l+=2*n,u+=2*n);var d=0,p=l*a;return i&&a<1?l=p:!i&&a<1&&(d=l-p,s+=d,l=p),{x1:s,y1:o,w:l,h:u,xOffset:d,yOffset:c}}},{key:"drawPickingRectangle",value:function(r,n,i){var a=this.atlasManager.getRenderTypeOpts(i),s=this.instanceCount;this.vertTypeBuffer.getView(s)[0]=eo;var o=this.indexBuffer.getView(s);Js(n,o);var l=this.colorBuffer.getView(s);Qa([0,0,0],1,l);var u=this.transformBuffer.getMatrixView(s);this.setTransformMatrix(r,u,a),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:"drawNode",value:function(r,n,i){var a=this.simpleShapeOptions.get(i);if(this._isVisible(r,a)){var s=a.shapeProps,o=this._getVertTypeForShape(r,s.shape);if(o===void 0||a.isSimple&&!a.isSimple(r,this.renderTarget)){this.drawTexture(r,n,i);return}var l=this.instanceCount;if(this.vertTypeBuffer.getView(l)[0]=o,o===Xc||o===kl){var u=a.getBoundingBox(r),c=this._getCornerRadius(r,s.radius,u),d=this.cornerRadiusBuffer.getView(l);d[0]=c,d[1]=c,d[2]=c,d[3]=c,o===kl&&(d[0]=0,d[2]=0)}var p=this.indexBuffer.getView(l);Js(n,p);var f=this.renderTarget.picking?1:i==="node-body"?r.effectiveOpacity():1,x=this.renderTarget.picking?1:r.pstyle(s.opacity).value*f,S=r.pstyle(s.color).value,v=this.colorBuffer.getView(l);Qa(S,x,v);var m=this.lineWidthBuffer.getView(l);if(m[0]=0,m[1]=0,s.border){var b=r.pstyle("border-width").value;if(b>0){var w=r.pstyle("border-color").value,_=f*r.pstyle("border-opacity").value,T=this.borderColorBuffer.getView(l);Qa(w,_,T);var N=r.pstyle("border-position").value;if(N==="inside")m[0]=0,m[1]=-b;else if(N==="outside")m[0]=b,m[1]=0;else{var E=b/2;m[0]=E,m[1]=-E}}}var k=this.transformBuffer.getMatrixView(l);this.setTransformMatrix(r,k,a),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 eo;case"ellipse":return El;case"roundrectangle":case"round-rectangle":return Xc;case"bottom-round-rectangle":return kl;default:return}}},{key:"_getCornerRadius",value:function(r,n,i){var a=i.w,s=i.h;if(r.pstyle(n).value==="auto")return wa(a,s);var o=r.pstyle(n).pfValue,l=a/2,u=s/2;return Math.min(o,u,l)}},{key:"drawEdgeArrow",value:function(r,n,i){if(r.visible()){var a=r._private.rscratch,s,o,l;if(i==="source"?(s=a.arrowStartX,o=a.arrowStartY,l=a.srcArrowAngle):(s=a.arrowEndX,o=a.arrowEndY,l=a.tgtArrowAngle),!(isNaN(s)||s==null||isNaN(o)||o==null||isNaN(l)||l==null)){var u=r.pstyle(i+"-arrow-shape").value;if(u!=="none"){var c=r.pstyle(i+"-arrow-color").value,d=r.pstyle("opacity").value,p=r.pstyle("line-opacity").value,f=d*p,x=r.pstyle("width").pfValue,S=r.pstyle("arrow-scale").value,v=this.r.getArrowWidth(x,S),m=this.instanceCount,b=this.transformBuffer.getMatrixView(m);Gw(b),pd(b,b,[s,o]),Vv(b,b,[v,v]),qw(b,b,l),this.vertTypeBuffer.getView(m)[0]=Kg;var w=this.indexBuffer.getView(m);Js(n,w);var _=this.colorBuffer.getView(m);Qa(c,f,_),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 a=r.pstyle("opacity").value,s=r.pstyle("line-opacity").value,o=r.pstyle("width").pfValue,l=r.pstyle("line-color").value,u=a*s;if(i.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),i.length==4){var c=this.instanceCount;this.vertTypeBuffer.getView(c)[0]=Yw;var d=this.indexBuffer.getView(c);Js(n,d);var p=this.colorBuffer.getView(c);Qa(l,u,p);var f=this.lineWidthBuffer.getView(c);f[0]=o;var x=this.pointAPointBBuffer.getView(c);x[0]=i[0],x[1]=i[1],x[2]=i[2],x[3]=i[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var S=0;S<i.length-2;S+=2){var v=this.instanceCount;this.vertTypeBuffer.getView(v)[0]=Kw;var m=this.indexBuffer.getView(v);Js(n,m);var b=this.colorBuffer.getView(v);Qa(l,u,b);var w=this.lineWidthBuffer.getView(v);w[0]=o;var _=i[S-2],T=i[S-1],N=i[S],E=i[S+1],k=i[S+2],L=i[S+3],A=i[S+4],M=i[S+5];S==0&&(_=2*N-k+.001,T=2*E-L+.001),S==i.length-4&&(A=2*k-N+.001,M=2*L-E+.001);var O=this.pointAPointBBuffer.getView(v);O[0]=_,O[1]=T,O[2]=N,O[3]=E;var $=this.pointCPointDBuffer.getView(v);$[0]=k,$[1]=L,$[2]=A,$[3]=M,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 a=this._getNumSegments(r);return this._getCurveSegmentPoints(i,a)}}},{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),a=0;a<=n;a++)if(a==0)i[0]=r[0],i[1]=r[1];else if(a==n)i[a*2]=r[r.length-2],i[a*2+1]=r[r.length-1];else{var s=a/n;this._setCurvePoint(r,s,i,a*2)}return i}},{key:"_setCurvePoint",value:function(r,n,i,a){if(r.length<=2)i[a]=r[0],i[a+1]=r[1];else{for(var s=Array(r.length-2),o=0;o<s.length;o+=2){var l=(1-n)*r[o]+n*r[o+2],u=(1-n)*r[o+1]+n*r[o+3];s[o]=l,s[o+1]=u}return this._setCurvePoint(s,n,i,a)}}},{key:"endBatch",value:function(){var r=this.gl,n=this.vao,i=this.vertexCount,a=this.instanceCount;if(a!==0){var s=this.renderTarget.picking?this.pickingProgram:this.program;r.useProgram(s),r.bindVertexArray(n);var o=yn(this.buffers),l;try{for(o.s();!(l=o.n()).done;){var u=l.value;u.bufferSubData(a)}}catch(x){o.e(x)}finally{o.f()}for(var c=this.batchManager.getAtlases(),d=0;d<c.length;d++)c[d].bufferIfNeeded(r);for(var p=0;p<c.length;p++)r.activeTexture(r.TEXTURE0+p),r.bindTexture(r.TEXTURE_2D,c[p].texture),r.uniform1i(s.uTextures[p],p);r.uniform1f(s.uZoom,OM(this.r)),r.uniformMatrix3fv(s.uPanZoomMatrix,!1,this.panZoomMatrix),r.uniform1i(s.uAtlasSize,this.batchManager.getAtlasSize());var f=Qa(this.bgColor,1);r.uniform4fv(s.uBGColor,f),r.drawArraysInstanced(r.TRIANGLES,0,i,a),r.bindVertexArray(null),r.bindTexture(r.TEXTURE_2D,null),this.debug&&this.batchDebugInfo.push({count:a,atlasCount:c.length}),this.startBatch()}}},{key:"getDebugInfo",value:function(){var r=this.atlasManager.getDebugInfo(),n=r.reduce(function(s,o){return s+o.atlasCount},0),i=this.batchDebugInfo,a=i.reduce(function(s,o){return s+o.count},0);return{atlasInfo:r,totalAtlases:n,wrappedCount:this.wrappedCount,simpleCount:this.simpleCount,batchCount:i.length,batchInfo:i,totalInstances:a}}}])})(),kC={};kC.initWebgl=function(t,e){var r=this,n=r.data.contexts[r.WEBGL];t.bgColor=nO(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=WM(n),r.pickingFrameBuffer.needsDraw=!0,r.drawing=new rO(r,n,t);var i=function(d){return function(p){return r.getTextAngle(p,d)}},a=function(d){return function(p){var f=p.pstyle(d);return f&&f.value}},s=function(d){return function(p){return p.pstyle("".concat(d,"-opacity")).value>0}},o=function(d){var p=d.pstyle("text-events").strValue==="yes";return p?Od.USE_BB:Od.IGNORE},l=function(d){var p=d.position(),f=p.x,x=p.y,S=d.outerWidth(),v=d.outerHeight();return{w:S,h:v,x1:f-S/2,y1:x-v/2}};r.drawing.addAtlasCollection("node",{texRows:t.webglTexRowsNodes}),r.drawing.addAtlasCollection("label",{texRows:t.webglTexRows}),r.drawing.addTextureAtlasRenderType("node-body",{collection:"node",getKey:e.getStyleKey,getBoundingBox:e.getElementBox,drawElement:e.drawElement}),r.drawing.addSimpleShapeRenderType("node-body",{getBoundingBox:l,isSimple:IM,shapeProps:{shape:"shape",color:"background-color",opacity:"background-opacity",radius:"corner-radius",border:!0}}),r.drawing.addSimpleShapeRenderType("node-overlay",{getBoundingBox:l,isVisible:s("overlay"),shapeProps:{shape:"overlay-shape",color:"overlay-color",opacity:"overlay-opacity",padding:"overlay-padding",radius:"overlay-corner-radius"}}),r.drawing.addSimpleShapeRenderType("node-underlay",{getBoundingBox:l,isVisible:s("underlay"),shapeProps:{shape:"underlay-shape",color:"underlay-color",opacity:"underlay-opacity",padding:"underlay-padding",radius:"underlay-corner-radius"}}),r.drawing.addTextureAtlasRenderType("label",{collection:"label",getTexPickingMode:o,getKey:Xg(e.getLabelKey,null),getBoundingBox:Qg(e.getLabelBox,null),drawClipped:!0,drawElement:e.drawLabel,getRotation:i(null),getRotationPoint:e.getLabelRotationPoint,getRotationOffset:e.getLabelRotationOffset,isVisible:a("label")}),r.drawing.addTextureAtlasRenderType("edge-source-label",{collection:"label",getTexPickingMode:o,getKey:Xg(e.getSourceLabelKey,"source"),getBoundingBox:Qg(e.getSourceLabelBox,"source"),drawClipped:!0,drawElement:e.drawSourceLabel,getRotation:i("source"),getRotationPoint:e.getSourceLabelRotationPoint,getRotationOffset:e.getSourceLabelRotationOffset,isVisible:a("source-label")}),r.drawing.addTextureAtlasRenderType("edge-target-label",{collection:"label",getTexPickingMode:o,getKey:Xg(e.getTargetLabelKey,"target"),getBoundingBox:Qg(e.getTargetLabelBox,"target"),drawClipped:!0,drawElement:e.drawTargetLabel,getRotation:i("target"),getRotationPoint:e.getTargetLabelRotationPoint,getRotationOffset:e.getTargetLabelRotationOffset,isVisible:a("target-label")});var u=du(function(){console.log("garbage collect flag set"),r.data.gc=!0},1e4);r.onUpdateEleCalcs(function(c,d){var p=!1;d&&d.length>0&&(p|=r.drawing.invalidate(d)),p&&u()}),iO(r)};function nO(t){var e=t.cy.container(),r=e&&e.style&&e.style.backgroundColor||"white";return QS(r)}function EC(t,e){var r=t._private.rscratch;return rn(r,"labelWrapCachedLines",e)||[]}var Xg=function(e,r){return function(n){var i=e(n),a=EC(n,r);return a.length>1?a.map(function(s,o){return"".concat(i,"_").concat(o)}):i}},Qg=function(e,r){return function(n,i){var a=e(n);if(typeof i=="string"){var s=i.indexOf("_");if(s>0){var o=Number(i.substring(s+1)),l=EC(n,r),u=a.h/l.length,c=u*o,d=a.y1+c;return{x1:a.x1,w:a.w,y1:d,h:u,yOffset:c}}}return a}};function iO(t){{var e=t.render;t.render=function(a){a=a||{};var s=t.cy;t.webgl&&(s.zoom()>yC?(aO(t),e.call(t,a)):(sO(t),NC(t,a,zl.SCREEN)))}}{var r=t.matchCanvasSize;t.matchCanvasSize=function(a){r.call(t,a),t.pickingFrameBuffer.setFramebufferAttachmentSizes(t.canvasWidth,t.canvasHeight),t.pickingFrameBuffer.needsDraw=!0}}t.findNearestElements=function(a,s,o,l){return hO(t,a,s)};{var n=t.invalidateCachedZSortedEles;t.invalidateCachedZSortedEles=function(){n.call(t),t.pickingFrameBuffer.needsDraw=!0}}{var i=t.notify;t.notify=function(a,s){i.call(t,a,s),a==="viewport"||a==="bounds"?t.pickingFrameBuffer.needsDraw=!0:a==="background"&&t.drawing.invalidate(s,{type:"node-body"})}}}function aO(t){var e=t.data.contexts[t.WEBGL];e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)}function sO(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 oO(t){var e=t.canvasWidth,r=t.canvasHeight,n=Wm(t),i=n.pan,a=n.zoom,s=qg();pd(s,s,[i.x,i.y]),Vv(s,s,[a,a]);var o=qg();GM(o,e,r);var l=qg();return VM(l,o,s),l}function TC(t,e){var r=t.canvasWidth,n=t.canvasHeight,i=Wm(t),a=i.pan,s=i.zoom;e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,r,n),e.translate(a.x,a.y),e.scale(s,s)}function lO(t,e){t.drawSelectionRectangle(e,function(r){return TC(t,r)})}function uO(t){var e=t.data.contexts[t.NODE];e.save(),TC(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 cO(t){var e=function(i,a,s){for(var o=i.atlasManager.getAtlasCollection(a),l=t.data.contexts[t.NODE],u=o.atlases,c=0;c<u.length;c++){var d=u[c],p=d.canvas;if(p){var f=p.width,x=p.height,S=f*c,v=p.height*s,m=.4;l.save(),l.scale(m,m),l.drawImage(p,S,v),l.strokeStyle="black",l.rect(S,v,f,x),l.stroke(),l.restore()}}},r=0;e(t.drawing,"node",r++),e(t.drawing,"label",r++)}function dO(t,e,r,n,i){var a,s,o,l,u=Wm(t),c=u.pan,d=u.zoom;{var p=jM(t,c,d,e,r),f=br(p,2),x=f[0],S=f[1],v=6;a=x-v/2,s=S-v/2,o=v,l=v}if(o===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),NC(t,null,zl.PICKING),t.pickingFrameBuffer.needsDraw=!1);var b=o*l,w=new Uint8Array(b*4);m.readPixels(a,s,o,l,m.RGBA,m.UNSIGNED_BYTE,w),m.bindFramebuffer(m.FRAMEBUFFER,null);for(var _=new Set,T=0;T<b;T++){var N=w.slice(T*4,T*4+4),E=FM(N)-1;E>=0&&_.add(E)}return _}function hO(t,e,r){var n=dO(t,e,r),i=t.getCachedZSortedEles(),a,s,o=yn(n),l;try{for(o.s();!(l=o.n()).done;){var u=l.value,c=i[u];if(!a&&c.isNode()&&(a=c),!s&&c.isEdge()&&(s=c),a&&s)break}}catch(d){o.e(d)}finally{o.f()}return[a,s].filter(Boolean)}function Zg(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 NC(t,e,r){var n;t.webglDebug&&(n=performance.now());var i=t.drawing,a=0;if(r.screen&&t.data.canvasNeedsRedraw[t.SELECT_BOX]&&lO(t,e),t.data.canvasNeedsRedraw[t.NODE]||r.picking){var s=t.data.contexts[t.WEBGL];r.screen?(s.clearColor(0,0,0,0),s.enable(s.BLEND),s.blendFunc(s.ONE,s.ONE_MINUS_SRC_ALPHA)):s.disable(s.BLEND),s.clear(s.COLOR_BUFFER_BIT|s.DEPTH_BUFFER_BIT),s.viewport(0,0,s.canvas.width,s.canvas.height);var o=oO(t),l=t.getCachedZSortedEles();if(a=l.length,i.startFrame(o,r),r.screen){for(var u=0;u<l.nondrag.length;u++)Zg(t,u,l.nondrag[u]);for(var c=0;c<l.drag.length;c++)Zg(t,c,l.drag[c])}else if(r.picking)for(var d=0;d<l.length;d++)Zg(t,d,l[d]);i.endFrame(),r.screen&&t.webglDebugShowAtlases&&(uO(t),cO(t)),t.data.canvasNeedsRedraw[t.NODE]=!1,t.data.canvasNeedsRedraw[t.DRAG]=!1}if(t.webglDebug){var p=performance.now(),f=!1,x=Math.ceil(p-n),S=i.getDebugInfo(),v=["".concat(a," elements"),"".concat(S.totalInstances," instances"),"".concat(S.batchCount," batches"),"".concat(S.totalAtlases," atlases"),"".concat(S.wrappedCount," wrapped textures"),"".concat(S.simpleCount," simple shapes")].join(", ");if(f)console.log("WebGL (".concat(r.name,") - time ").concat(x,"ms, ").concat(v));else{console.log("WebGL (".concat(r.name,") - frame time ").concat(x,"ms")),console.log("Totals:"),console.log(" ".concat(v)),console.log("Texture Atlases Used:");var m=S.atlasInfo,b=yn(m),w;try{for(b.s();!(w=b.n()).done;){var _=w.value;console.log(" ".concat(_.type,": ").concat(_.keyCount," keys, ").concat(_.atlasCount," atlases"))}}catch(T){b.e(T)}finally{b.f()}console.log("")}}t.data.gc&&(console.log("Garbage Collect!"),t.data.gc=!1,i.gc())}var Da={};Da.drawPolygonPath=function(t,e,r,n,i,a){var s=n/2,o=i/2;t.beginPath&&t.beginPath(),t.moveTo(e+s*a[0],r+o*a[1]);for(var l=1;l<a.length/2;l++)t.lineTo(e+s*a[l*2],r+o*a[l*2+1]);t.closePath()};Da.drawRoundPolygonPath=function(t,e,r,n,i,a,s){s.forEach(function(o){return lC(t,o)}),t.closePath()};Da.drawRoundRectanglePath=function(t,e,r,n,i,a){var s=n/2,o=i/2,l=a==="auto"?wa(n,i):Math.min(a,o,s);t.beginPath&&t.beginPath(),t.moveTo(e,r-o),t.arcTo(e+s,r-o,e+s,r,l),t.arcTo(e+s,r+o,e,r+o,l),t.arcTo(e-s,r+o,e-s,r,l),t.arcTo(e-s,r-o,e,r-o,l),t.lineTo(e,r-o),t.closePath()};Da.drawBottomRoundRectanglePath=function(t,e,r,n,i,a){var s=n/2,o=i/2,l=a==="auto"?wa(n,i):a;t.beginPath&&t.beginPath(),t.moveTo(e,r-o),t.lineTo(e+s,r-o),t.lineTo(e+s,r),t.arcTo(e+s,r+o,e,r+o,l),t.arcTo(e-s,r+o,e-s,r,l),t.lineTo(e-s,r-o),t.lineTo(e,r-o),t.closePath()};Da.drawCutRectanglePath=function(t,e,r,n,i,a,s){var o=n/2,l=i/2,u=s==="auto"?Lm():s;t.beginPath&&t.beginPath(),t.moveTo(e-o+u,r-l),t.lineTo(e+o-u,r-l),t.lineTo(e+o,r-l+u),t.lineTo(e+o,r+l-u),t.lineTo(e+o-u,r+l),t.lineTo(e-o+u,r+l),t.lineTo(e-o,r+l-u),t.lineTo(e-o,r-l+u),t.closePath()};Da.drawBarrelPath=function(t,e,r,n,i){var a=n/2,s=i/2,o=e-a,l=e+a,u=r-s,c=r+s,d=Dv(n,i),p=d.widthOffset,f=d.heightOffset,x=d.ctrlPtOffsetPct*p;t.beginPath&&t.beginPath(),t.moveTo(o,u+f),t.lineTo(o,c-f),t.quadraticCurveTo(o+x,c,o+p,c),t.lineTo(l-p,c),t.quadraticCurveTo(l-x,c,l,c-f),t.lineTo(l,u+f),t.quadraticCurveTo(l-x,u,l-p,u),t.lineTo(o+p,u),t.quadraticCurveTo(o+x,u,o,u+f),t.closePath()};var Xw=Math.sin(0),Qw=Math.cos(0),Gv={},qv={},RC=Math.PI/40;for(var to=0*Math.PI;to<2*Math.PI;to+=RC)Gv[to]=Math.sin(to),qv[to]=Math.cos(to);Da.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 a,s,o=n/2,l=i/2,u=0*Math.PI;u<2*Math.PI;u+=RC)a=e-o*Gv[u]*Xw+o*qv[u]*Qw,s=r+l*qv[u]*Xw+l*Gv[u]*Qw,u===0?t.moveTo(a,s):t.lineTo(a,s);t.closePath()};var mu={};mu.createBuffer=function(t,e){var r=document.createElement("canvas");return r.width=t,r.height=e,[r,r.getContext("2d")]};mu.bufferCanvasImage=function(t){var e=this.cy,r=e.mutableElements(),n=r.boundingBox(),i=this.findContainerClientCoords(),a=t.full?Math.ceil(n.w):i[2],s=t.full?Math.ceil(n.h):i[3],o=Ke(t.maxWidth)||Ke(t.maxHeight),l=this.getPixelRatio(),u=1;if(t.scale!==void 0)a*=t.scale,s*=t.scale,u=t.scale;else if(o){var c=1/0,d=1/0;Ke(t.maxWidth)&&(c=u*t.maxWidth/a),Ke(t.maxHeight)&&(d=u*t.maxHeight/s),u=Math.min(c,d),a*=u,s*=u}o||(a*=l,s*=l,u*=l);var p=document.createElement("canvas");p.width=a,p.height=s,p.style.width=a+"px",p.style.height=s+"px";var f=p.getContext("2d");if(a>0&&s>0){f.clearRect(0,0,a,s),f.globalCompositeOperation="source-over";var x=this.getCachedZSortedEles();if(t.full)f.translate(-n.x1*u,-n.y1*u),f.scale(u,u),this.drawElements(f,x),f.scale(1/u,1/u),f.translate(n.x1*u,n.y1*u);else{var S=e.pan(),v={x:S.x*u,y:S.y*u};u*=e.zoom(),f.translate(v.x,v.y),f.scale(u,u),this.drawElements(f,x),f.scale(1/u,1/u),f.translate(-v.x,-v.y)}t.bg&&(f.globalCompositeOperation="destination-over",f.fillStyle=t.bg,f.rect(0,0,a,s),f.fill())}return p};function fO(t,e){for(var r=atob(t),n=new ArrayBuffer(r.length),i=new Uint8Array(n),a=0;a<r.length;a++)i[a]=r.charCodeAt(a);return new Blob([n],{type:e})}function Zw(t){var e=t.indexOf(",");return t.substr(e+1)}function LC(t,e,r){var n=function(){return e.toDataURL(r,t.quality)};switch(t.output){case"blob-promise":return new To(function(i,a){try{e.toBlob(function(s){s!=null?i(s):a(new Error("`canvas.toBlob()` sent a null value in its callback"))},r,t.quality)}catch(s){a(s)}});case"blob":return fO(Zw(n()),r);case"base64":return Zw(n());case"base64uri":default:return n()}}mu.png=function(t){return LC(t,this.bufferCanvasImage(t),"image/png")};mu.jpg=function(t){return LC(t,this.bufferCanvasImage(t),"image/jpeg")};var DC={};DC.nodeShapeImpl=function(t,e,r,n,i,a,s,o){switch(t){case"ellipse":return this.drawEllipsePath(e,r,n,i,a);case"polygon":return this.drawPolygonPath(e,r,n,i,a,s);case"round-polygon":return this.drawRoundPolygonPath(e,r,n,i,a,s,o);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(e,r,n,i,a,o);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(e,r,n,i,a,s,o);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(e,r,n,i,a,o);case"barrel":return this.drawBarrelPath(e,r,n,i,a)}};var pO=AC,St=AC.prototype;St.CANVAS_LAYERS=3;St.SELECT_BOX=0;St.DRAG=1;St.NODE=2;St.WEBGL=3;St.CANVAS_TYPES=["2d","2d","2d","webgl2"];St.BUFFER_COUNT=3;St.TEXTURE_BUFFER=0;St.MOTIONBLUR_BUFFER_NODE=1;St.MOTIONBLUR_BUFFER_DRAG=2;function AC(t){var e=this,r=e.cy.window(),n=r.document;t.webgl&&(St.CANVAS_LAYERS=e.CANVAS_LAYERS=4,console.log("webgl rendering enabled")),e.data={canvases:new Array(St.CANVAS_LAYERS),contexts:new Array(St.CANVAS_LAYERS),canvasNeedsRedraw:new Array(St.CANVAS_LAYERS),bufferCanvases:new Array(St.BUFFER_COUNT),bufferContexts:new Array(St.CANVAS_LAYERS)};var i="-webkit-tap-highlight-color",a="rgba(0,0,0,0)";e.data.canvasContainer=n.createElement("div");var s=e.data.canvasContainer.style;e.data.canvasContainer.style[i]=a,s.position="relative",s.zIndex="0",s.overflow="hidden";var o=t.cy.container();o.appendChild(e.data.canvasContainer),o.style[i]=a;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"};iD()&&(l["-ms-touch-action"]="none",l["touch-action"]="none");for(var u=0;u<St.CANVAS_LAYERS;u++){var c=e.data.canvases[u]=n.createElement("canvas"),d=St.CANVAS_TYPES[u];e.data.contexts[u]=c.getContext(d),e.data.contexts[u]||sr("Could not create canvas of type "+d),Object.keys(l).forEach(function(Y){c.style[Y]=l[Y]}),c.style.position="absolute",c.setAttribute("data-id","layer"+u),c.style.zIndex=String(St.CANVAS_LAYERS-u),e.data.canvasContainer.appendChild(c),e.data.canvasNeedsRedraw[u]=!1}e.data.topCanvas=e.data.canvases[0],e.data.canvases[St.NODE].setAttribute("data-id","layer"+St.NODE+"-node"),e.data.canvases[St.SELECT_BOX].setAttribute("data-id","layer"+St.SELECT_BOX+"-selectbox"),e.data.canvases[St.DRAG].setAttribute("data-id","layer"+St.DRAG+"-drag"),e.data.canvases[St.WEBGL]&&e.data.canvases[St.WEBGL].setAttribute("data-id","layer"+St.WEBGL+"-webgl");for(var u=0;u<St.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 p=sn(),f=function(Q){return{x:(Q.x1+Q.x2)/2,y:(Q.y1+Q.y2)/2}},x=function(Q){return{x:-Q.w/2,y:-Q.h/2}},S=function(Q){var te=Q[0]._private,ie=te.oldBackgroundTimestamp===te.backgroundTimestamp;return!ie},v=function(Q){return Q[0]._private.nodeKey},m=function(Q){return Q[0]._private.labelStyleKey},b=function(Q){return Q[0]._private.sourceLabelStyleKey},w=function(Q){return Q[0]._private.targetLabelStyleKey},_=function(Q,te,ie,le,pe){return e.drawElement(Q,te,ie,!1,!1,pe)},T=function(Q,te,ie,le,pe){return e.drawElementText(Q,te,ie,le,"main",pe)},N=function(Q,te,ie,le,pe){return e.drawElementText(Q,te,ie,le,"source",pe)},E=function(Q,te,ie,le,pe){return e.drawElementText(Q,te,ie,le,"target",pe)},k=function(Q){return Q.boundingBox(),Q[0]._private.bodyBounds},L=function(Q){return Q.boundingBox(),Q[0]._private.labelBounds.main||p},A=function(Q){return Q.boundingBox(),Q[0]._private.labelBounds.source||p},M=function(Q){return Q.boundingBox(),Q[0]._private.labelBounds.target||p},O=function(Q,te){return te},$=function(Q){return f(k(Q))},D=function(Q,te,ie){var le=Q?Q+"-":"";return{x:te.x+ie.pstyle(le+"text-margin-x").pfValue,y:te.y+ie.pstyle(le+"text-margin-y").pfValue}},B=function(Q,te,ie){var le=Q[0]._private.rscratch;return{x:le[te],y:le[ie]}},j=function(Q){return D("",B(Q,"labelX","labelY"),Q)},I=function(Q){return D("source",B(Q,"sourceLabelX","sourceLabelY"),Q)},U=function(Q){return D("target",B(Q,"targetLabelX","targetLabelY"),Q)},F=function(Q){return x(k(Q))},P=function(Q){return x(A(Q))},H=function(Q){return x(M(Q))},W=function(Q){var te=L(Q),ie=x(L(Q));if(Q.isNode()){switch(_o(Q.pstyle("text-halign").value)){case"left":ie.x=-te.w-(te.leftPad||0);break;case"right":ie.x=-(te.rightPad||0);break}switch(Co(Q.pstyle("text-valign").value)){case"top":ie.y=-te.h-(te.topPad||0);break;case"bottom":ie.y=-(te.botPad||0);break}}return ie},V=e.data.eleTxrCache=new jl(e,{getKey:v,doesEleInvalidateKey:S,drawElement:_,getBoundingBox:k,getRotationPoint:$,getRotationOffset:F,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),re=e.data.lblTxrCache=new jl(e,{getKey:m,drawElement:T,getBoundingBox:L,getRotationPoint:j,getRotationOffset:W,isVisible:O}),J=e.data.slbTxrCache=new jl(e,{getKey:b,drawElement:N,getBoundingBox:A,getRotationPoint:I,getRotationOffset:P,isVisible:O}),ne=e.data.tlbTxrCache=new jl(e,{getKey:w,drawElement:E,getBoundingBox:M,getRotationPoint:U,getRotationOffset:H,isVisible:O}),X=e.data.lyrTxrCache=new xC(e);e.onUpdateEleCalcs(function(Q,te){V.invalidateElements(te),re.invalidateElements(te),J.invalidateElements(te),ne.invalidateElements(te),X.invalidateElements(te);for(var ie=0;ie<te.length;ie++){var le=te[ie]._private;le.oldBackgroundTimestamp=le.backgroundTimestamp}});var q=function(Q){for(var te=0;te<Q.length;te++)X.enqueueElementRefinement(Q[te].ele)};V.onDequeue(q),re.onDequeue(q),J.onDequeue(q),ne.onDequeue(q),t.webgl&&e.initWebgl(t,{getStyleKey:v,getLabelKey:m,getSourceLabelKey:b,getTargetLabelKey:w,drawElement:_,drawLabel:T,drawSourceLabel:N,drawTargetLabel:E,getElementBox:k,getLabelBox:L,getSourceLabelBox:A,getTargetLabelBox:M,getElementRotationPoint:$,getElementRotationOffset:F,getLabelRotationPoint:j,getSourceLabelRotationPoint:I,getTargetLabelRotationPoint:U,getLabelRotationOffset:W,getSourceLabelRotationOffset:P,getTargetLabelRotationOffset:H})}St.redrawHint=function(t,e){var r=this;switch(t){case"eles":r.data.canvasNeedsRedraw[St.NODE]=e;break;case"drag":r.data.canvasNeedsRedraw[St.DRAG]=e;break;case"select":r.data.canvasNeedsRedraw[St.SELECT_BOX]=e;break;case"gc":r.data.gc=!0;break}};var gO=typeof Path2D<"u";St.path2dEnabled=function(t){if(t===void 0)return this.pathsEnabled;this.pathsEnabled=!!t};St.usePaths=function(){return gO&&this.pathsEnabled};St.setImgSmoothing=function(t,e){t.imageSmoothingEnabled!=null?t.imageSmoothingEnabled=e:(t.webkitImageSmoothingEnabled=e,t.mozImageSmoothingEnabled=e,t.msImageSmoothingEnabled=e)};St.getImgSmoothing=function(t){return t.imageSmoothingEnabled!=null?t.imageSmoothingEnabled:t.webkitImageSmoothingEnabled||t.mozImageSmoothingEnabled||t.msImageSmoothingEnabled};St.makeOffscreenCanvas=function(t,e){var r;if((typeof OffscreenCanvas>"u"?"undefined":kr(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};[bC,_i,$i,Um,bs,La,on,kC,Da,mu,DC].forEach(function(t){mt(St,t)});var vO=[{name:"null",impl:aC},{name:"base",impl:vC},{name:"canvas",impl:pO}],mO=[{type:"layout",extensions:zP},{type:"renderer",extensions:vO}],PC={},MC={};function OC(t,e,r){var n=r,i=function(k){Ht("Can not register `"+e+"` for `"+t+"` since `"+k+"` already exists in the prototype and can not be overridden")};if(t==="core"){if(tu.prototype[e])return i(e);tu.prototype[e]=r}else if(t==="collection"){if(Fr.prototype[e])return i(e);Fr.prototype[e]=r}else if(t==="layout"){for(var a=function(k){this.options=k,r.call(this,k),Ot(this._private)||(this._private={}),this._private.cy=k.cy,this._private.listeners=[],this.createEmitter()},s=a.prototype=Object.create(r.prototype),o=[],l=0;l<o.length;l++){var u=o[l];s[u]=s[u]||function(){return this}}s.start&&!s.run?s.run=function(){return this.start(),this}:!s.start&&s.run&&(s.start=function(){return this.run(),this});var c=r.prototype.stop;s.stop=function(){var E=this.options;if(E&&E.animate){var k=this.animations;if(k)for(var L=0;L<k.length;L++)k[L].stop()}return c?c.call(this):this.emit("layoutstop"),this},s.destroy||(s.destroy=function(){return this}),s.cy=function(){return this._private.cy};var d=function(k){return k._private.cy},p={addEventFields:function(k,L){L.layout=k,L.cy=d(k),L.target=k},bubble:function(){return!0},parent:function(k){return d(k)}};mt(s,{createEmitter:function(){return this._private.emitter=new rh(p,this),this},emitter:function(){return this._private.emitter},on:function(k,L){return this.emitter().on(k,L),this},one:function(k,L){return this.emitter().one(k,L),this},once:function(k,L){return this.emitter().one(k,L),this},removeListener:function(k,L){return this.emitter().removeListener(k,L),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(k,L){return this.emitter().emit(k,L),this}}),$t.eventAliasesOn(s),n=a}else if(t==="renderer"&&e!=="null"&&e!=="base"){var f=jC("renderer","base"),x=f.prototype,S=r,v=r.prototype,m=function(){f.apply(this,arguments),S.apply(this,arguments)},b=m.prototype;for(var w in x){var _=x[w],T=v[w]!=null;if(T)return i(w);b[w]=_}for(var N in v)b[N]=v[N];x.clientFunctions.forEach(function(E){b[E]=b[E]||function(){sr("Renderer does not implement `renderer."+E+"()` on its prototype")}}),n=m}else if(t==="__proto__"||t==="constructor"||t==="prototype")return sr(t+" is an illegal type to be registered, possibly lead to prototype pollutions");return ZS({map:PC,keys:[t,e],value:n})}function jC(t,e){return JS({map:PC,keys:[t,e]})}function yO(t,e,r,n,i){return ZS({map:MC,keys:[t,e,r,n],value:i})}function xO(t,e,r,n){return JS({map:MC,keys:[t,e,r,n]})}var Yv=function(){if(arguments.length===2)return jC.apply(null,arguments);if(arguments.length===3)return OC.apply(null,arguments);if(arguments.length===4)return xO.apply(null,arguments);if(arguments.length===5)return yO.apply(null,arguments);sr("Invalid extension access syntax")};tu.prototype.extension=Yv;mO.forEach(function(t){t.extensions.forEach(function(e){OC(t.type,e.name,e.impl)})});var jd=function(){if(!(this instanceof jd))return new jd;this.length=0},gs=jd.prototype;gs.instanceString=function(){return"stylesheet"};gs.selector=function(t){var e=this.length++;return this[e]={selector:t,properties:[]},this};gs.css=function(t,e){var r=this.length-1;if(ht(t))this[r].properties.push({name:t,value:e});else if(Ot(t))for(var n=t,i=Object.keys(n),a=0;a<i.length;a++){var s=i[a],o=n[s];if(o!=null){var l=Ar.properties[s]||Ar.properties[Gd(s)];if(l!=null){var u=l.name,c=o;this[r].properties.push({name:u,value:c})}}}return this};gs.style=gs.css;gs.generateStyle=function(t){var e=new Ar(t);return this.appendToStyle(e)};gs.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 a=0;a<i.length;a++){var s=i[a];t.css(s.name,s.value)}}return t};var bO="3.34.1",ka=function(e){if(e===void 0&&(e={}),Ot(e))return new tu(e);if(ht(e))return Yv.apply(Yv,arguments)};ka.use=function(t){var e=Array.prototype.slice.call(arguments,1);return e.unshift(ka),t.apply(null,e),this};ka.warnings=function(t){return s_(t)};ka.version=bO;ka.stylesheet=ka.Stylesheet=jd;var gd={exports:{}},vd={exports:{}},md={exports:{}},wO=md.exports,Jw;function SO(){return Jw||(Jw=1,(function(t,e){(function(n,i){t.exports=i()})(wO,function(){return(function(r){var n={};function i(a){if(n[a])return n[a].exports;var s=n[a]={i:a,l:!1,exports:{}};return r[a].call(s.exports,s,s.exports,i),s.l=!0,s.exports}return i.m=r,i.c=n,i.i=function(a){return a},i.d=function(a,s,o){i.o(a,s)||Object.defineProperty(a,s,{configurable:!1,enumerable:!0,get:o})},i.n=function(a){var s=a&&a.__esModule?function(){return a.default}:function(){return a};return i.d(s,"a",s),s},i.o=function(a,s){return Object.prototype.hasOwnProperty.call(a,s)},i.p="",i(i.s=28)})([(function(r,n,i){function a(){}a.QUALITY=1,a.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,a.DEFAULT_INCREMENTAL=!1,a.DEFAULT_ANIMATION_ON_LAYOUT=!0,a.DEFAULT_ANIMATION_DURING_LAYOUT=!1,a.DEFAULT_ANIMATION_PERIOD=50,a.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,a.DEFAULT_GRAPH_MARGIN=15,a.NODE_DIMENSIONS_INCLUDE_LABELS=!1,a.SIMPLE_NODE_SIZE=40,a.SIMPLE_NODE_HALF_SIZE=a.SIMPLE_NODE_SIZE/2,a.EMPTY_COMPOUND_NODE_SIZE=40,a.MIN_EDGE_LENGTH=1,a.WORLD_BOUNDARY=1e6,a.INITIAL_WORLD_BOUNDARY=a.WORLD_BOUNDARY/1e3,a.WORLD_CENTER_X=1200,a.WORLD_CENTER_Y=900,r.exports=a}),(function(r,n,i){var a=i(2),s=i(8),o=i(9);function l(c,d,p){a.call(this,p),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=p,this.bendpoints=[],this.source=c,this.target=d}l.prototype=Object.create(a.prototype);for(var u in a)l[u]=a[u];l.prototype.getSource=function(){return this.source},l.prototype.getTarget=function(){return this.target},l.prototype.isInterGraph=function(){return this.isInterGraph},l.prototype.getLength=function(){return this.length},l.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},l.prototype.getBendpoints=function(){return this.bendpoints},l.prototype.getLca=function(){return this.lca},l.prototype.getSourceInLca=function(){return this.sourceInLca},l.prototype.getTargetInLca=function(){return this.targetInLca},l.prototype.getOtherEnd=function(c){if(this.source===c)return this.target;if(this.target===c)return this.source;throw"Node is not incident with this edge"},l.prototype.getOtherEndInGraph=function(c,d){for(var p=this.getOtherEnd(c),f=d.getGraphManager().getRoot();;){if(p.getOwner()==d)return p;if(p.getOwner()==f)break;p=p.getOwner().getParent()}return null},l.prototype.updateLength=function(){var c=new Array(4);this.isOverlapingSourceAndTarget=s.getIntersection(this.target.getRect(),this.source.getRect(),c),this.isOverlapingSourceAndTarget||(this.lengthX=c[0]-c[2],this.lengthY=c[1]-c[3],Math.abs(this.lengthX)<1&&(this.lengthX=o.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=o.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=o.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=o.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},r.exports=l}),(function(r,n,i){function a(s){this.vGraphObject=s}r.exports=a}),(function(r,n,i){var a=i(2),s=i(10),o=i(13),l=i(0),u=i(16),c=i(5);function d(f,x,S,v){S==null&&v==null&&(v=x),a.call(this,v),f.graphManager!=null&&(f=f.graphManager),this.estimatedSize=s.MIN_VALUE,this.inclusionTreeDepth=s.MAX_VALUE,this.vGraphObject=v,this.edges=[],this.graphManager=f,S!=null&&x!=null?this.rect=new o(x.x,x.y,S.width,S.height):this.rect=new o}d.prototype=Object.create(a.prototype);for(var p in a)d[p]=a[p];d.prototype.getEdges=function(){return this.edges},d.prototype.getChild=function(){return this.child},d.prototype.getOwner=function(){return this.owner},d.prototype.getWidth=function(){return this.rect.width},d.prototype.setWidth=function(f){this.rect.width=f},d.prototype.getHeight=function(){return this.rect.height},d.prototype.setHeight=function(f){this.rect.height=f},d.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},d.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},d.prototype.getCenter=function(){return new c(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},d.prototype.getLocation=function(){return new c(this.rect.x,this.rect.y)},d.prototype.getRect=function(){return this.rect},d.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},d.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},d.prototype.setRect=function(f,x){this.rect.x=f.x,this.rect.y=f.y,this.rect.width=x.width,this.rect.height=x.height},d.prototype.setCenter=function(f,x){this.rect.x=f-this.rect.width/2,this.rect.y=x-this.rect.height/2},d.prototype.setLocation=function(f,x){this.rect.x=f,this.rect.y=x},d.prototype.moveBy=function(f,x){this.rect.x+=f,this.rect.y+=x},d.prototype.getEdgeListToNode=function(f){var x=[],S=this;return S.edges.forEach(function(v){if(v.target==f){if(v.source!=S)throw"Incorrect edge source!";x.push(v)}}),x},d.prototype.getEdgesBetween=function(f){var x=[],S=this;return S.edges.forEach(function(v){if(!(v.source==S||v.target==S))throw"Incorrect edge source and/or target";(v.target==f||v.source==f)&&x.push(v)}),x},d.prototype.getNeighborsList=function(){var f=new Set,x=this;return x.edges.forEach(function(S){if(S.source==x)f.add(S.target);else{if(S.target!=x)throw"Incorrect incidency!";f.add(S.source)}}),f},d.prototype.withChildren=function(){var f=new Set,x,S;if(f.add(this),this.child!=null)for(var v=this.child.getNodes(),m=0;m<v.length;m++)x=v[m],S=x.withChildren(),S.forEach(function(b){f.add(b)});return f},d.prototype.getNoOfChildren=function(){var f=0,x;if(this.child==null)f=1;else for(var S=this.child.getNodes(),v=0;v<S.length;v++)x=S[v],f+=x.getNoOfChildren();return f==0&&(f=1),f},d.prototype.getEstimatedSize=function(){if(this.estimatedSize==s.MIN_VALUE)throw"assert failed";return this.estimatedSize},d.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)},d.prototype.scatter=function(){var f,x,S=-l.INITIAL_WORLD_BOUNDARY,v=l.INITIAL_WORLD_BOUNDARY;f=l.WORLD_CENTER_X+u.nextDouble()*(v-S)+S;var m=-l.INITIAL_WORLD_BOUNDARY,b=l.INITIAL_WORLD_BOUNDARY;x=l.WORLD_CENTER_Y+u.nextDouble()*(b-m)+m,this.rect.x=f,this.rect.y=x},d.prototype.updateBounds=function(){if(this.getChild()==null)throw"assert failed";if(this.getChild().getNodes().length!=0){var f=this.getChild();if(f.updateBounds(!0),this.rect.x=f.getLeft(),this.rect.y=f.getTop(),this.setWidth(f.getRight()-f.getLeft()),this.setHeight(f.getBottom()-f.getTop()),l.NODE_DIMENSIONS_INCLUDE_LABELS){var x=f.getRight()-f.getLeft(),S=f.getBottom()-f.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(S+this.labelHeight)):this.labelPosVertical=="center"&&this.labelHeight>S?(this.rect.y-=(this.labelHeight-S)/2,this.setHeight(this.labelHeight)):this.labelPosVertical=="bottom"&&this.setHeight(S+this.labelHeight))}}},d.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==s.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},d.prototype.transform=function(f){var x=this.rect.x;x>l.WORLD_BOUNDARY?x=l.WORLD_BOUNDARY:x<-l.WORLD_BOUNDARY&&(x=-l.WORLD_BOUNDARY);var S=this.rect.y;S>l.WORLD_BOUNDARY?S=l.WORLD_BOUNDARY:S<-l.WORLD_BOUNDARY&&(S=-l.WORLD_BOUNDARY);var v=new c(x,S),m=f.inverseTransformPoint(v);this.setLocation(m.x,m.y)},d.prototype.getLeft=function(){return this.rect.x},d.prototype.getRight=function(){return this.rect.x+this.rect.width},d.prototype.getTop=function(){return this.rect.y},d.prototype.getBottom=function(){return this.rect.y+this.rect.height},d.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},r.exports=d}),(function(r,n,i){var a=i(0);function s(){}for(var o in a)s[o]=a[o];s.MAX_ITERATIONS=2500,s.DEFAULT_EDGE_LENGTH=50,s.DEFAULT_SPRING_STRENGTH=.45,s.DEFAULT_REPULSION_STRENGTH=4500,s.DEFAULT_GRAVITY_STRENGTH=.4,s.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,s.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,s.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,s.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,s.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,s.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,s.COOLING_ADAPTATION_FACTOR=.33,s.ADAPTATION_LOWER_NODE_LIMIT=1e3,s.ADAPTATION_UPPER_NODE_LIMIT=5e3,s.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,s.MAX_NODE_DISPLACEMENT=s.MAX_NODE_DISPLACEMENT_INCREMENTAL*3,s.MIN_REPULSION_DIST=s.DEFAULT_EDGE_LENGTH/10,s.CONVERGENCE_CHECK_PERIOD=100,s.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,s.MIN_EDGE_LENGTH=1,s.GRID_CALCULATION_CHECK_PERIOD=10,r.exports=s}),(function(r,n,i){function a(s,o){s==null&&o==null?(this.x=0,this.y=0):(this.x=s,this.y=o)}a.prototype.getX=function(){return this.x},a.prototype.getY=function(){return this.y},a.prototype.setX=function(s){this.x=s},a.prototype.setY=function(s){this.y=s},a.prototype.getDifference=function(s){return new DimensionD(this.x-s.x,this.y-s.y)},a.prototype.getCopy=function(){return new a(this.x,this.y)},a.prototype.translate=function(s){return this.x+=s.width,this.y+=s.height,this},r.exports=a}),(function(r,n,i){var a=i(2),s=i(10),o=i(0),l=i(7),u=i(3),c=i(1),d=i(13),p=i(12),f=i(11);function x(v,m,b){a.call(this,b),this.estimatedSize=s.MIN_VALUE,this.margin=o.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=v,m!=null&&m instanceof l?this.graphManager=m:m!=null&&m instanceof Layout&&(this.graphManager=m.graphManager)}x.prototype=Object.create(a.prototype);for(var S in a)x[S]=a[S];x.prototype.getNodes=function(){return this.nodes},x.prototype.getEdges=function(){return this.edges},x.prototype.getGraphManager=function(){return this.graphManager},x.prototype.getParent=function(){return this.parent},x.prototype.getLeft=function(){return this.left},x.prototype.getRight=function(){return this.right},x.prototype.getTop=function(){return this.top},x.prototype.getBottom=function(){return this.bottom},x.prototype.isConnected=function(){return this.isConnected},x.prototype.add=function(v,m,b){if(m==null&&b==null){var w=v;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(w)>-1)throw"Node already in graph!";return w.owner=this,this.getNodes().push(w),w}else{var _=v;if(!(this.getNodes().indexOf(m)>-1&&this.getNodes().indexOf(b)>-1))throw"Source or target not in graph!";if(!(m.owner==b.owner&&m.owner==this))throw"Both owners must be this graph!";return m.owner!=b.owner?null:(_.source=m,_.target=b,_.isInterGraph=!1,this.getEdges().push(_),m.edges.push(_),b!=m&&b.edges.push(_),_)}},x.prototype.remove=function(v){var m=v;if(v instanceof u){if(m==null)throw"Node is null!";if(!(m.owner!=null&&m.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var b=m.edges.slice(),w,_=b.length,T=0;T<_;T++)w=b[T],w.isInterGraph?this.graphManager.remove(w):w.source.owner.remove(w);var N=this.nodes.indexOf(m);if(N==-1)throw"Node not in owner node list!";this.nodes.splice(N,1)}else if(v instanceof c){var w=v;if(w==null)throw"Edge is null!";if(!(w.source!=null&&w.target!=null))throw"Source and/or target is null!";if(!(w.source.owner!=null&&w.target.owner!=null&&w.source.owner==this&&w.target.owner==this))throw"Source and/or target owner is invalid!";var E=w.source.edges.indexOf(w),k=w.target.edges.indexOf(w);if(!(E>-1&&k>-1))throw"Source and/or target doesn't know this edge!";w.source.edges.splice(E,1),w.target!=w.source&&w.target.edges.splice(k,1);var N=w.source.owner.getEdges().indexOf(w);if(N==-1)throw"Not in owner's edge list!";w.source.owner.getEdges().splice(N,1)}},x.prototype.updateLeftTop=function(){for(var v=s.MAX_VALUE,m=s.MAX_VALUE,b,w,_,T=this.getNodes(),N=T.length,E=0;E<N;E++){var k=T[E];b=k.getTop(),w=k.getLeft(),v>b&&(v=b),m>w&&(m=w)}return v==s.MAX_VALUE?null:(T[0].getParent().paddingLeft!=null?_=T[0].getParent().paddingLeft:_=this.margin,this.left=m-_,this.top=v-_,new p(this.left,this.top))},x.prototype.updateBounds=function(v){for(var m=s.MAX_VALUE,b=-s.MAX_VALUE,w=s.MAX_VALUE,_=-s.MAX_VALUE,T,N,E,k,L,A=this.nodes,M=A.length,O=0;O<M;O++){var $=A[O];v&&$.child!=null&&$.updateBounds(),T=$.getLeft(),N=$.getRight(),E=$.getTop(),k=$.getBottom(),m>T&&(m=T),b<N&&(b=N),w>E&&(w=E),_<k&&(_=k)}var D=new d(m,w,b-m,_-w);m==s.MAX_VALUE&&(this.left=this.parent.getLeft(),this.right=this.parent.getRight(),this.top=this.parent.getTop(),this.bottom=this.parent.getBottom()),A[0].getParent().paddingLeft!=null?L=A[0].getParent().paddingLeft:L=this.margin,this.left=D.x-L,this.right=D.x+D.width+L,this.top=D.y-L,this.bottom=D.y+D.height+L},x.calculateBounds=function(v){for(var m=s.MAX_VALUE,b=-s.MAX_VALUE,w=s.MAX_VALUE,_=-s.MAX_VALUE,T,N,E,k,L=v.length,A=0;A<L;A++){var M=v[A];T=M.getLeft(),N=M.getRight(),E=M.getTop(),k=M.getBottom(),m>T&&(m=T),b<N&&(b=N),w>E&&(w=E),_<k&&(_=k)}var O=new d(m,w,b-m,_-w);return O},x.prototype.getInclusionTreeDepth=function(){return this==this.graphManager.getRoot()?1:this.parent.getInclusionTreeDepth()},x.prototype.getEstimatedSize=function(){if(this.estimatedSize==s.MIN_VALUE)throw"assert failed";return this.estimatedSize},x.prototype.calcEstimatedSize=function(){for(var v=0,m=this.nodes,b=m.length,w=0;w<b;w++){var _=m[w];v+=_.calcEstimatedSize()}return v==0?this.estimatedSize=o.EMPTY_COMPOUND_NODE_SIZE:this.estimatedSize=v/Math.sqrt(this.nodes.length),this.estimatedSize},x.prototype.updateConnected=function(){var v=this;if(this.nodes.length==0){this.isConnected=!0;return}var m=new f,b=new Set,w=this.nodes[0],_,T,N=w.withChildren();for(N.forEach(function(O){m.push(O),b.add(O)});m.length!==0;){w=m.shift(),_=w.getEdges();for(var E=_.length,k=0;k<E;k++){var L=_[k];if(T=L.getOtherEndInGraph(w,this),T!=null&&!b.has(T)){var A=T.withChildren();A.forEach(function(O){m.push(O),b.add(O)})}}}if(this.isConnected=!1,b.size>=this.nodes.length){var M=0;b.forEach(function(O){O.owner==v&&M++}),M==this.nodes.length&&(this.isConnected=!0)}},r.exports=x}),(function(r,n,i){var a,s=i(1);function o(l){a=i(6),this.layout=l,this.graphs=[],this.edges=[]}o.prototype.addRoot=function(){var l=this.layout.newGraph(),u=this.layout.newNode(null),c=this.add(l,u);return this.setRootGraph(c),this.rootGraph},o.prototype.add=function(l,u,c,d,p){if(c==null&&d==null&&p==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{p=c,d=u,c=l;var f=d.getOwner(),x=p.getOwner();if(!(f!=null&&f.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(x!=null&&x.getGraphManager()==this))throw"Target not in this graph mgr!";if(f==x)return c.isInterGraph=!1,f.add(c,d,p);if(c.isInterGraph=!0,c.source=d,c.target=p,this.edges.indexOf(c)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(c),!(c.source!=null&&c.target!=null))throw"Edge source and/or target is null!";if(!(c.source.edges.indexOf(c)==-1&&c.target.edges.indexOf(c)==-1))throw"Edge already in source and/or target incidency list!";return c.source.edges.push(c),c.target.edges.push(c),c}},o.prototype.remove=function(l){if(l instanceof a){var u=l;if(u.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(u==this.rootGraph||u.parent!=null&&u.parent.graphManager==this))throw"Invalid parent node!";var c=[];c=c.concat(u.getEdges());for(var d,p=c.length,f=0;f<p;f++)d=c[f],u.remove(d);var x=[];x=x.concat(u.getNodes());var S;p=x.length;for(var f=0;f<p;f++)S=x[f],u.remove(S);u==this.rootGraph&&this.setRootGraph(null);var v=this.graphs.indexOf(u);this.graphs.splice(v,1),u.parent=null}else if(l instanceof s){if(d=l,d==null)throw"Edge is null!";if(!d.isInterGraph)throw"Not an inter-graph edge!";if(!(d.source!=null&&d.target!=null))throw"Source and/or target is null!";if(!(d.source.edges.indexOf(d)!=-1&&d.target.edges.indexOf(d)!=-1))throw"Source and/or target doesn't know this edge!";var v=d.source.edges.indexOf(d);if(d.source.edges.splice(v,1),v=d.target.edges.indexOf(d),d.target.edges.splice(v,1),!(d.source.owner!=null&&d.source.owner.getGraphManager()!=null))throw"Edge owner graph or owner graph manager is null!";if(d.source.owner.getGraphManager().edges.indexOf(d)==-1)throw"Not in owner graph manager's edge list!";var v=d.source.owner.getGraphManager().edges.indexOf(d);d.source.owner.getGraphManager().edges.splice(v,1)}},o.prototype.updateBounds=function(){this.rootGraph.updateBounds(!0)},o.prototype.getGraphs=function(){return this.graphs},o.prototype.getAllNodes=function(){if(this.allNodes==null){for(var l=[],u=this.getGraphs(),c=u.length,d=0;d<c;d++)l=l.concat(u[d].getNodes());this.allNodes=l}return this.allNodes},o.prototype.resetAllNodes=function(){this.allNodes=null},o.prototype.resetAllEdges=function(){this.allEdges=null},o.prototype.resetAllNodesToApplyGravitation=function(){this.allNodesToApplyGravitation=null},o.prototype.getAllEdges=function(){if(this.allEdges==null){var l=[],u=this.getGraphs();u.length;for(var c=0;c<u.length;c++)l=l.concat(u[c].getEdges());l=l.concat(this.edges),this.allEdges=l}return this.allEdges},o.prototype.getAllNodesToApplyGravitation=function(){return this.allNodesToApplyGravitation},o.prototype.setAllNodesToApplyGravitation=function(l){if(this.allNodesToApplyGravitation!=null)throw"assert failed";this.allNodesToApplyGravitation=l},o.prototype.getRoot=function(){return this.rootGraph},o.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"))},o.prototype.getLayout=function(){return this.layout},o.prototype.isOneAncestorOfOther=function(l,u){if(!(l!=null&&u!=null))throw"assert failed";if(l==u)return!0;var c=l.getOwner(),d;do{if(d=c.getParent(),d==null)break;if(d==u)return!0;if(c=d.getOwner(),c==null)break}while(!0);c=u.getOwner();do{if(d=c.getParent(),d==null)break;if(d==l)return!0;if(c=d.getOwner(),c==null)break}while(!0);return!1},o.prototype.calcLowestCommonAncestors=function(){for(var l,u,c,d,p,f=this.getAllEdges(),x=f.length,S=0;S<x;S++){if(l=f[S],u=l.source,c=l.target,l.lca=null,l.sourceInLca=u,l.targetInLca=c,u==c){l.lca=u.getOwner();continue}for(d=u.getOwner();l.lca==null;){for(l.targetInLca=c,p=c.getOwner();l.lca==null;){if(p==d){l.lca=p;break}if(p==this.rootGraph)break;if(l.lca!=null)throw"assert failed";l.targetInLca=p.getParent(),p=l.targetInLca.getOwner()}if(d==this.rootGraph)break;l.lca==null&&(l.sourceInLca=d.getParent(),d=l.sourceInLca.getOwner())}if(l.lca==null)throw"assert failed"}},o.prototype.calcLowestCommonAncestor=function(l,u){if(l==u)return l.getOwner();var c=l.getOwner();do{if(c==null)break;var d=u.getOwner();do{if(d==null)break;if(d==c)return d;d=d.getParent().getOwner()}while(!0);c=c.getParent().getOwner()}while(!0);return c},o.prototype.calcInclusionTreeDepths=function(l,u){l==null&&u==null&&(l=this.rootGraph,u=1);for(var c,d=l.getNodes(),p=d.length,f=0;f<p;f++)c=d[f],c.inclusionTreeDepth=u,c.child!=null&&this.calcInclusionTreeDepths(c.child,u+1)},o.prototype.includesInvalidEdge=function(){for(var l,u=[],c=this.edges.length,d=0;d<c;d++)l=this.edges[d],this.isOneAncestorOfOther(l.source,l.target)&&u.push(l);for(var d=0;d<u.length;d++)this.remove(u[d]);return!1},r.exports=o}),(function(r,n,i){var a=i(12);function s(){}s.calcSeparationAmount=function(o,l,u,c){if(!o.intersects(l))throw"assert failed";var d=new Array(2);this.decideDirectionsForOverlappingNodes(o,l,d),u[0]=Math.min(o.getRight(),l.getRight())-Math.max(o.x,l.x),u[1]=Math.min(o.getBottom(),l.getBottom())-Math.max(o.y,l.y),o.getX()<=l.getX()&&o.getRight()>=l.getRight()?u[0]+=Math.min(l.getX()-o.getX(),o.getRight()-l.getRight()):l.getX()<=o.getX()&&l.getRight()>=o.getRight()&&(u[0]+=Math.min(o.getX()-l.getX(),l.getRight()-o.getRight())),o.getY()<=l.getY()&&o.getBottom()>=l.getBottom()?u[1]+=Math.min(l.getY()-o.getY(),o.getBottom()-l.getBottom()):l.getY()<=o.getY()&&l.getBottom()>=o.getBottom()&&(u[1]+=Math.min(o.getY()-l.getY(),l.getBottom()-o.getBottom()));var p=Math.abs((l.getCenterY()-o.getCenterY())/(l.getCenterX()-o.getCenterX()));l.getCenterY()===o.getCenterY()&&l.getCenterX()===o.getCenterX()&&(p=1);var f=p*u[0],x=u[1]/p;u[0]<x?x=u[0]:f=u[1],u[0]=-1*d[0]*(x/2+c),u[1]=-1*d[1]*(f/2+c)},s.decideDirectionsForOverlappingNodes=function(o,l,u){o.getCenterX()<l.getCenterX()?u[0]=-1:u[0]=1,o.getCenterY()<l.getCenterY()?u[1]=-1:u[1]=1},s.getIntersection2=function(o,l,u){var c=o.getCenterX(),d=o.getCenterY(),p=l.getCenterX(),f=l.getCenterY();if(o.intersects(l))return u[0]=c,u[1]=d,u[2]=p,u[3]=f,!0;var x=o.getX(),S=o.getY(),v=o.getRight(),m=o.getX(),b=o.getBottom(),w=o.getRight(),_=o.getWidthHalf(),T=o.getHeightHalf(),N=l.getX(),E=l.getY(),k=l.getRight(),L=l.getX(),A=l.getBottom(),M=l.getRight(),O=l.getWidthHalf(),$=l.getHeightHalf(),D=!1,B=!1;if(c===p){if(d>f)return u[0]=c,u[1]=S,u[2]=p,u[3]=A,!1;if(d<f)return u[0]=c,u[1]=b,u[2]=p,u[3]=E,!1}else if(d===f){if(c>p)return u[0]=x,u[1]=d,u[2]=k,u[3]=f,!1;if(c<p)return u[0]=v,u[1]=d,u[2]=N,u[3]=f,!1}else{var j=o.height/o.width,I=l.height/l.width,U=(f-d)/(p-c),F=void 0,P=void 0,H=void 0,W=void 0,V=void 0,re=void 0;if(-j===U?c>p?(u[0]=m,u[1]=b,D=!0):(u[0]=v,u[1]=S,D=!0):j===U&&(c>p?(u[0]=x,u[1]=S,D=!0):(u[0]=w,u[1]=b,D=!0)),-I===U?p>c?(u[2]=L,u[3]=A,B=!0):(u[2]=k,u[3]=E,B=!0):I===U&&(p>c?(u[2]=N,u[3]=E,B=!0):(u[2]=M,u[3]=A,B=!0)),D&&B)return!1;if(c>p?d>f?(F=this.getCardinalDirection(j,U,4),P=this.getCardinalDirection(I,U,2)):(F=this.getCardinalDirection(-j,U,3),P=this.getCardinalDirection(-I,U,1)):d>f?(F=this.getCardinalDirection(-j,U,1),P=this.getCardinalDirection(-I,U,3)):(F=this.getCardinalDirection(j,U,2),P=this.getCardinalDirection(I,U,4)),!D)switch(F){case 1:W=S,H=c+-T/U,u[0]=H,u[1]=W;break;case 2:H=w,W=d+_*U,u[0]=H,u[1]=W;break;case 3:W=b,H=c+T/U,u[0]=H,u[1]=W;break;case 4:H=m,W=d+-_*U,u[0]=H,u[1]=W;break}if(!B)switch(P){case 1:re=E,V=p+-$/U,u[2]=V,u[3]=re;break;case 2:V=M,re=f+O*U,u[2]=V,u[3]=re;break;case 3:re=A,V=p+$/U,u[2]=V,u[3]=re;break;case 4:V=L,re=f+-O*U,u[2]=V,u[3]=re;break}}return!1},s.getCardinalDirection=function(o,l,u){return o>l?u:1+u%4},s.getIntersection=function(o,l,u,c){if(c==null)return this.getIntersection2(o,l,u);var d=o.x,p=o.y,f=l.x,x=l.y,S=u.x,v=u.y,m=c.x,b=c.y,w=void 0,_=void 0,T=void 0,N=void 0,E=void 0,k=void 0,L=void 0,A=void 0,M=void 0;return T=x-p,E=d-f,L=f*p-d*x,N=b-v,k=S-m,A=m*v-S*b,M=T*k-N*E,M===0?null:(w=(E*A-k*L)/M,_=(N*L-T*A)/M,new a(w,_))},s.angleOfVector=function(o,l,u,c){var d=void 0;return o!==u?(d=Math.atan((c-l)/(u-o)),u<o?d+=Math.PI:c<l&&(d+=this.TWO_PI)):c<l?d=this.ONE_AND_HALF_PI:d=this.HALF_PI,d},s.doIntersect=function(o,l,u,c){var d=o.x,p=o.y,f=l.x,x=l.y,S=u.x,v=u.y,m=c.x,b=c.y,w=(f-d)*(b-v)-(m-S)*(x-p);if(w===0)return!1;var _=((b-v)*(m-d)+(S-m)*(b-p))/w,T=((p-x)*(m-d)+(f-d)*(b-p))/w;return 0<_&&_<1&&0<T&&T<1},s.findCircleLineIntersections=function(o,l,u,c,d,p,f){var x=(u-o)*(u-o)+(c-l)*(c-l),S=2*((o-d)*(u-o)+(l-p)*(c-l)),v=(o-d)*(o-d)+(l-p)*(l-p)-f*f,m=S*S-4*x*v;if(m>=0){var b=(-S+Math.sqrt(S*S-4*x*v))/(2*x),w=(-S-Math.sqrt(S*S-4*x*v))/(2*x),_=null;return b>=0&&b<=1?[b]:w>=0&&w<=1?[w]:_}else return null},s.HALF_PI=.5*Math.PI,s.ONE_AND_HALF_PI=1.5*Math.PI,s.TWO_PI=2*Math.PI,s.THREE_PI=3*Math.PI,r.exports=s}),(function(r,n,i){function a(){}a.sign=function(s){return s>0?1:s<0?-1:0},a.floor=function(s){return s<0?Math.ceil(s):Math.floor(s)},a.ceil=function(s){return s<0?Math.floor(s):Math.ceil(s)},r.exports=a}),(function(r,n,i){function a(){}a.MAX_VALUE=2147483647,a.MIN_VALUE=-2147483648,r.exports=a}),(function(r,n,i){var a=(function(){function d(p,f){for(var x=0;x<f.length;x++){var S=f[x];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(p,S.key,S)}}return function(p,f,x){return f&&d(p.prototype,f),x&&d(p,x),p}})();function s(d,p){if(!(d instanceof p))throw new TypeError("Cannot call a class as a function")}var o=function(p){return{value:p,next:null,prev:null}},l=function(p,f,x,S){return p!==null?p.next=f:S.head=f,x!==null?x.prev=f:S.tail=f,f.prev=p,f.next=x,S.length++,f},u=function(p,f){var x=p.prev,S=p.next;return x!==null?x.next=S:f.head=S,S!==null?S.prev=x:f.tail=x,p.prev=p.next=null,f.length--,p},c=(function(){function d(p){var f=this;s(this,d),this.length=0,this.head=null,this.tail=null,p!=null&&p.forEach(function(x){return f.push(x)})}return a(d,[{key:"size",value:function(){return this.length}},{key:"insertBefore",value:function(f,x){return l(x.prev,o(f),x,this)}},{key:"insertAfter",value:function(f,x){return l(x,o(f),x.next,this)}},{key:"insertNodeBefore",value:function(f,x){return l(x.prev,f,x,this)}},{key:"insertNodeAfter",value:function(f,x){return l(x,f,x.next,this)}},{key:"push",value:function(f){return l(this.tail,o(f),null,this)}},{key:"unshift",value:function(f){return l(null,o(f),this.head,this)}},{key:"remove",value:function(f){return u(f,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(f){if(f<=this.length()){for(var x=1,S=this.head;x<f;)S=S.next,x++;return S.value}}},{key:"set_object_at",value:function(f,x){if(f<=this.length()){for(var S=1,v=this.head;S<f;)v=v.next,S++;v.value=x}}}]),d})();r.exports=c}),(function(r,n,i){function a(s,o,l){this.x=null,this.y=null,s==null&&o==null&&l==null?(this.x=0,this.y=0):typeof s=="number"&&typeof o=="number"&&l==null?(this.x=s,this.y=o):s.constructor.name=="Point"&&o==null&&l==null&&(l=s,this.x=l.x,this.y=l.y)}a.prototype.getX=function(){return this.x},a.prototype.getY=function(){return this.y},a.prototype.getLocation=function(){return new a(this.x,this.y)},a.prototype.setLocation=function(s,o,l){s.constructor.name=="Point"&&o==null&&l==null?(l=s,this.setLocation(l.x,l.y)):typeof s=="number"&&typeof o=="number"&&l==null&&(parseInt(s)==s&&parseInt(o)==o?this.move(s,o):(this.x=Math.floor(s+.5),this.y=Math.floor(o+.5)))},a.prototype.move=function(s,o){this.x=s,this.y=o},a.prototype.translate=function(s,o){this.x+=s,this.y+=o},a.prototype.equals=function(s){if(s.constructor.name=="Point"){var o=s;return this.x==o.x&&this.y==o.y}return this==s},a.prototype.toString=function(){return new a().constructor.name+"[x="+this.x+",y="+this.y+"]"},r.exports=a}),(function(r,n,i){function a(s,o,l,u){this.x=0,this.y=0,this.width=0,this.height=0,s!=null&&o!=null&&l!=null&&u!=null&&(this.x=s,this.y=o,this.width=l,this.height=u)}a.prototype.getX=function(){return this.x},a.prototype.setX=function(s){this.x=s},a.prototype.getY=function(){return this.y},a.prototype.setY=function(s){this.y=s},a.prototype.getWidth=function(){return this.width},a.prototype.setWidth=function(s){this.width=s},a.prototype.getHeight=function(){return this.height},a.prototype.setHeight=function(s){this.height=s},a.prototype.getRight=function(){return this.x+this.width},a.prototype.getBottom=function(){return this.y+this.height},a.prototype.intersects=function(s){return!(this.getRight()<s.x||this.getBottom()<s.y||s.getRight()<this.x||s.getBottom()<this.y)},a.prototype.getCenterX=function(){return this.x+this.width/2},a.prototype.getMinX=function(){return this.getX()},a.prototype.getMaxX=function(){return this.getX()+this.width},a.prototype.getCenterY=function(){return this.y+this.height/2},a.prototype.getMinY=function(){return this.getY()},a.prototype.getMaxY=function(){return this.getY()+this.height},a.prototype.getWidthHalf=function(){return this.width/2},a.prototype.getHeightHalf=function(){return this.height/2},r.exports=a}),(function(r,n,i){var a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o};function s(){}s.lastID=0,s.createID=function(o){return s.isPrimitive(o)?o:(o.uniqueID!=null||(o.uniqueID=s.getString(),s.lastID++),o.uniqueID)},s.getString=function(o){return o==null&&(o=s.lastID),"Object#"+o},s.isPrimitive=function(o){var l=typeof o>"u"?"undefined":a(o);return o==null||l!="object"&&l!="function"},r.exports=s}),(function(r,n,i){function a(S){if(Array.isArray(S)){for(var v=0,m=Array(S.length);v<S.length;v++)m[v]=S[v];return m}else return Array.from(S)}var s=i(0),o=i(7),l=i(3),u=i(1),c=i(6),d=i(5),p=i(17),f=i(29);function x(S){f.call(this),this.layoutQuality=s.QUALITY,this.createBendsAsNeeded=s.DEFAULT_CREATE_BENDS_AS_NEEDED,this.incremental=s.DEFAULT_INCREMENTAL,this.animationOnLayout=s.DEFAULT_ANIMATION_ON_LAYOUT,this.animationDuringLayout=s.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=s.DEFAULT_ANIMATION_PERIOD,this.uniformLeafNodeSizes=s.DEFAULT_UNIFORM_LEAF_NODE_SIZES,this.edgeToDummyNodes=new Map,this.graphManager=new o(this),this.isLayoutFinished=!1,this.isSubLayout=!1,this.isRemoteUse=!1,S!=null&&(this.isRemoteUse=S)}x.RANDOM_SEED=1,x.prototype=Object.create(f.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 S=new o(this);return this.graphManager=S,S},x.prototype.newGraph=function(S){return new c(null,this.graphManager,S)},x.prototype.newNode=function(S){return new l(this.graphManager,S)},x.prototype.newEdge=function(S){return new u(null,null,S)},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 S;return this.checkLayoutSuccess()?S=!1:S=this.layout(),s.ANIMATE==="during"?!1:(S&&(this.isSubLayout||this.doPostLayout()),this.tilingPostLayout&&this.tilingPostLayout(),this.isLayoutFinished=!0,S)},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 S=this.graphManager.getAllEdges(),v=0;v<S.length;v++)S[v];for(var m=this.graphManager.getRoot().getNodes(),v=0;v<m.length;v++)m[v];this.update(this.graphManager.getRoot())}},x.prototype.update=function(S){if(S==null)this.update2();else if(S instanceof l){var v=S;if(v.getChild()!=null)for(var m=v.getChild().getNodes(),b=0;b<m.length;b++)update(m[b]);if(v.vGraphObject!=null){var w=v.vGraphObject;w.update(v)}}else if(S instanceof u){var _=S;if(_.vGraphObject!=null){var T=_.vGraphObject;T.update(_)}}else if(S instanceof c){var N=S;if(N.vGraphObject!=null){var E=N.vGraphObject;E.update(N)}}},x.prototype.initParameters=function(){this.isSubLayout||(this.layoutQuality=s.QUALITY,this.animationDuringLayout=s.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=s.DEFAULT_ANIMATION_PERIOD,this.animationOnLayout=s.DEFAULT_ANIMATION_ON_LAYOUT,this.incremental=s.DEFAULT_INCREMENTAL,this.createBendsAsNeeded=s.DEFAULT_CREATE_BENDS_AS_NEEDED,this.uniformLeafNodeSizes=s.DEFAULT_UNIFORM_LEAF_NODE_SIZES),this.animationDuringLayout&&(this.animationOnLayout=!1)},x.prototype.transform=function(S){if(S==null)this.transform(new d(0,0));else{var v=new p,m=this.graphManager.getRoot().updateLeftTop();if(m!=null){v.setWorldOrgX(S.x),v.setWorldOrgY(S.y),v.setDeviceOrgX(m.x),v.setDeviceOrgY(m.y);for(var b=this.getAllNodes(),w,_=0;_<b.length;_++)w=b[_],w.transform(v)}}},x.prototype.positionNodesRandomly=function(S){if(S==null)this.positionNodesRandomly(this.getGraphManager().getRoot()),this.getGraphManager().getRoot().updateBounds(!0);else for(var v,m,b=S.getNodes(),w=0;w<b.length;w++)v=b[w],m=v.getChild(),m==null||m.getNodes().length==0?v.scatter():(this.positionNodesRandomly(m),v.updateBounds())},x.prototype.getFlatForest=function(){for(var S=[],v=!0,m=this.graphManager.getRoot().getNodes(),b=!0,w=0;w<m.length;w++)m[w].getChild()!=null&&(b=!1);if(!b)return S;var _=new Set,T=[],N=new Map,E=[];for(E=E.concat(m);E.length>0&&v;){for(T.push(E[0]);T.length>0&&v;){var k=T[0];T.splice(0,1),_.add(k);for(var L=k.getEdges(),w=0;w<L.length;w++){var A=L[w].getOtherEnd(k);if(N.get(k)!=A)if(!_.has(A))T.push(A),N.set(A,k);else{v=!1;break}}}if(!v)S=[];else{var M=[].concat(a(_));S.push(M);for(var w=0;w<M.length;w++){var O=M[w],$=E.indexOf(O);$>-1&&E.splice($,1)}_=new Set,N=new Map}}return S},x.prototype.createDummyNodesForBendpoints=function(S){for(var v=[],m=S.source,b=this.graphManager.calcLowestCommonAncestor(S.source,S.target),w=0;w<S.bendpoints.length;w++){var _=this.newNode(null);_.setRect(new Point(0,0),new Dimension(1,1)),b.add(_);var T=this.newEdge(null);this.graphManager.add(T,m,_),v.add(_),m=_}var T=this.newEdge(null);return this.graphManager.add(T,m,S.target),this.edgeToDummyNodes.set(S,v),S.isInterGraph()?this.graphManager.remove(S):b.remove(S),v},x.prototype.createBendpointsFromDummyNodes=function(){var S=[];S=S.concat(this.graphManager.getAllEdges()),S=[].concat(a(this.edgeToDummyNodes.keys())).concat(S);for(var v=0;v<S.length;v++){var m=S[v];if(m.bendpoints.length>0){for(var b=this.edgeToDummyNodes.get(m),w=0;w<b.length;w++){var _=b[w],T=new d(_.getCenterX(),_.getCenterY()),N=m.bendpoints.get(w);N.x=T.x,N.y=T.y,_.getOwner().remove(_)}this.graphManager.add(m,m.source,m.target)}}},x.transform=function(S,v,m,b){if(m!=null&&b!=null){var w=v;if(S<=50){var _=v/m;w-=(v-_)/50*(50-S)}else{var T=v*b;w+=(T-v)/50*(S-50)}return w}else{var N,E;return S<=50?(N=9*v/500,E=v/10):(N=9*v/50,E=-8*v),N*S+E}},x.findCenterOfTree=function(S){var v=[];v=v.concat(S);var m=[],b=new Map,w=!1,_=null;(v.length==1||v.length==2)&&(w=!0,_=v[0]);for(var T=0;T<v.length;T++){var N=v[T],E=N.getNeighborsList().size;b.set(N,N.getNeighborsList().size),E==1&&m.push(N)}var k=[];for(k=k.concat(m);!w;){var L=[];L=L.concat(k),k=[];for(var T=0;T<v.length;T++){var N=v[T],A=v.indexOf(N);A>=0&&v.splice(A,1);var M=N.getNeighborsList();M.forEach(function(D){if(m.indexOf(D)<0){var B=b.get(D),j=B-1;j==1&&k.push(D),b.set(D,j)}})}m=m.concat(k),(v.length==1||v.length==2)&&(w=!0,_=v[0])}return _},x.prototype.setGraphManager=function(S){this.graphManager=S},r.exports=x}),(function(r,n,i){function a(){}a.seed=1,a.x=0,a.nextDouble=function(){return a.x=Math.sin(a.seed++)*1e4,a.x-Math.floor(a.x)},r.exports=a}),(function(r,n,i){var a=i(5);function s(o,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}s.prototype.getWorldOrgX=function(){return this.lworldOrgX},s.prototype.setWorldOrgX=function(o){this.lworldOrgX=o},s.prototype.getWorldOrgY=function(){return this.lworldOrgY},s.prototype.setWorldOrgY=function(o){this.lworldOrgY=o},s.prototype.getWorldExtX=function(){return this.lworldExtX},s.prototype.setWorldExtX=function(o){this.lworldExtX=o},s.prototype.getWorldExtY=function(){return this.lworldExtY},s.prototype.setWorldExtY=function(o){this.lworldExtY=o},s.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},s.prototype.setDeviceOrgX=function(o){this.ldeviceOrgX=o},s.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},s.prototype.setDeviceOrgY=function(o){this.ldeviceOrgY=o},s.prototype.getDeviceExtX=function(){return this.ldeviceExtX},s.prototype.setDeviceExtX=function(o){this.ldeviceExtX=o},s.prototype.getDeviceExtY=function(){return this.ldeviceExtY},s.prototype.setDeviceExtY=function(o){this.ldeviceExtY=o},s.prototype.transformX=function(o){var l=0,u=this.lworldExtX;return u!=0&&(l=this.ldeviceOrgX+(o-this.lworldOrgX)*this.ldeviceExtX/u),l},s.prototype.transformY=function(o){var l=0,u=this.lworldExtY;return u!=0&&(l=this.ldeviceOrgY+(o-this.lworldOrgY)*this.ldeviceExtY/u),l},s.prototype.inverseTransformX=function(o){var l=0,u=this.ldeviceExtX;return u!=0&&(l=this.lworldOrgX+(o-this.ldeviceOrgX)*this.lworldExtX/u),l},s.prototype.inverseTransformY=function(o){var l=0,u=this.ldeviceExtY;return u!=0&&(l=this.lworldOrgY+(o-this.ldeviceOrgY)*this.lworldExtY/u),l},s.prototype.inverseTransformPoint=function(o){var l=new a(this.inverseTransformX(o.x),this.inverseTransformY(o.y));return l},r.exports=s}),(function(r,n,i){function a(f){if(Array.isArray(f)){for(var x=0,S=Array(f.length);x<f.length;x++)S[x]=f[x];return S}else return Array.from(f)}var s=i(15),o=i(4),l=i(0),u=i(8),c=i(9);function d(){s.call(this),this.useSmartIdealEdgeLengthCalculation=o.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=o.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=o.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=o.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=o.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.displacementThresholdPerNode=3*o.DEFAULT_EDGE_LENGTH/100,this.coolingFactor=o.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.initialCoolingFactor=o.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.totalDisplacement=0,this.oldTotalDisplacement=0,this.maxIterations=o.MAX_ITERATIONS}d.prototype=Object.create(s.prototype);for(var p in s)d[p]=s[p];d.prototype.initParameters=function(){s.prototype.initParameters.call(this,arguments),this.totalIterations=0,this.notAnimatedIterations=0,this.useFRGridVariant=o.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION,this.grid=[]},d.prototype.calcIdealEdgeLengths=function(){for(var f,x,S,v,m,b,w,_=this.getGraphManager().getAllEdges(),T=0;T<_.length;T++)f=_[T],x=f.idealLength,f.isInterGraph&&(v=f.getSource(),m=f.getTarget(),b=f.getSourceInLca().getEstimatedSize(),w=f.getTargetInLca().getEstimatedSize(),this.useSmartIdealEdgeLengthCalculation&&(f.idealLength+=b+w-2*l.SIMPLE_NODE_SIZE),S=f.getLca().getInclusionTreeDepth(),f.idealLength+=x*o.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR*(v.getInclusionTreeDepth()+m.getInclusionTreeDepth()-2*S))},d.prototype.initSpringEmbedder=function(){var f=this.getAllNodes().length;this.incremental?(f>o.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*o.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(f-o.ADAPTATION_LOWER_NODE_LIMIT)/(o.ADAPTATION_UPPER_NODE_LIMIT-o.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-o.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=o.MAX_NODE_DISPLACEMENT_INCREMENTAL):(f>o.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(o.COOLING_ADAPTATION_FACTOR,1-(f-o.ADAPTATION_LOWER_NODE_LIMIT)/(o.ADAPTATION_UPPER_NODE_LIMIT-o.ADAPTATION_LOWER_NODE_LIMIT)*(1-o.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=o.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.displacementThresholdPerNode=3*o.DEFAULT_EDGE_LENGTH/100,this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},d.prototype.calcSpringForces=function(){for(var f=this.getAllEdges(),x,S=0;S<f.length;S++)x=f[S],this.calcSpringForce(x,x.idealLength)},d.prototype.calcRepulsionForces=function(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,S,v,m,b,w=this.getAllNodes(),_;if(this.useFRGridVariant)for(this.totalIterations%o.GRID_CALCULATION_CHECK_PERIOD==1&&f&&this.updateGrid(),_=new Set,S=0;S<w.length;S++)m=w[S],this.calculateRepulsionForceOfANode(m,_,f,x),_.add(m);else for(S=0;S<w.length;S++)for(m=w[S],v=S+1;v<w.length;v++)b=w[v],m.getOwner()==b.getOwner()&&this.calcRepulsionForce(m,b)},d.prototype.calcGravitationalForces=function(){for(var f,x=this.getAllNodesToApplyGravitation(),S=0;S<x.length;S++)f=x[S],this.calcGravitationalForce(f)},d.prototype.moveNodes=function(){for(var f=this.getAllNodes(),x,S=0;S<f.length;S++)x=f[S],x.move()},d.prototype.calcSpringForce=function(f,x){var S=f.getSource(),v=f.getTarget(),m,b,w,_;if(this.uniformLeafNodeSizes&&S.getChild()==null&&v.getChild()==null)f.updateLengthSimple();else if(f.updateLength(),f.isOverlapingSourceAndTarget)return;m=f.getLength(),m!=0&&(b=f.edgeElasticity*(m-x),w=b*(f.lengthX/m),_=b*(f.lengthY/m),S.springForceX+=w,S.springForceY+=_,v.springForceX-=w,v.springForceY-=_)},d.prototype.calcRepulsionForce=function(f,x){var S=f.getRect(),v=x.getRect(),m=new Array(2),b=new Array(4),w,_,T,N,E,k,L;if(S.intersects(v)){u.calcSeparationAmount(S,v,m,o.DEFAULT_EDGE_LENGTH/2),k=2*m[0],L=2*m[1];var A=f.noOfChildren*x.noOfChildren/(f.noOfChildren+x.noOfChildren);f.repulsionForceX-=A*k,f.repulsionForceY-=A*L,x.repulsionForceX+=A*k,x.repulsionForceY+=A*L}else this.uniformLeafNodeSizes&&f.getChild()==null&&x.getChild()==null?(w=v.getCenterX()-S.getCenterX(),_=v.getCenterY()-S.getCenterY()):(u.getIntersection(S,v,b),w=b[2]-b[0],_=b[3]-b[1]),Math.abs(w)<o.MIN_REPULSION_DIST&&(w=c.sign(w)*o.MIN_REPULSION_DIST),Math.abs(_)<o.MIN_REPULSION_DIST&&(_=c.sign(_)*o.MIN_REPULSION_DIST),T=w*w+_*_,N=Math.sqrt(T),E=(f.nodeRepulsion/2+x.nodeRepulsion/2)*f.noOfChildren*x.noOfChildren/T,k=E*w/N,L=E*_/N,f.repulsionForceX-=k,f.repulsionForceY-=L,x.repulsionForceX+=k,x.repulsionForceY+=L},d.prototype.calcGravitationalForce=function(f){var x,S,v,m,b,w,_,T;x=f.getOwner(),S=(x.getRight()+x.getLeft())/2,v=(x.getTop()+x.getBottom())/2,m=f.getCenterX()-S,b=f.getCenterY()-v,w=Math.abs(m)+f.getWidth()/2,_=Math.abs(b)+f.getHeight()/2,f.getOwner()==this.graphManager.getRoot()?(T=x.getEstimatedSize()*this.gravityRangeFactor,(w>T||_>T)&&(f.gravitationForceX=-this.gravityConstant*m,f.gravitationForceY=-this.gravityConstant*b)):(T=x.getEstimatedSize()*this.compoundGravityRangeFactor,(w>T||_>T)&&(f.gravitationForceX=-this.gravityConstant*m*this.compoundGravityConstant,f.gravitationForceY=-this.gravityConstant*b*this.compoundGravityConstant))},d.prototype.isConverged=function(){var f,x=!1;return this.totalIterations>this.maxIterations/3&&(x=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),f=this.totalDisplacement<this.totalDisplacementThreshold,this.oldTotalDisplacement=this.totalDisplacement,f||x},d.prototype.animate=function(){this.animationDuringLayout&&!this.isSubLayout&&(this.notAnimatedIterations==this.animationPeriod?(this.update(),this.notAnimatedIterations=0):this.notAnimatedIterations++)},d.prototype.calcNoOfChildrenForAllNodes=function(){for(var f,x=this.graphManager.getAllNodes(),S=0;S<x.length;S++)f=x[S],f.noOfChildren=f.getNoOfChildren()},d.prototype.calcGrid=function(f){var x=0,S=0;x=parseInt(Math.ceil((f.getRight()-f.getLeft())/this.repulsionRange)),S=parseInt(Math.ceil((f.getBottom()-f.getTop())/this.repulsionRange));for(var v=new Array(x),m=0;m<x;m++)v[m]=new Array(S);for(var m=0;m<x;m++)for(var b=0;b<S;b++)v[m][b]=new Array;return v},d.prototype.addNodeToGrid=function(f,x,S){var v=0,m=0,b=0,w=0;v=parseInt(Math.floor((f.getRect().x-x)/this.repulsionRange)),m=parseInt(Math.floor((f.getRect().width+f.getRect().x-x)/this.repulsionRange)),b=parseInt(Math.floor((f.getRect().y-S)/this.repulsionRange)),w=parseInt(Math.floor((f.getRect().height+f.getRect().y-S)/this.repulsionRange));for(var _=v;_<=m;_++)for(var T=b;T<=w;T++)this.grid[_][T].push(f),f.setGridCoordinates(v,m,b,w)},d.prototype.updateGrid=function(){var f,x,S=this.getAllNodes();for(this.grid=this.calcGrid(this.graphManager.getRoot()),f=0;f<S.length;f++)x=S[f],this.addNodeToGrid(x,this.graphManager.getRoot().getLeft(),this.graphManager.getRoot().getTop())},d.prototype.calculateRepulsionForceOfANode=function(f,x,S,v){if(this.totalIterations%o.GRID_CALCULATION_CHECK_PERIOD==1&&S||v){var m=new Set;f.surrounding=new Array;for(var b,w=this.grid,_=f.startX-1;_<f.finishX+2;_++)for(var T=f.startY-1;T<f.finishY+2;T++)if(!(_<0||T<0||_>=w.length||T>=w[0].length)){for(var N=0;N<w[_][T].length;N++)if(b=w[_][T][N],!(f.getOwner()!=b.getOwner()||f==b)&&!x.has(b)&&!m.has(b)){var E=Math.abs(f.getCenterX()-b.getCenterX())-(f.getWidth()/2+b.getWidth()/2),k=Math.abs(f.getCenterY()-b.getCenterY())-(f.getHeight()/2+b.getHeight()/2);E<=this.repulsionRange&&k<=this.repulsionRange&&m.add(b)}}f.surrounding=[].concat(a(m))}for(_=0;_<f.surrounding.length;_++)this.calcRepulsionForce(f,f.surrounding[_])},d.prototype.calcRepulsionRange=function(){return 0},r.exports=d}),(function(r,n,i){var a=i(1),s=i(4);function o(u,c,d){a.call(this,u,c,d),this.idealLength=s.DEFAULT_EDGE_LENGTH,this.edgeElasticity=s.DEFAULT_SPRING_STRENGTH}o.prototype=Object.create(a.prototype);for(var l in a)o[l]=a[l];r.exports=o}),(function(r,n,i){var a=i(3),s=i(4);function o(u,c,d,p){a.call(this,u,c,d,p),this.nodeRepulsion=s.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=[]}o.prototype=Object.create(a.prototype);for(var l in a)o[l]=a[l];o.prototype.setGridCoordinates=function(u,c,d,p){this.startX=u,this.finishX=c,this.startY=d,this.finishY=p},r.exports=o}),(function(r,n,i){function a(s,o){this.width=0,this.height=0,s!==null&&o!==null&&(this.height=o,this.width=s)}a.prototype.getWidth=function(){return this.width},a.prototype.setWidth=function(s){this.width=s},a.prototype.getHeight=function(){return this.height},a.prototype.setHeight=function(s){this.height=s},r.exports=a}),(function(r,n,i){var a=i(14);function s(){this.map={},this.keys=[]}s.prototype.put=function(o,l){var u=a.createID(o);this.contains(u)||(this.map[u]=l,this.keys.push(o))},s.prototype.contains=function(o){return a.createID(o),this.map[o]!=null},s.prototype.get=function(o){var l=a.createID(o);return this.map[l]},s.prototype.keySet=function(){return this.keys},r.exports=s}),(function(r,n,i){var a=i(14);function s(){this.set={}}s.prototype.add=function(o){var l=a.createID(o);this.contains(l)||(this.set[l]=o)},s.prototype.remove=function(o){delete this.set[a.createID(o)]},s.prototype.clear=function(){this.set={}},s.prototype.contains=function(o){return this.set[a.createID(o)]==o},s.prototype.isEmpty=function(){return this.size()===0},s.prototype.size=function(){return Object.keys(this.set).length},s.prototype.addAllTo=function(o){for(var l=Object.keys(this.set),u=l.length,c=0;c<u;c++)o.push(this.set[l[c]])},s.prototype.size=function(){return Object.keys(this.set).length},s.prototype.addAll=function(o){for(var l=o.length,u=0;u<l;u++){var c=o[u];this.add(c)}},r.exports=s}),(function(r,n,i){function a(){}a.multMat=function(s,o){for(var l=[],u=0;u<s.length;u++){l[u]=[];for(var c=0;c<o[0].length;c++){l[u][c]=0;for(var d=0;d<s[0].length;d++)l[u][c]+=s[u][d]*o[d][c]}}return l},a.transpose=function(s){for(var o=[],l=0;l<s[0].length;l++){o[l]=[];for(var u=0;u<s.length;u++)o[l][u]=s[u][l]}return o},a.multCons=function(s,o){for(var l=[],u=0;u<s.length;u++)l[u]=s[u]*o;return l},a.minusOp=function(s,o){for(var l=[],u=0;u<s.length;u++)l[u]=s[u]-o[u];return l},a.dotProduct=function(s,o){for(var l=0,u=0;u<s.length;u++)l+=s[u]*o[u];return l},a.mag=function(s){return Math.sqrt(this.dotProduct(s,s))},a.normalize=function(s){for(var o=[],l=this.mag(s),u=0;u<s.length;u++)o[u]=s[u]/l;return o},a.multGamma=function(s){for(var o=[],l=0,u=0;u<s.length;u++)l+=s[u];l*=-1/s.length;for(var c=0;c<s.length;c++)o[c]=l+s[c];return o},a.multL=function(s,o,l){for(var u=[],c=[],d=[],p=0;p<o[0].length;p++){for(var f=0,x=0;x<o.length;x++)f+=-.5*o[x][p]*s[x];c[p]=f}for(var S=0;S<l.length;S++){for(var v=0,m=0;m<l.length;m++)v+=l[S][m]*c[m];d[S]=v}for(var b=0;b<o.length;b++){for(var w=0,_=0;_<o[0].length;_++)w+=o[b][_]*d[_];u[b]=w}return u},r.exports=a}),(function(r,n,i){var a=(function(){function u(c,d){for(var p=0;p<d.length;p++){var f=d[p];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(c,f.key,f)}}return function(c,d,p){return d&&u(c.prototype,d),p&&u(c,p),c}})();function s(u,c){if(!(u instanceof c))throw new TypeError("Cannot call a class as a function")}var o=i(11),l=(function(){function u(c,d){s(this,u),(d!==null||d!==void 0)&&(this.compareFunction=this._defaultCompareFunction);var p=void 0;c instanceof o?p=c.size():p=c.length,this._quicksort(c,0,p-1)}return a(u,[{key:"_quicksort",value:function(d,p,f){if(p<f){var x=this._partition(d,p,f);this._quicksort(d,p,x),this._quicksort(d,x+1,f)}}},{key:"_partition",value:function(d,p,f){for(var x=this._get(d,p),S=p,v=f;;){for(;this.compareFunction(x,this._get(d,v));)v--;for(;this.compareFunction(this._get(d,S),x);)S++;if(S<v)this._swap(d,S,v),S++,v--;else return v}}},{key:"_get",value:function(d,p){return d instanceof o?d.get_object_at(p):d[p]}},{key:"_set",value:function(d,p,f){d instanceof o?d.set_object_at(p,f):d[p]=f}},{key:"_swap",value:function(d,p,f){var x=this._get(d,p);this._set(d,p,this._get(d,f)),this._set(d,f,x)}},{key:"_defaultCompareFunction",value:function(d,p){return p>d}}]),u})();r.exports=l}),(function(r,n,i){function a(){}a.svd=function(s){this.U=null,this.V=null,this.s=null,this.m=0,this.n=0,this.m=s.length,this.n=s[0].length;var o=Math.min(this.m,this.n);this.s=(function(ft){for(var ut=[];ft-- >0;)ut.push(0);return ut})(Math.min(this.m+1,this.n)),this.U=(function(ft){var ut=function Ft(Tt){if(Tt.length==0)return 0;for(var Vt=[],jt=0;jt<Tt[0];jt++)Vt.push(Ft(Tt.slice(1)));return Vt};return ut(ft)})([this.m,o]),this.V=(function(ft){var ut=function Ft(Tt){if(Tt.length==0)return 0;for(var Vt=[],jt=0;jt<Tt[0];jt++)Vt.push(Ft(Tt.slice(1)));return Vt};return ut(ft)})([this.n,this.n]);for(var l=(function(ft){for(var ut=[];ft-- >0;)ut.push(0);return ut})(this.n),u=(function(ft){for(var ut=[];ft-- >0;)ut.push(0);return ut})(this.m),c=!0,d=Math.min(this.m-1,this.n),p=Math.max(0,Math.min(this.n-2,this.m)),f=0;f<Math.max(d,p);f++){if(f<d){this.s[f]=0;for(var x=f;x<this.m;x++)this.s[f]=a.hypot(this.s[f],s[x][f]);if(this.s[f]!==0){s[f][f]<0&&(this.s[f]=-this.s[f]);for(var S=f;S<this.m;S++)s[S][f]/=this.s[f];s[f][f]+=1}this.s[f]=-this.s[f]}for(var v=f+1;v<this.n;v++){if((function(ft,ut){return ft&&ut})(f<d,this.s[f]!==0)){for(var m=0,b=f;b<this.m;b++)m+=s[b][f]*s[b][v];m=-m/s[f][f];for(var w=f;w<this.m;w++)s[w][v]+=m*s[w][f]}l[v]=s[f][v]}if((function(ft,ut){return ut})(c,f<d))for(var _=f;_<this.m;_++)this.U[_][f]=s[_][f];if(f<p){l[f]=0;for(var T=f+1;T<this.n;T++)l[f]=a.hypot(l[f],l[T]);if(l[f]!==0){l[f+1]<0&&(l[f]=-l[f]);for(var N=f+1;N<this.n;N++)l[N]/=l[f];l[f+1]+=1}if(l[f]=-l[f],(function(ft,ut){return ft&&ut})(f+1<this.m,l[f]!==0)){for(var E=f+1;E<this.m;E++)u[E]=0;for(var k=f+1;k<this.n;k++)for(var L=f+1;L<this.m;L++)u[L]+=l[k]*s[L][k];for(var A=f+1;A<this.n;A++)for(var M=-l[A]/l[f+1],O=f+1;O<this.m;O++)s[O][A]+=M*u[O]}for(var $=f+1;$<this.n;$++)this.V[$][f]=l[$]}}var D=Math.min(this.n,this.m+1);d<this.n&&(this.s[d]=s[d][d]),this.m<D&&(this.s[D-1]=0),p+1<D&&(l[p]=s[p][D-1]),l[D-1]=0;{for(var B=d;B<o;B++){for(var j=0;j<this.m;j++)this.U[j][B]=0;this.U[B][B]=1}for(var I=d-1;I>=0;I--)if(this.s[I]!==0){for(var U=I+1;U<o;U++){for(var F=0,P=I;P<this.m;P++)F+=this.U[P][I]*this.U[P][U];F=-F/this.U[I][I];for(var H=I;H<this.m;H++)this.U[H][U]+=F*this.U[H][I]}for(var W=I;W<this.m;W++)this.U[W][I]=-this.U[W][I];this.U[I][I]=1+this.U[I][I];for(var V=0;V<I-1;V++)this.U[V][I]=0}else{for(var re=0;re<this.m;re++)this.U[re][I]=0;this.U[I][I]=1}}for(var J=this.n-1;J>=0;J--){if((function(ft,ut){return ft&&ut})(J<p,l[J]!==0))for(var ne=J+1;ne<o;ne++){for(var X=0,q=J+1;q<this.n;q++)X+=this.V[q][J]*this.V[q][ne];X=-X/this.V[J+1][J];for(var Y=J+1;Y<this.n;Y++)this.V[Y][ne]+=X*this.V[Y][J]}for(var Q=0;Q<this.n;Q++)this.V[Q][J]=0;this.V[J][J]=1}for(var te=D-1,ie=Math.pow(2,-52),le=Math.pow(2,-966);D>0;){var pe=void 0,Le=void 0;for(pe=D-2;pe>=-1&&pe!==-1;pe--)if(Math.abs(l[pe])<=le+ie*(Math.abs(this.s[pe])+Math.abs(this.s[pe+1]))){l[pe]=0;break}if(pe===D-2)Le=4;else{var je=void 0;for(je=D-1;je>=pe&&je!==pe;je--){var Se=(je!==D?Math.abs(l[je]):0)+(je!==pe+1?Math.abs(l[je-1]):0);if(Math.abs(this.s[je])<=le+ie*Se){this.s[je]=0;break}}je===pe?Le=3:je===D-1?Le=1:(Le=2,pe=je)}switch(pe++,Le){case 1:{var Te=l[D-2];l[D-2]=0;for(var Ae=D-2;Ae>=pe;Ae--){var Ne=a.hypot(this.s[Ae],Te),Pe=this.s[Ae]/Ne,ze=Te/Ne;this.s[Ae]=Ne,Ae!==pe&&(Te=-ze*l[Ae-1],l[Ae-1]=Pe*l[Ae-1]);for(var Ie=0;Ie<this.n;Ie++)Ne=Pe*this.V[Ie][Ae]+ze*this.V[Ie][D-1],this.V[Ie][D-1]=-ze*this.V[Ie][Ae]+Pe*this.V[Ie][D-1],this.V[Ie][Ae]=Ne}}break;case 2:{var $e=l[pe-1];l[pe-1]=0;for(var Ge=pe;Ge<D;Ge++){var ve=a.hypot(this.s[Ge],$e),Ee=this.s[Ge]/ve,Me=$e/ve;this.s[Ge]=ve,$e=-Me*l[Ge],l[Ge]=Ee*l[Ge];for(var ye=0;ye<this.m;ye++)ve=Ee*this.U[ye][Ge]+Me*this.U[ye][pe-1],this.U[ye][pe-1]=-Me*this.U[ye][Ge]+Ee*this.U[ye][pe-1],this.U[ye][Ge]=ve}}break;case 3:{var ee=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[pe])),Math.abs(l[pe])),ue=this.s[D-1]/ee,ae=this.s[D-2]/ee,se=l[D-2]/ee,ce=this.s[pe]/ee,be=l[pe]/ee,he=((ae+ue)*(ae-ue)+se*se)/2,de=ue*se*(ue*se),me=0;(function(ft,ut){return ft||ut})(he!==0,de!==0)&&(me=Math.sqrt(he*he+de),he<0&&(me=-me),me=de/(he+me));for(var ke=(ce+ue)*(ce-ue)+me,Re=ce*be,Ce=pe;Ce<D-1;Ce++){var De=a.hypot(ke,Re),Qe=ke/De,Xe=Re/De;Ce!==pe&&(l[Ce-1]=De),ke=Qe*this.s[Ce]+Xe*l[Ce],l[Ce]=Qe*l[Ce]-Xe*this.s[Ce],Re=Xe*this.s[Ce+1],this.s[Ce+1]=Qe*this.s[Ce+1];for(var yt=0;yt<this.n;yt++)De=Qe*this.V[yt][Ce]+Xe*this.V[yt][Ce+1],this.V[yt][Ce+1]=-Xe*this.V[yt][Ce]+Qe*this.V[yt][Ce+1],this.V[yt][Ce]=De;if(De=a.hypot(ke,Re),Qe=ke/De,Xe=Re/De,this.s[Ce]=De,ke=Qe*l[Ce]+Xe*this.s[Ce+1],this.s[Ce+1]=-Xe*l[Ce]+Qe*this.s[Ce+1],Re=Xe*l[Ce+1],l[Ce+1]=Qe*l[Ce+1],Ce<this.m-1)for(var et=0;et<this.m;et++)De=Qe*this.U[et][Ce]+Xe*this.U[et][Ce+1],this.U[et][Ce+1]=-Xe*this.U[et][Ce]+Qe*this.U[et][Ce+1],this.U[et][Ce]=De}l[D-2]=ke}break;case 4:{if(this.s[pe]<=0){this.s[pe]=this.s[pe]<0?-this.s[pe]:0;for(var Ze=0;Ze<=te;Ze++)this.V[Ze][pe]=-this.V[Ze][pe]}for(;pe<te&&!(this.s[pe]>=this.s[pe+1]);){var ct=this.s[pe];if(this.s[pe]=this.s[pe+1],this.s[pe+1]=ct,pe<this.n-1)for(var tt=0;tt<this.n;tt++)ct=this.V[tt][pe+1],this.V[tt][pe+1]=this.V[tt][pe],this.V[tt][pe]=ct;if(pe<this.m-1)for(var Ye=0;Ye<this.m;Ye++)ct=this.U[Ye][pe+1],this.U[Ye][pe+1]=this.U[Ye][pe],this.U[Ye][pe]=ct;pe++}D--}break}}var kt={U:this.U,V:this.V,S:this.s};return kt},a.hypot=function(s,o){var l=void 0;return Math.abs(s)>Math.abs(o)?(l=o/s,l=Math.abs(s)*Math.sqrt(1+l*l)):o!=0?(l=s/o,l=Math.abs(o)*Math.sqrt(1+l*l)):l=0,l},r.exports=a}),(function(r,n,i){var a=(function(){function l(u,c){for(var d=0;d<c.length;d++){var p=c[d];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(u,p.key,p)}}return function(u,c,d){return c&&l(u.prototype,c),d&&l(u,d),u}})();function s(l,u){if(!(l instanceof u))throw new TypeError("Cannot call a class as a function")}var o=(function(){function l(u,c){var d=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,p=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,f=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;s(this,l),this.sequence1=u,this.sequence2=c,this.match_score=d,this.mismatch_penalty=p,this.gap_penalty=f,this.iMax=u.length+1,this.jMax=c.length+1,this.grid=new Array(this.iMax);for(var x=0;x<this.iMax;x++){this.grid[x]=new Array(this.jMax);for(var S=0;S<this.jMax;S++)this.grid[x][S]=0}this.tracebackGrid=new Array(this.iMax);for(var v=0;v<this.iMax;v++){this.tracebackGrid[v]=new Array(this.jMax);for(var m=0;m<this.jMax;m++)this.tracebackGrid[v][m]=[null,null,null]}this.alignments=[],this.score=-1,this.computeGrids()}return a(l,[{key:"getScore",value:function(){return this.score}},{key:"getAlignments",value:function(){return this.alignments}},{key:"computeGrids",value:function(){for(var c=1;c<this.jMax;c++)this.grid[0][c]=this.grid[0][c-1]+this.gap_penalty,this.tracebackGrid[0][c]=[!1,!1,!0];for(var d=1;d<this.iMax;d++)this.grid[d][0]=this.grid[d-1][0]+this.gap_penalty,this.tracebackGrid[d][0]=[!1,!0,!1];for(var p=1;p<this.iMax;p++)for(var f=1;f<this.jMax;f++){var x=void 0;this.sequence1[p-1]===this.sequence2[f-1]?x=this.grid[p-1][f-1]+this.match_score:x=this.grid[p-1][f-1]+this.mismatch_penalty;var S=this.grid[p-1][f]+this.gap_penalty,v=this.grid[p][f-1]+this.gap_penalty,m=[x,S,v],b=this.arrayAllMaxIndexes(m);this.grid[p][f]=m[b[0]],this.tracebackGrid[p][f]=[b.includes(0),b.includes(1),b.includes(2)]}this.score=this.grid[this.iMax-1][this.jMax-1]}},{key:"alignmentTraceback",value:function(){var c=[];for(c.push({pos:[this.sequence1.length,this.sequence2.length],seq1:"",seq2:""});c[0];){var d=c[0],p=this.tracebackGrid[d.pos[0]][d.pos[1]];p[0]&&c.push({pos:[d.pos[0]-1,d.pos[1]-1],seq1:this.sequence1[d.pos[0]-1]+d.seq1,seq2:this.sequence2[d.pos[1]-1]+d.seq2}),p[1]&&c.push({pos:[d.pos[0]-1,d.pos[1]],seq1:this.sequence1[d.pos[0]-1]+d.seq1,seq2:"-"+d.seq2}),p[2]&&c.push({pos:[d.pos[0],d.pos[1]-1],seq1:"-"+d.seq1,seq2:this.sequence2[d.pos[1]-1]+d.seq2}),d.pos[0]===0&&d.pos[1]===0&&this.alignments.push({sequence1:d.seq1,sequence2:d.seq2}),c.shift()}return this.alignments}},{key:"getAllIndexes",value:function(c,d){for(var p=[],f=-1;(f=c.indexOf(d,f+1))!==-1;)p.push(f);return p}},{key:"arrayAllMaxIndexes",value:function(c){return this.getAllIndexes(c,Math.max.apply(null,c))}}]),l})();r.exports=o}),(function(r,n,i){var a=function(){};a.FDLayout=i(18),a.FDLayoutConstants=i(4),a.FDLayoutEdge=i(19),a.FDLayoutNode=i(20),a.DimensionD=i(21),a.HashMap=i(22),a.HashSet=i(23),a.IGeometry=i(8),a.IMath=i(9),a.Integer=i(10),a.Point=i(12),a.PointD=i(5),a.RandomSeed=i(16),a.RectangleD=i(13),a.Transform=i(17),a.UniqueIDGeneretor=i(14),a.Quicksort=i(25),a.LinkedList=i(11),a.LGraphObject=i(2),a.LGraph=i(6),a.LEdge=i(1),a.LGraphManager=i(7),a.LNode=i(3),a.Layout=i(15),a.LayoutConstants=i(0),a.NeedlemanWunsch=i(27),a.Matrix=i(24),a.SVD=i(26),r.exports=a}),(function(r,n,i){function a(){this.listeners=[]}var s=a.prototype;s.addListener=function(o,l){this.listeners.push({event:o,callback:l})},s.removeListener=function(o,l){for(var u=this.listeners.length;u>=0;u--){var c=this.listeners[u];c.event===o&&c.callback===l&&this.listeners.splice(u,1)}},s.emit=function(o,l){for(var u=0;u<this.listeners.length;u++){var c=this.listeners[u];o===c.event&&c.callback(l)}},r.exports=a})])})})(md)),md.exports}var _O=vd.exports,e2;function CO(){return e2||(e2=1,(function(t,e){(function(n,i){t.exports=i(SO())})(_O,function(r){return(()=>{var n={45:((o,l,u)=>{var c={};c.layoutBase=u(551),c.CoSEConstants=u(806),c.CoSEEdge=u(767),c.CoSEGraph=u(880),c.CoSEGraphManager=u(578),c.CoSELayout=u(765),c.CoSENode=u(991),c.ConstraintHandler=u(902),o.exports=c}),806:((o,l,u)=>{var c=u(551).FDLayoutConstants;function d(){}for(var p in c)d[p]=c[p];d.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,d.DEFAULT_RADIAL_SEPARATION=c.DEFAULT_EDGE_LENGTH,d.DEFAULT_COMPONENT_SEPERATION=60,d.TILE=!0,d.TILING_PADDING_VERTICAL=10,d.TILING_PADDING_HORIZONTAL=10,d.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,d.ENFORCE_CONSTRAINTS=!0,d.APPLY_LAYOUT=!0,d.RELAX_MOVEMENT_ON_CONSTRAINTS=!0,d.TREE_REDUCTION_ON_INCREMENTAL=!0,d.PURE_INCREMENTAL=d.DEFAULT_INCREMENTAL,o.exports=d}),767:((o,l,u)=>{var c=u(551).FDLayoutEdge;function d(f,x,S){c.call(this,f,x,S)}d.prototype=Object.create(c.prototype);for(var p in c)d[p]=c[p];o.exports=d}),880:((o,l,u)=>{var c=u(551).LGraph;function d(f,x,S){c.call(this,f,x,S)}d.prototype=Object.create(c.prototype);for(var p in c)d[p]=c[p];o.exports=d}),578:((o,l,u)=>{var c=u(551).LGraphManager;function d(f){c.call(this,f)}d.prototype=Object.create(c.prototype);for(var p in c)d[p]=c[p];o.exports=d}),765:((o,l,u)=>{var c=u(551).FDLayout,d=u(578),p=u(880),f=u(991),x=u(767),S=u(806),v=u(902),m=u(551).FDLayoutConstants,b=u(551).LayoutConstants,w=u(551).Point,_=u(551).PointD,T=u(551).DimensionD,N=u(551).Layout,E=u(551).Integer,k=u(551).IGeometry,L=u(551).LGraph,A=u(551).Transform,M=u(551).LinkedList;function O(){c.call(this),this.toBeTiled={},this.constraints={}}O.prototype=Object.create(c.prototype);for(var $ in c)O[$]=c[$];O.prototype.newGraphManager=function(){var D=new d(this);return this.graphManager=D,D},O.prototype.newGraph=function(D){return new p(null,this.graphManager,D)},O.prototype.newNode=function(D){return new f(this.graphManager,D)},O.prototype.newEdge=function(D){return new x(null,null,D)},O.prototype.initParameters=function(){c.prototype.initParameters.call(this,arguments),this.isSubLayout||(S.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=S.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=S.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)},O.prototype.initSpringEmbedder=function(){c.prototype.initSpringEmbedder.call(this),this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/m.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=.04,this.coolingAdjuster=1},O.prototype.layout=function(){var D=b.DEFAULT_CREATE_BENDS_AS_NEEDED;return D&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},O.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(S.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var B=new Set(this.getAllNodes()),j=this.nodesWithGravity.filter(function(F){return B.has(F)});this.graphManager.setAllNodesToApplyGravitation(j)}}else{var D=this.getFlatForest();if(D.length>0)this.positionNodesRadially(D);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var B=new Set(this.getAllNodes()),j=this.nodesWithGravity.filter(function(I){return B.has(I)});this.graphManager.setAllNodesToApplyGravitation(j),this.positionNodesRandomly()}}return Object.keys(this.constraints).length>0&&(v.handleConstraints(this),this.initConstraintVariables()),this.initSpringEmbedder(),S.APPLY_LAYOUT&&this.runSpringEmbedder(),!0},O.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()),B=this.nodesWithGravity.filter(function(U){return D.has(U)});this.graphManager.setAllNodesToApplyGravitation(B),this.graphManager.updateBounds(),this.updateGrid(),S.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()),S.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 j=!this.isTreeGrowing&&!this.isGrowthFinished,I=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(j,I),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},O.prototype.getPositionsData=function(){for(var D=this.graphManager.getAllNodes(),B={},j=0;j<D.length;j++){var I=D[j].rect,U=D[j].id;B[U]={id:U,x:I.getCenterX(),y:I.getCenterY(),w:I.width,h:I.height}}return B},O.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()}},O.prototype.moveNodes=function(){for(var D=this.getAllNodes(),B,j=0;j<D.length;j++)B=D[j],B.calculateDisplacement();Object.keys(this.constraints).length>0&&this.updateDisplacements();for(var j=0;j<D.length;j++)B=D[j],B.move()},O.prototype.initConstraintVariables=function(){var D=this;this.idToNodeMap=new Map,this.fixedNodeSet=new Set;for(var B=this.graphManager.getAllNodes(),j=0;j<B.length;j++){var I=B[j];this.idToNodeMap.set(I.id,I)}var U=function Y(Q){for(var te=Q.getChild().getNodes(),ie,le=0,pe=0;pe<te.length;pe++)ie=te[pe],ie.getChild()==null?D.fixedNodeSet.has(ie.id)&&(le+=100):le+=Y(ie);return le};if(this.constraints.fixedNodeConstraint){this.constraints.fixedNodeConstraint.forEach(function(te){D.fixedNodeSet.add(te.nodeId)});for(var B=this.graphManager.getAllNodes(),I,j=0;j<B.length;j++)if(I=B[j],I.getChild()!=null){var F=U(I);F>0&&(I.fixedNodeWeight=F)}}if(this.constraints.relativePlacementConstraint){var P=new Map,H=new Map;if(this.dummyToNodeForVerticalAlignment=new Map,this.dummyToNodeForHorizontalAlignment=new Map,this.fixedNodesOnHorizontal=new Set,this.fixedNodesOnVertical=new Set,this.fixedNodeSet.forEach(function(Y){D.fixedNodesOnHorizontal.add(Y),D.fixedNodesOnVertical.add(Y)}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var W=this.constraints.alignmentConstraint.vertical,j=0;j<W.length;j++)this.dummyToNodeForVerticalAlignment.set("dummy"+j,[]),W[j].forEach(function(Q){P.set(Q,"dummy"+j),D.dummyToNodeForVerticalAlignment.get("dummy"+j).push(Q),D.fixedNodeSet.has(Q)&&D.fixedNodesOnHorizontal.add("dummy"+j)});if(this.constraints.alignmentConstraint.horizontal)for(var V=this.constraints.alignmentConstraint.horizontal,j=0;j<V.length;j++)this.dummyToNodeForHorizontalAlignment.set("dummy"+j,[]),V[j].forEach(function(Q){H.set(Q,"dummy"+j),D.dummyToNodeForHorizontalAlignment.get("dummy"+j).push(Q),D.fixedNodeSet.has(Q)&&D.fixedNodesOnVertical.add("dummy"+j)})}if(S.RELAX_MOVEMENT_ON_CONSTRAINTS)this.shuffle=function(Y){var Q,te,ie;for(ie=Y.length-1;ie>=2*Y.length/3;ie--)Q=Math.floor(Math.random()*(ie+1)),te=Y[ie],Y[ie]=Y[Q],Y[Q]=te;return Y},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(Y){if(Y.left){var Q=P.has(Y.left)?P.get(Y.left):Y.left,te=P.has(Y.right)?P.get(Y.right):Y.right;D.nodesInRelativeHorizontal.includes(Q)||(D.nodesInRelativeHorizontal.push(Q),D.nodeToRelativeConstraintMapHorizontal.set(Q,[]),D.dummyToNodeForVerticalAlignment.has(Q)?D.nodeToTempPositionMapHorizontal.set(Q,D.idToNodeMap.get(D.dummyToNodeForVerticalAlignment.get(Q)[0]).getCenterX()):D.nodeToTempPositionMapHorizontal.set(Q,D.idToNodeMap.get(Q).getCenterX())),D.nodesInRelativeHorizontal.includes(te)||(D.nodesInRelativeHorizontal.push(te),D.nodeToRelativeConstraintMapHorizontal.set(te,[]),D.dummyToNodeForVerticalAlignment.has(te)?D.nodeToTempPositionMapHorizontal.set(te,D.idToNodeMap.get(D.dummyToNodeForVerticalAlignment.get(te)[0]).getCenterX()):D.nodeToTempPositionMapHorizontal.set(te,D.idToNodeMap.get(te).getCenterX())),D.nodeToRelativeConstraintMapHorizontal.get(Q).push({right:te,gap:Y.gap}),D.nodeToRelativeConstraintMapHorizontal.get(te).push({left:Q,gap:Y.gap})}else{var ie=H.has(Y.top)?H.get(Y.top):Y.top,le=H.has(Y.bottom)?H.get(Y.bottom):Y.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(le)||(D.nodesInRelativeVertical.push(le),D.nodeToRelativeConstraintMapVertical.set(le,[]),D.dummyToNodeForHorizontalAlignment.has(le)?D.nodeToTempPositionMapVertical.set(le,D.idToNodeMap.get(D.dummyToNodeForHorizontalAlignment.get(le)[0]).getCenterY()):D.nodeToTempPositionMapVertical.set(le,D.idToNodeMap.get(le).getCenterY())),D.nodeToRelativeConstraintMapVertical.get(ie).push({bottom:le,gap:Y.gap}),D.nodeToRelativeConstraintMapVertical.get(le).push({top:ie,gap:Y.gap})}});else{var re=new Map,J=new Map;this.constraints.relativePlacementConstraint.forEach(function(Y){if(Y.left){var Q=P.has(Y.left)?P.get(Y.left):Y.left,te=P.has(Y.right)?P.get(Y.right):Y.right;re.has(Q)?re.get(Q).push(te):re.set(Q,[te]),re.has(te)?re.get(te).push(Q):re.set(te,[Q])}else{var ie=H.has(Y.top)?H.get(Y.top):Y.top,le=H.has(Y.bottom)?H.get(Y.bottom):Y.bottom;J.has(ie)?J.get(ie).push(le):J.set(ie,[le]),J.has(le)?J.get(le).push(ie):J.set(le,[ie])}});var ne=function(Q,te){var ie=[],le=[],pe=new M,Le=new Set,je=0;return Q.forEach(function(Se,Te){if(!Le.has(Te)){ie[je]=[],le[je]=!1;var Ae=Te;for(pe.push(Ae),Le.add(Ae),ie[je].push(Ae);pe.length!=0;){Ae=pe.shift(),te.has(Ae)&&(le[je]=!0);var Ne=Q.get(Ae);Ne.forEach(function(Pe){Le.has(Pe)||(pe.push(Pe),Le.add(Pe),ie[je].push(Pe))})}je++}}),{components:ie,isFixed:le}},X=ne(re,D.fixedNodesOnHorizontal);this.componentsOnHorizontal=X.components,this.fixedComponentsOnHorizontal=X.isFixed;var q=ne(J,D.fixedNodesOnVertical);this.componentsOnVertical=q.components,this.fixedComponentsOnVertical=q.isFixed}}},O.prototype.updateDisplacements=function(){var D=this;if(this.constraints.fixedNodeConstraint&&this.constraints.fixedNodeConstraint.forEach(function(q){var Y=D.idToNodeMap.get(q.nodeId);Y.displacementX=0,Y.displacementY=0}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var B=this.constraints.alignmentConstraint.vertical,j=0;j<B.length;j++){for(var I=0,U=0;U<B[j].length;U++){if(this.fixedNodeSet.has(B[j][U])){I=0;break}I+=this.idToNodeMap.get(B[j][U]).displacementX}for(var F=I/B[j].length,U=0;U<B[j].length;U++)this.idToNodeMap.get(B[j][U]).displacementX=F}if(this.constraints.alignmentConstraint.horizontal)for(var P=this.constraints.alignmentConstraint.horizontal,j=0;j<P.length;j++){for(var H=0,U=0;U<P[j].length;U++){if(this.fixedNodeSet.has(P[j][U])){H=0;break}H+=this.idToNodeMap.get(P[j][U]).displacementY}for(var W=H/P[j].length,U=0;U<P[j].length;U++)this.idToNodeMap.get(P[j][U]).displacementY=W}}if(this.constraints.relativePlacementConstraint)if(S.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 Y=0;D.dummyToNodeForVerticalAlignment.has(q)?Y=D.idToNodeMap.get(D.dummyToNodeForVerticalAlignment.get(q)[0]).displacementX:Y=D.idToNodeMap.get(q).displacementX,D.nodeToRelativeConstraintMapHorizontal.get(q).forEach(function(Q){if(Q.right){var te=D.nodeToTempPositionMapHorizontal.get(Q.right)-D.nodeToTempPositionMapHorizontal.get(q)-Y;te<Q.gap&&(Y-=Q.gap-te)}else{var te=D.nodeToTempPositionMapHorizontal.get(q)-D.nodeToTempPositionMapHorizontal.get(Q.left)+Y;te<Q.gap&&(Y+=Q.gap-te)}}),D.nodeToTempPositionMapHorizontal.set(q,D.nodeToTempPositionMapHorizontal.get(q)+Y),D.dummyToNodeForVerticalAlignment.has(q)?D.dummyToNodeForVerticalAlignment.get(q).forEach(function(Q){D.idToNodeMap.get(Q).displacementX=Y}):D.idToNodeMap.get(q).displacementX=Y}}),this.nodesInRelativeVertical.forEach(function(q){if(!D.fixedNodesOnHorizontal.has(q)){var Y=0;D.dummyToNodeForHorizontalAlignment.has(q)?Y=D.idToNodeMap.get(D.dummyToNodeForHorizontalAlignment.get(q)[0]).displacementY:Y=D.idToNodeMap.get(q).displacementY,D.nodeToRelativeConstraintMapVertical.get(q).forEach(function(Q){if(Q.bottom){var te=D.nodeToTempPositionMapVertical.get(Q.bottom)-D.nodeToTempPositionMapVertical.get(q)-Y;te<Q.gap&&(Y-=Q.gap-te)}else{var te=D.nodeToTempPositionMapVertical.get(q)-D.nodeToTempPositionMapVertical.get(Q.top)+Y;te<Q.gap&&(Y+=Q.gap-te)}}),D.nodeToTempPositionMapVertical.set(q,D.nodeToTempPositionMapVertical.get(q)+Y),D.dummyToNodeForHorizontalAlignment.has(q)?D.dummyToNodeForHorizontalAlignment.get(q).forEach(function(Q){D.idToNodeMap.get(Q).displacementY=Y}):D.idToNodeMap.get(q).displacementY=Y}});else{for(var j=0;j<this.componentsOnHorizontal.length;j++){var V=this.componentsOnHorizontal[j];if(this.fixedComponentsOnHorizontal[j])for(var U=0;U<V.length;U++)this.dummyToNodeForVerticalAlignment.has(V[U])?this.dummyToNodeForVerticalAlignment.get(V[U]).forEach(function(Q){D.idToNodeMap.get(Q).displacementX=0}):this.idToNodeMap.get(V[U]).displacementX=0;else{for(var re=0,J=0,U=0;U<V.length;U++)if(this.dummyToNodeForVerticalAlignment.has(V[U])){var ne=this.dummyToNodeForVerticalAlignment.get(V[U]);re+=ne.length*this.idToNodeMap.get(ne[0]).displacementX,J+=ne.length}else re+=this.idToNodeMap.get(V[U]).displacementX,J++;for(var X=re/J,U=0;U<V.length;U++)this.dummyToNodeForVerticalAlignment.has(V[U])?this.dummyToNodeForVerticalAlignment.get(V[U]).forEach(function(Q){D.idToNodeMap.get(Q).displacementX=X}):this.idToNodeMap.get(V[U]).displacementX=X}}for(var j=0;j<this.componentsOnVertical.length;j++){var V=this.componentsOnVertical[j];if(this.fixedComponentsOnVertical[j])for(var U=0;U<V.length;U++)this.dummyToNodeForHorizontalAlignment.has(V[U])?this.dummyToNodeForHorizontalAlignment.get(V[U]).forEach(function(te){D.idToNodeMap.get(te).displacementY=0}):this.idToNodeMap.get(V[U]).displacementY=0;else{for(var re=0,J=0,U=0;U<V.length;U++)if(this.dummyToNodeForHorizontalAlignment.has(V[U])){var ne=this.dummyToNodeForHorizontalAlignment.get(V[U]);re+=ne.length*this.idToNodeMap.get(ne[0]).displacementY,J+=ne.length}else re+=this.idToNodeMap.get(V[U]).displacementY,J++;for(var X=re/J,U=0;U<V.length;U++)this.dummyToNodeForHorizontalAlignment.has(V[U])?this.dummyToNodeForHorizontalAlignment.get(V[U]).forEach(function(pe){D.idToNodeMap.get(pe).displacementY=X}):this.idToNodeMap.get(V[U]).displacementY=X}}}},O.prototype.calculateNodesToApplyGravitationTo=function(){var D=[],B,j=this.graphManager.getGraphs(),I=j.length,U;for(U=0;U<I;U++)B=j[U],B.updateConnected(),B.isConnected||(D=D.concat(B.getNodes()));return D},O.prototype.createBendpoints=function(){var D=[];D=D.concat(this.graphManager.getAllEdges());var B=new Set,j;for(j=0;j<D.length;j++){var I=D[j];if(!B.has(I)){var U=I.getSource(),F=I.getTarget();if(U==F)I.getBendpoints().push(new _),I.getBendpoints().push(new _),this.createDummyNodesForBendpoints(I),B.add(I);else{var P=[];if(P=P.concat(U.getEdgeListToNode(F)),P=P.concat(F.getEdgeListToNode(U)),!B.has(P[0])){if(P.length>1){var H;for(H=0;H<P.length;H++){var W=P[H];W.getBendpoints().push(new _),this.createDummyNodesForBendpoints(W)}}P.forEach(function(V){B.add(V)})}}}if(B.size==D.length)break}},O.prototype.positionNodesRadially=function(D){for(var B=new w(0,0),j=Math.ceil(Math.sqrt(D.length)),I=0,U=0,F=0,P=new _(0,0),H=0;H<D.length;H++){H%j==0&&(F=0,U=I,H!=0&&(U+=S.DEFAULT_COMPONENT_SEPERATION),I=0);var W=D[H],V=N.findCenterOfTree(W);B.x=F,B.y=U,P=O.radialLayout(W,V,B),P.y>I&&(I=Math.floor(P.y)),F=Math.floor(P.x+S.DEFAULT_COMPONENT_SEPERATION)}this.transform(new _(b.WORLD_CENTER_X-P.x/2,b.WORLD_CENTER_Y-P.y/2))},O.radialLayout=function(D,B,j){var I=Math.max(this.maxDiagonalInTree(D),S.DEFAULT_RADIAL_SEPARATION);O.branchRadialLayout(B,null,0,359,0,I);var U=L.calculateBounds(D),F=new A;F.setDeviceOrgX(U.getMinX()),F.setDeviceOrgY(U.getMinY()),F.setWorldOrgX(j.x),F.setWorldOrgY(j.y);for(var P=0;P<D.length;P++){var H=D[P];H.transform(F)}var W=new _(U.getMaxX(),U.getMaxY());return F.inverseTransformPoint(W)},O.branchRadialLayout=function(D,B,j,I,U,F){var P=(I-j+1)/2;P<0&&(P+=180);var H=(P+j)%360,W=H*k.TWO_PI/360,V=U*Math.cos(W),re=U*Math.sin(W);D.setCenter(V,re);var J=[];J=J.concat(D.getEdges());var ne=J.length;B!=null&&ne--;for(var X=0,q=J.length,Y,Q=D.getEdgesBetween(B);Q.length>1;){var te=Q[0];Q.splice(0,1);var ie=J.indexOf(te);ie>=0&&J.splice(ie,1),q--,ne--}B!=null?Y=(J.indexOf(Q[0])+1)%q:Y=0;for(var le=Math.abs(I-j)/ne,pe=Y;X!=ne;pe=++pe%q){var Le=J[pe].getOtherEnd(D);if(Le!=B){var je=(j+X*le)%360,Se=(je+le)%360;O.branchRadialLayout(Le,D,je,Se,U+F,F),X++}}},O.maxDiagonalInTree=function(D){for(var B=E.MIN_VALUE,j=0;j<D.length;j++){var I=D[j],U=I.getDiagonal();U>B&&(B=U)}return B},O.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},O.prototype.groupZeroDegreeMembers=function(){var D=this,B={};this.memberGroups={},this.idToDummyNode={};for(var j=[],I=this.graphManager.getAllNodes(),U=0;U<I.length;U++){var F=I[U],P=F.getParent();this.getNodeDegreeWithChildren(F)===0&&(P.id==null||!this.getToBeTiled(P))&&j.push(F)}for(var U=0;U<j.length;U++){var F=j[U],H=F.getParent().id;typeof B[H]>"u"&&(B[H]=[]),B[H]=B[H].concat(F)}Object.keys(B).forEach(function(W){if(B[W].length>1){var V="DummyCompound_"+W;D.memberGroups[V]=B[W];var re=B[W][0].getParent(),J=new f(D.graphManager);J.id=V,J.paddingLeft=re.paddingLeft||0,J.paddingRight=re.paddingRight||0,J.paddingBottom=re.paddingBottom||0,J.paddingTop=re.paddingTop||0,D.idToDummyNode[V]=J;var ne=D.getGraphManager().add(D.newGraph(),J),X=re.getChild();X.add(J);for(var q=0;q<B[W].length;q++){var Y=B[W][q];X.remove(Y),ne.add(Y)}}})},O.prototype.clearCompounds=function(){var D={},B={};this.performDFSOnCompounds();for(var j=0;j<this.compoundOrder.length;j++)B[this.compoundOrder[j].id]=this.compoundOrder[j],D[this.compoundOrder[j].id]=[].concat(this.compoundOrder[j].getChild().getNodes()),this.graphManager.remove(this.compoundOrder[j].getChild()),this.compoundOrder[j].child=null;this.graphManager.resetAllNodes(),this.tileCompoundMembers(D,B)},O.prototype.clearZeroDegreeMembers=function(){var D=this,B=this.tiledZeroDegreePack=[];Object.keys(this.memberGroups).forEach(function(j){var I=D.idToDummyNode[j];if(B[j]=D.tileNodes(D.memberGroups[j],I.paddingLeft+I.paddingRight),I.rect.width=B[j].width,I.rect.height=B[j].height,I.setCenter(B[j].centerX,B[j].centerY),I.labelMarginLeft=0,I.labelMarginTop=0,S.NODE_DIMENSIONS_INCLUDE_LABELS){var U=I.rect.width,F=I.rect.height;I.labelWidth&&(I.labelPosHorizontal=="left"?(I.rect.x-=I.labelWidth,I.setWidth(U+I.labelWidth),I.labelMarginLeft=I.labelWidth):I.labelPosHorizontal=="center"&&I.labelWidth>U?(I.rect.x-=(I.labelWidth-U)/2,I.setWidth(I.labelWidth),I.labelMarginLeft=(I.labelWidth-U)/2):I.labelPosHorizontal=="right"&&I.setWidth(U+I.labelWidth)),I.labelHeight&&(I.labelPosVertical=="top"?(I.rect.y-=I.labelHeight,I.setHeight(F+I.labelHeight),I.labelMarginTop=I.labelHeight):I.labelPosVertical=="center"&&I.labelHeight>F?(I.rect.y-=(I.labelHeight-F)/2,I.setHeight(I.labelHeight),I.labelMarginTop=(I.labelHeight-F)/2):I.labelPosVertical=="bottom"&&I.setHeight(F+I.labelHeight))}})},O.prototype.repopulateCompounds=function(){for(var D=this.compoundOrder.length-1;D>=0;D--){var B=this.compoundOrder[D],j=B.id,I=B.paddingLeft,U=B.paddingTop,F=B.labelMarginLeft,P=B.labelMarginTop;this.adjustLocations(this.tiledMemberPack[j],B.rect.x,B.rect.y,I,U,F,P)}},O.prototype.repopulateZeroDegreeMembers=function(){var D=this,B=this.tiledZeroDegreePack;Object.keys(B).forEach(function(j){var I=D.idToDummyNode[j],U=I.paddingLeft,F=I.paddingTop,P=I.labelMarginLeft,H=I.labelMarginTop;D.adjustLocations(B[j],I.rect.x,I.rect.y,U,F,P,H)})},O.prototype.getToBeTiled=function(D){var B=D.id;if(this.toBeTiled[B]!=null)return this.toBeTiled[B];var j=D.getChild();if(j==null)return this.toBeTiled[B]=!1,!1;for(var I=j.getNodes(),U=0;U<I.length;U++){var F=I[U];if(this.getNodeDegree(F)>0)return this.toBeTiled[B]=!1,!1;if(F.getChild()==null){this.toBeTiled[F.id]=!1;continue}if(!this.getToBeTiled(F))return this.toBeTiled[B]=!1,!1}return this.toBeTiled[B]=!0,!0},O.prototype.getNodeDegree=function(D){D.id;for(var B=D.getEdges(),j=0,I=0;I<B.length;I++){var U=B[I];U.getSource().id!==U.getTarget().id&&(j=j+1)}return j},O.prototype.getNodeDegreeWithChildren=function(D){var B=this.getNodeDegree(D);if(D.getChild()==null)return B;for(var j=D.getChild().getNodes(),I=0;I<j.length;I++){var U=j[I];B+=this.getNodeDegreeWithChildren(U)}return B},O.prototype.performDFSOnCompounds=function(){this.compoundOrder=[],this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes())},O.prototype.fillCompexOrderByDFS=function(D){for(var B=0;B<D.length;B++){var j=D[B];j.getChild()!=null&&this.fillCompexOrderByDFS(j.getChild().getNodes()),this.getToBeTiled(j)&&this.compoundOrder.push(j)}},O.prototype.adjustLocations=function(D,B,j,I,U,F,P){B+=I+F,j+=U+P;for(var H=B,W=0;W<D.rows.length;W++){var V=D.rows[W];B=H;for(var re=0,J=0;J<V.length;J++){var ne=V[J];ne.rect.x=B,ne.rect.y=j,B+=ne.rect.width+D.horizontalPadding,ne.rect.height>re&&(re=ne.rect.height)}j+=re+D.verticalPadding}},O.prototype.tileCompoundMembers=function(D,B){var j=this;this.tiledMemberPack=[],Object.keys(D).forEach(function(I){var U=B[I];if(j.tiledMemberPack[I]=j.tileNodes(D[I],U.paddingLeft+U.paddingRight),U.rect.width=j.tiledMemberPack[I].width,U.rect.height=j.tiledMemberPack[I].height,U.setCenter(j.tiledMemberPack[I].centerX,j.tiledMemberPack[I].centerY),U.labelMarginLeft=0,U.labelMarginTop=0,S.NODE_DIMENSIONS_INCLUDE_LABELS){var F=U.rect.width,P=U.rect.height;U.labelWidth&&(U.labelPosHorizontal=="left"?(U.rect.x-=U.labelWidth,U.setWidth(F+U.labelWidth),U.labelMarginLeft=U.labelWidth):U.labelPosHorizontal=="center"&&U.labelWidth>F?(U.rect.x-=(U.labelWidth-F)/2,U.setWidth(U.labelWidth),U.labelMarginLeft=(U.labelWidth-F)/2):U.labelPosHorizontal=="right"&&U.setWidth(F+U.labelWidth)),U.labelHeight&&(U.labelPosVertical=="top"?(U.rect.y-=U.labelHeight,U.setHeight(P+U.labelHeight),U.labelMarginTop=U.labelHeight):U.labelPosVertical=="center"&&U.labelHeight>P?(U.rect.y-=(U.labelHeight-P)/2,U.setHeight(U.labelHeight),U.labelMarginTop=(U.labelHeight-P)/2):U.labelPosVertical=="bottom"&&U.setHeight(P+U.labelHeight))}})},O.prototype.tileNodes=function(D,B){var j=this.tileNodesByFavoringDim(D,B,!0),I=this.tileNodesByFavoringDim(D,B,!1),U=this.getOrgRatio(j),F=this.getOrgRatio(I),P;return F<U?P=I:P=j,P},O.prototype.getOrgRatio=function(D){var B=D.width,j=D.height,I=B/j;return I<1&&(I=1/I),I},O.prototype.calcIdealRowWidth=function(D,B){var j=S.TILING_PADDING_VERTICAL,I=S.TILING_PADDING_HORIZONTAL,U=D.length,F=0,P=0,H=0;D.forEach(function(q){F+=q.getWidth(),P+=q.getHeight(),q.getWidth()>H&&(H=q.getWidth())});var W=F/U,V=P/U,re=Math.pow(j-I,2)+4*(W+I)*(V+j)*U,J=(I-j+Math.sqrt(re))/(2*(W+I)),ne;B?(ne=Math.ceil(J),ne==J&&ne++):ne=Math.floor(J);var X=ne*(W+I)-I;return H>X&&(X=H),X+=I*2,X},O.prototype.tileNodesByFavoringDim=function(D,B,j){var I=S.TILING_PADDING_VERTICAL,U=S.TILING_PADDING_HORIZONTAL,F=S.TILING_COMPARE_BY,P={rows:[],rowWidth:[],rowHeight:[],width:0,height:B,verticalPadding:I,horizontalPadding:U,centerX:0,centerY:0};F&&(P.idealRowWidth=this.calcIdealRowWidth(D,j));var H=function(Y){return Y.rect.width*Y.rect.height},W=function(Y,Q){return H(Q)-H(Y)};D.sort(function(q,Y){var Q=W;return P.idealRowWidth?(Q=F,Q(q.id,Y.id)):Q(q,Y)});for(var V=0,re=0,J=0;J<D.length;J++){var ne=D[J];V+=ne.getCenterX(),re+=ne.getCenterY()}P.centerX=V/D.length,P.centerY=re/D.length;for(var J=0;J<D.length;J++){var ne=D[J];if(P.rows.length==0)this.insertNodeToRow(P,ne,0,B);else if(this.canAddHorizontal(P,ne.rect.width,ne.rect.height)){var X=P.rows.length-1;P.idealRowWidth||(X=this.getShortestRowIndex(P)),this.insertNodeToRow(P,ne,X,B)}else this.insertNodeToRow(P,ne,P.rows.length,B);this.shiftToLastRow(P)}return P},O.prototype.insertNodeToRow=function(D,B,j,I){var U=I;if(j==D.rows.length){var F=[];D.rows.push(F),D.rowWidth.push(U),D.rowHeight.push(0)}var P=D.rowWidth[j]+B.rect.width;D.rows[j].length>0&&(P+=D.horizontalPadding),D.rowWidth[j]=P,D.width<P&&(D.width=P);var H=B.rect.height;j>0&&(H+=D.verticalPadding);var W=0;H>D.rowHeight[j]&&(W=D.rowHeight[j],D.rowHeight[j]=H,W=D.rowHeight[j]-W),D.height+=W,D.rows[j].push(B)},O.prototype.getShortestRowIndex=function(D){for(var B=-1,j=Number.MAX_VALUE,I=0;I<D.rows.length;I++)D.rowWidth[I]<j&&(B=I,j=D.rowWidth[I]);return B},O.prototype.getLongestRowIndex=function(D){for(var B=-1,j=Number.MIN_VALUE,I=0;I<D.rows.length;I++)D.rowWidth[I]>j&&(B=I,j=D.rowWidth[I]);return B},O.prototype.canAddHorizontal=function(D,B,j){if(D.idealRowWidth){var I=D.rows.length-1,U=D.rowWidth[I];return U+B+D.horizontalPadding<=D.idealRowWidth}var F=this.getShortestRowIndex(D);if(F<0)return!0;var P=D.rowWidth[F];if(P+D.horizontalPadding+B<=D.width)return!0;var H=0;D.rowHeight[F]<j&&F>0&&(H=j+D.verticalPadding-D.rowHeight[F]);var W;D.width-P>=B+D.horizontalPadding?W=(D.height+H)/(P+B+D.horizontalPadding):W=(D.height+H)/D.width,H=j+D.verticalPadding;var V;return D.width<B?V=(D.height+H)/B:V=(D.height+H)/D.width,V<1&&(V=1/V),W<1&&(W=1/W),W<V},O.prototype.shiftToLastRow=function(D){var B=this.getLongestRowIndex(D),j=D.rowWidth.length-1,I=D.rows[B],U=I[I.length-1],F=U.width+D.horizontalPadding;if(D.width-D.rowWidth[j]>F&&B!=j){I.splice(-1,1),D.rows[j].push(U),D.rowWidth[B]=D.rowWidth[B]-F,D.rowWidth[j]=D.rowWidth[j]+F,D.width=D.rowWidth[instance.getLongestRowIndex(D)];for(var P=Number.MIN_VALUE,H=0;H<I.length;H++)I[H].height>P&&(P=I[H].height);B>0&&(P+=D.verticalPadding);var W=D.rowHeight[B]+D.rowHeight[j];D.rowHeight[B]=P,D.rowHeight[j]<U.height+D.verticalPadding&&(D.rowHeight[j]=U.height+D.verticalPadding);var V=D.rowHeight[B]+D.rowHeight[j];D.height+=V-W,this.shiftToLastRow(D)}},O.prototype.tilingPreLayout=function(){S.TILE&&(this.groupZeroDegreeMembers(),this.clearCompounds(),this.clearZeroDegreeMembers())},O.prototype.tilingPostLayout=function(){S.TILE&&(this.repopulateZeroDegreeMembers(),this.repopulateCompounds())},O.prototype.reduceTrees=function(){for(var D=[],B=!0,j;B;){var I=this.graphManager.getAllNodes(),U=[];B=!1;for(var F=0;F<I.length;F++)if(j=I[F],j.getEdges().length==1&&!j.getEdges()[0].isInterGraph&&j.getChild()==null){if(S.PURE_INCREMENTAL){var P=j.getEdges()[0].getOtherEnd(j),H=new T(j.getCenterX()-P.getCenterX(),j.getCenterY()-P.getCenterY());U.push([j,j.getEdges()[0],j.getOwner(),H])}else U.push([j,j.getEdges()[0],j.getOwner()]);B=!0}if(B==!0){for(var W=[],V=0;V<U.length;V++)U[V][0].getEdges().length==1&&(W.push(U[V]),U[V][0].getOwner().remove(U[V][0]));D.push(W),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()}}this.prunedNodesAll=D},O.prototype.growTree=function(D){for(var B=D.length,j=D[B-1],I,U=0;U<j.length;U++)I=j[U],this.findPlaceforPrunedNode(I),I[2].add(I[0]),I[2].add(I[1],I[1].source,I[1].target);D.splice(D.length-1,1),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()},O.prototype.findPlaceforPrunedNode=function(D){var B,j,I=D[0];if(I==D[1].source?j=D[1].target:j=D[1].source,S.PURE_INCREMENTAL)I.setCenter(j.getCenterX()+D[3].getWidth(),j.getCenterY()+D[3].getHeight());else{var U=j.startX,F=j.finishX,P=j.startY,H=j.finishY,W=0,V=0,re=0,J=0,ne=[W,re,V,J];if(P>0)for(var X=U;X<=F;X++)ne[0]+=this.grid[X][P-1].length+this.grid[X][P].length-1;if(F<this.grid.length-1)for(var X=P;X<=H;X++)ne[1]+=this.grid[F+1][X].length+this.grid[F][X].length-1;if(H<this.grid[0].length-1)for(var X=U;X<=F;X++)ne[2]+=this.grid[X][H+1].length+this.grid[X][H].length-1;if(U>0)for(var X=P;X<=H;X++)ne[3]+=this.grid[U-1][X].length+this.grid[U][X].length-1;for(var q=E.MAX_VALUE,Y,Q,te=0;te<ne.length;te++)ne[te]<q?(q=ne[te],Y=1,Q=te):ne[te]==q&&Y++;if(Y==3&&q==0)ne[0]==0&&ne[1]==0&&ne[2]==0?B=1:ne[0]==0&&ne[1]==0&&ne[3]==0?B=0:ne[0]==0&&ne[2]==0&&ne[3]==0?B=3:ne[1]==0&&ne[2]==0&&ne[3]==0&&(B=2);else if(Y==2&&q==0){var ie=Math.floor(Math.random()*2);ne[0]==0&&ne[1]==0?ie==0?B=0:B=1:ne[0]==0&&ne[2]==0?ie==0?B=0:B=2:ne[0]==0&&ne[3]==0?ie==0?B=0:B=3:ne[1]==0&&ne[2]==0?ie==0?B=1:B=2:ne[1]==0&&ne[3]==0?ie==0?B=1:B=3:ie==0?B=2:B=3}else if(Y==4&&q==0){var ie=Math.floor(Math.random()*4);B=ie}else B=Q;B==0?I.setCenter(j.getCenterX(),j.getCenterY()-j.getHeight()/2-m.DEFAULT_EDGE_LENGTH-I.getHeight()/2):B==1?I.setCenter(j.getCenterX()+j.getWidth()/2+m.DEFAULT_EDGE_LENGTH+I.getWidth()/2,j.getCenterY()):B==2?I.setCenter(j.getCenterX(),j.getCenterY()+j.getHeight()/2+m.DEFAULT_EDGE_LENGTH+I.getHeight()/2):I.setCenter(j.getCenterX()-j.getWidth()/2-m.DEFAULT_EDGE_LENGTH-I.getWidth()/2,j.getCenterY())}},o.exports=O}),991:((o,l,u)=>{var c=u(551).FDLayoutNode,d=u(551).IMath;function p(x,S,v,m){c.call(this,x,S,v,m)}p.prototype=Object.create(c.prototype);for(var f in c)p[f]=c[f];p.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*d.sign(this.displacementX)),Math.abs(this.displacementY)>x.coolingFactor*x.maxNodeDisplacement&&(this.displacementY=x.coolingFactor*x.maxNodeDisplacement*d.sign(this.displacementY)),this.child&&this.child.getNodes().length>0&&this.propogateDisplacementToChildren(this.displacementX,this.displacementY)},p.prototype.propogateDisplacementToChildren=function(x,S){for(var v=this.getChild().getNodes(),m,b=0;b<v.length;b++)m=v[b],m.getChild()==null?(m.displacementX+=x,m.displacementY+=S):m.propogateDisplacementToChildren(x,S)},p.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},p.prototype.setPred1=function(x){this.pred1=x},p.prototype.getPred1=function(){return pred1},p.prototype.getPred2=function(){return pred2},p.prototype.setNext=function(x){this.next=x},p.prototype.getNext=function(){return next},p.prototype.setProcessed=function(x){this.processed=x},p.prototype.isProcessed=function(){return processed},o.exports=p}),902:((o,l,u)=>{function c(v){if(Array.isArray(v)){for(var m=0,b=Array(v.length);m<v.length;m++)b[m]=v[m];return b}else return Array.from(v)}var d=u(806),p=u(551).LinkedList,f=u(551).Matrix,x=u(551).SVD;function S(){}S.handleConstraints=function(v){var m={};m.fixedNodeConstraint=v.constraints.fixedNodeConstraint,m.alignmentConstraint=v.constraints.alignmentConstraint,m.relativePlacementConstraint=v.constraints.relativePlacementConstraint;for(var b=new Map,w=new Map,_=[],T=[],N=v.getAllNodes(),E=0,k=0;k<N.length;k++){var L=N[k];L.getChild()==null&&(w.set(L.id,E++),_.push(L.getCenterX()),T.push(L.getCenterY()),b.set(L.id,L))}m.relativePlacementConstraint&&m.relativePlacementConstraint.forEach(function(ae){!ae.gap&&ae.gap!=0&&(ae.left?ae.gap=d.DEFAULT_EDGE_LENGTH+b.get(ae.left).getWidth()/2+b.get(ae.right).getWidth()/2:ae.gap=d.DEFAULT_EDGE_LENGTH+b.get(ae.top).getHeight()/2+b.get(ae.bottom).getHeight()/2)});var A=function(se,ce){return{x:se.x-ce.x,y:se.y-ce.y}},M=function(se){var ce=0,be=0;return se.forEach(function(he){ce+=_[w.get(he)],be+=T[w.get(he)]}),{x:ce/se.size,y:be/se.size}},O=function(se,ce,be,he,de){function me(et,Ze){var ct=new Set(et),tt=!0,Ye=!1,kt=void 0;try{for(var ft=Ze[Symbol.iterator](),ut;!(tt=(ut=ft.next()).done);tt=!0){var Ft=ut.value;ct.add(Ft)}}catch(Tt){Ye=!0,kt=Tt}finally{try{!tt&&ft.return&&ft.return()}finally{if(Ye)throw kt}}return ct}var ke=new Map;se.forEach(function(et,Ze){ke.set(Ze,0)}),se.forEach(function(et,Ze){et.forEach(function(ct){ke.set(ct.id,ke.get(ct.id)+1)})});var Re=new Map,Ce=new Map,De=new p;ke.forEach(function(et,Ze){et==0?(De.push(Ze),be||(ce=="horizontal"?Re.set(Ze,w.has(Ze)?_[w.get(Ze)]:he.get(Ze)):Re.set(Ze,w.has(Ze)?T[w.get(Ze)]:he.get(Ze)))):Re.set(Ze,Number.NEGATIVE_INFINITY),be&&Ce.set(Ze,new Set([Ze]))}),be&&de.forEach(function(et){var Ze=[];if(et.forEach(function(Ye){be.has(Ye)&&Ze.push(Ye)}),Ze.length>0){var ct=0;Ze.forEach(function(Ye){ce=="horizontal"?(Re.set(Ye,w.has(Ye)?_[w.get(Ye)]:he.get(Ye)),ct+=Re.get(Ye)):(Re.set(Ye,w.has(Ye)?T[w.get(Ye)]:he.get(Ye)),ct+=Re.get(Ye))}),ct=ct/Ze.length,et.forEach(function(Ye){be.has(Ye)||Re.set(Ye,ct)})}else{var tt=0;et.forEach(function(Ye){ce=="horizontal"?tt+=w.has(Ye)?_[w.get(Ye)]:he.get(Ye):tt+=w.has(Ye)?T[w.get(Ye)]:he.get(Ye)}),tt=tt/et.length,et.forEach(function(Ye){Re.set(Ye,tt)})}});for(var Qe=function(){var Ze=De.shift(),ct=se.get(Ze);ct.forEach(function(tt){if(Re.get(tt.id)<Re.get(Ze)+tt.gap)if(be&&be.has(tt.id)){var Ye=void 0;if(ce=="horizontal"?Ye=w.has(tt.id)?_[w.get(tt.id)]:he.get(tt.id):Ye=w.has(tt.id)?T[w.get(tt.id)]:he.get(tt.id),Re.set(tt.id,Ye),Ye<Re.get(Ze)+tt.gap){var kt=Re.get(Ze)+tt.gap-Ye;Ce.get(Ze).forEach(function(ft){Re.set(ft,Re.get(ft)-kt)})}}else Re.set(tt.id,Re.get(Ze)+tt.gap);ke.set(tt.id,ke.get(tt.id)-1),ke.get(tt.id)==0&&De.push(tt.id),be&&Ce.set(tt.id,me(Ce.get(Ze),Ce.get(tt.id)))})};De.length!=0;)Qe();if(be){var Xe=new Set;se.forEach(function(et,Ze){et.length==0&&Xe.add(Ze)});var yt=[];Ce.forEach(function(et,Ze){if(Xe.has(Ze)){var ct=!1,tt=!0,Ye=!1,kt=void 0;try{for(var ft=et[Symbol.iterator](),ut;!(tt=(ut=ft.next()).done);tt=!0){var Ft=ut.value;be.has(Ft)&&(ct=!0)}}catch(jt){Ye=!0,kt=jt}finally{try{!tt&&ft.return&&ft.return()}finally{if(Ye)throw kt}}if(!ct){var Tt=!1,Vt=void 0;yt.forEach(function(jt,vr){jt.has([].concat(c(et))[0])&&(Tt=!0,Vt=vr)}),Tt?et.forEach(function(jt){yt[Vt].add(jt)}):yt.push(new Set(et))}}}),yt.forEach(function(et,Ze){var ct=Number.POSITIVE_INFINITY,tt=Number.POSITIVE_INFINITY,Ye=Number.NEGATIVE_INFINITY,kt=Number.NEGATIVE_INFINITY,ft=!0,ut=!1,Ft=void 0;try{for(var Tt=et[Symbol.iterator](),Vt;!(ft=(Vt=Tt.next()).done);ft=!0){var jt=Vt.value,vr=void 0;ce=="horizontal"?vr=w.has(jt)?_[w.get(jt)]:he.get(jt):vr=w.has(jt)?T[w.get(jt)]:he.get(jt);var or=Re.get(jt);vr<ct&&(ct=vr),vr>Ye&&(Ye=vr),or<tt&&(tt=or),or>kt&&(kt=or)}}catch(Gn){ut=!0,Ft=Gn}finally{try{!ft&&Tt.return&&Tt.return()}finally{if(ut)throw Ft}}var ir=(ct+Ye)/2-(tt+kt)/2,zt=!0,Qr=!1,dr=void 0;try{for(var Dn=et[Symbol.iterator](),ki;!(zt=(ki=Dn.next()).done);zt=!0){var Vn=ki.value;Re.set(Vn,Re.get(Vn)+ir)}}catch(Gn){Qr=!0,dr=Gn}finally{try{!zt&&Dn.return&&Dn.return()}finally{if(Qr)throw dr}}})}return Re},$=function(se){var ce=0,be=0,he=0,de=0;if(se.forEach(function(Ce){Ce.left?_[w.get(Ce.left)]-_[w.get(Ce.right)]>=0?ce++:be++:T[w.get(Ce.top)]-T[w.get(Ce.bottom)]>=0?he++:de++}),ce>be&&he>de)for(var me=0;me<w.size;me++)_[me]=-1*_[me],T[me]=-1*T[me];else if(ce>be)for(var ke=0;ke<w.size;ke++)_[ke]=-1*_[ke];else if(he>de)for(var Re=0;Re<w.size;Re++)T[Re]=-1*T[Re]},D=function(se){var ce=[],be=new p,he=new Set,de=0;return se.forEach(function(me,ke){if(!he.has(ke)){ce[de]=[];var Re=ke;for(be.push(Re),he.add(Re),ce[de].push(Re);be.length!=0;){Re=be.shift();var Ce=se.get(Re);Ce.forEach(function(De){he.has(De.id)||(be.push(De.id),he.add(De.id),ce[de].push(De.id))})}de++}}),ce},B=function(se){var ce=new Map;return se.forEach(function(be,he){ce.set(he,[])}),se.forEach(function(be,he){be.forEach(function(de){ce.get(he).push(de),ce.get(de.id).push({id:he,gap:de.gap,direction:de.direction})})}),ce},j=function(se){var ce=new Map;return se.forEach(function(be,he){ce.set(he,[])}),se.forEach(function(be,he){be.forEach(function(de){ce.get(de.id).push({id:he,gap:de.gap,direction:de.direction})})}),ce},I=[],U=[],F=!1,P=!1,H=new Set,W=new Map,V=new Map,re=[];if(m.fixedNodeConstraint&&m.fixedNodeConstraint.forEach(function(ae){H.add(ae.nodeId)}),m.relativePlacementConstraint&&(m.relativePlacementConstraint.forEach(function(ae){ae.left?(W.has(ae.left)?W.get(ae.left).push({id:ae.right,gap:ae.gap,direction:"horizontal"}):W.set(ae.left,[{id:ae.right,gap:ae.gap,direction:"horizontal"}]),W.has(ae.right)||W.set(ae.right,[])):(W.has(ae.top)?W.get(ae.top).push({id:ae.bottom,gap:ae.gap,direction:"vertical"}):W.set(ae.top,[{id:ae.bottom,gap:ae.gap,direction:"vertical"}]),W.has(ae.bottom)||W.set(ae.bottom,[]))}),V=B(W),re=D(V)),d.TRANSFORM_ON_CONSTRAINT_HANDLING){if(m.fixedNodeConstraint&&m.fixedNodeConstraint.length>1)m.fixedNodeConstraint.forEach(function(ae,se){I[se]=[ae.position.x,ae.position.y],U[se]=[_[w.get(ae.nodeId)],T[w.get(ae.nodeId)]]}),F=!0;else if(m.alignmentConstraint)(function(){var ae=0;if(m.alignmentConstraint.vertical){for(var se=m.alignmentConstraint.vertical,ce=function(Re){var Ce=new Set;se[Re].forEach(function(Xe){Ce.add(Xe)});var De=new Set([].concat(c(Ce)).filter(function(Xe){return H.has(Xe)})),Qe=void 0;De.size>0?Qe=_[w.get(De.values().next().value)]:Qe=M(Ce).x,se[Re].forEach(function(Xe){I[ae]=[Qe,T[w.get(Xe)]],U[ae]=[_[w.get(Xe)],T[w.get(Xe)]],ae++})},be=0;be<se.length;be++)ce(be);F=!0}if(m.alignmentConstraint.horizontal){for(var he=m.alignmentConstraint.horizontal,de=function(Re){var Ce=new Set;he[Re].forEach(function(Xe){Ce.add(Xe)});var De=new Set([].concat(c(Ce)).filter(function(Xe){return H.has(Xe)})),Qe=void 0;De.size>0?Qe=_[w.get(De.values().next().value)]:Qe=M(Ce).y,he[Re].forEach(function(Xe){I[ae]=[_[w.get(Xe)],Qe],U[ae]=[_[w.get(Xe)],T[w.get(Xe)]],ae++})},me=0;me<he.length;me++)de(me);F=!0}m.relativePlacementConstraint&&(P=!0)})();else if(m.relativePlacementConstraint){for(var J=0,ne=0,X=0;X<re.length;X++)re[X].length>J&&(J=re[X].length,ne=X);if(J<V.size/2)$(m.relativePlacementConstraint),F=!1,P=!1;else{var q=new Map,Y=new Map,Q=[];re[ne].forEach(function(ae){W.get(ae).forEach(function(se){se.direction=="horizontal"?(q.has(ae)?q.get(ae).push(se):q.set(ae,[se]),q.has(se.id)||q.set(se.id,[]),Q.push({left:ae,right:se.id})):(Y.has(ae)?Y.get(ae).push(se):Y.set(ae,[se]),Y.has(se.id)||Y.set(se.id,[]),Q.push({top:ae,bottom:se.id}))})}),$(Q),P=!1;var te=O(q,"horizontal"),ie=O(Y,"vertical");re[ne].forEach(function(ae,se){U[se]=[_[w.get(ae)],T[w.get(ae)]],I[se]=[],te.has(ae)?I[se][0]=te.get(ae):I[se][0]=_[w.get(ae)],ie.has(ae)?I[se][1]=ie.get(ae):I[se][1]=T[w.get(ae)]}),F=!0}}if(F){for(var le=void 0,pe=f.transpose(I),Le=f.transpose(U),je=0;je<pe.length;je++)pe[je]=f.multGamma(pe[je]),Le[je]=f.multGamma(Le[je]);var Se=f.multMat(pe,f.transpose(Le)),Te=x.svd(Se);le=f.multMat(Te.V,f.transpose(Te.U));for(var Ae=0;Ae<w.size;Ae++){var Ne=[_[Ae],T[Ae]],Pe=[le[0][0],le[1][0]],ze=[le[0][1],le[1][1]];_[Ae]=f.dotProduct(Ne,Pe),T[Ae]=f.dotProduct(Ne,ze)}P&&$(m.relativePlacementConstraint)}}if(d.ENFORCE_CONSTRAINTS){if(m.fixedNodeConstraint&&m.fixedNodeConstraint.length>0){var Ie={x:0,y:0};m.fixedNodeConstraint.forEach(function(ae,se){var ce={x:_[w.get(ae.nodeId)],y:T[w.get(ae.nodeId)]},be=ae.position,he=A(be,ce);Ie.x+=he.x,Ie.y+=he.y}),Ie.x/=m.fixedNodeConstraint.length,Ie.y/=m.fixedNodeConstraint.length,_.forEach(function(ae,se){_[se]+=Ie.x}),T.forEach(function(ae,se){T[se]+=Ie.y}),m.fixedNodeConstraint.forEach(function(ae){_[w.get(ae.nodeId)]=ae.position.x,T[w.get(ae.nodeId)]=ae.position.y})}if(m.alignmentConstraint){if(m.alignmentConstraint.vertical)for(var $e=m.alignmentConstraint.vertical,Ge=function(se){var ce=new Set;$e[se].forEach(function(de){ce.add(de)});var be=new Set([].concat(c(ce)).filter(function(de){return H.has(de)})),he=void 0;be.size>0?he=_[w.get(be.values().next().value)]:he=M(ce).x,ce.forEach(function(de){H.has(de)||(_[w.get(de)]=he)})},ve=0;ve<$e.length;ve++)Ge(ve);if(m.alignmentConstraint.horizontal)for(var Ee=m.alignmentConstraint.horizontal,Me=function(se){var ce=new Set;Ee[se].forEach(function(de){ce.add(de)});var be=new Set([].concat(c(ce)).filter(function(de){return H.has(de)})),he=void 0;be.size>0?he=T[w.get(be.values().next().value)]:he=M(ce).y,ce.forEach(function(de){H.has(de)||(T[w.get(de)]=he)})},ye=0;ye<Ee.length;ye++)Me(ye)}m.relativePlacementConstraint&&(function(){var ae=new Map,se=new Map,ce=new Map,be=new Map,he=new Map,de=new Map,me=new Set,ke=new Set;if(H.forEach(function(Nt){me.add(Nt),ke.add(Nt)}),m.alignmentConstraint){if(m.alignmentConstraint.vertical)for(var Re=m.alignmentConstraint.vertical,Ce=function(dt){ce.set("dummy"+dt,[]),Re[dt].forEach(function(Rt){ae.set(Rt,"dummy"+dt),ce.get("dummy"+dt).push(Rt),H.has(Rt)&&me.add("dummy"+dt)}),he.set("dummy"+dt,_[w.get(Re[dt][0])])},De=0;De<Re.length;De++)Ce(De);if(m.alignmentConstraint.horizontal)for(var Qe=m.alignmentConstraint.horizontal,Xe=function(dt){be.set("dummy"+dt,[]),Qe[dt].forEach(function(Rt){se.set(Rt,"dummy"+dt),be.get("dummy"+dt).push(Rt),H.has(Rt)&&ke.add("dummy"+dt)}),de.set("dummy"+dt,T[w.get(Qe[dt][0])])},yt=0;yt<Qe.length;yt++)Xe(yt)}var et=new Map,Ze=new Map,ct=function(dt){W.get(dt).forEach(function(Rt){var Xt=void 0,Qt=void 0;Rt.direction=="horizontal"?(Xt=ae.get(dt)?ae.get(dt):dt,ae.get(Rt.id)?Qt={id:ae.get(Rt.id),gap:Rt.gap,direction:Rt.direction}:Qt=Rt,et.has(Xt)?et.get(Xt).push(Qt):et.set(Xt,[Qt]),et.has(Qt.id)||et.set(Qt.id,[])):(Xt=se.get(dt)?se.get(dt):dt,se.get(Rt.id)?Qt={id:se.get(Rt.id),gap:Rt.gap,direction:Rt.direction}:Qt=Rt,Ze.has(Xt)?Ze.get(Xt).push(Qt):Ze.set(Xt,[Qt]),Ze.has(Qt.id)||Ze.set(Qt.id,[]))})},tt=!0,Ye=!1,kt=void 0;try{for(var ft=W.keys()[Symbol.iterator](),ut;!(tt=(ut=ft.next()).done);tt=!0){var Ft=ut.value;ct(Ft)}}catch(Nt){Ye=!0,kt=Nt}finally{try{!tt&&ft.return&&ft.return()}finally{if(Ye)throw kt}}var Tt=B(et),Vt=B(Ze),jt=D(Tt),vr=D(Vt),or=j(et),ir=j(Ze),zt=[],Qr=[];jt.forEach(function(Nt,dt){zt[dt]=[],Nt.forEach(function(Rt){or.get(Rt).length==0&&zt[dt].push(Rt)})}),vr.forEach(function(Nt,dt){Qr[dt]=[],Nt.forEach(function(Rt){ir.get(Rt).length==0&&Qr[dt].push(Rt)})});var dr=O(et,"horizontal",me,he,zt),Dn=O(Ze,"vertical",ke,de,Qr),ki=function(dt){ce.get(dt)?ce.get(dt).forEach(function(Rt){_[w.get(Rt)]=dr.get(dt)}):_[w.get(dt)]=dr.get(dt)},Vn=!0,Gn=!1,Pa=void 0;try{for(var Ma=dr.keys()[Symbol.iterator](),Ss;!(Vn=(Ss=Ma.next()).done);Vn=!0){var Gt=Ss.value;ki(Gt)}}catch(Nt){Gn=!0,Pa=Nt}finally{try{!Vn&&Ma.return&&Ma.return()}finally{if(Gn)throw Pa}}var Ei=function(dt){be.get(dt)?be.get(dt).forEach(function(Rt){T[w.get(Rt)]=Dn.get(dt)}):T[w.get(dt)]=Dn.get(dt)},qn=!0,oi=!1,li=void 0;try{for(var Ui=Dn.keys()[Symbol.iterator](),Oa;!(qn=(Oa=Ui.next()).done);qn=!0){var Gt=Oa.value;Ei(Gt)}}catch(Nt){oi=!0,li=Nt}finally{try{!qn&&Ui.return&&Ui.return()}finally{if(oi)throw li}}})()}for(var ee=0;ee<N.length;ee++){var ue=N[ee];ue.getChild()==null&&ue.setCenter(_[w.get(ue.id)],T[w.get(ue.id)])}},o.exports=S}),551:(o=>{o.exports=r})},i={};function a(o){var l=i[o];if(l!==void 0)return l.exports;var u=i[o]={exports:{}};return n[o](u,u.exports,a),u.exports}var s=a(45);return s})()})})(vd)),vd.exports}var kO=gd.exports,t2;function EO(){return t2||(t2=1,(function(t,e){(function(n,i){t.exports=i(CO())})(kO,function(r){return(()=>{var n={658:(o=>{o.exports=Object.assign!=null?Object.assign.bind(Object):function(l){for(var u=arguments.length,c=Array(u>1?u-1:0),d=1;d<u;d++)c[d-1]=arguments[d];return c.forEach(function(p){Object.keys(p).forEach(function(f){return l[f]=p[f]})}),l}}),548:((o,l,u)=>{var c=(function(){function f(x,S){var v=[],m=!0,b=!1,w=void 0;try{for(var _=x[Symbol.iterator](),T;!(m=(T=_.next()).done)&&(v.push(T.value),!(S&&v.length===S));m=!0);}catch(N){b=!0,w=N}finally{try{!m&&_.return&&_.return()}finally{if(b)throw w}}return v}return function(x,S){if(Array.isArray(x))return x;if(Symbol.iterator in Object(x))return f(x,S);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),d=u(140).layoutBase.LinkedList,p={};p.getTopMostNodes=function(f){for(var x={},S=0;S<f.length;S++)x[f[S].id()]=!0;var v=f.filter(function(m,b){typeof m=="number"&&(m=b);for(var w=m.parent()[0];w!=null;){if(x[w.id()])return!1;w=w.parent()[0]}return!0});return v},p.connectComponents=function(f,x,S,v){var m=new d,b=new Set,w=[],_=void 0,T=void 0,N=void 0,E=!1,k=1,L=[],A=[],M=function(){var $=f.collection();A.push($);var D=S[0],B=f.collection();B.merge(D).merge(D.descendants().intersection(x)),w.push(D),B.forEach(function(U){m.push(U),b.add(U),$.merge(U)});for(var j=function(){D=m.shift();var F=f.collection();D.neighborhood().nodes().forEach(function(V){x.intersection(D.edgesWith(V)).length>0&&F.merge(V)});for(var P=0;P<F.length;P++){var H=F[P];if(_=S.intersection(H.union(H.ancestors())),_!=null&&!b.has(_[0])){var W=_.union(_.descendants());W.forEach(function(V){m.push(V),b.add(V),$.merge(V),S.has(V)&&w.push(V)})}}};m.length!=0;)j();if($.forEach(function(U){x.intersection(U.connectedEdges()).forEach(function(F){$.has(F.source())&&$.has(F.target())&&$.merge(F)})}),w.length==S.length&&(E=!0),!E||E&&k>1){T=w[0],N=T.connectedEdges().length,w.forEach(function(U){U.connectedEdges().length<N&&(N=U.connectedEdges().length,T=U)}),L.push(T.id());var I=f.collection();I.merge(w[0]),w.forEach(function(U){I.merge(U)}),w=[],S=S.difference(I),k++}};do M();while(!E);return v&&L.length>0&&v.set("dummy"+(v.size+1),L),A},p.relocateComponent=function(f,x,S){if(!S.fixedNodeConstraint){var v=Number.POSITIVE_INFINITY,m=Number.NEGATIVE_INFINITY,b=Number.POSITIVE_INFINITY,w=Number.NEGATIVE_INFINITY;if(S.quality=="draft"){var _=!0,T=!1,N=void 0;try{for(var E=x.nodeIndexes[Symbol.iterator](),k;!(_=(k=E.next()).done);_=!0){var L=k.value,A=c(L,2),M=A[0],O=A[1],$=S.cy.getElementById(M);if($){var D=$.boundingBox(),B=x.xCoords[O]-D.w/2,j=x.xCoords[O]+D.w/2,I=x.yCoords[O]-D.h/2,U=x.yCoords[O]+D.h/2;B<v&&(v=B),j>m&&(m=j),I<b&&(b=I),U>w&&(w=U)}}}catch(V){T=!0,N=V}finally{try{!_&&E.return&&E.return()}finally{if(T)throw N}}var F=f.x-(m+v)/2,P=f.y-(w+b)/2;x.xCoords=x.xCoords.map(function(V){return V+F}),x.yCoords=x.yCoords.map(function(V){return V+P})}else{Object.keys(x).forEach(function(V){var re=x[V],J=re.getRect().x,ne=re.getRect().x+re.getRect().width,X=re.getRect().y,q=re.getRect().y+re.getRect().height;J<v&&(v=J),ne>m&&(m=ne),X<b&&(b=X),q>w&&(w=q)});var H=f.x-(m+v)/2,W=f.y-(w+b)/2;Object.keys(x).forEach(function(V){var re=x[V];re.setCenter(re.getCenterX()+H,re.getCenterY()+W)})}}},p.calcBoundingBox=function(f,x,S,v){for(var m=Number.MAX_SAFE_INTEGER,b=Number.MIN_SAFE_INTEGER,w=Number.MAX_SAFE_INTEGER,_=Number.MIN_SAFE_INTEGER,T=void 0,N=void 0,E=void 0,k=void 0,L=f.descendants().not(":parent"),A=L.length,M=0;M<A;M++){var O=L[M];T=x[v.get(O.id())]-O.width()/2,N=x[v.get(O.id())]+O.width()/2,E=S[v.get(O.id())]-O.height()/2,k=S[v.get(O.id())]+O.height()/2,m>T&&(m=T),b<N&&(b=N),w>E&&(w=E),_<k&&(_=k)}var $={};return $.topLeftX=m,$.topLeftY=w,$.width=b-m,$.height=_-w,$},p.calcParentsWithoutChildren=function(f,x){var S=f.collection();return x.nodes(":parent").forEach(function(v){var m=!1;v.children().forEach(function(b){b.css("display")!="none"&&(m=!0)}),m||S.merge(v)}),S},o.exports=p}),816:((o,l,u)=>{var c=u(548),d=u(140).CoSELayout,p=u(140).CoSENode,f=u(140).layoutBase.PointD,x=u(140).layoutBase.DimensionD,S=u(140).layoutBase.LayoutConstants,v=u(140).layoutBase.FDLayoutConstants,m=u(140).CoSEConstants,b=function(_,T){var N=_.cy,E=_.eles,k=E.nodes(),L=E.edges(),A=void 0,M=void 0,O=void 0,$={};_.randomize&&(A=T.nodeIndexes,M=T.xCoords,O=T.yCoords);var D=function(V){return typeof V=="function"},B=function(V,re){return D(V)?V(re):V},j=c.calcParentsWithoutChildren(N,E),I=function W(V,re,J,ne){for(var X=re.length,q=0;q<X;q++){var Y=re[q],Q=null;Y.intersection(j).length==0&&(Q=Y.children());var te=void 0,ie=Y.layoutDimensions({nodeDimensionsIncludeLabels:ne.nodeDimensionsIncludeLabels});if(Y.outerWidth()!=null&&Y.outerHeight()!=null)if(ne.randomize)if(!Y.isParent())te=V.add(new p(J.graphManager,new f(M[A.get(Y.id())]-ie.w/2,O[A.get(Y.id())]-ie.h/2),new x(parseFloat(ie.w),parseFloat(ie.h))));else{var le=c.calcBoundingBox(Y,M,O,A);Y.intersection(j).length==0?te=V.add(new p(J.graphManager,new f(le.topLeftX,le.topLeftY),new x(le.width,le.height))):te=V.add(new p(J.graphManager,new f(le.topLeftX,le.topLeftY),new x(parseFloat(ie.w),parseFloat(ie.h))))}else te=V.add(new p(J.graphManager,new f(Y.position("x")-ie.w/2,Y.position("y")-ie.h/2),new x(parseFloat(ie.w),parseFloat(ie.h))));else te=V.add(new p(this.graphManager));if(te.id=Y.data("id"),te.nodeRepulsion=B(ne.nodeRepulsion,Y),te.paddingLeft=parseInt(Y.css("padding")),te.paddingTop=parseInt(Y.css("padding")),te.paddingRight=parseInt(Y.css("padding")),te.paddingBottom=parseInt(Y.css("padding")),ne.nodeDimensionsIncludeLabels&&(te.labelWidth=Y.boundingBox({includeLabels:!0,includeNodes:!1,includeOverlays:!1}).w,te.labelHeight=Y.boundingBox({includeLabels:!0,includeNodes:!1,includeOverlays:!1}).h,te.labelPosVertical=Y.css("text-valign"),te.labelPosHorizontal=Y.css("text-halign")),$[Y.data("id")]=te,isNaN(te.rect.x)&&(te.rect.x=0),isNaN(te.rect.y)&&(te.rect.y=0),Q!=null&&Q.length>0){var pe=void 0;pe=J.getGraphManager().add(J.newGraph(),te),W(pe,Q,J,ne)}}},U=function(V,re,J){for(var ne=0,X=0,q=0;q<J.length;q++){var Y=J[q],Q=$[Y.data("source")],te=$[Y.data("target")];if(Q&&te&&Q!==te&&Q.getEdgesBetween(te).length==0){var ie=re.add(V.newEdge(),Q,te);ie.id=Y.id(),ie.idealLength=B(_.idealEdgeLength,Y),ie.edgeElasticity=B(_.edgeElasticity,Y),ne+=ie.idealLength,X++}}_.idealEdgeLength!=null&&(X>0?m.DEFAULT_EDGE_LENGTH=v.DEFAULT_EDGE_LENGTH=ne/X:D(_.idealEdgeLength)?m.DEFAULT_EDGE_LENGTH=v.DEFAULT_EDGE_LENGTH=50:m.DEFAULT_EDGE_LENGTH=v.DEFAULT_EDGE_LENGTH=_.idealEdgeLength,m.MIN_REPULSION_DIST=v.MIN_REPULSION_DIST=v.DEFAULT_EDGE_LENGTH/10,m.DEFAULT_RADIAL_SEPARATION=v.DEFAULT_EDGE_LENGTH)},F=function(V,re){re.fixedNodeConstraint&&(V.constraints.fixedNodeConstraint=re.fixedNodeConstraint),re.alignmentConstraint&&(V.constraints.alignmentConstraint=re.alignmentConstraint),re.relativePlacementConstraint&&(V.constraints.relativePlacementConstraint=re.relativePlacementConstraint)};_.nestingFactor!=null&&(m.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=v.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=_.nestingFactor),_.gravity!=null&&(m.DEFAULT_GRAVITY_STRENGTH=v.DEFAULT_GRAVITY_STRENGTH=_.gravity),_.numIter!=null&&(m.MAX_ITERATIONS=v.MAX_ITERATIONS=_.numIter),_.gravityRange!=null&&(m.DEFAULT_GRAVITY_RANGE_FACTOR=v.DEFAULT_GRAVITY_RANGE_FACTOR=_.gravityRange),_.gravityCompound!=null&&(m.DEFAULT_COMPOUND_GRAVITY_STRENGTH=v.DEFAULT_COMPOUND_GRAVITY_STRENGTH=_.gravityCompound),_.gravityRangeCompound!=null&&(m.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=v.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=_.gravityRangeCompound),_.initialEnergyOnIncremental!=null&&(m.DEFAULT_COOLING_FACTOR_INCREMENTAL=v.DEFAULT_COOLING_FACTOR_INCREMENTAL=_.initialEnergyOnIncremental),_.tilingCompareBy!=null&&(m.TILING_COMPARE_BY=_.tilingCompareBy),_.quality=="proof"?S.QUALITY=2:S.QUALITY=0,m.NODE_DIMENSIONS_INCLUDE_LABELS=v.NODE_DIMENSIONS_INCLUDE_LABELS=S.NODE_DIMENSIONS_INCLUDE_LABELS=_.nodeDimensionsIncludeLabels,m.DEFAULT_INCREMENTAL=v.DEFAULT_INCREMENTAL=S.DEFAULT_INCREMENTAL=!_.randomize,m.ANIMATE=v.ANIMATE=S.ANIMATE=_.animate,m.TILE=_.tile,m.TILING_PADDING_VERTICAL=typeof _.tilingPaddingVertical=="function"?_.tilingPaddingVertical.call():_.tilingPaddingVertical,m.TILING_PADDING_HORIZONTAL=typeof _.tilingPaddingHorizontal=="function"?_.tilingPaddingHorizontal.call():_.tilingPaddingHorizontal,m.DEFAULT_INCREMENTAL=v.DEFAULT_INCREMENTAL=S.DEFAULT_INCREMENTAL=!0,m.PURE_INCREMENTAL=!_.randomize,S.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 d,H=P.newGraphManager();return I(H.addRoot(),c.getTopMostNodes(k),P,_),U(P,H,L),F(P,_),P.runLayout(),$};o.exports={coseLayout:b}}),212:((o,l,u)=>{var c=(function(){function _(T,N){for(var E=0;E<N.length;E++){var k=N[E];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(T,k.key,k)}}return function(T,N,E){return N&&_(T.prototype,N),E&&_(T,E),T}})();function d(_,T){if(!(_ instanceof T))throw new TypeError("Cannot call a class as a function")}var p=u(658),f=u(548),x=u(657),S=x.spectralLayout,v=u(816),m=v.coseLayout,b=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(T){return 4500},idealEdgeLength:function(T){return 50},edgeElasticity:function(T){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(){}}),w=(function(){function _(T){d(this,_),this.options=p({},b,T)}return c(_,[{key:"run",value:function(){var N=this,E=this.options,k=E.cy,L=E.eles,A=[],M=[],O=void 0,$=[];E.fixedNodeConstraint&&(!Array.isArray(E.fixedNodeConstraint)||E.fixedNodeConstraint.length==0)&&(E.fixedNodeConstraint=void 0),E.alignmentConstraint&&(E.alignmentConstraint.vertical&&(!Array.isArray(E.alignmentConstraint.vertical)||E.alignmentConstraint.vertical.length==0)&&(E.alignmentConstraint.vertical=void 0),E.alignmentConstraint.horizontal&&(!Array.isArray(E.alignmentConstraint.horizontal)||E.alignmentConstraint.horizontal.length==0)&&(E.alignmentConstraint.horizontal=void 0)),E.relativePlacementConstraint&&(!Array.isArray(E.relativePlacementConstraint)||E.relativePlacementConstraint.length==0)&&(E.relativePlacementConstraint=void 0);var D=E.fixedNodeConstraint||E.alignmentConstraint||E.relativePlacementConstraint;D&&(E.tile=!1,E.packComponents=!1);var B=void 0,j=!1;if(k.layoutUtilities&&E.packComponents&&(B=k.layoutUtilities("get"),B||(B=k.layoutUtilities()),j=!0),L.nodes().length>0)if(j){var F=f.getTopMostNodes(E.eles.nodes());if(O=f.connectComponents(k,E.eles,F),O.forEach(function(Se){var Te=Se.boundingBox();$.push({x:Te.x1+Te.w/2,y:Te.y1+Te.h/2})}),E.randomize&&O.forEach(function(Se){E.eles=Se,A.push(S(E))}),E.quality=="default"||E.quality=="proof"){var P=k.collection();if(E.tile){var H=new Map,W=[],V=[],re=0,J={nodeIndexes:H,xCoords:W,yCoords:V},ne=[];if(O.forEach(function(Se,Te){Se.edges().length==0&&(Se.nodes().forEach(function(Ae,Ne){P.merge(Se.nodes()[Ne]),Ae.isParent()||(J.nodeIndexes.set(Se.nodes()[Ne].id(),re++),J.xCoords.push(Se.nodes()[0].position().x),J.yCoords.push(Se.nodes()[0].position().y))}),ne.push(Te))}),P.length>1){var X=P.boundingBox();$.push({x:X.x1+X.w/2,y:X.y1+X.h/2}),O.push(P),A.push(J);for(var q=ne.length-1;q>=0;q--)O.splice(ne[q],1),A.splice(ne[q],1),$.splice(ne[q],1)}}O.forEach(function(Se,Te){E.eles=Se,M.push(m(E,A[Te])),f.relocateComponent($[Te],M[Te],E)})}else O.forEach(function(Se,Te){f.relocateComponent($[Te],A[Te],E)});var Y=new Set;if(O.length>1){var Q=[],te=L.filter(function(Se){return Se.css("display")=="none"});O.forEach(function(Se,Te){var Ae=void 0;if(E.quality=="draft"&&(Ae=A[Te].nodeIndexes),Se.nodes().not(te).length>0){var Ne={};Ne.edges=[],Ne.nodes=[];var Pe=void 0;Se.nodes().not(te).forEach(function(ze){if(E.quality=="draft")if(!ze.isParent())Pe=Ae.get(ze.id()),Ne.nodes.push({x:A[Te].xCoords[Pe]-ze.boundingbox().w/2,y:A[Te].yCoords[Pe]-ze.boundingbox().h/2,width:ze.boundingbox().w,height:ze.boundingbox().h});else{var Ie=f.calcBoundingBox(ze,A[Te].xCoords,A[Te].yCoords,Ae);Ne.nodes.push({x:Ie.topLeftX,y:Ie.topLeftY,width:Ie.width,height:Ie.height})}else M[Te][ze.id()]&&Ne.nodes.push({x:M[Te][ze.id()].getLeft(),y:M[Te][ze.id()].getTop(),width:M[Te][ze.id()].getWidth(),height:M[Te][ze.id()].getHeight()})}),Se.edges().forEach(function(ze){var Ie=ze.source(),$e=ze.target();if(Ie.css("display")!="none"&&$e.css("display")!="none")if(E.quality=="draft"){var Ge=Ae.get(Ie.id()),ve=Ae.get($e.id()),Ee=[],Me=[];if(Ie.isParent()){var ye=f.calcBoundingBox(Ie,A[Te].xCoords,A[Te].yCoords,Ae);Ee.push(ye.topLeftX+ye.width/2),Ee.push(ye.topLeftY+ye.height/2)}else Ee.push(A[Te].xCoords[Ge]),Ee.push(A[Te].yCoords[Ge]);if($e.isParent()){var ee=f.calcBoundingBox($e,A[Te].xCoords,A[Te].yCoords,Ae);Me.push(ee.topLeftX+ee.width/2),Me.push(ee.topLeftY+ee.height/2)}else Me.push(A[Te].xCoords[ve]),Me.push(A[Te].yCoords[ve]);Ne.edges.push({startX:Ee[0],startY:Ee[1],endX:Me[0],endY:Me[1]})}else M[Te][Ie.id()]&&M[Te][$e.id()]&&Ne.edges.push({startX:M[Te][Ie.id()].getCenterX(),startY:M[Te][Ie.id()].getCenterY(),endX:M[Te][$e.id()].getCenterX(),endY:M[Te][$e.id()].getCenterY()})}),Ne.nodes.length>0&&(Q.push(Ne),Y.add(Te))}});var ie=B.packComponents(Q,E.randomize).shifts;if(E.quality=="draft")A.forEach(function(Se,Te){var Ae=Se.xCoords.map(function(Pe){return Pe+ie[Te].dx}),Ne=Se.yCoords.map(function(Pe){return Pe+ie[Te].dy});Se.xCoords=Ae,Se.yCoords=Ne});else{var le=0;Y.forEach(function(Se){Object.keys(M[Se]).forEach(function(Te){var Ae=M[Se][Te];Ae.setCenter(Ae.getCenterX()+ie[le].dx,Ae.getCenterY()+ie[le].dy)}),le++})}}}else{var I=E.eles.boundingBox();if($.push({x:I.x1+I.w/2,y:I.y1+I.h/2}),E.randomize){var U=S(E);A.push(U)}E.quality=="default"||E.quality=="proof"?(M.push(m(E,A[0])),f.relocateComponent($[0],M[0],E)):f.relocateComponent($[0],A[0],E)}var pe=function(Te,Ae){if(E.quality=="default"||E.quality=="proof"){typeof Te=="number"&&(Te=Ae);var Ne=void 0,Pe=void 0,ze=Te.data("id");return M.forEach(function($e){ze in $e&&(Ne={x:$e[ze].getRect().getCenterX(),y:$e[ze].getRect().getCenterY()},Pe=$e[ze])}),E.nodeDimensionsIncludeLabels&&(Pe.labelWidth&&(Pe.labelPosHorizontal=="left"?Ne.x+=Pe.labelWidth/2:Pe.labelPosHorizontal=="right"&&(Ne.x-=Pe.labelWidth/2)),Pe.labelHeight&&(Pe.labelPosVertical=="top"?Ne.y+=Pe.labelHeight/2:Pe.labelPosVertical=="bottom"&&(Ne.y-=Pe.labelHeight/2))),Ne==null&&(Ne={x:Te.position("x"),y:Te.position("y")}),{x:Ne.x,y:Ne.y}}else{var Ie=void 0;return A.forEach(function($e){var Ge=$e.nodeIndexes.get(Te.id());Ge!=null&&(Ie={x:$e.xCoords[Ge],y:$e.yCoords[Ge]})}),Ie==null&&(Ie={x:Te.position("x"),y:Te.position("y")}),{x:Ie.x,y:Ie.y}}};if(E.quality=="default"||E.quality=="proof"||E.randomize){var Le=f.calcParentsWithoutChildren(k,L),je=L.filter(function(Se){return Se.css("display")=="none"});E.eles=L.not(je),L.nodes().not(":parent").not(je).layoutPositions(N,E,pe),Le.length>0&&Le.forEach(function(Se){Se.position(pe(Se))})}else console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.")}}]),_})();o.exports=w}),657:((o,l,u)=>{var c=u(548),d=u(140).layoutBase.Matrix,p=u(140).layoutBase.SVD,f=function(S){var v=S.cy,m=S.eles,b=m.nodes(),w=m.nodes(":parent"),_=new Map,T=new Map,N=new Map,E=[],k=[],L=[],A=[],M=[],O=[],$=[],D=[],B=void 0,j=1e8,I=1e-9,U=S.piTol,F=S.samplingType,P=S.nodeSeparation,H=void 0,W=function(){for(var se=0,ce=0,be=!1;ce<H;){se=Math.floor(Math.random()*B),be=!1;for(var he=0;he<ce;he++)if(A[he]==se){be=!0;break}if(!be)A[ce]=se,ce++;else continue}},V=function(se,ce,be){for(var he=[],de=0,me=0,ke=0,Re=void 0,Ce=[],De=0,Qe=1,Xe=0;Xe<B;Xe++)Ce[Xe]=j;for(he[me]=se,Ce[se]=0;me>=de;){ke=he[de++];for(var yt=E[ke],et=0;et<yt.length;et++)Re=T.get(yt[et]),Ce[Re]==j&&(Ce[Re]=Ce[ke]+1,he[++me]=Re);O[ke][ce]=Ce[ke]*P}if(be){for(var Ze=0;Ze<B;Ze++)O[Ze][ce]<M[Ze]&&(M[Ze]=O[Ze][ce]);for(var ct=0;ct<B;ct++)M[ct]>De&&(De=M[ct],Qe=ct)}return Qe},re=function(se){var ce=void 0;if(se){ce=Math.floor(Math.random()*B);for(var he=0;he<B;he++)M[he]=j;for(var de=0;de<H;de++)A[de]=ce,ce=V(ce,de,se)}else{W();for(var be=0;be<H;be++)V(A[be],be,se)}for(var me=0;me<B;me++)for(var ke=0;ke<H;ke++)O[me][ke]*=O[me][ke];for(var Re=0;Re<H;Re++)$[Re]=[];for(var Ce=0;Ce<H;Ce++)for(var De=0;De<H;De++)$[Ce][De]=O[A[De]][Ce]},J=function(){for(var se=p.svd($),ce=se.S,be=se.U,he=se.V,de=ce[0]*ce[0]*ce[0],me=[],ke=0;ke<H;ke++){me[ke]=[];for(var Re=0;Re<H;Re++)me[ke][Re]=0,ke==Re&&(me[ke][Re]=ce[ke]/(ce[ke]*ce[ke]+de/(ce[ke]*ce[ke])))}D=d.multMat(d.multMat(he,me),d.transpose(be))},ne=function(){for(var se=void 0,ce=void 0,be=[],he=[],de=[],me=[],ke=0;ke<B;ke++)be[ke]=Math.random(),he[ke]=Math.random();be=d.normalize(be),he=d.normalize(he);for(var Re=I,Ce=I,De=void 0;;){for(var Qe=0;Qe<B;Qe++)de[Qe]=be[Qe];if(be=d.multGamma(d.multL(d.multGamma(de),O,D)),se=d.dotProduct(de,be),be=d.normalize(be),Re=d.dotProduct(de,be),De=Math.abs(Re/Ce),De<=1+U&&De>=1)break;Ce=Re}for(var Xe=0;Xe<B;Xe++)de[Xe]=be[Xe];for(Ce=I;;){for(var yt=0;yt<B;yt++)me[yt]=he[yt];if(me=d.minusOp(me,d.multCons(de,d.dotProduct(de,me))),he=d.multGamma(d.multL(d.multGamma(me),O,D)),ce=d.dotProduct(me,he),he=d.normalize(he),Re=d.dotProduct(me,he),De=Math.abs(Re/Ce),De<=1+U&&De>=1)break;Ce=Re}for(var et=0;et<B;et++)me[et]=he[et];k=d.multCons(de,Math.sqrt(Math.abs(se))),L=d.multCons(me,Math.sqrt(Math.abs(ce)))};c.connectComponents(v,m,c.getTopMostNodes(b),_),w.forEach(function(ae){c.connectComponents(v,m,c.getTopMostNodes(ae.descendants().intersection(m)),_)});for(var X=0,q=0;q<b.length;q++)b[q].isParent()||T.set(b[q].id(),X++);var Y=!0,Q=!1,te=void 0;try{for(var ie=_.keys()[Symbol.iterator](),le;!(Y=(le=ie.next()).done);Y=!0){var pe=le.value;T.set(pe,X++)}}catch(ae){Q=!0,te=ae}finally{try{!Y&&ie.return&&ie.return()}finally{if(Q)throw te}}for(var Le=0;Le<T.size;Le++)E[Le]=[];w.forEach(function(ae){for(var se=ae.children().intersection(m);se.nodes(":childless").length==0;)se=se.nodes()[0].children().intersection(m);var ce=0,be=se.nodes(":childless")[0].connectedEdges().length;se.nodes(":childless").forEach(function(he,de){he.connectedEdges().length<be&&(be=he.connectedEdges().length,ce=de)}),N.set(ae.id(),se.nodes(":childless")[ce].id())}),b.forEach(function(ae){var se=void 0;ae.isParent()?se=T.get(N.get(ae.id())):se=T.get(ae.id()),ae.neighborhood().nodes().forEach(function(ce){m.intersection(ae.edgesWith(ce)).length>0&&(ce.isParent()?E[se].push(N.get(ce.id())):E[se].push(ce.id()))})});var je=function(se){var ce=T.get(se),be=void 0;_.get(se).forEach(function(he){v.getElementById(he).isParent()?be=N.get(he):be=he,E[ce].push(be),E[T.get(be)].push(se)})},Se=!0,Te=!1,Ae=void 0;try{for(var Ne=_.keys()[Symbol.iterator](),Pe;!(Se=(Pe=Ne.next()).done);Se=!0){var ze=Pe.value;je(ze)}}catch(ae){Te=!0,Ae=ae}finally{try{!Se&&Ne.return&&Ne.return()}finally{if(Te)throw Ae}}B=T.size;var Ie=void 0;if(B>2){H=B<S.sampleSize?B:S.sampleSize;for(var $e=0;$e<B;$e++)O[$e]=[];for(var Ge=0;Ge<H;Ge++)D[Ge]=[];return S.quality=="draft"||S.step=="all"?(re(F),J(),ne(),Ie={nodeIndexes:T,xCoords:k,yCoords:L}):(T.forEach(function(ae,se){k.push(v.getElementById(se).position("x")),L.push(v.getElementById(se).position("y"))}),Ie={nodeIndexes:T,xCoords:k,yCoords:L}),Ie}else{var ve=T.keys(),Ee=v.getElementById(ve.next().value),Me=Ee.position(),ye=Ee.outerWidth();if(k.push(Me.x),L.push(Me.y),B==2){var ee=v.getElementById(ve.next().value),ue=ee.outerWidth();k.push(Me.x+ye/2+ue/2+S.idealEdgeLength),L.push(Me.y)}return Ie={nodeIndexes:T,xCoords:k,yCoords:L},Ie}};o.exports={spectralLayout:f}}),579:((o,l,u)=>{var c=u(212),d=function(f){f&&f("layout","fcose",c)};typeof cytoscape<"u"&&d(cytoscape),o.exports=d}),140:(o=>{o.exports=r})},i={};function a(o){var l=i[o];if(l!==void 0)return l.exports;var u=i[o]={exports:{}};return n[o](u,u.exports,a),u.exports}var s=a(579);return s})()})})(gd)),gd.exports}var TO=EO();const NO=$d(TO);ka.use(NO);const RO={function:"#10b981",method:"#10b981",constructor:"#10b981",class:"#f97316",struct:"#f97316",interface:"#3b82f6",type_alias:"#3b82f6",trait:"#3b82f6",enum:"#8b5cf6",macro:"#a855f7"},LO={typescript:"#10b981",javascript:"#10b981",rust:"#f97316",python:"#3b82f6",go:"#06b6d4"};function DO(t){var e,r;return RO[(e=t.kind)==null?void 0:e.toLowerCase()]??LO[(r=t.lang)==null?void 0:r.toLowerCase()]??"#9ca3af"}function AO(t){return Math.round(Math.min(20+Math.sqrt(t)*6,60))}function IC({nodes:t,edges:e,externalSelectedId:r,onNodeClick:n,onNodeSelect:i}){const a=K.useRef(null),[s,o]=K.useState(null),l=K.useRef(new Map),u=K.useRef(n),c=K.useRef(i);return K.useEffect(()=>{u.current=n,c.current=i},[n,i]),K.useEffect(()=>{if(!a.current)return;const d=new Map(t.map((x,S)=>[x.id,`n${S}`]));l.current=d;const p=[...t.map(x=>({group:"nodes",data:{id:d.get(x.id),label:x.name||x.id.split("/").pop()||x.id,color:DO(x),size:AO(x.inDeg),kind:x.kind,file:x.file,inDeg:x.inDeg,outDeg:x.outDeg,raw:x}})),...e.filter(x=>d.has(x.src)&&d.has(x.tgt)).map((x,S)=>({group:"edges",data:{id:`e${S}`,source:d.get(x.src),target:d.get(x.tgt)}}))],f=ka({container:a.current,elements:p,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 f.on("tap","node",x=>{var m,b;const S=x.target.data("raw");(m=u.current)==null||m.call(u,S),(b=c.current)==null||b.call(c,S),f.elements().removeClass("highlighted dimmed");const v=x.target.closedNeighborhood();f.elements().addClass("dimmed"),v.removeClass("dimmed").addClass("highlighted"),x.target.select()}),f.on("tap",x=>{var S;x.target===f&&(f.elements().removeClass("highlighted dimmed"),f.elements("node").unselect(),(S=c.current)==null||S.call(c,null))}),f.ready(()=>{f.destroyed()||f.fit(void 0,40)}),o(f),()=>{f.destroy(),o(null)}},[t,e]),K.useEffect(()=>{if(s&&!s.destroyed()&&(s.elements("node").unselect(),s.elements().removeClass("highlighted dimmed"),r)){const d=l.current.get(r)??r,p=s.$id(d);if(p.length){p.select();const f=p.closedNeighborhood();s.elements().addClass("dimmed"),f.removeClass("dimmed").addClass("highlighted"),s.destroyed()||s.animate({fit:{eles:f,padding:60},duration:300})}}},[s,r]),y.jsx("div",{ref:a,className:"w-full h-full"})}const PO={function:"#10b981",method:"#10b981",constructor:"#10b981",class:"#f97316",struct:"#f97316",interface:"#3b82f6",type_alias:"#3b82f6",trait:"#3b82f6",enum:"#8b5cf6",macro:"#a855f7"},MO={typescript:"#10b981",javascript:"#10b981",rust:"#f97316",python:"#3b82f6",go:"#06b6d4"};function OO(t){var e,r;return PO[(e=t.kind)==null?void 0:e.toLowerCase()]??MO[(r=t.lang)==null?void 0:r.toLowerCase()]??"#9ca3af"}function jO({nodes:t,selectedId:e,onSelect:r}){var a;const n=[...t].sort((s,o)=>o.inDeg-s.inDeg).slice(0,40),i=((a=n[0])==null?void 0:a.inDeg)??1;return y.jsx("div",{className:"h-full flex flex-col overflow-hidden",style:{background:"#0f1419"},children:y.jsx("div",{className:"flex-1 overflow-y-auto",children:n.map((s,o)=>{const l=i>0?s.inDeg/i*100:0,u=OO(s),c=s.id===e,d=s.name||s.id.split("/").pop()||s.id,p=s.file?s.file.split("/").slice(-2).join("/"):"";return y.jsxs("button",{type:"button",onClick:()=>r==null?void 0:r(s),className:"w-full text-left px-4 py-2.5 relative transition-colors border-b",style:{borderColor:"rgba(230,237,243,0.06)",background:c?"rgba(63,185,80,0.08)":"transparent"},onMouseEnter:f=>{c||(f.currentTarget.style.background="rgba(230,237,243,0.04)")},onMouseLeave:f=>{c||(f.currentTarget.style.background="transparent")},children:[y.jsx("div",{className:"absolute inset-y-0 left-0 pointer-events-none",style:{width:`${l}%`,backgroundColor:u,opacity:c?.18:.1}}),y.jsxs("div",{className:"relative flex items-center gap-2",children:[y.jsx("span",{className:"text-[10px] tabular-nums w-5 text-right shrink-0 font-mono",style:{color:"rgba(230,237,243,0.25)"},children:o+1}),y.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:u}}),y.jsxs("span",{className:"flex-1 min-w-0 flex flex-col",children:[y.jsx("span",{className:"font-mono text-[11px] truncate font-medium",style:{color:"#e6edf3"},title:s.name||s.id,children:d}),p&&y.jsxs("span",{className:"text-[9px] truncate font-mono",style:{color:"rgba(230,237,243,0.35)"},children:[s.kind&&y.jsx("span",{style:{color:"rgba(230,237,243,0.45)",marginRight:"4px"},children:s.kind}),p]})]}),y.jsx("span",{className:"shrink-0 text-[11px] font-semibold tabular-nums ml-2 font-mono",style:{color:c?"#3fb950":"rgba(230,237,243,0.6)"},children:s.inDeg})]})]},s.id)})})})}const Oe={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"},IO={function:"#10b981",method:"#10b981",constructor:"#10b981",class:"#f97316",struct:"#f97316",interface:"#3b82f6",type_alias:"#3b82f6",trait:"#3b82f6",enum:"#8b5cf6",macro:"#a855f7"},BO={typescript:"#10b981",javascript:"#10b981",rust:"#f97316",python:"#3b82f6",go:"#06b6d4"};function FO(t){var e,r;return IO[(e=t.kind)==null?void 0:e.toLowerCase()]??BO[(r=t.lang)==null?void 0:r.toLowerCase()]??"#9ca3af"}function zO({node:t,edges:e,onClose:r,onBlast:n,onExpand:i,blast:a,blastBusy:s,expandBusy:o,onFocusDependent:l}){const u=e.filter(f=>f.tgt===t.id),c=e.filter(f=>f.src===t.id),d=FO(t);function p(f){const x=f.split("/");return x[x.length-1]??f}return y.jsxs("div",{className:"w-64 shrink-0 flex flex-col border-l overflow-hidden",style:{background:Oe.canvas2,borderColor:Oe.hairline},children:[y.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-2 border-b shrink-0 min-w-0",style:{borderColor:Oe.hairline},children:[y.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:d}}),y.jsx("span",{className:"text-[11px] font-semibold truncate flex-1 font-mono",style:{color:Oe.ink},title:t.name||t.id,children:t.name||t.id.split("/").pop()}),y.jsx("button",{type:"button",onClick:r,className:"shrink-0 leading-none text-base",style:{color:Oe.faint},children:"×"})]}),y.jsxs("div",{className:"overflow-y-auto flex-1 p-3 flex flex-col gap-3 text-[11px]",children:[(n!==void 0||i!==void 0)&&y.jsxs("div",{className:"flex gap-2",children:[n!==void 0&&y.jsx("button",{type:"button",onClick:()=>n(t),disabled:s,className:"flex-1 px-2 py-1 rounded-lg text-[10px] font-mono font-semibold disabled:opacity-50",style:{background:"rgba(248,81,73,0.12)",color:Oe.deny,border:`1px solid ${Oe.hairline}`},children:s?"Computing…":"⚡ Blast radius"}),i!==void 0&&y.jsx("button",{type:"button",onClick:()=>i(t),disabled:o,className:"flex-1 px-2 py-1 rounded-lg text-[10px] font-mono font-semibold disabled:opacity-50",style:{background:"rgba(121,192,255,0.12)",color:Oe.link,border:`1px solid ${Oe.hairline}`},children:o?"Expanding…":"⤢ Expand neighbors"})]}),a!=null&&y.jsxs("div",{className:"flex flex-col gap-1",children:[y.jsxs("span",{className:"text-[10px] font-mono uppercase",style:{color:Oe.faint},children:["blast radius · ",a.dependents.length," dependents"]}),a.unresolved>0&&y.jsxs("span",{className:"text-[10px] font-mono",style:{color:Oe.deny},children:["+",a.unresolved," unresolved call(s) — impact may be larger"]}),a.unresolved===-1&&y.jsx("span",{className:"text-[10px] font-mono",style:{color:Oe.deny},children:"blast radius failed to compute"}),y.jsxs("ul",{className:"flex flex-col gap-0.5 max-h-48 overflow-y-auto",children:[a.dependents.slice(0,30).map(f=>y.jsx("li",{children:y.jsxs("button",{type:"button",onClick:()=>l==null?void 0:l(f),className:"w-full text-left text-[10px] font-mono truncate hover:underline",style:{color:Oe.link},title:`${f.file}:${f.line}`,children:[f.name," ",y.jsxs("span",{style:{color:Oe.faint},children:["(",f.kind,")"]})]})},f.id)),a.dependents.length>30&&y.jsxs("li",{className:"text-[10px] font-mono",style:{color:Oe.faint},children:["+",a.dependents.length-30," more"]})]})]}),t.kind&&y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-semibold uppercase",style:{background:Oe.surface,color:Oe.muted},children:t.kind}),y.jsx("span",{className:"capitalize font-mono",style:{color:Oe.faint},children:t.lang||""})]}),t.file&&y.jsxs("div",{children:[y.jsx("p",{className:"text-[10px] mb-0.5 font-mono uppercase tracking-wide",style:{color:Oe.faint},children:"File"}),y.jsx("p",{className:"font-mono text-[10px] break-all",style:{color:Oe.muted},children:t.file})]}),y.jsxs("div",{className:"flex gap-4",children:[y.jsxs("div",{children:[y.jsx("p",{className:"text-[10px] font-mono uppercase tracking-wide mb-0.5",style:{color:Oe.faint},children:"Callers"}),y.jsx("p",{className:"font-mono font-bold",style:{color:Oe.ink},children:t.inDeg})]}),y.jsxs("div",{children:[y.jsx("p",{className:"text-[10px] font-mono uppercase tracking-wide mb-0.5",style:{color:Oe.faint},children:"Calls"}),y.jsx("p",{className:"font-mono font-bold",style:{color:Oe.ink},children:t.outDeg})]})]}),u.length>0&&y.jsxs("div",{children:[y.jsxs("p",{className:"text-[10px] font-mono uppercase tracking-wide mb-1",style:{color:Oe.faint},children:["Called by (in view) ",y.jsx("span",{style:{color:Oe.muted},children:u.length})]}),y.jsxs("div",{className:"flex flex-col gap-0.5",children:[u.slice(0,10).map(f=>y.jsx("p",{className:"font-mono text-[10px] truncate",style:{color:Oe.muted},title:f.src,children:p(f.src)},f.src)),u.length>10&&y.jsxs("p",{className:"text-[10px] font-mono",style:{color:Oe.faint},children:["+",u.length-10," more"]})]})]}),c.length>0&&y.jsxs("div",{children:[y.jsxs("p",{className:"text-[10px] font-mono uppercase tracking-wide mb-1",style:{color:Oe.faint},children:["Calls (in view) ",y.jsx("span",{style:{color:Oe.muted},children:c.length})]}),y.jsxs("div",{className:"flex flex-col gap-0.5",children:[c.slice(0,10).map(f=>y.jsx("p",{className:"font-mono text-[10px] truncate",style:{color:Oe.muted},title:f.tgt,children:p(f.tgt)},f.tgt)),c.length>10&&y.jsxs("p",{className:"text-[10px] font-mono",style:{color:Oe.faint},children:["+",c.length-10," more"]})]})]})]})]})}function $O({graph:t}){const[e,r]=K.useState(""),[n,i]=K.useState(null),{nodes:a,edges:s,reqCounts:o}=K.useMemo(()=>{var b;const d=Object.keys(t.domains),p=new Set(d),f=new Map;for(const w of d)f.set(w,Object.keys(((b=t.domains[w])==null?void 0:b.requirements)??{}).length);const x=w=>{if(w==="(root)")return null;let _=w;for(;_.includes("/");)if(_=_.slice(0,_.lastIndexOf("/")),p.has(_))return _;return p.has("(root)")?"(root)":null},S=new Map,v=[];for(const w of d){const _=x(w);_!==null&&(v.push({src:_,tgt:w}),S.set(_,(S.get(_)??0)+1))}return{nodes:d.map(w=>({id:w,name:w==="(root)"?"(root)":w.slice(w.lastIndexOf("/")+1),kind:"domain",file:w,inDeg:Math.min(f.get(w)??0,60),outDeg:S.get(w)??0,lang:"domain"})),edges:v,reqCounts:f}},[t]),l=e.trim().toLowerCase(),u=K.useMemo(()=>{if(l==="")return{nodes:a,edges:s};const d=new Set(a.filter(x=>{var S;return x.id.toLowerCase().includes(l)||Object.values(((S=t.domains[x.id])==null?void 0:S.requirements)??{}).some(v=>(v.title??"").toLowerCase().includes(l))}).map(x=>x.id)),p=new Set(d),f=new Map(s.map(x=>[x.tgt,x.src]));for(const x of d){let S=f.get(x);for(;S!==void 0&&!p.has(S);)p.add(S),S=f.get(S)}return{nodes:a.filter(x=>p.has(x.id)),edges:s.filter(x=>p.has(x.src)&&p.has(x.tgt))}},[a,s,l,t]),c=n!==null?t.domains[n]:void 0;return a.length===0?y.jsx("div",{className:"h-full overflow-y-auto p-4",children:y.jsx("p",{className:"text-sm text-center mt-8 font-mono",style:{color:Oe.faint},children:"No domains in this graph."})}):y.jsxs("div",{className:"h-full flex flex-col",children:[y.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 shrink-0 border-b",style:{borderColor:Oe.hairline},children:[y.jsxs("span",{className:"text-[11px] font-mono shrink-0",style:{color:Oe.muted},children:[a.length," domains · ",[...o.values()].reduce((d,p)=>d+p,0)," requirements"]}),y.jsx("input",{type:"text",value:e,onChange:d=>r(d.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 ${Oe.hairlineS}`,background:Oe.canvas2,color:Oe.ink}}),l!==""&&y.jsx("span",{className:"text-[10px] font-mono shrink-0",style:{color:Oe.faint},children:u.nodes.length===1?"1 match":`${u.nodes.length} matches`})]}),y.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[y.jsx("div",{className:"flex-1 overflow-hidden",style:{background:Oe.canvas},children:y.jsx(IC,{nodes:u.nodes,edges:u.edges,externalSelectedId:n,onNodeSelect:d=>i(d?d.id:null)})}),n!==null&&c&&y.jsx(HO,{domainId:n,domain:c,onClose:()=>i(null)})]})]})}function HO({domainId:t,domain:e,onClose:r}){const i=Object.entries(e.requirements??{});return y.jsxs("div",{className:"w-[380px] shrink-0 border-l flex flex-col",style:{borderColor:Oe.hairlineS,background:Oe.surface2},children:[y.jsxs("div",{className:"px-4 py-2.5 border-b flex items-center gap-2 shrink-0",style:{borderColor:Oe.hairline,background:Oe.canvas2},children:[y.jsx("span",{className:"text-[11px] font-semibold font-mono truncate",style:{color:Oe.ink},children:t}),y.jsxs("span",{className:"text-[10px] font-mono ml-auto shrink-0",style:{color:Oe.faint},children:[i.length," reqs"]}),y.jsx("button",{type:"button",onClick:r,"aria-label":"Close domain details",className:"text-sm shrink-0 px-1",style:{color:Oe.muted},children:"×"})]}),y.jsxs("div",{className:"flex-1 overflow-y-auto",children:[e.description&&y.jsx("p",{className:"text-[11px] px-4 pt-3 pb-1",style:{color:Oe.muted},children:e.description}),i.length===0?y.jsx("p",{className:"text-[11px] px-4 py-3 font-mono",style:{color:Oe.faint},children:"No requirements recorded for this domain."}):y.jsxs("div",{className:"divide-y",style:{borderColor:Oe.hairline},children:[i.slice(0,150).map(([a,s])=>y.jsxs("div",{className:"px-4 py-2.5",style:{borderColor:Oe.hairline},children:[y.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[y.jsx("span",{className:"text-[10px] font-mono",style:{color:Oe.faint},children:a}),s.status&&y.jsx("span",{className:"text-[9px] uppercase font-semibold px-1.5 py-0.5 rounded font-mono",style:{background:s.status==="active"?"rgba(63,185,80,0.15)":s.status==="deprecated"?"rgba(248,81,73,0.15)":Oe.surface,color:s.status==="active"?Oe.ok:s.status==="deprecated"?Oe.deny:Oe.muted},children:s.status})]}),y.jsx("p",{className:"text-[11px]",style:{color:Oe.ink},children:s.title}),s.description&&s.description!==s.title&&y.jsx("p",{className:"text-[10px] mt-0.5",style:{color:Oe.muted},children:s.description.slice(0,160)})]},a)),i.length>150&&y.jsxs("p",{className:"text-[10px] font-mono px-4 py-2",style:{color:Oe.faint},children:["+",i.length-150," more requirements"]})]})]})]})}function r2(){return y.jsxs("div",{className:"flex items-center gap-1.5",children:[y.jsx("span",{className:"w-3 h-3 rounded-full",style:{background:Oe.deny}}),y.jsx("span",{className:"w-3 h-3 rounded-full",style:{background:Oe.accent}}),y.jsx("span",{className:"w-3 h-3 rounded-full",style:{background:Oe.ok}})]})}function UO({repo:t,onClose:e,onSelectRun:r,initialFocus:n}){const[i,a]=K.useState("graph"),[s,o]=K.useState("code"),[l,u]=K.useState(!0),[c,d]=K.useState(null),[p,f]=K.useState(null),[x,S]=K.useState(null),[v,m]=K.useState(!1),[b,w]=K.useState(!1),[_,T]=K.useState(null),[N,E]=K.useState(null),[k,L]=K.useState(null),[A,M]=K.useState(!0);async function O(){w(!0),T(null);try{const{runId:Y}=await Ue.rerunOnboarding(t.id);r==null||r(Y),e()}catch(Y){T(Y instanceof Error?Y.message:String(Y)),w(!1)}}K.useEffect(()=>{function Y(Q){Q.key==="Escape"&&e()}return document.addEventListener("keydown",Y),()=>document.removeEventListener("keydown",Y)},[e]),K.useEffect(()=>{u(!0);const Y=n!=null&&n!==""?{focus:n,limit:120}:void 0;Ue.getRepoGraph(t.id,Y).then(({graph:Q})=>{if(d(Q),Y!==void 0&&Q!==null){const te=Q.nodes.find(ie=>ie.id===n||ie.name===n);te&&(L(te),E(te.id))}}).catch(()=>d(null)).finally(()=>u(!1))},[t.id,n]),K.useEffect(()=>{s!=="domain"||p!==null||(m(!0),Ue.getRepoDomainGraph(t.id).then(({graph:Y,coverage:Q})=>{f(Y),S(Q)}).catch(()=>{f(null),S(null)}).finally(()=>m(!1)))},[s,p,t.id]);function $(Y){E(Y.id),L(Y)}function D(Y){L(Y),Y!==null&&E(Y.id),j(null)}const[B,j]=K.useState(null),[I,U]=K.useState(!1),[F,P]=K.useState(!1);function H(Y){U(!0),Ue.getBlastRadius(t.id,Y.name||Y.id).then(j).catch(()=>j({target:Y.name,dependents:[],unresolved:-1})).finally(()=>U(!1))}function W(Y){d(Q=>{if(Q===null)return Q;const te=new Set(Q.nodes.map(je=>je.id)),ie=[...Q.nodes,...Y.nodes.filter(je=>!te.has(je.id))],le=je=>`${je.src}→${je.tgt}`,pe=new Set(Q.edges.map(le)),Le=[...Q.edges,...Y.edges.filter(je=>!pe.has(le(je)))];return{nodes:ie,edges:Le,stats:{nodeCount:ie.length,edgeCount:Le.length,fileCount:new Set(ie.map(je=>je.file)).size}}})}function V(Y){P(!0),Ue.getRepoGraph(t.id,{focus:Y.id,limit:60}).then(({graph:Q})=>{Q!==null&&W(Q)}).catch(()=>{}).finally(()=>P(!1))}function re(Y){j(null);const Q=c==null?void 0:c.nodes.find(te=>te.id===Y.id);if(Q){D(Q);return}Ue.getRepoGraph(t.id,{focus:Y.id,limit:60}).then(({graph:te})=>{if(te===null)return;W(te);const ie=te.nodes.find(le=>le.id===Y.id)??te.nodes.find(le=>le.name===Y.name);ie&&D(ie)}).catch(()=>{})}function J(Y){const te=Y.toLowerCase().split("/"),ie=te[te.length-1]??"";return te.some(le=>le==="test"||le==="tests"||le==="spec"||le==="specs"||le==="__tests__"||le==="e2e")||ie.startsWith("test_")||/_(test|spec|tests|suite)\.[^.]+$/.test(ie)||/\.(test|spec)\.[^.]+$/.test(ie)}const ne=c?c.nodes.filter(Y=>!(!Y.file||Y.file.startsWith("node_modules/")||A&&J(Y.file))):[],X=ne.length===0;function q({value:Y,current:Q,label:te,onChange:ie}){const le=Y===Q;return y.jsx("button",{type:"button",onClick:()=>ie(Y),className:"rounded px-2.5 py-1 text-[11px] font-mono font-medium transition-colors",style:{background:le?Oe.surface:"transparent",color:le?Oe.ink:Oe.muted,boxShadow:le?"0 1px 4px rgba(0,0,0,0.4)":"none"},children:te})}return y.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"rgba(0,0,0,0.75)"},onMouseDown:Y=>{Y.target===Y.currentTarget&&e()},children:y.jsxs("div",{className:"w-[92vw] h-[92vh] rounded-2xl flex flex-col overflow-hidden",style:{background:Oe.blue,border:`1px solid ${Oe.hairlineS}`,boxShadow:"0 40px 80px -20px rgba(0,0,0,0.8)"},children:[y.jsxs("div",{className:"flex items-center gap-3 px-5 py-3 border-b shrink-0",style:{background:Oe.blue2,borderColor:Oe.hairline},children:[y.jsx("span",{className:"text-[13px] font-semibold font-mono mr-1",style:{color:Oe.ink},children:t.name}),y.jsx("div",{className:"flex gap-0.5 rounded p-0.5",style:{background:"rgba(0,0,0,0.25)"},children:["code","domain"].map(Y=>y.jsx(q,{value:Y,current:s,label:Y==="code"?"Code":"Domain",onChange:o},Y))}),s==="code"&&y.jsx("div",{className:"flex gap-0.5 rounded p-0.5",style:{background:"rgba(0,0,0,0.25)"},children:["graph","hotspots"].map(Y=>y.jsx(q,{value:Y,current:i,label:Y==="graph"?"Graph":"Hotspots",onChange:a},Y))}),s==="code"&&y.jsx("button",{type:"button",onClick:()=>M(Y=>!Y),className:"flex items-center gap-1.5 px-2 py-1 rounded text-[10px] font-mono font-medium transition-colors border",style:{borderColor:A?Oe.hairline:"rgba(255,218,25,0.4)",background:A?"rgba(0,0,0,0.2)":"rgba(255,218,25,0.08)",color:A?Oe.faint:Oe.accent},children:A?"tests hidden":"tests shown"}),c&&s==="code"&&y.jsxs("span",{className:"text-[10px] font-mono px-2 py-0.5 rounded",style:{background:"rgba(0,0,0,0.2)",color:Oe.muted},children:[ne.length," nodes · ",c.stats.edgeCount," edges"]}),y.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:Oe.faint},onMouseEnter:Y=>Y.currentTarget.style.color=Oe.ink,onMouseLeave:Y=>Y.currentTarget.style.color=Oe.faint,children:"×"})]}),y.jsx("div",{className:"flex-1 overflow-hidden",style:{background:Oe.blue},children:l?y.jsx("div",{className:"flex items-center justify-center h-full",children:y.jsx("span",{className:"text-sm font-mono",style:{color:Oe.muted},children:"Loading…"})}):s==="domain"?v?y.jsx("div",{className:"flex items-center justify-center h-full",children:y.jsx("span",{className:"text-sm font-mono",style:{color:Oe.muted},children:"Loading domain graph…"})}):p?y.jsx($O,{graph:p}):y.jsx("div",{className:"flex items-center justify-center h-full",children:y.jsxs("div",{className:"max-w-sm w-full mx-auto p-6 rounded-xl border flex flex-col gap-4",style:{border:`1px solid ${Oe.hairlineS}`,background:Oe.canvas2},children:[y.jsx("p",{className:"text-sm font-semibold font-mono",style:{color:Oe.ink},children:"Domain graph not yet generated"}),y.jsxs("p",{className:"text-xs leading-relaxed",style:{color:Oe.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",y.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 ",y.jsx("span",{className:"font-mono",children:"wicked-core domain-graph"}),"."]}),x?y.jsxs("div",{className:"rounded-lg p-4 flex flex-col gap-2 border",style:{border:`1px solid ${Oe.hairline}`},children:[y.jsxs("div",{className:"flex justify-between items-baseline",children:[y.jsx("span",{className:"text-[11px] font-mono",style:{color:Oe.muted},children:"Annotation coverage"}),y.jsx("span",{className:"text-[11px] font-mono font-bold",style:{color:Oe.ink},children:x.behavior_bearing===0?"not extracted":x.coverage<1&&x.coverage*100>=99.95?"<100%":`${(x.coverage*100).toFixed(1)}%`})]}),y.jsx("div",{className:"w-full h-1.5 rounded-full overflow-hidden",style:{background:Oe.surface},children:y.jsx("div",{className:"h-full rounded-full",style:{width:x.behavior_bearing===0?"0%":`${Math.max(x.coverage*100,.5)}%`,background:Oe.ok}})}),y.jsxs("div",{className:"flex gap-4 mt-1 text-[10px] font-mono tabular-nums",style:{color:Oe.faint},children:[y.jsxs("span",{children:[x.resolved.toLocaleString()," resolved"]}),y.jsxs("span",{children:[x.behavior_bearing.toLocaleString()," behavior-bearing"]}),y.jsxs("span",{children:[x.total.toLocaleString()," total"]})]})]}):y.jsx("p",{className:"text-[11px] font-mono",style:{color:Oe.faint},children:"No coverage data — run onboarding first."}),y.jsx("button",{type:"button",onClick:()=>void O(),disabled:b,className:"self-start rounded-lg px-4 py-2 text-sm font-semibold disabled:opacity-50",style:{background:Oe.accent,color:Oe.accentInk},children:b?"Starting…":"Run annotation workflow →"}),_&&y.jsx("p",{className:"text-[11px] font-mono",style:{color:Oe.deny},children:_})]})}):X?y.jsx("div",{className:"flex items-center justify-center h-full",children:y.jsx("p",{className:"text-sm font-mono",style:{color:Oe.muted},children:"Code graph not yet available — run onboarding first."})}):y.jsxs("div",{className:"h-full flex p-4 gap-4",children:[y.jsxs("div",{className:"flex-1 flex flex-col gap-3 min-w-0 overflow-hidden",children:[y.jsxs("div",{className:"rounded-xl overflow-hidden flex flex-col",style:{display:i==="graph"?"flex":"none",flex:1,border:`1px solid ${Oe.hairlineS}`,background:Oe.canvas2,boxShadow:"0 20px 50px -20px rgba(0,0,0,0.6)"},children:[y.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 border-b shrink-0",style:{background:Oe.canvas,borderColor:Oe.hairline},children:[y.jsx(r2,{}),y.jsxs("span",{className:"font-mono text-[10px] ml-1",style:{color:Oe.faint},children:["code-graph · ",y.jsx("span",{style:{color:Oe.link},children:t.name})]}),y.jsxs("span",{className:"ml-auto font-mono text-[9px] px-2 py-0.5 rounded",style:{background:Oe.surface,color:Oe.muted},children:[ne.length," nodes"]})]}),y.jsx("div",{className:"flex-1 overflow-hidden",style:{background:Oe.canvas},children:y.jsx(IC,{nodes:ne,edges:c.edges,externalSelectedId:N,onNodeSelect:D})})]}),y.jsxs("div",{className:"rounded-xl overflow-hidden flex flex-col",style:{display:i==="hotspots"?"flex":"none",flex:1,border:`1px solid ${Oe.hairlineS}`,background:Oe.canvas2,boxShadow:"0 20px 50px -20px rgba(0,0,0,0.6)"},children:[y.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 border-b shrink-0",style:{background:Oe.canvas,borderColor:Oe.hairline},children:[y.jsx(r2,{}),y.jsxs("span",{className:"font-mono text-[10px] ml-1",style:{color:Oe.faint},children:["hotspots · ",y.jsx("span",{style:{color:Oe.link},children:t.name})]})]}),y.jsx("div",{className:"flex-1 overflow-hidden",style:{background:Oe.surface2},children:y.jsx(jO,{nodes:ne,selectedId:(k==null?void 0:k.id)??null,onSelect:$})})]})]}),k&&y.jsx(zO,{node:k,edges:c.edges,onClose:()=>L(null),onBlast:H,onExpand:V,blast:B,blastBusy:I,expandBusy:F,onFocusDependent:re})]})})]})})}const WO=new Set(["sessionStarted","unitPlanned","unitDistributed","unitExecuting","gateDecided","unitDone","unitDenied","awaitingHuman","resumed","runCancelled","sessionFailed","sessionCompleted"]);function VO(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,governanceUnenforced:null,outputBytes:null,outputGoverned:!1,reworkAmendment:null}}function n2(t){return JSON.stringify([t.criterion,t.hasDeterministicFloor,t.deterministicPass,t.agentVerdict,t.agentReasoning,t.evaluatorPass,t.evaluatorPolicies,t.denialReason,t.combined])}function GO(t,e){var S;const r={...t.session},n=new Map;for(const v of t.units)n.set(v.ord,{ord:v.ord,description:v.description,stage:v.stage,status:v.status,resolved:!0,assignedCli:v.assigned_cli,assignedInvocation:v.assigned_invocation,routing:v.routing,denialReason:v.denial_reason,skillRef:v.skill_ref??null,phaseStatus:v.phase_status,role:v.role??null,gate:v.gate??null,hasValidatorPin:v.has_validator_pin??!1,executorType:v.tool_cmd!=null?"tool":"agent",attempts:[],usage:[],filesRead:[],gateEvals:[],stepErrors:[],crashRedrives:0,workerSessionReuses:0,contextInjections:[],hookFires:[],validationPinAttached:!1,gateEscalated:!1,toolExecutorCmd:v.tool_cmd??null,governanceArmed:!1,governanceUnenforced:null,outputBytes:null,outputGoverned:!1,reworkAmendment:null});let i=r.status==="awaiting_human"?{ord:((S=t.units[r.unit_ix])==null?void 0:S.ord)??r.unit_ix+1,prompt:null}:null,a=null;const s=[];let o=null,l=t.session.workflow_id||null;const u=new Map,c=new Set,d=new Set,p=new Set,f=v=>{let m=n.get(v);return m===void 0&&(m=VO(v),n.set(v,m)),m};for(const v of e){const m=typeof v.ord=="number"?v.ord:void 0;switch(v.type){case"sessionStarted":r.status="planning";break;case"unitPlanned":if(m!==void 0){const b=f(m);b.description=typeof v.description=="string"?v.description:b.description;const w=(v.hasValidatorPin??v.has_validator_pin)===!0,_=v.executorType??v.executor_type,T=v.skillRef??v.skill_ref;b.resolved?(b.role===null&&typeof v.role=="string"&&(b.role=v.role),b.gate===null&&typeof v.gate=="string"&&(b.gate=v.gate),!b.hasValidatorPin&&w&&(b.hasValidatorPin=!0),b.executorType===null&&typeof _=="string"&&(b.executorType=_)):(typeof v.stage=="string"&&(b.stage=v.stage),typeof v.role=="string"&&(b.role=v.role),typeof v.gate=="string"&&(b.gate=v.gate),b.hasValidatorPin=w,typeof _=="string"&&(b.executorType=_)),!b.skillRef&&typeof T=="string"&&(b.skillRef=T)}break;case"unitDistributed":if(m!==void 0){const b=f(m);b.status==="pending"&&(b.status="distributed"),typeof v.cli=="string"&&b.assignedCli===null&&(b.assignedCli=v.cli)}break;case"unitExecuting":if(m!==void 0){const b=f(m);b.status==="pending"&&(b.status="distributed")}break;case"unitDone":m!==void 0&&(f(m).status="done");break;case"unitDenied":m!==void 0&&(f(m).status="rejected");break;case"awaitingHuman":m!==void 0&&(r.status="awaiting_human",i={ord:m,prompt:typeof v.prompt=="string"?v.prompt:null});break;case"resumed":r.status="executing",i=null;break;case"runCancelled":r.status="cancelled",i=null;break;case"sessionFailed":r.status="failed",i=null;break;case"sessionCompleted":r.status="completed",i=null;break;case"unitDispatched":if(m!==void 0&&typeof v.attempt=="number"){const b=f(m);b.attempts.includes(v.attempt)||(b.attempts.push(v.attempt),b.attempts.sort((w,_)=>w-_))}break;case"cliUsage":if(m!==void 0&&typeof v.attempt=="number"&&typeof v.inputTokens=="number"&&typeof v.outputTokens=="number"){const b=f(m),w=typeof v.costUsd=="number"?v.costUsd:null,_=v,T=typeof _.cacheReadTokens=="number"?_.cacheReadTokens:0,N=typeof _.cacheCreationTokens=="number"?_.cacheCreationTokens:0,E=b.usage.find(k=>k.attempt===v.attempt);E?(E.inputTokens=v.inputTokens,E.outputTokens=v.outputTokens,E.costUsd=w,E.cacheReadTokens=T,E.cacheCreationTokens=N):b.usage.push({attempt:v.attempt,inputTokens:v.inputTokens,outputTokens:v.outputTokens,costUsd:w,cacheReadTokens:T,cacheCreationTokens:N})}break;case"dataUsed":if(m!==void 0&&Array.isArray(v.files)){const b=f(m);for(const w of v.files)typeof w=="string"&&!b.filesRead.includes(w)&&b.filesRead.push(w)}break;case"gateEvaluated":if(m!==void 0){const b=f(m),w={criterion:v.criterion??null,hasDeterministicFloor:v.hasDeterministicFloor===!0,deterministicPass:v.deterministicPass===!0,agentVerdict:v.agentVerdict??null,agentReasoning:v.agentReasoning??null,evaluatorPass:typeof v.evaluatorPass=="boolean"?v.evaluatorPass:null,evaluatorPolicies:Array.isArray(v.evaluatorPolicies)?v.evaluatorPolicies.filter(T=>typeof T=="string"):[],denialReason:v.denialReason??null,combined:v.combined===!0},_=n2(w);b.gateEvals.some(T=>n2(T)===_)||b.gateEvals.push(w)}break;case"stepFailed":if(m!==void 0&&typeof v.attempt=="number"&&typeof v.detail=="string"&&typeof v.failureKind=="string"){const b=f(m);b.stepErrors.some(w=>w.attempt===v.attempt)||b.stepErrors.push({attempt:v.attempt,detail:v.detail,failureKind:v.failureKind})}break;case"crashRecoveryRedrive":if(m!==void 0&&typeof v.attempt=="number"){let b=u.get(m);b||(b=new Set,u.set(m,b)),b.has(v.attempt)||(b.add(v.attempt),f(m).crashRedrives+=1)}break;case"workerSessionStarted":typeof v.terminalId=="string"&&(a=v.terminalId);break;case"acpSessionStarted":break;case"acpFallback":typeof v.cliKey=="string"&&typeof v.reason=="string"&&typeof v.fallbackKind=="string"&&(s.some(w=>w.cliKey===v.cliKey&&w.reason===v.reason&&w.fallbackKind===v.fallbackKind)||s.push({cliKey:v.cliKey,reason:v.reason,fallbackKind:v.fallbackKind}));break;case"workerSessionReused":if(m!==void 0&&typeof v.terminalId=="string"){const b=`${m}:${v.terminalId}`;c.has(b)||(c.add(b),f(m).workerSessionReuses+=1)}break;case"workerSessionClosed":typeof v.terminalId=="string"&&(v.reason==="run_complete"||v.reason==="error")&&(o={terminalId:v.terminalId,reason:v.reason});break;case"unitContextInjected":if(m!==void 0&&Array.isArray(v.priorUnits)&&!d.has(m)){d.add(m);const b=f(m);for(const w of v.priorUnits)if(typeof w=="object"&&w!==null){const _=w;typeof _.ord=="number"&&typeof _.label=="string"&&typeof _.outputBytes=="number"&&b.contextInjections.push({ord:_.ord,label:_.label,outputBytes:_.outputBytes})}}break;case"governanceHookFired":if(m!==void 0&&typeof v.attempt=="number"&&typeof v.toolName=="string"&&(v.decision==="allow"||v.decision==="deny")){const b=`${m}:${v.attempt}:${v.toolName}`;p.has(b)||(p.add(b),f(m).hookFires.push({toolName:v.toolName,decision:v.decision,denyingPolicy:typeof v.denyingPolicy=="string"?v.denyingPolicy:null}))}break;case"validationPinAttached":m!==void 0&&(f(m).validationPinAttached=!0);break;case"gateEscalated":m!==void 0&&(f(m).gateEscalated=!0);break;case"toolExecutorDispatched":m!==void 0&&Array.isArray(v.cmd)&&(f(m).toolExecutorCmd=v.cmd);break;case"governanceContextArmed":m!==void 0&&(f(m).governanceArmed=!0);break;case"governanceUnenforced":m!==void 0&&typeof v.cli=="string"&&typeof v.reason=="string"&&(f(m).governanceUnenforced={cli:v.cli,reason:v.reason});break;case"workflowSelected":l===null&&typeof v.workflowId=="string"&&(l=v.workflowId);break;case"unitReworkAmended":if(m!==void 0&&typeof v.amendment=="string"){const b=f(m);b.reworkAmendment=v.amendment,typeof v.updatedDescription=="string"&&(b.description=v.updatedDescription)}break;case"unitOutputCaptured":if(m!==void 0&&typeof v.attempt=="number"&&typeof v.outputBytes=="number"&&typeof v.governed=="boolean"){const b=f(m);b.outputBytes=v.outputBytes,b.outputGoverned=v.governed}break}}const x=[...n.values()].sort((v,m)=>v.ord-m.ord);return{session:r,units:x,pendingGate:i,activeTerminalId:a,acpFallbacks:s,lastWorkerClose:o,selectedWorkflow:l}}function i2(t){return(t.split(/[\\/]/).pop()??t).replace(/\.(exe|cmd|bat)$/i,"").toLowerCase()}function qO(t,e){const r=t==null?void 0:t.trim();return r?i2(r.split(/\s+/)[0]??"")==="claude":e!==null&&i2(e)==="claude"}function YO(t){let e=0,r=0,n=0,i=0,a=0,s=0,o=0,l=0;const u=new Map,c=new Set,d=new Set;for(const f of t.units){const x=f.status==="distributed"||f.status==="done"||f.status==="rejected";f.usage.length===0&&f.assignedCli!==null&&x&&(qO(f.assignedInvocation,f.assignedCli)?d.add(f.assignedCli):c.add(f.assignedCli));const S=f.assignedCli??"unknown",v=f.usage.length>0?Math.min(...f.usage.map(m=>m.attempt)):0;for(const m of f.usage){o+=1,e+=m.inputTokens,r+=m.outputTokens,m.costUsd!==null&&(a+=m.costUsd,s+=1),m.attempt>v&&(l+=m.inputTokens+m.outputTokens),n+=m.cacheReadTokens,i+=m.cacheCreationTokens;const b=u.get(S)??{cli:S,input:0,output:0,cost:null};b.input+=m.inputTokens,b.output+=m.outputTokens,m.costUsd!==null&&(b.cost=(b.cost??0)+m.costUsd),u.set(S,b)}}const p=e+r;return{totalInput:e,totalOutput:r,totalTokens:p,totalCost:s>0?a:null,costComplete:o>0&&s===o,reworkTokens:l,reworkPct:p>0?l/p*100:0,perCli:[...u.values()],noAdapterClis:[...c],pendingUsageClis:[...d],hasUsage:o>0,totalCacheRead:n,totalCacheCreation:i}}const KO=[];function XO(t,e){const r=ho(s=>s.byRun[t])??KO,[n,i]=K.useState(e??null),a=ho(s=>{const o=s.byRun[t];if(o===void 0)return 0;let l=0;for(const u of o)WO.has(u.type)&&(l+=1);return l});return K.useEffect(()=>{let s=!1;return(async()=>{try{const{run:o}=await Ue.getRun(t);s||i(o)}catch{}})(),()=>{s=!0}},[t,a]),K.useMemo(()=>n===null||n.session.id!==t?null:GO(n,r),[n,r,t])}function ch(t){return t.seated==null?`${t.returned} polled`:`${t.returned} of ${t.seated} seats`}function yu(t){return t.seated!=null&&t.returned*2<=t.seated}function QO(t){return t.dissent===0&&!yu(t)}function ZO(t){if(t.method==="council"){if(QO(t))return`council: ${t.winner} (unanimous)`;const e=`${t.dissent} dissent, ${t.agreement_pct}% agreement`;return yu(t)?`council: ${t.winner} (quorum lost — ${ch(t)}, ${e})`:`council: ${t.winner} (${e})`}return t.method==="evaluator_distinct"?`evaluator≠creator: ${t.winner} (was ${t.was})`:t.method==="tool"?"tool: direct command (no council)":`degraded: ${t.reason}`}function JO({model:t}){const e=t.units.filter(n=>n.resolved&&n.routing!=null),r=Wn(n=>n.assumptions[t.session.id])??[];return y.jsxs("div",{"data-testid":"assumptions",className:"flex flex-col gap-2 text-[11px]",children:[r.length>0&&y.jsxs("div",{className:"flex flex-col gap-1",children:[y.jsx("p",{className:"font-mono font-semibold",style:{color:"rgba(230,237,243,0.6)"},children:"external transformations"}),y.jsx("ul",{className:"flex flex-col gap-1",children:r.map((n,i)=>y.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:[y.jsxs("div",{className:"flex items-center gap-1.5",children:[y.jsxs("span",{style:{color:"#e6edf3"},children:["unit #",n.ord]}),y.jsx("span",{style:{color:"#79c0ff"},children:n.library}),!n.known&&y.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"})]}),y.jsx("p",{style:{color:"rgba(230,237,243,0.7)"},children:n.transform}),y.jsx("p",{style:{color:"rgba(230,237,243,0.45)"},children:n.detail})]},`${n.ord}:${n.library}:${i}`))})]}),e.length===0?y.jsx("p",{style:{color:"rgba(230,237,243,0.4)"},children:"No routing decisions recorded yet."}):y.jsx("ul",{className:"flex flex-col gap-1",children:e.map(n=>y.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:[y.jsxs("span",{className:"font-medium",style:{color:"#e6edf3"},children:["unit #",n.ord]}),n.description.includes(" — ")&&y.jsx("span",{className:"ml-1",style:{color:"rgba(230,237,243,0.4)"},children:n.description.split(" — ")[0]})," ","— ",ZO(n.routing)]},n.ord))})]})}const ej=new Set(["completed","cancelled","failed"]),tj=new Intl.NumberFormat("en-US");function Za(t){return tj.format(t)}function a2(t){return t===null?"—":`$${t.toFixed(4)}`}function rj({model:t}){const e=YO(t),n=!ej.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 y.jsxs("div",{"data-testid":"burn",className:"flex flex-col gap-2 text-[11px]",children:[e.hasUsage?y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[y.jsxs("div",{style:i,children:[y.jsxs("p",{style:{color:"rgba(230,237,243,0.4)"},children:["tokens",n?" (partial)":""]}),y.jsx("p",{className:"font-mono text-sm",style:{color:"#e6edf3"},children:Za(e.totalTokens)}),y.jsxs("p",{className:"text-[10px]",style:{color:"rgba(230,237,243,0.35)"},children:[Za(e.totalInput)," in / ",Za(e.totalOutput)," out"]}),(e.totalCacheRead>0||e.totalCacheCreation>0)&&y.jsxs("p",{className:"text-[10px]",style:{color:"rgba(96,165,250,0.55)"},children:[Za(e.totalCacheRead)," cached · ",Za(e.totalCacheCreation)," written"]})]}),y.jsxs("div",{style:i,children:[y.jsxs("p",{style:{color:"rgba(230,237,243,0.4)"},children:["cost",e.costComplete&&!n?"":" (partial)"]}),y.jsx("p",{className:"font-mono text-sm",style:{color:"#e6edf3"},children:a2(e.totalCost)}),e.totalCost===null&&y.jsx("p",{className:"text-[10px]",style:{color:"rgba(230,237,243,0.35)"},children:"no cost reported"})]}),y.jsxs("div",{style:i,"data-testid":"burn-rework",children:[y.jsxs("p",{style:{color:"rgba(230,237,243,0.4)"},children:["rework",n?" (prov.)":""]}),y.jsxs("p",{className:"font-mono text-sm",style:{color:"#e6edf3"},children:[n?"~":"",e.reworkPct.toFixed(0),"%"]}),y.jsxs("p",{className:"text-[10px]",style:{color:"rgba(230,237,243,0.35)"},children:[Za(e.reworkTokens)," tok"]})]})]}),n&&y.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."}),y.jsxs("div",{children:[y.jsx("p",{className:"mb-1",style:{color:"rgba(230,237,243,0.4)"},children:"per CLI"}),y.jsx("ul",{className:"flex flex-col gap-0.5",children:e.perCli.map(a=>y.jsxs("li",{className:"flex justify-between font-mono",style:{color:"rgba(230,237,243,0.6)"},children:[y.jsx("span",{children:a.cli}),y.jsxs("span",{children:[Za(a.input+a.output)," tok · ",a2(a.cost)]})]},a.cli))})]})]}):y.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 ",y.jsx("code",{children:"cliUsage"})," ","(claude reports tokens + cost directly)."]}),e.noAdapterClis.length>0&&y.jsxs("p",{style:{color:"#ffda19"},"data-testid":"burn-unavailable",children:["usage unavailable for ",e.noAdapterClis.join(", ")," — no usage adapter"]}),e.pendingUsageClis.length>0&&y.jsxs("p",{style:{color:"rgba(230,237,243,0.4)"},"data-testid":"burn-pending",children:["usage not yet reported for ",e.pendingUsageClis.join(", ")]})]})}function nj({model:t}){const e=t.units.filter(r=>r.filesRead.length>0);return y.jsxs("div",{"data-testid":"data-used",className:"flex flex-col gap-2 text-[11px]",children:[e.length===0?y.jsxs("p",{style:{color:"rgba(230,237,243,0.4)"},"data-testid":"data-used-empty",children:["No files-read captured yet — populated from claude ",y.jsx("code",{children:"tool_use"})," blocks via"," ",y.jsx("code",{children:"dataUsed"}),"."]}):y.jsx("ul",{className:"flex flex-col gap-2",children:e.map(r=>y.jsxs("li",{"data-testid":"data-used-unit","data-ord":r.ord,children:[y.jsxs("p",{className:"font-semibold font-mono",style:{color:"rgba(230,237,243,0.7)"},children:["unit #",r.ord,r.assignedCli?` · ${r.assignedCli}`:""]}),y.jsx("ul",{className:"mt-0.5 flex flex-col gap-0.5",children:r.filesRead.map(n=>y.jsx("li",{className:"truncate font-mono",style:{color:"rgba(230,237,243,0.45)"},title:n,children:n},n))})]},r.ord))}),y.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 ij({routing:t}){return t?t.method==="council"?y.jsxs("p",{className:"text-[11px] font-mono",style:{color:"rgba(230,237,243,0.45)"},"data-testid":"routing-provenance",children:[y.jsx("span",{className:"font-medium",style:{color:"rgba(230,237,243,0.6)"},children:"Council:"})," ",t.winner," won · ",t.agreement_pct,"% agreement · ",ch(t)," · ",t.dissent," dissent",yu(t)&&y.jsx("span",{style:{color:"#ffda19"},children:" · quorum lost"})]}):t.method==="degraded"?y.jsxs("p",{className:"text-[11px] font-mono",style:{color:"#ffda19"},"data-testid":"routing-provenance",children:[y.jsx("span",{className:"font-medium",children:"Degraded:"})," ",t.reason]}):t.method==="tool"?y.jsxs("p",{className:"text-[11px] font-mono",style:{color:"rgba(230,237,243,0.4)"},"data-testid":"routing-provenance",children:[y.jsx("span",{className:"font-medium",children:"Tool:"})," direct command — no council"]}):y.jsxs("p",{className:"text-[11px] font-mono",style:{color:"#a78bfa"},"data-testid":"routing-provenance",children:[y.jsx("span",{className:"font-medium",children:"Evaluator-distinct:"})," ",t.winner," (was ",t.was,")"]}):null}function aj(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===!0&&t.evaluatorPolicies.length>0?"evaluator (2nd pass)":t.agentVerdict!==null?"agent judge":t.hasDeterministicFloor?"deterministic floor":"ungated"}function sj({model:t}){const{units:e,session:r,pendingGate:n}=t,i=e.filter(l=>l.routing!==null||l.denialReason!==null||l.gateEvals.length>0),a=n!==null?n.ord+1:r.status==="executing"?r.unit_ix:null,s=(()=>{if(a===null)return!1;const l=r.human_confirm;return l==="all"?!0:l==="none"?!1:l.before===a})(),o={background:"#161c26",border:"1px solid rgba(230,237,243,0.07)",borderRadius:"6px",padding:"8px"};return y.jsx("div",{"data-testid":"decisions-ledger",className:"flex flex-col gap-2",children:i.length===0&&n===null?y.jsx("p",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"No governed decisions recorded yet."}):y.jsxs("ol",{className:"flex flex-col gap-2",children:[i.map(l=>y.jsxs("li",{"data-testid":"ledger-row","data-ord":l.ord,style:o,children:[y.jsxs("div",{className:"flex items-center justify-between mb-1",children:[y.jsxs("div",{className:"flex items-center gap-1",children:[y.jsxs("span",{className:"font-semibold text-[11px] font-mono",style:{color:"#e6edf3"},children:["unit #",l.ord]}),(l.role==="creator"||l.role==="evaluator")&&y.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"&&y.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&&y.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]})]}),y.jsx("span",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.35)"},children:l.resolved?l.stage:"resolving…"})]}),y.jsx(ij,{routing:l.routing}),l.skillRef&&y.jsxs("p",{className:"text-[11px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:["skill: ",y.jsx("span",{style:{color:"rgba(230,237,243,0.6)"},children:l.skillRef})]}),l.gateEvals.map((u,c)=>y.jsxs("div",{className:"mt-1 rounded p-1.5",style:{background:"#0f1419",border:"1px solid rgba(230,237,243,0.05)"},children:[y.jsxs("p",{className:"text-[11px] font-mono",children:[y.jsx("span",{className:"font-semibold",style:{color:u.combined?"#3fb950":"#f85149"},children:u.combined?"ALLOW":"DENY"}),y.jsxs("span",{style:{color:"rgba(230,237,243,0.45)"},children:[" · ",aj(u),u.criterion?` · ${u.criterion}`:" · (ungated)"]})]}),u.hasDeterministicFloor&&y.jsxs("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:["deterministic: ",u.deterministicPass?"pass":"fail"]}),u.agentVerdict!==null&&y.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&&y.jsxs("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:["evaluator: ",u.evaluatorPass?"pass":"fail",u.evaluatorPolicies.length>0?` — ${u.evaluatorPolicies.join(", ")}`:u.evaluatorPass?" (no policy applied)":""]}),u.denialReason&&y.jsxs("p",{className:"text-[10px] font-mono",style:{color:"#f85149"},children:["reason: ",u.denialReason]})]},c)),l.denialReason&&l.gateEvals.length===0&&y.jsxs("p",{className:"mt-1 text-[11px] font-mono",style:{color:"#f85149"},"data-testid":"ledger-denial",children:["denied: ",l.denialReason]})]},l.ord)),n!==null&&y.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:[y.jsx("span",{className:"font-semibold",children:"PENDING"})," · awaiting human · before unit #",n.ord,n.prompt?` — ${n.prompt}`:""]}),a!==null&&y.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:[s?"next decision point · unit #":"next unit · unit #",a,s?" (human-confirm gate)":""]})]})})}function oj({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 y.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 lj({claim:t}){const[e,r]=K.useState(!1),n=new Date(t.evaluated_at*1e3).toLocaleTimeString();return y.jsxs("li",{className:"rounded p-2 text-[11px]",style:{background:"#161c26",border:"1px solid rgba(230,237,243,0.07)"},children:[y.jsxs("div",{className:"flex items-center justify-between gap-2",children:[y.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[y.jsx(oj,{decision:t.decision}),y.jsx("span",{className:"font-mono truncate",style:{color:"rgba(230,237,243,0.6)"},children:t.phase})]}),y.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[y.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)&&y.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&&y.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&&y.jsxs("p",{children:[y.jsx("span",{className:"font-semibold",style:{color:"rgba(230,237,243,0.7)"},children:"criteria: "}),t.criteria]}),t.policy_ids.length>0&&y.jsxs("div",{children:[y.jsx("p",{className:"font-semibold",style:{color:"rgba(230,237,243,0.7)"},children:"policies matched:"}),y.jsx("ul",{className:"list-inside list-disc pl-1",children:t.policy_ids.map(i=>y.jsx("li",{children:i},i))})]}),t.obligations.length>0&&y.jsxs("div",{children:[y.jsx("p",{className:"font-semibold",style:{color:"rgba(230,237,243,0.7)"},children:"obligations:"}),y.jsx("ul",{className:"list-inside list-disc pl-1",children:t.obligations.map((i,a)=>y.jsx("li",{children:i},a))})]}),y.jsxs("p",{children:["evaluator: ",y.jsx("span",{children:t.evaluator_identity})," · ","claim: ",y.jsx("span",{children:t.claim_id})]})]})]})}function uj({model:t}){const[e,r]=K.useState([]),[n,i]=K.useState(!0),[a,s]=K.useState(null),o=K.useCallback(async()=>{i(!0),s(null);try{const{claims:d}=await Ue.listClaims();r(d.filter(p=>p.scope===t.session.id).sort((p,f)=>p.evaluated_at-f.evaluated_at))}catch(d){s(d instanceof Error?d.message:String(d))}finally{i(!1)}},[t.session.id]);K.useEffect(()=>{o()},[o]);const l=y.jsx("button",{type:"button",onClick:()=>void o(),className:"self-start text-[10px] font-mono hover:underline",style:{color:"rgba(230,237,243,0.4)"},children:"Refresh"});if(n)return y.jsx("p",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Loading governance claims…"});if(a)return y.jsxs("div",{className:"flex flex-col gap-1",children:[y.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:a}),l]});if(e.length===0)return y.jsxs("div",{className:"flex flex-col gap-1",children:[y.jsx("p",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"No governance claims recorded for this run."}),y.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(d=>d.decision==="deny").length,c=e.filter(d=>d.decision==="allow_with_conditions").length;return y.jsxs("div",{className:"flex flex-col gap-2",children:[y.jsxs("div",{className:"flex items-center justify-between",children:[y.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&&y.jsxs("span",{className:"ml-1 font-semibold",style:{color:"#f85149"},children:["· ",u," denied"]}),c>0&&y.jsxs("span",{className:"ml-1",style:{color:"#ffda19"},children:["· ",c," with obligations"]})]}),l]}),y.jsx("ol",{className:"flex flex-col gap-1.5",children:e.map(d=>y.jsx(lj,{claim:d},d.claim_id))})]})}function Kv({title:t,onClose:e,children:r,disableEscapeKey:n}){const i=K.useId();return K.useEffect(()=>{if(n)return;function a(s){s.key==="Escape"&&e()}return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[e,n]),y.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"rgba(0,0,0,0.6)"},children:y.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:[y.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:[y.jsx("h2",{id:i,className:"text-sm font-semibold font-mono",style:{color:"#e6edf3"},children:t}),y.jsx("button",{type:"button",onClick:e,className:"text-lg leading-none transition-colors",style:{color:"rgba(230,237,243,0.35)"},onMouseEnter:a=>{a.currentTarget.style.color="#e6edf3"},onMouseLeave:a=>{a.currentTarget.style.color="rgba(230,237,243,0.35)"},"aria-label":"Close",children:"✕"})]}),y.jsx("div",{className:"flex-1 overflow-auto p-4",children:r})]})})}const cj={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 dj({runId:t}){const e=cm(r=>r.entries).filter(r=>r.runId===t);return e.length===0?y.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."}):y.jsxs("div",{className:"flex flex-col gap-2",children:[y.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."}),y.jsx("ol",{"data-testid":"steering-timeline",className:"flex flex-col gap-2",children:e.map(r=>{const n=cj[r.action];return y.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:[y.jsxs("div",{className:"flex items-center justify-between",children:[y.jsx("span",{className:"font-semibold font-mono",style:{color:n.color},children:n.label}),y.jsx("span",{className:"font-mono",style:{color:"rgba(230,237,243,0.35)"},children:typeof r.ord=="number"?`before unit #${r.ord}`:"—"})]}),r.amend&&y.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:[y.jsx("span",{className:"font-medium",style:{color:"#e6edf3"},children:"amended instruction:"})," ",r.amend]}),y.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 Jg={exports:{}},s2;function hj(){return s2||(s2=1,(function(t,e){(function(r,n){t.exports=n()})(globalThis,(()=>(()=>{var r={4567:function(s,o,l){var u=this&&this.__decorate||function(b,w,_,T){var N,E=arguments.length,k=E<3?w:T===null?T=Object.getOwnPropertyDescriptor(w,_):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(b,w,_,T);else for(var L=b.length-1;L>=0;L--)(N=b[L])&&(k=(E<3?N(k):E>3?N(w,_,k):N(w,_))||k);return E>3&&k&&Object.defineProperty(w,_,k),k},c=this&&this.__param||function(b,w){return function(_,T){w(_,T,b)}};Object.defineProperty(o,"__esModule",{value:!0}),o.AccessibilityManager=void 0;const d=l(9042),p=l(9924),f=l(844),x=l(4725),S=l(2585),v=l(3656);let m=o.AccessibilityManager=class extends f.Disposable{constructor(b,w,_,T){super(),this._terminal=b,this._coreBrowserService=_,this._renderService=T,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 N=0;N<this._terminal.rows;N++)this._rowElements[N]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[N]);if(this._topBoundaryFocusListener=N=>this._handleBoundaryFocus(N,0),this._bottomBoundaryFocusListener=N=>this._handleBoundaryFocus(N,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 p.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((N=>this._handleResize(N.rows)))),this.register(this._terminal.onRender((N=>this._refreshRows(N.start,N.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((N=>this._handleChar(N)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
381
|
+
`)))),this.register(this._terminal.onA11yTab((N=>this._handleTab(N)))),this.register(this._terminal.onKey((N=>this._handleKey(N.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,v.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,f.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(b){for(let w=0;w<b;w++)this._handleChar(" ")}_handleChar(b){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==b&&(this._charsToAnnounce+=b):this._charsToAnnounce+=b,b===`
|
|
382
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=d.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(b){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(b)||this._charsToConsume.push(b)}_refreshRows(b,w){this._liveRegionDebouncer.refresh(b,w,this._terminal.rows)}_renderRows(b,w){const _=this._terminal.buffer,T=_.lines.length.toString();for(let N=b;N<=w;N++){const E=_.lines.get(_.ydisp+N),k=[],L=(E==null?void 0:E.translateToString(!0,void 0,void 0,k))||"",A=(_.ydisp+N+1).toString(),M=this._rowElements[N];M&&(L.length===0?(M.innerText=" ",this._rowColumns.set(M,[0,1])):(M.textContent=L,this._rowColumns.set(M,k)),M.setAttribute("aria-posinset",A),M.setAttribute("aria-setsize",T))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(b,w){const _=b.target,T=this._rowElements[w===0?1:this._rowElements.length-2];if(_.getAttribute("aria-posinset")===(w===0?"1":`${this._terminal.buffer.lines.length}`)||b.relatedTarget!==T)return;let N,E;if(w===0?(N=_,E=this._rowElements.pop(),this._rowContainer.removeChild(E)):(N=this._rowElements.shift(),E=_,this._rowContainer.removeChild(N)),N.removeEventListener("focus",this._topBoundaryFocusListener),E.removeEventListener("focus",this._bottomBoundaryFocusListener),w===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(w===0?-1:1),this._rowElements[w===0?1:this._rowElements.length-2].focus(),b.preventDefault(),b.stopImmediatePropagation()}_handleSelectionChange(){var L;if(this._rowElements.length===0)return;const b=document.getSelection();if(!b)return;if(b.isCollapsed)return void(this._rowContainer.contains(b.anchorNode)&&this._terminal.clearSelection());if(!b.anchorNode||!b.focusNode)return void console.error("anchorNode and/or focusNode are null");let w={node:b.anchorNode,offset:b.anchorOffset},_={node:b.focusNode,offset:b.focusOffset};if((w.node.compareDocumentPosition(_.node)&Node.DOCUMENT_POSITION_PRECEDING||w.node===_.node&&w.offset>_.offset)&&([w,_]=[_,w]),w.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(w={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(w.node))return;const T=this._rowElements.slice(-1)[0];if(_.node.compareDocumentPosition(T)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(_={node:T,offset:((L=T.textContent)==null?void 0:L.length)??0}),!this._rowContainer.contains(_.node))return;const N=({node:A,offset:M})=>{const O=A instanceof Text?A.parentNode:A;let $=parseInt(O==null?void 0:O.getAttribute("aria-posinset"),10)-1;if(isNaN($))return console.warn("row is invalid. Race condition?"),null;const D=this._rowColumns.get(O);if(!D)return console.warn("columns is null. Race condition?"),null;let B=M<D.length?D[M]:D.slice(-1)[0]+1;return B>=this._terminal.cols&&(++$,B=0),{row:$,column:B}},E=N(w),k=N(_);if(E&&k){if(E.row>k.row||E.row===k.row&&E.column>=k.column)throw new Error("invalid range");this._terminal.select(E.column,E.row,(k.row-E.row)*this._terminal.cols-E.column+k.column)}}_handleResize(b){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let w=this._rowContainer.children.length;w<this._terminal.rows;w++)this._rowElements[w]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[w]);for(;this._rowElements.length>b;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const b=this._coreBrowserService.mainDocument.createElement("div");return b.setAttribute("role","listitem"),b.tabIndex=-1,this._refreshRowDimensions(b),b}_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 b=0;b<this._terminal.rows;b++)this._refreshRowDimensions(this._rowElements[b])}}_refreshRowDimensions(b){b.style.height=`${this._renderService.dimensions.css.cell.height}px`}};o.AccessibilityManager=m=u([c(1,S.IInstantiationService),c(2,x.ICoreBrowserService),c(3,x.IRenderService)],m)},3614:(s,o)=>{function l(p){return p.replace(/\r?\n/g,"\r")}function u(p,f){return f?"\x1B[200~"+p+"\x1B[201~":p}function c(p,f,x,S){p=u(p=l(p),x.decPrivateModes.bracketedPasteMode&&S.rawOptions.ignoreBracketedPasteMode!==!0),x.triggerDataEvent(p,!0),f.value=""}function d(p,f,x){const S=x.getBoundingClientRect(),v=p.clientX-S.left-10,m=p.clientY-S.top-10;f.style.width="20px",f.style.height="20px",f.style.left=`${v}px`,f.style.top=`${m}px`,f.style.zIndex="1000",f.focus()}Object.defineProperty(o,"__esModule",{value:!0}),o.rightClickHandler=o.moveTextAreaUnderMouseCursor=o.paste=o.handlePasteEvent=o.copyHandler=o.bracketTextForPaste=o.prepareTextForTerminal=void 0,o.prepareTextForTerminal=l,o.bracketTextForPaste=u,o.copyHandler=function(p,f){p.clipboardData&&p.clipboardData.setData("text/plain",f.selectionText),p.preventDefault()},o.handlePasteEvent=function(p,f,x,S){p.stopPropagation(),p.clipboardData&&c(p.clipboardData.getData("text/plain"),f,x,S)},o.paste=c,o.moveTextAreaUnderMouseCursor=d,o.rightClickHandler=function(p,f,x,S,v){d(p,f,x),v&&S.rightClickSelect(p),f.value=S.selectionText,f.select()}},7239:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ColorContrastCache=void 0;const u=l(1505);o.ColorContrastCache=class{constructor(){this._color=new u.TwoKeyMap,this._css=new u.TwoKeyMap}setCss(c,d,p){this._css.set(c,d,p)}getCss(c,d){return this._css.get(c,d)}setColor(c,d,p){this._color.set(c,d,p)}getColor(c,d){return this._color.get(c,d)}clear(){this._color.clear(),this._css.clear()}}},3656:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.addDisposableDomListener=void 0,o.addDisposableDomListener=function(l,u,c,d){l.addEventListener(u,c,d);let p=!1;return{dispose:()=>{p||(p=!0,l.removeEventListener(u,c,d))}}}},3551:function(s,o,l){var u=this&&this.__decorate||function(m,b,w,_){var T,N=arguments.length,E=N<3?b:_===null?_=Object.getOwnPropertyDescriptor(b,w):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(m,b,w,_);else for(var k=m.length-1;k>=0;k--)(T=m[k])&&(E=(N<3?T(E):N>3?T(b,w,E):T(b,w))||E);return N>3&&E&&Object.defineProperty(b,w,E),E},c=this&&this.__param||function(m,b){return function(w,_){b(w,_,m)}};Object.defineProperty(o,"__esModule",{value:!0}),o.Linkifier=void 0;const d=l(3656),p=l(8460),f=l(844),x=l(2585),S=l(4725);let v=o.Linkifier=class extends f.Disposable{get currentLink(){return this._currentLink}constructor(m,b,w,_,T){super(),this._element=m,this._mouseService=b,this._renderService=w,this._bufferService=_,this._linkProviderService=T,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new p.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new p.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,f.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,f.toDisposable)((()=>{var N;this._lastMouseEvent=void 0,(N=this._activeProviderReplies)==null||N.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,d.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,d.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,d.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,d.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(m){this._lastMouseEvent=m;const b=this._positionFromMouseEvent(m,this._element,this._mouseService);if(!b)return;this._isMouseOut=!1;const w=m.composedPath();for(let _=0;_<w.length;_++){const T=w[_];if(T.classList.contains("xterm"))break;if(T.classList.contains("xterm-hover"))return}this._lastBufferCell&&b.x===this._lastBufferCell.x&&b.y===this._lastBufferCell.y||(this._handleHover(b),this._lastBufferCell=b)}_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,b){var _,T;this._activeProviderReplies&&b||((_=this._activeProviderReplies)==null||_.forEach((N=>{N==null||N.forEach((E=>{E.link.dispose&&E.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=m.y);let w=!1;for(const[N,E]of this._linkProviderService.linkProviders.entries())b?(T=this._activeProviderReplies)!=null&&T.get(N)&&(w=this._checkLinkProviderResult(N,m,w)):E.provideLinks(m.y,(k=>{var A,M;if(this._isMouseOut)return;const L=k==null?void 0:k.map((O=>({link:O})));(A=this._activeProviderReplies)==null||A.set(N,L),w=this._checkLinkProviderResult(N,m,w),((M=this._activeProviderReplies)==null?void 0:M.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(m.y,this._activeProviderReplies)}))}_removeIntersectingLinks(m,b){const w=new Set;for(let _=0;_<b.size;_++){const T=b.get(_);if(T)for(let N=0;N<T.length;N++){const E=T[N],k=E.link.range.start.y<m?0:E.link.range.start.x,L=E.link.range.end.y>m?this._bufferService.cols:E.link.range.end.x;for(let A=k;A<=L;A++){if(w.has(A)){T.splice(N--,1);break}w.add(A)}}}}_checkLinkProviderResult(m,b,w){var N;if(!this._activeProviderReplies)return w;const _=this._activeProviderReplies.get(m);let T=!1;for(let E=0;E<m;E++)this._activeProviderReplies.has(E)&&!this._activeProviderReplies.get(E)||(T=!0);if(!T&&_){const E=_.find((k=>this._linkAtPosition(k.link,b)));E&&(w=!0,this._handleNewLink(E))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!w)for(let E=0;E<this._activeProviderReplies.size;E++){const k=(N=this._activeProviderReplies.get(E))==null?void 0:N.find((L=>this._linkAtPosition(L.link,b)));if(k){w=!0,this._handleNewLink(k);break}}return w}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(m){if(!this._currentLink)return;const b=this._positionFromMouseEvent(m,this._element,this._mouseService);b&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,b)&&this._currentLink.link.activate(m,this._currentLink.link.text)}_clearCurrentLink(m,b){this._currentLink&&this._lastMouseEvent&&(!m||!b||this._currentLink.link.range.start.y>=m&&this._currentLink.link.range.end.y<=b)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,f.disposeArray)(this._linkCacheDisposables))}_handleNewLink(m){if(!this._lastMouseEvent)return;const b=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);b&&this._linkAtPosition(m.link,b)&&(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 w,_;return(_=(w=this._currentLink)==null?void 0:w.state)==null?void 0:_.decorations.pointerCursor},set:w=>{var _;(_=this._currentLink)!=null&&_.state&&this._currentLink.state.decorations.pointerCursor!==w&&(this._currentLink.state.decorations.pointerCursor=w,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",w))}},underline:{get:()=>{var w,_;return(_=(w=this._currentLink)==null?void 0:w.state)==null?void 0:_.decorations.underline},set:w=>{var _,T,N;(_=this._currentLink)!=null&&_.state&&((N=(T=this._currentLink)==null?void 0:T.state)==null?void 0:N.decorations.underline)!==w&&(this._currentLink.state.decorations.underline=w,this._currentLink.state.isHovered&&this._fireUnderlineEvent(m.link,w))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((w=>{if(!this._currentLink)return;const _=w.start===0?0:w.start+1+this._bufferService.buffer.ydisp,T=this._bufferService.buffer.ydisp+1+w.end;if(this._currentLink.link.range.start.y>=_&&this._currentLink.link.range.end.y<=T&&(this._clearCurrentLink(_,T),this._lastMouseEvent)){const N=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);N&&this._askForLink(N,!1)}}))))}_linkHover(m,b,w){var _;(_=this._currentLink)!=null&&_.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(b,!0),this._currentLink.state.decorations.pointerCursor&&m.classList.add("xterm-cursor-pointer")),b.hover&&b.hover(w,b.text)}_fireUnderlineEvent(m,b){const w=m.range,_=this._bufferService.buffer.ydisp,T=this._createLinkUnderlineEvent(w.start.x-1,w.start.y-_-1,w.end.x,w.end.y-_-1,void 0);(b?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(T)}_linkLeave(m,b,w){var _;(_=this._currentLink)!=null&&_.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(b,!1),this._currentLink.state.decorations.pointerCursor&&m.classList.remove("xterm-cursor-pointer")),b.leave&&b.leave(w,b.text)}_linkAtPosition(m,b){const w=m.range.start.y*this._bufferService.cols+m.range.start.x,_=m.range.end.y*this._bufferService.cols+m.range.end.x,T=b.y*this._bufferService.cols+b.x;return w<=T&&T<=_}_positionFromMouseEvent(m,b,w){const _=w.getCoords(m,b,this._bufferService.cols,this._bufferService.rows);if(_)return{x:_[0],y:_[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(m,b,w,_,T){return{x1:m,y1:b,x2:w,y2:_,cols:this._bufferService.cols,fg:T}}};o.Linkifier=v=u([c(1,S.IMouseService),c(2,S.IRenderService),c(3,x.IBufferService),c(4,S.ILinkProviderService)],v)},9042:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.tooMuchOutput=o.promptLabel=void 0,o.promptLabel="Terminal input",o.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(s,o,l){var u=this&&this.__decorate||function(S,v,m,b){var w,_=arguments.length,T=_<3?v:b===null?b=Object.getOwnPropertyDescriptor(v,m):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(S,v,m,b);else for(var N=S.length-1;N>=0;N--)(w=S[N])&&(T=(_<3?w(T):_>3?w(v,m,T):w(v,m))||T);return _>3&&T&&Object.defineProperty(v,m,T),T},c=this&&this.__param||function(S,v){return function(m,b){v(m,b,S)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OscLinkProvider=void 0;const d=l(511),p=l(2585);let f=o.OscLinkProvider=class{constructor(S,v,m){this._bufferService=S,this._optionsService=v,this._oscLinkService=m}provideLinks(S,v){var L;const m=this._bufferService.buffer.lines.get(S-1);if(!m)return void v(void 0);const b=[],w=this._optionsService.rawOptions.linkHandler,_=new d.CellData,T=m.getTrimmedLength();let N=-1,E=-1,k=!1;for(let A=0;A<T;A++)if(E!==-1||m.hasContent(A)){if(m.loadCell(A,_),_.hasExtendedAttrs()&&_.extended.urlId){if(E===-1){E=A,N=_.extended.urlId;continue}k=_.extended.urlId!==N}else E!==-1&&(k=!0);if(k||E!==-1&&A===T-1){const M=(L=this._oscLinkService.getLinkData(N))==null?void 0:L.uri;if(M){const O={start:{x:E+1,y:S},end:{x:A+(k||A!==T-1?0:1),y:S}};let $=!1;if(!(w!=null&&w.allowNonHttpProtocols))try{const D=new URL(M);["http:","https:"].includes(D.protocol)||($=!0)}catch{$=!0}$||b.push({text:M,range:O,activate:(D,B)=>w?w.activate(D,B,O):x(0,B),hover:(D,B)=>{var j;return(j=w==null?void 0:w.hover)==null?void 0:j.call(w,D,B,O)},leave:(D,B)=>{var j;return(j=w==null?void 0:w.leave)==null?void 0:j.call(w,D,B,O)}})}k=!1,_.hasExtendedAttrs()&&_.extended.urlId?(E=A,N=_.extended.urlId):(E=-1,N=-1)}}v(b)}};function x(S,v){if(confirm(`Do you want to navigate to ${v}?
|
|
383
|
+
|
|
384
|
+
WARNING: This link could potentially be dangerous`)){const m=window.open();if(m){try{m.opener=null}catch{}m.location.href=v}else console.warn("Opening link blocked as opener could not be cleared")}}o.OscLinkProvider=f=u([c(0,p.IBufferService),c(1,p.IOptionsService),c(2,p.IOscLinkService)],f)},6193:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.RenderDebouncer=void 0,o.RenderDebouncer=class{constructor(l,u){this._renderCallback=l,this._coreBrowserService=u,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(l){return this._refreshCallbacks.push(l),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(l,u,c){this._rowCount=c,l=l!==void 0?l:0,u=u!==void 0?u:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,l):l,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,u):u,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();const l=Math.max(this._rowStart,0),u=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(l,u),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const l of this._refreshCallbacks)l(0);this._refreshCallbacks=[]}}},3236:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Terminal=void 0;const u=l(3614),c=l(3656),d=l(3551),p=l(9042),f=l(3730),x=l(1680),S=l(3107),v=l(5744),m=l(2950),b=l(1296),w=l(428),_=l(4269),T=l(5114),N=l(8934),E=l(3230),k=l(9312),L=l(4725),A=l(6731),M=l(8055),O=l(8969),$=l(8460),D=l(844),B=l(6114),j=l(8437),I=l(2584),U=l(7399),F=l(5941),P=l(9074),H=l(2585),W=l(5435),V=l(4567),re=l(779);class J extends O.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(X={}){super(X),this.browser=B,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new D.MutableDisposable),this._onCursorMove=this.register(new $.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new $.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new $.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new $.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new $.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new $.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new $.EventEmitter),this._onBlur=this.register(new $.EventEmitter),this._onA11yCharEmitter=this.register(new $.EventEmitter),this._onA11yTabEmitter=this.register(new $.EventEmitter),this._onWillOpen=this.register(new $.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(P.DecorationService),this._instantiationService.setService(H.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(re.LinkProviderService),this._instantiationService.setService(L.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(f.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((q,Y)=>this.refresh(q,Y)))),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,$.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,$.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,$.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,$.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,Y;this._customKeyEventHandler=void 0,(Y=(q=this.element)==null?void 0:q.parentNode)==null||Y.removeChild(this.element)})))}_handleColorEvent(X){if(this._themeService)for(const q of X){let Y,Q="";switch(q.index){case 256:Y="foreground",Q="10";break;case 257:Y="background",Q="11";break;case 258:Y="cursor",Q="12";break;default:Y="ansi",Q="4;"+q.index}switch(q.type){case 0:const te=M.color.toColorRGB(Y==="ansi"?this._themeService.colors.ansi[q.index]:this._themeService.colors[Y]);this.coreService.triggerDataEvent(`${I.C0.ESC}]${Q};${(0,F.toRgbString)(te)}${I.C1_ESCAPED.ST}`);break;case 1:if(Y==="ansi")this._themeService.modifyColors((ie=>ie.ansi[q.index]=M.channels.toColor(...q.color)));else{const ie=Y;this._themeService.modifyColors((le=>le[ie]=M.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(X){X?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(V.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(X){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(I.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var X;return(X=this.textarea)==null?void 0:X.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(I.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 X=this.buffer.ybase+this.buffer.y,q=this.buffer.lines.get(X);if(!q)return;const Y=Math.min(this.buffer.x,this.cols-1),Q=this._renderService.dimensions.css.cell.height,te=q.getWidth(Y),ie=this._renderService.dimensions.css.cell.width*te,le=this.buffer.y*this._renderService.dimensions.css.cell.height,pe=Y*this._renderService.dimensions.css.cell.width;this.textarea.style.left=pe+"px",this.textarea.style.top=le+"px",this.textarea.style.width=ie+"px",this.textarea.style.height=Q+"px",this.textarea.style.lineHeight=Q+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,c.addDisposableDomListener)(this.element,"copy",(q=>{this.hasSelection()&&(0,u.copyHandler)(q,this._selectionService)})));const X=q=>(0,u.handlePasteEvent)(q,this.textarea,this.coreService,this.optionsService);this.register((0,c.addDisposableDomListener)(this.textarea,"paste",X)),this.register((0,c.addDisposableDomListener)(this.element,"paste",X)),B.isFirefox?this.register((0,c.addDisposableDomListener)(this.element,"mousedown",(q=>{q.button===2&&(0,u.rightClickHandler)(q,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,c.addDisposableDomListener)(this.element,"contextmenu",(q=>{(0,u.rightClickHandler)(q,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),B.isLinux&&this.register((0,c.addDisposableDomListener)(this.element,"auxclick",(q=>{q.button===1&&(0,u.moveTextAreaUnderMouseCursor)(q,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,c.addDisposableDomListener)(this.textarea,"keyup",(X=>this._keyUp(X)),!0)),this.register((0,c.addDisposableDomListener)(this.textarea,"keydown",(X=>this._keyDown(X)),!0)),this.register((0,c.addDisposableDomListener)(this.textarea,"keypress",(X=>this._keyPress(X)),!0)),this.register((0,c.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,c.addDisposableDomListener)(this.textarea,"compositionupdate",(X=>this._compositionHelper.compositionupdate(X)))),this.register((0,c.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,c.addDisposableDomListener)(this.textarea,"input",(X=>this._inputEvent(X)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(X){var Y;if(!X)throw new Error("Terminal requires a parent element.");if(X.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((Y=this.element)==null?void 0:Y.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=X.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"),X.appendChild(this.element);const q=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),q.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,c.addDisposableDomListener)(this.screenElement,"mousemove",(Q=>this.updateCursorStyle(Q)))),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",p.promptLabel),B.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(T.CoreBrowserService,this.textarea,X.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(L.ICoreBrowserService,this._coreBrowserService),this.register((0,c.addDisposableDomListener)(this.textarea,"focus",(Q=>this._handleTextAreaFocus(Q)))),this.register((0,c.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(w.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(L.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(A.ThemeService),this._instantiationService.setService(L.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(_.CharacterJoinerService),this._instantiationService.setService(L.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(E.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(L.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((Q=>this._onRender.fire(Q)))),this.onResize((Q=>this._renderService.resize(Q.cols,Q.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(N.MouseService),this._instantiationService.setService(L.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(d.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((Q=>this.scrollLines(Q.amount,Q.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(L.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((Q=>this.scrollLines(Q.amount,Q.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((Q=>this._renderService.handleSelectionChanged(Q.start,Q.end,Q.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((Q=>{this.textarea.value=Q,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((Q=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,c.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(S.BufferDecorationRenderer,this.screenElement)),this.register((0,c.addDisposableDomListener)(this.element,"mousedown",(Q=>this._selectionService.handleMouseDown(Q)))),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(V.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(Q=>this._handleScreenReaderModeOptionChange(Q)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(v.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(Q=>{!this._overviewRulerRenderer&&Q&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(v.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(b.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const X=this,q=this.element;function Y(ie){const le=X._mouseService.getMouseReportCoords(ie,X.screenElement);if(!le)return!1;let pe,Le;switch(ie.overrideType||ie.type){case"mousemove":Le=32,ie.buttons===void 0?(pe=3,ie.button!==void 0&&(pe=ie.button<3?ie.button:3)):pe=1&ie.buttons?0:4&ie.buttons?1:2&ie.buttons?2:3;break;case"mouseup":Le=0,pe=ie.button<3?ie.button:3;break;case"mousedown":Le=1,pe=ie.button<3?ie.button:3;break;case"wheel":if(X._customWheelEventHandler&&X._customWheelEventHandler(ie)===!1||X.viewport.getLinesScrolled(ie)===0)return!1;Le=ie.deltaY<0?0:1,pe=4;break;default:return!1}return!(Le===void 0||pe===void 0||pe>4)&&X.coreMouseService.triggerMouseEvent({col:le.col,row:le.row,x:le.x,y:le.y,button:pe,action:Le,ctrl:ie.ctrlKey,alt:ie.altKey,shift:ie.shiftKey})}const Q={mouseup:null,wheel:null,mousedrag:null,mousemove:null},te={mouseup:ie=>(Y(ie),ie.buttons||(this._document.removeEventListener("mouseup",Q.mouseup),Q.mousedrag&&this._document.removeEventListener("mousemove",Q.mousedrag)),this.cancel(ie)),wheel:ie=>(Y(ie),this.cancel(ie,!0)),mousedrag:ie=>{ie.buttons&&Y(ie)},mousemove:ie=>{ie.buttons||Y(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?Q.mousemove||(q.addEventListener("mousemove",te.mousemove),Q.mousemove=te.mousemove):(q.removeEventListener("mousemove",Q.mousemove),Q.mousemove=null),16&ie?Q.wheel||(q.addEventListener("wheel",te.wheel,{passive:!1}),Q.wheel=te.wheel):(q.removeEventListener("wheel",Q.wheel),Q.wheel=null),2&ie?Q.mouseup||(Q.mouseup=te.mouseup):(this._document.removeEventListener("mouseup",Q.mouseup),Q.mouseup=null),4&ie?Q.mousedrag||(Q.mousedrag=te.mousedrag):(this._document.removeEventListener("mousemove",Q.mousedrag),Q.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,c.addDisposableDomListener)(q,"mousedown",(ie=>{if(ie.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(ie))return Y(ie),Q.mouseup&&this._document.addEventListener("mouseup",Q.mouseup),Q.mousedrag&&this._document.addEventListener("mousemove",Q.mousedrag),this.cancel(ie)}))),this.register((0,c.addDisposableDomListener)(q,"wheel",(ie=>{if(!Q.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(ie)===!1)return!1;if(!this.buffer.hasScrollback){const le=this.viewport.getLinesScrolled(ie);if(le===0)return;const pe=I.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(ie.deltaY<0?"A":"B");let Le="";for(let je=0;je<Math.abs(le);je++)Le+=pe;return this.coreService.triggerDataEvent(Le,!0),this.cancel(ie,!0)}return this.viewport.handleWheel(ie)?this.cancel(ie):void 0}}),{passive:!1})),this.register((0,c.addDisposableDomListener)(q,"touchstart",(ie=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(ie),this.cancel(ie)}),{passive:!0})),this.register((0,c.addDisposableDomListener)(q,"touchmove",(ie=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(ie)?void 0:this.cancel(ie)}),{passive:!1}))}refresh(X,q){var Y;(Y=this._renderService)==null||Y.refreshRows(X,q)}updateCursorStyle(X){var q;(q=this._selectionService)!=null&&q.shouldColumnSelect(X)?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(X,q,Y=0){var Q;Y===1?(super.scrollLines(X,q,Y),this.refresh(0,this.rows-1)):(Q=this.viewport)==null||Q.scrollLines(X)}paste(X){(0,u.paste)(X,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(X){this._customKeyEventHandler=X}attachCustomWheelEventHandler(X){this._customWheelEventHandler=X}registerLinkProvider(X){return this._linkProviderService.registerLinkProvider(X)}registerCharacterJoiner(X){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const q=this._characterJoinerService.register(X);return this.refresh(0,this.rows-1),q}deregisterCharacterJoiner(X){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(X)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(X){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+X)}registerDecoration(X){return this._decorationService.registerDecoration(X)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(X,q,Y){this._selectionService.setSelection(X,q,Y)}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 X;(X=this._selectionService)==null||X.clearSelection()}selectAll(){var X;(X=this._selectionService)==null||X.selectAll()}selectLines(X,q){var Y;(Y=this._selectionService)==null||Y.selectLines(X,q)}_keyDown(X){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1)return!1;const q=this.browser.isMac&&this.options.macOptionIsMeta&&X.altKey;if(!q&&!this._compositionHelper.keydown(X))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;q||X.key!=="Dead"&&X.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const Y=(0,U.evaluateKeyboardEvent)(X,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(X),Y.type===3||Y.type===2){const Q=this.rows-1;return this.scrollLines(Y.type===2?-Q:Q),this.cancel(X,!0)}return Y.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,X)||(Y.cancel&&this.cancel(X,!0),!Y.key||!!(X.key&&!X.ctrlKey&&!X.altKey&&!X.metaKey&&X.key.length===1&&X.key.charCodeAt(0)>=65&&X.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(Y.key!==I.C0.ETX&&Y.key!==I.C0.CR||(this.textarea.value=""),this._onKey.fire({key:Y.key,domEvent:X}),this._showCursor(),this.coreService.triggerDataEvent(Y.key,!0),!this.optionsService.rawOptions.screenReaderMode||X.altKey||X.ctrlKey?this.cancel(X,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(X,q){const Y=X.isMac&&!this.options.macOptionIsMeta&&q.altKey&&!q.ctrlKey&&!q.metaKey||X.isWindows&&q.altKey&&q.ctrlKey&&!q.metaKey||X.isWindows&&q.getModifierState("AltGraph");return q.type==="keypress"?Y:Y&&(!q.keyCode||q.keyCode>47)}_keyUp(X){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1||((function(q){return q.keyCode===16||q.keyCode===17||q.keyCode===18})(X)||this.focus(),this.updateCursorStyle(X),this._keyPressHandled=!1)}_keyPress(X){let q;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1)return!1;if(this.cancel(X),X.charCode)q=X.charCode;else if(X.which===null||X.which===void 0)q=X.keyCode;else{if(X.which===0||X.charCode===0)return!1;q=X.which}return!(!q||(X.altKey||X.ctrlKey||X.metaKey)&&!this._isThirdLevelShift(this.browser,X)||(q=String.fromCharCode(q),this._onKey.fire({key:q,domEvent:X}),this._showCursor(),this.coreService.triggerDataEvent(q,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(X){if(X.data&&X.inputType==="insertText"&&(!X.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const q=X.data;return this.coreService.triggerDataEvent(q,!0),this.cancel(X),!0}return!1}resize(X,q){X!==this.cols||q!==this.rows?super.resize(X,q):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(X,q){var Y,Q;(Y=this._charSizeService)==null||Y.measure(),(Q=this.viewport)==null||Q.syncScrollArea(!0)}clear(){var X;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(j.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(X=this.viewport)==null||X.reset(),this.refresh(0,this.rows-1)}}reset(){var q,Y;this.options.rows=this.rows,this.options.cols=this.cols;const X=this._customKeyEventHandler;this._setup(),super.reset(),(q=this._selectionService)==null||q.reset(),this._decorationService.reset(),(Y=this.viewport)==null||Y.reset(),this._customKeyEventHandler=X,this.refresh(0,this.rows-1)}clearTextureAtlas(){var X;(X=this._renderService)==null||X.clearTextureAtlas()}_reportFocus(){var X;(X=this.element)!=null&&X.classList.contains("focus")?this.coreService.triggerDataEvent(I.C0.ESC+"[I"):this.coreService.triggerDataEvent(I.C0.ESC+"[O")}_reportWindowsOptions(X){if(this._renderService)switch(X){case W.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const q=this._renderService.dimensions.css.canvas.width.toFixed(0),Y=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${I.C0.ESC}[4;${Y};${q}t`);break;case W.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const Q=this._renderService.dimensions.css.cell.width.toFixed(0),te=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${I.C0.ESC}[6;${te};${Q}t`)}}cancel(X,q){if(this.options.cancelEvents||q)return X.preventDefault(),X.stopPropagation(),!1}}o.Terminal=J},9924:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.TimeBasedDebouncer=void 0,o.TimeBasedDebouncer=class{constructor(l,u=1e3){this._renderCallback=l,this._debounceThresholdMS=u,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(l,u,c){this._rowCount=c,l=l!==void 0?l:0,u=u!==void 0?u:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,l):l,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,u):u;const d=Date.now();if(d-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=d,this._innerRefresh();else if(!this._additionalRefreshRequested){const p=d-this._lastRefreshMs,f=this._debounceThresholdMS-p;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),f)}}_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(s,o,l){var u=this&&this.__decorate||function(m,b,w,_){var T,N=arguments.length,E=N<3?b:_===null?_=Object.getOwnPropertyDescriptor(b,w):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(m,b,w,_);else for(var k=m.length-1;k>=0;k--)(T=m[k])&&(E=(N<3?T(E):N>3?T(b,w,E):T(b,w))||E);return N>3&&E&&Object.defineProperty(b,w,E),E},c=this&&this.__param||function(m,b){return function(w,_){b(w,_,m)}};Object.defineProperty(o,"__esModule",{value:!0}),o.Viewport=void 0;const d=l(3656),p=l(4725),f=l(8460),x=l(844),S=l(2585);let v=o.Viewport=class extends x.Disposable{constructor(m,b,w,_,T,N,E,k){super(),this._viewportElement=m,this._scrollArea=b,this._bufferService=w,this._optionsService=_,this._charSizeService=T,this._renderService=N,this._coreBrowserService=E,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 f.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,d.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((L=>this._activeBuffer=L.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((L=>this._renderDimensions=L))),this._handleThemeChange(k.colors),this.register(k.onChangeColors((L=>this._handleThemeChange(L)))),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 b=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==b&&(this._lastRecordedBufferHeight=b,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 b=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:b,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,b){const w=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(b<0&&this._viewportElement.scrollTop!==0||b>0&&w<this._lastRecordedBufferHeight)||(m.cancelable&&m.preventDefault(),!1)}handleWheel(m){const b=this._getPixelsScrolled(m);return b!==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+b:this._smoothScrollState.target+=b,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=b,this._bubbleScroll(m,b))}scrollLines(m){if(m!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const b=m*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+b,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 b=this._applyScrollModifier(m.deltaY,m);return m.deltaMode===WheelEvent.DOM_DELTA_LINE?b*=this._currentRowHeight:m.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(b*=this._currentRowHeight*this._bufferService.rows),b}getBufferElements(m,b){var k;let w,_="";const T=[],N=b??this._bufferService.buffer.lines.length,E=this._bufferService.buffer.lines;for(let L=m;L<N;L++){const A=E.get(L);if(!A)continue;const M=(k=E.get(L+1))==null?void 0:k.isWrapped;if(_+=A.translateToString(!M),!M||L===E.length-1){const O=document.createElement("div");O.textContent=_,T.push(O),_.length>0&&(w=O),_=""}}return{bufferElements:T,cursorElement:w}}getLinesScrolled(m){if(m.deltaY===0||m.shiftKey)return 0;let b=this._applyScrollModifier(m.deltaY,m);return m.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(b/=this._currentRowHeight+0,this._wheelPartialScroll+=b,b=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):m.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(b*=this._bufferService.rows),b}_applyScrollModifier(m,b){const w=this._optionsService.rawOptions.fastScrollModifier;return w==="alt"&&b.altKey||w==="ctrl"&&b.ctrlKey||w==="shift"&&b.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 b=this._lastTouchY-m.touches[0].pageY;return this._lastTouchY=m.touches[0].pageY,b!==0&&(this._viewportElement.scrollTop+=b,this._bubbleScroll(m,b))}};o.Viewport=v=u([c(2,S.IBufferService),c(3,S.IOptionsService),c(4,p.ICharSizeService),c(5,p.IRenderService),c(6,p.ICoreBrowserService),c(7,p.IThemeService)],v)},3107:function(s,o,l){var u=this&&this.__decorate||function(S,v,m,b){var w,_=arguments.length,T=_<3?v:b===null?b=Object.getOwnPropertyDescriptor(v,m):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(S,v,m,b);else for(var N=S.length-1;N>=0;N--)(w=S[N])&&(T=(_<3?w(T):_>3?w(v,m,T):w(v,m))||T);return _>3&&T&&Object.defineProperty(v,m,T),T},c=this&&this.__param||function(S,v){return function(m,b){v(m,b,S)}};Object.defineProperty(o,"__esModule",{value:!0}),o.BufferDecorationRenderer=void 0;const d=l(4725),p=l(844),f=l(2585);let x=o.BufferDecorationRenderer=class extends p.Disposable{constructor(S,v,m,b,w){super(),this._screenElement=S,this._bufferService=v,this._coreBrowserService=m,this._decorationService=b,this._renderService=w,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,p.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 S of this._decorationService.decorations)this._renderDecoration(S);this._dimensionsChanged=!1}_renderDecoration(S){this._refreshStyle(S),this._dimensionsChanged&&this._refreshXPosition(S)}_createElement(S){var b;const v=this._coreBrowserService.mainDocument.createElement("div");v.classList.add("xterm-decoration"),v.classList.toggle("xterm-decoration-top-layer",((b=S==null?void 0:S.options)==null?void 0:b.layer)==="top"),v.style.width=`${Math.round((S.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,v.style.height=(S.options.height||1)*this._renderService.dimensions.css.cell.height+"px",v.style.top=(S.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",v.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const m=S.options.x??0;return m&&m>this._bufferService.cols&&(v.style.display="none"),this._refreshXPosition(S,v),v}_refreshStyle(S){const v=S.marker.line-this._bufferService.buffers.active.ydisp;if(v<0||v>=this._bufferService.rows)S.element&&(S.element.style.display="none",S.onRenderEmitter.fire(S.element));else{let m=this._decorationElements.get(S);m||(m=this._createElement(S),S.element=m,this._decorationElements.set(S,m),this._container.appendChild(m),S.onDispose((()=>{this._decorationElements.delete(S),m.remove()}))),m.style.top=v*this._renderService.dimensions.css.cell.height+"px",m.style.display=this._altBufferIsActive?"none":"block",S.onRenderEmitter.fire(m)}}_refreshXPosition(S,v=S.element){if(!v)return;const m=S.options.x??0;(S.options.anchor||"left")==="right"?v.style.right=m?m*this._renderService.dimensions.css.cell.width+"px":"":v.style.left=m?m*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(S){var v;(v=this._decorationElements.get(S))==null||v.remove(),this._decorationElements.delete(S),S.dispose()}};o.BufferDecorationRenderer=x=u([c(1,f.IBufferService),c(2,d.ICoreBrowserService),c(3,f.IDecorationService),c(4,d.IRenderService)],x)},5871:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ColorZoneStore=void 0,o.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(l){if(l.options.overviewRulerOptions){for(const u of this._zones)if(u.color===l.options.overviewRulerOptions.color&&u.position===l.options.overviewRulerOptions.position){if(this._lineIntersectsZone(u,l.marker.line))return;if(this._lineAdjacentToZone(u,l.marker.line,l.options.overviewRulerOptions.position))return void this._addLineToZone(u,l.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=l.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=l.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=l.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=l.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:l.options.overviewRulerOptions.color,position:l.options.overviewRulerOptions.position,startBufferLine:l.marker.line,endBufferLine:l.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(l){this._linePadding=l}_lineIntersectsZone(l,u){return u>=l.startBufferLine&&u<=l.endBufferLine}_lineAdjacentToZone(l,u,c){return u>=l.startBufferLine-this._linePadding[c||"full"]&&u<=l.endBufferLine+this._linePadding[c||"full"]}_addLineToZone(l,u){l.startBufferLine=Math.min(l.startBufferLine,u),l.endBufferLine=Math.max(l.endBufferLine,u)}}},5744:function(s,o,l){var u=this&&this.__decorate||function(w,_,T,N){var E,k=arguments.length,L=k<3?_:N===null?N=Object.getOwnPropertyDescriptor(_,T):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(w,_,T,N);else for(var A=w.length-1;A>=0;A--)(E=w[A])&&(L=(k<3?E(L):k>3?E(_,T,L):E(_,T))||L);return k>3&&L&&Object.defineProperty(_,T,L),L},c=this&&this.__param||function(w,_){return function(T,N){_(T,N,w)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OverviewRulerRenderer=void 0;const d=l(5871),p=l(4725),f=l(844),x=l(2585),S={full:0,left:0,center:0,right:0},v={full:0,left:0,center:0,right:0},m={full:0,left:0,center:0,right:0};let b=o.OverviewRulerRenderer=class extends f.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(w,_,T,N,E,k,L){var M;super(),this._viewportElement=w,this._screenElement=_,this._bufferService=T,this._decorationService=N,this._renderService=E,this._optionsService=k,this._coreBrowserService=L,this._colorZoneStore=new d.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(),(M=this._viewportElement.parentElement)==null||M.insertBefore(this._canvas,this._viewportElement);const A=this._canvas.getContext("2d");if(!A)throw new Error("Ctx cannot be null");this._ctx=A,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,f.toDisposable)((()=>{var O;(O=this._canvas)==null||O.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 w=Math.floor(this._canvas.width/3),_=Math.ceil(this._canvas.width/3);v.full=this._canvas.width,v.left=w,v.center=_,v.right=w,this._refreshDrawHeightConstants(),m.full=0,m.left=0,m.center=v.left,m.right=v.left+v.center}_refreshDrawHeightConstants(){S.full=Math.round(2*this._coreBrowserService.dpr);const w=this._canvas.height/this._bufferService.buffer.lines.length,_=Math.round(Math.max(Math.min(w,12),6)*this._coreBrowserService.dpr);S.left=_,S.center=_,S.right=_}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*S.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*S.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*S.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*S.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 w=this._colorZoneStore.zones;for(const _ of w)_.position!=="full"&&this._renderColorZone(_);for(const _ of w)_.position==="full"&&this._renderColorZone(_);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(w){this._ctx.fillStyle=w.color,this._ctx.fillRect(m[w.position||"full"],Math.round((this._canvas.height-1)*(w.startBufferLine/this._bufferService.buffers.active.lines.length)-S[w.position||"full"]/2),v[w.position||"full"],Math.round((this._canvas.height-1)*((w.endBufferLine-w.startBufferLine)/this._bufferService.buffers.active.lines.length)+S[w.position||"full"]))}_queueRefresh(w,_){this._shouldUpdateDimensions=w||this._shouldUpdateDimensions,this._shouldUpdateAnchor=_||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};o.OverviewRulerRenderer=b=u([c(2,x.IBufferService),c(3,x.IDecorationService),c(4,p.IRenderService),c(5,x.IOptionsService),c(6,p.ICoreBrowserService)],b)},2950:function(s,o,l){var u=this&&this.__decorate||function(S,v,m,b){var w,_=arguments.length,T=_<3?v:b===null?b=Object.getOwnPropertyDescriptor(v,m):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(S,v,m,b);else for(var N=S.length-1;N>=0;N--)(w=S[N])&&(T=(_<3?w(T):_>3?w(v,m,T):w(v,m))||T);return _>3&&T&&Object.defineProperty(v,m,T),T},c=this&&this.__param||function(S,v){return function(m,b){v(m,b,S)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CompositionHelper=void 0;const d=l(4725),p=l(2585),f=l(2584);let x=o.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(S,v,m,b,w,_){this._textarea=S,this._compositionView=v,this._bufferService=m,this._optionsService=b,this._coreService=w,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(S){this._compositionView.textContent=S.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(S){if(this._isComposing||this._isSendingComposition){if(S.keyCode===229||S.keyCode===16||S.keyCode===17||S.keyCode===18)return!1;this._finalizeComposition(!1)}return S.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(S){if(this._compositionView.classList.remove("active"),this._isComposing=!1,S){const v={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let m;this._isSendingComposition=!1,v.start+=this._dataAlreadySent.length,m=this._isComposing?this._textarea.value.substring(v.start,v.end):this._textarea.value.substring(v.start),m.length>0&&this._coreService.triggerDataEvent(m,!0)}}),0)}else{this._isSendingComposition=!1;const v=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(v,!0)}}_handleAnyTextareaChanges(){const S=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const v=this._textarea.value,m=v.replace(S,"");this._dataAlreadySent=m,v.length>S.length?this._coreService.triggerDataEvent(m,!0):v.length<S.length?this._coreService.triggerDataEvent(`${f.C0.DEL}`,!0):v.length===S.length&&v!==S&&this._coreService.triggerDataEvent(v,!0)}}),0)}updateCompositionElements(S){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const v=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),m=this._renderService.dimensions.css.cell.height,b=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,w=v*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=w+"px",this._compositionView.style.top=b+"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=w+"px",this._textarea.style.top=b+"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"}S||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};o.CompositionHelper=x=u([c(2,p.IBufferService),c(3,p.IOptionsService),c(4,p.ICoreService),c(5,d.IRenderService)],x)},9806:(s,o)=>{function l(u,c,d){const p=d.getBoundingClientRect(),f=u.getComputedStyle(d),x=parseInt(f.getPropertyValue("padding-left")),S=parseInt(f.getPropertyValue("padding-top"));return[c.clientX-p.left-x,c.clientY-p.top-S]}Object.defineProperty(o,"__esModule",{value:!0}),o.getCoords=o.getCoordsRelativeToElement=void 0,o.getCoordsRelativeToElement=l,o.getCoords=function(u,c,d,p,f,x,S,v,m){if(!x)return;const b=l(u,c,d);return b?(b[0]=Math.ceil((b[0]+(m?S/2:0))/S),b[1]=Math.ceil(b[1]/v),b[0]=Math.min(Math.max(b[0],1),p+(m?1:0)),b[1]=Math.min(Math.max(b[1],1),f),b):void 0}},9504:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.moveToCellSequence=void 0;const u=l(2584);function c(v,m,b,w){const _=v-d(v,b),T=m-d(m,b),N=Math.abs(_-T)-(function(E,k,L){let A=0;const M=E-d(E,L),O=k-d(k,L);for(let $=0;$<Math.abs(M-O);$++){const D=p(E,k)==="A"?-1:1,B=L.buffer.lines.get(M+D*$);B!=null&&B.isWrapped&&A++}return A})(v,m,b);return S(N,x(p(v,m),w))}function d(v,m){let b=0,w=m.buffer.lines.get(v),_=w==null?void 0:w.isWrapped;for(;_&&v>=0&&v<m.rows;)b++,w=m.buffer.lines.get(--v),_=w==null?void 0:w.isWrapped;return b}function p(v,m){return v>m?"A":"B"}function f(v,m,b,w,_,T){let N=v,E=m,k="";for(;N!==b||E!==w;)N+=_?1:-1,_&&N>T.cols-1?(k+=T.buffer.translateBufferLineToString(E,!1,v,N),N=0,v=0,E++):!_&&N<0&&(k+=T.buffer.translateBufferLineToString(E,!1,0,v+1),N=T.cols-1,v=N,E--);return k+T.buffer.translateBufferLineToString(E,!1,v,N)}function x(v,m){const b=m?"O":"[";return u.C0.ESC+b+v}function S(v,m){v=Math.floor(v);let b="";for(let w=0;w<v;w++)b+=m;return b}o.moveToCellSequence=function(v,m,b,w){const _=b.buffer.x,T=b.buffer.y;if(!b.buffer.hasScrollback)return(function(k,L,A,M,O,$){return c(L,M,O,$).length===0?"":S(f(k,L,k,L-d(L,O),!1,O).length,x("D",$))})(_,T,0,m,b,w)+c(T,m,b,w)+(function(k,L,A,M,O,$){let D;D=c(L,M,O,$).length>0?M-d(M,O):L;const B=M,j=(function(I,U,F,P,H,W){let V;return V=c(F,P,H,W).length>0?P-d(P,H):U,I<F&&V<=P||I>=F&&V<P?"C":"D"})(k,L,A,M,O,$);return S(f(k,D,A,B,j==="C",O).length,x(j,$))})(_,T,v,m,b,w);let N;if(T===m)return N=_>v?"D":"C",S(Math.abs(_-v),x(N,w));N=T>m?"D":"C";const E=Math.abs(T-m);return S((function(k,L){return L.cols-k})(T>m?v:_,b)+(E-1)*b.cols+1+((T>m?_:v)-1),x(N,w))}},1296:function(s,o,l){var u=this&&this.__decorate||function($,D,B,j){var I,U=arguments.length,F=U<3?D:j===null?j=Object.getOwnPropertyDescriptor(D,B):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")F=Reflect.decorate($,D,B,j);else for(var P=$.length-1;P>=0;P--)(I=$[P])&&(F=(U<3?I(F):U>3?I(D,B,F):I(D,B))||F);return U>3&&F&&Object.defineProperty(D,B,F),F},c=this&&this.__param||function($,D){return function(B,j){D(B,j,$)}};Object.defineProperty(o,"__esModule",{value:!0}),o.DomRenderer=void 0;const d=l(3787),p=l(2550),f=l(2223),x=l(6171),S=l(6052),v=l(4725),m=l(8055),b=l(8460),w=l(844),_=l(2585),T="xterm-dom-renderer-owner-",N="xterm-rows",E="xterm-fg-",k="xterm-bg-",L="xterm-focus",A="xterm-selection";let M=1,O=o.DomRenderer=class extends w.Disposable{constructor($,D,B,j,I,U,F,P,H,W,V,re,J){super(),this._terminal=$,this._document=D,this._element=B,this._screenElement=j,this._viewportElement=I,this._helperContainer=U,this._linkifier2=F,this._charSizeService=H,this._optionsService=W,this._bufferService=V,this._coreBrowserService=re,this._themeService=J,this._terminalClass=M++,this._rowElements=[],this._selectionRenderModel=(0,S.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new b.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(N),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(A),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(d.DomRendererRowFactory,document),this._element.classList.add(T+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,w.toDisposable)((()=>{this._element.classList.remove(T+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new p.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 $=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*$,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*$),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/$),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/$),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 B of this._rowElements)B.style.width=`${this.dimensions.css.canvas.width}px`,B.style.height=`${this.dimensions.css.cell.height}px`,B.style.lineHeight=`${this.dimensions.css.cell.height}px`,B.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const D=`${this._terminalSelector} .${N} 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($){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let D=`${this._terminalSelector} .${N} { color: ${$.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;D+=`${this._terminalSelector} .${N} .xterm-dim { color: ${m.color.multiplyOpacity($.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 B=`blink_underline_${this._terminalClass}`,j=`blink_bar_${this._terminalClass}`,I=`blink_block_${this._terminalClass}`;D+=`@keyframes ${B} { 50% { border-bottom-style: hidden; }}`,D+=`@keyframes ${j} { 50% { box-shadow: none; }}`,D+=`@keyframes ${I} { 0% { background-color: ${$.cursor.css}; color: ${$.cursorAccent.css}; } 50% { background-color: inherit; color: ${$.cursor.css}; }}`,D+=`${this._terminalSelector} .${N}.${L} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${B} 1s step-end infinite;}${this._terminalSelector} .${N}.${L} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${j} 1s step-end infinite;}${this._terminalSelector} .${N}.${L} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${I} 1s step-end infinite;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-block { background-color: ${$.cursor.css}; color: ${$.cursorAccent.css};}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${$.cursor.css} !important; color: ${$.cursorAccent.css} !important;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${$.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${$.cursor.css} inset;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${$.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,D+=`${this._terminalSelector} .${A} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${A} div { position: absolute; background-color: ${$.selectionBackgroundOpaque.css};}${this._terminalSelector} .${A} div { position: absolute; background-color: ${$.selectionInactiveBackgroundOpaque.css};}`;for(const[U,F]of $.ansi.entries())D+=`${this._terminalSelector} .${E}${U} { color: ${F.css}; }${this._terminalSelector} .${E}${U}.xterm-dim { color: ${m.color.multiplyOpacity(F,.5).css}; }${this._terminalSelector} .${k}${U} { background-color: ${F.css}; }`;D+=`${this._terminalSelector} .${E}${f.INVERTED_DEFAULT_COLOR} { color: ${m.color.opaque($.background).css}; }${this._terminalSelector} .${E}${f.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${m.color.multiplyOpacity(m.color.opaque($.background),.5).css}; }${this._terminalSelector} .${k}${f.INVERTED_DEFAULT_COLOR} { background-color: ${$.foreground.css}; }`,this._themeStyleElement.textContent=D}_setDefaultSpacing(){const $=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${$}px`,this._rowFactory.defaultSpacing=$}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements($,D){for(let B=this._rowElements.length;B<=D;B++){const j=this._document.createElement("div");this._rowContainer.appendChild(j),this._rowElements.push(j)}for(;this._rowElements.length>D;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize($,D){this._refreshRowElements($,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(L),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(L),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged($,D,B){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged($,D,B),this.renderRows(0,this._bufferService.rows-1),!$||!D)return;this._selectionRenderModel.update(this._terminal,$,D,B);const j=this._selectionRenderModel.viewportStartRow,I=this._selectionRenderModel.viewportEndRow,U=this._selectionRenderModel.viewportCappedStartRow,F=this._selectionRenderModel.viewportCappedEndRow;if(U>=this._bufferService.rows||F<0)return;const P=this._document.createDocumentFragment();if(B){const H=$[0]>D[0];P.appendChild(this._createSelectionElement(U,H?D[0]:$[0],H?$[0]:D[0],F-U+1))}else{const H=j===U?$[0]:0,W=U===I?D[0]:this._bufferService.cols;P.appendChild(this._createSelectionElement(U,H,W));const V=F-U-1;if(P.appendChild(this._createSelectionElement(U+1,0,this._bufferService.cols,V)),U!==F){const re=I===F?D[0]:this._bufferService.cols;P.appendChild(this._createSelectionElement(F,0,re))}}this._selectionContainer.appendChild(P)}_createSelectionElement($,D,B,j=1){const I=this._document.createElement("div"),U=D*this.dimensions.css.cell.width;let F=this.dimensions.css.cell.width*(B-D);return U+F>this.dimensions.css.canvas.width&&(F=this.dimensions.css.canvas.width-U),I.style.height=j*this.dimensions.css.cell.height+"px",I.style.top=$*this.dimensions.css.cell.height+"px",I.style.left=`${U}px`,I.style.width=`${F}px`,I}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 $ of this._rowElements)$.replaceChildren()}renderRows($,D){const B=this._bufferService.buffer,j=B.ybase+B.y,I=Math.min(B.x,this._bufferService.cols-1),U=this._optionsService.rawOptions.cursorBlink,F=this._optionsService.rawOptions.cursorStyle,P=this._optionsService.rawOptions.cursorInactiveStyle;for(let H=$;H<=D;H++){const W=H+B.ydisp,V=this._rowElements[H],re=B.lines.get(W);if(!V||!re)break;V.replaceChildren(...this._rowFactory.createRow(re,W,W===j,F,P,I,U,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${T}${this._terminalClass}`}_handleLinkHover($){this._setCellUnderline($.x1,$.x2,$.y1,$.y2,$.cols,!0)}_handleLinkLeave($){this._setCellUnderline($.x1,$.x2,$.y1,$.y2,$.cols,!1)}_setCellUnderline($,D,B,j,I,U){B<0&&($=0),j<0&&(D=0);const F=this._bufferService.rows-1;B=Math.max(Math.min(B,F),0),j=Math.max(Math.min(j,F),0),I=Math.min(I,this._bufferService.cols);const P=this._bufferService.buffer,H=P.ybase+P.y,W=Math.min(P.x,I-1),V=this._optionsService.rawOptions.cursorBlink,re=this._optionsService.rawOptions.cursorStyle,J=this._optionsService.rawOptions.cursorInactiveStyle;for(let ne=B;ne<=j;++ne){const X=ne+P.ydisp,q=this._rowElements[ne],Y=P.lines.get(X);if(!q||!Y)break;q.replaceChildren(...this._rowFactory.createRow(Y,X,X===H,re,J,W,V,this.dimensions.css.cell.width,this._widthCache,U?ne===B?$:0:-1,U?(ne===j?D:I)-1:-1))}}};o.DomRenderer=O=u([c(7,_.IInstantiationService),c(8,v.ICharSizeService),c(9,_.IOptionsService),c(10,_.IBufferService),c(11,v.ICoreBrowserService),c(12,v.IThemeService)],O)},3787:function(s,o,l){var u=this&&this.__decorate||function(N,E,k,L){var A,M=arguments.length,O=M<3?E:L===null?L=Object.getOwnPropertyDescriptor(E,k):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(N,E,k,L);else for(var $=N.length-1;$>=0;$--)(A=N[$])&&(O=(M<3?A(O):M>3?A(E,k,O):A(E,k))||O);return M>3&&O&&Object.defineProperty(E,k,O),O},c=this&&this.__param||function(N,E){return function(k,L){E(k,L,N)}};Object.defineProperty(o,"__esModule",{value:!0}),o.DomRendererRowFactory=void 0;const d=l(2223),p=l(643),f=l(511),x=l(2585),S=l(8055),v=l(4725),m=l(4269),b=l(6171),w=l(3734);let _=o.DomRendererRowFactory=class{constructor(N,E,k,L,A,M,O){this._document=N,this._characterJoinerService=E,this._optionsService=k,this._coreBrowserService=L,this._coreService=A,this._decorationService=M,this._themeService=O,this._workCell=new f.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(N,E,k){this._selectionStart=N,this._selectionEnd=E,this._columnSelectMode=k}createRow(N,E,k,L,A,M,O,$,D,B,j){const I=[],U=this._characterJoinerService.getJoinedCharacters(E),F=this._themeService.colors;let P,H=N.getNoBgTrimmedLength();k&&H<M+1&&(H=M+1);let W=0,V="",re=0,J=0,ne=0,X=!1,q=0,Y=!1,Q=0;const te=[],ie=B!==-1&&j!==-1;for(let le=0;le<H;le++){N.loadCell(le,this._workCell);let pe=this._workCell.getWidth();if(pe===0)continue;let Le=!1,je=le,Se=this._workCell;if(U.length>0&&le===U[0][0]){Le=!0;const ae=U.shift();Se=new m.JoinedCellData(this._workCell,N.translateToString(!0,ae[0],ae[1]),ae[1]-ae[0]),je=ae[1]-1,pe=Se.getWidth()}const Te=this._isCellInSelection(le,E),Ae=k&&le===M,Ne=ie&&le>=B&&le<=j;let Pe=!1;this._decorationService.forEachDecorationAtCell(le,E,void 0,(ae=>{Pe=!0}));let ze=Se.getChars()||p.WHITESPACE_CELL_CHAR;if(ze===" "&&(Se.isUnderline()||Se.isOverline())&&(ze=" "),Q=pe*$-D.get(ze,Se.isBold(),Se.isItalic()),P){if(W&&(Te&&Y||!Te&&!Y&&Se.bg===re)&&(Te&&Y&&F.selectionForeground||Se.fg===J)&&Se.extended.ext===ne&&Ne===X&&Q===q&&!Ae&&!Le&&!Pe){Se.isInvisible()?V+=p.WHITESPACE_CELL_CHAR:V+=ze,W++;continue}W&&(P.textContent=V),P=this._document.createElement("span"),W=0,V=""}else P=this._document.createElement("span");if(re=Se.bg,J=Se.fg,ne=Se.extended.ext,X=Ne,q=Q,Y=Te,Le&&M>=le&&M<=je&&(M=le),!this._coreService.isCursorHidden&&Ae&&this._coreService.isCursorInitialized){if(te.push("xterm-cursor"),this._coreBrowserService.isFocused)O&&te.push("xterm-cursor-blink"),te.push(L==="bar"?"xterm-cursor-bar":L==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(A)switch(A){case"outline":te.push("xterm-cursor-outline");break;case"block":te.push("xterm-cursor-block");break;case"bar":te.push("xterm-cursor-bar");break;case"underline":te.push("xterm-cursor-underline")}}if(Se.isBold()&&te.push("xterm-bold"),Se.isItalic()&&te.push("xterm-italic"),Se.isDim()&&te.push("xterm-dim"),V=Se.isInvisible()?p.WHITESPACE_CELL_CHAR:Se.getChars()||p.WHITESPACE_CELL_CHAR,Se.isUnderline()&&(te.push(`xterm-underline-${Se.extended.underlineStyle}`),V===" "&&(V=" "),!Se.isUnderlineColorDefault()))if(Se.isUnderlineColorRGB())P.style.textDecorationColor=`rgb(${w.AttributeData.toColorRGB(Se.getUnderlineColor()).join(",")})`;else{let ae=Se.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Se.isBold()&&ae<8&&(ae+=8),P.style.textDecorationColor=F.ansi[ae].css}Se.isOverline()&&(te.push("xterm-overline"),V===" "&&(V=" ")),Se.isStrikethrough()&&te.push("xterm-strikethrough"),Ne&&(P.style.textDecoration="underline");let Ie=Se.getFgColor(),$e=Se.getFgColorMode(),Ge=Se.getBgColor(),ve=Se.getBgColorMode();const Ee=!!Se.isInverse();if(Ee){const ae=Ie;Ie=Ge,Ge=ae;const se=$e;$e=ve,ve=se}let Me,ye,ee,ue=!1;switch(this._decorationService.forEachDecorationAtCell(le,E,void 0,(ae=>{ae.options.layer!=="top"&&ue||(ae.backgroundColorRGB&&(ve=50331648,Ge=ae.backgroundColorRGB.rgba>>8&16777215,Me=ae.backgroundColorRGB),ae.foregroundColorRGB&&($e=50331648,Ie=ae.foregroundColorRGB.rgba>>8&16777215,ye=ae.foregroundColorRGB),ue=ae.options.layer==="top")})),!ue&&Te&&(Me=this._coreBrowserService.isFocused?F.selectionBackgroundOpaque:F.selectionInactiveBackgroundOpaque,Ge=Me.rgba>>8&16777215,ve=50331648,ue=!0,F.selectionForeground&&($e=50331648,Ie=F.selectionForeground.rgba>>8&16777215,ye=F.selectionForeground)),ue&&te.push("xterm-decoration-top"),ve){case 16777216:case 33554432:ee=F.ansi[Ge],te.push(`xterm-bg-${Ge}`);break;case 50331648:ee=S.channels.toColor(Ge>>16,Ge>>8&255,255&Ge),this._addStyle(P,`background-color:#${T((Ge>>>0).toString(16),"0",6)}`);break;default:Ee?(ee=F.foreground,te.push(`xterm-bg-${d.INVERTED_DEFAULT_COLOR}`)):ee=F.background}switch(Me||Se.isDim()&&(Me=S.color.multiplyOpacity(ee,.5)),$e){case 16777216:case 33554432:Se.isBold()&&Ie<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Ie+=8),this._applyMinimumContrast(P,ee,F.ansi[Ie],Se,Me,void 0)||te.push(`xterm-fg-${Ie}`);break;case 50331648:const ae=S.channels.toColor(Ie>>16&255,Ie>>8&255,255&Ie);this._applyMinimumContrast(P,ee,ae,Se,Me,ye)||this._addStyle(P,`color:#${T(Ie.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(P,ee,F.foreground,Se,Me,ye)||Ee&&te.push(`xterm-fg-${d.INVERTED_DEFAULT_COLOR}`)}te.length&&(P.className=te.join(" "),te.length=0),Ae||Le||Pe?P.textContent=V:W++,Q!==this.defaultSpacing&&(P.style.letterSpacing=`${Q}px`),I.push(P),le=je}return P&&W&&(P.textContent=V),I}_applyMinimumContrast(N,E,k,L,A,M){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,b.treatGlyphAsBackgroundColor)(L.getCode()))return!1;const O=this._getContrastCache(L);let $;if(A||M||($=O.getColor(E.rgba,k.rgba)),$===void 0){const D=this._optionsService.rawOptions.minimumContrastRatio/(L.isDim()?2:1);$=S.color.ensureContrastRatio(A||E,M||k,D),O.setColor((A||E).rgba,(M||k).rgba,$??null)}return!!$&&(this._addStyle(N,`color:${$.css}`),!0)}_getContrastCache(N){return N.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(N,E){N.setAttribute("style",`${N.getAttribute("style")||""}${E};`)}_isCellInSelection(N,E){const k=this._selectionStart,L=this._selectionEnd;return!(!k||!L)&&(this._columnSelectMode?k[0]<=L[0]?N>=k[0]&&E>=k[1]&&N<L[0]&&E<=L[1]:N<k[0]&&E>=k[1]&&N>=L[0]&&E<=L[1]:E>k[1]&&E<L[1]||k[1]===L[1]&&E===k[1]&&N>=k[0]&&N<L[0]||k[1]<L[1]&&E===L[1]&&N<L[0]||k[1]<L[1]&&E===k[1]&&N>=k[0])}};function T(N,E,k){for(;N.length<k;)N=E+N;return N}o.DomRendererRowFactory=_=u([c(1,v.ICharacterJoinerService),c(2,x.IOptionsService),c(3,v.ICoreBrowserService),c(4,x.ICoreService),c(5,x.IDecorationService),c(6,v.IThemeService)],_)},2550:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.WidthCache=void 0,o.WidthCache=class{constructor(l,u){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=l.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const c=l.createElement("span");c.classList.add("xterm-char-measure-element");const d=l.createElement("span");d.classList.add("xterm-char-measure-element"),d.style.fontWeight="bold";const p=l.createElement("span");p.classList.add("xterm-char-measure-element"),p.style.fontStyle="italic";const f=l.createElement("span");f.classList.add("xterm-char-measure-element"),f.style.fontWeight="bold",f.style.fontStyle="italic",this._measureElements=[c,d,p,f],this._container.appendChild(c),this._container.appendChild(d),this._container.appendChild(p),this._container.appendChild(f),u.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(l,u,c,d){l===this._font&&u===this._fontSize&&c===this._weight&&d===this._weightBold||(this._font=l,this._fontSize=u,this._weight=c,this._weightBold=d,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${c}`,this._measureElements[1].style.fontWeight=`${d}`,this._measureElements[2].style.fontWeight=`${c}`,this._measureElements[3].style.fontWeight=`${d}`,this.clear())}get(l,u,c){let d=0;if(!u&&!c&&l.length===1&&(d=l.charCodeAt(0))<256){if(this._flat[d]!==-9999)return this._flat[d];const x=this._measure(l,0);return x>0&&(this._flat[d]=x),x}let p=l;u&&(p+="B"),c&&(p+="I");let f=this._holey.get(p);if(f===void 0){let x=0;u&&(x|=1),c&&(x|=2),f=this._measure(l,x),f>0&&this._holey.set(p,f)}return f}_measure(l,u){const c=this._measureElements[u];return c.textContent=l.repeat(32),c.offsetWidth/32}}},2223:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.TEXT_BASELINE=o.DIM_OPACITY=o.INVERTED_DEFAULT_COLOR=void 0;const u=l(6114);o.INVERTED_DEFAULT_COLOR=257,o.DIM_OPACITY=.5,o.TEXT_BASELINE=u.isFirefox||u.isLegacyEdge?"bottom":"ideographic"},6171:(s,o)=>{function l(c){return 57508<=c&&c<=57558}function u(c){return c>=128512&&c<=128591||c>=127744&&c<=128511||c>=128640&&c<=128767||c>=9728&&c<=9983||c>=9984&&c<=10175||c>=65024&&c<=65039||c>=129280&&c<=129535||c>=127462&&c<=127487}Object.defineProperty(o,"__esModule",{value:!0}),o.computeNextVariantOffset=o.createRenderDimensions=o.treatGlyphAsBackgroundColor=o.allowRescaling=o.isEmoji=o.isRestrictedPowerlineGlyph=o.isPowerlineGlyph=o.throwIfFalsy=void 0,o.throwIfFalsy=function(c){if(!c)throw new Error("value must not be falsy");return c},o.isPowerlineGlyph=l,o.isRestrictedPowerlineGlyph=function(c){return 57520<=c&&c<=57527},o.isEmoji=u,o.allowRescaling=function(c,d,p,f){return d===1&&p>Math.ceil(1.5*f)&&c!==void 0&&c>255&&!u(c)&&!l(c)&&!(function(x){return 57344<=x&&x<=63743})(c)},o.treatGlyphAsBackgroundColor=function(c){return l(c)||(function(d){return 9472<=d&&d<=9631})(c)},o.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}}}},o.computeNextVariantOffset=function(c,d,p=0){return(c-(2*Math.round(d)-p))%(2*Math.round(d))}},6052:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.createSelectionRenderModel=void 0;class l{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(c,d,p,f=!1){if(this.selectionStart=d,this.selectionEnd=p,!d||!p||d[0]===p[0]&&d[1]===p[1])return void this.clear();const x=c.buffers.active.ydisp,S=d[1]-x,v=p[1]-x,m=Math.max(S,0),b=Math.min(v,c.rows-1);m>=c.rows||b<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=f,this.viewportStartRow=S,this.viewportEndRow=v,this.viewportCappedStartRow=m,this.viewportCappedEndRow=b,this.startCol=d[0],this.endCol=p[0])}isCellSelected(c,d,p){return!!this.hasSelection&&(p-=c.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?d>=this.startCol&&p>=this.viewportCappedStartRow&&d<this.endCol&&p<=this.viewportCappedEndRow:d<this.startCol&&p>=this.viewportCappedStartRow&&d>=this.endCol&&p<=this.viewportCappedEndRow:p>this.viewportStartRow&&p<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&p===this.viewportStartRow&&d>=this.startCol&&d<this.endCol||this.viewportStartRow<this.viewportEndRow&&p===this.viewportEndRow&&d<this.endCol||this.viewportStartRow<this.viewportEndRow&&p===this.viewportStartRow&&d>=this.startCol)}}o.createSelectionRenderModel=function(){return new l}},456:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.SelectionModel=void 0,o.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(s,o,l){var u=this&&this.__decorate||function(b,w,_,T){var N,E=arguments.length,k=E<3?w:T===null?T=Object.getOwnPropertyDescriptor(w,_):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(b,w,_,T);else for(var L=b.length-1;L>=0;L--)(N=b[L])&&(k=(E<3?N(k):E>3?N(w,_,k):N(w,_))||k);return E>3&&k&&Object.defineProperty(w,_,k),k},c=this&&this.__param||function(b,w){return function(_,T){w(_,T,b)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CharSizeService=void 0;const d=l(2585),p=l(8460),f=l(844);let x=o.CharSizeService=class extends f.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(b,w,_){super(),this._optionsService=_,this.width=0,this.height=0,this._onCharSizeChange=this.register(new p.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new m(this._optionsService))}catch{this._measureStrategy=this.register(new v(b,w,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const b=this._measureStrategy.measure();b.width===this.width&&b.height===this.height||(this.width=b.width,this.height=b.height,this._onCharSizeChange.fire())}};o.CharSizeService=x=u([c(2,d.IOptionsService)],x);class S extends f.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(w,_){w!==void 0&&w>0&&_!==void 0&&_>0&&(this._result.width=w,this._result.height=_)}}class v extends S{constructor(w,_,T){super(),this._document=w,this._parentElement=_,this._optionsService=T,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 S{constructor(w){super(),this._optionsService=w,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 w=this._ctx.measureText("W");return this._validateAndSet(w.width,w.fontBoundingBoxAscent+w.fontBoundingBoxDescent),this._result}}},4269:function(s,o,l){var u=this&&this.__decorate||function(m,b,w,_){var T,N=arguments.length,E=N<3?b:_===null?_=Object.getOwnPropertyDescriptor(b,w):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(m,b,w,_);else for(var k=m.length-1;k>=0;k--)(T=m[k])&&(E=(N<3?T(E):N>3?T(b,w,E):T(b,w))||E);return N>3&&E&&Object.defineProperty(b,w,E),E},c=this&&this.__param||function(m,b){return function(w,_){b(w,_,m)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CharacterJoinerService=o.JoinedCellData=void 0;const d=l(3734),p=l(643),f=l(511),x=l(2585);class S extends d.AttributeData{constructor(b,w,_){super(),this.content=0,this.combinedData="",this.fg=b.fg,this.bg=b.bg,this.combinedData=w,this._width=_}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(b){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}o.JoinedCellData=S;let v=o.CharacterJoinerService=class BC{constructor(b){this._bufferService=b,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new f.CellData}register(b){const w={id:this._nextCharacterJoinerId++,handler:b};return this._characterJoiners.push(w),w.id}deregister(b){for(let w=0;w<this._characterJoiners.length;w++)if(this._characterJoiners[w].id===b)return this._characterJoiners.splice(w,1),!0;return!1}getJoinedCharacters(b){if(this._characterJoiners.length===0)return[];const w=this._bufferService.buffer.lines.get(b);if(!w||w.length===0)return[];const _=[],T=w.translateToString(!0);let N=0,E=0,k=0,L=w.getFg(0),A=w.getBg(0);for(let M=0;M<w.getTrimmedLength();M++)if(w.loadCell(M,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==L||this._workCell.bg!==A){if(M-N>1){const O=this._getJoinedRanges(T,k,E,w,N);for(let $=0;$<O.length;$++)_.push(O[$])}N=M,k=E,L=this._workCell.fg,A=this._workCell.bg}E+=this._workCell.getChars().length||p.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-N>1){const M=this._getJoinedRanges(T,k,E,w,N);for(let O=0;O<M.length;O++)_.push(M[O])}return _}_getJoinedRanges(b,w,_,T,N){const E=b.substring(w,_);let k=[];try{k=this._characterJoiners[0].handler(E)}catch(L){console.error(L)}for(let L=1;L<this._characterJoiners.length;L++)try{const A=this._characterJoiners[L].handler(E);for(let M=0;M<A.length;M++)BC._mergeRanges(k,A[M])}catch(A){console.error(A)}return this._stringRangesToCellRanges(k,T,N),k}_stringRangesToCellRanges(b,w,_){let T=0,N=!1,E=0,k=b[T];if(k){for(let L=_;L<this._bufferService.cols;L++){const A=w.getWidth(L),M=w.getString(L).length||p.WHITESPACE_CELL_CHAR.length;if(A!==0){if(!N&&k[0]<=E&&(k[0]=L,N=!0),k[1]<=E){if(k[1]=L,k=b[++T],!k)break;k[0]<=E?(k[0]=L,N=!0):N=!1}E+=M}}k&&(k[1]=this._bufferService.cols)}}static _mergeRanges(b,w){let _=!1;for(let T=0;T<b.length;T++){const N=b[T];if(_){if(w[1]<=N[0])return b[T-1][1]=w[1],b;if(w[1]<=N[1])return b[T-1][1]=Math.max(w[1],N[1]),b.splice(T,1),b;b.splice(T,1),T--}else{if(w[1]<=N[0])return b.splice(T,0,w),b;if(w[1]<=N[1])return N[0]=Math.min(w[0],N[0]),b;w[0]<N[1]&&(N[0]=Math.min(w[0],N[0]),_=!0)}}return _?b[b.length-1][1]=w[1]:b.push(w),b}};o.CharacterJoinerService=v=u([c(0,x.IBufferService)],v)},5114:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CoreBrowserService=void 0;const u=l(844),c=l(8460),d=l(3656);class p extends u.Disposable{constructor(S,v,m){super(),this._textarea=S,this._window=v,this.mainDocument=m,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new f(this._window),this._onDprChange=this.register(new c.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new c.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((b=>this._screenDprMonitor.setWindow(b)))),this.register((0,c.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(S){this._window!==S&&(this._window=S,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}}o.CoreBrowserService=p;class f extends u.Disposable{constructor(S){super(),this._parentWindow=S,this._windowResizeListener=this.register(new u.MutableDisposable),this._onDprChange=this.register(new c.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,u.toDisposable)((()=>this.clearListener())))}setWindow(S){this._parentWindow=S,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,d.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var S;this._outerListener&&((S=this._resolutionMediaMatchList)==null||S.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:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.LinkProviderService=void 0;const u=l(844);class c extends u.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,u.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(p){return this.linkProviders.push(p),{dispose:()=>{const f=this.linkProviders.indexOf(p);f!==-1&&this.linkProviders.splice(f,1)}}}}o.LinkProviderService=c},8934:function(s,o,l){var u=this&&this.__decorate||function(x,S,v,m){var b,w=arguments.length,_=w<3?S:m===null?m=Object.getOwnPropertyDescriptor(S,v):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(x,S,v,m);else for(var T=x.length-1;T>=0;T--)(b=x[T])&&(_=(w<3?b(_):w>3?b(S,v,_):b(S,v))||_);return w>3&&_&&Object.defineProperty(S,v,_),_},c=this&&this.__param||function(x,S){return function(v,m){S(v,m,x)}};Object.defineProperty(o,"__esModule",{value:!0}),o.MouseService=void 0;const d=l(4725),p=l(9806);let f=o.MouseService=class{constructor(x,S){this._renderService=x,this._charSizeService=S}getCoords(x,S,v,m,b){return(0,p.getCoords)(window,x,S,v,m,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,b)}getMouseReportCoords(x,S){const v=(0,p.getCoordsRelativeToElement)(window,x,S);if(this._charSizeService.hasValidSize)return v[0]=Math.min(Math.max(v[0],0),this._renderService.dimensions.css.canvas.width-1),v[1]=Math.min(Math.max(v[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(v[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(v[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(v[0]),y:Math.floor(v[1])}}};o.MouseService=f=u([c(0,d.IRenderService),c(1,d.ICharSizeService)],f)},3230:function(s,o,l){var u=this&&this.__decorate||function(b,w,_,T){var N,E=arguments.length,k=E<3?w:T===null?T=Object.getOwnPropertyDescriptor(w,_):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(b,w,_,T);else for(var L=b.length-1;L>=0;L--)(N=b[L])&&(k=(E<3?N(k):E>3?N(w,_,k):N(w,_))||k);return E>3&&k&&Object.defineProperty(w,_,k),k},c=this&&this.__param||function(b,w){return function(_,T){w(_,T,b)}};Object.defineProperty(o,"__esModule",{value:!0}),o.RenderService=void 0;const d=l(6193),p=l(4725),f=l(8460),x=l(844),S=l(7226),v=l(2585);let m=o.RenderService=class extends x.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(b,w,_,T,N,E,k,L){super(),this._rowCount=b,this._charSizeService=T,this._renderer=this.register(new x.MutableDisposable),this._pausedResizeTask=new S.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 f.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new f.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new f.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new f.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new d.RenderDebouncer(((A,M)=>this._renderRows(A,M)),k),this.register(this._renderDebouncer),this.register(k.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(E.onResize((()=>this._fullRefresh()))),this.register(E.buffers.onBufferActivate((()=>{var A;return(A=this._renderer.value)==null?void 0:A.clear()}))),this.register(_.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(N.onDecorationRegistered((()=>this._fullRefresh()))),this.register(N.onDecorationRemoved((()=>this._fullRefresh()))),this.register(_.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(E.cols,E.rows),this._fullRefresh()}))),this.register(_.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(E.buffer.y,E.buffer.y,!0)))),this.register(L.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(k.window,w),this.register(k.onWindowChange((A=>this._registerIntersectionObserver(A,w))))}_registerIntersectionObserver(b,w){if("IntersectionObserver"in b){const _=new b.IntersectionObserver((T=>this._handleIntersectionChange(T[T.length-1])),{threshold:0});_.observe(w),this._observerDisposable.value=(0,x.toDisposable)((()=>_.disconnect()))}}_handleIntersectionChange(b){this._isPaused=b.isIntersecting===void 0?b.intersectionRatio===0:!b.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(b,w,_=!1){this._isPaused?this._needsFullRefresh=!0:(_||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(b,w,this._rowCount))}_renderRows(b,w){this._renderer.value&&(b=Math.min(b,this._rowCount-1),w=Math.min(w,this._rowCount-1),this._renderer.value.renderRows(b,w),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:b,end:w}),this._onRender.fire({start:b,end:w}),this._isNextRenderRedrawOnly=!0)}resize(b,w){this._rowCount=w,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(b){this._renderer.value=b,this._renderer.value&&(this._renderer.value.onRequestRedraw((w=>this.refreshRows(w.start,w.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(b){return this._renderDebouncer.addRefreshCallback(b)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var b,w;this._renderer.value&&((w=(b=this._renderer.value).clearTextureAtlas)==null||w.call(b),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(b,w){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var _;return(_=this._renderer.value)==null?void 0:_.handleResize(b,w)})):this._renderer.value.handleResize(b,w),this._fullRefresh())}handleCharSizeChanged(){var b;(b=this._renderer.value)==null||b.handleCharSizeChanged()}handleBlur(){var b;(b=this._renderer.value)==null||b.handleBlur()}handleFocus(){var b;(b=this._renderer.value)==null||b.handleFocus()}handleSelectionChanged(b,w,_){var T;this._selectionState.start=b,this._selectionState.end=w,this._selectionState.columnSelectMode=_,(T=this._renderer.value)==null||T.handleSelectionChanged(b,w,_)}handleCursorMove(){var b;(b=this._renderer.value)==null||b.handleCursorMove()}clear(){var b;(b=this._renderer.value)==null||b.clear()}};o.RenderService=m=u([c(2,v.IOptionsService),c(3,p.ICharSizeService),c(4,v.IDecorationService),c(5,v.IBufferService),c(6,p.ICoreBrowserService),c(7,p.IThemeService)],m)},9312:function(s,o,l){var u=this&&this.__decorate||function(k,L,A,M){var O,$=arguments.length,D=$<3?L:M===null?M=Object.getOwnPropertyDescriptor(L,A):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(k,L,A,M);else for(var B=k.length-1;B>=0;B--)(O=k[B])&&(D=($<3?O(D):$>3?O(L,A,D):O(L,A))||D);return $>3&&D&&Object.defineProperty(L,A,D),D},c=this&&this.__param||function(k,L){return function(A,M){L(A,M,k)}};Object.defineProperty(o,"__esModule",{value:!0}),o.SelectionService=void 0;const d=l(9806),p=l(9504),f=l(456),x=l(4725),S=l(8460),v=l(844),m=l(6114),b=l(4841),w=l(511),_=l(2585),T=" ",N=new RegExp(T,"g");let E=o.SelectionService=class extends v.Disposable{constructor(k,L,A,M,O,$,D,B,j){super(),this._element=k,this._screenElement=L,this._linkifier=A,this._bufferService=M,this._coreService=O,this._mouseService=$,this._optionsService=D,this._renderService=B,this._coreBrowserService=j,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new w.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new S.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new S.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new S.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new S.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=I=>this._handleMouseMove(I),this._mouseUpListener=I=>this._handleMouseUp(I),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((I=>this._handleTrim(I))),this.register(this._bufferService.buffers.onBufferActivate((I=>this._handleBufferActivate(I)))),this.enable(),this._model=new f.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,v.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const k=this._model.finalSelectionStart,L=this._model.finalSelectionEnd;return!(!k||!L||k[0]===L[0]&&k[1]===L[1])}get selectionText(){const k=this._model.finalSelectionStart,L=this._model.finalSelectionEnd;if(!k||!L)return"";const A=this._bufferService.buffer,M=[];if(this._activeSelectionMode===3){if(k[0]===L[0])return"";const O=k[0]<L[0]?k[0]:L[0],$=k[0]<L[0]?L[0]:k[0];for(let D=k[1];D<=L[1];D++){const B=A.translateBufferLineToString(D,!0,O,$);M.push(B)}}else{const O=k[1]===L[1]?L[0]:void 0;M.push(A.translateBufferLineToString(k[1],!0,k[0],O));for(let $=k[1]+1;$<=L[1]-1;$++){const D=A.lines.get($),B=A.translateBufferLineToString($,!0);D!=null&&D.isWrapped?M[M.length-1]+=B:M.push(B)}if(k[1]!==L[1]){const $=A.lines.get(L[1]),D=A.translateBufferLineToString(L[1],!0,0,L[0]);$&&$.isWrapped?M[M.length-1]+=D:M.push(D)}}return M.map((O=>O.replace(N," "))).join(m.isWindows?`\r
|
|
385
|
+
`:`
|
|
386
|
+
`)}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 L=this._getMouseBufferCoords(k),A=this._model.finalSelectionStart,M=this._model.finalSelectionEnd;return!!(A&&M&&L)&&this._areCoordsInSelection(L,A,M)}isCellInSelection(k,L){const A=this._model.finalSelectionStart,M=this._model.finalSelectionEnd;return!(!A||!M)&&this._areCoordsInSelection([k,L],A,M)}_areCoordsInSelection(k,L,A){return k[1]>L[1]&&k[1]<A[1]||L[1]===A[1]&&k[1]===L[1]&&k[0]>=L[0]&&k[0]<A[0]||L[1]<A[1]&&k[1]===A[1]&&k[0]<A[0]||L[1]<A[1]&&k[1]===L[1]&&k[0]>=L[0]}_selectWordAtCursor(k,L){var O,$;const A=($=(O=this._linkifier.currentLink)==null?void 0:O.link)==null?void 0:$.range;if(A)return this._model.selectionStart=[A.start.x-1,A.start.y-1],this._model.selectionStartLength=(0,b.getRangeLength)(A,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const M=this._getMouseBufferCoords(k);return!!M&&(this._selectWordAt(M,L),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(k,L){this._model.clearSelection(),k=Math.max(k,0),L=Math.min(L,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,k],this._model.selectionEnd=[this._bufferService.cols,L],this.refresh(),this._onSelectionChange.fire()}_handleTrim(k){this._model.handleTrim(k)&&this.refresh()}_getMouseBufferCoords(k){const L=this._mouseService.getCoords(k,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(L)return L[0]--,L[1]--,L[1]+=this._bufferService.buffer.ydisp,L}_getMouseEventScrollAmount(k){let L=(0,d.getCoordsRelativeToElement)(this._coreBrowserService.window,k,this._screenElement)[1];const A=this._renderService.dimensions.css.canvas.height;return L>=0&&L<=A?0:(L>A&&(L-=A),L=Math.min(Math.max(L,-50),50),L/=50,L/Math.abs(L)+Math.round(14*L))}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 L=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);L&&L.length!==this._model.selectionStart[0]&&L.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(k){this._selectWordAtCursor(k,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(k){const L=this._getMouseBufferCoords(k);L&&(this._activeSelectionMode=2,this._selectLineAt(L[1]))}shouldColumnSelect(k){return k.altKey&&!(m.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(k){if(k.stopImmediatePropagation(),!this._model.selectionStart)return;const L=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 A=this._bufferService.buffer;if(this._model.selectionEnd[1]<A.lines.length){const M=A.lines.get(this._model.selectionEnd[1]);M&&M.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}L&&L[0]===this._model.selectionEnd[0]&&L[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 L=k.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&L<500&&k.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const A=this._mouseService.getCoords(k,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(A&&A[0]!==void 0&&A[1]!==void 0){const M=(0,p.moveToCellSequence)(A[0]-1,A[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(M,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const k=this._model.finalSelectionStart,L=this._model.finalSelectionEnd,A=!(!k||!L||k[0]===L[0]&&k[1]===L[1]);A?k&&L&&(this._oldSelectionStart&&this._oldSelectionEnd&&k[0]===this._oldSelectionStart[0]&&k[1]===this._oldSelectionStart[1]&&L[0]===this._oldSelectionEnd[0]&&L[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(k,L,A)):this._oldHasSelection&&this._fireOnSelectionChange(k,L,A)}_fireOnSelectionChange(k,L,A){this._oldSelectionStart=k,this._oldSelectionEnd=L,this._oldHasSelection=A,this._onSelectionChange.fire()}_handleBufferActivate(k){this.clearSelection(),this._trimListener.dispose(),this._trimListener=k.activeBuffer.lines.onTrim((L=>this._handleTrim(L)))}_convertViewportColToCharacterIndex(k,L){let A=L;for(let M=0;L>=M;M++){const O=k.loadCell(M,this._workCell).getChars().length;this._workCell.getWidth()===0?A--:O>1&&L!==M&&(A+=O-1)}return A}setSelection(k,L,A){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[k,L],this._model.selectionStartLength=A,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(k){this._isClickInSelection(k)||(this._selectWordAtCursor(k,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(k,L,A=!0,M=!0){if(k[0]>=this._bufferService.cols)return;const O=this._bufferService.buffer,$=O.lines.get(k[1]);if(!$)return;const D=O.translateBufferLineToString(k[1],!1);let B=this._convertViewportColToCharacterIndex($,k[0]),j=B;const I=k[0]-B;let U=0,F=0,P=0,H=0;if(D.charAt(B)===" "){for(;B>0&&D.charAt(B-1)===" ";)B--;for(;j<D.length&&D.charAt(j+1)===" ";)j++}else{let re=k[0],J=k[0];$.getWidth(re)===0&&(U++,re--),$.getWidth(J)===2&&(F++,J++);const ne=$.getString(J).length;for(ne>1&&(H+=ne-1,j+=ne-1);re>0&&B>0&&!this._isCharWordSeparator($.loadCell(re-1,this._workCell));){$.loadCell(re-1,this._workCell);const X=this._workCell.getChars().length;this._workCell.getWidth()===0?(U++,re--):X>1&&(P+=X-1,B-=X-1),B--,re--}for(;J<$.length&&j+1<D.length&&!this._isCharWordSeparator($.loadCell(J+1,this._workCell));){$.loadCell(J+1,this._workCell);const X=this._workCell.getChars().length;this._workCell.getWidth()===2?(F++,J++):X>1&&(H+=X-1,j+=X-1),j++,J++}}j++;let W=B+I-U+P,V=Math.min(this._bufferService.cols,j-B+U+F-P-H);if(L||D.slice(B,j).trim()!==""){if(A&&W===0&&$.getCodePoint(0)!==32){const re=O.lines.get(k[1]-1);if(re&&$.isWrapped&&re.getCodePoint(this._bufferService.cols-1)!==32){const J=this._getWordAt([this._bufferService.cols-1,k[1]-1],!1,!0,!1);if(J){const ne=this._bufferService.cols-J.start;W-=ne,V+=ne}}}if(M&&W+V===this._bufferService.cols&&$.getCodePoint(this._bufferService.cols-1)!==32){const re=O.lines.get(k[1]+1);if(re!=null&&re.isWrapped&&re.getCodePoint(0)!==32){const J=this._getWordAt([0,k[1]+1],!1,!1,!0);J&&(V+=J.length)}}return{start:W,length:V}}}_selectWordAt(k,L){const A=this._getWordAt(k,L);if(A){for(;A.start<0;)A.start+=this._bufferService.cols,k[1]--;this._model.selectionStart=[A.start,k[1]],this._model.selectionStartLength=A.length}}_selectToWordAt(k){const L=this._getWordAt(k,!0);if(L){let A=k[1];for(;L.start<0;)L.start+=this._bufferService.cols,A--;if(!this._model.areSelectionValuesReversed())for(;L.start+L.length>this._bufferService.cols;)L.length-=this._bufferService.cols,A++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?L.start:L.start+L.length,A]}}_isCharWordSeparator(k){return k.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(k.getChars())>=0}_selectLineAt(k){const L=this._bufferService.buffer.getWrappedRangeForLine(k),A={start:{x:0,y:L.first},end:{x:this._bufferService.cols-1,y:L.last}};this._model.selectionStart=[0,L.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,b.getRangeLength)(A,this._bufferService.cols)}};o.SelectionService=E=u([c(3,_.IBufferService),c(4,_.ICoreService),c(5,x.IMouseService),c(6,_.IOptionsService),c(7,x.IRenderService),c(8,x.ICoreBrowserService)],E)},4725:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ILinkProviderService=o.IThemeService=o.ICharacterJoinerService=o.ISelectionService=o.IRenderService=o.IMouseService=o.ICoreBrowserService=o.ICharSizeService=void 0;const u=l(8343);o.ICharSizeService=(0,u.createDecorator)("CharSizeService"),o.ICoreBrowserService=(0,u.createDecorator)("CoreBrowserService"),o.IMouseService=(0,u.createDecorator)("MouseService"),o.IRenderService=(0,u.createDecorator)("RenderService"),o.ISelectionService=(0,u.createDecorator)("SelectionService"),o.ICharacterJoinerService=(0,u.createDecorator)("CharacterJoinerService"),o.IThemeService=(0,u.createDecorator)("ThemeService"),o.ILinkProviderService=(0,u.createDecorator)("LinkProviderService")},6731:function(s,o,l){var u=this&&this.__decorate||function(E,k,L,A){var M,O=arguments.length,$=O<3?k:A===null?A=Object.getOwnPropertyDescriptor(k,L):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")$=Reflect.decorate(E,k,L,A);else for(var D=E.length-1;D>=0;D--)(M=E[D])&&($=(O<3?M($):O>3?M(k,L,$):M(k,L))||$);return O>3&&$&&Object.defineProperty(k,L,$),$},c=this&&this.__param||function(E,k){return function(L,A){k(L,A,E)}};Object.defineProperty(o,"__esModule",{value:!0}),o.ThemeService=o.DEFAULT_ANSI_COLORS=void 0;const d=l(7239),p=l(8055),f=l(8460),x=l(844),S=l(2585),v=p.css.toColor("#ffffff"),m=p.css.toColor("#000000"),b=p.css.toColor("#ffffff"),w=p.css.toColor("#000000"),_={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};o.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const E=[p.css.toColor("#2e3436"),p.css.toColor("#cc0000"),p.css.toColor("#4e9a06"),p.css.toColor("#c4a000"),p.css.toColor("#3465a4"),p.css.toColor("#75507b"),p.css.toColor("#06989a"),p.css.toColor("#d3d7cf"),p.css.toColor("#555753"),p.css.toColor("#ef2929"),p.css.toColor("#8ae234"),p.css.toColor("#fce94f"),p.css.toColor("#729fcf"),p.css.toColor("#ad7fa8"),p.css.toColor("#34e2e2"),p.css.toColor("#eeeeec")],k=[0,95,135,175,215,255];for(let L=0;L<216;L++){const A=k[L/36%6|0],M=k[L/6%6|0],O=k[L%6];E.push({css:p.channels.toCss(A,M,O),rgba:p.channels.toRgba(A,M,O)})}for(let L=0;L<24;L++){const A=8+10*L;E.push({css:p.channels.toCss(A,A,A),rgba:p.channels.toRgba(A,A,A)})}return E})());let T=o.ThemeService=class extends x.Disposable{get colors(){return this._colors}constructor(E){super(),this._optionsService=E,this._contrastCache=new d.ColorContrastCache,this._halfContrastCache=new d.ColorContrastCache,this._onChangeColors=this.register(new f.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:v,background:m,cursor:b,cursorAccent:w,selectionForeground:void 0,selectionBackgroundTransparent:_,selectionBackgroundOpaque:p.color.blend(m,_),selectionInactiveBackgroundTransparent:_,selectionInactiveBackgroundOpaque:p.color.blend(m,_),ansi:o.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(E={}){const k=this._colors;if(k.foreground=N(E.foreground,v),k.background=N(E.background,m),k.cursor=N(E.cursor,b),k.cursorAccent=N(E.cursorAccent,w),k.selectionBackgroundTransparent=N(E.selectionBackground,_),k.selectionBackgroundOpaque=p.color.blend(k.background,k.selectionBackgroundTransparent),k.selectionInactiveBackgroundTransparent=N(E.selectionInactiveBackground,k.selectionBackgroundTransparent),k.selectionInactiveBackgroundOpaque=p.color.blend(k.background,k.selectionInactiveBackgroundTransparent),k.selectionForeground=E.selectionForeground?N(E.selectionForeground,p.NULL_COLOR):void 0,k.selectionForeground===p.NULL_COLOR&&(k.selectionForeground=void 0),p.color.isOpaque(k.selectionBackgroundTransparent)&&(k.selectionBackgroundTransparent=p.color.opacity(k.selectionBackgroundTransparent,.3)),p.color.isOpaque(k.selectionInactiveBackgroundTransparent)&&(k.selectionInactiveBackgroundTransparent=p.color.opacity(k.selectionInactiveBackgroundTransparent,.3)),k.ansi=o.DEFAULT_ANSI_COLORS.slice(),k.ansi[0]=N(E.black,o.DEFAULT_ANSI_COLORS[0]),k.ansi[1]=N(E.red,o.DEFAULT_ANSI_COLORS[1]),k.ansi[2]=N(E.green,o.DEFAULT_ANSI_COLORS[2]),k.ansi[3]=N(E.yellow,o.DEFAULT_ANSI_COLORS[3]),k.ansi[4]=N(E.blue,o.DEFAULT_ANSI_COLORS[4]),k.ansi[5]=N(E.magenta,o.DEFAULT_ANSI_COLORS[5]),k.ansi[6]=N(E.cyan,o.DEFAULT_ANSI_COLORS[6]),k.ansi[7]=N(E.white,o.DEFAULT_ANSI_COLORS[7]),k.ansi[8]=N(E.brightBlack,o.DEFAULT_ANSI_COLORS[8]),k.ansi[9]=N(E.brightRed,o.DEFAULT_ANSI_COLORS[9]),k.ansi[10]=N(E.brightGreen,o.DEFAULT_ANSI_COLORS[10]),k.ansi[11]=N(E.brightYellow,o.DEFAULT_ANSI_COLORS[11]),k.ansi[12]=N(E.brightBlue,o.DEFAULT_ANSI_COLORS[12]),k.ansi[13]=N(E.brightMagenta,o.DEFAULT_ANSI_COLORS[13]),k.ansi[14]=N(E.brightCyan,o.DEFAULT_ANSI_COLORS[14]),k.ansi[15]=N(E.brightWhite,o.DEFAULT_ANSI_COLORS[15]),E.extendedAnsi){const L=Math.min(k.ansi.length-16,E.extendedAnsi.length);for(let A=0;A<L;A++)k.ansi[A+16]=N(E.extendedAnsi[A],o.DEFAULT_ANSI_COLORS[A+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(E){this._restoreColor(E),this._onChangeColors.fire(this.colors)}_restoreColor(E){if(E!==void 0)switch(E){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[E]=this._restoreColors.ansi[E]}else for(let k=0;k<this._restoreColors.ansi.length;++k)this._colors.ansi[k]=this._restoreColors.ansi[k]}modifyColors(E){E(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 N(E,k){if(E!==void 0)try{return p.css.toColor(E)}catch{}return k}o.ThemeService=T=u([c(0,S.IOptionsService)],T)},6349:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CircularList=void 0;const u=l(8460),c=l(844);class d extends c.Disposable{constructor(f){super(),this._maxLength=f,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(f){if(this._maxLength===f)return;const x=new Array(f);for(let S=0;S<Math.min(f,this.length);S++)x[S]=this._array[this._getCyclicIndex(S)];this._array=x,this._maxLength=f,this._startIndex=0}get length(){return this._length}set length(f){if(f>this._length)for(let x=this._length;x<f;x++)this._array[x]=void 0;this._length=f}get(f){return this._array[this._getCyclicIndex(f)]}set(f,x){this._array[this._getCyclicIndex(f)]=x}push(f){this._array[this._getCyclicIndex(this._length)]=f,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(f,x,...S){if(x){for(let v=f;v<this._length-x;v++)this._array[this._getCyclicIndex(v)]=this._array[this._getCyclicIndex(v+x)];this._length-=x,this.onDeleteEmitter.fire({index:f,amount:x})}for(let v=this._length-1;v>=f;v--)this._array[this._getCyclicIndex(v+S.length)]=this._array[this._getCyclicIndex(v)];for(let v=0;v<S.length;v++)this._array[this._getCyclicIndex(f+v)]=S[v];if(S.length&&this.onInsertEmitter.fire({index:f,amount:S.length}),this._length+S.length>this._maxLength){const v=this._length+S.length-this._maxLength;this._startIndex+=v,this._length=this._maxLength,this.onTrimEmitter.fire(v)}else this._length+=S.length}trimStart(f){f>this._length&&(f=this._length),this._startIndex+=f,this._length-=f,this.onTrimEmitter.fire(f)}shiftElements(f,x,S){if(!(x<=0)){if(f<0||f>=this._length)throw new Error("start argument out of range");if(f+S<0)throw new Error("Cannot shift elements in list beyond index 0");if(S>0){for(let m=x-1;m>=0;m--)this.set(f+m+S,this.get(f+m));const v=f+x+S-this._length;if(v>0)for(this._length+=v;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let v=0;v<x;v++)this.set(f+v+S,this.get(f+v))}}_getCyclicIndex(f){return(this._startIndex+f)%this._maxLength}}o.CircularList=d},1439:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.clone=void 0,o.clone=function l(u,c=5){if(typeof u!="object")return u;const d=Array.isArray(u)?[]:{};for(const p in u)d[p]=c<=1?u[p]:u[p]&&l(u[p],c-1);return d}},8055:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.contrastRatio=o.toPaddedHex=o.rgba=o.rgb=o.css=o.color=o.channels=o.NULL_COLOR=void 0;let l=0,u=0,c=0,d=0;var p,f,x,S,v;function m(w){const _=w.toString(16);return _.length<2?"0"+_:_}function b(w,_){return w<_?(_+.05)/(w+.05):(w+.05)/(_+.05)}o.NULL_COLOR={css:"#00000000",rgba:0},(function(w){w.toCss=function(_,T,N,E){return E!==void 0?`#${m(_)}${m(T)}${m(N)}${m(E)}`:`#${m(_)}${m(T)}${m(N)}`},w.toRgba=function(_,T,N,E=255){return(_<<24|T<<16|N<<8|E)>>>0},w.toColor=function(_,T,N,E){return{css:w.toCss(_,T,N,E),rgba:w.toRgba(_,T,N,E)}}})(p||(o.channels=p={})),(function(w){function _(T,N){return d=Math.round(255*N),[l,u,c]=v.toChannels(T.rgba),{css:p.toCss(l,u,c,d),rgba:p.toRgba(l,u,c,d)}}w.blend=function(T,N){if(d=(255&N.rgba)/255,d===1)return{css:N.css,rgba:N.rgba};const E=N.rgba>>24&255,k=N.rgba>>16&255,L=N.rgba>>8&255,A=T.rgba>>24&255,M=T.rgba>>16&255,O=T.rgba>>8&255;return l=A+Math.round((E-A)*d),u=M+Math.round((k-M)*d),c=O+Math.round((L-O)*d),{css:p.toCss(l,u,c),rgba:p.toRgba(l,u,c)}},w.isOpaque=function(T){return(255&T.rgba)==255},w.ensureContrastRatio=function(T,N,E){const k=v.ensureContrastRatio(T.rgba,N.rgba,E);if(k)return p.toColor(k>>24&255,k>>16&255,k>>8&255)},w.opaque=function(T){const N=(255|T.rgba)>>>0;return[l,u,c]=v.toChannels(N),{css:p.toCss(l,u,c),rgba:N}},w.opacity=_,w.multiplyOpacity=function(T,N){return d=255&T.rgba,_(T,d*N/255)},w.toColorRGB=function(T){return[T.rgba>>24&255,T.rgba>>16&255,T.rgba>>8&255]}})(f||(o.color=f={})),(function(w){let _,T;try{const N=document.createElement("canvas");N.width=1,N.height=1;const E=N.getContext("2d",{willReadFrequently:!0});E&&(_=E,_.globalCompositeOperation="copy",T=_.createLinearGradient(0,0,1,1))}catch{}w.toColor=function(N){if(N.match(/#[\da-f]{3,8}/i))switch(N.length){case 4:return l=parseInt(N.slice(1,2).repeat(2),16),u=parseInt(N.slice(2,3).repeat(2),16),c=parseInt(N.slice(3,4).repeat(2),16),p.toColor(l,u,c);case 5:return l=parseInt(N.slice(1,2).repeat(2),16),u=parseInt(N.slice(2,3).repeat(2),16),c=parseInt(N.slice(3,4).repeat(2),16),d=parseInt(N.slice(4,5).repeat(2),16),p.toColor(l,u,c,d);case 7:return{css:N,rgba:(parseInt(N.slice(1),16)<<8|255)>>>0};case 9:return{css:N,rgba:parseInt(N.slice(1),16)>>>0}}const E=N.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(E)return l=parseInt(E[1]),u=parseInt(E[2]),c=parseInt(E[3]),d=Math.round(255*(E[5]===void 0?1:parseFloat(E[5]))),p.toColor(l,u,c,d);if(!_||!T)throw new Error("css.toColor: Unsupported css format");if(_.fillStyle=T,_.fillStyle=N,typeof _.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(_.fillRect(0,0,1,1),[l,u,c,d]=_.getImageData(0,0,1,1).data,d!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:p.toRgba(l,u,c,d),css:N}}})(x||(o.css=x={})),(function(w){function _(T,N,E){const k=T/255,L=N/255,A=E/255;return .2126*(k<=.03928?k/12.92:Math.pow((k+.055)/1.055,2.4))+.7152*(L<=.03928?L/12.92:Math.pow((L+.055)/1.055,2.4))+.0722*(A<=.03928?A/12.92:Math.pow((A+.055)/1.055,2.4))}w.relativeLuminance=function(T){return _(T>>16&255,T>>8&255,255&T)},w.relativeLuminance2=_})(S||(o.rgb=S={})),(function(w){function _(N,E,k){const L=N>>24&255,A=N>>16&255,M=N>>8&255;let O=E>>24&255,$=E>>16&255,D=E>>8&255,B=b(S.relativeLuminance2(O,$,D),S.relativeLuminance2(L,A,M));for(;B<k&&(O>0||$>0||D>0);)O-=Math.max(0,Math.ceil(.1*O)),$-=Math.max(0,Math.ceil(.1*$)),D-=Math.max(0,Math.ceil(.1*D)),B=b(S.relativeLuminance2(O,$,D),S.relativeLuminance2(L,A,M));return(O<<24|$<<16|D<<8|255)>>>0}function T(N,E,k){const L=N>>24&255,A=N>>16&255,M=N>>8&255;let O=E>>24&255,$=E>>16&255,D=E>>8&255,B=b(S.relativeLuminance2(O,$,D),S.relativeLuminance2(L,A,M));for(;B<k&&(O<255||$<255||D<255);)O=Math.min(255,O+Math.ceil(.1*(255-O))),$=Math.min(255,$+Math.ceil(.1*(255-$))),D=Math.min(255,D+Math.ceil(.1*(255-D))),B=b(S.relativeLuminance2(O,$,D),S.relativeLuminance2(L,A,M));return(O<<24|$<<16|D<<8|255)>>>0}w.blend=function(N,E){if(d=(255&E)/255,d===1)return E;const k=E>>24&255,L=E>>16&255,A=E>>8&255,M=N>>24&255,O=N>>16&255,$=N>>8&255;return l=M+Math.round((k-M)*d),u=O+Math.round((L-O)*d),c=$+Math.round((A-$)*d),p.toRgba(l,u,c)},w.ensureContrastRatio=function(N,E,k){const L=S.relativeLuminance(N>>8),A=S.relativeLuminance(E>>8);if(b(L,A)<k){if(A<L){const $=_(N,E,k),D=b(L,S.relativeLuminance($>>8));if(D<k){const B=T(N,E,k);return D>b(L,S.relativeLuminance(B>>8))?$:B}return $}const M=T(N,E,k),O=b(L,S.relativeLuminance(M>>8));if(O<k){const $=_(N,E,k);return O>b(L,S.relativeLuminance($>>8))?M:$}return M}},w.reduceLuminance=_,w.increaseLuminance=T,w.toChannels=function(N){return[N>>24&255,N>>16&255,N>>8&255,255&N]}})(v||(o.rgba=v={})),o.toPaddedHex=m,o.contrastRatio=b},8969:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CoreTerminal=void 0;const u=l(844),c=l(2585),d=l(4348),p=l(7866),f=l(744),x=l(7302),S=l(6975),v=l(8460),m=l(1753),b=l(1480),w=l(7994),_=l(9282),T=l(5435),N=l(5981),E=l(2660);let k=!1;class L extends u.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new v.EventEmitter),this._onScroll.event((M=>{var O;(O=this._onScrollApi)==null||O.fire(M.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(M){for(const O in M)this.optionsService.options[O]=M[O]}constructor(M){super(),this._windowsWrappingHeuristics=this.register(new u.MutableDisposable),this._onBinary=this.register(new v.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new v.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new v.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new v.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new v.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new v.EventEmitter),this._instantiationService=new d.InstantiationService,this.optionsService=this.register(new x.OptionsService(M)),this._instantiationService.setService(c.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(f.BufferService)),this._instantiationService.setService(c.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(p.LogService)),this._instantiationService.setService(c.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(S.CoreService)),this._instantiationService.setService(c.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(m.CoreMouseService)),this._instantiationService.setService(c.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(b.UnicodeService)),this._instantiationService.setService(c.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(w.CharsetService),this._instantiationService.setService(c.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(E.OscLinkService),this._instantiationService.setService(c.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new T.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,v.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,v.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,v.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,v.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((O=>{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((O=>{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 N.WriteBuffer(((O,$)=>this._inputHandler.parse(O,$)))),this.register((0,v.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(M,O){this._writeBuffer.write(M,O)}writeSync(M,O){this._logService.logLevel<=c.LogLevelEnum.WARN&&!k&&(this._logService.warn("writeSync is unreliable and will be removed soon."),k=!0),this._writeBuffer.writeSync(M,O)}input(M,O=!0){this.coreService.triggerDataEvent(M,O)}resize(M,O){isNaN(M)||isNaN(O)||(M=Math.max(M,f.MINIMUM_COLS),O=Math.max(O,f.MINIMUM_ROWS),this._bufferService.resize(M,O))}scroll(M,O=!1){this._bufferService.scroll(M,O)}scrollLines(M,O,$){this._bufferService.scrollLines(M,O,$)}scrollPages(M){this.scrollLines(M*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(M){const O=M-this._bufferService.buffer.ydisp;O!==0&&this.scrollLines(O)}registerEscHandler(M,O){return this._inputHandler.registerEscHandler(M,O)}registerDcsHandler(M,O){return this._inputHandler.registerDcsHandler(M,O)}registerCsiHandler(M,O){return this._inputHandler.registerCsiHandler(M,O)}registerOscHandler(M,O){return this._inputHandler.registerOscHandler(M,O)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let M=!1;const O=this.optionsService.rawOptions.windowsPty;O&&O.buildNumber!==void 0&&O.buildNumber!==void 0?M=O.backend==="conpty"&&O.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(M=!0),M?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const M=[];M.push(this.onLineFeed(_.updateWindowsModeWrappedState.bind(null,this._bufferService))),M.push(this.registerCsiHandler({final:"H"},(()=>((0,_.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,u.toDisposable)((()=>{for(const O of M)O.dispose()}))}}}o.CoreTerminal=L},8460:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.runAndSubscribe=o.forwardEvent=o.EventEmitter=void 0,o.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=l=>(this._listeners.push(l),{dispose:()=>{if(!this._disposed){for(let u=0;u<this._listeners.length;u++)if(this._listeners[u]===l)return void this._listeners.splice(u,1)}}})),this._event}fire(l,u){const c=[];for(let d=0;d<this._listeners.length;d++)c.push(this._listeners[d]);for(let d=0;d<c.length;d++)c[d].call(void 0,l,u)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},o.forwardEvent=function(l,u){return l((c=>u.fire(c)))},o.runAndSubscribe=function(l,u){return u(void 0),l((c=>u(c)))}},5435:function(s,o,l){var u=this&&this.__decorate||function(U,F,P,H){var W,V=arguments.length,re=V<3?F:H===null?H=Object.getOwnPropertyDescriptor(F,P):H;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")re=Reflect.decorate(U,F,P,H);else for(var J=U.length-1;J>=0;J--)(W=U[J])&&(re=(V<3?W(re):V>3?W(F,P,re):W(F,P))||re);return V>3&&re&&Object.defineProperty(F,P,re),re},c=this&&this.__param||function(U,F){return function(P,H){F(P,H,U)}};Object.defineProperty(o,"__esModule",{value:!0}),o.InputHandler=o.WindowsOptionsReportType=void 0;const d=l(2584),p=l(7116),f=l(2015),x=l(844),S=l(482),v=l(8437),m=l(8460),b=l(643),w=l(511),_=l(3734),T=l(2585),N=l(1480),E=l(6242),k=l(6351),L=l(5941),A={"(":0,")":1,"*":2,"+":3,"-":1,".":2},M=131072;function O(U,F){if(U>24)return F.setWinLines||!1;switch(U){case 1:return!!F.restoreWin;case 2:return!!F.minimizeWin;case 3:return!!F.setWinPosition;case 4:return!!F.setWinSizePixels;case 5:return!!F.raiseWin;case 6:return!!F.lowerWin;case 7:return!!F.refreshWin;case 8:return!!F.setWinSizeChars;case 9:return!!F.maximizeWin;case 10:return!!F.fullscreenWin;case 11:return!!F.getWinState;case 13:return!!F.getWinPosition;case 14:return!!F.getWinSizePixels;case 15:return!!F.getScreenSizePixels;case 16:return!!F.getCellSizePixels;case 18:return!!F.getWinSizeChars;case 19:return!!F.getScreenSizeChars;case 20:return!!F.getIconTitle;case 21:return!!F.getWinTitle;case 22:return!!F.pushTitle;case 23:return!!F.popTitle;case 24:return!!F.setWinLines}return!1}var $;(function(U){U[U.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",U[U.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})($||(o.WindowsOptionsReportType=$={}));let D=0;class B extends x.Disposable{getAttrData(){return this._curAttrData}constructor(F,P,H,W,V,re,J,ne,X=new f.EscapeSequenceParser){super(),this._bufferService=F,this._charsetService=P,this._coreService=H,this._logService=W,this._optionsService=V,this._oscLinkService=re,this._coreMouseService=J,this._unicodeService=ne,this._parser=X,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new S.StringToUtf32,this._utf8Decoder=new S.Utf8ToUtf32,this._workCell=new w.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=v.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=v.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new m.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new m.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new m.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new m.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new m.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new m.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new m.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new m.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new m.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new m.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new m.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new m.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new m.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new j(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((q=>this._activeBuffer=q.activeBuffer))),this._parser.setCsiHandlerFallback(((q,Y)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(q),params:Y.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,Y,Q)=>{this._logService.debug("Unknown OSC code: ",{identifier:q,action:Y,data:Q})})),this._parser.setDcsHandlerFallback(((q,Y,Q)=>{Y==="HOOK"&&(Q=Q.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(q),action:Y,payload:Q})})),this._parser.setPrintHandler(((q,Y,Q)=>this.print(q,Y,Q))),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(d.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(d.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(d.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(d.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(d.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(d.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(d.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(d.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(d.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(d.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(d.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(d.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new E.OscHandler((q=>(this.setTitle(q),this.setIconName(q),!0)))),this._parser.registerOscHandler(1,new E.OscHandler((q=>this.setIconName(q)))),this._parser.registerOscHandler(2,new E.OscHandler((q=>this.setTitle(q)))),this._parser.registerOscHandler(4,new E.OscHandler((q=>this.setOrReportIndexedColor(q)))),this._parser.registerOscHandler(8,new E.OscHandler((q=>this.setHyperlink(q)))),this._parser.registerOscHandler(10,new E.OscHandler((q=>this.setOrReportFgColor(q)))),this._parser.registerOscHandler(11,new E.OscHandler((q=>this.setOrReportBgColor(q)))),this._parser.registerOscHandler(12,new E.OscHandler((q=>this.setOrReportCursorColor(q)))),this._parser.registerOscHandler(104,new E.OscHandler((q=>this.restoreIndexedColor(q)))),this._parser.registerOscHandler(110,new E.OscHandler((q=>this.restoreFgColor(q)))),this._parser.registerOscHandler(111,new E.OscHandler((q=>this.restoreBgColor(q)))),this._parser.registerOscHandler(112,new E.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 p.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,Y)=>this.requestStatusString(q,Y))))}_preserveStack(F,P,H,W){this._parseStack.paused=!0,this._parseStack.cursorStartX=F,this._parseStack.cursorStartY=P,this._parseStack.decodedLength=H,this._parseStack.position=W}_logSlowResolvingAsync(F){this._logService.logLevel<=T.LogLevelEnum.WARN&&Promise.race([F,new Promise(((P,H)=>setTimeout((()=>H("#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(F,P){let H,W=this._activeBuffer.x,V=this._activeBuffer.y,re=0;const J=this._parseStack.paused;if(J){if(H=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,P))return this._logSlowResolvingAsync(H),H;W=this._parseStack.cursorStartX,V=this._parseStack.cursorStartY,this._parseStack.paused=!1,F.length>M&&(re=this._parseStack.position+M)}if(this._logService.logLevel<=T.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof F=="string"?` "${F}"`:` "${Array.prototype.map.call(F,(q=>String.fromCharCode(q))).join("")}"`),typeof F=="string"?F.split("").map((q=>q.charCodeAt(0))):F),this._parseBuffer.length<F.length&&this._parseBuffer.length<M&&(this._parseBuffer=new Uint32Array(Math.min(F.length,M))),J||this._dirtyRowTracker.clearRange(),F.length>M)for(let q=re;q<F.length;q+=M){const Y=q+M<F.length?q+M:F.length,Q=typeof F=="string"?this._stringDecoder.decode(F.substring(q,Y),this._parseBuffer):this._utf8Decoder.decode(F.subarray(q,Y),this._parseBuffer);if(H=this._parser.parse(this._parseBuffer,Q))return this._preserveStack(W,V,Q,q),this._logSlowResolvingAsync(H),H}else if(!J){const q=typeof F=="string"?this._stringDecoder.decode(F,this._parseBuffer):this._utf8Decoder.decode(F,this._parseBuffer);if(H=this._parser.parse(this._parseBuffer,q))return this._preserveStack(W,V,q,0),this._logSlowResolvingAsync(H),H}this._activeBuffer.x===W&&this._activeBuffer.y===V||this._onCursorMove.fire();const ne=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),X=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);X<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(X,this._bufferService.rows-1),Math.min(ne,this._bufferService.rows-1))}print(F,P,H){let W,V;const re=this._charsetService.charset,J=this._optionsService.rawOptions.screenReaderMode,ne=this._bufferService.cols,X=this._coreService.decPrivateModes.wraparound,q=this._coreService.modes.insertMode,Y=this._curAttrData;let Q=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&H-P>0&&Q.getWidth(this._activeBuffer.x-1)===2&&Q.setCellFromCodepoint(this._activeBuffer.x-1,0,1,Y);let te=this._parser.precedingJoinState;for(let ie=P;ie<H;++ie){if(W=F[ie],W<127&&re){const je=re[String.fromCharCode(W)];je&&(W=je.charCodeAt(0))}const le=this._unicodeService.charProperties(W,te);V=N.UnicodeService.extractWidth(le);const pe=N.UnicodeService.extractShouldJoin(le),Le=pe?N.UnicodeService.extractWidth(te):0;if(te=le,J&&this._onA11yChar.fire((0,S.stringFromCodePoint)(W)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+V-Le>ne){if(X){const je=Q;let Se=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),Q=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),Le>0&&Q instanceof v.BufferLine&&Q.copyCellsFrom(je,Se,0,Le,!1);Se<ne;)je.setCellFromCodepoint(Se++,0,1,Y)}else if(this._activeBuffer.x=ne-1,V===2)continue}if(pe&&this._activeBuffer.x){const je=Q.getWidth(this._activeBuffer.x-1)?1:2;Q.addCodepointToCell(this._activeBuffer.x-je,W,V);for(let Se=V-Le;--Se>=0;)Q.setCellFromCodepoint(this._activeBuffer.x++,0,0,Y)}else if(q&&(Q.insertCells(this._activeBuffer.x,V-Le,this._activeBuffer.getNullCell(Y)),Q.getWidth(ne-1)===2&&Q.setCellFromCodepoint(ne-1,b.NULL_CELL_CODE,b.NULL_CELL_WIDTH,Y)),Q.setCellFromCodepoint(this._activeBuffer.x++,W,V,Y),V>0)for(;--V;)Q.setCellFromCodepoint(this._activeBuffer.x++,0,0,Y)}this._parser.precedingJoinState=te,this._activeBuffer.x<ne&&H-P>0&&Q.getWidth(this._activeBuffer.x)===0&&!Q.hasContent(this._activeBuffer.x)&&Q.setCellFromCodepoint(this._activeBuffer.x,0,1,Y),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(F,P){return F.final!=="t"||F.prefix||F.intermediates?this._parser.registerCsiHandler(F,P):this._parser.registerCsiHandler(F,(H=>!O(H.params[0],this._optionsService.rawOptions.windowOptions)||P(H)))}registerDcsHandler(F,P){return this._parser.registerDcsHandler(F,new k.DcsHandler(P))}registerEscHandler(F,P){return this._parser.registerEscHandler(F,P)}registerOscHandler(F,P){return this._parser.registerOscHandler(F,new E.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 F;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&&((F=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&F.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 F=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-F),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(F=this._bufferService.cols-1){this._activeBuffer.x=Math.min(F,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(F,P){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=F,this._activeBuffer.y=this._activeBuffer.scrollTop+P):(this._activeBuffer.x=F,this._activeBuffer.y=P),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(F,P){this._restrictCursor(),this._setCursor(this._activeBuffer.x+F,this._activeBuffer.y+P)}cursorUp(F){const P=this._activeBuffer.y-this._activeBuffer.scrollTop;return P>=0?this._moveCursor(0,-Math.min(P,F.params[0]||1)):this._moveCursor(0,-(F.params[0]||1)),!0}cursorDown(F){const P=this._activeBuffer.scrollBottom-this._activeBuffer.y;return P>=0?this._moveCursor(0,Math.min(P,F.params[0]||1)):this._moveCursor(0,F.params[0]||1),!0}cursorForward(F){return this._moveCursor(F.params[0]||1,0),!0}cursorBackward(F){return this._moveCursor(-(F.params[0]||1),0),!0}cursorNextLine(F){return this.cursorDown(F),this._activeBuffer.x=0,!0}cursorPrecedingLine(F){return this.cursorUp(F),this._activeBuffer.x=0,!0}cursorCharAbsolute(F){return this._setCursor((F.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(F){return this._setCursor(F.length>=2?(F.params[1]||1)-1:0,(F.params[0]||1)-1),!0}charPosAbsolute(F){return this._setCursor((F.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(F){return this._moveCursor(F.params[0]||1,0),!0}linePosAbsolute(F){return this._setCursor(this._activeBuffer.x,(F.params[0]||1)-1),!0}vPositionRelative(F){return this._moveCursor(0,F.params[0]||1),!0}hVPosition(F){return this.cursorPosition(F),!0}tabClear(F){const P=F.params[0];return P===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:P===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(F){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let P=F.params[0]||1;for(;P--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(F){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let P=F.params[0]||1;for(;P--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(F){const P=F.params[0];return P===1&&(this._curAttrData.bg|=536870912),P!==2&&P!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(F,P,H,W=!1,V=!1){const re=this._activeBuffer.lines.get(this._activeBuffer.ybase+F);re.replaceCells(P,H,this._activeBuffer.getNullCell(this._eraseAttrData()),V),W&&(re.isWrapped=!1)}_resetBufferLine(F,P=!1){const H=this._activeBuffer.lines.get(this._activeBuffer.ybase+F);H&&(H.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),P),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+F),H.isWrapped=!1)}eraseInDisplay(F,P=!1){let H;switch(this._restrictCursor(this._bufferService.cols),F.params[0]){case 0:for(H=this._activeBuffer.y,this._dirtyRowTracker.markDirty(H),this._eraseInBufferLine(H++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,P);H<this._bufferService.rows;H++)this._resetBufferLine(H,P);this._dirtyRowTracker.markDirty(H);break;case 1:for(H=this._activeBuffer.y,this._dirtyRowTracker.markDirty(H),this._eraseInBufferLine(H,0,this._activeBuffer.x+1,!0,P),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(H+1).isWrapped=!1);H--;)this._resetBufferLine(H,P);this._dirtyRowTracker.markDirty(0);break;case 2:for(H=this._bufferService.rows,this._dirtyRowTracker.markDirty(H-1);H--;)this._resetBufferLine(H,P);this._dirtyRowTracker.markDirty(0);break;case 3:const W=this._activeBuffer.lines.length-this._bufferService.rows;W>0&&(this._activeBuffer.lines.trimStart(W),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-W,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-W,0),this._onScroll.fire(0))}return!0}eraseInLine(F,P=!1){switch(this._restrictCursor(this._bufferService.cols),F.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(F){this._restrictCursor();let P=F.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const H=this._activeBuffer.ybase+this._activeBuffer.y,W=this._bufferService.rows-1-this._activeBuffer.scrollBottom,V=this._bufferService.rows-1+this._activeBuffer.ybase-W+1;for(;P--;)this._activeBuffer.lines.splice(V-1,1),this._activeBuffer.lines.splice(H,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(F){this._restrictCursor();let P=F.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const H=this._activeBuffer.ybase+this._activeBuffer.y;let W;for(W=this._bufferService.rows-1-this._activeBuffer.scrollBottom,W=this._bufferService.rows-1+this._activeBuffer.ybase-W;P--;)this._activeBuffer.lines.splice(H,1),this._activeBuffer.lines.splice(W,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(F){this._restrictCursor();const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return P&&(P.insertCells(this._activeBuffer.x,F.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(F){this._restrictCursor();const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return P&&(P.deleteCells(this._activeBuffer.x,F.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(F){let P=F.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(F){let P=F.params[0]||1;for(;P--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(v.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(F){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=F.params[0]||1;for(let H=this._activeBuffer.scrollTop;H<=this._activeBuffer.scrollBottom;++H){const W=this._activeBuffer.lines.get(this._activeBuffer.ybase+H);W.deleteCells(0,P,this._activeBuffer.getNullCell(this._eraseAttrData())),W.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(F){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=F.params[0]||1;for(let H=this._activeBuffer.scrollTop;H<=this._activeBuffer.scrollBottom;++H){const W=this._activeBuffer.lines.get(this._activeBuffer.ybase+H);W.insertCells(0,P,this._activeBuffer.getNullCell(this._eraseAttrData())),W.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(F){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=F.params[0]||1;for(let H=this._activeBuffer.scrollTop;H<=this._activeBuffer.scrollBottom;++H){const W=this._activeBuffer.lines.get(this._activeBuffer.ybase+H);W.insertCells(this._activeBuffer.x,P,this._activeBuffer.getNullCell(this._eraseAttrData())),W.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(F){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=F.params[0]||1;for(let H=this._activeBuffer.scrollTop;H<=this._activeBuffer.scrollBottom;++H){const W=this._activeBuffer.lines.get(this._activeBuffer.ybase+H);W.deleteCells(this._activeBuffer.x,P,this._activeBuffer.getNullCell(this._eraseAttrData())),W.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(F){this._restrictCursor();const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return P&&(P.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(F.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(F){const P=this._parser.precedingJoinState;if(!P)return!0;const H=F.params[0]||1,W=N.UnicodeService.extractWidth(P),V=this._activeBuffer.x-W,re=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(V),J=new Uint32Array(re.length*H);let ne=0;for(let q=0;q<re.length;){const Y=re.codePointAt(q)||0;J[ne++]=Y,q+=Y>65535?2:1}let X=ne;for(let q=1;q<H;++q)J.copyWithin(X,0,ne),X+=ne;return this.print(J,0,X),!0}sendDeviceAttributesPrimary(F){return F.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(d.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(d.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(F){return F.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(d.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(d.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(F.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(d.C0.ESC+"[>83;40003;0c")),!0}_is(F){return(this._optionsService.rawOptions.termName+"").indexOf(F)===0}setMode(F){for(let P=0;P<F.length;P++)switch(F.params[P]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(F){for(let P=0;P<F.length;P++)switch(F.params[P]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,p.DEFAULT_CHARSET),this._charsetService.setgCharset(1,p.DEFAULT_CHARSET),this._charsetService.setgCharset(2,p.DEFAULT_CHARSET),this._charsetService.setgCharset(3,p.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(F){for(let P=0;P<F.length;P++)switch(F.params[P]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(F){for(let P=0;P<F.length;P++)switch(F.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(),F.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(F,P){const H=this._coreService.decPrivateModes,{activeProtocol:W,activeEncoding:V}=this._coreMouseService,re=this._coreService,{buffers:J,cols:ne}=this._bufferService,{active:X,alt:q}=J,Y=this._optionsService.rawOptions,Q=pe=>pe?1:2,te=F.params[0];return ie=te,le=P?te===2?4:te===4?Q(re.modes.insertMode):te===12?3:te===20?Q(Y.convertEol):0:te===1?Q(H.applicationCursorKeys):te===3?Y.windowOptions.setWinLines?ne===80?2:ne===132?1:0:0:te===6?Q(H.origin):te===7?Q(H.wraparound):te===8?3:te===9?Q(W==="X10"):te===12?Q(Y.cursorBlink):te===25?Q(!re.isCursorHidden):te===45?Q(H.reverseWraparound):te===66?Q(H.applicationKeypad):te===67?4:te===1e3?Q(W==="VT200"):te===1002?Q(W==="DRAG"):te===1003?Q(W==="ANY"):te===1004?Q(H.sendFocus):te===1005?4:te===1006?Q(V==="SGR"):te===1015?4:te===1016?Q(V==="SGR_PIXELS"):te===1048?1:te===47||te===1047||te===1049?Q(X===q):te===2004?Q(H.bracketedPasteMode):0,re.triggerDataEvent(`${d.C0.ESC}[${P?"":"?"}${ie};${le}$y`),!0;var ie,le}_updateAttrColor(F,P,H,W,V){return P===2?(F|=50331648,F&=-16777216,F|=_.AttributeData.fromColorRGB([H,W,V])):P===5&&(F&=-50331904,F|=33554432|255&H),F}_extractColor(F,P,H){const W=[0,0,-1,0,0,0];let V=0,re=0;do{if(W[re+V]=F.params[P+re],F.hasSubParams(P+re)){const J=F.getSubParams(P+re);let ne=0;do W[1]===5&&(V=1),W[re+ne+1+V]=J[ne];while(++ne<J.length&&ne+re+1+V<W.length);break}if(W[1]===5&&re+V>=2||W[1]===2&&re+V>=5)break;W[1]&&(V=1)}while(++re+P<F.length&&re+V<W.length);for(let J=2;J<W.length;++J)W[J]===-1&&(W[J]=0);switch(W[0]){case 38:H.fg=this._updateAttrColor(H.fg,W[1],W[3],W[4],W[5]);break;case 48:H.bg=this._updateAttrColor(H.bg,W[1],W[3],W[4],W[5]);break;case 58:H.extended=H.extended.clone(),H.extended.underlineColor=this._updateAttrColor(H.extended.underlineColor,W[1],W[3],W[4],W[5])}return re}_processUnderline(F,P){P.extended=P.extended.clone(),(!~F||F>5)&&(F=1),P.extended.underlineStyle=F,P.fg|=268435456,F===0&&(P.fg&=-268435457),P.updateExtended()}_processSGR0(F){F.fg=v.DEFAULT_ATTR_DATA.fg,F.bg=v.DEFAULT_ATTR_DATA.bg,F.extended=F.extended.clone(),F.extended.underlineStyle=0,F.extended.underlineColor&=-67108864,F.updateExtended()}charAttributes(F){if(F.length===1&&F.params[0]===0)return this._processSGR0(this._curAttrData),!0;const P=F.length;let H;const W=this._curAttrData;for(let V=0;V<P;V++)H=F.params[V],H>=30&&H<=37?(W.fg&=-50331904,W.fg|=16777216|H-30):H>=40&&H<=47?(W.bg&=-50331904,W.bg|=16777216|H-40):H>=90&&H<=97?(W.fg&=-50331904,W.fg|=16777224|H-90):H>=100&&H<=107?(W.bg&=-50331904,W.bg|=16777224|H-100):H===0?this._processSGR0(W):H===1?W.fg|=134217728:H===3?W.bg|=67108864:H===4?(W.fg|=268435456,this._processUnderline(F.hasSubParams(V)?F.getSubParams(V)[0]:1,W)):H===5?W.fg|=536870912:H===7?W.fg|=67108864:H===8?W.fg|=1073741824:H===9?W.fg|=2147483648:H===2?W.bg|=134217728:H===21?this._processUnderline(2,W):H===22?(W.fg&=-134217729,W.bg&=-134217729):H===23?W.bg&=-67108865:H===24?(W.fg&=-268435457,this._processUnderline(0,W)):H===25?W.fg&=-536870913:H===27?W.fg&=-67108865:H===28?W.fg&=-1073741825:H===29?W.fg&=2147483647:H===39?(W.fg&=-67108864,W.fg|=16777215&v.DEFAULT_ATTR_DATA.fg):H===49?(W.bg&=-67108864,W.bg|=16777215&v.DEFAULT_ATTR_DATA.bg):H===38||H===48||H===58?V+=this._extractColor(F,V,W):H===53?W.bg|=1073741824:H===55?W.bg&=-1073741825:H===59?(W.extended=W.extended.clone(),W.extended.underlineColor=-1,W.updateExtended()):H===100?(W.fg&=-67108864,W.fg|=16777215&v.DEFAULT_ATTR_DATA.fg,W.bg&=-67108864,W.bg|=16777215&v.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",H);return!0}deviceStatus(F){switch(F.params[0]){case 5:this._coreService.triggerDataEvent(`${d.C0.ESC}[0n`);break;case 6:const P=this._activeBuffer.y+1,H=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${d.C0.ESC}[${P};${H}R`)}return!0}deviceStatusPrivate(F){if(F.params[0]===6){const P=this._activeBuffer.y+1,H=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${d.C0.ESC}[?${P};${H}R`)}return!0}softReset(F){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=v.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(F){const P=F.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 H=P%2==1;return this._optionsService.options.cursorBlink=H,!0}setScrollRegion(F){const P=F.params[0]||1;let H;return(F.length<2||(H=F.params[1])>this._bufferService.rows||H===0)&&(H=this._bufferService.rows),H>P&&(this._activeBuffer.scrollTop=P-1,this._activeBuffer.scrollBottom=H-1,this._setCursor(0,0)),!0}windowOptions(F){if(!O(F.params[0],this._optionsService.rawOptions.windowOptions))return!0;const P=F.length>1?F.params[1]:0;switch(F.params[0]){case 14:P!==2&&this._onRequestWindowsOptionsReport.fire($.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire($.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${d.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(F){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(F){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(F){return this._windowTitle=F,this._onTitleChange.fire(F),!0}setIconName(F){return this._iconName=F,!0}setOrReportIndexedColor(F){const P=[],H=F.split(";");for(;H.length>1;){const W=H.shift(),V=H.shift();if(/^\d+$/.exec(W)){const re=parseInt(W);if(I(re))if(V==="?")P.push({type:0,index:re});else{const J=(0,L.parseColor)(V);J&&P.push({type:1,index:re,color:J})}}}return P.length&&this._onColor.fire(P),!0}setHyperlink(F){const P=F.split(";");return!(P.length<2)&&(P[1]?this._createHyperlink(P[0],P[1]):!P[0]&&this._finishHyperlink())}_createHyperlink(F,P){this._getCurrentLinkId()&&this._finishHyperlink();const H=F.split(":");let W;const V=H.findIndex((re=>re.startsWith("id=")));return V!==-1&&(W=H[V].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:W,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(F,P){const H=F.split(";");for(let W=0;W<H.length&&!(P>=this._specialColors.length);++W,++P)if(H[W]==="?")this._onColor.fire([{type:0,index:this._specialColors[P]}]);else{const V=(0,L.parseColor)(H[W]);V&&this._onColor.fire([{type:1,index:this._specialColors[P],color:V}])}return!0}setOrReportFgColor(F){return this._setOrReportSpecialColor(F,0)}setOrReportBgColor(F){return this._setOrReportSpecialColor(F,1)}setOrReportCursorColor(F){return this._setOrReportSpecialColor(F,2)}restoreIndexedColor(F){if(!F)return this._onColor.fire([{type:2}]),!0;const P=[],H=F.split(";");for(let W=0;W<H.length;++W)if(/^\d+$/.exec(H[W])){const V=parseInt(H[W]);I(V)&&P.push({type:2,index:V})}return P.length&&this._onColor.fire(P),!0}restoreFgColor(F){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(F){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(F){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,p.DEFAULT_CHARSET),!0}selectCharset(F){return F.length!==2?(this.selectDefaultCharset(),!0):(F[0]==="/"||this._charsetService.setgCharset(A[F[0]],p.CHARSETS[F[1]]||p.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 F=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,F,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=v.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=v.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(F){return this._charsetService.setgLevel(F),!0}screenAlignmentPattern(){const F=new w.CellData;F.content=4194373,F.fg=this._curAttrData.fg,F.bg=this._curAttrData.bg,this._setCursor(0,0);for(let P=0;P<this._bufferService.rows;++P){const H=this._activeBuffer.ybase+this._activeBuffer.y+P,W=this._activeBuffer.lines.get(H);W&&(W.fill(F),W.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(F,P){const H=this._bufferService.buffer,W=this._optionsService.rawOptions;return(V=>(this._coreService.triggerDataEvent(`${d.C0.ESC}${V}${d.C0.ESC}\\`),!0))(F==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:F==='"p'?'P1$r61;1"p':F==="r"?`P1$r${H.scrollTop+1};${H.scrollBottom+1}r`:F==="m"?"P1$r0m":F===" q"?`P1$r${{block:2,underline:4,bar:6}[W.cursorStyle]-(W.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(F,P){this._dirtyRowTracker.markRangeDirty(F,P)}}o.InputHandler=B;let j=class{constructor(U){this._bufferService=U,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(U){U<this.start?this.start=U:U>this.end&&(this.end=U)}markRangeDirty(U,F){U>F&&(D=U,U=F,F=D),U<this.start&&(this.start=U),F>this.end&&(this.end=F)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function I(U){return 0<=U&&U<256}j=u([c(0,T.IBufferService)],j)},844:(s,o)=>{function l(u){for(const c of u)c.dispose();u.length=0}Object.defineProperty(o,"__esModule",{value:!0}),o.getDisposeArrayDisposable=o.disposeArray=o.toDisposable=o.MutableDisposable=o.Disposable=void 0,o.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const u of this._disposables)u.dispose();this._disposables.length=0}register(u){return this._disposables.push(u),u}unregister(u){const c=this._disposables.indexOf(u);c!==-1&&this._disposables.splice(c,1)}},o.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(u){var c;this._isDisposed||u===this._value||((c=this._value)==null||c.dispose(),this._value=u)}clear(){this.value=void 0}dispose(){var u;this._isDisposed=!0,(u=this._value)==null||u.dispose(),this._value=void 0}},o.toDisposable=function(u){return{dispose:u}},o.disposeArray=l,o.getDisposeArrayDisposable=function(u){return{dispose:()=>l(u)}}},1505:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.FourKeyMap=o.TwoKeyMap=void 0;class l{constructor(){this._data={}}set(c,d,p){this._data[c]||(this._data[c]={}),this._data[c][d]=p}get(c,d){return this._data[c]?this._data[c][d]:void 0}clear(){this._data={}}}o.TwoKeyMap=l,o.FourKeyMap=class{constructor(){this._data=new l}set(u,c,d,p,f){this._data.get(u,c)||this._data.set(u,c,new l),this._data.get(u,c).set(d,p,f)}get(u,c,d,p){var f;return(f=this._data.get(u,c))==null?void 0:f.get(d,p)}clear(){this._data.clear()}}},6114:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.isChromeOS=o.isLinux=o.isWindows=o.isIphone=o.isIpad=o.isMac=o.getSafariVersion=o.isSafari=o.isLegacyEdge=o.isFirefox=o.isNode=void 0,o.isNode=typeof process<"u"&&"title"in process;const l=o.isNode?"node":navigator.userAgent,u=o.isNode?"node":navigator.platform;o.isFirefox=l.includes("Firefox"),o.isLegacyEdge=l.includes("Edge"),o.isSafari=/^((?!chrome|android).)*safari/i.test(l),o.getSafariVersion=function(){if(!o.isSafari)return 0;const c=l.match(/Version\/(\d+)/);return c===null||c.length<2?0:parseInt(c[1])},o.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(u),o.isIpad=u==="iPad",o.isIphone=u==="iPhone",o.isWindows=["Windows","Win16","Win32","WinCE"].includes(u),o.isLinux=u.indexOf("Linux")>=0,o.isChromeOS=/\bCrOS\b/.test(l)},6106:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.SortedList=void 0;let l=0;o.SortedList=class{constructor(u){this._getKey=u,this._array=[]}clear(){this._array.length=0}insert(u){this._array.length!==0?(l=this._search(this._getKey(u)),this._array.splice(l,0,u)):this._array.push(u)}delete(u){if(this._array.length===0)return!1;const c=this._getKey(u);if(c===void 0||(l=this._search(c),l===-1)||this._getKey(this._array[l])!==c)return!1;do if(this._array[l]===u)return this._array.splice(l,1),!0;while(++l<this._array.length&&this._getKey(this._array[l])===c);return!1}*getKeyIterator(u){if(this._array.length!==0&&(l=this._search(u),!(l<0||l>=this._array.length)&&this._getKey(this._array[l])===u))do yield this._array[l];while(++l<this._array.length&&this._getKey(this._array[l])===u)}forEachByKey(u,c){if(this._array.length!==0&&(l=this._search(u),!(l<0||l>=this._array.length)&&this._getKey(this._array[l])===u))do c(this._array[l]);while(++l<this._array.length&&this._getKey(this._array[l])===u)}values(){return[...this._array].values()}_search(u){let c=0,d=this._array.length-1;for(;d>=c;){let p=c+d>>1;const f=this._getKey(this._array[p]);if(f>u)d=p-1;else{if(!(f<u)){for(;p>0&&this._getKey(this._array[p-1])===u;)p--;return p}c=p+1}}return c}}},7226:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DebouncedIdleTask=o.IdleTaskQueue=o.PriorityTaskQueue=void 0;const u=l(6114);class c{constructor(){this._tasks=[],this._i=0}enqueue(f){this._tasks.push(f),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(f){this._idleCallback=void 0;let x=0,S=0,v=f.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),S=Math.max(x,S),m=f.timeRemaining(),1.5*S>m)return v-x<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(v-x))}ms`),void this._start();v=m}this.clear()}}class d extends c{_requestCallback(f){return setTimeout((()=>f(this._createDeadline(16))))}_cancelCallback(f){clearTimeout(f)}_createDeadline(f){const x=Date.now()+f;return{timeRemaining:()=>Math.max(0,x-Date.now())}}}o.PriorityTaskQueue=d,o.IdleTaskQueue=!u.isNode&&"requestIdleCallback"in window?class extends c{_requestCallback(p){return requestIdleCallback(p)}_cancelCallback(p){cancelIdleCallback(p)}}:d,o.DebouncedIdleTask=class{constructor(){this._queue=new o.IdleTaskQueue}set(p){this._queue.clear(),this._queue.enqueue(p)}flush(){this._queue.flush()}}},9282:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.updateWindowsModeWrappedState=void 0;const u=l(643);o.updateWindowsModeWrappedState=function(c){const d=c.buffer.lines.get(c.buffer.ybase+c.buffer.y-1),p=d==null?void 0:d.get(c.cols-1),f=c.buffer.lines.get(c.buffer.ybase+c.buffer.y);f&&p&&(f.isWrapped=p[u.CHAR_DATA_CODE_INDEX]!==u.NULL_CELL_CODE&&p[u.CHAR_DATA_CODE_INDEX]!==u.WHITESPACE_CELL_CODE)}},3734:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ExtendedAttrs=o.AttributeData=void 0;class l{constructor(){this.fg=0,this.bg=0,this.extended=new u}static toColorRGB(d){return[d>>>16&255,d>>>8&255,255&d]}static fromColorRGB(d){return(255&d[0])<<16|(255&d[1])<<8|255&d[2]}clone(){const d=new l;return d.fg=this.fg,d.bg=this.bg,d.extended=this.extended.clone(),d}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}}o.AttributeData=l;class u{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(d){this._ext=d}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(d){this._ext&=-469762049,this._ext|=d<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(d){this._ext&=-67108864,this._ext|=67108863&d}get urlId(){return this._urlId}set urlId(d){this._urlId=d}get underlineVariantOffset(){const d=(3758096384&this._ext)>>29;return d<0?4294967288^d:d}set underlineVariantOffset(d){this._ext&=536870911,this._ext|=d<<29&3758096384}constructor(d=0,p=0){this._ext=0,this._urlId=0,this._ext=d,this._urlId=p}clone(){return new u(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}o.ExtendedAttrs=u},9092:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Buffer=o.MAX_BUFFER_SIZE=void 0;const u=l(6349),c=l(7226),d=l(3734),p=l(8437),f=l(4634),x=l(511),S=l(643),v=l(4863),m=l(7116);o.MAX_BUFFER_SIZE=4294967295,o.Buffer=class{constructor(b,w,_){this._hasScrollback=b,this._optionsService=w,this._bufferService=_,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=p.DEFAULT_ATTR_DATA.clone(),this.savedCharset=m.DEFAULT_CHARSET,this.markers=[],this._nullCell=x.CellData.fromCharData([0,S.NULL_CELL_CHAR,S.NULL_CELL_WIDTH,S.NULL_CELL_CODE]),this._whitespaceCell=x.CellData.fromCharData([0,S.WHITESPACE_CELL_CHAR,S.WHITESPACE_CELL_WIDTH,S.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new c.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new u.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(b){return b?(this._nullCell.fg=b.fg,this._nullCell.bg=b.bg,this._nullCell.extended=b.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new d.ExtendedAttrs),this._nullCell}getWhitespaceCell(b){return b?(this._whitespaceCell.fg=b.fg,this._whitespaceCell.bg=b.bg,this._whitespaceCell.extended=b.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new d.ExtendedAttrs),this._whitespaceCell}getBlankLine(b,w){return new p.BufferLine(this._bufferService.cols,this.getNullCell(b),w)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const b=this.ybase+this.y-this.ydisp;return b>=0&&b<this._rows}_getCorrectBufferLength(b){if(!this._hasScrollback)return b;const w=b+this._optionsService.rawOptions.scrollback;return w>o.MAX_BUFFER_SIZE?o.MAX_BUFFER_SIZE:w}fillViewportRows(b){if(this.lines.length===0){b===void 0&&(b=p.DEFAULT_ATTR_DATA);let w=this._rows;for(;w--;)this.lines.push(this.getBlankLine(b))}}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(b,w){const _=this.getNullCell(p.DEFAULT_ATTR_DATA);let T=0;const N=this._getCorrectBufferLength(w);if(N>this.lines.maxLength&&(this.lines.maxLength=N),this.lines.length>0){if(this._cols<b)for(let k=0;k<this.lines.length;k++)T+=+this.lines.get(k).resize(b,_);let E=0;if(this._rows<w)for(let k=this._rows;k<w;k++)this.lines.length<w+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new p.BufferLine(b,_)):this.ybase>0&&this.lines.length<=this.ybase+this.y+E+1?(this.ybase--,E++,this.ydisp>0&&this.ydisp--):this.lines.push(new p.BufferLine(b,_)));else for(let k=this._rows;k>w;k--)this.lines.length>w+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(N<this.lines.maxLength){const k=this.lines.length-N;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=N}this.x=Math.min(this.x,b-1),this.y=Math.min(this.y,w-1),E&&(this.y+=E),this.savedX=Math.min(this.savedX,b-1),this.scrollTop=0}if(this.scrollBottom=w-1,this._isReflowEnabled&&(this._reflow(b,w),this._cols>b))for(let E=0;E<this.lines.length;E++)T+=+this.lines.get(E).resize(b,_);this._cols=b,this._rows=w,this._memoryCleanupQueue.clear(),T>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let b=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,b=!1);let w=0;for(;this._memoryCleanupPosition<this.lines.length;)if(w+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),w>100)return!0;return b}get _isReflowEnabled(){const b=this._optionsService.rawOptions.windowsPty;return b&&b.buildNumber?this._hasScrollback&&b.backend==="conpty"&&b.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(b,w){this._cols!==b&&(b>this._cols?this._reflowLarger(b,w):this._reflowSmaller(b,w))}_reflowLarger(b,w){const _=(0,f.reflowLargerGetLinesToRemove)(this.lines,this._cols,b,this.ybase+this.y,this.getNullCell(p.DEFAULT_ATTR_DATA));if(_.length>0){const T=(0,f.reflowLargerCreateNewLayout)(this.lines,_);(0,f.reflowLargerApplyNewLayout)(this.lines,T.layout),this._reflowLargerAdjustViewport(b,w,T.countRemoved)}}_reflowLargerAdjustViewport(b,w,_){const T=this.getNullCell(p.DEFAULT_ATTR_DATA);let N=_;for(;N-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<w&&this.lines.push(new p.BufferLine(b,T))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-_,0)}_reflowSmaller(b,w){const _=this.getNullCell(p.DEFAULT_ATTR_DATA),T=[];let N=0;for(let E=this.lines.length-1;E>=0;E--){let k=this.lines.get(E);if(!k||!k.isWrapped&&k.getTrimmedLength()<=b)continue;const L=[k];for(;k.isWrapped&&E>0;)k=this.lines.get(--E),L.unshift(k);const A=this.ybase+this.y;if(A>=E&&A<E+L.length)continue;const M=L[L.length-1].getTrimmedLength(),O=(0,f.reflowSmallerGetNewLineLengths)(L,this._cols,b),$=O.length-L.length;let D;D=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+$):Math.max(0,this.lines.length-this.lines.maxLength+$);const B=[];for(let H=0;H<$;H++){const W=this.getBlankLine(p.DEFAULT_ATTR_DATA,!0);B.push(W)}B.length>0&&(T.push({start:E+L.length+N,newLines:B}),N+=B.length),L.push(...B);let j=O.length-1,I=O[j];I===0&&(j--,I=O[j]);let U=L.length-$-1,F=M;for(;U>=0;){const H=Math.min(F,I);if(L[j]===void 0)break;if(L[j].copyCellsFrom(L[U],F-H,I-H,H,!0),I-=H,I===0&&(j--,I=O[j]),F-=H,F===0){U--;const W=Math.max(U,0);F=(0,f.getWrappedLineTrimmedLength)(L,W,this._cols)}}for(let H=0;H<L.length;H++)O[H]<b&&L[H].setCell(O[H],_);let P=$-D;for(;P-- >0;)this.ybase===0?this.y<w-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+N)-w&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+$,this.ybase+w-1)}if(T.length>0){const E=[],k=[];for(let j=0;j<this.lines.length;j++)k.push(this.lines.get(j));const L=this.lines.length;let A=L-1,M=0,O=T[M];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+N);let $=0;for(let j=Math.min(this.lines.maxLength-1,L+N-1);j>=0;j--)if(O&&O.start>A+$){for(let I=O.newLines.length-1;I>=0;I--)this.lines.set(j--,O.newLines[I]);j++,E.push({index:A+1,amount:O.newLines.length}),$+=O.newLines.length,O=T[++M]}else this.lines.set(j,k[A--]);let D=0;for(let j=E.length-1;j>=0;j--)E[j].index+=D,this.lines.onInsertEmitter.fire(E[j]),D+=E[j].amount;const B=Math.max(0,L+N-this.lines.maxLength);B>0&&this.lines.onTrimEmitter.fire(B)}}translateBufferLineToString(b,w,_=0,T){const N=this.lines.get(b);return N?N.translateToString(w,_,T):""}getWrappedRangeForLine(b){let w=b,_=b;for(;w>0&&this.lines.get(w).isWrapped;)w--;for(;_+1<this.lines.length&&this.lines.get(_+1).isWrapped;)_++;return{first:w,last:_}}setupTabStops(b){for(b!=null?this.tabs[b]||(b=this.prevStop(b)):(this.tabs={},b=0);b<this._cols;b+=this._optionsService.rawOptions.tabStopWidth)this.tabs[b]=!0}prevStop(b){for(b==null&&(b=this.x);!this.tabs[--b]&&b>0;);return b>=this._cols?this._cols-1:b<0?0:b}nextStop(b){for(b==null&&(b=this.x);!this.tabs[++b]&&b<this._cols;);return b>=this._cols?this._cols-1:b<0?0:b}clearMarkers(b){this._isClearing=!0;for(let w=0;w<this.markers.length;w++)this.markers[w].line===b&&(this.markers[w].dispose(),this.markers.splice(w--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let b=0;b<this.markers.length;b++)this.markers[b].dispose(),this.markers.splice(b--,1);this._isClearing=!1}addMarker(b){const w=new v.Marker(b);return this.markers.push(w),w.register(this.lines.onTrim((_=>{w.line-=_,w.line<0&&w.dispose()}))),w.register(this.lines.onInsert((_=>{w.line>=_.index&&(w.line+=_.amount)}))),w.register(this.lines.onDelete((_=>{w.line>=_.index&&w.line<_.index+_.amount&&w.dispose(),w.line>_.index&&(w.line-=_.amount)}))),w.register(w.onDispose((()=>this._removeMarker(w)))),w}_removeMarker(b){this._isClearing||this.markers.splice(this.markers.indexOf(b),1)}}},8437:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferLine=o.DEFAULT_ATTR_DATA=void 0;const u=l(3734),c=l(511),d=l(643),p=l(482);o.DEFAULT_ATTR_DATA=Object.freeze(new u.AttributeData);let f=0;class x{constructor(v,m,b=!1){this.isWrapped=b,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*v);const w=m||c.CellData.fromCharData([0,d.NULL_CELL_CHAR,d.NULL_CELL_WIDTH,d.NULL_CELL_CODE]);for(let _=0;_<v;++_)this.setCell(_,w);this.length=v}get(v){const m=this._data[3*v+0],b=2097151&m;return[this._data[3*v+1],2097152&m?this._combined[v]:b?(0,p.stringFromCodePoint)(b):"",m>>22,2097152&m?this._combined[v].charCodeAt(this._combined[v].length-1):b]}set(v,m){this._data[3*v+1]=m[d.CHAR_DATA_ATTR_INDEX],m[d.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[v]=m[1],this._data[3*v+0]=2097152|v|m[d.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*v+0]=m[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|m[d.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(v){return this._data[3*v+0]>>22}hasWidth(v){return 12582912&this._data[3*v+0]}getFg(v){return this._data[3*v+1]}getBg(v){return this._data[3*v+2]}hasContent(v){return 4194303&this._data[3*v+0]}getCodePoint(v){const m=this._data[3*v+0];return 2097152&m?this._combined[v].charCodeAt(this._combined[v].length-1):2097151&m}isCombined(v){return 2097152&this._data[3*v+0]}getString(v){const m=this._data[3*v+0];return 2097152&m?this._combined[v]:2097151&m?(0,p.stringFromCodePoint)(2097151&m):""}isProtected(v){return 536870912&this._data[3*v+2]}loadCell(v,m){return f=3*v,m.content=this._data[f+0],m.fg=this._data[f+1],m.bg=this._data[f+2],2097152&m.content&&(m.combinedData=this._combined[v]),268435456&m.bg&&(m.extended=this._extendedAttrs[v]),m}setCell(v,m){2097152&m.content&&(this._combined[v]=m.combinedData),268435456&m.bg&&(this._extendedAttrs[v]=m.extended),this._data[3*v+0]=m.content,this._data[3*v+1]=m.fg,this._data[3*v+2]=m.bg}setCellFromCodepoint(v,m,b,w){268435456&w.bg&&(this._extendedAttrs[v]=w.extended),this._data[3*v+0]=m|b<<22,this._data[3*v+1]=w.fg,this._data[3*v+2]=w.bg}addCodepointToCell(v,m,b){let w=this._data[3*v+0];2097152&w?this._combined[v]+=(0,p.stringFromCodePoint)(m):2097151&w?(this._combined[v]=(0,p.stringFromCodePoint)(2097151&w)+(0,p.stringFromCodePoint)(m),w&=-2097152,w|=2097152):w=m|4194304,b&&(w&=-12582913,w|=b<<22),this._data[3*v+0]=w}insertCells(v,m,b){if((v%=this.length)&&this.getWidth(v-1)===2&&this.setCellFromCodepoint(v-1,0,1,b),m<this.length-v){const w=new c.CellData;for(let _=this.length-v-m-1;_>=0;--_)this.setCell(v+m+_,this.loadCell(v+_,w));for(let _=0;_<m;++_)this.setCell(v+_,b)}else for(let w=v;w<this.length;++w)this.setCell(w,b);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,b)}deleteCells(v,m,b){if(v%=this.length,m<this.length-v){const w=new c.CellData;for(let _=0;_<this.length-v-m;++_)this.setCell(v+_,this.loadCell(v+m+_,w));for(let _=this.length-m;_<this.length;++_)this.setCell(_,b)}else for(let w=v;w<this.length;++w)this.setCell(w,b);v&&this.getWidth(v-1)===2&&this.setCellFromCodepoint(v-1,0,1,b),this.getWidth(v)!==0||this.hasContent(v)||this.setCellFromCodepoint(v,0,1,b)}replaceCells(v,m,b,w=!1){if(w)for(v&&this.getWidth(v-1)===2&&!this.isProtected(v-1)&&this.setCellFromCodepoint(v-1,0,1,b),m<this.length&&this.getWidth(m-1)===2&&!this.isProtected(m)&&this.setCellFromCodepoint(m,0,1,b);v<m&&v<this.length;)this.isProtected(v)||this.setCell(v,b),v++;else for(v&&this.getWidth(v-1)===2&&this.setCellFromCodepoint(v-1,0,1,b),m<this.length&&this.getWidth(m-1)===2&&this.setCellFromCodepoint(m,0,1,b);v<m&&v<this.length;)this.setCell(v++,b)}resize(v,m){if(v===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const b=3*v;if(v>this.length){if(this._data.buffer.byteLength>=4*b)this._data=new Uint32Array(this._data.buffer,0,b);else{const w=new Uint32Array(b);w.set(this._data),this._data=w}for(let w=this.length;w<v;++w)this.setCell(w,m)}else{this._data=this._data.subarray(0,b);const w=Object.keys(this._combined);for(let T=0;T<w.length;T++){const N=parseInt(w[T],10);N>=v&&delete this._combined[N]}const _=Object.keys(this._extendedAttrs);for(let T=0;T<_.length;T++){const N=parseInt(_[T],10);N>=v&&delete this._extendedAttrs[N]}}return this.length=v,4*b*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const v=new Uint32Array(this._data.length);return v.set(this._data),this._data=v,1}return 0}fill(v,m=!1){if(m)for(let b=0;b<this.length;++b)this.isProtected(b)||this.setCell(b,v);else{this._combined={},this._extendedAttrs={};for(let b=0;b<this.length;++b)this.setCell(b,v)}}copyFrom(v){this.length!==v.length?this._data=new Uint32Array(v._data):this._data.set(v._data),this.length=v.length,this._combined={};for(const m in v._combined)this._combined[m]=v._combined[m];this._extendedAttrs={};for(const m in v._extendedAttrs)this._extendedAttrs[m]=v._extendedAttrs[m];this.isWrapped=v.isWrapped}clone(){const v=new x(0);v._data=new Uint32Array(this._data),v.length=this.length;for(const m in this._combined)v._combined[m]=this._combined[m];for(const m in this._extendedAttrs)v._extendedAttrs[m]=this._extendedAttrs[m];return v.isWrapped=this.isWrapped,v}getTrimmedLength(){for(let v=this.length-1;v>=0;--v)if(4194303&this._data[3*v+0])return v+(this._data[3*v+0]>>22);return 0}getNoBgTrimmedLength(){for(let v=this.length-1;v>=0;--v)if(4194303&this._data[3*v+0]||50331648&this._data[3*v+2])return v+(this._data[3*v+0]>>22);return 0}copyCellsFrom(v,m,b,w,_){const T=v._data;if(_)for(let E=w-1;E>=0;E--){for(let k=0;k<3;k++)this._data[3*(b+E)+k]=T[3*(m+E)+k];268435456&T[3*(m+E)+2]&&(this._extendedAttrs[b+E]=v._extendedAttrs[m+E])}else for(let E=0;E<w;E++){for(let k=0;k<3;k++)this._data[3*(b+E)+k]=T[3*(m+E)+k];268435456&T[3*(m+E)+2]&&(this._extendedAttrs[b+E]=v._extendedAttrs[m+E])}const N=Object.keys(v._combined);for(let E=0;E<N.length;E++){const k=parseInt(N[E],10);k>=m&&(this._combined[k-m+b]=v._combined[k])}}translateToString(v,m,b,w){m=m??0,b=b??this.length,v&&(b=Math.min(b,this.getTrimmedLength())),w&&(w.length=0);let _="";for(;m<b;){const T=this._data[3*m+0],N=2097151&T,E=2097152&T?this._combined[m]:N?(0,p.stringFromCodePoint)(N):d.WHITESPACE_CELL_CHAR;if(_+=E,w)for(let k=0;k<E.length;++k)w.push(m);m+=T>>22||1}return w&&w.push(m),_}}o.BufferLine=x},4841:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.getRangeLength=void 0,o.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:(s,o)=>{function l(u,c,d){if(c===u.length-1)return u[c].getTrimmedLength();const p=!u[c].hasContent(d-1)&&u[c].getWidth(d-1)===1,f=u[c+1].getWidth(0)===2;return p&&f?d-1:d}Object.defineProperty(o,"__esModule",{value:!0}),o.getWrappedLineTrimmedLength=o.reflowSmallerGetNewLineLengths=o.reflowLargerApplyNewLayout=o.reflowLargerCreateNewLayout=o.reflowLargerGetLinesToRemove=void 0,o.reflowLargerGetLinesToRemove=function(u,c,d,p,f){const x=[];for(let S=0;S<u.length-1;S++){let v=S,m=u.get(++v);if(!m.isWrapped)continue;const b=[u.get(S)];for(;v<u.length&&m.isWrapped;)b.push(m),m=u.get(++v);if(p>=S&&p<v){S+=b.length-1;continue}let w=0,_=l(b,w,c),T=1,N=0;for(;T<b.length;){const k=l(b,T,c),L=k-N,A=d-_,M=Math.min(L,A);b[w].copyCellsFrom(b[T],N,_,M,!1),_+=M,_===d&&(w++,_=0),N+=M,N===k&&(T++,N=0),_===0&&w!==0&&b[w-1].getWidth(d-1)===2&&(b[w].copyCellsFrom(b[w-1],d-1,_++,1,!1),b[w-1].setCell(d-1,f))}b[w].replaceCells(_,d,f);let E=0;for(let k=b.length-1;k>0&&(k>w||b[k].getTrimmedLength()===0);k--)E++;E>0&&(x.push(S+b.length-E),x.push(E)),S+=b.length-1}return x},o.reflowLargerCreateNewLayout=function(u,c){const d=[];let p=0,f=c[p],x=0;for(let S=0;S<u.length;S++)if(f===S){const v=c[++p];u.onDeleteEmitter.fire({index:S-x,amount:v}),S+=v-1,x+=v,f=c[++p]}else d.push(S);return{layout:d,countRemoved:x}},o.reflowLargerApplyNewLayout=function(u,c){const d=[];for(let p=0;p<c.length;p++)d.push(u.get(c[p]));for(let p=0;p<d.length;p++)u.set(p,d[p]);u.length=c.length},o.reflowSmallerGetNewLineLengths=function(u,c,d){const p=[],f=u.map(((m,b)=>l(u,b,c))).reduce(((m,b)=>m+b));let x=0,S=0,v=0;for(;v<f;){if(f-v<d){p.push(f-v);break}x+=d;const m=l(u,S,c);x>m&&(x-=m,S++);const b=u[S].getWidth(x-1)===2;b&&x--;const w=b?d-1:d;p.push(w),v+=w}return p},o.getWrappedLineTrimmedLength=l},5295:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferSet=void 0;const u=l(8460),c=l(844),d=l(9092);class p extends c.Disposable{constructor(x,S){super(),this._optionsService=x,this._bufferService=S,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 d.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new d.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,S){this._normal.resize(x,S),this._alt.resize(x,S),this.setupTabStops(x)}setupTabStops(x){this._normal.setupTabStops(x),this._alt.setupTabStops(x)}}o.BufferSet=p},511:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CellData=void 0;const u=l(482),c=l(643),d=l(3734);class p extends d.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new d.ExtendedAttrs,this.combinedData=""}static fromCharData(x){const S=new p;return S.setFromCharData(x),S}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,u.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(x){this.fg=x[c.CHAR_DATA_ATTR_INDEX],this.bg=0;let S=!1;if(x[c.CHAR_DATA_CHAR_INDEX].length>2)S=!0;else if(x[c.CHAR_DATA_CHAR_INDEX].length===2){const v=x[c.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=v&&v<=56319){const m=x[c.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=m&&m<=57343?this.content=1024*(v-55296)+m-56320+65536|x[c.CHAR_DATA_WIDTH_INDEX]<<22:S=!0}else S=!0}else this.content=x[c.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|x[c.CHAR_DATA_WIDTH_INDEX]<<22;S&&(this.combinedData=x[c.CHAR_DATA_CHAR_INDEX],this.content=2097152|x[c.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}o.CellData=p},643:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.WHITESPACE_CELL_CODE=o.WHITESPACE_CELL_WIDTH=o.WHITESPACE_CELL_CHAR=o.NULL_CELL_CODE=o.NULL_CELL_WIDTH=o.NULL_CELL_CHAR=o.CHAR_DATA_CODE_INDEX=o.CHAR_DATA_WIDTH_INDEX=o.CHAR_DATA_CHAR_INDEX=o.CHAR_DATA_ATTR_INDEX=o.DEFAULT_EXT=o.DEFAULT_ATTR=o.DEFAULT_COLOR=void 0,o.DEFAULT_COLOR=0,o.DEFAULT_ATTR=256|o.DEFAULT_COLOR<<9,o.DEFAULT_EXT=0,o.CHAR_DATA_ATTR_INDEX=0,o.CHAR_DATA_CHAR_INDEX=1,o.CHAR_DATA_WIDTH_INDEX=2,o.CHAR_DATA_CODE_INDEX=3,o.NULL_CELL_CHAR="",o.NULL_CELL_WIDTH=1,o.NULL_CELL_CODE=0,o.WHITESPACE_CELL_CHAR=" ",o.WHITESPACE_CELL_WIDTH=1,o.WHITESPACE_CELL_CODE=32},4863:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Marker=void 0;const u=l(8460),c=l(844);class d{get id(){return this._id}constructor(f){this.line=f,this.isDisposed=!1,this._disposables=[],this._id=d._nextId++,this._onDispose=this.register(new u.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,c.disposeArray)(this._disposables),this._disposables.length=0)}register(f){return this._disposables.push(f),f}}o.Marker=d,d._nextId=1},7116:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DEFAULT_CHARSET=o.CHARSETS=void 0,o.CHARSETS={},o.DEFAULT_CHARSET=o.CHARSETS.B,o.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:"≥","{":"π","|":"≠","}":"£","~":"·"},o.CHARSETS.A={"#":"£"},o.CHARSETS.B=void 0,o.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},o.CHARSETS.C=o.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},o.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},o.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},o.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},o.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},o.CHARSETS.E=o.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},o.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},o.CHARSETS.H=o.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},o.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(s,o)=>{var l,u,c;Object.defineProperty(o,"__esModule",{value:!0}),o.C1_ESCAPED=o.C1=o.C0=void 0,(function(d){d.NUL="\0",d.SOH="",d.STX="",d.ETX="",d.EOT="",d.ENQ="",d.ACK="",d.BEL="\x07",d.BS="\b",d.HT=" ",d.LF=`
|
|
387
|
+
`,d.VT="\v",d.FF="\f",d.CR="\r",d.SO="",d.SI="",d.DLE="",d.DC1="",d.DC2="",d.DC3="",d.DC4="",d.NAK="",d.SYN="",d.ETB="",d.CAN="",d.EM="",d.SUB="",d.ESC="\x1B",d.FS="",d.GS="",d.RS="",d.US="",d.SP=" ",d.DEL=""})(l||(o.C0=l={})),(function(d){d.PAD="",d.HOP="",d.BPH="",d.NBH="",d.IND="",d.NEL="
",d.SSA="",d.ESA="",d.HTS="",d.HTJ="",d.VTS="",d.PLD="",d.PLU="",d.RI="",d.SS2="",d.SS3="",d.DCS="",d.PU1="",d.PU2="",d.STS="",d.CCH="",d.MW="",d.SPA="",d.EPA="",d.SOS="",d.SGCI="",d.SCI="",d.CSI="",d.ST="",d.OSC="",d.PM="",d.APC=""})(u||(o.C1=u={})),(function(d){d.ST=`${l.ESC}\\`})(c||(o.C1_ESCAPED=c={}))},7399:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.evaluateKeyboardEvent=void 0;const u=l(2584),c={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};o.evaluateKeyboardEvent=function(d,p,f,x){const S={type:0,cancel:!1,key:void 0},v=(d.shiftKey?1:0)|(d.altKey?2:0)|(d.ctrlKey?4:0)|(d.metaKey?8:0);switch(d.keyCode){case 0:d.key==="UIKeyInputUpArrow"?S.key=p?u.C0.ESC+"OA":u.C0.ESC+"[A":d.key==="UIKeyInputLeftArrow"?S.key=p?u.C0.ESC+"OD":u.C0.ESC+"[D":d.key==="UIKeyInputRightArrow"?S.key=p?u.C0.ESC+"OC":u.C0.ESC+"[C":d.key==="UIKeyInputDownArrow"&&(S.key=p?u.C0.ESC+"OB":u.C0.ESC+"[B");break;case 8:S.key=d.ctrlKey?"\b":u.C0.DEL,d.altKey&&(S.key=u.C0.ESC+S.key);break;case 9:if(d.shiftKey){S.key=u.C0.ESC+"[Z";break}S.key=u.C0.HT,S.cancel=!0;break;case 13:S.key=d.altKey?u.C0.ESC+u.C0.CR:u.C0.CR,S.cancel=!0;break;case 27:S.key=u.C0.ESC,d.altKey&&(S.key=u.C0.ESC+u.C0.ESC),S.cancel=!0;break;case 37:if(d.metaKey)break;v?(S.key=u.C0.ESC+"[1;"+(v+1)+"D",S.key===u.C0.ESC+"[1;3D"&&(S.key=u.C0.ESC+(f?"b":"[1;5D"))):S.key=p?u.C0.ESC+"OD":u.C0.ESC+"[D";break;case 39:if(d.metaKey)break;v?(S.key=u.C0.ESC+"[1;"+(v+1)+"C",S.key===u.C0.ESC+"[1;3C"&&(S.key=u.C0.ESC+(f?"f":"[1;5C"))):S.key=p?u.C0.ESC+"OC":u.C0.ESC+"[C";break;case 38:if(d.metaKey)break;v?(S.key=u.C0.ESC+"[1;"+(v+1)+"A",f||S.key!==u.C0.ESC+"[1;3A"||(S.key=u.C0.ESC+"[1;5A")):S.key=p?u.C0.ESC+"OA":u.C0.ESC+"[A";break;case 40:if(d.metaKey)break;v?(S.key=u.C0.ESC+"[1;"+(v+1)+"B",f||S.key!==u.C0.ESC+"[1;3B"||(S.key=u.C0.ESC+"[1;5B")):S.key=p?u.C0.ESC+"OB":u.C0.ESC+"[B";break;case 45:d.shiftKey||d.ctrlKey||(S.key=u.C0.ESC+"[2~");break;case 46:S.key=v?u.C0.ESC+"[3;"+(v+1)+"~":u.C0.ESC+"[3~";break;case 36:S.key=v?u.C0.ESC+"[1;"+(v+1)+"H":p?u.C0.ESC+"OH":u.C0.ESC+"[H";break;case 35:S.key=v?u.C0.ESC+"[1;"+(v+1)+"F":p?u.C0.ESC+"OF":u.C0.ESC+"[F";break;case 33:d.shiftKey?S.type=2:d.ctrlKey?S.key=u.C0.ESC+"[5;"+(v+1)+"~":S.key=u.C0.ESC+"[5~";break;case 34:d.shiftKey?S.type=3:d.ctrlKey?S.key=u.C0.ESC+"[6;"+(v+1)+"~":S.key=u.C0.ESC+"[6~";break;case 112:S.key=v?u.C0.ESC+"[1;"+(v+1)+"P":u.C0.ESC+"OP";break;case 113:S.key=v?u.C0.ESC+"[1;"+(v+1)+"Q":u.C0.ESC+"OQ";break;case 114:S.key=v?u.C0.ESC+"[1;"+(v+1)+"R":u.C0.ESC+"OR";break;case 115:S.key=v?u.C0.ESC+"[1;"+(v+1)+"S":u.C0.ESC+"OS";break;case 116:S.key=v?u.C0.ESC+"[15;"+(v+1)+"~":u.C0.ESC+"[15~";break;case 117:S.key=v?u.C0.ESC+"[17;"+(v+1)+"~":u.C0.ESC+"[17~";break;case 118:S.key=v?u.C0.ESC+"[18;"+(v+1)+"~":u.C0.ESC+"[18~";break;case 119:S.key=v?u.C0.ESC+"[19;"+(v+1)+"~":u.C0.ESC+"[19~";break;case 120:S.key=v?u.C0.ESC+"[20;"+(v+1)+"~":u.C0.ESC+"[20~";break;case 121:S.key=v?u.C0.ESC+"[21;"+(v+1)+"~":u.C0.ESC+"[21~";break;case 122:S.key=v?u.C0.ESC+"[23;"+(v+1)+"~":u.C0.ESC+"[23~";break;case 123:S.key=v?u.C0.ESC+"[24;"+(v+1)+"~":u.C0.ESC+"[24~";break;default:if(!d.ctrlKey||d.shiftKey||d.altKey||d.metaKey)if(f&&!x||!d.altKey||d.metaKey)!f||d.altKey||d.ctrlKey||d.shiftKey||!d.metaKey?d.key&&!d.ctrlKey&&!d.altKey&&!d.metaKey&&d.keyCode>=48&&d.key.length===1?S.key=d.key:d.key&&d.ctrlKey&&(d.key==="_"&&(S.key=u.C0.US),d.key==="@"&&(S.key=u.C0.NUL)):d.keyCode===65&&(S.type=1);else{const m=c[d.keyCode],b=m==null?void 0:m[d.shiftKey?1:0];if(b)S.key=u.C0.ESC+b;else if(d.keyCode>=65&&d.keyCode<=90){const w=d.ctrlKey?d.keyCode-64:d.keyCode+32;let _=String.fromCharCode(w);d.shiftKey&&(_=_.toUpperCase()),S.key=u.C0.ESC+_}else if(d.keyCode===32)S.key=u.C0.ESC+(d.ctrlKey?u.C0.NUL:" ");else if(d.key==="Dead"&&d.code.startsWith("Key")){let w=d.code.slice(3,4);d.shiftKey||(w=w.toLowerCase()),S.key=u.C0.ESC+w,S.cancel=!0}}else d.keyCode>=65&&d.keyCode<=90?S.key=String.fromCharCode(d.keyCode-64):d.keyCode===32?S.key=u.C0.NUL:d.keyCode>=51&&d.keyCode<=55?S.key=String.fromCharCode(d.keyCode-51+27):d.keyCode===56?S.key=u.C0.DEL:d.keyCode===219?S.key=u.C0.ESC:d.keyCode===220?S.key=u.C0.FS:d.keyCode===221&&(S.key=u.C0.GS)}return S}},482:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Utf8ToUtf32=o.StringToUtf32=o.utf32ToString=o.stringFromCodePoint=void 0,o.stringFromCodePoint=function(l){return l>65535?(l-=65536,String.fromCharCode(55296+(l>>10))+String.fromCharCode(l%1024+56320)):String.fromCharCode(l)},o.utf32ToString=function(l,u=0,c=l.length){let d="";for(let p=u;p<c;++p){let f=l[p];f>65535?(f-=65536,d+=String.fromCharCode(55296+(f>>10))+String.fromCharCode(f%1024+56320)):d+=String.fromCharCode(f)}return d},o.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(l,u){const c=l.length;if(!c)return 0;let d=0,p=0;if(this._interim){const f=l.charCodeAt(p++);56320<=f&&f<=57343?u[d++]=1024*(this._interim-55296)+f-56320+65536:(u[d++]=this._interim,u[d++]=f),this._interim=0}for(let f=p;f<c;++f){const x=l.charCodeAt(f);if(55296<=x&&x<=56319){if(++f>=c)return this._interim=x,d;const S=l.charCodeAt(f);56320<=S&&S<=57343?u[d++]=1024*(x-55296)+S-56320+65536:(u[d++]=x,u[d++]=S)}else x!==65279&&(u[d++]=x)}return d}},o.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(l,u){const c=l.length;if(!c)return 0;let d,p,f,x,S=0,v=0,m=0;if(this.interim[0]){let _=!1,T=this.interim[0];T&=(224&T)==192?31:(240&T)==224?15:7;let N,E=0;for(;(N=63&this.interim[++E])&&E<4;)T<<=6,T|=N;const k=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,L=k-E;for(;m<L;){if(m>=c)return 0;if(N=l[m++],(192&N)!=128){m--,_=!0;break}this.interim[E++]=N,T<<=6,T|=63&N}_||(k===2?T<128?m--:u[S++]=T:k===3?T<2048||T>=55296&&T<=57343||T===65279||(u[S++]=T):T<65536||T>1114111||(u[S++]=T)),this.interim.fill(0)}const b=c-4;let w=m;for(;w<c;){for(;!(!(w<b)||128&(d=l[w])||128&(p=l[w+1])||128&(f=l[w+2])||128&(x=l[w+3]));)u[S++]=d,u[S++]=p,u[S++]=f,u[S++]=x,w+=4;if(d=l[w++],d<128)u[S++]=d;else if((224&d)==192){if(w>=c)return this.interim[0]=d,S;if(p=l[w++],(192&p)!=128){w--;continue}if(v=(31&d)<<6|63&p,v<128){w--;continue}u[S++]=v}else if((240&d)==224){if(w>=c)return this.interim[0]=d,S;if(p=l[w++],(192&p)!=128){w--;continue}if(w>=c)return this.interim[0]=d,this.interim[1]=p,S;if(f=l[w++],(192&f)!=128){w--;continue}if(v=(15&d)<<12|(63&p)<<6|63&f,v<2048||v>=55296&&v<=57343||v===65279)continue;u[S++]=v}else if((248&d)==240){if(w>=c)return this.interim[0]=d,S;if(p=l[w++],(192&p)!=128){w--;continue}if(w>=c)return this.interim[0]=d,this.interim[1]=p,S;if(f=l[w++],(192&f)!=128){w--;continue}if(w>=c)return this.interim[0]=d,this.interim[1]=p,this.interim[2]=f,S;if(x=l[w++],(192&x)!=128){w--;continue}if(v=(7&d)<<18|(63&p)<<12|(63&f)<<6|63&x,v<65536||v>1114111)continue;u[S++]=v}}return S}}},225:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeV6=void 0;const u=l(1480),c=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],d=[[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 p;o.UnicodeV6=class{constructor(){if(this.version="6",!p){p=new Uint8Array(65536),p.fill(1),p[0]=0,p.fill(0,1,32),p.fill(0,127,160),p.fill(2,4352,4448),p[9001]=2,p[9002]=2,p.fill(2,11904,42192),p[12351]=1,p.fill(2,44032,55204),p.fill(2,63744,64256),p.fill(2,65040,65050),p.fill(2,65072,65136),p.fill(2,65280,65377),p.fill(2,65504,65511);for(let f=0;f<c.length;++f)p.fill(0,c[f][0],c[f][1]+1)}}wcwidth(f){return f<32?0:f<127?1:f<65536?p[f]:(function(x,S){let v,m=0,b=S.length-1;if(x<S[0][0]||x>S[b][1])return!1;for(;b>=m;)if(v=m+b>>1,x>S[v][1])m=v+1;else{if(!(x<S[v][0]))return!0;b=v-1}return!1})(f,d)?0:f>=131072&&f<=196605||f>=196608&&f<=262141?2:1}charProperties(f,x){let S=this.wcwidth(f),v=S===0&&x!==0;if(v){const m=u.UnicodeService.extractWidth(x);m===0?v=!1:m>S&&(S=m)}return u.UnicodeService.createPropertyValue(0,S,v)}}},5981:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.WriteBuffer=void 0;const u=l(8460),c=l(844);class d extends c.Disposable{constructor(f){super(),this._action=f,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(f,x){if(x!==void 0&&this._syncCalls>x)return void(this._syncCalls=0);if(this._pendingData+=f.length,this._writeBuffer.push(f),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let S;for(this._isSyncWriting=!0;S=this._writeBuffer.shift();){this._action(S);const v=this._callbacks.shift();v&&v()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(f,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+=f.length,this._writeBuffer.push(f),this._callbacks.push(x),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=f.length,this._writeBuffer.push(f),this._callbacks.push(x)}_innerWrite(f=0,x=!0){const S=f||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const v=this._writeBuffer[this._bufferOffset],m=this._action(v,x);if(m){const w=_=>Date.now()-S>=12?setTimeout((()=>this._innerWrite(0,_))):this._innerWrite(S,_);return void m.catch((_=>(queueMicrotask((()=>{throw _})),Promise.resolve(!1)))).then(w)}const b=this._callbacks[this._bufferOffset];if(b&&b(),this._bufferOffset++,this._pendingData-=v.length,Date.now()-S>=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()}}o.WriteBuffer=d},5941:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.toRgbString=o.parseColor=void 0;const l=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,u=/^[\da-f]+$/;function c(d,p){const f=d.toString(16),x=f.length<2?"0"+f:f;switch(p){case 4:return f[0];case 8:return x;case 12:return(x+x).slice(0,3);default:return x+x}}o.parseColor=function(d){if(!d)return;let p=d.toLowerCase();if(p.indexOf("rgb:")===0){p=p.slice(4);const f=l.exec(p);if(f){const x=f[1]?15:f[4]?255:f[7]?4095:65535;return[Math.round(parseInt(f[1]||f[4]||f[7]||f[10],16)/x*255),Math.round(parseInt(f[2]||f[5]||f[8]||f[11],16)/x*255),Math.round(parseInt(f[3]||f[6]||f[9]||f[12],16)/x*255)]}}else if(p.indexOf("#")===0&&(p=p.slice(1),u.exec(p)&&[3,6,9,12].includes(p.length))){const f=p.length/3,x=[0,0,0];for(let S=0;S<3;++S){const v=parseInt(p.slice(f*S,f*S+f),16);x[S]=f===1?v<<4:f===2?v:f===3?v>>4:v>>8}return x}},o.toRgbString=function(d,p=16){const[f,x,S]=d;return`rgb:${c(f,p)}/${c(x,p)}/${c(S,p)}`}},5770:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.PAYLOAD_LIMIT=void 0,o.PAYLOAD_LIMIT=1e7},6351:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DcsHandler=o.DcsParser=void 0;const u=l(482),c=l(8742),d=l(5770),p=[];o.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=p,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=p}registerHandler(x,S){this._handlers[x]===void 0&&(this._handlers[x]=[]);const v=this._handlers[x];return v.push(S),{dispose:()=>{const m=v.indexOf(S);m!==-1&&v.splice(m,1)}}}clearHandler(x){this._handlers[x]&&delete this._handlers[x]}setHandlerFallback(x){this._handlerFb=x}reset(){if(this._active.length)for(let x=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;x>=0;--x)this._active[x].unhook(!1);this._stack.paused=!1,this._active=p,this._ident=0}hook(x,S){if(this.reset(),this._ident=x,this._active=this._handlers[x]||p,this._active.length)for(let v=this._active.length-1;v>=0;v--)this._active[v].hook(S);else this._handlerFb(this._ident,"HOOK",S)}put(x,S,v){if(this._active.length)for(let m=this._active.length-1;m>=0;m--)this._active[m].put(x,S,v);else this._handlerFb(this._ident,"PUT",(0,u.utf32ToString)(x,S,v))}unhook(x,S=!0){if(this._active.length){let v=!1,m=this._active.length-1,b=!1;if(this._stack.paused&&(m=this._stack.loopPosition-1,v=S,b=this._stack.fallThrough,this._stack.paused=!1),!b&&v===!1){for(;m>=0&&(v=this._active[m].unhook(x),v!==!0);m--)if(v instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=m,this._stack.fallThrough=!1,v;m--}for(;m>=0;m--)if(v=this._active[m].unhook(!1),v instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=m,this._stack.fallThrough=!0,v}else this._handlerFb(this._ident,"UNHOOK",x);this._active=p,this._ident=0}};const f=new c.Params;f.addParam(0),o.DcsHandler=class{constructor(x){this._handler=x,this._data="",this._params=f,this._hitLimit=!1}hook(x){this._params=x.length>1||x.params[0]?x.clone():f,this._data="",this._hitLimit=!1}put(x,S,v){this._hitLimit||(this._data+=(0,u.utf32ToString)(x,S,v),this._data.length>d.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(x){let S=!1;if(this._hitLimit)S=!1;else if(x&&(S=this._handler(this._data,this._params),S instanceof Promise))return S.then((v=>(this._params=f,this._data="",this._hitLimit=!1,v)));return this._params=f,this._data="",this._hitLimit=!1,S}}},2015:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.EscapeSequenceParser=o.VT500_TRANSITION_TABLE=o.TransitionTable=void 0;const u=l(844),c=l(8742),d=l(6242),p=l(6351);class f{constructor(m){this.table=new Uint8Array(m)}setDefault(m,b){this.table.fill(m<<4|b)}add(m,b,w,_){this.table[b<<8|m]=w<<4|_}addMany(m,b,w,_){for(let T=0;T<m.length;T++)this.table[b<<8|m[T]]=w<<4|_}}o.TransitionTable=f;const x=160;o.VT500_TRANSITION_TABLE=(function(){const v=new f(4095),m=Array.apply(null,Array(256)).map(((E,k)=>k)),b=(E,k)=>m.slice(E,k),w=b(32,127),_=b(0,24);_.push(25),_.push.apply(_,b(28,32));const T=b(0,14);let N;for(N in v.setDefault(1,0),v.addMany(w,0,2,0),T)v.addMany([24,26,153,154],N,3,0),v.addMany(b(128,144),N,3,0),v.addMany(b(144,152),N,3,0),v.add(156,N,0,0),v.add(27,N,11,1),v.add(157,N,4,8),v.addMany([152,158,159],N,0,7),v.add(155,N,11,3),v.add(144,N,11,9);return v.addMany(_,0,3,0),v.addMany(_,1,3,1),v.add(127,1,0,1),v.addMany(_,8,0,8),v.addMany(_,3,3,3),v.add(127,3,0,3),v.addMany(_,4,3,4),v.add(127,4,0,4),v.addMany(_,6,3,6),v.addMany(_,5,3,5),v.add(127,5,0,5),v.addMany(_,2,3,2),v.add(127,2,0,2),v.add(93,1,4,8),v.addMany(w,8,5,8),v.add(127,8,5,8),v.addMany([156,27,24,26,7],8,6,0),v.addMany(b(28,32),8,0,8),v.addMany([88,94,95],1,0,7),v.addMany(w,7,0,7),v.addMany(_,7,0,7),v.add(156,7,0,0),v.add(127,7,0,7),v.add(91,1,11,3),v.addMany(b(64,127),3,7,0),v.addMany(b(48,60),3,8,4),v.addMany([60,61,62,63],3,9,4),v.addMany(b(48,60),4,8,4),v.addMany(b(64,127),4,7,0),v.addMany([60,61,62,63],4,0,6),v.addMany(b(32,64),6,0,6),v.add(127,6,0,6),v.addMany(b(64,127),6,0,0),v.addMany(b(32,48),3,9,5),v.addMany(b(32,48),5,9,5),v.addMany(b(48,64),5,0,6),v.addMany(b(64,127),5,7,0),v.addMany(b(32,48),4,9,5),v.addMany(b(32,48),1,9,2),v.addMany(b(32,48),2,9,2),v.addMany(b(48,127),2,10,0),v.addMany(b(48,80),1,10,0),v.addMany(b(81,88),1,10,0),v.addMany([89,90,92],1,10,0),v.addMany(b(96,127),1,10,0),v.add(80,1,11,9),v.addMany(_,9,0,9),v.add(127,9,0,9),v.addMany(b(28,32),9,0,9),v.addMany(b(32,48),9,9,12),v.addMany(b(48,60),9,8,10),v.addMany([60,61,62,63],9,9,10),v.addMany(_,11,0,11),v.addMany(b(32,128),11,0,11),v.addMany(b(28,32),11,0,11),v.addMany(_,10,0,10),v.add(127,10,0,10),v.addMany(b(28,32),10,0,10),v.addMany(b(48,60),10,8,10),v.addMany([60,61,62,63],10,0,11),v.addMany(b(32,48),10,9,12),v.addMany(_,12,0,12),v.add(127,12,0,12),v.addMany(b(28,32),12,0,12),v.addMany(b(32,48),12,9,12),v.addMany(b(48,64),12,0,11),v.addMany(b(64,127),12,12,13),v.addMany(b(64,127),10,12,13),v.addMany(b(64,127),9,12,13),v.addMany(_,13,13,13),v.addMany(w,13,13,13),v.add(127,13,0,13),v.addMany([27,156,24,26],13,14,0),v.add(x,0,2,0),v.add(x,8,5,8),v.add(x,6,0,6),v.add(x,11,0,11),v.add(x,13,13,13),v})();class S extends u.Disposable{constructor(m=o.VT500_TRANSITION_TABLE){super(),this._transitions=m,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new c.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(b,w,_)=>{},this._executeHandlerFb=b=>{},this._csiHandlerFb=(b,w)=>{},this._escHandlerFb=b=>{},this._errorHandlerFb=b=>b,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 d.OscParser),this._dcsParser=this.register(new p.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(m,b=[64,126]){let w=0;if(m.prefix){if(m.prefix.length>1)throw new Error("only one byte as prefix supported");if(w=m.prefix.charCodeAt(0),w&&60>w||w>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 T=0;T<m.intermediates.length;++T){const N=m.intermediates.charCodeAt(T);if(32>N||N>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");w<<=8,w|=N}}if(m.final.length!==1)throw new Error("final must be a single byte");const _=m.final.charCodeAt(0);if(b[0]>_||_>b[1])throw new Error(`final must be in range ${b[0]} .. ${b[1]}`);return w<<=8,w|=_,w}identToString(m){const b=[];for(;m;)b.push(String.fromCharCode(255&m)),m>>=8;return b.reverse().join("")}setPrintHandler(m){this._printHandler=m}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(m,b){const w=this._identifier(m,[48,126]);this._escHandlers[w]===void 0&&(this._escHandlers[w]=[]);const _=this._escHandlers[w];return _.push(b),{dispose:()=>{const T=_.indexOf(b);T!==-1&&_.splice(T,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,b){this._executeHandlers[m.charCodeAt(0)]=b}clearExecuteHandler(m){this._executeHandlers[m.charCodeAt(0)]&&delete this._executeHandlers[m.charCodeAt(0)]}setExecuteHandlerFallback(m){this._executeHandlerFb=m}registerCsiHandler(m,b){const w=this._identifier(m);this._csiHandlers[w]===void 0&&(this._csiHandlers[w]=[]);const _=this._csiHandlers[w];return _.push(b),{dispose:()=>{const T=_.indexOf(b);T!==-1&&_.splice(T,1)}}}clearCsiHandler(m){this._csiHandlers[this._identifier(m)]&&delete this._csiHandlers[this._identifier(m)]}setCsiHandlerFallback(m){this._csiHandlerFb=m}registerDcsHandler(m,b){return this._dcsParser.registerHandler(this._identifier(m),b)}clearDcsHandler(m){this._dcsParser.clearHandler(this._identifier(m))}setDcsHandlerFallback(m){this._dcsParser.setHandlerFallback(m)}registerOscHandler(m,b){return this._oscParser.registerHandler(m,b)}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,b,w,_,T){this._parseStack.state=m,this._parseStack.handlers=b,this._parseStack.handlerPos=w,this._parseStack.transition=_,this._parseStack.chunkPos=T}parse(m,b,w){let _,T=0,N=0,E=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,E=this._parseStack.chunkPos+1;else{if(w===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 L=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(w===!1&&L>-1){for(;L>=0&&(_=k[L](this._params),_!==!0);L--)if(_ instanceof Promise)return this._parseStack.handlerPos=L,_}this._parseStack.handlers=[];break;case 4:if(w===!1&&L>-1){for(;L>=0&&(_=k[L](),_!==!0);L--)if(_ instanceof Promise)return this._parseStack.handlerPos=L,_}this._parseStack.handlers=[];break;case 6:if(T=m[this._parseStack.chunkPos],_=this._dcsParser.unhook(T!==24&&T!==26,w),_)return _;T===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(T=m[this._parseStack.chunkPos],_=this._oscParser.end(T!==24&&T!==26,w),_)return _;T===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,E=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let k=E;k<b;++k){switch(T=m[k],N=this._transitions.table[this.currentState<<8|(T<160?T:x)],N>>4){case 2:for(let $=k+1;;++$){if($>=b||(T=m[$])<32||T>126&&T<x){this._printHandler(m,k,$),k=$-1;break}if(++$>=b||(T=m[$])<32||T>126&&T<x){this._printHandler(m,k,$),k=$-1;break}if(++$>=b||(T=m[$])<32||T>126&&T<x){this._printHandler(m,k,$),k=$-1;break}if(++$>=b||(T=m[$])<32||T>126&&T<x){this._printHandler(m,k,$),k=$-1;break}}break;case 3:this._executeHandlers[T]?this._executeHandlers[T]():this._executeHandlerFb(T),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:k,code:T,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const L=this._csiHandlers[this._collect<<8|T];let A=L?L.length-1:-1;for(;A>=0&&(_=L[A](this._params),_!==!0);A--)if(_ instanceof Promise)return this._preserveStack(3,L,A,N,k),_;A<0&&this._csiHandlerFb(this._collect<<8|T,this._params),this.precedingJoinState=0;break;case 8:do switch(T){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(T-48)}while(++k<b&&(T=m[k])>47&&T<60);k--;break;case 9:this._collect<<=8,this._collect|=T;break;case 10:const M=this._escHandlers[this._collect<<8|T];let O=M?M.length-1:-1;for(;O>=0&&(_=M[O](),_!==!0);O--)if(_ instanceof Promise)return this._preserveStack(4,M,O,N,k),_;O<0&&this._escHandlerFb(this._collect<<8|T),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|T,this._params);break;case 13:for(let $=k+1;;++$)if($>=b||(T=m[$])===24||T===26||T===27||T>127&&T<x){this._dcsParser.put(m,k,$),k=$-1;break}break;case 14:if(_=this._dcsParser.unhook(T!==24&&T!==26),_)return this._preserveStack(6,[],0,N,k),_;T===27&&(N|=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 $=k+1;;$++)if($>=b||(T=m[$])<32||T>127&&T<x){this._oscParser.put(m,k,$),k=$-1;break}break;case 6:if(_=this._oscParser.end(T!==24&&T!==26),_)return this._preserveStack(5,[],0,N,k),_;T===27&&(N|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&N}}}o.EscapeSequenceParser=S},6242:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.OscHandler=o.OscParser=void 0;const u=l(5770),c=l(482),d=[];o.OscParser=class{constructor(){this._state=0,this._active=d,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(p,f){this._handlers[p]===void 0&&(this._handlers[p]=[]);const x=this._handlers[p];return x.push(f),{dispose:()=>{const S=x.indexOf(f);S!==-1&&x.splice(S,1)}}}clearHandler(p){this._handlers[p]&&delete this._handlers[p]}setHandlerFallback(p){this._handlerFb=p}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=d}reset(){if(this._state===2)for(let p=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;p>=0;--p)this._active[p].end(!1);this._stack.paused=!1,this._active=d,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||d,this._active.length)for(let p=this._active.length-1;p>=0;p--)this._active[p].start();else this._handlerFb(this._id,"START")}_put(p,f,x){if(this._active.length)for(let S=this._active.length-1;S>=0;S--)this._active[S].put(p,f,x);else this._handlerFb(this._id,"PUT",(0,c.utf32ToString)(p,f,x))}start(){this.reset(),this._state=1}put(p,f,x){if(this._state!==3){if(this._state===1)for(;f<x;){const S=p[f++];if(S===59){this._state=2,this._start();break}if(S<48||57<S)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+S-48}this._state===2&&x-f>0&&this._put(p,f,x)}}end(p,f=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let x=!1,S=this._active.length-1,v=!1;if(this._stack.paused&&(S=this._stack.loopPosition-1,x=f,v=this._stack.fallThrough,this._stack.paused=!1),!v&&x===!1){for(;S>=0&&(x=this._active[S].end(p),x!==!0);S--)if(x instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=S,this._stack.fallThrough=!1,x;S--}for(;S>=0;S--)if(x=this._active[S].end(!1),x instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=S,this._stack.fallThrough=!0,x}else this._handlerFb(this._id,"END",p);this._active=d,this._id=-1,this._state=0}}},o.OscHandler=class{constructor(p){this._handler=p,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(p,f,x){this._hitLimit||(this._data+=(0,c.utf32ToString)(p,f,x),this._data.length>u.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(p){let f=!1;if(this._hitLimit)f=!1;else if(p&&(f=this._handler(this._data),f instanceof Promise))return f.then((x=>(this._data="",this._hitLimit=!1,x)));return this._data="",this._hitLimit=!1,f}}},8742:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Params=void 0;const l=2147483647;class u{static fromArray(d){const p=new u;if(!d.length)return p;for(let f=Array.isArray(d[0])?1:0;f<d.length;++f){const x=d[f];if(Array.isArray(x))for(let S=0;S<x.length;++S)p.addSubParam(x[S]);else p.addParam(x)}return p}constructor(d=32,p=32){if(this.maxLength=d,this.maxSubParamsLength=p,p>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(d),this.length=0,this._subParams=new Int32Array(p),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(d),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const d=new u(this.maxLength,this.maxSubParamsLength);return d.params.set(this.params),d.length=this.length,d._subParams.set(this._subParams),d._subParamsLength=this._subParamsLength,d._subParamsIdx.set(this._subParamsIdx),d._rejectDigits=this._rejectDigits,d._rejectSubDigits=this._rejectSubDigits,d._digitIsSub=this._digitIsSub,d}toArray(){const d=[];for(let p=0;p<this.length;++p){d.push(this.params[p]);const f=this._subParamsIdx[p]>>8,x=255&this._subParamsIdx[p];x-f>0&&d.push(Array.prototype.slice.call(this._subParams,f,x))}return d}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(d){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(d<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=d>l?l:d}}addSubParam(d){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(d<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=d>l?l:d,this._subParamsIdx[this.length-1]++}}hasSubParams(d){return(255&this._subParamsIdx[d])-(this._subParamsIdx[d]>>8)>0}getSubParams(d){const p=this._subParamsIdx[d]>>8,f=255&this._subParamsIdx[d];return f-p>0?this._subParams.subarray(p,f):null}getSubParamsAll(){const d={};for(let p=0;p<this.length;++p){const f=this._subParamsIdx[p]>>8,x=255&this._subParamsIdx[p];x-f>0&&(d[p]=this._subParams.slice(f,x))}return d}addDigit(d){let p;if(this._rejectDigits||!(p=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const f=this._digitIsSub?this._subParams:this.params,x=f[p-1];f[p-1]=~x?Math.min(10*x+d,l):d}}o.Params=u},5741:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.AddonManager=void 0,o.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let l=this._addons.length-1;l>=0;l--)this._addons[l].instance.dispose()}loadAddon(l,u){const c={instance:u,dispose:u.dispose,isDisposed:!1};this._addons.push(c),u.dispose=()=>this._wrappedAddonDispose(c),u.activate(l)}_wrappedAddonDispose(l){if(l.isDisposed)return;let u=-1;for(let c=0;c<this._addons.length;c++)if(this._addons[c]===l){u=c;break}if(u===-1)throw new Error("Could not dispose an addon that has not been loaded");l.isDisposed=!0,l.dispose.apply(l.instance),this._addons.splice(u,1)}}},8771:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferApiView=void 0;const u=l(3785),c=l(511);o.BufferApiView=class{constructor(d,p){this._buffer=d,this.type=p}init(d){return this._buffer=d,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(d){const p=this._buffer.lines.get(d);if(p)return new u.BufferLineApiView(p)}getNullCell(){return new c.CellData}}},3785:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferLineApiView=void 0;const u=l(511);o.BufferLineApiView=class{constructor(c){this._line=c}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(c,d){if(!(c<0||c>=this._line.length))return d?(this._line.loadCell(c,d),d):this._line.loadCell(c,new u.CellData)}translateToString(c,d,p){return this._line.translateToString(c,d,p)}}},8285:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferNamespaceApi=void 0;const u=l(8771),c=l(8460),d=l(844);class p extends d.Disposable{constructor(x){super(),this._core=x,this._onBufferChange=this.register(new c.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new u.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new u.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}o.BufferNamespaceApi=p},7975:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ParserApi=void 0,o.ParserApi=class{constructor(l){this._core=l}registerCsiHandler(l,u){return this._core.registerCsiHandler(l,(c=>u(c.toArray())))}addCsiHandler(l,u){return this.registerCsiHandler(l,u)}registerDcsHandler(l,u){return this._core.registerDcsHandler(l,((c,d)=>u(c,d.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:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeApi=void 0,o.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(s,o,l){var u=this&&this.__decorate||function(v,m,b,w){var _,T=arguments.length,N=T<3?m:w===null?w=Object.getOwnPropertyDescriptor(m,b):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(v,m,b,w);else for(var E=v.length-1;E>=0;E--)(_=v[E])&&(N=(T<3?_(N):T>3?_(m,b,N):_(m,b))||N);return T>3&&N&&Object.defineProperty(m,b,N),N},c=this&&this.__param||function(v,m){return function(b,w){m(b,w,v)}};Object.defineProperty(o,"__esModule",{value:!0}),o.BufferService=o.MINIMUM_ROWS=o.MINIMUM_COLS=void 0;const d=l(8460),p=l(844),f=l(5295),x=l(2585);o.MINIMUM_COLS=2,o.MINIMUM_ROWS=1;let S=o.BufferService=class extends p.Disposable{get buffer(){return this.buffers.active}constructor(v){super(),this.isUserScrolling=!1,this._onResize=this.register(new d.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new d.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(v.rawOptions.cols||0,o.MINIMUM_COLS),this.rows=Math.max(v.rawOptions.rows||0,o.MINIMUM_ROWS),this.buffers=this.register(new f.BufferSet(v,this))}resize(v,m){this.cols=v,this.rows=m,this.buffers.resize(v,m),this._onResize.fire({cols:v,rows:m})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(v,m=!1){const b=this.buffer;let w;w=this._cachedBlankLine,w&&w.length===this.cols&&w.getFg(0)===v.fg&&w.getBg(0)===v.bg||(w=b.getBlankLine(v,m),this._cachedBlankLine=w),w.isWrapped=m;const _=b.ybase+b.scrollTop,T=b.ybase+b.scrollBottom;if(b.scrollTop===0){const N=b.lines.isFull;T===b.lines.length-1?N?b.lines.recycle().copyFrom(w):b.lines.push(w.clone()):b.lines.splice(T+1,0,w.clone()),N?this.isUserScrolling&&(b.ydisp=Math.max(b.ydisp-1,0)):(b.ybase++,this.isUserScrolling||b.ydisp++)}else{const N=T-_+1;b.lines.shiftElements(_+1,N-1,-1),b.lines.set(T,w.clone())}this.isUserScrolling||(b.ydisp=b.ybase),this._onScroll.fire(b.ydisp)}scrollLines(v,m,b){const w=this.buffer;if(v<0){if(w.ydisp===0)return;this.isUserScrolling=!0}else v+w.ydisp>=w.ybase&&(this.isUserScrolling=!1);const _=w.ydisp;w.ydisp=Math.max(Math.min(w.ydisp+v,w.ybase),0),_!==w.ydisp&&(m||this._onScroll.fire(w.ydisp))}};o.BufferService=S=u([c(0,x.IOptionsService)],S)},7994:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CharsetService=void 0,o.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(s,o,l){var u=this&&this.__decorate||function(w,_,T,N){var E,k=arguments.length,L=k<3?_:N===null?N=Object.getOwnPropertyDescriptor(_,T):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(w,_,T,N);else for(var A=w.length-1;A>=0;A--)(E=w[A])&&(L=(k<3?E(L):k>3?E(_,T,L):E(_,T))||L);return k>3&&L&&Object.defineProperty(_,T,L),L},c=this&&this.__param||function(w,_){return function(T,N){_(T,N,w)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CoreMouseService=void 0;const d=l(2585),p=l(8460),f=l(844),x={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:w=>w.button!==4&&w.action===1&&(w.ctrl=!1,w.alt=!1,w.shift=!1,!0)},VT200:{events:19,restrict:w=>w.action!==32},DRAG:{events:23,restrict:w=>w.action!==32||w.button!==3},ANY:{events:31,restrict:w=>!0}};function S(w,_){let T=(w.ctrl?16:0)|(w.shift?4:0)|(w.alt?8:0);return w.button===4?(T|=64,T|=w.action):(T|=3&w.button,4&w.button&&(T|=64),8&w.button&&(T|=128),w.action===32?T|=32:w.action!==0||_||(T|=3)),T}const v=String.fromCharCode,m={DEFAULT:w=>{const _=[S(w,!1)+32,w.col+32,w.row+32];return _[0]>255||_[1]>255||_[2]>255?"":`\x1B[M${v(_[0])}${v(_[1])}${v(_[2])}`},SGR:w=>{const _=w.action===0&&w.button!==4?"m":"M";return`\x1B[<${S(w,!0)};${w.col};${w.row}${_}`},SGR_PIXELS:w=>{const _=w.action===0&&w.button!==4?"m":"M";return`\x1B[<${S(w,!0)};${w.x};${w.y}${_}`}};let b=o.CoreMouseService=class extends f.Disposable{constructor(w,_){super(),this._bufferService=w,this._coreService=_,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new p.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const T of Object.keys(x))this.addProtocol(T,x[T]);for(const T of Object.keys(m))this.addEncoding(T,m[T]);this.reset()}addProtocol(w,_){this._protocols[w]=_}addEncoding(w,_){this._encodings[w]=_}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(w){if(!this._protocols[w])throw new Error(`unknown protocol "${w}"`);this._activeProtocol=w,this._onProtocolChange.fire(this._protocols[w].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(w){if(!this._encodings[w])throw new Error(`unknown encoding "${w}"`);this._activeEncoding=w}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(w){if(w.col<0||w.col>=this._bufferService.cols||w.row<0||w.row>=this._bufferService.rows||w.button===4&&w.action===32||w.button===3&&w.action!==32||w.button!==4&&(w.action===2||w.action===3)||(w.col++,w.row++,w.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,w,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(w))return!1;const _=this._encodings[this._activeEncoding](w);return _&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(_):this._coreService.triggerDataEvent(_,!0)),this._lastEvent=w,!0}explainEvents(w){return{down:!!(1&w),up:!!(2&w),drag:!!(4&w),move:!!(8&w),wheel:!!(16&w)}}_equalEvents(w,_,T){if(T){if(w.x!==_.x||w.y!==_.y)return!1}else if(w.col!==_.col||w.row!==_.row)return!1;return w.button===_.button&&w.action===_.action&&w.ctrl===_.ctrl&&w.alt===_.alt&&w.shift===_.shift}};o.CoreMouseService=b=u([c(0,d.IBufferService),c(1,d.ICoreService)],b)},6975:function(s,o,l){var u=this&&this.__decorate||function(b,w,_,T){var N,E=arguments.length,k=E<3?w:T===null?T=Object.getOwnPropertyDescriptor(w,_):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(b,w,_,T);else for(var L=b.length-1;L>=0;L--)(N=b[L])&&(k=(E<3?N(k):E>3?N(w,_,k):N(w,_))||k);return E>3&&k&&Object.defineProperty(w,_,k),k},c=this&&this.__param||function(b,w){return function(_,T){w(_,T,b)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CoreService=void 0;const d=l(1439),p=l(8460),f=l(844),x=l(2585),S=Object.freeze({insertMode:!1}),v=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let m=o.CoreService=class extends f.Disposable{constructor(b,w,_){super(),this._bufferService=b,this._logService=w,this._optionsService=_,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new p.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new p.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new p.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new p.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,d.clone)(S),this.decPrivateModes=(0,d.clone)(v)}reset(){this.modes=(0,d.clone)(S),this.decPrivateModes=(0,d.clone)(v)}triggerDataEvent(b,w=!1){if(this._optionsService.rawOptions.disableStdin)return;const _=this._bufferService.buffer;w&&this._optionsService.rawOptions.scrollOnUserInput&&_.ybase!==_.ydisp&&this._onRequestScrollToBottom.fire(),w&&this._onUserInput.fire(),this._logService.debug(`sending data "${b}"`,(()=>b.split("").map((T=>T.charCodeAt(0))))),this._onData.fire(b)}triggerBinaryEvent(b){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${b}"`,(()=>b.split("").map((w=>w.charCodeAt(0))))),this._onBinary.fire(b))}};o.CoreService=m=u([c(0,x.IBufferService),c(1,x.ILogService),c(2,x.IOptionsService)],m)},9074:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DecorationService=void 0;const u=l(8055),c=l(8460),d=l(844),p=l(6106);let f=0,x=0;class S extends d.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new p.SortedList((b=>b==null?void 0:b.marker.line)),this._onDecorationRegistered=this.register(new c.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new c.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,d.toDisposable)((()=>this.reset())))}registerDecoration(b){if(b.marker.isDisposed)return;const w=new v(b);if(w){const _=w.marker.onDispose((()=>w.dispose()));w.onDispose((()=>{w&&(this._decorations.delete(w)&&this._onDecorationRemoved.fire(w),_.dispose())})),this._decorations.insert(w),this._onDecorationRegistered.fire(w)}return w}reset(){for(const b of this._decorations.values())b.dispose();this._decorations.clear()}*getDecorationsAtCell(b,w,_){let T=0,N=0;for(const E of this._decorations.getKeyIterator(w))T=E.options.x??0,N=T+(E.options.width??1),b>=T&&b<N&&(!_||(E.options.layer??"bottom")===_)&&(yield E)}forEachDecorationAtCell(b,w,_,T){this._decorations.forEachByKey(w,(N=>{f=N.options.x??0,x=f+(N.options.width??1),b>=f&&b<x&&(!_||(N.options.layer??"bottom")===_)&&T(N)}))}}o.DecorationService=S;class v extends d.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(b){super(),this.options=b,this.onRenderEmitter=this.register(new c.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new c.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=b.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.InstantiationService=o.ServiceCollection=void 0;const u=l(2585),c=l(8343);class d{constructor(...f){this._entries=new Map;for(const[x,S]of f)this.set(x,S)}set(f,x){const S=this._entries.get(f);return this._entries.set(f,x),S}forEach(f){for(const[x,S]of this._entries.entries())f(x,S)}has(f){return this._entries.has(f)}get(f){return this._entries.get(f)}}o.ServiceCollection=d,o.InstantiationService=class{constructor(){this._services=new d,this._services.set(u.IInstantiationService,this)}setService(p,f){this._services.set(p,f)}getService(p){return this._services.get(p)}createInstance(p,...f){const x=(0,c.getServiceDependencies)(p).sort(((m,b)=>m.index-b.index)),S=[];for(const m of x){const b=this._services.get(m.id);if(!b)throw new Error(`[createInstance] ${p.name} depends on UNKNOWN service ${m.id}.`);S.push(b)}const v=x.length>0?x[0].index:f.length;if(f.length!==v)throw new Error(`[createInstance] First service dependency of ${p.name} at position ${v+1} conflicts with ${f.length} static arguments`);return new p(...f,...S)}}},7866:function(s,o,l){var u=this&&this.__decorate||function(v,m,b,w){var _,T=arguments.length,N=T<3?m:w===null?w=Object.getOwnPropertyDescriptor(m,b):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(v,m,b,w);else for(var E=v.length-1;E>=0;E--)(_=v[E])&&(N=(T<3?_(N):T>3?_(m,b,N):_(m,b))||N);return T>3&&N&&Object.defineProperty(m,b,N),N},c=this&&this.__param||function(v,m){return function(b,w){m(b,w,v)}};Object.defineProperty(o,"__esModule",{value:!0}),o.traceCall=o.setTraceLogger=o.LogService=void 0;const d=l(844),p=l(2585),f={trace:p.LogLevelEnum.TRACE,debug:p.LogLevelEnum.DEBUG,info:p.LogLevelEnum.INFO,warn:p.LogLevelEnum.WARN,error:p.LogLevelEnum.ERROR,off:p.LogLevelEnum.OFF};let x,S=o.LogService=class extends d.Disposable{get logLevel(){return this._logLevel}constructor(v){super(),this._optionsService=v,this._logLevel=p.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),x=this}_updateLogLevel(){this._logLevel=f[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(v){for(let m=0;m<v.length;m++)typeof v[m]=="function"&&(v[m]=v[m]())}_log(v,m,b){this._evalLazyOptionalParams(b),v.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+m,...b)}trace(v,...m){var b;this._logLevel<=p.LogLevelEnum.TRACE&&this._log(((b=this._optionsService.options.logger)==null?void 0:b.trace.bind(this._optionsService.options.logger))??console.log,v,m)}debug(v,...m){var b;this._logLevel<=p.LogLevelEnum.DEBUG&&this._log(((b=this._optionsService.options.logger)==null?void 0:b.debug.bind(this._optionsService.options.logger))??console.log,v,m)}info(v,...m){var b;this._logLevel<=p.LogLevelEnum.INFO&&this._log(((b=this._optionsService.options.logger)==null?void 0:b.info.bind(this._optionsService.options.logger))??console.info,v,m)}warn(v,...m){var b;this._logLevel<=p.LogLevelEnum.WARN&&this._log(((b=this._optionsService.options.logger)==null?void 0:b.warn.bind(this._optionsService.options.logger))??console.warn,v,m)}error(v,...m){var b;this._logLevel<=p.LogLevelEnum.ERROR&&this._log(((b=this._optionsService.options.logger)==null?void 0:b.error.bind(this._optionsService.options.logger))??console.error,v,m)}};o.LogService=S=u([c(0,p.IOptionsService)],S),o.setTraceLogger=function(v){x=v},o.traceCall=function(v,m,b){if(typeof b.value!="function")throw new Error("not supported");const w=b.value;b.value=function(..._){if(x.logLevel!==p.LogLevelEnum.TRACE)return w.apply(this,_);x.trace(`GlyphRenderer#${w.name}(${_.map((N=>JSON.stringify(N))).join(", ")})`);const T=w.apply(this,_);return x.trace(`GlyphRenderer#${w.name} return`,T),T}}},7302:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.OptionsService=o.DEFAULT_OPTIONS=void 0;const u=l(8460),c=l(844),d=l(6114);o.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:d.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const p=["normal","bold","100","200","300","400","500","600","700","800","900"];class f extends c.Disposable{constructor(S){super(),this._onOptionChange=this.register(new u.EventEmitter),this.onOptionChange=this._onOptionChange.event;const v={...o.DEFAULT_OPTIONS};for(const m in S)if(m in v)try{const b=S[m];v[m]=this._sanitizeAndValidateOption(m,b)}catch(b){console.error(b)}this.rawOptions=v,this.options={...v},this._setupOptions(),this.register((0,c.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(S,v){return this.onOptionChange((m=>{m===S&&v(this.rawOptions[S])}))}onMultipleOptionChange(S,v){return this.onOptionChange((m=>{S.indexOf(m)!==-1&&v()}))}_setupOptions(){const S=m=>{if(!(m in o.DEFAULT_OPTIONS))throw new Error(`No option with key "${m}"`);return this.rawOptions[m]},v=(m,b)=>{if(!(m in o.DEFAULT_OPTIONS))throw new Error(`No option with key "${m}"`);b=this._sanitizeAndValidateOption(m,b),this.rawOptions[m]!==b&&(this.rawOptions[m]=b,this._onOptionChange.fire(m))};for(const m in this.rawOptions){const b={get:S.bind(this,m),set:v.bind(this,m)};Object.defineProperty(this.options,m,b)}}_sanitizeAndValidateOption(S,v){switch(S){case"cursorStyle":if(v||(v=o.DEFAULT_OPTIONS[S]),!(function(m){return m==="block"||m==="underline"||m==="bar"})(v))throw new Error(`"${v}" is not a valid value for ${S}`);break;case"wordSeparator":v||(v=o.DEFAULT_OPTIONS[S]);break;case"fontWeight":case"fontWeightBold":if(typeof v=="number"&&1<=v&&v<=1e3)break;v=p.includes(v)?v:o.DEFAULT_OPTIONS[S];break;case"cursorWidth":v=Math.floor(v);case"lineHeight":case"tabStopWidth":if(v<1)throw new Error(`${S} cannot be less than 1, value: ${v}`);break;case"minimumContrastRatio":v=Math.max(1,Math.min(21,Math.round(10*v)/10));break;case"scrollback":if((v=Math.min(v,4294967295))<0)throw new Error(`${S} cannot be less than 0, value: ${v}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(v<=0)throw new Error(`${S} cannot be less than or equal to 0, value: ${v}`);break;case"rows":case"cols":if(!v&&v!==0)throw new Error(`${S} must be numeric, value: ${v}`);break;case"windowsPty":v=v??{}}return v}}o.OptionsService=f},2660:function(s,o,l){var u=this&&this.__decorate||function(f,x,S,v){var m,b=arguments.length,w=b<3?x:v===null?v=Object.getOwnPropertyDescriptor(x,S):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(f,x,S,v);else for(var _=f.length-1;_>=0;_--)(m=f[_])&&(w=(b<3?m(w):b>3?m(x,S,w):m(x,S))||w);return b>3&&w&&Object.defineProperty(x,S,w),w},c=this&&this.__param||function(f,x){return function(S,v){x(S,v,f)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OscLinkService=void 0;const d=l(2585);let p=o.OscLinkService=class{constructor(f){this._bufferService=f,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(f){const x=this._bufferService.buffer;if(f.id===void 0){const _=x.addMarker(x.ybase+x.y),T={data:f,id:this._nextId++,lines:[_]};return _.onDispose((()=>this._removeMarkerFromLink(T,_))),this._dataByLinkId.set(T.id,T),T.id}const S=f,v=this._getEntryIdKey(S),m=this._entriesWithId.get(v);if(m)return this.addLineToLink(m.id,x.ybase+x.y),m.id;const b=x.addMarker(x.ybase+x.y),w={id:this._nextId++,key:this._getEntryIdKey(S),data:S,lines:[b]};return b.onDispose((()=>this._removeMarkerFromLink(w,b))),this._entriesWithId.set(w.key,w),this._dataByLinkId.set(w.id,w),w.id}addLineToLink(f,x){const S=this._dataByLinkId.get(f);if(S&&S.lines.every((v=>v.line!==x))){const v=this._bufferService.buffer.addMarker(x);S.lines.push(v),v.onDispose((()=>this._removeMarkerFromLink(S,v)))}}getLinkData(f){var x;return(x=this._dataByLinkId.get(f))==null?void 0:x.data}_getEntryIdKey(f){return`${f.id};;${f.uri}`}_removeMarkerFromLink(f,x){const S=f.lines.indexOf(x);S!==-1&&(f.lines.splice(S,1),f.lines.length===0&&(f.data.id!==void 0&&this._entriesWithId.delete(f.key),this._dataByLinkId.delete(f.id)))}};o.OscLinkService=p=u([c(0,d.IBufferService)],p)},8343:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.createDecorator=o.getServiceDependencies=o.serviceRegistry=void 0;const l="di$target",u="di$dependencies";o.serviceRegistry=new Map,o.getServiceDependencies=function(c){return c[u]||[]},o.createDecorator=function(c){if(o.serviceRegistry.has(c))return o.serviceRegistry.get(c);const d=function(p,f,x){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(S,v,m){v[l]===v?v[u].push({id:S,index:m}):(v[u]=[{id:S,index:m}],v[l]=v)})(d,p,x)};return d.toString=()=>c,o.serviceRegistry.set(c,d),d}},2585:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.IDecorationService=o.IUnicodeService=o.IOscLinkService=o.IOptionsService=o.ILogService=o.LogLevelEnum=o.IInstantiationService=o.ICharsetService=o.ICoreService=o.ICoreMouseService=o.IBufferService=void 0;const u=l(8343);var c;o.IBufferService=(0,u.createDecorator)("BufferService"),o.ICoreMouseService=(0,u.createDecorator)("CoreMouseService"),o.ICoreService=(0,u.createDecorator)("CoreService"),o.ICharsetService=(0,u.createDecorator)("CharsetService"),o.IInstantiationService=(0,u.createDecorator)("InstantiationService"),(function(d){d[d.TRACE=0]="TRACE",d[d.DEBUG=1]="DEBUG",d[d.INFO=2]="INFO",d[d.WARN=3]="WARN",d[d.ERROR=4]="ERROR",d[d.OFF=5]="OFF"})(c||(o.LogLevelEnum=c={})),o.ILogService=(0,u.createDecorator)("LogService"),o.IOptionsService=(0,u.createDecorator)("OptionsService"),o.IOscLinkService=(0,u.createDecorator)("OscLinkService"),o.IUnicodeService=(0,u.createDecorator)("UnicodeService"),o.IDecorationService=(0,u.createDecorator)("DecorationService")},1480:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeService=void 0;const u=l(8460),c=l(225);class d{static extractShouldJoin(f){return(1&f)!=0}static extractWidth(f){return f>>1&3}static extractCharKind(f){return f>>3}static createPropertyValue(f,x,S=!1){return(16777215&f)<<3|(3&x)<<1|(S?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new u.EventEmitter,this.onChange=this._onChange.event;const f=new c.UnicodeV6;this.register(f),this._active=f.version,this._activeProvider=f}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(f){if(!this._providers[f])throw new Error(`unknown Unicode version "${f}"`);this._active=f,this._activeProvider=this._providers[f],this._onChange.fire(f)}register(f){this._providers[f.version]=f}wcwidth(f){return this._activeProvider.wcwidth(f)}getStringCellWidth(f){let x=0,S=0;const v=f.length;for(let m=0;m<v;++m){let b=f.charCodeAt(m);if(55296<=b&&b<=56319){if(++m>=v)return x+this.wcwidth(b);const T=f.charCodeAt(m);56320<=T&&T<=57343?b=1024*(b-55296)+T-56320+65536:x+=this.wcwidth(T)}const w=this.charProperties(b,S);let _=d.extractWidth(w);d.extractShouldJoin(w)&&(_-=d.extractWidth(S)),x+=_,S=w}return x}charProperties(f,x){return this._activeProvider.charProperties(f,x)}}o.UnicodeService=d}},n={};function i(s){var o=n[s];if(o!==void 0)return o.exports;var l=n[s]={exports:{}};return r[s].call(l.exports,l,l.exports,i),l.exports}var a={};return(()=>{var s=a;Object.defineProperty(s,"__esModule",{value:!0}),s.Terminal=void 0;const o=i(9042),l=i(3236),u=i(844),c=i(5741),d=i(8285),p=i(7975),f=i(7090),x=["cols","rows"];class S extends u.Disposable{constructor(m){super(),this._core=this.register(new l.Terminal(m)),this._addonManager=this.register(new c.AddonManager),this._publicOptions={...this._core.options};const b=_=>this._core.options[_],w=(_,T)=>{this._checkReadonlyOptions(_),this._core.options[_]=T};for(const _ in this._core.options){const T={get:b.bind(this,_),set:w.bind(this,_)};Object.defineProperty(this._publicOptions,_,T)}}_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 p.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new f.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 d.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const m=this._core.coreService.decPrivateModes;let b="none";switch(this._core.coreMouseService.activeProtocol){case"X10":b="x10";break;case"VT200":b="vt200";break;case"DRAG":b="drag";break;case"ANY":b="any"}return{applicationCursorKeysMode:m.applicationCursorKeys,applicationKeypadMode:m.applicationKeypad,bracketedPasteMode:m.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:b,originMode:m.origin,reverseWraparoundMode:m.reverseWraparound,sendFocusMode:m.sendFocus,wraparoundMode:m.wraparound}}get options(){return this._publicOptions}set options(m){for(const b in m)this._publicOptions[b]=m[b]}blur(){this._core.blur()}focus(){this._core.focus()}input(m,b=!0){this._core.input(m,b)}resize(m,b){this._verifyIntegers(m,b),this._core.resize(m,b)}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,b,w){this._verifyIntegers(m,b,w),this._core.select(m,b,w)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(m,b){this._verifyIntegers(m,b),this._core.selectLines(m,b)}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,b){this._core.write(m,b)}writeln(m,b){this._core.write(m),this._core.write(`\r
|
|
388
|
+
`,b)}paste(m){this._core.paste(m)}refresh(m,b){this._verifyIntegers(m,b),this._core.refresh(m,b)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(m){this._addonManager.loadAddon(this,m)}static get strings(){return o}_verifyIntegers(...m){for(const b of m)if(b===1/0||isNaN(b)||b%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...m){for(const b of m)if(b&&(b===1/0||isNaN(b)||b%1!=0||b<0))throw new Error("This API only accepts positive integers")}}s.Terminal=S})(),a})()))})(Jg)),Jg.exports}var FC=hj(),ev={exports:{}},o2;function fj(){return o2||(o2=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 a=this._terminal._core;this._terminal.rows===i.rows&&this._terminal.cols===i.cols||(a._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,a=i._renderService.dimensions;if(a.css.cell.width===0||a.css.cell.height===0)return;const s=this._terminal.options.scrollback===0?0:i.viewport.scrollBarWidth,o=window.getComputedStyle(this._terminal.element.parentElement),l=parseInt(o.getPropertyValue("height")),u=Math.max(0,parseInt(o.getPropertyValue("width"))),c=window.getComputedStyle(this._terminal.element),d=l-(parseInt(c.getPropertyValue("padding-top"))+parseInt(c.getPropertyValue("padding-bottom"))),p=u-(parseInt(c.getPropertyValue("padding-right"))+parseInt(c.getPropertyValue("padding-left")))-s;return{cols:Math.max(2,Math.floor(p/a.css.cell.width)),rows:Math.max(1,Math.floor(d/a.css.cell.height))}}}})(),r})()))})(ev)),ev.exports}var zC=fj();function $C({cwd:t,cmd:e,governed:r=!0,initialInput:n}){const i=K.useRef(null),a=K.useRef({cwd:t,cmd:e,governed:r,initialInput:n});return a.current={cwd:t,cmd:e,governed:r,initialInput:n},K.useEffect(()=>{const s=i.current;if(!s)return;let o=!1,l,u;const c=new FC.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"}}),d=new zC.FitAddon;c.loadAddon(d);const p=c.onData(S=>{l&&l.readyState===WebSocket.OPEN&&l.send(S)}),f=typeof ResizeObserver<"u"?new ResizeObserver(()=>{try{d.fit()}catch{}u&&Ue.resizeTerminal(u,c.cols,c.rows).catch(()=>{})}):void 0,x=requestAnimationFrame(()=>{if(!o){c.open(s);try{d.fit()}catch{}f==null||f.observe(s),(async()=>{const S=a.current;let v;try{const w={cwd:S.cwd,cols:c.cols,rows:c.rows,governed:S.governed};S.cmd!==void 0&&(w.cmd=S.cmd),v=(await Ue.openTerminal(w)).id}catch(w){const _=w instanceof Error?w.message:String(w);c.write(`\r
|
|
389
|
+
\x1B[31m[failed to open terminal: ${_}]\x1B[0m\r
|
|
390
|
+
`);return}if(o){Ue.closeTerminal(v).catch(()=>{});return}u=v;const m=new WebSocket(lS(v));m.binaryType="arraybuffer";const b=a.current.initialInput;b!==void 0&&b.length>0&&(m.readyState===WebSocket.OPEN?m.send(b):m.onopen=()=>m.send(b)),m.onmessage=w=>{typeof w.data=="string"?c.write(w.data):c.write(new Uint8Array(w.data))},l=m})()}});return()=>{o=!0,cancelAnimationFrame(x),f==null||f.disconnect(),p.dispose();try{l==null||l.close()}catch{}u&&Ue.closeTerminal(u).catch(()=>{}),c.dispose()}},[]),y.jsxs("div",{"data-testid":"terminal",className:"flex flex-col gap-1",children:[y.jsxs("div",{className:"flex items-center justify-between text-[11px]",children:[y.jsx("span",{className:"font-semibold font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Terminal"}),y.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"})]}),y.jsx("div",{ref:i,"data-testid":"terminal-host",className:"h-64 w-full overflow-hidden rounded p-1",style:{background:"#0d1117"}})]})}function Tl({label:t,value:e,mono:r}){return y.jsxs("div",{className:"flex gap-2 text-[11px]",children:[y.jsx("span",{className:"w-20 shrink-0 font-mono",style:{color:"rgba(230,237,243,0.4)"},children:t}),y.jsx("span",{className:r?"font-mono break-all":"",style:{color:"rgba(230,237,243,0.7)"},children:e})]})}function pj({model:t}){const{session:e}=t;return y.jsxs("div",{"data-testid":"what-where",className:"flex flex-col gap-1.5",children:[y.jsx(Tl,{label:"intent",value:e.problem}),y.jsx(Tl,{label:"repo",value:e.repo_ref??"—",mono:!0}),y.jsx(Tl,{label:"worktree",value:e.workdir??"—",mono:!0}),y.jsx(Tl,{label:"roster",value:e.clis.length>0?e.clis.join(", "):"—",mono:!0}),y.jsx(Tl,{label:"entity",value:e.entity_mode}),y.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 (",y.jsx("code",{children:"work_output"})," pending daemon surface)"]})]})}const gj=[{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"}],vj=new Set(["Write","Edit","MultiEdit","NotebookEdit"]),mj=new Set(["DeleteFile","Remove"]);function tv({path:t,opKind:e,runId:r}){const[n,i]=K.useState(null),a=K.useRef(null);K.useEffect(()=>()=>{a.current!==null&&clearTimeout(a.current)},[]);const s=t.replace(/\\/g,"/").split("/"),o=s.pop()??t,l=s.length>0?`${s.join("/")}/`:"",u=e==="delete"?"−":e==="write"?"±":"~",c=e==="delete"?"#f85149":e==="write"?"#ffda19":"rgba(230,237,243,0.25)",d=e==="delete"?"#f85149":"#e6edf3";function p(S){i(S),a.current!==null&&clearTimeout(a.current),a.current=setTimeout(()=>{i(null),a.current=null},2e3)}function f(){navigator.clipboard.writeText(t).then(()=>{p("copied")}).catch(()=>{})}function x(){Ue.openPath(t,r).then(()=>p("opened")).catch(()=>{navigator.clipboard.writeText(t).catch(()=>{}),p("open-failed")})}return y.jsxs("li",{title:t,className:"flex items-start gap-1.5 min-w-0",children:[y.jsx("span",{className:"shrink-0 mt-0.5 text-[9px] font-mono select-none",style:{color:c},children:u}),y.jsxs("button",{type:"button",onClick:x,className:"min-w-0 flex-1 leading-5 font-mono text-[10px] break-all text-left transition-opacity hover:opacity-70",title:`Open with system default app: ${t}`,style:{background:"none",border:"none",padding:0,cursor:"pointer"},children:[l&&y.jsx("span",{style:{color:"rgba(230,237,243,0.3)"},children:l}),y.jsx("span",{style:{color:d},children:o}),n==="opened"&&y.jsx("span",{className:"ml-1 text-[9px]",style:{color:"#3fb950"},children:"✓ opened"}),n==="copied"&&y.jsx("span",{className:"ml-1 text-[9px]",style:{color:"#3fb950"},children:"✓ copied"}),n==="open-failed"&&y.jsx("span",{className:"ml-1 text-[9px]",style:{color:"#ffda19"},children:"open unavailable — path copied"})]}),y.jsx("button",{type:"button",onClick:f,"aria-label":`Copy path ${t}`,title:"Copy path",className:"shrink-0 mt-0.5 text-[9px] font-mono leading-5 transition-opacity hover:opacity-70",style:{background:"none",border:"none",padding:0,cursor:"pointer",color:"rgba(230,237,243,0.35)"},children:"⧉"})]})}function yj({model:t}){const e=t.session.id,r=new Set,n=new Set;for(const x of t.units)for(const S of x.hookFires)vj.has(S.toolName)&&r.add(x.ord),mj.has(S.toolName)&&n.add(x.ord);const i=new Set,a=new Set,s=new Set;for(const x of t.units)for(const S of x.filesRead)s.add(S),n.has(x.ord)?a.add(S):r.has(x.ord)&&i.add(S);for(const x of a)i.delete(x);const o=new Set;for(const x of s)!i.has(x)&&!a.has(x)&&o.add(x);const l=i.size>0||a.size>0,u=s.size>0,c=!["completed","cancelled","failed"].includes(t.session.status);if(!u)return y.jsx("p",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.35)"},children:c?"No files changed yet.":"No files changed."});const d=[...i].sort(),p=[...a].sort(),f=[...o].sort();return y.jsxs("div",{className:"flex flex-col gap-4",children:[(l||c)&&y.jsxs("div",{children:[y.jsx("p",{className:"text-[10px] font-mono mb-2 uppercase tracking-wider",style:{color:"rgba(230,237,243,0.3)"},children:"Modified / Created"}),l?y.jsxs("ul",{className:"flex flex-col gap-1",children:[d.map(x=>y.jsx(tv,{path:x,opKind:"write",runId:e},x)),p.map(x=>y.jsx(tv,{path:x,opKind:"delete",runId:e},x))]}):y.jsx("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.3)"},children:"No files changed yet."})]}),f.length>0&&y.jsxs("div",{children:[y.jsx("p",{className:"text-[10px] font-mono mb-2 uppercase tracking-wider",style:{color:"rgba(230,237,243,0.3)"},children:"Referenced"}),y.jsx("ul",{className:"flex flex-col gap-1",children:f.map(x=>y.jsx(tv,{path:x,runId:e},x))})]}),y.jsxs("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.2)"},children:[s.size," file",s.size!==1?"s":""," total"]})]})}function xj({view:t}){const[e,r]=K.useState(!1),[n,i]=K.useState("whatwhere"),[a,s]=K.useState(!1),[o,l]=K.useState(!1),{session:u}=t,c=XO(u.id,t),d=c?new Set(c.units.flatMap(f=>f.filesRead)).size:null;function p(f){i(x=>x===f?null:f)}return e?y.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:[y.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:"‹"}),y.jsx("button",{type:"button",onClick:()=>s(!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:"⬛"}),y.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:"%"})]}):y.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:[y.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:[y.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:[y.jsx("span",{className:"text-sm leading-none shrink-0",style:{color:"rgba(230,237,243,0.35)"},children:"›"}),y.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-widest font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Insights"})]}),y.jsx("button",{type:"button",onClick:()=>s(!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"}),y.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"})]}),y.jsx("div",{className:"flex-1 overflow-y-auto",children:gj.map(({id:f,label:x})=>y.jsxs("div",{style:{borderBottom:"1px solid rgba(230,237,243,0.06)"},children:[y.jsxs("button",{type:"button",onClick:()=>p(f),className:"w-full flex items-center justify-between px-4 py-2.5 text-left transition-colors",style:{color:n===f?"#e6edf3":"rgba(230,237,243,0.55)"},onMouseEnter:S=>{S.currentTarget.style.background="rgba(230,237,243,0.04)"},onMouseLeave:S=>{S.currentTarget.style.background="transparent"},"aria-expanded":n===f,children:[y.jsxs("div",{className:"flex items-center gap-1.5",children:[y.jsx("span",{className:"text-xs font-medium font-mono",children:x}),f==="files"&&d!==null&&d>0&&y.jsx("span",{className:"text-[9px] font-mono px-1 py-0.5 rounded",style:{background:"rgba(121,192,255,0.12)",color:"#79c0ff"},children:d})]}),y.jsx("span",{className:"text-xs",style:{color:"rgba(230,237,243,0.3)"},children:n===f?"▲":"▼"})]}),n===f&&c&&y.jsxs("div",{className:"px-4 py-3",style:{background:"#0a0d12"},children:[f==="decisions"&&y.jsx(sj,{model:c}),f==="governance"&&y.jsx(uj,{model:c}),f==="burn"&&y.jsx(rj,{model:c}),f==="data"&&y.jsx(nj,{model:c}),f==="steering"&&y.jsx(dj,{runId:c.session.id}),f==="whatwhere"&&y.jsx(pj,{model:c}),f==="assumptions"&&y.jsx(JO,{model:c}),f==="files"&&y.jsx(yj,{model:c})]}),n===f&&!c&&y.jsx("div",{className:"px-4 py-3",children:y.jsx("p",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.35)"},children:"Loading…"})})]},f))}),a&&y.jsx(Kv,{title:"Operator shell",onClose:()=>s(!1),disableEscapeKey:!0,children:y.jsx($C,{cwd:u.workdir??".",governed:!0})}),o&&y.jsx(Kv,{title:"Coverage report",onClose:()=>l(!1),children:y.jsx(fS,{})})]})}const HC={critical:"#f85149",error:"#f97316",warn:"#ffda19",info:"rgba(230,237,243,0.5)"},bj={id:"",rule_type:"pattern",statement:"",severity:"warn",confidence:.9,targets:{},provenance:{source:"manual",source_kinds:["policy"]}};function wj({rule:t,onEdit:e}){var r,n,i;return y.jsxs("tr",{className:"text-[11px]",style:{borderBottom:"1px solid rgba(230,237,243,0.06)"},children:[y.jsx("td",{className:"px-3 py-2 font-mono",style:{color:"rgba(230,237,243,0.7)"},children:t.id}),y.jsx("td",{className:"px-3 py-2",style:{color:"rgba(230,237,243,0.45)"},children:t.rule_type}),y.jsx("td",{className:"px-3 py-2",children:y.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:HC[t.severity]??"rgba(230,237,243,0.5)"},children:t.severity})}),y.jsx("td",{className:"px-3 py-2 truncate max-w-xs",style:{color:"rgba(230,237,243,0.6)"},children:t.statement}),y.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(" / ")||"—"}),y.jsx("td",{className:"px-3 py-2",children:y.jsx("button",{type:"button",onClick:()=>e(t),className:"text-[10px] hover:underline",style:{color:"#79c0ff"},children:"Edit"})})]})}function Sj(){const[t,e]=K.useState([]),[r,n]=K.useState(!0),[i,a]=K.useState(null),[s,o]=K.useState(""),[l,u]=K.useState(null),[c,d]=K.useState("idle"),[p,f]=K.useState(null),[x,S]=K.useState({}),[v,m]=K.useState(null),[b,w]=K.useState(!1),[_,T]=K.useState(null),N=K.useCallback(async()=>{n(!0),a(null);try{const{rules:O}=await Ue.listConformanceRules();e(O)}catch(O){a(O instanceof Error?O.message:String(O))}finally{n(!1)}},[]);K.useEffect(()=>{N()},[N]);const E=O=>{o(JSON.stringify(O??bj,null,2)),u(null),d("idle"),f(null)},k=O=>{o(O);try{JSON.parse(O),u(null)}catch($){u($ instanceof Error?$.message:String($))}},L=async()=>{if(l)return;let O;try{O=JSON.parse(s)}catch($){u($ instanceof Error?$.message:String($));return}d("saving"),f(null);try{await Ue.upsertConformanceRule(O),d("ok"),await N()}catch($){d("error"),f($ instanceof Error?$.message:String($))}},A=async()=>{w(!0),T(null);try{const{rules:O}=await Ue.recallRulesPreview(x);m(O)}catch(O){T(O instanceof Error?O.message:String(O)),m(null)}finally{w(!1)}},M=(O,$)=>y.jsx("input",{type:"text","aria-label":O,placeholder:$,value:x[O]??"",onChange:D=>S(B=>({...B,[O]: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 y.jsxs("div",{className:"flex flex-col gap-4",children:[y.jsxs("div",{className:"flex items-center gap-3",children:[y.jsx("h2",{className:"text-sm font-semibold",style:{color:"#e6edf3"},children:"Conformance rules"}),y.jsx("button",{type:"button",onClick:()=>void N(),className:"text-[10px] hover:underline",style:{color:"rgba(230,237,243,0.4)"},children:"Refresh"}),y.jsx("button",{type:"button",onClick:()=>E(),className:"ml-auto rounded px-2 py-1 text-[11px] font-semibold",style:{background:"#ffda19",color:"#0d1117"},children:"+ New rule"})]}),i&&y.jsx("p",{className:"rounded px-2 py-1 text-xs",style:{background:"rgba(248,81,73,0.08)",color:"#f85149"},children:i}),r?y.jsx("p",{className:"text-xs",style:{color:"rgba(230,237,243,0.4)"},children:"Loading rules…"}):y.jsx("div",{className:"overflow-x-auto rounded",style:{border:"1px solid rgba(230,237,243,0.08)"},children:y.jsxs("table",{className:"w-full text-[11px]",children:[y.jsx("thead",{children:y.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:[y.jsx("th",{className:"px-3 py-2 text-left",children:"ID"}),y.jsx("th",{className:"px-3 py-2 text-left",children:"Type"}),y.jsx("th",{className:"px-3 py-2 text-left",children:"Severity"}),y.jsx("th",{className:"px-3 py-2 text-left",children:"Statement"}),y.jsx("th",{className:"px-3 py-2 text-left",children:"Targets"}),y.jsx("th",{className:"px-3 py-2"})]})}),y.jsx("tbody",{children:t.length===0?y.jsx("tr",{children:y.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(O=>y.jsx(wj,{rule:O,onEdit:E},O.id))})]})}),s!==""&&y.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:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("span",{className:"text-[11px] font-semibold",style:{color:"#ffda19"},children:"Rule JSON"}),y.jsx("button",{type:"button",onClick:()=>{o(""),d("idle")},className:"ml-auto text-[10px] hover:underline",style:{color:"rgba(230,237,243,0.4)"},children:"Cancel"})]}),y.jsx("textarea",{"aria-label":"Conformance rule JSON editor",value:s,onChange:O=>k(O.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&&y.jsx("p",{className:"text-[10px]",style:{color:"#f85149"},children:l}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("button",{type:"button",onClick:()=>void L(),disabled:!!l||c==="saving",className:"rounded px-3 py-1 text-[11px] font-semibold disabled:opacity-50",style:{background:"#3fb950",color:"#0d1117"},children:c==="saving"?"Saving…":"Save rule"}),c==="ok"&&y.jsx("span",{className:"text-[10px]",style:{color:"#3fb950"},children:"Saved."}),c==="error"&&y.jsx("span",{className:"text-[10px]",style:{color:"#f85149"},children:p})]})]}),y.jsxs("div",{className:"flex flex-col gap-2 rounded p-3",style:{border:"1px solid rgba(230,237,243,0.08)",background:"#0f1419"},children:[y.jsx("p",{className:"text-[11px] font-semibold",style:{color:"rgba(230,237,243,0.7)"},children:"Preview — which rules apply?"}),y.jsxs("div",{className:"flex flex-wrap gap-2 items-center",children:[M("language","language"),M("layer","layer"),M("framework","framework"),M("severity","severity"),M("rule_type","type"),y.jsx("button",{type:"button",onClick:()=>void A(),disabled:b,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:b?"Loading…":"Preview"})]}),_&&y.jsx("p",{className:"text-[10px]",style:{color:"#f85149"},children:_}),v!==null&&(v.length===0?y.jsx("p",{className:"text-[10px]",style:{color:"rgba(230,237,243,0.4)"},children:"No rules match this query."}):y.jsx("ul",{className:"flex flex-col gap-0.5",children:v.map(O=>y.jsxs("li",{className:"flex items-center gap-2 text-[10px]",children:[y.jsx("span",{className:"inline-flex rounded px-1 text-[9px] font-semibold font-mono",style:{background:"rgba(230,237,243,0.06)",color:HC[O.severity]??"rgba(230,237,243,0.5)"},children:O.severity}),y.jsx("span",{className:"font-mono",style:{color:"rgba(230,237,243,0.6)"},children:O.id}),y.jsx("span",{className:"truncate",style:{color:"rgba(230,237,243,0.45)"},children:O.statement})]},O.id))}))]})]})}function Nl(t,e){return{...t,[e]:(t[e]??0)+1}}const nu=si((t,e)=>({elicitations:{},generations:{},getRunGen:r=>e().generations[r]??0,setElicitation:r=>t(n=>({elicitations:{...n.elicitations,[r.runId]:r},generations:Nl(n.generations,r.runId)})),clearElicitation:r=>t(n=>{const i={...n.elicitations};return delete i[r],{elicitations:i,generations:Nl(n.generations,r)}}),setFromGetIfUnchanged:(r,n,i)=>{let a=!1;return t(s=>{if((s.generations[r]??0)!==n)return s;a=!0;const o={...s.elicitations};return i===null?delete o[r]:o[r]=i,{elicitations:o,generations:Nl(s.generations,r)}}),a},swapFromGet:(r,n,i)=>{let a=!1;return t(s=>{var l;if(((l=s.elicitations[r])==null?void 0:l.elicitationId)!==n)return s;a=!0;const o={...s.elicitations};return i===null?delete o[r]:o[r]=i,{elicitations:o,generations:Nl(s.generations,r)}}),a},ingest:r=>{const n=typeof r.session=="string"?r.session:void 0;if(n!==void 0){if(r.type==="elicitationCreated"){const i=r.elicitationId,a=r.message??r.prompt;if(typeof i!="string"||typeof a!="string")return;e().setElicitation({runId:n,elicitationId:i,message:a,options:Array.isArray(r.options)?r.options:null,receivedAt:new Date().toISOString()});return}(r.type==="elicitationResolved"||r.type==="sessionCompleted"||r.type==="sessionFailed"||r.type==="sessionCancelled")&&e().clearElicitation(n)}},reconcile:r=>{const n=new Set(r);t(i=>{const a=Object.keys(i.elicitations).filter(l=>!n.has(l));if(a.length===0)return i;const s={};for(const[l,u]of Object.entries(i.elicitations))n.has(l)&&(s[l]=u);let o=i.generations;for(const l of a)o=Nl(o,l);return{elicitations:s,generations:o}})}}));function _j({e:t}){const[e,r]=K.useState(""),[n,i]=K.useState(null),[a,s]=K.useState(!1),[o,l]=K.useState(null),u=nu(x=>x.swapFromGet),c=nu(x=>x.clearElicitation),d=n??e.trim(),p=t.options===null?d.length>0:n!==null;async function f(x){s(!0),l(null);try{await Ue.respondToElicitation(t.runId,{elicitationId:t.elicitationId,action:x,...x==="accept"?{content:{response:d}}:{}}),c(t.runId)}catch(S){const v=S instanceof Error?S.message:String(S);if(/\b409\b/.test(v)){let m;try{m=await Ue.getElicitation(t.runId)}catch(w){l(w instanceof Error?w.message:String(w));return}u(t.runId,t.elicitationId,m===null?null:{runId:m.runId,elicitationId:m.elicitationId,message:m.message,options:m.options,receivedAt:m.receivedAt})&&m===null&&l(null)}else l(v)}finally{s(!1)}}return y.jsxs("div",{className:"flex flex-col gap-2 rounded p-3",style:{border:"1px solid rgba(230,237,243,0.12)",background:"#1b222e"},"data-testid":"elicitation-prompt",children:[y.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wider font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Input requested"}),y.jsx("p",{className:"text-sm",style:{color:"#e6edf3"},children:t.message}),t.options===null?y.jsx("input",{type:"text",value:e,disabled:a,onChange:x=>r(x.target.value),placeholder:"Your answer","aria-label":"Your answer",className:"rounded px-2 py-1 text-sm",style:{background:"#161c26",border:"1px solid rgba(230,237,243,0.1)",color:"#e6edf3"}}):y.jsx("div",{className:"flex flex-wrap gap-1",children:t.options.map(x=>y.jsx("button",{type:"button",disabled:a,onClick:()=>i(x),className:"rounded px-2 py-0.5 text-xs font-mono",style:{background:n===x?"rgba(121,192,255,0.15)":"#161c26",border:`1px solid ${n===x?"#79c0ff":"rgba(230,237,243,0.1)"}`,color:"#e6edf3"},children:x},x))}),o!==null&&y.jsx("p",{className:"text-xs",style:{color:"#f85149"},children:o}),y.jsxs("div",{className:"flex gap-2",children:[y.jsx("button",{type:"button",disabled:a||!p,onClick:()=>void f("accept"),className:"rounded px-2 py-0.5 text-xs font-semibold",style:{background:p?"rgba(63,185,80,0.12)":"rgba(230,237,243,0.05)",border:`1px solid ${p?"rgba(63,185,80,0.3)":"rgba(230,237,243,0.1)"}`,color:p?"#3fb950":"rgba(230,237,243,0.3)"},children:"Send"}),y.jsx("button",{type:"button",disabled:a,onClick:()=>void f("decline"),className:"rounded px-2 py-0.5 text-xs",style:{border:"1px solid rgba(230,237,243,0.15)",color:"rgba(230,237,243,0.7)"},children:"Decline"})]})]})}function Cj(t){const e=t.indexOf("[");return e===-1?{headline:t.trim(),footnote:null}:{headline:t.slice(0,e).trim(),footnote:t.slice(e+1,t.lastIndexOf("]")!==-1?t.lastIndexOf("]"):void 0).trim()}}function kj(t){const e=t.behavior_bearing===0?"—":`${(t.coverage*100).toFixed(1)}%`,r=t.behavior_bearing===0?"":` · resolved ${(t.resolved_rate*100).toFixed(0)}%`;return`Coverage: ${e} · ${t.behavior_bearing.toLocaleString()} nodes · ${t.unaccounted} unaccounted${r}`}function l2({runId:t,ord:e,prompt:r,repoRef:n,onResolved:i}){const a=Un(k=>k.clearGate),s=cm(k=>k.record),[o,l]=K.useState(""),[u,c]=K.useState(!1),[d,p]=K.useState(null),[f,x]=K.useState(null),S=K.useRef(null);K.useEffect(()=>{if(window.location.hash!==_S)return;const k=S.current;k!==null&&(k.scrollIntoView({block:"center"}),k.focus({preventScroll:!0}),window.history.replaceState(null,"",window.location.pathname))},[t]),K.useEffect(()=>{n&&Ue.getCoverageReportForRepo(n).then(({report:k})=>{k&&x(k)}).catch(()=>{})},[n]);async function v(k,L){c(!0),p(null);try{await k(),s({runId:t,action:L.kind,...typeof e=="number"?{ord:e}:{},...L.amend!==void 0?{amend:L.amend}:{}}),a(t),i==null||i()}catch(A){p(A instanceof Error?A.message:String(A))}finally{c(!1)}}const m=()=>v(()=>Ue.confirmGate(t,{approve:!0}),{kind:"approve"}),b=()=>{const k=o.trim();if(!k)return Promise.resolve();const L={approve:!0,amend:k};return v(()=>Ue.confirmGate(t,L),{kind:"approve-with-steer",amend:k})},w=()=>v(()=>Ue.confirmGate(t,{approve:!1}),{kind:"reject"}),_=()=>v(()=>Ue.cancelRun(t),{kind:"cancel"}),{headline:T,footnote:N}=Cj(r??"Prompt unavailable (daemon restarted) — you can still approve or reject."),E=T.toLowerCase().includes("not pass")||T.toLowerCase().includes("coverage");return y.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:[y.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[y.jsx("span",{className:"w-2 h-2 rounded-full animate-pulse",style:{background:"#ffda19"}}),y.jsx("p",{className:"font-semibold text-sm font-mono",style:{color:"#ffda19"},children:"Awaiting human decision"})]}),y.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}`:""]}),y.jsx("p",{ref:S,tabIndex:-1,className:"text-xs mb-1 leading-relaxed font-mono",style:{color:"rgba(230,237,243,0.85)",outline:"none"},"data-testid":"steering-prompt",children:T}),E&&f&&y.jsx("p",{className:"text-xs mb-2 font-mono",style:{color:"rgba(96,165,250,0.85)"},children:kj(f)}),N&&y.jsxs("details",{className:"mb-3",children:[y.jsx("summary",{className:"text-[10px] font-mono cursor-pointer select-none",style:{color:"rgba(230,237,243,0.3)"},children:"why this gate fired"}),y.jsx("p",{className:"text-[10px] font-mono mt-1 leading-relaxed",style:{color:"rgba(230,237,243,0.35)"},children:N})]}),y.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:E&&f&&f.unaccounted>0?`${f.unaccounted} nodes unaccounted — add guidance for the evaluator, e.g. "focus on services/ directory"`:"Optional steer — guide the next unit when approving with steer",value:o,onChange:k=>l(k.target.value),disabled:u}),d&&y.jsx("p",{className:"text-xs mb-3 font-mono",style:{color:"#f85149"},"data-testid":"steering-error",children:d}),y.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[y.jsx("button",{"data-testid":"steering-approve",onClick:()=>void m(),disabled:u,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"}),y.jsx("button",{"data-testid":"steering-approve-steer",onClick:()=>void b(),disabled:u||!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 + steer"}),y.jsx("button",{"data-testid":"steering-reject",onClick:()=>void w(),disabled:u,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"}),y.jsx("button",{"data-testid":"steering-cancel",onClick:()=>void _(),disabled:u,className:"rounded-lg px-3 py-2 text-xs font-semibold font-mono disabled:opacity-50 transition-opacity",style:{background:"rgba(139,148,158,0.12)",border:"1px solid rgba(139,148,158,0.25)",color:"rgba(139,148,158,0.9)"},children:"Cancel run"})]}),y.jsx("p",{className:"text-[10px] font-mono mt-2",style:{color:"rgba(230,237,243,0.25)"},children:"Workflow-declared gate — run-level human_confirm setting does not apply here."})]})}const UC={feature:"Feature (6 phases)",bug:"Bug (4 phases)",migration:"Migration (5 phases)"};function Ej(t,e){const r=e.find(n=>n.id===t);return r?`${t.charAt(0).toUpperCase()}${t.slice(1)} (${r.phases.length} phases)`:UC[t]??t}function ro({children:t}){return y.jsx("p",{className:"text-[10px] uppercase tracking-widest font-semibold mb-2",style:{color:"rgba(230,237,243,0.35)"},children:t})}function Rl(){return y.jsx("div",{style:{height:"1px",background:"rgba(230,237,243,0.07)"}})}function Tj({roster:t,selectedClis:e,onToggleCli:r,confirmMode:n,onConfirmModeChange:i,beforeOrd:a,onBeforeOrdChange:s,entityMode:o,onEntityModeChange:l,workflows:u,workflow:c,onWorkflowChange:d,repos:p,repoRefs:f,onRepoRefsChange:x,attachedFiles:S,onFilesChange:v}){const m=K.useRef(null);function b(_){const T=Array.from(_.target.files??[]);v([...S,...T]),_.target.value=""}function w(_){v(S.filter((T,N)=>N!==_))}return y.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:[y.jsxs("div",{className:"px-4 py-3",children:[y.jsx(ro,{children:"Upload files"}),y.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)…"}),y.jsx("input",{ref:m,type:"file",multiple:!0,className:"hidden",onChange:b,"aria-label":"Upload files for knowledge context"}),S.length>0&&y.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:S.map((_,T)=>y.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,y.jsx("button",{type:"button",onClick:()=>w(T),"aria-label":`Remove ${_.name}`,className:"opacity-60 hover:opacity-100 leading-none",children:"×"})]},T))})]}),y.jsx(Rl,{}),y.jsxs("div",{className:"px-4 py-3",children:[y.jsx(ro,{children:"CLIs on/off"}),t.length===0?y.jsx("span",{style:{color:"rgba(230,237,243,0.3)"},children:"No roster loaded"}):y.jsx("div",{className:"flex flex-wrap gap-x-4 gap-y-1.5",children:t.map(_=>{var T;return y.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer",style:{color:"rgba(230,237,243,0.65)"},children:[y.jsx("input",{type:"checkbox",checked:e.has(_.key),onChange:()=>r(_.key),"data-testid":`launch-seat-${_.key}`}),y.jsx("span",{children:_.key}),((T=_.health)==null?void 0:T.status)==="inactive"&&y.jsx("span",{className:"rounded-full border px-1.5 text-[10px] font-mono",style:{color:"#f85149",borderColor:"rgba(248,81,73,0.5)"},title:_.health.message??"marked inactive by the platform","data-testid":`seat-health-${_.key}`,children:"inactive"}),_.signed_in===!1&&y.jsx("span",{className:"rounded-full border px-1.5 text-[10px] font-mono",style:{color:"#f85149",borderColor:"rgba(248,81,73,0.5)"},title:`${_.key} isn't signed in — runs routed there will fall back or fail. Sign in in Settings.`,"data-testid":`seat-signin-${_.key}`,children:"sign in needed"})]},_.key)})})]}),y.jsx(Rl,{}),y.jsxs("div",{className:"px-4 py-3",children:[y.jsx(ro,{children:"Set gate"}),y.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[y.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:[y.jsx("option",{value:"none",children:"None"}),y.jsx("option",{value:"all",children:"Every unit"}),y.jsx("option",{value:"before",children:"Before unit #"})]}),n==="before"&&y.jsx("input",{type:"number",min:1,value:a,onChange:_=>s(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"}})]})]}),y.jsx(Rl,{}),y.jsxs("div",{className:"px-4 py-3",children:[y.jsx(ro,{children:"Set mode"}),y.jsx("div",{className:"flex items-center gap-1.5",children:["shared","isolated"].map(_=>y.jsx("button",{type:"button","data-testid":`launch-entity-${_}`,onClick:()=>l(_),className:"rounded-lg px-3 py-1 capitalize font-medium transition-colors",style:o===_?{background:"rgba(230,237,243,0.12)",color:"#e6edf3"}:{color:"rgba(230,237,243,0.4)"},children:_},_))})]}),y.jsx(Rl,{}),y.jsxs("div",{className:"px-4 py-3",children:[y.jsx(ro,{children:"Choose workflow"}),y.jsxs("select",{"data-testid":"launch-workflow",className:"rounded-lg px-2 py-1 w-full",style:{background:"#0d1117",border:"1px solid rgba(230,237,243,0.14)",color:"#e6edf3"},value:c,onChange:_=>d(_.target.value),children:[y.jsx("option",{value:"",children:"(free-text)"}),(u.length>0?u.map(_=>_.id):Object.keys(UC)).map(_=>y.jsx("option",{value:_,children:Ej(_,u)},_))]})]}),y.jsx(Rl,{}),y.jsxs("div",{className:"px-4 py-3",children:[y.jsx(ro,{children:"Add repos"}),p.length===0?y.jsx("p",{className:"text-[11px] font-mono italic",style:{color:"rgba(230,237,243,0.3)"},children:"No repos registered."}):y.jsx("div",{className:"flex flex-col gap-1.5 max-h-36 overflow-y-auto pr-1",children:p.map(_=>{const T=f.includes(_.id);return y.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:[y.jsx("input",{type:"checkbox","data-testid":`launch-repo-${_.id}`,checked:T,onChange:()=>{x(T?f.filter(N=>N!==_.id):[...f,_.id])},className:"accent-[#ffda19] w-3.5 h-3.5 shrink-0"}),y.jsx("span",{className:"text-[11px] font-mono truncate",style:{color:"#e6edf3"},children:_.name})]},_.id)})})]})]})}const Nj=new Set(["executing","distributing","planning"]);function Rj(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 Lj({label:t,onClear:e}){return y.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,y.jsx("button",{type:"button",onClick:e,"aria-label":`Clear ${t}`,className:"opacity-60 hover:opacity-100 leading-none ml-0.5",children:"×"})]})}const Dj=new Set(["chat","onboarding","survey-repo","domain-graph-slice","memories"]);function WC({runId:t,runStatus:e,onLaunched:r,embedded:n,workflowOverride:i,mode:a,injectTarget:s,onClearInjectTarget:o,navigate:l}){const u=Un(de=>de.clearGate),[c,d]=K.useState(""),[p,f]=K.useState(!1),[x,S]=K.useState(null),v=K.useRef(null),[m,b]=K.useState(""),[w,_]=K.useState(!1),[T,N]=K.useState(null),E=K.useRef(!1),[k,L]=K.useState(""),[A,M]=K.useState(""),[O,$]=K.useState([]),[D,B]=K.useState([]),j=K.useMemo(()=>D.filter(de=>!de.is_system&&!Dj.has(de.id)),[D]),[I,U]=K.useState(new Set),[F,P]=K.useState([]),[H,W]=K.useState([]),[V,re]=K.useState("shared"),[J,ne]=K.useState("none"),[X,q]=K.useState(1),[Y,Q]=K.useState([]),[te,ie]=K.useState(!1),[le,pe]=K.useState(0),[Le,je]=K.useState(null),[Se,Te]=K.useState(null),[Ae,Ne]=K.useState(!1),[Pe,ze]=K.useState(!1),Ie=K.useRef(null),$e=K.useRef(null),Ge=K.useRef(null);K.useEffect(()=>{Ue.getRoster().then(({roster:de})=>{$(de);try{const me=localStorage.getItem("wicked_default_clis");if(me){U(new Set(JSON.parse(me)));return}}catch{}U(new Set(de.filter(me=>me.enabled_for_council).map(me=>me.key)))}).catch(()=>{}),Ue.listRepos().then(({repos:de})=>P(de)).catch(()=>{}),Ue.listWorkflows().then(({workflows:de})=>B(de)).catch(()=>{})},[]),K.useEffect(()=>(te?(pe(0),$e.current=setInterval(()=>pe(de=>de+1),1e3)):($e.current!==null&&(clearInterval($e.current),$e.current=null),pe(0)),()=>{$e.current!==null&&(clearInterval($e.current),$e.current=null)}),[te]),K.useEffect(()=>{const de=Ge.current;if(!de)return;de.style.height="auto";const me=100;de.style.height=`${Math.min(de.scrollHeight,me)}px`},[k]),K.useEffect(()=>{if(!k.trim()||A||i){Te(null);return}Te(Rj(k))},[k,A,i]),K.useEffect(()=>{if(!Pe)return;function de(me){Ie.current&&!Ie.current.contains(me.target)&&ze(!1)}return document.addEventListener("click",de),()=>document.removeEventListener("click",de)},[Pe]),K.useEffect(()=>{if(!Pe)return;function de(me){me.key==="Escape"&&ze(!1)}return document.addEventListener("keydown",de),()=>document.removeEventListener("keydown",de)},[Pe]);function ve(de){U(me=>{const ke=new Set(me);return ke.has(de)?ke.delete(de):ke.add(de),ke})}function Ee(){U(new Set(O.filter(de=>de.enabled_for_council).map(de=>de.key)))}async function Me(){if(!k.trim()||I.size===0||te)return;ie(!0),je(null);const de={problem:k.trim()},me=O.filter(Ce=>I.has(Ce.key));me.length>0&&(de.clisJson=JSON.stringify(me)),de.entityMode=V,a==="ask"?de.humanConfirm="all":a!=="autonomous"&&(J==="all"?de.humanConfirm="all":J==="before"&&(de.humanConfirm=`before:${X}`));const ke=H[0];ke&&(de.repoRef=ke);const Re=(i==null?void 0:i.trim())||A;Re&&(de.workflow=Re);try{const{runId:Ce}=await Ue.launchRun(de);L(""),r(Ce)}catch(Ce){je(Ce instanceof Error?Ce.message:String(Ce))}finally{ie(!1)}}async function ye(){const de=c.trim();if(!(!de||!t)){f(!0),S(null);try{await Ue.confirmGate(t,{approve:!0,amend:de}),d(""),u(t)}catch(me){S(me instanceof Error?me.message:String(me))}finally{f(!1)}}}async function ee(){const de=m.trim();if(!de||!t||E.current)return;E.current=!0,_(!0),N(null);const me=(s==null?void 0:s.trim())||"all";try{await Ue.injectMessage(t,de,me),b("")}catch(ke){N(ke instanceof Error?ke.message:String(ke))}finally{E.current=!1,_(!1)}}if(t){if(e==="awaiting_human"){const de=c.trim().length>0&&!p;return y.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:[x&&y.jsx("p",{className:"text-[11px] font-mono",style:{color:"#f85149"},children:x}),y.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:[y.jsx("textarea",{ref:v,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:c,onChange:me=>d(me.target.value),onKeyDown:me=>{me.key==="Enter"&&(me.metaKey||me.ctrlKey)&&(me.preventDefault(),ye())},disabled:p,rows:1}),y.jsx("button",{type:"button",onClick:()=>void ye(),disabled:!de,className:"shrink-0 rounded-xl px-4 py-2 text-sm font-semibold transition-opacity disabled:opacity-40",style:{background:"#ffda19",color:"#0d1117"},children:p?"…":"Steer →"})]}),y.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&&Nj.has(e)){const de=m.trim().length>0&&!w,me=(s==null?void 0:s.trim())||"all",ke=me!=="all",Re=ke?me:"all agents";return y.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:[T&&y.jsx("p",{className:"text-[11px] font-mono",style:{color:"#f85149"},children:T}),y.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:[y.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 ${Re}…`,value:m,onChange:Ce=>b(Ce.target.value),onKeyDown:Ce=>{Ce.key==="Enter"&&(Ce.metaKey||Ce.ctrlKey)&&(Ce.preventDefault(),ee())},disabled:w,rows:1}),y.jsx("button",{type:"button",onClick:()=>void ee(),disabled:!de,className:"shrink-0 rounded-xl px-4 py-2 text-sm font-semibold transition-opacity disabled:opacity-40",style:{background:"#ffda19",color:"#0d1117"},children:w?"…":"Send →"})]}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsxs("span",{"data-testid":"steering-live-chip",className:"flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-[10px] font-mono shrink-0",style:{background:"rgba(121,192,255,0.08)",color:"#79c0ff",border:"1px solid rgba(121,192,255,0.2)"},children:[y.jsx("span",{className:"inline-block w-1 h-1 rounded-full animate-pulse",style:{background:"#79c0ff"}}),"steering live run"]}),y.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"}),ke&&y.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:["→ ",me,o&&y.jsx("button",{type:"button",onClick:o,"aria-label":"Clear target, broadcast to all",className:"opacity-60 hover:opacity-100 leading-none ml-0.5",children:"×"})]})]})]})}return y.jsx("div",{className:"px-5 py-4 shrink-0",style:{borderTop:"1px solid rgba(230,237,243,0.07)",background:"#161c26"},children:y.jsx("div",{className:"rounded-2xl px-5 py-4",style:{border:"1px solid rgba(230,237,243,0.1)",background:"#1b222e"},children:y.jsx("p",{className:"text-sm italic font-mono",style:{color:"rgba(230,237,243,0.35)"},children:"Steer at the next gate."})})})}const ue=k.trim().length>0&&I.size>0&&!te,ae=Se!==null&&!Ae&&!A&&!i,se=O.filter(de=>I.has(de.key)&&de.signed_in===!1),ce=new Set(O.filter(de=>de.enabled_for_council).map(de=>de.key)),be=I.size!==ce.size||[...I].some(de=>!ce.has(de)),he=[];Y.length>0&&he.push({label:`${Y.length} file${Y.length!==1?"s":""} attached`,onClear:()=>Q([])}),J!=="none"&&he.push({label:J==="all"?"Gate: every unit":`Gate: before #${X}`,onClear:()=>ne("none")}),V==="isolated"&&he.push({label:"Mode: isolated",onClear:()=>re("shared")}),A&&he.push({label:`Workflow: ${A}`,onClear:()=>{M(""),Ne(!0)}});for(const de of H){const me=F.find(ke=>ke.id===de);he.push({label:`Repo: ${(me==null?void 0:me.name)??de}`,onClear:()=>W(ke=>ke.filter(Re=>Re!==de))})}return be&&O.length>0&&he.push({label:`CLIs: ${[...I].join(", ")}`,onClear:Ee}),y.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:[ae&&y.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:[y.jsxs("span",{children:["Detected: ",y.jsx("strong",{style:{color:"#ffda19"},children:Se})," workflow"]}),y.jsx("button",{type:"button",onClick:()=>{M(Se),Ne(!0)},className:"rounded-lg px-3 py-1 font-semibold text-xs",style:{background:"#ffda19",color:"#0d1117"},children:"Apply"}),y.jsx("button",{type:"button",onClick:()=>Ne(!0),className:"ml-auto",style:{color:"rgba(230,237,243,0.35)"},children:"✕"})]}),se.length>0&&y.jsxs("div",{"data-testid":"signin-warning",className:"flex items-center gap-2 text-xs rounded-xl px-4 py-2 font-mono",style:{background:"rgba(248,81,73,0.08)",border:"1px solid rgba(248,81,73,0.3)",color:"#f85149"},children:[y.jsxs("span",{className:"flex-1",children:["⚠ ",se.map(de=>de.key).join(", ")," ",se.length===1?"isn't":"aren't"," signed in — runs routed there will fall back or fail. Sign in in Settings."]}),y.jsx("button",{type:"button",onClick:()=>l==null?void 0:l("/system"),className:"rounded-lg px-3 py-1 font-semibold text-xs shrink-0",style:{background:"rgba(248,81,73,0.15)",color:"#f85149",border:"1px solid rgba(248,81,73,0.35)"},children:"Open Settings"})]}),y.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:[y.jsxs("div",{className:"relative shrink-0",ref:Ie,children:[Pe&&y.jsx("div",{style:{position:"absolute",bottom:"calc(100% + 10px)",left:0,zIndex:50},children:y.jsx(Tj,{roster:O,selectedClis:I,onToggleCli:ve,confirmMode:J,onConfirmModeChange:ne,beforeOrd:X,onBeforeOrdChange:q,entityMode:V,onEntityModeChange:re,workflows:j,workflow:A,onWorkflowChange:de=>{M(de),Ne(!0)},repos:F,repoRefs:H,onRepoRefsChange:W,attachedFiles:Y,onFilesChange:Q})}),y.jsx("button",{type:"button","aria-label":"Open launch options","aria-expanded":Pe,"aria-haspopup":"dialog",onClick:()=>ze(de=>!de),className:"w-7 h-7 rounded-full flex items-center justify-center text-base font-light transition-all",style:Pe?{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:"+"})]}),y.jsx("textarea",{ref:Ge,"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:k,onChange:de=>{L(de.target.value),Ne(!1)},onKeyDown:de=>{de.key==="Enter"&&(de.metaKey||de.ctrlKey)&&(de.preventDefault(),Me())},disabled:te,rows:1}),y.jsx("button",{type:"button","data-testid":"launch-submit",onClick:()=>void Me(),disabled:!ue,"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:te?`${le}s`:"Send"})]}),he.length>0&&y.jsx("div",{className:"flex flex-wrap gap-1.5 px-1",children:he.map((de,me)=>y.jsx(Lj,{label:de.label,onClear:de.onClear},me))}),Le&&y.jsx("p",{className:"text-xs px-1 font-mono",style:{color:"#f85149"},"data-testid":"launch-error",children:Le}),te&&le>=5&&y.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 Aj({terminalId:t,cliKey:e,onClose:r}){const n=K.useRef(null),i=K.useRef(t);return i.current=t,K.useEffect(()=>{const a=n.current;if(!a)return;let s=!1;const o=new FC.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 zC.FitAddon;o.loadAddon(l),o.open(a);try{l.fit()}catch{}const u=new WebSocket(lS(i.current));u.binaryType="arraybuffer",u.onmessage=d=>{typeof d.data=="string"?o.write(d.data):o.write(new Uint8Array(d.data))},u.onerror=()=>{s||o.write(`\r
|
|
391
|
+
\x1B[31m[terminal connection error]\x1B[0m\r
|
|
392
|
+
`)},u.onclose=()=>{s||o.write(`\r
|
|
393
|
+
\x1B[90m[agent session ended]\x1B[0m\r
|
|
394
|
+
`)};const c=typeof ResizeObserver<"u"?new ResizeObserver(()=>{try{l.fit()}catch{}}):void 0;return c==null||c.observe(a),()=>{s=!0,c==null||c.disconnect();try{u.close()}catch{}o.dispose()}},[t]),y.jsxs("div",{className:"flex flex-col rounded-xl overflow-hidden",style:{background:"#0d1117",border:"1px solid rgba(230,237,243,0.08)"},children:[y.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:[y.jsxs("span",{className:"text-[11px] font-mono font-semibold",style:{color:"rgba(230,237,243,0.5)"},children:[e," ",y.jsx("span",{style:{color:"rgba(230,237,243,0.3)",fontWeight:400},children:"· observer"})]}),y.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:"×"})]}),y.jsx("div",{ref:n,className:"h-56 w-full overflow-hidden p-1"})]})}function Pj(t,e){const r={};return(t[t.length-1]===""?[...t,""]:t).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const Mj=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Oj=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,jj={};function u2(t,e){return(jj.jsx?Oj:Mj).test(t)}const Ij=/[ \t\n\f\r]/g;function Bj(t){return typeof t=="object"?t.type==="text"?c2(t.value):!1:c2(t)}function c2(t){return t.replace(Ij,"")===""}class xu{constructor(e,r,n){this.normal=r,this.property=e,n&&(this.space=n)}}xu.prototype.normal={};xu.prototype.property={};xu.prototype.space=void 0;function VC(t,e){const r={},n={};for(const i of t)Object.assign(r,i.property),Object.assign(n,i.normal);return new xu(r,n,e)}function Xv(t){return t.toLowerCase()}class xn{constructor(e,r){this.attribute=r,this.property=e}}xn.prototype.attribute="";xn.prototype.booleanish=!1;xn.prototype.boolean=!1;xn.prototype.commaOrSpaceSeparated=!1;xn.prototype.commaSeparated=!1;xn.prototype.defined=!1;xn.prototype.mustUseProperty=!1;xn.prototype.number=!1;xn.prototype.overloadedBoolean=!1;xn.prototype.property="";xn.prototype.spaceSeparated=!1;xn.prototype.space=void 0;let Fj=0;const bt=ws(),yr=ws(),Qv=ws(),We=ws(),qt=ws(),us=ws(),Cn=ws();function ws(){return 2**++Fj}const Zv=Object.freeze(Object.defineProperty({__proto__:null,boolean:bt,booleanish:yr,commaOrSpaceSeparated:Cn,commaSeparated:us,number:We,overloadedBoolean:Qv,spaceSeparated:qt},Symbol.toStringTag,{value:"Module"})),rv=Object.keys(Zv);class Vm extends xn{constructor(e,r,n,i){let a=-1;if(super(e,r),d2(this,"space",i),typeof n=="number")for(;++a<rv.length;){const s=rv[a];d2(this,rv[a],(n&Zv[s])===Zv[s])}}}Vm.prototype.defined=!0;function d2(t,e,r){r&&(t[e]=r)}function Ao(t){const e={},r={};for(const[n,i]of Object.entries(t.properties)){const a=new Vm(n,t.transform(t.attributes||{},n),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(n)&&(a.mustUseProperty=!0),e[n]=a,r[Xv(n)]=n,r[Xv(a.attribute)]=n}return new xu(e,r,t.space)}const GC=Ao({properties:{ariaActiveDescendant:null,ariaAtomic:yr,ariaAutoComplete:null,ariaBusy:yr,ariaChecked:yr,ariaColCount:We,ariaColIndex:We,ariaColSpan:We,ariaControls:qt,ariaCurrent:null,ariaDescribedBy:qt,ariaDetails:null,ariaDisabled:yr,ariaDropEffect:qt,ariaErrorMessage:null,ariaExpanded:yr,ariaFlowTo:qt,ariaGrabbed:yr,ariaHasPopup:null,ariaHidden:yr,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:qt,ariaLevel:We,ariaLive:null,ariaModal:yr,ariaMultiLine:yr,ariaMultiSelectable:yr,ariaOrientation:null,ariaOwns:qt,ariaPlaceholder:null,ariaPosInSet:We,ariaPressed:yr,ariaReadOnly:yr,ariaRelevant:null,ariaRequired:yr,ariaRoleDescription:qt,ariaRowCount:We,ariaRowIndex:We,ariaRowSpan:We,ariaSelected:yr,ariaSetSize:We,ariaSort:null,ariaValueMax:We,ariaValueMin:We,ariaValueNow:We,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function qC(t,e){return e in t?t[e]:e}function YC(t,e){return qC(t,e.toLowerCase())}const zj=Ao({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:us,acceptCharset:qt,accessKey:qt,action:null,allow:null,allowFullScreen:bt,allowPaymentRequest:bt,allowUserMedia:bt,alpha:bt,alt:null,as:null,async:bt,autoCapitalize:null,autoComplete:qt,autoFocus:bt,autoPlay:bt,blocking:qt,capture:null,charSet:null,checked:bt,cite:null,className:qt,closedBy:null,colorSpace:null,cols:We,colSpan:We,command:null,commandFor:null,content:null,contentEditable:yr,controls:bt,controlsList:qt,coords:We|us,crossOrigin:null,data:null,dateTime:null,decoding:null,default:bt,defer:bt,dir:null,dirName:null,disabled:bt,download:Qv,draggable:yr,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:bt,formTarget:null,headers:qt,height:We,hidden:Qv,high:We,href:null,hrefLang:null,htmlFor:qt,httpEquiv:qt,id:null,imageSizes:null,imageSrcSet:null,inert:bt,inputMode:null,integrity:null,is:null,isMap:bt,itemId:null,itemProp:qt,itemRef:qt,itemScope:bt,itemType:qt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:bt,low:We,manifest:null,max:null,maxLength:We,media:null,method:null,min:null,minLength:We,multiple:bt,muted:bt,name:null,nonce:null,noModule:bt,noValidate:bt,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:bt,optimum:We,pattern:null,ping:qt,placeholder:null,playsInline:bt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:bt,referrerPolicy:null,rel:qt,required:bt,reversed:bt,rows:We,rowSpan:We,sandbox:qt,scope:null,scoped:bt,seamless:bt,selected:bt,shadowRootClonable:bt,shadowRootCustomElementRegistry:bt,shadowRootDelegatesFocus:bt,shadowRootMode:null,shadowRootSerializable:bt,shape:null,size:We,sizes:null,slot:null,span:We,spellCheck:yr,src:null,srcDoc:null,srcLang:null,srcSet:null,start:We,step:null,style:null,tabIndex:We,target:null,title:null,translate:null,type:null,typeMustMatch:bt,useMap:null,value:yr,width:We,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:qt,axis:null,background:null,bgColor:null,border:We,borderColor:null,bottomMargin:We,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:bt,declare:bt,event:null,face:null,frame:null,frameBorder:null,hSpace:We,leftMargin:We,link:null,longDesc:null,lowSrc:null,marginHeight:We,marginWidth:We,noResize:bt,noHref:bt,noShade:bt,noWrap:bt,object:null,profile:null,prompt:null,rev:null,rightMargin:We,rules:null,scheme:null,scrolling:yr,standby:null,summary:null,text:null,topMargin:We,valueType:null,version:null,vAlign:null,vLink:null,vSpace:We,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:bt,disablePictureInPicture:bt,disableRemotePlayback:bt,exportParts:us,part:qt,prefix:null,property:null,results:We,security:null,unselectable:null},space:"html",transform:YC}),$j=Ao({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:Cn,accentHeight:We,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:We,amplitude:We,arabicForm:null,ascent:We,attributeName:null,attributeType:null,azimuth:We,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:We,by:null,calcMode:null,capHeight:We,className:qt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:We,diffuseConstant:We,direction:null,display:null,dur:null,divisor:We,dominantBaseline:null,download:bt,dx:null,dy:null,edgeMode:null,editable:null,elevation:We,enableBackground:null,end:null,event:null,exponent:We,externalResourcesRequired:null,fill:null,fillOpacity:We,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:us,g2:us,glyphName:us,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:We,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:We,horizOriginX:We,horizOriginY:We,id:null,ideographic:We,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:We,k:We,k1:We,k2:We,k3:We,k4:We,kernelMatrix:Cn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:We,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:We,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:We,overlineThickness:We,paintOrder:null,panose1:null,path:null,pathLength:We,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:qt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:We,pointsAtY:We,pointsAtZ:We,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Cn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Cn,rev:Cn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Cn,requiredFeatures:Cn,requiredFonts:Cn,requiredFormats:Cn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:We,specularExponent:We,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:We,strikethroughThickness:We,string:null,stroke:null,strokeDashArray:Cn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:We,strokeOpacity:We,strokeWidth:null,style:null,surfaceScale:We,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Cn,tabIndex:We,tableValues:null,target:null,targetX:We,targetY:We,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Cn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:We,underlineThickness:We,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:We,values:null,vAlphabetic:We,vMathematical:We,vectorEffect:null,vHanging:We,vIdeographic:We,version:null,vertAdvY:We,vertOriginX:We,vertOriginY:We,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:We,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:qC}),KC=Ao({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()}}),XC=Ao({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:YC}),QC=Ao({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),Hj={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"},Uj=/[A-Z]/g,h2=/-[a-z]/g,Wj=/^data[-\w.:]+$/i;function Vj(t,e){const r=Xv(e);let n=e,i=xn;if(r in t.normal)return t.property[t.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&Wj.test(e)){if(e.charAt(4)==="-"){const a=e.slice(5).replace(h2,qj);n="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{const a=e.slice(4);if(!h2.test(a)){let s=a.replace(Uj,Gj);s.charAt(0)!=="-"&&(s="-"+s),e="data"+s}}i=Vm}return new i(n,e)}function Gj(t){return"-"+t.toLowerCase()}function qj(t){return t.charAt(1).toUpperCase()}const Yj=VC([GC,zj,KC,XC,QC],"html"),Gm=VC([GC,$j,KC,XC,QC],"svg");function Kj(t){return t.join(" ").trim()}var no={},nv,f2;function Xj(){if(f2)return nv;f2=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,r=/^\s*/,n=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,a=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,s=/^[;\s]*/,o=/^\s+|\s+$/g,l=`
|
|
395
|
+
`,u="/",c="*",d="",p="comment",f="declaration";function x(v,m){if(typeof v!="string")throw new TypeError("First argument must be a string");if(!v)return[];m=m||{};var b=1,w=1;function _(D){var B=D.match(e);B&&(b+=B.length);var j=D.lastIndexOf(l);w=~j?D.length-j:w+D.length}function T(){var D={line:b,column:w};return function(B){return B.position=new N(D),L(),B}}function N(D){this.start=D,this.end={line:b,column:w},this.source=m.source}N.prototype.content=v;function E(D){var B=new Error(m.source+":"+b+":"+w+": "+D);if(B.reason=D,B.filename=m.source,B.line=b,B.column=w,B.source=v,!m.silent)throw B}function k(D){var B=D.exec(v);if(B){var j=B[0];return _(j),v=v.slice(j.length),B}}function L(){k(r)}function A(D){var B;for(D=D||[];B=M();)B!==!1&&D.push(B);return D}function M(){var D=T();if(!(u!=v.charAt(0)||c!=v.charAt(1))){for(var B=2;d!=v.charAt(B)&&(c!=v.charAt(B)||u!=v.charAt(B+1));)++B;if(B+=2,d===v.charAt(B-1))return E("End of comment missing");var j=v.slice(2,B-2);return w+=2,_(j),v=v.slice(B),w+=2,D({type:p,comment:j})}}function O(){var D=T(),B=k(n);if(B){if(M(),!k(i))return E("property missing ':'");var j=k(a),I=D({type:f,property:S(B[0].replace(t,d)),value:j?S(j[0].replace(t,d)):d});return k(s),I}}function $(){var D=[];A(D);for(var B;B=O();)B!==!1&&(D.push(B),A(D));return D}return L(),$()}function S(v){return v?v.replace(o,d):d}return nv=x,nv}var p2;function Qj(){if(p2)return no;p2=1;var t=no&&no.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(no,"__esModule",{value:!0}),no.default=r;const e=t(Xj());function r(n,i){let a=null;if(!n||typeof n!="string")return a;const s=(0,e.default)(n),o=typeof i=="function";return s.forEach(l=>{if(l.type!=="declaration")return;const{property:u,value:c}=l;o?i(u,c,l):c&&(a=a||{},a[u]=c)}),a}return no}var Ll={},g2;function Zj(){if(g2)return Ll;g2=1,Object.defineProperty(Ll,"__esModule",{value:!0}),Ll.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,r=/^[^-]+$/,n=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,a=function(u){return!u||r.test(u)||t.test(u)},s=function(u,c){return c.toUpperCase()},o=function(u,c){return"".concat(c,"-")},l=function(u,c){return c===void 0&&(c={}),a(u)?u:(u=u.toLowerCase(),c.reactCompat?u=u.replace(i,o):u=u.replace(n,o),u.replace(e,s))};return Ll.camelCase=l,Ll}var Dl,v2;function Jj(){if(v2)return Dl;v2=1;var t=Dl&&Dl.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},e=t(Qj()),r=Zj();function n(i,a){var s={};return!i||typeof i!="string"||(0,e.default)(i,function(o,l){o&&l&&(s[(0,r.camelCase)(o,a)]=l)}),s}return n.default=n,Dl=n,Dl}var eI=Jj();const tI=$d(eI),ZC=JC("end"),qm=JC("start");function JC(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 rI(t){const e=qm(t),r=ZC(t);if(e&&r)return{start:e,end:r}}function $l(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?m2(t.position):"start"in t||"end"in t?m2(t):"line"in t||"column"in t?Jv(t):""}function Jv(t){return y2(t&&t.line)+":"+y2(t&&t.column)}function m2(t){return Jv(t&&t.start)+"-"+Jv(t&&t.end)}function y2(t){return t&&typeof t=="number"?t:1}class Xr extends Error{constructor(e,r,n){super(),typeof r=="string"&&(n=r,r=void 0);let i="",a={},s=!1;if(r&&("line"in r&&"column"in r?a={place:r}:"start"in r&&"end"in r?a={place:r}:"type"in r?a={ancestors:[r],place:r.position}:a={...r}),typeof e=="string"?i=e:!a.cause&&e&&(s=!0,i=e.message,a.cause=e),!a.ruleId&&!a.source&&typeof n=="string"){const l=n.indexOf(":");l===-1?a.ruleId=n:(a.source=n.slice(0,l),a.ruleId=n.slice(l+1))}if(!a.place&&a.ancestors&&a.ancestors){const l=a.ancestors[a.ancestors.length-1];l&&(a.place=l.position)}const o=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=o?o.line:void 0,this.name=$l(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=s&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Xr.prototype.file="";Xr.prototype.name="";Xr.prototype.reason="";Xr.prototype.message="";Xr.prototype.stack="";Xr.prototype.column=void 0;Xr.prototype.line=void 0;Xr.prototype.ancestors=void 0;Xr.prototype.cause=void 0;Xr.prototype.fatal=void 0;Xr.prototype.place=void 0;Xr.prototype.ruleId=void 0;Xr.prototype.source=void 0;const Ym={}.hasOwnProperty,nI=new Map,iI=/[A-Z]/g,aI=new Set(["table","tbody","thead","tfoot","tr"]),sI=new Set(["td","th"]),ek="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function oI(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=gI(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=pI(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"?Gm:Yj,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},a=tk(i,t,void 0);return a&&typeof a!="string"?a:i.create(t,i.Fragment,{children:a||void 0},void 0)}function tk(t,e,r){if(e.type==="element")return lI(t,e,r);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return uI(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return dI(t,e,r);if(e.type==="mdxjsEsm")return cI(t,e);if(e.type==="root")return hI(t,e,r);if(e.type==="text")return fI(t,e)}function lI(t,e,r){const n=t.schema;let i=n;e.tagName.toLowerCase()==="svg"&&n.space==="html"&&(i=Gm,t.schema=i),t.ancestors.push(e);const a=nk(t,e.tagName,!1),s=vI(t,e);let o=Xm(t,e);return aI.has(e.tagName)&&(o=o.filter(function(l){return typeof l=="string"?!Bj(l):!0})),rk(t,s,a,e),Km(s,o),t.ancestors.pop(),t.schema=n,t.create(e,a,s,r)}function uI(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)}iu(t,e.position)}function cI(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);iu(t,e.position)}function dI(t,e,r){const n=t.schema;let i=n;e.name==="svg"&&n.space==="html"&&(i=Gm,t.schema=i),t.ancestors.push(e);const a=e.name===null?t.Fragment:nk(t,e.name,!0),s=mI(t,e),o=Xm(t,e);return rk(t,s,a,e),Km(s,o),t.ancestors.pop(),t.schema=n,t.create(e,a,s,r)}function hI(t,e,r){const n={};return Km(n,Xm(t,e)),t.create(e,t.Fragment,n,r)}function fI(t,e){return e.value}function rk(t,e,r,n){typeof r!="string"&&r!==t.Fragment&&t.passNode&&(e.node=n)}function Km(t,e){if(e.length>0){const r=e.length>1?e:e[0];r&&(t.children=r)}}function pI(t,e,r){return n;function n(i,a,s,o){const u=Array.isArray(s.children)?r:e;return o?u(a,s,o):u(a,s)}}function gI(t,e){return r;function r(n,i,a,s){const o=Array.isArray(a.children),l=qm(n);return e(i,a,s,o,{columnNumber:l?l.column-1:void 0,fileName:t,lineNumber:l?l.line:void 0},void 0)}}function vI(t,e){const r={};let n,i;for(i in e.properties)if(i!=="children"&&Ym.call(e.properties,i)){const a=yI(t,i,e.properties[i]);if(a){const[s,o]=a;t.tableCellAlignToStyle&&s==="align"&&typeof o=="string"&&sI.has(e.tagName)?n=o:r[s]=o}}if(n){const a=r.style||(r.style={});a[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=n}return r}function mI(t,e){const r={};for(const n of e.attributes)if(n.type==="mdxJsxExpressionAttribute")if(n.data&&n.data.estree&&t.evaluater){const a=n.data.estree.body[0];a.type;const s=a.expression;s.type;const o=s.properties[0];o.type,Object.assign(r,t.evaluater.evaluateExpression(o.argument))}else iu(t,e.position);else{const i=n.name;let a;if(n.value&&typeof n.value=="object")if(n.value.data&&n.value.data.estree&&t.evaluater){const o=n.value.data.estree.body[0];o.type,a=t.evaluater.evaluateExpression(o.expression)}else iu(t,e.position);else a=n.value===null?!0:n.value;r[i]=a}return r}function Xm(t,e){const r=[];let n=-1;const i=t.passKeys?new Map:nI;for(;++n<e.children.length;){const a=e.children[n];let s;if(t.passKeys){const l=a.type==="element"?a.tagName:a.type==="mdxJsxFlowElement"||a.type==="mdxJsxTextElement"?a.name:void 0;if(l){const u=i.get(l)||0;s=l+"-"+u,i.set(l,u+1)}}const o=tk(t,a,s);o!==void 0&&r.push(o)}return r}function yI(t,e,r){const n=Vj(t.schema,e);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=n.commaSeparated?Pj(r):Kj(r)),n.property==="style"){let i=typeof r=="object"?r:xI(t,String(r));return t.stylePropertyNameCase==="css"&&(i=bI(i)),["style",i]}return[t.elementAttributeNameCase==="react"&&n.space?Hj[n.property]||n.property:n.attribute,r]}}function xI(t,e){try{return tI(e,{reactCompat:!0})}catch(r){if(t.ignoreInvalidStyle)return{};const n=r,i=new Xr("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=ek+"#cannot-parse-style-attribute",i}}function nk(t,e,r){let n;if(!r)n={type:"Literal",value:e};else if(e.includes(".")){const i=e.split(".");let a=-1,s;for(;++a<i.length;){const o=u2(i[a])?{type:"Identifier",name:i[a]}:{type:"Literal",value:i[a]};s=s?{type:"MemberExpression",object:s,property:o,computed:!!(a&&o.type==="Literal"),optional:!1}:o}n=s}else n=u2(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(n.type==="Literal"){const i=n.value;return Ym.call(t.components,i)?t.components[i]:i}if(t.evaluater)return t.evaluater.evaluateExpression(n);iu(t)}function iu(t,e){const r=new Xr("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=ek+"#cannot-handle-mdx-estrees-without-createevaluater",r}function bI(t){const e={};let r;for(r in t)Ym.call(t,r)&&(e[wI(r)]=t[r]);return e}function wI(t){let e=t.replace(iI,SI);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function SI(t){return"-"+t.toLowerCase()}const iv={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"]},_I={};function Qm(t,e){const r=_I,n=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,i=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return ik(t,n,i)}function ik(t,e,r){if(CI(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 x2(t.children,e,r)}return Array.isArray(t)?x2(t,e,r):""}function x2(t,e,r){const n=[];let i=-1;for(;++i<t.length;)n[i]=ik(t[i],e,r);return n.join("")}function CI(t){return!!(t&&typeof t=="object")}const b2=document.createElement("i");function Zm(t){const e="&"+t+";";b2.innerHTML=e;const r=b2.textContent;return r.charCodeAt(r.length-1)===59&&t!=="semi"||r===e?!1:r}function Rn(t,e,r,n){const i=t.length;let a=0,s;if(e<0?e=-e>i?0:i+e:e=e>i?i:e,r=r>0?r:0,n.length<1e4)s=Array.from(n),s.unshift(e,r),t.splice(...s);else for(r&&t.splice(e,r);a<n.length;)s=n.slice(a,a+1e4),s.unshift(e,0),t.splice(...s),a+=1e4,e+=1e4}function $n(t,e){return t.length>0?(Rn(t,t.length,0,e),t):e}const w2={}.hasOwnProperty;function ak(t){const e={};let r=-1;for(;++r<t.length;)kI(e,t[r]);return e}function kI(t,e){let r;for(r in e){const i=(w2.call(t,r)?t[r]:void 0)||(t[r]={}),a=e[r];let s;if(a)for(s in a){w2.call(i,s)||(i[s]=[]);const o=a[s];EI(i[s],Array.isArray(o)?o:o?[o]:[])}}}function EI(t,e){let r=-1;const n=[];for(;++r<e.length;)(e[r].add==="after"?t:n).push(e[r]);Rn(t,0,0,n)}function sk(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 ni(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const nn=Aa(/[A-Za-z]/),Gr=Aa(/[\dA-Za-z]/),TI=Aa(/[#-'*+\--9=?A-Z^-~]/);function Id(t){return t!==null&&(t<32||t===127)}const em=Aa(/\d/),NI=Aa(/[\dA-Fa-f]/),RI=Aa(/[!-/:-@[-`{-~]/);function vt(t){return t!==null&&t<-2}function Kt(t){return t!==null&&(t<0||t===32)}function Et(t){return t===-2||t===-1||t===32}const dh=Aa(new RegExp("\\p{P}|\\p{S}","u")),vs=Aa(/\s/);function Aa(t){return e;function e(r){return r!==null&&r>-1&&t.test(String.fromCharCode(r))}}function Po(t){const e=[];let r=-1,n=0,i=0;for(;++r<t.length;){const a=t.charCodeAt(r);let s="";if(a===37&&Gr(t.charCodeAt(r+1))&&Gr(t.charCodeAt(r+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(s=String.fromCharCode(a));else if(a>55295&&a<57344){const o=t.charCodeAt(r+1);a<56320&&o>56319&&o<57344?(s=String.fromCharCode(a,o),i=1):s="�"}else s=String.fromCharCode(a);s&&(e.push(t.slice(n,r),encodeURIComponent(s)),n=r+i+1,s=""),i&&(r+=i,i=0)}return e.join("")+t.slice(n)}function At(t,e,r,n){const i=n?n-1:Number.POSITIVE_INFINITY;let a=0;return s;function s(l){return Et(l)?(t.enter(r),o(l)):e(l)}function o(l){return Et(l)&&a++<i?(t.consume(l),o):(t.exit(r),e(l))}}const LI={tokenize:DI};function DI(t){const e=t.attempt(this.parser.constructs.contentInitial,n,i);let r;return e;function n(o){if(o===null){t.consume(o);return}return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),At(t,e,"linePrefix")}function i(o){return t.enter("paragraph"),a(o)}function a(o){const l=t.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=l),r=l,s(o)}function s(o){if(o===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(o);return}return vt(o)?(t.consume(o),t.exit("chunkText"),a):(t.consume(o),s)}}const AI={tokenize:PI},S2={tokenize:MI};function PI(t){const e=this,r=[];let n=0,i,a,s;return o;function o(w){if(n<r.length){const _=r[n];return e.containerState=_[1],t.attempt(_[0].continuation,l,u)(w)}return u(w)}function l(w){if(n++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,i&&b();const _=e.events.length;let T=_,N;for(;T--;)if(e.events[T][0]==="exit"&&e.events[T][1].type==="chunkFlow"){N=e.events[T][1].end;break}m(n);let E=_;for(;E<e.events.length;)e.events[E][1].end={...N},E++;return Rn(e.events,T+1,0,e.events.slice(_)),e.events.length=E,u(w)}return o(w)}function u(w){if(n===r.length){if(!i)return p(w);if(i.currentConstruct&&i.currentConstruct.concrete)return x(w);e.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(S2,c,d)(w)}function c(w){return i&&b(),m(n),p(w)}function d(w){return e.parser.lazy[e.now().line]=n!==r.length,s=e.now().offset,x(w)}function p(w){return e.containerState={},t.attempt(S2,f,x)(w)}function f(w){return n++,r.push([e.currentConstruct,e.containerState]),p(w)}function x(w){if(w===null){i&&b(),m(0),t.consume(w);return}return i=i||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:a}),S(w)}function S(w){if(w===null){v(t.exit("chunkFlow"),!0),m(0),t.consume(w);return}return vt(w)?(t.consume(w),v(t.exit("chunkFlow")),n=0,e.interrupt=void 0,o):(t.consume(w),S)}function v(w,_){const T=e.sliceStream(w);if(_&&T.push(null),w.previous=a,a&&(a.next=w),a=w,i.defineSkip(w.start),i.write(T),e.parser.lazy[w.start.line]){let N=i.events.length;for(;N--;)if(i.events[N][1].start.offset<s&&(!i.events[N][1].end||i.events[N][1].end.offset>s))return;const E=e.events.length;let k=E,L,A;for(;k--;)if(e.events[k][0]==="exit"&&e.events[k][1].type==="chunkFlow"){if(L){A=e.events[k][1].end;break}L=!0}for(m(n),N=E;N<e.events.length;)e.events[N][1].end={...A},N++;Rn(e.events,k+1,0,e.events.slice(E)),e.events.length=N}}function m(w){let _=r.length;for(;_-- >w;){const T=r[_];e.containerState=T[1],T[0].exit.call(e,t)}r.length=w}function b(){i.write([null]),a=void 0,i=void 0,e.containerState._closeFlow=void 0}}function MI(t,e,r){return At(t,t.attempt(this.parser.constructs.document,e,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ko(t){if(t===null||Kt(t)||vs(t))return 1;if(dh(t))return 2}function hh(t,e,r){const n=[];let i=-1;for(;++i<t.length;){const a=t[i].resolveAll;a&&!n.includes(a)&&(e=a(e,r),n.push(a))}return e}const tm={name:"attention",resolveAll:OI,tokenize:jI};function OI(t,e){let r=-1,n,i,a,s,o,l,u,c;for(;++r<t.length;)if(t[r][0]==="enter"&&t[r][1].type==="attentionSequence"&&t[r][1]._close){for(n=r;n--;)if(t[n][0]==="exit"&&t[n][1].type==="attentionSequence"&&t[n][1]._open&&e.sliceSerialize(t[n][1]).charCodeAt(0)===e.sliceSerialize(t[r][1]).charCodeAt(0)){if((t[n][1]._close||t[r][1]._open)&&(t[r][1].end.offset-t[r][1].start.offset)%3&&!((t[n][1].end.offset-t[n][1].start.offset+t[r][1].end.offset-t[r][1].start.offset)%3))continue;l=t[n][1].end.offset-t[n][1].start.offset>1&&t[r][1].end.offset-t[r][1].start.offset>1?2:1;const d={...t[n][1].end},p={...t[r][1].start};_2(d,-l),_2(p,l),s={type:l>1?"strongSequence":"emphasisSequence",start:d,end:{...t[n][1].end}},o={type:l>1?"strongSequence":"emphasisSequence",start:{...t[r][1].start},end:p},a={type:l>1?"strongText":"emphasisText",start:{...t[n][1].end},end:{...t[r][1].start}},i={type:l>1?"strong":"emphasis",start:{...s.start},end:{...o.end}},t[n][1].end={...s.start},t[r][1].start={...o.end},u=[],t[n][1].end.offset-t[n][1].start.offset&&(u=$n(u,[["enter",t[n][1],e],["exit",t[n][1],e]])),u=$n(u,[["enter",i,e],["enter",s,e],["exit",s,e],["enter",a,e]]),u=$n(u,hh(e.parser.constructs.insideSpan.null,t.slice(n+1,r),e)),u=$n(u,[["exit",a,e],["enter",o,e],["exit",o,e],["exit",i,e]]),t[r][1].end.offset-t[r][1].start.offset?(c=2,u=$n(u,[["enter",t[r][1],e],["exit",t[r][1],e]])):c=0,Rn(t,n-1,r-n+3,u),r=n+u.length-c-2;break}}for(r=-1;++r<t.length;)t[r][1].type==="attentionSequence"&&(t[r][1].type="data");return t}function jI(t,e){const r=this.parser.constructs.attentionMarkers.null,n=this.previous,i=ko(n);let a;return s;function s(l){return a=l,t.enter("attentionSequence"),o(l)}function o(l){if(l===a)return t.consume(l),o;const u=t.exit("attentionSequence"),c=ko(l),d=!c||c===2&&i||r.includes(l),p=!i||i===2&&c||r.includes(n);return u._open=!!(a===42?d:d&&(i||!p)),u._close=!!(a===42?p:p&&(c||!d)),e(l)}}function _2(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const II={name:"autolink",tokenize:BI};function BI(t,e,r){let n=0;return i;function i(f){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),a}function a(f){return nn(f)?(t.consume(f),s):f===64?r(f):u(f)}function s(f){return f===43||f===45||f===46||Gr(f)?(n=1,o(f)):u(f)}function o(f){return f===58?(t.consume(f),n=0,l):(f===43||f===45||f===46||Gr(f))&&n++<32?(t.consume(f),o):(n=0,u(f))}function l(f){return f===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.exit("autolink"),e):f===null||f===32||f===60||Id(f)?r(f):(t.consume(f),l)}function u(f){return f===64?(t.consume(f),c):TI(f)?(t.consume(f),u):r(f)}function c(f){return Gr(f)?d(f):r(f)}function d(f){return f===46?(t.consume(f),n=0,c):f===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.exit("autolink"),e):p(f)}function p(f){if((f===45||Gr(f))&&n++<63){const x=f===45?p:d;return t.consume(f),x}return r(f)}}const bu={partial:!0,tokenize:FI};function FI(t,e,r){return n;function n(a){return Et(a)?At(t,i,"linePrefix")(a):i(a)}function i(a){return a===null||vt(a)?e(a):r(a)}}const ok={continuation:{tokenize:$I},exit:HI,name:"blockQuote",tokenize:zI};function zI(t,e,r){const n=this;return i;function i(s){if(s===62){const o=n.containerState;return o.open||(t.enter("blockQuote",{_container:!0}),o.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(s),t.exit("blockQuoteMarker"),a}return r(s)}function a(s){return Et(s)?(t.enter("blockQuotePrefixWhitespace"),t.consume(s),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(s))}}function $I(t,e,r){const n=this;return i;function i(s){return Et(s)?At(t,a,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):a(s)}function a(s){return t.attempt(ok,e,r)(s)}}function HI(t){t.exit("blockQuote")}const lk={name:"characterEscape",tokenize:UI};function UI(t,e,r){return n;function n(a){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(a),t.exit("escapeMarker"),i}function i(a){return RI(a)?(t.enter("characterEscapeValue"),t.consume(a),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):r(a)}}const uk={name:"characterReference",tokenize:WI};function WI(t,e,r){const n=this;let i=0,a,s;return o;function o(d){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),l}function l(d){return d===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(d),t.exit("characterReferenceMarkerNumeric"),u):(t.enter("characterReferenceValue"),a=31,s=Gr,c(d))}function u(d){return d===88||d===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(d),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),a=6,s=NI,c):(t.enter("characterReferenceValue"),a=7,s=em,c(d))}function c(d){if(d===59&&i){const p=t.exit("characterReferenceValue");return s===Gr&&!Zm(n.sliceSerialize(p))?r(d):(t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return s(d)&&i++<a?(t.consume(d),c):r(d)}}const C2={partial:!0,tokenize:GI},k2={concrete:!0,name:"codeFenced",tokenize:VI};function VI(t,e,r){const n=this,i={partial:!0,tokenize:T};let a=0,s=0,o;return l;function l(N){return u(N)}function u(N){const E=n.events[n.events.length-1];return a=E&&E[1].type==="linePrefix"?E[2].sliceSerialize(E[1],!0).length:0,o=N,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),c(N)}function c(N){return N===o?(s++,t.consume(N),c):s<3?r(N):(t.exit("codeFencedFenceSequence"),Et(N)?At(t,d,"whitespace")(N):d(N))}function d(N){return N===null||vt(N)?(t.exit("codeFencedFence"),n.interrupt?e(N):t.check(C2,S,_)(N)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),p(N))}function p(N){return N===null||vt(N)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),d(N)):Et(N)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),At(t,f,"whitespace")(N)):N===96&&N===o?r(N):(t.consume(N),p)}function f(N){return N===null||vt(N)?d(N):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),x(N))}function x(N){return N===null||vt(N)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),d(N)):N===96&&N===o?r(N):(t.consume(N),x)}function S(N){return t.attempt(i,_,v)(N)}function v(N){return t.enter("lineEnding"),t.consume(N),t.exit("lineEnding"),m}function m(N){return a>0&&Et(N)?At(t,b,"linePrefix",a+1)(N):b(N)}function b(N){return N===null||vt(N)?t.check(C2,S,_)(N):(t.enter("codeFlowValue"),w(N))}function w(N){return N===null||vt(N)?(t.exit("codeFlowValue"),b(N)):(t.consume(N),w)}function _(N){return t.exit("codeFenced"),e(N)}function T(N,E,k){let L=0;return A;function A(B){return N.enter("lineEnding"),N.consume(B),N.exit("lineEnding"),M}function M(B){return N.enter("codeFencedFence"),Et(B)?At(N,O,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):O(B)}function O(B){return B===o?(N.enter("codeFencedFenceSequence"),$(B)):k(B)}function $(B){return B===o?(L++,N.consume(B),$):L>=s?(N.exit("codeFencedFenceSequence"),Et(B)?At(N,D,"whitespace")(B):D(B)):k(B)}function D(B){return B===null||vt(B)?(N.exit("codeFencedFence"),E(B)):k(B)}}}function GI(t,e,r){const n=this;return i;function i(s){return s===null?r(s):(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),a)}function a(s){return n.parser.lazy[n.now().line]?r(s):e(s)}}const av={name:"codeIndented",tokenize:YI},qI={partial:!0,tokenize:KI};function YI(t,e,r){const n=this;return i;function i(u){return t.enter("codeIndented"),At(t,a,"linePrefix",5)(u)}function a(u){const c=n.events[n.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?s(u):r(u)}function s(u){return u===null?l(u):vt(u)?t.attempt(qI,s,l)(u):(t.enter("codeFlowValue"),o(u))}function o(u){return u===null||vt(u)?(t.exit("codeFlowValue"),s(u)):(t.consume(u),o)}function l(u){return t.exit("codeIndented"),e(u)}}function KI(t,e,r){const n=this;return i;function i(s){return n.parser.lazy[n.now().line]?r(s):vt(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),i):At(t,a,"linePrefix",5)(s)}function a(s){const o=n.events[n.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?e(s):vt(s)?i(s):r(s)}}const XI={name:"codeText",previous:ZI,resolve:QI,tokenize:JI};function QI(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 ZI(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function JI(t,e,r){let n=0,i,a;return s;function s(d){return t.enter("codeText"),t.enter("codeTextSequence"),o(d)}function o(d){return d===96?(t.consume(d),n++,o):(t.exit("codeTextSequence"),l(d))}function l(d){return d===null?r(d):d===32?(t.enter("space"),t.consume(d),t.exit("space"),l):d===96?(a=t.enter("codeTextSequence"),i=0,c(d)):vt(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),l):(t.enter("codeTextData"),u(d))}function u(d){return d===null||d===32||d===96||vt(d)?(t.exit("codeTextData"),l(d)):(t.consume(d),u)}function c(d){return d===96?(t.consume(d),i++,c):i===n?(t.exit("codeTextSequence"),t.exit("codeText"),e(d)):(a.type="codeTextData",u(d))}}class eB{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 a=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return n&&Al(this.left,n),a.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),Al(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Al(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);Al(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);Al(this.left,r.reverse())}}}function Al(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 ck(t){const e={};let r=-1,n,i,a,s,o,l,u;const c=new eB(t);for(;++r<c.length;){for(;r in e;)r=e[r];if(n=c.get(r),r&&n[1].type==="chunkFlow"&&c.get(r-1)[1].type==="listItemPrefix"&&(l=n[1]._tokenizer.events,a=0,a<l.length&&l[a][1].type==="lineEndingBlank"&&(a+=2),a<l.length&&l[a][1].type==="content"))for(;++a<l.length&&l[a][1].type!=="content";)l[a][1].type==="chunkText"&&(l[a][1]._isInFirstContentOfListItem=!0,a++);if(n[0]==="enter")n[1].contentType&&(Object.assign(e,tB(c,r)),r=e[r],u=!0);else if(n[1]._container){for(a=r,i=void 0;a--;)if(s=c.get(a),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank")s[0]==="enter"&&(i&&(c.get(i)[1].type="lineEndingBlank"),s[1].type="lineEnding",i=a);else if(!(s[1].type==="linePrefix"||s[1].type==="listItemIndent"))break;i&&(n[1].end={...c.get(i)[1].start},o=c.slice(i,r),o.unshift(n),c.splice(i,r-i+1,o))}}return Rn(t,0,Number.POSITIVE_INFINITY,c.slice(0)),!u}function tB(t,e){const r=t.get(e)[1],n=t.get(e)[2];let i=e-1;const a=[];let s=r._tokenizer;s||(s=n.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(s._contentTypeTextTrailing=!0));const o=s.events,l=[],u={};let c,d,p=-1,f=r,x=0,S=0;const v=[S];for(;f;){for(;t.get(++i)[1]!==f;);a.push(i),f._tokenizer||(c=n.sliceStream(f),f.next||c.push(null),d&&s.defineSkip(f.start),f._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(c),f._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),d=f,f=f.next}for(f=r;++p<o.length;)o[p][0]==="exit"&&o[p-1][0]==="enter"&&o[p][1].type===o[p-1][1].type&&o[p][1].start.line!==o[p][1].end.line&&(S=p+1,v.push(S),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(s.events=[],f?(f._tokenizer=void 0,f.previous=void 0):v.pop(),p=v.length;p--;){const m=o.slice(v[p],v[p+1]),b=a.pop();l.push([b,b+m.length-1]),t.splice(b,2,m)}for(l.reverse(),p=-1;++p<l.length;)u[x+l[p][0]]=x+l[p][1],x+=l[p][1]-l[p][0]-1;return u}const rB={resolve:iB,tokenize:aB},nB={partial:!0,tokenize:sB};function iB(t){return ck(t),t}function aB(t,e){let r;return n;function n(o){return t.enter("content"),r=t.enter("chunkContent",{contentType:"content"}),i(o)}function i(o){return o===null?a(o):vt(o)?t.check(nB,s,a)(o):(t.consume(o),i)}function a(o){return t.exit("chunkContent"),t.exit("content"),e(o)}function s(o){return t.consume(o),t.exit("chunkContent"),r.next=t.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,i}}function sB(t,e,r){const n=this;return i;function i(s){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),At(t,a,"linePrefix")}function a(s){if(s===null||vt(s))return r(s);const o=n.events[n.events.length-1];return!n.parser.constructs.disable.null.includes("codeIndented")&&o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?e(s):t.interrupt(n.parser.constructs.flow,r,e)(s)}}function dk(t,e,r,n,i,a,s,o,l){const u=l||Number.POSITIVE_INFINITY;let c=0;return d;function d(m){return m===60?(t.enter(n),t.enter(i),t.enter(a),t.consume(m),t.exit(a),p):m===null||m===32||m===41||Id(m)?r(m):(t.enter(n),t.enter(s),t.enter(o),t.enter("chunkString",{contentType:"string"}),S(m))}function p(m){return m===62?(t.enter(a),t.consume(m),t.exit(a),t.exit(i),t.exit(n),e):(t.enter(o),t.enter("chunkString",{contentType:"string"}),f(m))}function f(m){return m===62?(t.exit("chunkString"),t.exit(o),p(m)):m===null||m===60||vt(m)?r(m):(t.consume(m),m===92?x:f)}function x(m){return m===60||m===62||m===92?(t.consume(m),f):f(m)}function S(m){return!c&&(m===null||m===41||Kt(m))?(t.exit("chunkString"),t.exit(o),t.exit(s),t.exit(n),e(m)):c<u&&m===40?(t.consume(m),c++,S):m===41?(t.consume(m),c--,S):m===null||m===32||m===40||Id(m)?r(m):(t.consume(m),m===92?v:S)}function v(m){return m===40||m===41||m===92?(t.consume(m),S):S(m)}}function hk(t,e,r,n,i,a){const s=this;let o=0,l;return u;function u(f){return t.enter(n),t.enter(i),t.consume(f),t.exit(i),t.enter(a),c}function c(f){return o>999||f===null||f===91||f===93&&!l||f===94&&!o&&"_hiddenFootnoteSupport"in s.parser.constructs?r(f):f===93?(t.exit(a),t.enter(i),t.consume(f),t.exit(i),t.exit(n),e):vt(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),c):(t.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===null||f===91||f===93||vt(f)||o++>999?(t.exit("chunkString"),c(f)):(t.consume(f),l||(l=!Et(f)),f===92?p:d)}function p(f){return f===91||f===92||f===93?(t.consume(f),o++,d):d(f)}}function fk(t,e,r,n,i,a){let s;return o;function o(p){return p===34||p===39||p===40?(t.enter(n),t.enter(i),t.consume(p),t.exit(i),s=p===40?41:p,l):r(p)}function l(p){return p===s?(t.enter(i),t.consume(p),t.exit(i),t.exit(n),e):(t.enter(a),u(p))}function u(p){return p===s?(t.exit(a),l(s)):p===null?r(p):vt(p)?(t.enter("lineEnding"),t.consume(p),t.exit("lineEnding"),At(t,u,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),c(p))}function c(p){return p===s||p===null||vt(p)?(t.exit("chunkString"),u(p)):(t.consume(p),p===92?d:c)}function d(p){return p===s||p===92?(t.consume(p),c):c(p)}}function Hl(t,e){let r;return n;function n(i){return vt(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),r=!0,n):Et(i)?At(t,n,r?"linePrefix":"lineSuffix")(i):e(i)}}const oB={name:"definition",tokenize:uB},lB={partial:!0,tokenize:cB};function uB(t,e,r){const n=this;let i;return a;function a(f){return t.enter("definition"),s(f)}function s(f){return hk.call(n,t,o,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function o(f){return i=ni(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),f===58?(t.enter("definitionMarker"),t.consume(f),t.exit("definitionMarker"),l):r(f)}function l(f){return Kt(f)?Hl(t,u)(f):u(f)}function u(f){return dk(t,c,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function c(f){return t.attempt(lB,d,d)(f)}function d(f){return Et(f)?At(t,p,"whitespace")(f):p(f)}function p(f){return f===null||vt(f)?(t.exit("definition"),n.parser.defined.push(i),e(f)):r(f)}}function cB(t,e,r){return n;function n(o){return Kt(o)?Hl(t,i)(o):r(o)}function i(o){return fk(t,a,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function a(o){return Et(o)?At(t,s,"whitespace")(o):s(o)}function s(o){return o===null||vt(o)?e(o):r(o)}}const dB={name:"hardBreakEscape",tokenize:hB};function hB(t,e,r){return n;function n(a){return t.enter("hardBreakEscape"),t.consume(a),i}function i(a){return vt(a)?(t.exit("hardBreakEscape"),e(a)):r(a)}}const fB={name:"headingAtx",resolve:pB,tokenize:gB};function pB(t,e){let r=t.length-2,n=3,i,a;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},a={type:"chunkText",start:t[n][1].start,end:t[r][1].end,contentType:"text"},Rn(t,n,r-n+1,[["enter",i,e],["enter",a,e],["exit",a,e],["exit",i,e]])),t}function gB(t,e,r){let n=0;return i;function i(c){return t.enter("atxHeading"),a(c)}function a(c){return t.enter("atxHeadingSequence"),s(c)}function s(c){return c===35&&n++<6?(t.consume(c),s):c===null||Kt(c)?(t.exit("atxHeadingSequence"),o(c)):r(c)}function o(c){return c===35?(t.enter("atxHeadingSequence"),l(c)):c===null||vt(c)?(t.exit("atxHeading"),e(c)):Et(c)?At(t,o,"whitespace")(c):(t.enter("atxHeadingText"),u(c))}function l(c){return c===35?(t.consume(c),l):(t.exit("atxHeadingSequence"),o(c))}function u(c){return c===null||c===35||Kt(c)?(t.exit("atxHeadingText"),o(c)):(t.consume(c),u)}}const vB=["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"],E2=["pre","script","style","textarea"],mB={concrete:!0,name:"htmlFlow",resolveTo:bB,tokenize:wB},yB={partial:!0,tokenize:_B},xB={partial:!0,tokenize:SB};function bB(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 wB(t,e,r){const n=this;let i,a,s,o,l;return u;function u(V){return c(V)}function c(V){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(V),d}function d(V){return V===33?(t.consume(V),p):V===47?(t.consume(V),a=!0,S):V===63?(t.consume(V),i=3,n.interrupt?e:P):nn(V)?(t.consume(V),s=String.fromCharCode(V),v):r(V)}function p(V){return V===45?(t.consume(V),i=2,f):V===91?(t.consume(V),i=5,o=0,x):nn(V)?(t.consume(V),i=4,n.interrupt?e:P):r(V)}function f(V){return V===45?(t.consume(V),n.interrupt?e:P):r(V)}function x(V){const re="CDATA[";return V===re.charCodeAt(o++)?(t.consume(V),o===re.length?n.interrupt?e:O:x):r(V)}function S(V){return nn(V)?(t.consume(V),s=String.fromCharCode(V),v):r(V)}function v(V){if(V===null||V===47||V===62||Kt(V)){const re=V===47,J=s.toLowerCase();return!re&&!a&&E2.includes(J)?(i=1,n.interrupt?e(V):O(V)):vB.includes(s.toLowerCase())?(i=6,re?(t.consume(V),m):n.interrupt?e(V):O(V)):(i=7,n.interrupt&&!n.parser.lazy[n.now().line]?r(V):a?b(V):w(V))}return V===45||Gr(V)?(t.consume(V),s+=String.fromCharCode(V),v):r(V)}function m(V){return V===62?(t.consume(V),n.interrupt?e:O):r(V)}function b(V){return Et(V)?(t.consume(V),b):A(V)}function w(V){return V===47?(t.consume(V),A):V===58||V===95||nn(V)?(t.consume(V),_):Et(V)?(t.consume(V),w):A(V)}function _(V){return V===45||V===46||V===58||V===95||Gr(V)?(t.consume(V),_):T(V)}function T(V){return V===61?(t.consume(V),N):Et(V)?(t.consume(V),T):w(V)}function N(V){return V===null||V===60||V===61||V===62||V===96?r(V):V===34||V===39?(t.consume(V),l=V,E):Et(V)?(t.consume(V),N):k(V)}function E(V){return V===l?(t.consume(V),l=null,L):V===null||vt(V)?r(V):(t.consume(V),E)}function k(V){return V===null||V===34||V===39||V===47||V===60||V===61||V===62||V===96||Kt(V)?T(V):(t.consume(V),k)}function L(V){return V===47||V===62||Et(V)?w(V):r(V)}function A(V){return V===62?(t.consume(V),M):r(V)}function M(V){return V===null||vt(V)?O(V):Et(V)?(t.consume(V),M):r(V)}function O(V){return V===45&&i===2?(t.consume(V),j):V===60&&i===1?(t.consume(V),I):V===62&&i===4?(t.consume(V),H):V===63&&i===3?(t.consume(V),P):V===93&&i===5?(t.consume(V),F):vt(V)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(yB,W,$)(V)):V===null||vt(V)?(t.exit("htmlFlowData"),$(V)):(t.consume(V),O)}function $(V){return t.check(xB,D,W)(V)}function D(V){return t.enter("lineEnding"),t.consume(V),t.exit("lineEnding"),B}function B(V){return V===null||vt(V)?$(V):(t.enter("htmlFlowData"),O(V))}function j(V){return V===45?(t.consume(V),P):O(V)}function I(V){return V===47?(t.consume(V),s="",U):O(V)}function U(V){if(V===62){const re=s.toLowerCase();return E2.includes(re)?(t.consume(V),H):O(V)}return nn(V)&&s.length<8?(t.consume(V),s+=String.fromCharCode(V),U):O(V)}function F(V){return V===93?(t.consume(V),P):O(V)}function P(V){return V===62?(t.consume(V),H):V===45&&i===2?(t.consume(V),P):O(V)}function H(V){return V===null||vt(V)?(t.exit("htmlFlowData"),W(V)):(t.consume(V),H)}function W(V){return t.exit("htmlFlow"),e(V)}}function SB(t,e,r){const n=this;return i;function i(s){return vt(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),a):r(s)}function a(s){return n.parser.lazy[n.now().line]?r(s):e(s)}}function _B(t,e,r){return n;function n(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(bu,e,r)}}const CB={name:"htmlText",tokenize:kB};function kB(t,e,r){const n=this;let i,a,s;return o;function o(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),T):P===63?(t.consume(P),w):nn(P)?(t.consume(P),k):r(P)}function u(P){return P===45?(t.consume(P),c):P===91?(t.consume(P),a=0,x):nn(P)?(t.consume(P),b):r(P)}function c(P){return P===45?(t.consume(P),f):r(P)}function d(P){return P===null?r(P):P===45?(t.consume(P),p):vt(P)?(s=d,I(P)):(t.consume(P),d)}function p(P){return P===45?(t.consume(P),f):d(P)}function f(P){return P===62?j(P):P===45?p(P):d(P)}function x(P){const H="CDATA[";return P===H.charCodeAt(a++)?(t.consume(P),a===H.length?S:x):r(P)}function S(P){return P===null?r(P):P===93?(t.consume(P),v):vt(P)?(s=S,I(P)):(t.consume(P),S)}function v(P){return P===93?(t.consume(P),m):S(P)}function m(P){return P===62?j(P):P===93?(t.consume(P),m):S(P)}function b(P){return P===null||P===62?j(P):vt(P)?(s=b,I(P)):(t.consume(P),b)}function w(P){return P===null?r(P):P===63?(t.consume(P),_):vt(P)?(s=w,I(P)):(t.consume(P),w)}function _(P){return P===62?j(P):w(P)}function T(P){return nn(P)?(t.consume(P),N):r(P)}function N(P){return P===45||Gr(P)?(t.consume(P),N):E(P)}function E(P){return vt(P)?(s=E,I(P)):Et(P)?(t.consume(P),E):j(P)}function k(P){return P===45||Gr(P)?(t.consume(P),k):P===47||P===62||Kt(P)?L(P):r(P)}function L(P){return P===47?(t.consume(P),j):P===58||P===95||nn(P)?(t.consume(P),A):vt(P)?(s=L,I(P)):Et(P)?(t.consume(P),L):j(P)}function A(P){return P===45||P===46||P===58||P===95||Gr(P)?(t.consume(P),A):M(P)}function M(P){return P===61?(t.consume(P),O):vt(P)?(s=M,I(P)):Et(P)?(t.consume(P),M):L(P)}function O(P){return P===null||P===60||P===61||P===62||P===96?r(P):P===34||P===39?(t.consume(P),i=P,$):vt(P)?(s=O,I(P)):Et(P)?(t.consume(P),O):(t.consume(P),D)}function $(P){return P===i?(t.consume(P),i=void 0,B):P===null?r(P):vt(P)?(s=$,I(P)):(t.consume(P),$)}function D(P){return P===null||P===34||P===39||P===60||P===61||P===96?r(P):P===47||P===62||Kt(P)?L(P):(t.consume(P),D)}function B(P){return P===47||P===62||Kt(P)?L(P):r(P)}function j(P){return P===62?(t.consume(P),t.exit("htmlTextData"),t.exit("htmlText"),e):r(P)}function I(P){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(P),t.exit("lineEnding"),U}function U(P){return Et(P)?At(t,F,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):F(P)}function F(P){return t.enter("htmlTextData"),s(P)}}const Jm={name:"labelEnd",resolveAll:RB,resolveTo:LB,tokenize:DB},EB={tokenize:AB},TB={tokenize:PB},NB={tokenize:MB};function RB(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&&Rn(t,0,t.length,r),t}function LB(t,e){let r=t.length,n=0,i,a,s,o;for(;r--;)if(i=t[r][1],a){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;t[r][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(s){if(t[r][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(a=r,i.type!=="labelLink")){n=2;break}}else i.type==="labelEnd"&&(s=r);const l={type:t[a][1].type==="labelLink"?"link":"image",start:{...t[a][1].start},end:{...t[t.length-1][1].end}},u={type:"label",start:{...t[a][1].start},end:{...t[s][1].end}},c={type:"labelText",start:{...t[a+n+2][1].end},end:{...t[s-2][1].start}};return o=[["enter",l,e],["enter",u,e]],o=$n(o,t.slice(a+1,a+n+3)),o=$n(o,[["enter",c,e]]),o=$n(o,hh(e.parser.constructs.insideSpan.null,t.slice(a+n+4,s-3),e)),o=$n(o,[["exit",c,e],t[s-2],t[s-1],["exit",u,e]]),o=$n(o,t.slice(s+1)),o=$n(o,[["exit",l,e]]),Rn(t,a,t.length,o),t}function DB(t,e,r){const n=this;let i=n.events.length,a,s;for(;i--;)if((n.events[i][1].type==="labelImage"||n.events[i][1].type==="labelLink")&&!n.events[i][1]._balanced){a=n.events[i][1];break}return o;function o(p){return a?a._inactive?d(p):(s=n.parser.defined.includes(ni(n.sliceSerialize({start:a.end,end:n.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(p),t.exit("labelMarker"),t.exit("labelEnd"),l):r(p)}function l(p){return p===40?t.attempt(EB,c,s?c:d)(p):p===91?t.attempt(TB,c,s?u:d)(p):s?c(p):d(p)}function u(p){return t.attempt(NB,c,d)(p)}function c(p){return e(p)}function d(p){return a._balanced=!0,r(p)}}function AB(t,e,r){return n;function n(d){return t.enter("resource"),t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),i}function i(d){return Kt(d)?Hl(t,a)(d):a(d)}function a(d){return d===41?c(d):dk(t,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function s(d){return Kt(d)?Hl(t,l)(d):c(d)}function o(d){return r(d)}function l(d){return d===34||d===39||d===40?fk(t,u,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):c(d)}function u(d){return Kt(d)?Hl(t,c)(d):c(d)}function c(d){return d===41?(t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),t.exit("resource"),e):r(d)}}function PB(t,e,r){const n=this;return i;function i(o){return hk.call(n,t,a,s,"reference","referenceMarker","referenceString")(o)}function a(o){return n.parser.defined.includes(ni(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?e(o):r(o)}function s(o){return r(o)}}function MB(t,e,r){return n;function n(a){return t.enter("reference"),t.enter("referenceMarker"),t.consume(a),t.exit("referenceMarker"),i}function i(a){return a===93?(t.enter("referenceMarker"),t.consume(a),t.exit("referenceMarker"),t.exit("reference"),e):r(a)}}const OB={name:"labelStartImage",resolveAll:Jm.resolveAll,tokenize:jB};function jB(t,e,r){const n=this;return i;function i(o){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(o),t.exit("labelImageMarker"),a}function a(o){return o===91?(t.enter("labelMarker"),t.consume(o),t.exit("labelMarker"),t.exit("labelImage"),s):r(o)}function s(o){return o===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(o):e(o)}}const IB={name:"labelStartLink",resolveAll:Jm.resolveAll,tokenize:BB};function BB(t,e,r){const n=this;return i;function i(s){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(s),t.exit("labelMarker"),t.exit("labelLink"),a}function a(s){return s===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(s):e(s)}}const sv={name:"lineEnding",tokenize:FB};function FB(t,e){return r;function r(n){return t.enter("lineEnding"),t.consume(n),t.exit("lineEnding"),At(t,e,"linePrefix")}}const yd={name:"thematicBreak",tokenize:zB};function zB(t,e,r){let n=0,i;return a;function a(u){return t.enter("thematicBreak"),s(u)}function s(u){return i=u,o(u)}function o(u){return u===i?(t.enter("thematicBreakSequence"),l(u)):n>=3&&(u===null||vt(u))?(t.exit("thematicBreak"),e(u)):r(u)}function l(u){return u===i?(t.consume(u),n++,l):(t.exit("thematicBreakSequence"),Et(u)?At(t,o,"whitespace")(u):o(u))}}const pn={continuation:{tokenize:WB},exit:GB,name:"list",tokenize:UB},$B={partial:!0,tokenize:qB},HB={partial:!0,tokenize:VB};function UB(t,e,r){const n=this,i=n.events[n.events.length-1];let a=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,s=0;return o;function o(f){const x=n.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(x==="listUnordered"?!n.containerState.marker||f===n.containerState.marker:em(f)){if(n.containerState.type||(n.containerState.type=x,t.enter(x,{_container:!0})),x==="listUnordered")return t.enter("listItemPrefix"),f===42||f===45?t.check(yd,r,u)(f):u(f);if(!n.interrupt||f===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(f)}return r(f)}function l(f){return em(f)&&++s<10?(t.consume(f),l):(!n.interrupt||s<2)&&(n.containerState.marker?f===n.containerState.marker:f===41||f===46)?(t.exit("listItemValue"),u(f)):r(f)}function u(f){return t.enter("listItemMarker"),t.consume(f),t.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||f,t.check(bu,n.interrupt?r:c,t.attempt($B,p,d))}function c(f){return n.containerState.initialBlankLine=!0,a++,p(f)}function d(f){return Et(f)?(t.enter("listItemPrefixWhitespace"),t.consume(f),t.exit("listItemPrefixWhitespace"),p):r(f)}function p(f){return n.containerState.size=a+n.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(f)}}function WB(t,e,r){const n=this;return n.containerState._closeFlow=void 0,t.check(bu,i,a);function i(o){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,At(t,e,"listItemIndent",n.containerState.size+1)(o)}function a(o){return n.containerState.furtherBlankLines||!Et(o)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,s(o)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,t.attempt(HB,e,s)(o))}function s(o){return n.containerState._closeFlow=!0,n.interrupt=void 0,At(t,t.attempt(pn,e,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function VB(t,e,r){const n=this;return At(t,i,"listItemIndent",n.containerState.size+1);function i(a){const s=n.events[n.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===n.containerState.size?e(a):r(a)}}function GB(t){t.exit(this.containerState.type)}function qB(t,e,r){const n=this;return At(t,i,"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(a){const s=n.events[n.events.length-1];return!Et(a)&&s&&s[1].type==="listItemPrefixWhitespace"?e(a):r(a)}}const T2={name:"setextUnderline",resolveTo:YB,tokenize:KB};function YB(t,e){let r=t.length,n,i,a;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),!a&&t[r][1].type==="definition"&&(a=r);const s={type:"setextHeading",start:{...t[n][1].start},end:{...t[t.length-1][1].end}};return t[i][1].type="setextHeadingText",a?(t.splice(i,0,["enter",s,e]),t.splice(a+1,0,["exit",t[n][1],e]),t[n][1].end={...t[a][1].end}):t[n][1]=s,t.push(["exit",s,e]),t}function KB(t,e,r){const n=this;let i;return a;function a(u){let c=n.events.length,d;for(;c--;)if(n.events[c][1].type!=="lineEnding"&&n.events[c][1].type!=="linePrefix"&&n.events[c][1].type!=="content"){d=n.events[c][1].type==="paragraph";break}return!n.parser.lazy[n.now().line]&&(n.interrupt||d)?(t.enter("setextHeadingLine"),i=u,s(u)):r(u)}function s(u){return t.enter("setextHeadingLineSequence"),o(u)}function o(u){return u===i?(t.consume(u),o):(t.exit("setextHeadingLineSequence"),Et(u)?At(t,l,"lineSuffix")(u):l(u))}function l(u){return u===null||vt(u)?(t.exit("setextHeadingLine"),e(u)):r(u)}}const XB={tokenize:QB};function QB(t){const e=this,r=t.attempt(bu,n,t.attempt(this.parser.constructs.flowInitial,i,At(t,t.attempt(this.parser.constructs.flow,i,t.attempt(rB,i)),"linePrefix")));return r;function n(a){if(a===null){t.consume(a);return}return t.enter("lineEndingBlank"),t.consume(a),t.exit("lineEndingBlank"),e.currentConstruct=void 0,r}function i(a){if(a===null){t.consume(a);return}return t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),e.currentConstruct=void 0,r}}const ZB={resolveAll:gk()},JB=pk("string"),eF=pk("text");function pk(t){return{resolveAll:gk(t==="text"?tF:void 0),tokenize:e};function e(r){const n=this,i=this.parser.constructs[t],a=r.attempt(i,s,o);return s;function s(c){return u(c)?a(c):o(c)}function o(c){if(c===null){r.consume(c);return}return r.enter("data"),r.consume(c),l}function l(c){return u(c)?(r.exit("data"),a(c)):(r.consume(c),l)}function u(c){if(c===null)return!0;const d=i[c];let p=-1;if(d)for(;++p<d.length;){const f=d[p];if(!f.previous||f.previous.call(n,n.previous))return!0}return!1}}}function gk(t){return e;function e(r,n){let i=-1,a;for(;++i<=r.length;)a===void 0?r[i]&&r[i][1].type==="data"&&(a=i,i++):(!r[i]||r[i][1].type!=="data")&&(i!==a+2&&(r[a][1].end=r[i-1][1].end,r.splice(a+2,i-a-2),i=a+2),a=void 0);return t?t(r,n):r}}function tF(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 a=i.length,s=-1,o=0,l;for(;a--;){const u=i[a];if(typeof u=="string"){for(s=u.length;u.charCodeAt(s-1)===32;)o++,s--;if(s)break;s=-1}else if(u===-2)l=!0,o++;else if(u!==-1){a++;break}}if(e._contentTypeTextTrailing&&r===t.length&&(o=0),o){const u={type:r===t.length||l||o<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:a?s:n.start._bufferIndex+s,_index:n.start._index+a,line:n.end.line,column:n.end.column-o,offset:n.end.offset-o},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 rF={42:pn,43:pn,45:pn,48:pn,49:pn,50:pn,51:pn,52:pn,53:pn,54:pn,55:pn,56:pn,57:pn,62:ok},nF={91:oB},iF={[-2]:av,[-1]:av,32:av},aF={35:fB,42:yd,45:[T2,yd],60:mB,61:T2,95:yd,96:k2,126:k2},sF={38:uk,92:lk},oF={[-5]:sv,[-4]:sv,[-3]:sv,33:OB,38:uk,42:tm,60:[II,CB],91:IB,92:[dB,lk],93:Jm,95:tm,96:XI},lF={null:[tm,ZB]},uF={null:[42,95]},cF={null:[]},dF=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:uF,contentInitial:nF,disable:cF,document:rF,flow:aF,flowInitial:iF,insideSpan:lF,string:sF,text:oF},Symbol.toStringTag,{value:"Module"}));function hF(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={},a=[];let s=[],o=[];const l={attempt:E(T),check:E(N),consume:b,enter:w,exit:_,interrupt:E(N,{interrupt:!0})},u={code:null,containerState:{},defineSkip:S,events:[],now:x,parser:t,previous:null,sliceSerialize:p,sliceStream:f,write:d};let c=e.tokenize.call(u,l);return e.resolveAll&&a.push(e),u;function d(M){return s=$n(s,M),v(),s[s.length-1]!==null?[]:(k(e,0),u.events=hh(a,u.events,u),u.events)}function p(M,O){return pF(f(M),O)}function f(M){return fF(s,M)}function x(){const{_bufferIndex:M,_index:O,line:$,column:D,offset:B}=n;return{_bufferIndex:M,_index:O,line:$,column:D,offset:B}}function S(M){i[M.line]=M.column,A()}function v(){let M;for(;n._index<s.length;){const O=s[n._index];if(typeof O=="string")for(M=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===M&&n._bufferIndex<O.length;)m(O.charCodeAt(n._bufferIndex));else m(O)}}function m(M){c=c(M)}function b(M){vt(M)?(n.line++,n.column=1,n.offset+=M===-3?2:1,A()):M!==-1&&(n.column++,n.offset++),n._bufferIndex<0?n._index++:(n._bufferIndex++,n._bufferIndex===s[n._index].length&&(n._bufferIndex=-1,n._index++)),u.previous=M}function w(M,O){const $=O||{};return $.type=M,$.start=x(),u.events.push(["enter",$,u]),o.push($),$}function _(M){const O=o.pop();return O.end=x(),u.events.push(["exit",O,u]),O}function T(M,O){k(M,O.from)}function N(M,O){O.restore()}function E(M,O){return $;function $(D,B,j){let I,U,F,P;return Array.isArray(D)?W(D):"tokenize"in D?W([D]):H(D);function H(ne){return X;function X(q){const Y=q!==null&&ne[q],Q=q!==null&&ne.null,te=[...Array.isArray(Y)?Y:Y?[Y]:[],...Array.isArray(Q)?Q:Q?[Q]:[]];return W(te)(q)}}function W(ne){return I=ne,U=0,ne.length===0?j:V(ne[U])}function V(ne){return X;function X(q){return P=L(),F=ne,ne.partial||(u.currentConstruct=ne),ne.name&&u.parser.constructs.disable.null.includes(ne.name)?J():ne.tokenize.call(O?Object.assign(Object.create(u),O):u,l,re,J)(q)}}function re(ne){return M(F,P),B}function J(ne){return P.restore(),++U<I.length?V(I[U]):j}}}function k(M,O){M.resolveAll&&!a.includes(M)&&a.push(M),M.resolve&&Rn(u.events,O,u.events.length-O,M.resolve(u.events.slice(O),u)),M.resolveTo&&(u.events=M.resolveTo(u.events,u))}function L(){const M=x(),O=u.previous,$=u.currentConstruct,D=u.events.length,B=Array.from(o);return{from:D,restore:j};function j(){n=M,u.previous=O,u.currentConstruct=$,u.events.length=D,o=B,A()}}function A(){n.line in i&&n.column<2&&(n.column=i[n.line],n.offset+=i[n.line]-1)}}function fF(t,e){const r=e.start._index,n=e.start._bufferIndex,i=e.end._index,a=e.end._bufferIndex;let s;if(r===i)s=[t[r].slice(n,a)];else{if(s=t.slice(r,i),n>-1){const o=s[0];typeof o=="string"?s[0]=o.slice(n):s.shift()}a>0&&s.push(t[i].slice(0,a))}return s}function pF(t,e){let r=-1;const n=[];let i;for(;++r<t.length;){const a=t[r];let s;if(typeof a=="string")s=a;else switch(a){case-5:{s="\r";break}case-4:{s=`
|
|
396
|
+
`;break}case-3:{s=`\r
|
|
397
|
+
`;break}case-2:{s=e?" ":" ";break}case-1:{if(!e&&i)continue;s=" ";break}default:s=String.fromCharCode(a)}i=a===-2,n.push(s)}return n.join("")}function gF(t){const n={constructs:ak([dF,...(t||{}).extensions||[]]),content:i(LI),defined:[],document:i(AI),flow:i(XB),lazy:{},string:i(JB),text:i(eF)};return n;function i(a){return s;function s(o){return hF(n,a,o)}}}function vF(t){for(;!ck(t););return t}const N2=/[\0\t\n\r]/g;function mF(){let t=1,e="",r=!0,n;return i;function i(a,s,o){const l=[];let u,c,d,p,f;for(a=e+(typeof a=="string"?a.toString():new TextDecoder(s||void 0).decode(a)),d=0,e="",r&&(a.charCodeAt(0)===65279&&d++,r=void 0);d<a.length;){if(N2.lastIndex=d,u=N2.exec(a),p=u&&u.index!==void 0?u.index:a.length,f=a.charCodeAt(p),!u){e=a.slice(d);break}if(f===10&&d===p&&n)l.push(-3),n=void 0;else switch(n&&(l.push(-5),n=void 0),d<p&&(l.push(a.slice(d,p)),t+=p-d),f){case 0:{l.push(65533),t++;break}case 9:{for(c=Math.ceil(t/4)*4,l.push(-2);t++<c;)l.push(-1);break}case 10:{l.push(-4),t=1;break}default:n=!0,t=1}d=p+1}return o&&(n&&l.push(-5),e&&l.push(e),l.push(null)),l}}const yF=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function xF(t){return t.replace(yF,bF)}function bF(t,e,r){if(e)return e;if(r.charCodeAt(0)===35){const i=r.charCodeAt(1),a=i===120||i===88;return sk(r.slice(a?2:1),a?16:10)}return Zm(r)||t}const vk={}.hasOwnProperty;function wF(t,e,r){return e&&typeof e=="object"&&(r=e,e=void 0),SF(r)(vF(gF(r).document().write(mF()(t,e,!0))))}function SF(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(Ae),autolinkProtocol:L,autolinkEmail:L,atxHeading:a(Le),blockQuote:a(Q),characterEscape:L,characterReference:L,codeFenced:a(te),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:a(te,s),codeText:a(ie,s),codeTextData:L,data:L,codeFlowValue:L,definition:a(le),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:a(pe),hardBreakEscape:a(je),hardBreakTrailing:a(je),htmlFlow:a(Se,s),htmlFlowData:L,htmlText:a(Se,s),htmlTextData:L,image:a(Te),label:s,link:a(Ae),listItem:a(Pe),listItemValue:p,listOrdered:a(Ne,d),listUnordered:a(Ne),paragraph:a(ze),reference:V,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:a(Le),strong:a(Ie),thematicBreak:a(Ge)},exit:{atxHeading:l(),atxHeadingSequence:T,autolink:l(),autolinkEmail:Y,autolinkProtocol:q,blockQuote:l(),characterEscapeValue:A,characterReferenceMarkerHexadecimal:J,characterReferenceMarkerNumeric:J,characterReferenceValue:ne,characterReference:X,codeFenced:l(v),codeFencedFence:S,codeFencedFenceInfo:f,codeFencedFenceMeta:x,codeFlowValue:A,codeIndented:l(m),codeText:l(B),codeTextData:A,data:A,definition:l(),definitionDestinationString:_,definitionLabelString:b,definitionTitleString:w,emphasis:l(),hardBreakEscape:l(O),hardBreakTrailing:l(O),htmlFlow:l($),htmlFlowData:A,htmlText:l(D),htmlTextData:A,image:l(I),label:F,labelText:U,lineEnding:M,link:l(j),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:re,resourceDestinationString:P,resourceTitleString:H,resource:W,setextHeading:l(k),setextHeadingLineSequence:E,setextHeadingText:N,strong:l(),thematicBreak:l()}};mk(e,(t||{}).mdastExtensions||[]);const r={};return n;function n(ve){let Ee={type:"root",children:[]};const Me={stack:[Ee],tokenStack:[],config:e,enter:o,exit:u,buffer:s,resume:c,data:r},ye=[];let ee=-1;for(;++ee<ve.length;)if(ve[ee][1].type==="listOrdered"||ve[ee][1].type==="listUnordered")if(ve[ee][0]==="enter")ye.push(ee);else{const ue=ye.pop();ee=i(ve,ue,ee)}for(ee=-1;++ee<ve.length;){const ue=e[ve[ee][0]];vk.call(ue,ve[ee][1].type)&&ue[ve[ee][1].type].call(Object.assign({sliceSerialize:ve[ee][2].sliceSerialize},Me),ve[ee][1])}if(Me.tokenStack.length>0){const ue=Me.tokenStack[Me.tokenStack.length-1];(ue[1]||R2).call(Me,void 0,ue[0])}for(Ee.position={start:ha(ve.length>0?ve[0][1].start:{line:1,column:1,offset:0}),end:ha(ve.length>0?ve[ve.length-2][1].end:{line:1,column:1,offset:0})},ee=-1;++ee<e.transforms.length;)Ee=e.transforms[ee](Ee)||Ee;return Ee}function i(ve,Ee,Me){let ye=Ee-1,ee=-1,ue=!1,ae,se,ce,be;for(;++ye<=Me;){const he=ve[ye];switch(he[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{he[0]==="enter"?ee++:ee--,be=void 0;break}case"lineEndingBlank":{he[0]==="enter"&&(ae&&!be&&!ee&&!ce&&(ce=ye),be=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:be=void 0}if(!ee&&he[0]==="enter"&&he[1].type==="listItemPrefix"||ee===-1&&he[0]==="exit"&&(he[1].type==="listUnordered"||he[1].type==="listOrdered")){if(ae){let de=ye;for(se=void 0;de--;){const me=ve[de];if(me[1].type==="lineEnding"||me[1].type==="lineEndingBlank"){if(me[0]==="exit")continue;se&&(ve[se][1].type="lineEndingBlank",ue=!0),me[1].type="lineEnding",se=de}else if(!(me[1].type==="linePrefix"||me[1].type==="blockQuotePrefix"||me[1].type==="blockQuotePrefixWhitespace"||me[1].type==="blockQuoteMarker"||me[1].type==="listItemIndent"))break}ce&&(!se||ce<se)&&(ae._spread=!0),ae.end=Object.assign({},se?ve[se][1].start:he[1].end),ve.splice(se||ye,0,["exit",ae,he[2]]),ye++,Me++}if(he[1].type==="listItemPrefix"){const de={type:"listItem",_spread:!1,start:Object.assign({},he[1].start),end:void 0};ae=de,ve.splice(ye,0,["enter",de,he[2]]),ye++,Me++,ce=void 0,be=!0}}}return ve[Ee][1]._spread=ue,Me}function a(ve,Ee){return Me;function Me(ye){o.call(this,ve(ye),ye),Ee&&Ee.call(this,ye)}}function s(){this.stack.push({type:"fragment",children:[]})}function o(ve,Ee,Me){this.stack[this.stack.length-1].children.push(ve),this.stack.push(ve),this.tokenStack.push([Ee,Me||void 0]),ve.position={start:ha(Ee.start),end:void 0}}function l(ve){return Ee;function Ee(Me){ve&&ve.call(this,Me),u.call(this,Me)}}function u(ve,Ee){const Me=this.stack.pop(),ye=this.tokenStack.pop();if(ye)ye[0].type!==ve.type&&(Ee?Ee.call(this,ve,ye[0]):(ye[1]||R2).call(this,ve,ye[0]));else throw new Error("Cannot close `"+ve.type+"` ("+$l({start:ve.start,end:ve.end})+"): it’s not open");Me.position.end=ha(ve.end)}function c(){return Qm(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function p(ve){if(this.data.expectingFirstListItemValue){const Ee=this.stack[this.stack.length-2];Ee.start=Number.parseInt(this.sliceSerialize(ve),10),this.data.expectingFirstListItemValue=void 0}}function f(){const ve=this.resume(),Ee=this.stack[this.stack.length-1];Ee.lang=ve}function x(){const ve=this.resume(),Ee=this.stack[this.stack.length-1];Ee.meta=ve}function S(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const ve=this.resume(),Ee=this.stack[this.stack.length-1];Ee.value=ve.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function m(){const ve=this.resume(),Ee=this.stack[this.stack.length-1];Ee.value=ve.replace(/(\r?\n|\r)$/g,"")}function b(ve){const Ee=this.resume(),Me=this.stack[this.stack.length-1];Me.label=Ee,Me.identifier=ni(this.sliceSerialize(ve)).toLowerCase()}function w(){const ve=this.resume(),Ee=this.stack[this.stack.length-1];Ee.title=ve}function _(){const ve=this.resume(),Ee=this.stack[this.stack.length-1];Ee.url=ve}function T(ve){const Ee=this.stack[this.stack.length-1];if(!Ee.depth){const Me=this.sliceSerialize(ve).length;Ee.depth=Me}}function N(){this.data.setextHeadingSlurpLineEnding=!0}function E(ve){const Ee=this.stack[this.stack.length-1];Ee.depth=this.sliceSerialize(ve).codePointAt(0)===61?1:2}function k(){this.data.setextHeadingSlurpLineEnding=void 0}function L(ve){const Me=this.stack[this.stack.length-1].children;let ye=Me[Me.length-1];(!ye||ye.type!=="text")&&(ye=$e(),ye.position={start:ha(ve.start),end:void 0},Me.push(ye)),this.stack.push(ye)}function A(ve){const Ee=this.stack.pop();Ee.value+=this.sliceSerialize(ve),Ee.position.end=ha(ve.end)}function M(ve){const Ee=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Me=Ee.children[Ee.children.length-1];Me.position.end=ha(ve.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(Ee.type)&&(L.call(this,ve),A.call(this,ve))}function O(){this.data.atHardBreak=!0}function $(){const ve=this.resume(),Ee=this.stack[this.stack.length-1];Ee.value=ve}function D(){const ve=this.resume(),Ee=this.stack[this.stack.length-1];Ee.value=ve}function B(){const ve=this.resume(),Ee=this.stack[this.stack.length-1];Ee.value=ve}function j(){const ve=this.stack[this.stack.length-1];if(this.data.inReference){const Ee=this.data.referenceType||"shortcut";ve.type+="Reference",ve.referenceType=Ee,delete ve.url,delete ve.title}else delete ve.identifier,delete ve.label;this.data.referenceType=void 0}function I(){const ve=this.stack[this.stack.length-1];if(this.data.inReference){const Ee=this.data.referenceType||"shortcut";ve.type+="Reference",ve.referenceType=Ee,delete ve.url,delete ve.title}else delete ve.identifier,delete ve.label;this.data.referenceType=void 0}function U(ve){const Ee=this.sliceSerialize(ve),Me=this.stack[this.stack.length-2];Me.label=xF(Ee),Me.identifier=ni(Ee).toLowerCase()}function F(){const ve=this.stack[this.stack.length-1],Ee=this.resume(),Me=this.stack[this.stack.length-1];if(this.data.inReference=!0,Me.type==="link"){const ye=ve.children;Me.children=ye}else Me.alt=Ee}function P(){const ve=this.resume(),Ee=this.stack[this.stack.length-1];Ee.url=ve}function H(){const ve=this.resume(),Ee=this.stack[this.stack.length-1];Ee.title=ve}function W(){this.data.inReference=void 0}function V(){this.data.referenceType="collapsed"}function re(ve){const Ee=this.resume(),Me=this.stack[this.stack.length-1];Me.label=Ee,Me.identifier=ni(this.sliceSerialize(ve)).toLowerCase(),this.data.referenceType="full"}function J(ve){this.data.characterReferenceType=ve.type}function ne(ve){const Ee=this.sliceSerialize(ve),Me=this.data.characterReferenceType;let ye;Me?(ye=sk(Ee,Me==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ye=Zm(Ee);const ee=this.stack[this.stack.length-1];ee.value+=ye}function X(ve){const Ee=this.stack.pop();Ee.position.end=ha(ve.end)}function q(ve){A.call(this,ve);const Ee=this.stack[this.stack.length-1];Ee.url=this.sliceSerialize(ve)}function Y(ve){A.call(this,ve);const Ee=this.stack[this.stack.length-1];Ee.url="mailto:"+this.sliceSerialize(ve)}function Q(){return{type:"blockquote",children:[]}}function te(){return{type:"code",lang:null,meta:null,value:""}}function ie(){return{type:"inlineCode",value:""}}function le(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function pe(){return{type:"emphasis",children:[]}}function Le(){return{type:"heading",depth:0,children:[]}}function je(){return{type:"break"}}function Se(){return{type:"html",value:""}}function Te(){return{type:"image",title:null,url:"",alt:null}}function Ae(){return{type:"link",title:null,url:"",children:[]}}function Ne(ve){return{type:"list",ordered:ve.type==="listOrdered",start:null,spread:ve._spread,children:[]}}function Pe(ve){return{type:"listItem",spread:ve._spread,checked:null,children:[]}}function ze(){return{type:"paragraph",children:[]}}function Ie(){return{type:"strong",children:[]}}function $e(){return{type:"text",value:""}}function Ge(){return{type:"thematicBreak"}}}function ha(t){return{line:t.line,column:t.column,offset:t.offset}}function mk(t,e){let r=-1;for(;++r<e.length;){const n=e[r];Array.isArray(n)?mk(t,n):_F(t,n)}}function _F(t,e){let r;for(r in e)if(vk.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 R2(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+$l({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+$l({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+$l({start:e.start,end:e.end})+") is still open")}function CF(t){const e=this;e.parser=r;function r(n){return wF(n,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function kF(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 EF(t,e){const r={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,r),[t.applyData(e,r),{type:"text",value:`
|
|
398
|
+
`}]}function TF(t,e){const r=e.value?e.value+`
|
|
399
|
+
`:"",n={},i=e.lang?e.lang.split(/\s+/):[];i.length>0&&(n.className=["language-"+i[0]]);let a={type:"element",tagName:"code",properties:n,children:[{type:"text",value:r}]};return e.meta&&(a.data={meta:e.meta}),t.patch(e,a),a=t.applyData(e,a),a={type:"element",tagName:"pre",properties:{},children:[a]},t.patch(e,a),a}function NF(t,e){const r={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function RF(t,e){const r={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function LF(t,e){const r=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=String(e.identifier).toUpperCase(),i=Po(n.toLowerCase()),a=t.footnoteOrder.indexOf(n);let s,o=t.footnoteCounts.get(n);o===void 0?(o=0,t.footnoteOrder.push(n),s=t.footnoteOrder.length):s=a+1,o+=1,t.footnoteCounts.set(n,o);const l={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+i,id:r+"fnref-"+i+(o>1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(s)}]};t.patch(e,l);const u={type:"element",tagName:"sup",properties:{},children:[l]};return t.patch(e,u),t.applyData(e,u)}function DF(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 AF(t,e){if(t.options.allowDangerousHtml){const r={type:"raw",value:e.value};return t.patch(e,r),t.applyData(e,r)}}function yk(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),a=i[0];a&&a.type==="text"?a.value="["+a.value:i.unshift({type:"text",value:"["});const s=i[i.length-1];return s&&s.type==="text"?s.value+=n:i.push({type:"text",value:n}),i}function PF(t,e){const r=String(e.identifier).toUpperCase(),n=t.definitionById.get(r);if(!n)return yk(t,e);const i={src:Po(n.url||""),alt:e.alt};n.title!==null&&n.title!==void 0&&(i.title=n.title);const a={type:"element",tagName:"img",properties:i,children:[]};return t.patch(e,a),t.applyData(e,a)}function MF(t,e){const r={src:Po(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 OF(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 jF(t,e){const r=String(e.identifier).toUpperCase(),n=t.definitionById.get(r);if(!n)return yk(t,e);const i={href:Po(n.url||"")};n.title!==null&&n.title!==void 0&&(i.title=n.title);const a={type:"element",tagName:"a",properties:i,children:t.all(e)};return t.patch(e,a),t.applyData(e,a)}function IF(t,e){const r={href:Po(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 BF(t,e,r){const n=t.all(e),i=r?FF(r):xk(e),a={},s=[];if(typeof e.checked=="boolean"){const c=n[0];let d;c&&c.type==="element"&&c.tagName==="p"?d=c:(d={type:"element",tagName:"p",properties:{},children:[]},n.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),a.className=["task-list-item"]}let o=-1;for(;++o<n.length;){const c=n[o];(i||o!==0||c.type!=="element"||c.tagName!=="p")&&s.push({type:"text",value:`
|
|
400
|
+
`}),c.type==="element"&&c.tagName==="p"&&!i?s.push(...c.children):s.push(c)}const l=n[n.length-1];l&&(i||l.type!=="element"||l.tagName!=="p")&&s.push({type:"text",value:`
|
|
401
|
+
`});const u={type:"element",tagName:"li",properties:a,children:s};return t.patch(e,u),t.applyData(e,u)}function FF(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=xk(r[n])}return e}function xk(t){const e=t.spread;return e??t.children.length>1}function zF(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 s=n[i];if(s.type==="element"&&s.tagName==="li"&&s.properties&&Array.isArray(s.properties.className)&&s.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const a={type:"element",tagName:e.ordered?"ol":"ul",properties:r,children:t.wrap(n,!0)};return t.patch(e,a),t.applyData(e,a)}function $F(t,e){const r={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function HF(t,e){const r={type:"root",children:t.wrap(t.all(e))};return t.patch(e,r),t.applyData(e,r)}function UF(t,e){const r={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function WF(t,e){const r=t.all(e),n=r.shift(),i=[];if(n){const s={type:"element",tagName:"thead",properties:{},children:t.wrap([n],!0)};t.patch(e.children[0],s),i.push(s)}if(r.length>0){const s={type:"element",tagName:"tbody",properties:{},children:t.wrap(r,!0)},o=qm(e.children[1]),l=ZC(e.children[e.children.length-1]);o&&l&&(s.position={start:o,end:l}),i.push(s)}const a={type:"element",tagName:"table",properties:{},children:t.wrap(i,!0)};return t.patch(e,a),t.applyData(e,a)}function VF(t,e,r){const n=r?r.children:void 0,a=(n?n.indexOf(e):1)===0?"th":"td",s=r&&r.type==="table"?r.align:void 0,o=s?s.length:e.children.length;let l=-1;const u=[];for(;++l<o;){const d=e.children[l],p={},f=s?s[l]:void 0;f&&(p.align=f);let x={type:"element",tagName:a,properties:p,children:[]};d&&(x.children=t.all(d),t.patch(d,x),x=t.applyData(d,x)),u.push(x)}const c={type:"element",tagName:"tr",properties:{},children:t.wrap(u,!0)};return t.patch(e,c),t.applyData(e,c)}function GF(t,e){const r={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}const L2=9,D2=32;function qF(t){const e=String(t),r=/\r?\n|\r/g;let n=r.exec(e),i=0;const a=[];for(;n;)a.push(A2(e.slice(i,n.index),i>0,!0),n[0]),i=n.index+n[0].length,n=r.exec(e);return a.push(A2(e.slice(i),i>0,!1)),a.join("")}function A2(t,e,r){let n=0,i=t.length;if(e){let a=t.codePointAt(n);for(;a===L2||a===D2;)n++,a=t.codePointAt(n)}if(r){let a=t.codePointAt(i-1);for(;a===L2||a===D2;)i--,a=t.codePointAt(i-1)}return i>n?t.slice(n,i):""}function YF(t,e){const r={type:"text",value:qF(String(e.value))};return t.patch(e,r),t.applyData(e,r)}function KF(t,e){const r={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,r),t.applyData(e,r)}const XF={blockquote:kF,break:EF,code:TF,delete:NF,emphasis:RF,footnoteReference:LF,heading:DF,html:AF,imageReference:PF,image:MF,inlineCode:OF,linkReference:jF,link:IF,listItem:BF,list:zF,paragraph:$F,root:HF,strong:UF,table:WF,tableCell:GF,tableRow:VF,text:YF,thematicBreak:KF,toml:Qc,yaml:Qc,definition:Qc,footnoteDefinition:Qc};function Qc(){}const bk=-1,fh=0,Ul=1,Bd=2,ey=3,ty=4,ry=5,ny=6,wk=7,Sk=8,_k=typeof self=="object"?self:globalThis,P2=(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 _k[t](e)},QF=(t,e)=>{const r=(i,a)=>(t.set(a,i),i),n=i=>{if(t.has(i))return t.get(i);const[a,s]=e[i];switch(a){case fh:case bk:return r(s,i);case Ul:{const o=r([],i);for(const l of s)o.push(n(l));return o}case Bd:{const o=r({},i);for(const[l,u]of s)o[n(l)]=n(u);return o}case ey:return r(new Date(s),i);case ty:{const{source:o,flags:l}=s;return r(new RegExp(o,l),i)}case ry:{const o=r(new Map,i);for(const[l,u]of s)o.set(n(l),n(u));return o}case ny:{const o=r(new Set,i);for(const l of s)o.add(n(l));return o}case wk:{const{name:o,message:l}=s;return r(typeof _k[o]=="function"?P2(o,l):new Error(l),i)}case Sk:return r(BigInt(s),i);case"BigInt":return r(Object(BigInt(s)),i);case"ArrayBuffer":return r(new Uint8Array(s).buffer,s);case"DataView":{const{buffer:o}=new Uint8Array(s);return r(new DataView(o),s)}}return r(P2(a,s),i)};return n},M2=t=>QF(new Map,t)(0),is="",{toString:ZF}={},{keys:JF}=Object,Pl=t=>{const e=typeof t;if(e!=="object"||!t)return[fh,e];const r=ZF.call(t).slice(8,-1);switch(r){case"Array":return[Ul,is];case"Object":return[Bd,is];case"Date":return[ey,is];case"RegExp":return[ty,is];case"Map":return[ry,is];case"Set":return[ny,is];case"DataView":return[Ul,r]}return r.includes("Array")?[Ul,r]:t instanceof Error?[wk,t.name||"Error"]:[Bd,r]},Zc=([t,e])=>t===fh&&(e==="function"||e==="symbol"),e6=(t,e,r,n)=>{const i=(s,o)=>{const l=n.push(s)-1;return r.set(o,l),l},a=s=>{if(r.has(s))return r.get(s);let[o,l]=Pl(s);switch(o){case fh:{let c=s;switch(l){case"bigint":o=Sk,c=s.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+l);c=null;break;case"undefined":return i([bk],s)}return i([o,c],s)}case Ul:{if(l){let p=s;return l==="DataView"?p=new Uint8Array(s.buffer):l==="ArrayBuffer"&&(p=new Uint8Array(s)),i([l,[...p]],s)}const c=[],d=i([o,c],s);for(const p of s)c.push(a(p));return d}case Bd:{if(l)switch(l){case"BigInt":return i([l,s.toString()],s);case"Boolean":case"Number":case"String":return i([l,s.valueOf()],s)}if(e&&"toJSON"in s)return a(s.toJSON());const c=[],d=i([o,c],s);for(const p of JF(s))(t||!Zc(Pl(s[p])))&&c.push([a(p),a(s[p])]);return d}case ey:return i([o,isNaN(s.getTime())?is:s.toISOString()],s);case ty:{const{source:c,flags:d}=s;return i([o,{source:c,flags:d}],s)}case ry:{const c=[],d=i([o,c],s);for(const[p,f]of s)(t||!(Zc(Pl(p))||Zc(Pl(f))))&&c.push([a(p),a(f)]);return d}case ny:{const c=[],d=i([o,c],s);for(const p of s)(t||!Zc(Pl(p)))&&c.push(a(p));return d}}const{message:u}=s;return i([o,{name:l,message:u}],s)};return a},O2=(t,{json:e,lossy:r}={})=>{const n=[];return e6(!(e||r),!!e,new Map,n)(t),n},Fd=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?M2(O2(t,e)):structuredClone(t):(t,e)=>M2(O2(t,e));function t6(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 r6(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function n6(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=t.options.footnoteBackContent||t6,n=t.options.footnoteBackLabel||r6,i=t.options.footnoteLabel||"Footnotes",a=t.options.footnoteLabelTagName||"h2",s=t.options.footnoteLabelProperties||{className:["sr-only"]},o=[];let l=-1;for(;++l<t.footnoteOrder.length;){const u=t.footnoteById.get(t.footnoteOrder[l]);if(!u)continue;const c=t.all(u),d=String(u.identifier).toUpperCase(),p=Po(d.toLowerCase());let f=0;const x=[],S=t.footnoteCounts.get(d);for(;S!==void 0&&++f<=S;){x.length>0&&x.push({type:"text",value:" "});let b=typeof r=="string"?r:r(l,f);typeof b=="string"&&(b={type:"text",value:b}),x.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+p+(f>1?"-"+f:""),dataFootnoteBackref:"",ariaLabel:typeof n=="string"?n:n(l,f),className:["data-footnote-backref"]},children:Array.isArray(b)?b:[b]})}const v=c[c.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const b=v.children[v.children.length-1];b&&b.type==="text"?b.value+=" ":v.children.push({type:"text",value:" "}),v.children.push(...x)}else c.push(...x);const m={type:"element",tagName:"li",properties:{id:e+"fn-"+p},children:t.wrap(c,!0)};t.patch(u,m),o.push(m)}if(o.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:a,properties:{...Fd(s),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
|
|
402
|
+
`},{type:"element",tagName:"ol",properties:{},children:t.wrap(o,!0)},{type:"text",value:`
|
|
403
|
+
`}]}}const ph=(function(t){if(t==null)return o6;if(typeof t=="function")return gh(t);if(typeof t=="object")return Array.isArray(t)?i6(t):a6(t);if(typeof t=="string")return s6(t);throw new Error("Expected function, string, or object as test")});function i6(t){const e=[];let r=-1;for(;++r<t.length;)e[r]=ph(t[r]);return gh(n);function n(...i){let a=-1;for(;++a<e.length;)if(e[a].apply(this,i))return!0;return!1}}function a6(t){const e=t;return gh(r);function r(n){const i=n;let a;for(a in t)if(i[a]!==e[a])return!1;return!0}}function s6(t){return gh(e);function e(r){return r&&r.type===t}}function gh(t){return e;function e(r,n,i){return!!(l6(r)&&t.call(this,r,typeof n=="number"?n:void 0,i||void 0))}}function o6(){return!0}function l6(t){return t!==null&&typeof t=="object"&&"type"in t}const Ck=[],u6=!0,rm=!1,c6="skip";function kk(t,e,r,n){let i;typeof e=="function"&&typeof r!="function"?(n=r,r=e):i=e;const a=ph(i),s=n?-1:1;o(t,void 0,[])();function o(l,u,c){const d=l&&typeof l=="object"?l:{};if(typeof d.type=="string"){const f=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(p,"name",{value:"node ("+(l.type+(f?"<"+f+">":""))+")"})}return p;function p(){let f=Ck,x,S,v;if((!e||a(l,u,c[c.length-1]||void 0))&&(f=d6(r(l,c)),f[0]===rm))return f;if("children"in l&&l.children){const m=l;if(m.children&&f[0]!==c6)for(S=(n?m.children.length:-1)+s,v=c.concat(m);S>-1&&S<m.children.length;){const b=m.children[S];if(x=o(b,S,v)(),x[0]===rm)return x;S=typeof x[1]=="number"?x[1]:S+s}}return f}}}function d6(t){return Array.isArray(t)?t:typeof t=="number"?[u6,t]:t==null?Ck:[t]}function iy(t,e,r,n){let i,a,s;typeof e=="function"&&typeof r!="function"?(a=void 0,s=e,i=r):(a=e,s=r,i=n),kk(t,a,o,i);function o(l,u){const c=u[u.length-1],d=c?c.children.indexOf(l):void 0;return s(l,d,c)}}const nm={}.hasOwnProperty,h6={};function f6(t,e){const r=e||h6,n=new Map,i=new Map,a=new Map,s={...XF,...r.handlers},o={all:u,applyData:g6,definitionById:n,footnoteById:i,footnoteCounts:a,footnoteOrder:[],handlers:s,one:l,options:r,patch:p6,wrap:m6};return iy(t,function(c){if(c.type==="definition"||c.type==="footnoteDefinition"){const d=c.type==="definition"?n:i,p=String(c.identifier).toUpperCase();d.has(p)||d.set(p,c)}}),o;function l(c,d){const p=c.type,f=o.handlers[p];if(nm.call(o.handlers,p)&&f)return f(o,c,d);if(o.options.passThrough&&o.options.passThrough.includes(p)){if("children"in c){const{children:S,...v}=c,m=Fd(v);return m.children=o.all(c),m}return Fd(c)}return(o.options.unknownHandler||v6)(o,c,d)}function u(c){const d=[];if("children"in c){const p=c.children;let f=-1;for(;++f<p.length;){const x=o.one(p[f],c);if(x){if(f&&p[f-1].type==="break"&&(!Array.isArray(x)&&x.type==="text"&&(x.value=j2(x.value)),!Array.isArray(x)&&x.type==="element")){const S=x.children[0];S&&S.type==="text"&&(S.value=j2(S.value))}Array.isArray(x)?d.push(...x):d.push(x)}}}return d}}function p6(t,e){t.position&&(e.position=rI(t))}function g6(t,e){let r=e;if(t&&t.data){const n=t.data.hName,i=t.data.hChildren,a=t.data.hProperties;if(typeof n=="string")if(r.type==="element")r.tagName=n;else{const s="children"in r?r.children:[r];r={type:"element",tagName:n,properties:{},children:s}}r.type==="element"&&a&&Object.assign(r.properties,Fd(a)),"children"in r&&r.children&&i!==null&&i!==void 0&&(r.children=i)}return r}function v6(t,e){const r=e.data||{},n="value"in e&&!(nm.call(r,"hProperties")||nm.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 m6(t,e){const r=[];let n=-1;for(e&&r.push({type:"text",value:`
|
|
404
|
+
`});++n<t.length;)n&&r.push({type:"text",value:`
|
|
405
|
+
`}),r.push(t[n]);return e&&t.length>0&&r.push({type:"text",value:`
|
|
406
|
+
`}),r}function j2(t){let e=0,r=t.charCodeAt(e);for(;r===9||r===32;)e++,r=t.charCodeAt(e);return t.slice(e)}function I2(t,e){const r=f6(t,e),n=r.one(t,void 0),i=n6(r),a=Array.isArray(n)?{type:"root",children:n}:n||{type:"root",children:[]};return i&&a.children.push({type:"text",value:`
|
|
407
|
+
`},i),a}function y6(t,e){return t&&"run"in t?async function(r,n){const i=I2(r,{file:n,...e});await t.run(i,n)}:function(r,n){return I2(r,{file:n,...t||e})}}function B2(t){if(t)throw t}var ov,F2;function x6(){if(F2)return ov;F2=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]"},a=function(u){if(!u||e.call(u)!=="[object Object]")return!1;var c=t.call(u,"constructor"),d=u.constructor&&u.constructor.prototype&&t.call(u.constructor.prototype,"isPrototypeOf");if(u.constructor&&!c&&!d)return!1;var p;for(p in u);return typeof p>"u"||t.call(u,p)},s=function(u,c){r&&c.name==="__proto__"?r(u,c.name,{enumerable:!0,configurable:!0,value:c.newValue,writable:!0}):u[c.name]=c.newValue},o=function(u,c){if(c==="__proto__")if(t.call(u,c)){if(n)return n(u,c).value}else return;return u[c]};return ov=function l(){var u,c,d,p,f,x,S=arguments[0],v=1,m=arguments.length,b=!1;for(typeof S=="boolean"&&(b=S,S=arguments[1]||{},v=2),(S==null||typeof S!="object"&&typeof S!="function")&&(S={});v<m;++v)if(u=arguments[v],u!=null)for(c in u)d=o(S,c),p=o(u,c),S!==p&&(b&&p&&(a(p)||(f=i(p)))?(f?(f=!1,x=d&&i(d)?d:[]):x=d&&a(d)?d:{},s(S,{name:c,newValue:l(b,x,p)})):typeof p<"u"&&s(S,{name:c,newValue:p}));return S},ov}var b6=x6();const lv=$d(b6);function im(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 w6(){const t=[],e={run:r,use:n};return e;function r(...i){let a=-1;const s=i.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);o(null,...i);function o(l,...u){const c=t[++a];let d=-1;if(l){s(l);return}for(;++d<i.length;)(u[d]===null||u[d]===void 0)&&(u[d]=i[d]);i=u,c?S6(c,o)(...u):s(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 S6(t,e){let r;return n;function n(...s){const o=t.length>s.length;let l;o&&s.push(i);try{l=t.apply(this,s)}catch(u){const c=u;if(o&&r)throw c;return i(c)}o||(l&&l.then&&typeof l.then=="function"?l.then(a,i):l instanceof Error?i(l):a(l))}function i(s,...o){r||(r=!0,e(s,...o))}function a(s){i(null,s)}}const yi={basename:_6,dirname:C6,extname:k6,join:E6,sep:"/"};function _6(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');wu(t);let r=0,n=-1,i=t.length,a;if(e===void 0||e.length===0||e.length>t.length){for(;i--;)if(t.codePointAt(i)===47){if(a){r=i+1;break}}else n<0&&(a=!0,n=i+1);return n<0?"":t.slice(r,n)}if(e===t)return"";let s=-1,o=e.length-1;for(;i--;)if(t.codePointAt(i)===47){if(a){r=i+1;break}}else s<0&&(a=!0,s=i+1),o>-1&&(t.codePointAt(i)===e.codePointAt(o--)?o<0&&(n=i):(o=-1,n=s));return r===n?n=s:n<0&&(n=t.length),t.slice(r,n)}function C6(t){if(wu(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 k6(t){wu(t);let e=t.length,r=-1,n=0,i=-1,a=0,s;for(;e--;){const o=t.codePointAt(e);if(o===47){if(s){n=e+1;break}continue}r<0&&(s=!0,r=e+1),o===46?i<0?i=e:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||r<0||a===0||a===1&&i===r-1&&i===n+1?"":t.slice(i,r)}function E6(...t){let e=-1,r;for(;++e<t.length;)wu(t[e]),t[e]&&(r=r===void 0?t[e]:r+"/"+t[e]);return r===void 0?".":T6(r)}function T6(t){wu(t);const e=t.codePointAt(0)===47;let r=N6(t,!e);return r.length===0&&!e&&(r="."),r.length>0&&t.codePointAt(t.length-1)===47&&(r+="/"),e?"/"+r:r}function N6(t,e){let r="",n=0,i=-1,a=0,s=-1,o,l;for(;++s<=t.length;){if(s<t.length)o=t.codePointAt(s);else{if(o===47)break;o=47}if(o===47){if(!(i===s-1||a===1))if(i!==s-1&&a===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=s,a=0;continue}}else if(r.length>0){r="",n=0,i=s,a=0;continue}}e&&(r=r.length>0?r+"/..":"..",n=2)}else r.length>0?r+="/"+t.slice(i+1,s):r=t.slice(i+1,s),n=s-i-1;i=s,a=0}else o===46&&a>-1?a++:a=-1}return r}function wu(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const R6={cwd:L6};function L6(){return"/"}function am(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function D6(t){if(typeof t=="string")t=new URL(t);else if(!am(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 A6(t)}function A6(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 uv=["history","path","basename","stem","extname","dirname"];class Ek{constructor(e){let r;e?am(e)?r={path:e}:typeof e=="string"||P6(e)?r={value:e}:r=e:r={},this.cwd="cwd"in r?"":R6.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<uv.length;){const a=uv[n];a in r&&r[a]!==void 0&&r[a]!==null&&(this[a]=a==="history"?[...r[a]]:r[a])}let i;for(i in r)uv.includes(i)||(this[i]=r[i])}get basename(){return typeof this.path=="string"?yi.basename(this.path):void 0}set basename(e){dv(e,"basename"),cv(e,"basename"),this.path=yi.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?yi.dirname(this.path):void 0}set dirname(e){z2(this.basename,"dirname"),this.path=yi.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?yi.extname(this.path):void 0}set extname(e){if(cv(e,"extname"),z2(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=yi.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){am(e)&&(e=D6(e)),dv(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?yi.basename(this.path,this.extname):void 0}set stem(e){dv(e,"stem"),cv(e,"stem"),this.path=yi.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 Xr(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 cv(t,e){if(t&&t.includes(yi.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+yi.sep+"`")}function dv(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function z2(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function P6(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const M6=(function(t){const n=this.constructor.prototype,i=n[t],a=function(){return i.apply(a,arguments)};return Object.setPrototypeOf(a,n),a}),O6={}.hasOwnProperty;class ay extends M6{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=w6()}copy(){const e=new ay;let r=-1;for(;++r<this.attachers.length;){const n=this.attachers[r];e.use(...n)}return e.data(lv(!0,{},this.namespace)),e}data(e,r){return typeof e=="string"?arguments.length===2?(pv("data",this.frozen),this.namespace[e]=r,this):O6.call(this.namespace,e)&&this.namespace[e]||void 0:e?(pv("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=Jc(e),n=this.parser||this.Parser;return hv("parse",n),n(String(r),r)}process(e,r){const n=this;return this.freeze(),hv("process",this.parser||this.Parser),fv("process",this.compiler||this.Compiler),r?i(void 0,r):new Promise(i);function i(a,s){const o=Jc(e),l=n.parse(o);n.run(l,o,function(c,d,p){if(c||!d||!p)return u(c);const f=d,x=n.stringify(f,p);B6(x)?p.value=x:p.result=x,u(c,p)});function u(c,d){c||!d?s(c):a?a(d):r(void 0,d)}}}processSync(e){let r=!1,n;return this.freeze(),hv("processSync",this.parser||this.Parser),fv("processSync",this.compiler||this.Compiler),this.process(e,i),H2("processSync","process",r),n;function i(a,s){r=!0,B2(a),n=s}}run(e,r,n){$2(e),this.freeze();const i=this.transformers;return!n&&typeof r=="function"&&(n=r,r=void 0),n?a(void 0,n):new Promise(a);function a(s,o){const l=Jc(r);i.run(e,l,u);function u(c,d,p){const f=d||e;c?o(c):s?s(f):n(void 0,f,p)}}}runSync(e,r){let n=!1,i;return this.run(e,r,a),H2("runSync","run",n),i;function a(s,o){B2(s),i=o,n=!0}}stringify(e,r){this.freeze();const n=Jc(r),i=this.compiler||this.Compiler;return fv("stringify",i),$2(e),i(e,n)}use(e,...r){const n=this.attachers,i=this.namespace;if(pv("use",this.frozen),e!=null)if(typeof e=="function")l(e,r);else if(typeof e=="object")Array.isArray(e)?o(e):s(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function a(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[c,...d]=u;l(c,d)}else s(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function s(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");o(u.plugins),u.settings&&(i.settings=lv(!0,i.settings,u.settings))}function o(u){let c=-1;if(u!=null)if(Array.isArray(u))for(;++c<u.length;){const d=u[c];a(d)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,c){let d=-1,p=-1;for(;++d<n.length;)if(n[d][0]===u){p=d;break}if(p===-1)n.push([u,...c]);else if(c.length>0){let[f,...x]=c;const S=n[p][1];im(S)&&im(f)&&(f=lv(!0,S,f)),n[p]=[u,f,...x]}}}}const j6=new ay().freeze();function hv(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function fv(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function pv(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 $2(t){if(!im(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function H2(t,e,r){if(!r)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Jc(t){return I6(t)?t:new Ek(t)}function I6(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function B6(t){return typeof t=="string"||F6(t)}function F6(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const z6="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",U2=[],W2={allowDangerousHtml:!0},$6=/^(https?|ircs?|mailto|xmpp)$/i,H6=[{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 U6(t){const e=W6(t),r=V6(t);return G6(e.runSync(e.parse(r),r),t)}function W6(t){const e=t.rehypePlugins||U2,r=t.remarkPlugins||U2,n=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...W2}:W2;return j6().use(CF).use(r).use(y6,n).use(e)}function V6(t){const e=t.children||"",r=new Ek;return typeof e=="string"&&(r.value=e),r}function G6(t,e){const r=e.allowedElements,n=e.allowElement,i=e.components,a=e.disallowedElements,s=e.skipHtml,o=e.unwrapDisallowed,l=e.urlTransform||q6;for(const c of H6)Object.hasOwn(e,c.from)&&(""+c.from+(c.to?"use `"+c.to+"` instead":"remove it")+z6+c.id,void 0);return iy(t,u),oI(t,{Fragment:y.Fragment,components:i,ignoreInvalidStyle:!0,jsx:y.jsx,jsxs:y.jsxs,passKeys:!0,passNode:!0});function u(c,d,p){if(c.type==="raw"&&p&&typeof d=="number")return s?p.children.splice(d,1):p.children[d]={type:"text",value:c.value},d;if(c.type==="element"){let f;for(f in iv)if(Object.hasOwn(iv,f)&&Object.hasOwn(c.properties,f)){const x=c.properties[f],S=iv[f];(S===null||S.includes(c.tagName))&&(c.properties[f]=l(String(x||""),f,c))}}if(c.type==="element"){let f=r?!r.includes(c.tagName):a?a.includes(c.tagName):!1;if(!f&&n&&typeof d=="number"&&(f=!n(c,d,p)),f&&p&&typeof d=="number")return o&&c.children?p.children.splice(d,1,...c.children):p.children.splice(d,1),d}}}function q6(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||$6.test(t.slice(0,e))?t:""}function V2(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 Y6(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function K6(t,e,r){const i=ph((r||{}).ignore||[]),a=X6(e);let s=-1;for(;++s<a.length;)kk(t,"text",o);function o(u,c){let d=-1,p;for(;++d<c.length;){const f=c[d],x=p?p.children:void 0;if(i(f,x?x.indexOf(f):void 0,p))return;p=f}if(p)return l(u,c)}function l(u,c){const d=c[c.length-1],p=a[s][0],f=a[s][1];let x=0;const v=d.children.indexOf(u);let m=!1,b=[];p.lastIndex=0;let w=p.exec(u.value);for(;w;){const _=w.index,T={index:w.index,input:w.input,stack:[...c,u]};let N=f(...w,T);if(typeof N=="string"&&(N=N.length>0?{type:"text",value:N}:void 0),N===!1?p.lastIndex=_+1:(x!==_&&b.push({type:"text",value:u.value.slice(x,_)}),Array.isArray(N)?b.push(...N):N&&b.push(N),x=_+w[0].length,m=!0),!p.global)break;w=p.exec(u.value)}return m?(x<u.value.length&&b.push({type:"text",value:u.value.slice(x)}),d.children.splice(v,1,...b)):b=[u],v+b.length}}function X6(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([Q6(i[0]),Z6(i[1])])}return e}function Q6(t){return typeof t=="string"?new RegExp(Y6(t),"g"):t}function Z6(t){return typeof t=="function"?t:function(){return t}}const gv="phrasing",vv=["autolink","link","image","label"];function J6(){return{transforms:[s7],enter:{literalAutolink:t7,literalAutolinkEmail:mv,literalAutolinkHttp:mv,literalAutolinkWww:mv},exit:{literalAutolink:a7,literalAutolinkEmail:i7,literalAutolinkHttp:r7,literalAutolinkWww:n7}}}function e7(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:gv,notInConstruct:vv},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:gv,notInConstruct:vv},{character:":",before:"[ps]",after:"\\/",inConstruct:gv,notInConstruct:vv}]}}function t7(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function mv(t){this.config.enter.autolinkProtocol.call(this,t)}function r7(t){this.config.exit.autolinkProtocol.call(this,t)}function n7(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 i7(t){this.config.exit.autolinkEmail.call(this,t)}function a7(t){this.exit(t)}function s7(t){K6(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,o7],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),l7]],{ignore:["link","linkReference"]})}function o7(t,e,r,n,i){let a="";if(!Tk(i)||(/^w/i.test(e)&&(r=e+r,e="",a="http://"),!u7(r)))return!1;const s=c7(r+n);if(!s[0])return!1;const o={type:"link",title:null,url:a+e+s[0],children:[{type:"text",value:e+s[0]}]};return s[1]?[o,{type:"text",value:s[1]}]:o}function l7(t,e,r,n){return!Tk(n,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+r,children:[{type:"text",value:e+"@"+r}]}}function u7(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 c7(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=V2(t,"(");let a=V2(t,")");for(;n!==-1&&i>a;)t+=r.slice(0,n+1),r=r.slice(n+1),n=r.indexOf(")"),a++;return[t,r]}function Tk(t,e){const r=t.input.charCodeAt(t.index-1);return(t.index===0||vs(r)||dh(r))&&(!e||r!==47)}Nk.peek=x7;function d7(){this.buffer()}function h7(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function f7(){this.buffer()}function p7(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function g7(t){const e=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=ni(this.sliceSerialize(t)).toLowerCase(),r.label=e}function v7(t){this.exit(t)}function m7(t){const e=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=ni(this.sliceSerialize(t)).toLowerCase(),r.label=e}function y7(t){this.exit(t)}function x7(){return"["}function Nk(t,e,r,n){const i=r.createTracker(n);let a=i.move("[^");const s=r.enter("footnoteReference"),o=r.enter("reference");return a+=i.move(r.safe(r.associationId(t),{after:"]",before:a})),o(),s(),a+=i.move("]"),a}function b7(){return{enter:{gfmFootnoteCallString:d7,gfmFootnoteCall:h7,gfmFootnoteDefinitionLabelString:f7,gfmFootnoteDefinition:p7},exit:{gfmFootnoteCallString:g7,gfmFootnoteCall:v7,gfmFootnoteDefinitionLabelString:m7,gfmFootnoteDefinition:y7}}}function w7(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:r,footnoteReference:Nk},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(n,i,a,s){const o=a.createTracker(s);let l=o.move("[^");const u=a.enter("footnoteDefinition"),c=a.enter("label");return l+=o.move(a.safe(a.associationId(n),{before:l,after:"]"})),c(),l+=o.move("]:"),n.children&&n.children.length>0&&(o.shift(4),l+=o.move((e?`
|
|
408
|
+
`:" ")+a.indentLines(a.containerFlow(n,o.current()),e?Rk:S7))),u(),l}}function S7(t,e,r){return e===0?t:Rk(t,e,r)}function Rk(t,e,r){return(r?"":" ")+t}const _7=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Lk.peek=N7;function C7(){return{canContainEols:["delete"],enter:{strikethrough:E7},exit:{strikethrough:T7}}}function k7(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:_7}],handlers:{delete:Lk}}}function E7(t){this.enter({type:"delete",children:[]},t)}function T7(t){this.exit(t)}function Lk(t,e,r,n){const i=r.createTracker(n),a=r.enter("strikethrough");let s=i.move("~~");return s+=r.containerPhrasing(t,{...i.current(),before:s,after:"~"}),s+=i.move("~~"),a(),s}function N7(){return"~"}function R7(t){return t.length}function L7(t,e){const r=e||{},n=(r.align||[]).concat(),i=r.stringLength||R7,a=[],s=[],o=[],l=[];let u=0,c=-1;for(;++c<t.length;){const S=[],v=[];let m=-1;for(t[c].length>u&&(u=t[c].length);++m<t[c].length;){const b=D7(t[c][m]);if(r.alignDelimiters!==!1){const w=i(b);v[m]=w,(l[m]===void 0||w>l[m])&&(l[m]=w)}S.push(b)}s[c]=S,o[c]=v}let d=-1;if(typeof n=="object"&&"length"in n)for(;++d<u;)a[d]=G2(n[d]);else{const S=G2(n);for(;++d<u;)a[d]=S}d=-1;const p=[],f=[];for(;++d<u;){const S=a[d];let v="",m="";S===99?(v=":",m=":"):S===108?v=":":S===114&&(m=":");let b=r.alignDelimiters===!1?1:Math.max(1,l[d]-v.length-m.length);const w=v+"-".repeat(b)+m;r.alignDelimiters!==!1&&(b=v.length+b+m.length,b>l[d]&&(l[d]=b),f[d]=b),p[d]=w}s.splice(1,0,p),o.splice(1,0,f),c=-1;const x=[];for(;++c<s.length;){const S=s[c],v=o[c];d=-1;const m=[];for(;++d<u;){const b=S[d]||"";let w="",_="";if(r.alignDelimiters!==!1){const T=l[d]-(v[d]||0),N=a[d];N===114?w=" ".repeat(T):N===99?T%2?(w=" ".repeat(T/2+.5),_=" ".repeat(T/2-.5)):(w=" ".repeat(T/2),_=w):_=" ".repeat(T)}r.delimiterStart!==!1&&!d&&m.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&b==="")&&(r.delimiterStart!==!1||d)&&m.push(" "),r.alignDelimiters!==!1&&m.push(w),m.push(b),r.alignDelimiters!==!1&&m.push(_),r.padding!==!1&&m.push(" "),(r.delimiterEnd!==!1||d!==u-1)&&m.push("|")}x.push(r.delimiterEnd===!1?m.join("").replace(/ +$/,""):m.join(""))}return x.join(`
|
|
409
|
+
`)}function D7(t){return t==null?"":String(t)}function G2(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 A7(t,e,r,n){const i=r.enter("blockquote"),a=r.createTracker(n);a.move("> "),a.shift(2);const s=r.indentLines(r.containerFlow(t,a.current()),P7);return i(),s}function P7(t,e,r){return">"+(r?"":" ")+t}function M7(t,e){return q2(t,e.inConstruct,!0)&&!q2(t,e.notInConstruct,!1)}function q2(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 Y2(t,e,r,n){let i=-1;for(;++i<r.unsafe.length;)if(r.unsafe[i].character===`
|
|
410
|
+
`&&M7(r.stack,r.unsafe[i]))return/[ \t]/.test(n.before)?"":" ";return`\\
|
|
411
|
+
`}function O7(t,e){const r=String(t);let n=r.indexOf(e),i=n,a=0,s=0;if(typeof e!="string")throw new TypeError("Expected substring");for(;n!==-1;)n===i?++a>s&&(s=a):a=1,i=n+e.length,n=r.indexOf(e,i);return s}function j7(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 I7(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 B7(t,e,r,n){const i=I7(r),a=t.value||"",s=i==="`"?"GraveAccent":"Tilde";if(j7(t,r)){const d=r.enter("codeIndented"),p=r.indentLines(a,F7);return d(),p}const o=r.createTracker(n),l=i.repeat(Math.max(O7(a,i)+1,3)),u=r.enter("codeFenced");let c=o.move(l);if(t.lang){const d=r.enter(`codeFencedLang${s}`);c+=o.move(r.safe(t.lang,{before:c,after:" ",encode:["`"],...o.current()})),d()}if(t.lang&&t.meta){const d=r.enter(`codeFencedMeta${s}`);c+=o.move(" "),c+=o.move(r.safe(t.meta,{before:c,after:`
|
|
412
|
+
`,encode:["`"],...o.current()})),d()}return c+=o.move(`
|
|
413
|
+
`),a&&(c+=o.move(a+`
|
|
414
|
+
`)),c+=o.move(l),u(),c}function F7(t,e,r){return(r?"":" ")+t}function sy(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 z7(t,e,r,n){const i=sy(r),a=i==='"'?"Quote":"Apostrophe",s=r.enter("definition");let o=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("]: "),o(),!t.url||/[\0- \u007F]/.test(t.url)?(o=r.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(r.safe(t.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(o=r.enter("destinationRaw"),u+=l.move(r.safe(t.url,{before:u,after:t.title?" ":`
|
|
415
|
+
`,...l.current()}))),o(),t.title&&(o=r.enter(`title${a}`),u+=l.move(" "+i),u+=l.move(r.safe(t.title,{before:u,after:i,...l.current()})),u+=l.move(i),o()),s(),u}function $7(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 au(t){return"&#x"+t.toString(16).toUpperCase()+";"}function zd(t,e,r){const n=ko(t),i=ko(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}}Dk.peek=H7;function Dk(t,e,r,n){const i=$7(r),a=r.enter("emphasis"),s=r.createTracker(n),o=s.move(i);let l=s.move(r.containerPhrasing(t,{after:i,before:o,...s.current()}));const u=l.charCodeAt(0),c=zd(n.before.charCodeAt(n.before.length-1),u,i);c.inside&&(l=au(u)+l.slice(1));const d=l.charCodeAt(l.length-1),p=zd(n.after.charCodeAt(0),d,i);p.inside&&(l=l.slice(0,-1)+au(d));const f=s.move(i);return a(),r.attentionEncodeSurroundingInfo={after:p.outside,before:c.outside},o+l+f}function H7(t,e,r){return r.options.emphasis||"*"}function U7(t,e){let r=!1;return iy(t,function(n){if("value"in n&&/\r?\n|\r/.test(n.value)||n.type==="break")return r=!0,rm}),!!((!t.depth||t.depth<3)&&Qm(t)&&(e.options.setext||r))}function W7(t,e,r,n){const i=Math.max(Math.min(6,t.depth||1),1),a=r.createTracker(n);if(U7(t,r)){const c=r.enter("headingSetext"),d=r.enter("phrasing"),p=r.containerPhrasing(t,{...a.current(),before:`
|
|
416
|
+
`,after:`
|
|
417
|
+
`});return d(),c(),p+`
|
|
418
|
+
`+(i===1?"=":"-").repeat(p.length-(Math.max(p.lastIndexOf("\r"),p.lastIndexOf(`
|
|
419
|
+
`))+1))}const s="#".repeat(i),o=r.enter("headingAtx"),l=r.enter("phrasing");a.move(s+" ");let u=r.containerPhrasing(t,{before:"# ",after:`
|
|
420
|
+
`,...a.current()});return/^[\t ]/.test(u)&&(u=au(u.charCodeAt(0))+u.slice(1)),u=u?s+" "+u:s,r.options.closeAtx&&(u+=" "+s),l(),o(),u}Ak.peek=V7;function Ak(t){return t.value||""}function V7(){return"<"}Pk.peek=G7;function Pk(t,e,r,n){const i=sy(r),a=i==='"'?"Quote":"Apostrophe",s=r.enter("image");let o=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("]("),o(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(o=r.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(r.safe(t.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(o=r.enter("destinationRaw"),u+=l.move(r.safe(t.url,{before:u,after:t.title?" ":")",...l.current()}))),o(),t.title&&(o=r.enter(`title${a}`),u+=l.move(" "+i),u+=l.move(r.safe(t.title,{before:u,after:i,...l.current()})),u+=l.move(i),o()),u+=l.move(")"),s(),u}function G7(){return"!"}Mk.peek=q7;function Mk(t,e,r,n){const i=t.referenceType,a=r.enter("imageReference");let s=r.enter("label");const o=r.createTracker(n);let l=o.move("![");const u=r.safe(t.alt,{before:l,after:"]",...o.current()});l+=o.move(u+"]["),s();const c=r.stack;r.stack=[],s=r.enter("reference");const d=r.safe(r.associationId(t),{before:l,after:"]",...o.current()});return s(),r.stack=c,a(),i==="full"||!u||u!==d?l+=o.move(d+"]"):i==="shortcut"?l=l.slice(0,-1):l+=o.move("]"),l}function q7(){return"!"}Ok.peek=Y7;function Ok(t,e,r){let n=t.value||"",i="`",a=-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+" ");++a<r.unsafe.length;){const s=r.unsafe[a],o=r.compilePattern(s);let l;if(s.atBreak)for(;l=o.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 Y7(){return"`"}function jk(t,e){const r=Qm(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))}Ik.peek=K7;function Ik(t,e,r,n){const i=sy(r),a=i==='"'?"Quote":"Apostrophe",s=r.createTracker(n);let o,l;if(jk(t,r)){const c=r.stack;r.stack=[],o=r.enter("autolink");let d=s.move("<");return d+=s.move(r.containerPhrasing(t,{before:d,after:">",...s.current()})),d+=s.move(">"),o(),r.stack=c,d}o=r.enter("link"),l=r.enter("label");let u=s.move("[");return u+=s.move(r.containerPhrasing(t,{before:u,after:"](",...s.current()})),u+=s.move("]("),l(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(l=r.enter("destinationLiteral"),u+=s.move("<"),u+=s.move(r.safe(t.url,{before:u,after:">",...s.current()})),u+=s.move(">")):(l=r.enter("destinationRaw"),u+=s.move(r.safe(t.url,{before:u,after:t.title?" ":")",...s.current()}))),l(),t.title&&(l=r.enter(`title${a}`),u+=s.move(" "+i),u+=s.move(r.safe(t.title,{before:u,after:i,...s.current()})),u+=s.move(i),l()),u+=s.move(")"),o(),u}function K7(t,e,r){return jk(t,r)?"<":"["}Bk.peek=X7;function Bk(t,e,r,n){const i=t.referenceType,a=r.enter("linkReference");let s=r.enter("label");const o=r.createTracker(n);let l=o.move("[");const u=r.containerPhrasing(t,{before:l,after:"]",...o.current()});l+=o.move(u+"]["),s();const c=r.stack;r.stack=[],s=r.enter("reference");const d=r.safe(r.associationId(t),{before:l,after:"]",...o.current()});return s(),r.stack=c,a(),i==="full"||!u||u!==d?l+=o.move(d+"]"):i==="shortcut"?l=l.slice(0,-1):l+=o.move("]"),l}function X7(){return"["}function oy(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 Q7(t){const e=oy(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 Z7(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 Fk(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 J7(t,e,r,n){const i=r.enter("list"),a=r.bulletCurrent;let s=t.ordered?Z7(r):oy(r);const o=t.ordered?s==="."?")":".":Q7(r);let l=e&&r.bulletLastUsed?s===r.bulletLastUsed:!1;if(!t.ordered){const c=t.children?t.children[0]:void 0;if((s==="*"||s==="-")&&c&&(!c.children||!c.children[0])&&r.stack[r.stack.length-1]==="list"&&r.stack[r.stack.length-2]==="listItem"&&r.stack[r.stack.length-3]==="list"&&r.stack[r.stack.length-4]==="listItem"&&r.indexStack[r.indexStack.length-1]===0&&r.indexStack[r.indexStack.length-2]===0&&r.indexStack[r.indexStack.length-3]===0&&(l=!0),Fk(r)===s&&c){let d=-1;for(;++d<t.children.length;){const p=t.children[d];if(p&&p.type==="listItem"&&p.children&&p.children[0]&&p.children[0].type==="thematicBreak"){l=!0;break}}}}l&&(s=o),r.bulletCurrent=s;const u=r.containerFlow(t,n);return r.bulletLastUsed=s,r.bulletCurrent=a,i(),u}function ez(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 tz(t,e,r,n){const i=ez(r);let a=r.bulletCurrent||oy(r);e&&e.type==="list"&&e.ordered&&(a=(typeof e.start=="number"&&e.start>-1?e.start:1)+(r.options.incrementListMarker===!1?0:e.children.indexOf(t))+a);let s=a.length+1;(i==="tab"||i==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(s=Math.ceil(s/4)*4);const o=r.createTracker(n);o.move(a+" ".repeat(s-a.length)),o.shift(s);const l=r.enter("listItem"),u=r.indentLines(r.containerFlow(t,o.current()),c);return l(),u;function c(d,p,f){return p?(f?"":" ".repeat(s))+d:(f?a:a+" ".repeat(s-a.length))+d}}function rz(t,e,r,n){const i=r.enter("paragraph"),a=r.enter("phrasing"),s=r.containerPhrasing(t,n);return a(),i(),s}const nz=ph(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function iz(t,e,r,n){return(t.children.some(function(s){return nz(s)})?r.containerPhrasing:r.containerFlow).call(r,t,n)}function az(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}zk.peek=sz;function zk(t,e,r,n){const i=az(r),a=r.enter("strong"),s=r.createTracker(n),o=s.move(i+i);let l=s.move(r.containerPhrasing(t,{after:i,before:o,...s.current()}));const u=l.charCodeAt(0),c=zd(n.before.charCodeAt(n.before.length-1),u,i);c.inside&&(l=au(u)+l.slice(1));const d=l.charCodeAt(l.length-1),p=zd(n.after.charCodeAt(0),d,i);p.inside&&(l=l.slice(0,-1)+au(d));const f=s.move(i+i);return a(),r.attentionEncodeSurroundingInfo={after:p.outside,before:c.outside},o+l+f}function sz(t,e,r){return r.options.strong||"*"}function oz(t,e,r,n){return r.safe(t.value,n)}function lz(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 uz(t,e,r){const n=(Fk(r)+(r.options.ruleSpaces?" ":"")).repeat(lz(r));return r.options.ruleSpaces?n.slice(0,-1):n}const $k={blockquote:A7,break:Y2,code:B7,definition:z7,emphasis:Dk,hardBreak:Y2,heading:W7,html:Ak,image:Pk,imageReference:Mk,inlineCode:Ok,link:Ik,linkReference:Bk,list:J7,listItem:tz,paragraph:rz,root:iz,strong:zk,text:oz,thematicBreak:uz};function cz(){return{enter:{table:dz,tableData:K2,tableHeader:K2,tableRow:fz},exit:{codeText:pz,table:hz,tableData:yv,tableHeader:yv,tableRow:yv}}}function dz(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 hz(t){this.exit(t),this.data.inTable=void 0}function fz(t){this.enter({type:"tableRow",children:[]},t)}function yv(t){this.exit(t)}function K2(t){this.enter({type:"tableCell",children:[]},t)}function pz(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,gz));const r=this.stack[this.stack.length-1];r.type,r.value=e,this.exit(t)}function gz(t,e){return e==="|"?e:t}function vz(t){const e=t||{},r=e.tableCellPadding,n=e.tablePipeAlign,i=e.stringLength,a=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
421
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:p,table:s,tableCell:l,tableRow:o}};function s(f,x,S,v){return u(c(f,S,v),f.align)}function o(f,x,S,v){const m=d(f,S,v),b=u([m]);return b.slice(0,b.indexOf(`
|
|
422
|
+
`))}function l(f,x,S,v){const m=S.enter("tableCell"),b=S.enter("phrasing"),w=S.containerPhrasing(f,{...v,before:a,after:a});return b(),m(),w}function u(f,x){return L7(f,{align:x,alignDelimiters:n,padding:r,stringLength:i})}function c(f,x,S){const v=f.children;let m=-1;const b=[],w=x.enter("table");for(;++m<v.length;)b[m]=d(v[m],x,S);return w(),b}function d(f,x,S){const v=f.children;let m=-1;const b=[],w=x.enter("tableRow");for(;++m<v.length;)b[m]=l(v[m],f,x,S);return w(),b}function p(f,x,S){let v=$k.inlineCode(f,x,S);return S.stack.includes("tableCell")&&(v=v.replace(/\|/g,"\\$&")),v}}function mz(){return{exit:{taskListCheckValueChecked:X2,taskListCheckValueUnchecked:X2,paragraph:xz}}}function yz(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:bz}}}function X2(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function xz(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 a=-1,s;for(;++a<i.length;){const o=i[a];if(o.type==="paragraph"){s=o;break}}s===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 bz(t,e,r,n){const i=t.children[0],a=typeof t.checked=="boolean"&&i&&i.type==="paragraph",s="["+(t.checked?"x":" ")+"] ",o=r.createTracker(n);a&&o.move(s);let l=$k.listItem(t,e,r,{...n,...o.current()});return a&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),l;function u(c){return c+s}}function wz(){return[J6(),b7(),C7(),cz(),mz()]}function Sz(t){return{extensions:[e7(),w7(t),k7(),vz(t),yz()]}}const _z={tokenize:Rz,partial:!0},Hk={tokenize:Lz,partial:!0},Uk={tokenize:Dz,partial:!0},Wk={tokenize:Az,partial:!0},Cz={tokenize:Pz,partial:!0},Vk={name:"wwwAutolink",tokenize:Tz,previous:qk},Gk={name:"protocolAutolink",tokenize:Nz,previous:Yk},Hi={name:"emailAutolink",tokenize:Ez,previous:Kk},Ci={};function kz(){return{text:Ci}}let Ja=48;for(;Ja<123;)Ci[Ja]=Hi,Ja++,Ja===58?Ja=65:Ja===91&&(Ja=97);Ci[43]=Hi;Ci[45]=Hi;Ci[46]=Hi;Ci[95]=Hi;Ci[72]=[Hi,Gk];Ci[104]=[Hi,Gk];Ci[87]=[Hi,Vk];Ci[119]=[Hi,Vk];function Ez(t,e,r){const n=this;let i,a;return s;function s(d){return!sm(d)||!Kk.call(n,n.previous)||ly(n.events)?r(d):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),o(d))}function o(d){return sm(d)?(t.consume(d),o):d===64?(t.consume(d),l):r(d)}function l(d){return d===46?t.check(Cz,c,u)(d):d===45||d===95||Gr(d)?(a=!0,t.consume(d),l):c(d)}function u(d){return t.consume(d),i=!0,l}function c(d){return a&&i&&nn(n.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(d)):r(d)}}function Tz(t,e,r){const n=this;return i;function i(s){return s!==87&&s!==119||!qk.call(n,n.previous)||ly(n.events)?r(s):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(_z,t.attempt(Hk,t.attempt(Uk,a),r),r)(s))}function a(s){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(s)}}function Nz(t,e,r){const n=this;let i="",a=!1;return s;function s(d){return(d===72||d===104)&&Yk.call(n,n.previous)&&!ly(n.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),i+=String.fromCodePoint(d),t.consume(d),o):r(d)}function o(d){if(nn(d)&&i.length<5)return i+=String.fromCodePoint(d),t.consume(d),o;if(d===58){const p=i.toLowerCase();if(p==="http"||p==="https")return t.consume(d),l}return r(d)}function l(d){return d===47?(t.consume(d),a?u:(a=!0,l)):r(d)}function u(d){return d===null||Id(d)||Kt(d)||vs(d)||dh(d)?r(d):t.attempt(Hk,t.attempt(Uk,c),r)(d)}function c(d){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(d)}}function Rz(t,e,r){let n=0;return i;function i(s){return(s===87||s===119)&&n<3?(n++,t.consume(s),i):s===46&&n===3?(t.consume(s),a):r(s)}function a(s){return s===null?r(s):e(s)}}function Lz(t,e,r){let n,i,a;return s;function s(u){return u===46||u===95?t.check(Wk,l,o)(u):u===null||Kt(u)||vs(u)||u!==45&&dh(u)?l(u):(a=!0,t.consume(u),s)}function o(u){return u===95?n=!0:(i=n,n=void 0),t.consume(u),s}function l(u){return i||n||!a?r(u):e(u)}}function Dz(t,e){let r=0,n=0;return i;function i(s){return s===40?(r++,t.consume(s),i):s===41&&n<r?a(s):s===33||s===34||s===38||s===39||s===41||s===42||s===44||s===46||s===58||s===59||s===60||s===63||s===93||s===95||s===126?t.check(Wk,e,a)(s):s===null||Kt(s)||vs(s)?e(s):(t.consume(s),i)}function a(s){return s===41&&n++,t.consume(s),i}}function Az(t,e,r){return n;function n(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(t.consume(o),n):o===38?(t.consume(o),a):o===93?(t.consume(o),i):o===60||o===null||Kt(o)||vs(o)?e(o):r(o)}function i(o){return o===null||o===40||o===91||Kt(o)||vs(o)?e(o):n(o)}function a(o){return nn(o)?s(o):r(o)}function s(o){return o===59?(t.consume(o),n):nn(o)?(t.consume(o),s):r(o)}}function Pz(t,e,r){return n;function n(a){return t.consume(a),i}function i(a){return Gr(a)?r(a):e(a)}}function qk(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||Kt(t)}function Yk(t){return!nn(t)}function Kk(t){return!(t===47||sm(t))}function sm(t){return t===43||t===45||t===46||t===95||Gr(t)}function ly(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 Mz={tokenize:Hz,partial:!0};function Oz(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Fz,continuation:{tokenize:zz},exit:$z}},text:{91:{name:"gfmFootnoteCall",tokenize:Bz},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:jz,resolveTo:Iz}}}}function jz(t,e,r){const n=this;let i=n.events.length;const a=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let s;for(;i--;){const l=n.events[i][1];if(l.type==="labelImage"){s=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return o;function o(l){if(!s||!s._balanced)return r(l);const u=ni(n.sliceSerialize({start:s.end,end:n.now()}));return u.codePointAt(0)!==94||!a.includes(u.slice(1))?r(l):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(l),t.exit("gfmFootnoteCallLabelMarker"),e(l))}}function Iz(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 a={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},t[t.length-1][1].start)},s={type:"chunkString",contentType:"string",start:Object.assign({},a.start),end:Object.assign({},a.end)},o=[t[r+1],t[r+2],["enter",n,e],t[r+3],t[r+4],["enter",i,e],["exit",i,e],["enter",a,e],["enter",s,e],["exit",s,e],["exit",a,e],t[t.length-2],t[t.length-1],["exit",n,e]];return t.splice(r,t.length-r+1,...o),t}function Bz(t,e,r){const n=this,i=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let a=0,s;return o;function o(d){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),l}function l(d){return d!==94?r(d):(t.enter("gfmFootnoteCallMarker"),t.consume(d),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",u)}function u(d){if(a>999||d===93&&!s||d===null||d===91||Kt(d))return r(d);if(d===93){t.exit("chunkString");const p=t.exit("gfmFootnoteCallString");return i.includes(ni(n.sliceSerialize(p)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):r(d)}return Kt(d)||(s=!0),a++,t.consume(d),d===92?c:u}function c(d){return d===91||d===92||d===93?(t.consume(d),a++,u):u(d)}}function Fz(t,e,r){const n=this,i=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let a,s=0,o;return l;function l(x){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(x),t.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(x){return x===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(x),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",c):r(x)}function c(x){if(s>999||x===93&&!o||x===null||x===91||Kt(x))return r(x);if(x===93){t.exit("chunkString");const S=t.exit("gfmFootnoteDefinitionLabelString");return a=ni(n.sliceSerialize(S)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(x),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),p}return Kt(x)||(o=!0),s++,t.consume(x),x===92?d:c}function d(x){return x===91||x===92||x===93?(t.consume(x),s++,c):c(x)}function p(x){return x===58?(t.enter("definitionMarker"),t.consume(x),t.exit("definitionMarker"),i.includes(a)||i.push(a),At(t,f,"gfmFootnoteDefinitionWhitespace")):r(x)}function f(x){return e(x)}}function zz(t,e,r){return t.check(bu,e,t.attempt(Mz,e,r))}function $z(t){t.exit("gfmFootnoteDefinition")}function Hz(t,e,r){const n=this;return At(t,i,"gfmFootnoteDefinitionIndent",5);function i(a){const s=n.events[n.events.length-1];return s&&s[1].type==="gfmFootnoteDefinitionIndent"&&s[2].sliceSerialize(s[1],!0).length===4?e(a):r(a)}}function Uz(t){let r=(t||{}).singleTilde;const n={name:"strikethrough",tokenize:a,resolveAll:i};return r==null&&(r=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function i(s,o){let l=-1;for(;++l<s.length;)if(s[l][0]==="enter"&&s[l][1].type==="strikethroughSequenceTemporary"&&s[l][1]._close){let u=l;for(;u--;)if(s[u][0]==="exit"&&s[u][1].type==="strikethroughSequenceTemporary"&&s[u][1]._open&&s[l][1].end.offset-s[l][1].start.offset===s[u][1].end.offset-s[u][1].start.offset){s[l][1].type="strikethroughSequence",s[u][1].type="strikethroughSequence";const c={type:"strikethrough",start:Object.assign({},s[u][1].start),end:Object.assign({},s[l][1].end)},d={type:"strikethroughText",start:Object.assign({},s[u][1].end),end:Object.assign({},s[l][1].start)},p=[["enter",c,o],["enter",s[u][1],o],["exit",s[u][1],o],["enter",d,o]],f=o.parser.constructs.insideSpan.null;f&&Rn(p,p.length,0,hh(f,s.slice(u+1,l),o)),Rn(p,p.length,0,[["exit",d,o],["enter",s[l][1],o],["exit",s[l][1],o],["exit",c,o]]),Rn(s,u-1,l-u+3,p),l=u+p.length-2;break}}for(l=-1;++l<s.length;)s[l][1].type==="strikethroughSequenceTemporary"&&(s[l][1].type="data");return s}function a(s,o,l){const u=this.previous,c=this.events;let d=0;return p;function p(x){return u===126&&c[c.length-1][1].type!=="characterEscape"?l(x):(s.enter("strikethroughSequenceTemporary"),f(x))}function f(x){const S=ko(u);if(x===126)return d>1?l(x):(s.consume(x),d++,f);if(d<2&&!r)return l(x);const v=s.exit("strikethroughSequenceTemporary"),m=ko(x);return v._open=!m||m===2&&!!S,v._close=!S||S===2&&!!m,o(x)}}}class Wz{constructor(){this.map=[]}add(e,r,n){Vz(this,e,r,n)}consume(e){if(this.map.sort(function(a,s){return a[0]-s[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 a of i)e.push(a);i=n.pop()}this.map.length=0}}function Vz(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 Gz(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 a=n.length-1;n[a]=n[a]==="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 qz(){return{flow:{null:{name:"table",tokenize:Yz,resolveAll:Kz}}}}function Yz(t,e,r){const n=this;let i=0,a=0,s;return o;function o(A){let M=n.events.length-1;for(;M>-1;){const D=n.events[M][1].type;if(D==="lineEnding"||D==="linePrefix")M--;else break}const O=M>-1?n.events[M][1].type:null,$=O==="tableHead"||O==="tableRow"?N:l;return $===N&&n.parser.lazy[n.now().line]?r(A):$(A)}function l(A){return t.enter("tableHead"),t.enter("tableRow"),u(A)}function u(A){return A===124||(s=!0,a+=1),c(A)}function c(A){return A===null?r(A):vt(A)?a>1?(a=0,n.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(A),t.exit("lineEnding"),f):r(A):Et(A)?At(t,c,"whitespace")(A):(a+=1,s&&(s=!1,i+=1),A===124?(t.enter("tableCellDivider"),t.consume(A),t.exit("tableCellDivider"),s=!0,c):(t.enter("data"),d(A)))}function d(A){return A===null||A===124||Kt(A)?(t.exit("data"),c(A)):(t.consume(A),A===92?p:d)}function p(A){return A===92||A===124?(t.consume(A),d):d(A)}function f(A){return n.interrupt=!1,n.parser.lazy[n.now().line]?r(A):(t.enter("tableDelimiterRow"),s=!1,Et(A)?At(t,x,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A):x(A))}function x(A){return A===45||A===58?v(A):A===124?(s=!0,t.enter("tableCellDivider"),t.consume(A),t.exit("tableCellDivider"),S):T(A)}function S(A){return Et(A)?At(t,v,"whitespace")(A):v(A)}function v(A){return A===58?(a+=1,s=!0,t.enter("tableDelimiterMarker"),t.consume(A),t.exit("tableDelimiterMarker"),m):A===45?(a+=1,m(A)):A===null||vt(A)?_(A):T(A)}function m(A){return A===45?(t.enter("tableDelimiterFiller"),b(A)):T(A)}function b(A){return A===45?(t.consume(A),b):A===58?(s=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(A),t.exit("tableDelimiterMarker"),w):(t.exit("tableDelimiterFiller"),w(A))}function w(A){return Et(A)?At(t,_,"whitespace")(A):_(A)}function _(A){return A===124?x(A):A===null||vt(A)?!s||i!==a?T(A):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(A)):T(A)}function T(A){return r(A)}function N(A){return t.enter("tableRow"),E(A)}function E(A){return A===124?(t.enter("tableCellDivider"),t.consume(A),t.exit("tableCellDivider"),E):A===null||vt(A)?(t.exit("tableRow"),e(A)):Et(A)?At(t,E,"whitespace")(A):(t.enter("data"),k(A))}function k(A){return A===null||A===124||Kt(A)?(t.exit("data"),E(A)):(t.consume(A),A===92?L:k)}function L(A){return A===92||A===124?(t.consume(A),k):k(A)}}function Kz(t,e){let r=-1,n=!0,i=0,a=[0,0,0,0],s=[0,0,0,0],o=!1,l=0,u,c,d;const p=new Wz;for(;++r<t.length;){const f=t[r],x=f[1];f[0]==="enter"?x.type==="tableHead"?(o=!1,l!==0&&(Q2(p,e,l,u,c),c=void 0,l=0),u={type:"table",start:Object.assign({},x.start),end:Object.assign({},x.end)},p.add(r,0,[["enter",u,e]])):x.type==="tableRow"||x.type==="tableDelimiterRow"?(n=!0,d=void 0,a=[0,0,0,0],s=[0,r+1,0,0],o&&(o=!1,c={type:"tableBody",start:Object.assign({},x.start),end:Object.assign({},x.end)},p.add(r,0,[["enter",c,e]])),i=x.type==="tableDelimiterRow"?2:c?3:1):i&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")?(n=!1,s[2]===0&&(a[1]!==0&&(s[0]=s[1],d=ed(p,e,a,i,void 0,d),a=[0,0,0,0]),s[2]=r)):x.type==="tableCellDivider"&&(n?n=!1:(a[1]!==0&&(s[0]=s[1],d=ed(p,e,a,i,void 0,d)),a=s,s=[a[1],r,0,0])):x.type==="tableHead"?(o=!0,l=r):x.type==="tableRow"||x.type==="tableDelimiterRow"?(l=r,a[1]!==0?(s[0]=s[1],d=ed(p,e,a,i,r,d)):s[1]!==0&&(d=ed(p,e,s,i,r,d)),i=0):i&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")&&(s[3]=r)}for(l!==0&&Q2(p,e,l,u,c),p.consume(e.events),r=-1;++r<e.events.length;){const f=e.events[r];f[0]==="enter"&&f[1].type==="table"&&(f[1]._align=Gz(e.events,r))}return t}function ed(t,e,r,n,i,a){const s=n===1?"tableHeader":n===2?"tableDelimiter":"tableData",o="tableContent";r[0]!==0&&(a.end=Object.assign({},oo(e.events,r[0])),t.add(r[0],0,[["exit",a,e]]));const l=oo(e.events,r[1]);if(a={type:s,start:Object.assign({},l),end:Object.assign({},l)},t.add(r[1],0,[["enter",a,e]]),r[2]!==0){const u=oo(e.events,r[2]),c=oo(e.events,r[3]),d={type:o,start:Object.assign({},u),end:Object.assign({},c)};if(t.add(r[2],0,[["enter",d,e]]),n!==2){const p=e.events[r[2]],f=e.events[r[3]];if(p[1].end=Object.assign({},f[1].end),p[1].type="chunkText",p[1].contentType="text",r[3]>r[2]+1){const x=r[2]+1,S=r[3]-r[2]-1;t.add(x,S,[])}}t.add(r[3]+1,0,[["exit",d,e]])}return i!==void 0&&(a.end=Object.assign({},oo(e.events,i)),t.add(i,0,[["exit",a,e]]),a=void 0),a}function Q2(t,e,r,n,i){const a=[],s=oo(e.events,r);i&&(i.end=Object.assign({},s),a.push(["exit",i,e])),n.end=Object.assign({},s),a.push(["exit",n,e]),t.add(r+1,0,a)}function oo(t,e){const r=t[e],n=r[0]==="enter"?"start":"end";return r[1][n]}const Xz={name:"tasklistCheck",tokenize:Zz};function Qz(){return{text:{91:Xz}}}function Zz(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"),a)}function a(l){return Kt(l)?(t.enter("taskListCheckValueUnchecked"),t.consume(l),t.exit("taskListCheckValueUnchecked"),s):l===88||l===120?(t.enter("taskListCheckValueChecked"),t.consume(l),t.exit("taskListCheckValueChecked"),s):r(l)}function s(l){return l===93?(t.enter("taskListCheckMarker"),t.consume(l),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),o):r(l)}function o(l){return vt(l)?e(l):Et(l)?t.check({tokenize:Jz},e,r)(l):r(l)}}function Jz(t,e,r){return At(t,n,"whitespace");function n(i){return i===null?r(i):e(i)}}function e8(t){return ak([kz(),Oz(),Uz(t),qz(),Qz()])}const t8={};function r8(t){const e=this,r=t||t8,n=e.data(),i=n.micromarkExtensions||(n.micromarkExtensions=[]),a=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),s=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);i.push(e8(r)),a.push(wz()),s.push(Sz(r))}const n8={h1:({children:t})=>y.jsx("h1",{className:"text-lg font-bold mt-4 mb-2",style:{color:"#e6edf3"},children:t}),h2:({children:t})=>y.jsx("h2",{className:"text-base font-bold mt-3 mb-1.5",style:{color:"#e6edf3"},children:t}),h3:({children:t})=>y.jsx("h3",{className:"text-sm font-semibold mt-2 mb-1",style:{color:"#e6edf3"},children:t}),p:({children:t})=>y.jsx("p",{className:"mb-2 last:mb-0 leading-relaxed",children:t}),a:({href:t,children:e})=>y.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"underline",style:{color:"#79c0ff"},children:e}),img:({alt:t})=>y.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(`
|
|
423
|
+
`)?y.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}):y.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})=>y.jsx("pre",{className:"my-2",children:t}),blockquote:({children:t})=>y.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})=>y.jsx("ul",{className:"list-disc pl-5 mb-2 space-y-0.5",children:t}),ol:({children:t})=>y.jsx("ol",{className:"list-decimal pl-5 mb-2 space-y-0.5",children:t}),li:({children:t})=>y.jsx("li",{className:"text-sm leading-relaxed",children:t}),table:({children:t})=>y.jsx("div",{className:"overflow-x-auto my-2",children:y.jsx("table",{className:"text-xs w-full border-collapse font-mono",children:t})}),thead:({children:t})=>y.jsx("thead",{style:{borderBottom:"1px solid rgba(230,237,243,0.12)"},children:t}),tbody:({children:t})=>y.jsx("tbody",{children:t}),tr:({children:t})=>y.jsx("tr",{style:{borderBottom:"1px solid rgba(230,237,243,0.06)"},children:t}),th:({children:t})=>y.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})=>y.jsx("td",{className:"px-3 py-1.5",style:{color:"#e6edf3"},children:t}),hr:()=>y.jsx("hr",{className:"my-3",style:{borderColor:"rgba(230,237,243,0.1)"}}),strong:({children:t})=>y.jsx("strong",{className:"font-semibold",style:{color:"#e6edf3"},children:t}),em:({children:t})=>y.jsx("em",{style:{color:"rgba(230,237,243,0.8)"},children:t})};function uy({children:t,className:e}){return y.jsx("div",{className:`text-sm leading-relaxed ${e??""}`,style:{color:"#e6edf3"},children:y.jsx(U6,{remarkPlugins:[r8],components:n8,children:t})})}const i8={ask:"Ask",balanced:"Balanced",autonomous:"Autonomous"},a8={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"}},s8={bg:"rgba(230,237,243,0.1)",fg:"rgba(230,237,243,0.55)"};function o8(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 l8(t){var n,i;const e=t?t.state==="convened"?`Council convened — polling ${((n=t.clis)==null?void 0:n.length)??"?"} CLI${(((i=t.clis)==null?void 0:i.length)??0)===1?"":"s"}…`:t.state==="deliberating"?`Ballot ${t.round??"?"}: ${t.agreementPct??"?"}% — below the ${t.neededPct??75}% bar, runoff in progress…`:`Council voted — ${t.agreementPct??"?"}% agreement (${t.votes??"?"} votes)`:"Council deliberating…",r=(t==null?void 0:t.failedSeats)??[];return r.length===0?e:`${e}
|
|
424
|
+
${r.length} seat${r.length===1?"":"s"} did not vote — ${r.map(a=>`${a.cli} (${a.kind})`).join(", ")}`}function u8(t){if(t.routing===null)return t.assigned_cli?`→ ${t.assigned_cli}`:null;switch(t.routing.method){case"council":return`Council → ${t.assigned_cli??"?"} · ${ch(t.routing)} · ${t.routing.agreement_pct}% agree · ${t.routing.dissent} dissent${yu(t.routing)?" · quorum lost":""}`;case"evaluator_distinct":return`Evaluator-distinct → ${t.assigned_cli??"?"} (was: ${t.routing.was})`;case"degraded":return`Degraded routing: ${t.routing.reason}`;default:return t.assigned_cli?`→ ${t.assigned_cli}`:null}}const c8={done:{color:"#3fb950",background:"rgba(63,185,80,0.1)",border:"1px solid rgba(63,185,80,0.25)"},rejected:{color:"#f85149",background:"rgba(248,81,73,0.1)",border:"1px solid rgba(248,81,73,0.3)"},active:{color:"#79c0ff",background:"rgba(121,192,255,0.12)",border:"1px solid rgba(121,192,255,0.35)"},queued:{color:"rgba(230,237,243,0.3)",background:"transparent",border:"1px solid rgba(230,237,243,0.08)"}};function d8({runId:t,units:e,executingUnitOrd:r}){const n=Wn(i=>i.councilStatus);return e.length===0?null:y.jsx("div",{"data-testid":"process-stepper","aria-label":"Workflow phases",className:"flex items-center gap-1.5 flex-wrap px-6 py-2.5 shrink-0 font-mono text-[11px]",style:{borderBottom:"1px solid rgba(230,237,243,0.05)",background:"#161c26"},children:e.map((i,a)=>{const s=i.status==="done"?"done":i.status==="rejected"?"rejected":i.ord===r?"active":"queued",o=n[`${t}:${i.ord}`],l=[i.description,u8(i),s==="queued"&&i.status==="pending"?l8(o):null].filter(c=>c!==null&&c.length>0).join(`
|
|
425
|
+
`),u=c8[s];return y.jsxs(K.Fragment,{children:[a>0&&y.jsx("span",{"aria-hidden":"true",style:{color:"rgba(230,237,243,0.15)"},children:"›"}),y.jsxs("span",{"data-testid":`stepper-phase-${i.ord}`,"data-state":s,title:l,className:"rounded-full px-2.5 py-0.5 flex items-center gap-1.5 whitespace-nowrap relative",style:{background:u.background,border:u.border,color:u.color},children:[s==="done"&&y.jsx("span",{"aria-hidden":"true",children:"✓"}),s==="rejected"&&y.jsx("span",{"aria-hidden":"true",children:"✗"}),s==="active"&&y.jsx(Cv,{state:"executing",pill:!0}),s==="active"&&y.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full shrink-0",style:{background:"#79c0ff"}}),om(t,i)]})]},i.id)})})}const Z2=4096;function h8({runId:t,ord:e,phase:r}){const n=Wn(u=>u.outputs[bd(t,e)]),[i,a]=K.useState(!0),s=K.useRef(null);K.useEffect(()=>{const u=s.current;u&&(u.scrollTop=u.scrollHeight)},[n,i]);const o=typeof n=="string"&&n.length>0,l=o&&n.length>Z2?"…"+n.slice(n.length-Z2):n;return y.jsxs("div",{"data-testid":`live-narration-${e}`,children:[y.jsxs("div",{className:"flex items-center gap-2 text-sm font-mono",style:{color:"rgba(230,237,243,0.5)"},children:[y.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full animate-pulse",style:{background:"#79c0ff"}}),y.jsx("span",{className:"font-medium",style:{color:"#79c0ff"},children:r}),y.jsx("span",{children:o?"Working — live output":"Working…"}),o&&y.jsx("button",{type:"button","data-testid":`live-narration-toggle-${e}`,onClick:()=>a(u=>!u),className:"ml-auto text-xs font-medium font-mono hover:underline",style:{color:"#79c0ff"},children:i?"▾ Hide live output":"▸ Show live output"})]}),o&&i&&y.jsx("pre",{ref:s,"data-testid":`live-narration-text-${e}`,className:"mt-2 max-h-64 overflow-auto rounded-lg p-2.5 text-[11px] leading-snug whitespace-pre-wrap break-words 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:l})]})}function f8({reason:t}){const[e,r]=K.useState(!1),[n,i]=K.useState(!1),a="degraded-routing-detail";return e?y.jsx(y.Fragment,{}):y.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:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("span",{className:"shrink-0","aria-hidden":"true",children:"⚠"}),y.jsxs("span",{className:"flex-1",children:["Degraded routing: ",t]}),y.jsx("button",{type:"button",onClick:()=>i(s=>!s),className:"shrink-0 text-[10px] transition-opacity hover:opacity-70",style:{color:"rgba(255,218,25,0.6)"},"aria-expanded":n,"aria-controls":a,"aria-label":n?"Hide explanation":"Show explanation",children:n?"▲":"▼"}),y.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:y.jsx("span",{"aria-hidden":"true",children:"✕"})})]}),n&&y.jsxs("p",{id:a,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 ",y.jsx("strong",{children:"Decisions"})," section in the Insights panel on the right to see each reviewer's verdict."]})]})}function Xk({cli:t}){const{bg:e,fg:r}=a8[t.toLowerCase()]??s8;return y.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:o8(t)})}const p8={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"}},g8={pending:"queued",distributed:"dispatched",done:"done",rejected:"rejected"};function cy(t,e,r){return e.startsWith(`${t}:`)?e.slice(t.length+1):`u${r}`}function om(t,e){const r=cy(t,e.id,e.ord);return/^u\d+$/.test(r)?e.stage:r}const v8=new Set(["sessionStarted","sessionCompleted","sessionFailed","awaitingHuman","gateDecided","resumed","runCancelled","workerMessageQueued","workerMessageInjected"]),m8=new Set(["stepFailed","crashRecoveryRedrive","workerStalled","failureTriaged"]);function y8(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 x8(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 b8(){return y.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[y.jsx("circle",{cx:"8",cy:"8",r:"6.75",stroke:"currentColor",strokeWidth:"1.5"}),y.jsx("rect",{x:"5.25",y:"5.25",width:"5.5",height:"5.5",rx:"0.75",fill:"currentColor"})]})}function w8(){return y.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[y.jsx("path",{d:"M8 2v7.25m0 0L5.25 6.5M8 9.25l2.75-2.75",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),y.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 S8({runId:t,disabled:e}){const[r,n]=K.useState(!1),[i,a]=K.useState(null);async function s(){n(!0),a(null);try{await K3(t)}catch(u){a(u instanceof Error?u.message:String(u))}finally{n(!1)}}const o=e||r,l=e?"Export evidence — available once the run finishes":i??(r?"Exporting evidence…":"Export evidence");return y.jsxs(y.Fragment,{children:[i&&y.jsxs("span",{role:"alert",className:"text-[11px] font-mono shrink-0 max-w-[14rem] truncate",style:{color:"#f85149"},children:["Export failed: ",i]}),y.jsx("button",{type:"button",onClick:()=>void s(),disabled:o,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:o?.3:.65},onMouseEnter:u=>{o||(u.currentTarget.style.opacity="1")},onMouseLeave:u=>{o||(u.currentTarget.style.opacity="0.65")},children:y.jsx(w8,{})})]})}function _8({detail:t,onStop:e,canStop:r}){return y.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:[y.jsxs("div",{className:"flex items-center gap-2 font-semibold text-[11px] uppercase tracking-wide",children:[y.jsx("span",{children:"⚠"}),y.jsx("span",{children:"Step failure"})]}),t&&y.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}),y.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[y.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"}),y.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 C8({attempt:t}){return y.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:[y.jsxs("div",{className:"flex items-center gap-2 font-semibold text-[11px] uppercase tracking-wide",children:[y.jsx("span",{children:"↺"}),y.jsxs("span",{children:["Crash recovery — attempt ",t]})]}),y.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 Qk({mode:t,onChange:e,readOnly:r=!1}){const n=["ask","balanced","autonomous"];function i(a,s){var l,u;if(r)return;let o=s;if(a.key==="ArrowRight"||a.key==="ArrowDown")o=(s+1)%n.length;else if(a.key==="ArrowLeft"||a.key==="ArrowUp")o=(s-1+n.length)%n.length;else return;a.preventDefault(),e(n[o]),(u=(l=a.currentTarget.parentElement)==null?void 0:l.children[o])==null||u.focus()}return y.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((a,s)=>y.jsx("button",{type:"button",role:"radio","aria-checked":t===a,"aria-disabled":r,tabIndex:r?-1:t===a?0:-1,onClick:r?void 0:()=>e(a),onKeyDown:r?void 0:o=>i(o,s),disabled:r,className:"px-3 py-1 text-[11px] font-mono font-medium transition-colors disabled:cursor-default",style:t===a?{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:i8[a]},a))})}function k8({view:t,onNavigateBack:e}){const{session:r,units:n}=t,[i,a]=K.useState({}),s=K.useRef(new Set);return K.useEffect(()=>{for(const o of n)o.status==="done"&&!s.current.has(o.ord)&&(s.current.add(o.ord),a(l=>({...l,[o.ord]:{text:null,loading:!0,visible:!0}})),Ue.getUnitOutput(r.id,cy(r.id,o.id,o.ord)).then(({output:l,outputUnavailable:u})=>{a(c=>({...c,[o.ord]:{text:l??u??null,loading:!1,visible:!0}}))}).catch(()=>{a(l=>({...l,[o.ord]:{text:null,loading:!1,visible:!0}}))}))},[n,r.id]),y.jsxs("div",{className:"flex flex-col h-full",children:[y.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:[y.jsx("button",{type:"button",onClick:e,"aria-label":"Back",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:o=>{o.currentTarget.style.background="rgba(230,237,243,0.06)",o.currentTarget.style.color="#e6edf3"},onMouseLeave:o=>{o.currentTarget.style.background="transparent",o.currentTarget.style.color="rgba(230,237,243,0.4)"},children:"←"}),y.jsx("p",{className:"flex-1 text-base font-semibold truncate",style:{color:"#e6edf3"},title:r.problem,children:r.problem}),y.jsx("span",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.3)"},children:"legacy chat"})]}),y.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:[y.jsx("div",{className:"flex justify-end",children:y.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:r.problem})}),[...n].sort((o,l)=>o.ord-l.ord).map(o=>{const l=i[o.ord];return y.jsxs("div",{className:"self-start max-w-[85%] flex flex-col gap-2",children:[y.jsx("div",{className:"flex items-center gap-2",children:o.assigned_cli?y.jsxs(y.Fragment,{children:[y.jsx(Xk,{cli:o.assigned_cli}),y.jsx("span",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.55)"},children:o.assigned_cli})]}):y.jsx("span",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.55)"},children:"agent"})}),y.jsxs("div",{className:"rounded-2xl px-5 py-4",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.08)"},children:[(l==null?void 0:l.loading)&&y.jsx("span",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.5)"},children:"Loading…"}),!(l!=null&&l.loading)&&(l==null?void 0:l.text)&&y.jsxs("div",{children:[y.jsx("button",{type:"button",onClick:()=>a(u=>({...u,[o.ord]:{...u[o.ord],visible:!l.visible}})),className:"text-xs font-medium font-mono hover:underline",style:{color:"#79c0ff"},children:l.visible?"▾ Hide response":"▸ View response"}),l.visible&&y.jsx("div",{className:"mt-2.5 max-h-96 overflow-auto rounded-xl p-4",style:{background:"#0d1117"},children:y.jsx(uy,{className:"whitespace-pre-wrap",children:l.text})})]}),!(l!=null&&l.loading)&&!(l!=null&&l.text)&&y.jsx("span",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.3)"},children:"Response not available — this session predates durable transcripts."})]})]},o.id)})]})]})}function E8({view:t,mode:e,onModeChange:r,onLaunched:n,onNavigateBack:i,onRefresh:a,onKill:s,navigate:o}){const{session:l,units:u}=t,c=K.useMemo(()=>[...u].sort((j,I)=>j.ord-I.ord),[u]),d=K.useMemo(()=>uS(l,u),[l,u]),p=K.useMemo(()=>c.filter(j=>j.status==="done"||j.status==="rejected"||j.status==="distributed"&&j.ord===d),[c,d]),f=Un(j=>j.gates[l.id]),x=nu(j=>j.elicitations[l.id]),S=Wn(j=>j.logs[l.id])??[],[v,m]=K.useState("all"),b=Wn(j=>j.terminalIds),[w,_]=K.useState(null),[T,N]=K.useState({}),E=K.useRef(new Set),k=K.useRef(null);K.useEffect(()=>{var j;(j=k.current)==null||j.scrollIntoView({behavior:"smooth"})},[p.length,S.length]),K.useEffect(()=>{for(const j of u)j.status==="done"&&!E.current.has(j.ord)&&(E.current.add(j.ord),N(I=>({...I,[j.ord]:{text:null,loading:!0,visible:!0}})),Ue.getUnitOutput(l.id,cy(l.id,j.id,j.ord)).then(({output:I,outputUnavailable:U})=>{N(F=>({...F,[j.ord]:{text:I??U??"(no transcript captured)",loading:!1,visible:!0}}))}).catch(()=>{N(I=>({...I,[j.ord]:{text:"(transcript unavailable)",loading:!1,visible:!0}}))}))},[u,l.id]);function L(j){N(I=>{const U=I[j];return U?{...I,[j]:{...U,visible:!U.visible}}:I})}const A=CS[l.status]??{label:l.status,color:"rgba(230,237,243,0.5)"},M=["completed","cancelled","failed"].includes(l.status),O=S.filter(j=>v8.has(j.type)||m8.has(j.type)),$=x8(l.status),D=["executing","distributing","planning","awaiting_human"].includes(l.status);function B(){s==null||s(l.id)}return y.jsxs("div",{className:"flex flex-col h-full",children:[y.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:[y.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:j=>{j.currentTarget.style.background="rgba(230,237,243,0.06)",j.currentTarget.style.color="#e6edf3"},onMouseLeave:j=>{j.currentTarget.style.background="transparent",j.currentTarget.style.color="rgba(230,237,243,0.4)"},children:"←"}),y.jsx("span",{className:`w-2.5 h-2.5 rounded-full shrink-0 ${D?"animate-pulse":""}`,style:{background:$}}),y.jsx("p",{className:"flex-1 text-base font-semibold truncate",style:{color:"#e6edf3"},title:l.problem,children:l.problem}),y.jsx("span",{className:"text-xs font-medium shrink-0 font-mono",style:{color:A.color},children:A.label}),y.jsx(Qk,{mode:e,onChange:r,readOnly:M}),y.jsx(S8,{runId:l.id,disabled:!M}),!M&&s&&y.jsx("button",{type:"button",onClick:()=>void s(l.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:j=>{j.currentTarget.style.opacity="1"},onMouseLeave:j=>{j.currentTarget.style.opacity="0.65"},children:y.jsx(b8,{})})]}),y.jsx(d8,{runId:l.id,units:c,executingUnitOrd:d}),y.jsxs("div",{"data-testid":"thread",className:"flex-1 overflow-y-auto px-4 py-6 flex flex-col gap-6 max-w-3xl w-full mx-auto",children:[x!==void 0&&y.jsx("div",{className:"self-center w-full max-w-lg",children:y.jsx(_j,{e:x},x.elicitationId)}),y.jsx("div",{className:"flex justify-end",children:y.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:l.problem})}),p.flatMap(j=>{const I=T[j.ord],U=p8[j.stage]??{bg:"rgba(230,237,243,0.08)",color:"rgba(230,237,243,0.5)"},F=l.status==="awaiting_human"&&(f==null?void 0:f.ord)===j.ord,P=y.jsxs("div",{"data-message-id":j.id,className:"flex flex-col gap-2",children:[j.routing!==null&&j.routing.method==="council"&&y.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:[y.jsx("span",{className:"shrink-0",children:"⚖"}),y.jsxs("span",{children:[y.jsxs("span",{className:"font-semibold",children:["Council → ",j.assigned_cli??"?"]}),y.jsxs("span",{className:"ml-2",style:{color:"rgba(167,139,250,0.6)"},children:[ch(j.routing)," · ",j.routing.agreement_pct,"% agree · ",j.routing.dissent," dissent",yu(j.routing)&&y.jsx("span",{className:"ml-2",style:{color:"#ffda19"},children:"· quorum lost"})]})]})]}),j.routing!==null&&j.routing.method==="evaluator_distinct"&&y.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:[y.jsx("span",{className:"shrink-0",children:"⚖"}),y.jsxs("span",{children:[y.jsxs("span",{className:"font-semibold",children:["Evaluator-distinct → ",j.assigned_cli??"?"]}),y.jsxs("span",{className:"ml-2",style:{color:"rgba(167,139,250,0.6)"},children:["(was: ",j.routing.was,")"]})]})]}),j.routing!==null&&j.routing.method==="degraded"&&y.jsx(f8,{reason:j.routing.reason}),y.jsxs("div",{className:"self-start max-w-[85%] flex flex-col gap-2",children:[y.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[j.assigned_cli?y.jsxs("div",{className:"flex items-center gap-1",children:[y.jsxs("button",{type:"button",onClick:()=>m(j.assigned_cli),title:`Target ${j.assigned_cli}`,"aria-label":`Send message to ${j.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:[y.jsx(Xk,{cli:j.assigned_cli}),y.jsxs("span",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.55)"},children:[j.assigned_cli,y.jsxs("span",{style:{color:"rgba(230,237,243,0.3)"},children:[" · unit ",j.ord]})]})]}),b[`${l.id}:${j.assigned_cli}`]&&y.jsx("button",{type:"button","aria-pressed":(w==null?void 0:w.cliKey)===j.assigned_cli,"aria-label":(w==null?void 0:w.cliKey)===j.assigned_cli?`Close ${j.assigned_cli} terminal`:`Open ${j.assigned_cli} terminal`,title:(w==null?void 0:w.cliKey)===j.assigned_cli?`Close ${j.assigned_cli} terminal`:`Open ${j.assigned_cli} terminal`,onClick:()=>{const H=j.assigned_cli,W=b[`${l.id}:${H}`];_((w==null?void 0:w.cliKey)===H?null:{cliKey:H,terminalId:W})},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:"⌨"})]}):y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("span",{className:"w-7 h-7 rounded-full shrink-0",style:{background:"rgba(230,237,243,0.06)"}}),y.jsxs("span",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.55)"},children:["agent",y.jsxs("span",{style:{color:"rgba(230,237,243,0.3)"},children:[" · unit ",j.ord]})]})]}),y.jsx("span",{className:"rounded-full px-2 py-0.5 text-[11px] font-semibold uppercase tracking-wide font-mono",style:{background:U.bg,color:U.color},children:j.stage}),j.has_validator_pin&&y.jsx("span",{role:"img","aria-label":"Governance floor armed",style:{color:"#ffda19",fontSize:"12px"},children:"🔒"}),y.jsx("span",{className:"text-xs font-mono truncate max-w-xs",style:{color:"rgba(230,237,243,0.35)"},title:j.description,children:j.description})]}),y.jsxs("div",{className:"rounded-2xl px-5 py-4",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.08)"},children:[j.status==="distributed"&&y.jsx(h8,{runId:l.id,ord:j.ord,phase:om(l.id,j)}),j.status==="done"&&y.jsxs("div",{"data-testid":`unit-output-${j.ord}`,children:[y.jsxs("div",{className:"flex items-center gap-2 text-sm font-mono",children:[y.jsx("span",{style:{color:"#3fb950"},children:"✓"}),y.jsx("span",{className:"font-medium",style:{color:"#3fb950"},children:om(l.id,j)}),y.jsx("span",{className:"text-xs",style:{color:"rgba(230,237,243,0.4)"},children:g8[j.status]}),y.jsx("button",{type:"button","data-testid":`unit-output-toggle-${j.ord}`,onClick:()=>L(j.ord),className:"ml-auto text-xs font-medium font-mono hover:underline",style:{color:"#79c0ff"},children:I!=null&&I.visible?"▾ Hide output":"▸ Show output"})]}),(I==null?void 0:I.visible)&&y.jsx("div",{className:"mt-2.5 max-h-[28rem] overflow-y-auto",children:I.loading?y.jsx("span",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.5)"},children:"Loading output…"}):y.jsx(uy,{className:"whitespace-pre-wrap",children:I.text??""})})]}),j.status==="rejected"&&y.jsxs("div",{className:"text-sm font-medium font-mono",style:{color:"#f85149"},children:["Rejected",j.denial_reason?`: ${j.denial_reason}`:""]})]})]})]},j.id);return F?[y.jsx("div",{className:"self-center w-full max-w-lg",children:y.jsx(l2,{runId:l.id,...f?{ord:f.ord,prompt:f.prompt}:{},onResolved:a})},`gate-before-${j.id}`),P]:[P]}),O.map(j=>j.type==="stepFailed"?y.jsx("div",{className:"flex flex-col gap-2",children:y.jsx(_8,{detail:j.detail,onStop:B,canStop:s!==void 0&&!M})},j.seq):j.type==="crashRecoveryRedrive"?y.jsx("div",{className:"flex flex-col gap-2",children:y.jsx(C8,{attempt:j.attempt??1})},j.seq):y.jsx("div",{className:"flex justify-center",children:y.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:y8(j.type,j.detail)})},j.seq)),l.status==="awaiting_human"&&!p.some(j=>(f==null?void 0:f.ord)===j.ord)&&y.jsx("div",{className:"self-center w-full max-w-lg",children:y.jsx(l2,{runId:l.id,...f?{ord:f.ord,prompt:f.prompt}:{},onResolved:a})}),y.jsx("div",{ref:k})]}),w&&y.jsx("div",{className:"px-4 pb-3 shrink-0",children:y.jsx(Aj,{terminalId:w.terminalId,cliKey:w.cliKey,onClose:()=>_(null)})}),y.jsx(WC,{runId:M?null:l.id,runStatus:M?null:l.status,mode:e,onLaunched:n,injectTarget:v,onClearInjectTarget:()=>m("all"),...o!==void 0?{navigate:o}:{}})]})}function T8({chatMode:t,mode:e,onModeChange:r,onLaunched:n,navigate:i}){const a=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 y.jsx("div",{className:"flex flex-col h-full items-center justify-center",children:y.jsxs("div",{className:"w-full max-w-2xl px-8 flex flex-col gap-5",children:[y.jsxs("div",{className:"flex flex-col gap-2 text-center",children:[y.jsx("h1",{className:"text-3xl font-bold tracking-tight",style:{color:"#e6edf3"},children:a}),y.jsx("p",{className:"text-base leading-relaxed",style:{color:"rgba(230,237,243,0.5)"},children:s})]}),y.jsx("div",{className:"flex justify-center",children:y.jsx(Qk,{mode:e,onChange:r})}),y.jsx(WC,{embedded:!0,mode:e,onLaunched:n,...t?{workflowOverride:"chat"}:{},...i!==void 0?{navigate:i}:{}})]})})}function N8({view:t,chatMode:e,onLaunched:r,onNavigateBack:n,onRefresh:i,onKill:a,navigate:s}){const[o,l]=K.useState("balanced");if(t){let u=function(p){l(p),d||Ue.injectMessage(c.session.id,`mode:${p}`,"all").catch(()=>{})};const c=t;if(c.session.workflow_id==="chat")return y.jsx(k8,{view:c,onNavigateBack:n});const d=["completed","cancelled","failed"].includes(c.session.status);return y.jsx(E8,{view:c,mode:o,onModeChange:u,onLaunched:r,onNavigateBack:n,onRefresh:i,...a!==void 0?{onKill:a}:{},...s!==void 0?{navigate:s}:{}},c.session.id)}return y.jsx(T8,{chatMode:e??!1,mode:o,onModeChange:l,onLaunched:r,...s!==void 0?{navigate:s}:{}})}function Zk(t){const e=Wd(n=>n.setStatus),r=K.useRef(t);r.current=t,K.useEffect(()=>{let n=!1,i=null;function a(){if(n)return;const s=new WebSocket(`${oS()}/ws`);i=s,s.onopen=()=>{i===s&&e("connected")},s.onmessage=o=>{if(i===s)try{const l=JSON.parse(String(o.data));l!==null&&typeof l=="object"&&typeof l.type=="string"&&r.current(l)}catch{}},s.onclose=()=>{i===s&&e("disconnected"),n||setTimeout(a,3e3)},s.onerror=()=>{s.close()}}return a(),()=>{n=!0,i&&i.readyState!==WebSocket.CLOSED&&i.readyState!==WebSocket.CLOSING&&i.close(),i=null}},[e])}const xv={claude:{bg:"rgba(139,92,246,0.25)",fg:"#c4b5fd"},codex:{bg:"rgba(59,130,246,0.25)",fg:"#93c5fd"},agy:{bg:"rgba(34,197,94,0.2)",fg:"#86efac"},pi:{bg:"rgba(234,179,8,0.2)",fg:"#fde68a"}},bv={bg:"rgba(230,237,243,0.1)",fg:"rgba(230,237,243,0.55)"},dy=t=>`wicked.chat.${t??"_"}`;function R8(t){try{const e=sessionStorage.getItem(dy(t));return e!==null&&e!==""?e:null}catch{return null}}function L8(t,e){try{sessionStorage.setItem(dy(t),e)}catch{}}function J2(t){try{sessionStorage.removeItem(dy(t))}catch{}}function D8({repoId:t,onBack:e}){const[r,n]=K.useState(null),[i,a]=K.useState({}),[s,o]=K.useState({}),[l,u]=K.useState([]),[c,d]=K.useState(""),[p,f]=K.useState(null),[x,S]=K.useState(!1),v=K.useRef(null),m=K.useRef(null);m.current=r,K.useEffect(()=>{var E;(E=v.current)==null||E.scrollIntoView({behavior:"smooth"})},[l]),K.useEffect(()=>{let E=!1;u([]),a({}),o({}),f(null),S(!1),n(null),m.current=null;const k=Ue.getRoster().then(({roster:L})=>L).catch(()=>[]);return(async()=>{const L=R8(t);if(L!==null){const O=await Ue.getChat(L).then(({seats:$})=>({seats:$})).catch($=>({error:$ instanceof Error?$.message:String($)}));if(E)return;if("error"in O){n(L),m.current=L,f(`Could not reach the daemon to check the previous chat (${O.error}). Keeping it — reload to retry, or End chat to release its seats.`);return}if(O.seats.length>0){n(L),m.current=L,a(Object.fromEntries(O.seats.map($=>[$,"ready"])));return}J2(t)}const A=crypto.randomUUID();if(E)return;n(A),m.current=A,L8(t,A);const M=await k;if(!E){a(Object.fromEntries(M.flatMap(O=>typeof O.key=="string"?[[O.key,"warming"]]:[])));try{const{seats:O}=await Ue.openChat(t?{chatId:A,repoRef:t}:{chatId:A});if(E)return;const $={},D={};for(const B of O)$[B.cliKey]=B.ok?"ready":"failed",!B.ok&&B.error&&(D[B.cliKey]=B.error);a($),o(D)}catch(O){E||f(O instanceof Error?O.message:String(O))}}})(),()=>{E=!0}},[t]),Zk(E=>{const k=E;if(k.chat===m.current)switch(k.type){case"chatSessionReady":k.cliKey&&a(L=>({...L,[k.cliKey]:"ready"}));break;case"chatSessionFailed":k.cliKey&&(a(L=>({...L,[k.cliKey]:"failed"})),o(L=>({...L,[k.cliKey]:k.reason??"session failed"})));break;case"chatDelta":k.cliKey&&k.text&&b(k.cliKey,k.text);break;case"chatReply":k.cliKey&&w(k.cliKey,k.text??"",k.ok??!1);break}});function b(E,k){u(L=>{const A=[...L];for(let M=A.length-1;M>=0;M--){const O=A[M];if(O&&O.kind==="seat"&&O.cliKey===E&&O.pending)return A[M]={...O,text:O.text+k},A}return L})}function w(E,k,L){u(A=>{const M=[...A];for(let O=M.length-1;O>=0;O--){const $=M[O];if($&&$.kind==="seat"&&$.cliKey===E&&$.pending)return M[O]={kind:"seat",cliKey:E,text:k,pending:!1,ok:L},M}return A})}async function _(){const E=c.trim(),k=Object.values(i).some(A=>A==="ready");if(E===""||r===null||x||!k)return;d("");const L=Object.entries(i).filter(([,A])=>A==="ready").map(([A])=>A);u(A=>[...A,{kind:"user",text:E},...L.map(M=>({kind:"seat",cliKey:M,text:"",pending:!0,ok:!1}))]);try{await Ue.sendChatMessage(r,E)}catch(A){const M=A instanceof Error?A.message:String(A);u(O=>O.map($=>$.kind==="seat"&&$.pending?{...$,pending:!1,ok:!1,text:`(send failed: ${M})`}:$))}}async function T(){if(J2(t),r!==null)try{await Ue.closeChat(r)}catch{}S(!0),e()}const N=(E,k)=>{const L=xv[E]??bv;return y.jsxs("span",{title:k==="failed"?s[E]:k,className:"inline-flex items-center gap-1.5 rounded-lg px-2 py-0.5 text-[11px] font-mono",style:{background:L.bg,color:L.fg,opacity:k==="failed"?.5:1},children:[y.jsx("span",{className:`inline-block w-1.5 h-1.5 rounded-full ${k==="warming"?"animate-pulse":""}`,style:{background:k==="failed"?"#f85149":k==="warming"?"#d29922":"#3fb950"}}),E,k==="failed"?" ✕":""]},E)};return y.jsxs("div",{className:"flex flex-col h-full",style:{color:"#e6edf3"},children:[y.jsxs("div",{className:"flex items-center gap-3 px-6 py-3 border-b shrink-0",style:{borderColor:"rgba(230,237,243,0.08)"},children:[y.jsx("button",{type:"button",onClick:e,className:"text-sm font-mono opacity-60 hover:opacity-100",children:"←"}),y.jsx("span",{className:"text-sm font-mono font-semibold",children:"Group chat"}),y.jsx("div",{className:"flex items-center gap-1.5 flex-wrap",children:Object.entries(i).map(([E,k])=>N(E,k))}),y.jsx("div",{className:"flex-1"}),y.jsx("button",{type:"button",onClick:()=>void T(),className:"text-[11px] font-mono px-2.5 py-1 rounded-lg",style:{background:"rgba(248,81,73,0.12)",color:"#f85149",border:"1px solid rgba(248,81,73,0.25)"},children:"End chat"})]}),y.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-4 flex flex-col gap-3",children:[p!==null&&y.jsxs("p",{className:"text-[12px] font-mono",style:{color:"#f85149"},children:["Could not open chat: ",p]}),Object.keys(i).length===0&&p===null&&y.jsx("p",{className:"text-[12px] font-mono opacity-60",children:"Warming seats…"}),l.map((E,k)=>E.kind==="user"?y.jsx("div",{className:"self-end max-w-[70%] rounded-xl px-4 py-2 text-[13px]",style:{background:"rgba(88,166,255,0.15)"},children:E.text},k):y.jsxs("div",{className:"self-start max-w-[80%] flex gap-2",children:[y.jsx("span",{className:"shrink-0 w-7 h-7 rounded-lg flex items-center justify-center text-[10px] font-mono font-bold mt-0.5",style:{background:(xv[E.cliKey]??bv).bg,color:(xv[E.cliKey]??bv).fg},children:E.cliKey.slice(0,2).toUpperCase()}),y.jsx("div",{className:"rounded-xl px-4 py-2 text-[13px] min-w-[60px]",style:{background:"rgba(230,237,243,0.05)",border:`1px solid ${E.pending?"rgba(210,153,34,0.35)":E.ok?"rgba(230,237,243,0.08)":"rgba(248,81,73,0.35)"}`},children:E.pending&&E.text===""?y.jsx("span",{className:"opacity-50 font-mono text-[11px] animate-pulse",children:"thinking…"}):y.jsx(uy,{children:E.text})})]},k)),y.jsx("div",{ref:v})]}),y.jsx("div",{className:"px-6 py-3 border-t shrink-0",style:{borderColor:"rgba(230,237,243,0.08)"},children:y.jsxs("div",{className:"flex gap-2",children:[y.jsx("textarea",{value:c,onChange:E=>d(E.target.value),onKeyDown:E=>{E.key==="Enter"&&!E.shiftKey&&(E.preventDefault(),_())},rows:2,placeholder:"Message every warm seat… (Enter to send, Shift+Enter for newline)",className:"flex-1 rounded-xl px-4 py-2 text-[13px] font-mono outline-none resize-none",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.12)"}}),y.jsx("button",{type:"button",onClick:()=>void _(),disabled:!Object.values(i).some(E=>E==="ready")||c.trim()==="",className:"px-4 rounded-xl text-sm font-mono font-semibold disabled:opacity-40",style:{background:"rgba(88,166,255,0.2)",color:"#79c0ff"},children:"Send"})]})})]})}function A8(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 P8={recon:"#79c0ff",build:"#3fb950",review:"#a78bfa",test:"#ffda19"};function Jk(t){return P8[t]??"rgba(230,237,243,0.3)"}function M8({phase:t}){const e=t.executor,r=Jk(t.kind);return y.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:[y.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[y.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:r},title:t.kind}),y.jsx("span",{className:"font-semibold",style:{color:"#e6edf3"},children:t.id}),y.jsx("span",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:t.kind}),t.role!=="neutral"&&y.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"&&y.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(" ")]})]}),y.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-0.5 text-[10px]",style:{color:"rgba(230,237,243,0.45)"},children:[y.jsxs("span",{children:[y.jsx("span",{className:"font-medium",style:{color:"rgba(230,237,243,0.6)"},children:"gate:"})," ",t.gate_type?`${t.gate_type} / `:"",A8(t.gate)]}),t.depends_on.length>0&&y.jsxs("span",{children:[y.jsx("span",{className:"font-medium",style:{color:"rgba(230,237,243,0.6)"},children:"after:"})," ",t.depends_on.join(", ")]}),t.skill_ref&&y.jsxs("span",{children:[y.jsx("span",{className:"font-medium",style:{color:"rgba(230,237,243,0.6)"},children:"skill:"})," ",y.jsx("span",{className:"font-mono",children:t.skill_ref})]})]})]})}function eS(){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 O8(t){return t==="human"?{human_confirm:{unconditional:!1}}:t==="human_if"?{human_confirm_if:"verdict_not_pass"}:"auto"}async function j8(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 Ue.saveScript(e,t.script,t.scriptLang);return{type:"tool",cmd:[t.scriptLang==="python"?"python3":t.scriptLang==="sh"?"sh":"bash",r]}}async function tS(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:O8(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 j8(n)})));return{id:t,phases:r}}const Il={background:"#0f1419",border:"1px solid rgba(230,237,243,0.1)",color:"#e6edf3"};function td({active:t,onClick:e,children:r}){return y.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 I8({phase:t,index:e,total:r,allIds:n,onChange:i,onRemove:a,onMoveUp:s,onMoveDown:o}){const l=(c,d)=>i({...t,[c]:d}),u=n.slice(0,e);return y.jsxs("div",{className:"rounded p-3 flex flex-col gap-2",style:{border:"1px solid rgba(230,237,243,0.08)",background:"#1b222e"},children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("span",{className:"h-2.5 w-2.5 rounded-full",style:{backgroundColor:Jk(t.kind)}}),y.jsxs("span",{className:"text-[11px] font-semibold",style:{color:"rgba(230,237,243,0.7)"},children:["Phase ",e+1]}),y.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[y.jsx("button",{type:"button",onClick:s,disabled:e===0,className:"px-1 text-[10px] disabled:opacity-30",style:{color:"rgba(230,237,243,0.4)"},children:"▲"}),y.jsx("button",{type:"button",onClick:o,disabled:e===r-1,className:"px-1 text-[10px] disabled:opacity-30",style:{color:"rgba(230,237,243,0.4)"},children:"▼"}),y.jsx("button",{type:"button",onClick:a,className:"px-1 text-[10px]",style:{color:"#f85149"},children:"✕"})]})]}),y.jsxs("div",{className:"flex gap-2",children:[y.jsx("input",{className:"flex-1 rounded px-2 py-1 text-xs focus:outline-none",placeholder:"phase-id (e.g. build)",value:t.id,onChange:c=>l("id",c.target.value),style:Il}),y.jsx("select",{className:"rounded px-2 py-1 text-xs focus:outline-none",value:t.kind,onChange:c=>l("kind",c.target.value),style:Il,children:["recon","build","review","test"].map(c=>y.jsx("option",{value:c,children:c},c))})]}),y.jsxs("div",{className:"flex flex-col gap-1.5",children:[y.jsx("div",{className:"flex gap-1",children:["agent","command","script"].map(c=>y.jsx(td,{active:t.execMode===c,onClick:()=>l("execMode",c),children:c==="agent"?"Agent":c==="command"?"Command":"Script"},c))}),t.execMode==="command"&&y.jsx("input",{className:"rounded px-2 py-1 text-xs font-mono focus:outline-none",placeholder:"e.g. wicked-estate index or npm run build",value:t.cmd,onChange:c=>l("cmd",c.target.value),style:Il}),t.execMode==="script"&&y.jsxs("div",{className:"flex flex-col gap-1",children:[y.jsxs("div",{className:"flex gap-1 items-center",children:[y.jsx("span",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Language:"}),["bash","sh","python"].map(c=>y.jsx(td,{active:t.scriptLang===c,onClick:()=>l("scriptLang",c),children:c},c))]}),y.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
|
|
426
|
+
print("hello")`:`# bash script
|
|
427
|
+
echo "hello"`,value:t.script,onChange:c=>l("script",c.target.value),style:{...Il,background:"#0d1117"}}),y.jsxs("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.3)"},children:["Saved to"," ",y.jsxs("span",{style:{color:"rgba(230,237,243,0.5)"},children:["~/.wicked/scripts/",t.id||"script",".",t.scriptLang==="python"?"py":"sh"]})]})]})]}),y.jsxs("div",{className:"flex gap-2 flex-wrap",children:[y.jsxs("div",{className:"flex flex-col gap-0.5",children:[y.jsx("span",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Gate"}),y.jsx("div",{className:"flex gap-1",children:[["auto","Auto"],["human","Human"],["human_if","Human if fails"]].map(([c,d])=>y.jsx(td,{active:t.gate===c,onClick:()=>l("gate",c),children:d},c))})]}),y.jsxs("div",{className:"flex flex-col gap-0.5",children:[y.jsx("span",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Role"}),y.jsx("div",{className:"flex gap-1",children:["neutral","creator","evaluator"].map(c=>y.jsx(td,{active:t.role===c,onClick:()=>l("role",c),children:c},c))})]})]}),u.length>0&&y.jsxs("div",{className:"flex flex-col gap-0.5",children:[y.jsx("span",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Depends on"}),y.jsx("div",{className:"flex flex-wrap gap-1.5",children:u.map(c=>y.jsxs("label",{className:"flex items-center gap-1 text-[10px] cursor-pointer",style:{color:"rgba(230,237,243,0.55)"},children:[y.jsx("input",{type:"checkbox",checked:t.dependsOn.includes(c),onChange:d=>l("dependsOn",d.target.checked?[...t.dependsOn,c]:t.dependsOn.filter(p=>p!==c))}),y.jsx("span",{className:"font-mono",children:c})]},c))})]}),y.jsxs("div",{className:"flex gap-3 text-[10px]",style:{color:"rgba(230,237,243,0.45)"},children:[y.jsxs("label",{className:"flex items-center gap-1 cursor-pointer",children:[y.jsx("input",{type:"checkbox",checked:t.executesCode,onChange:c=>l("executesCode",c.target.checked)}),"executes code"]}),y.jsxs("label",{className:"flex items-center gap-1 cursor-pointer",children:[y.jsx("input",{type:"checkbox",checked:t.verifiedEvidence,onChange:c=>l("verifiedEvidence",c.target.checked)}),"verified evidence"]})]})]})}function B8({initial:t,onSaved:e,onCancel:r}){const[n,i]=K.useState((t==null?void 0:t.id)??""),[a,s]=K.useState(()=>t?t.phases.map(L=>{const A=L.executor,M=(A==null?void 0:A.type)==="tool"?"command":"agent";return{_key:Math.random().toString(36).slice(2),id:L.id,kind:L.kind,execMode:M,cmd:(A==null?void 0:A.type)==="tool"?A.cmd.join(" "):"",script:"",scriptLang:"bash",scriptPath:"",gate:L.gate==="auto"?"auto":typeof L.gate=="object"&&L.gate!==null&&"human_confirm_if"in L.gate?"human_if":"human",role:L.role,dependsOn:L.depends_on,executesCode:L.executes_code,verifiedEvidence:L.verified_evidence}}):[eS()]),[o,l]=K.useState(!1),[u,c]=K.useState(null),[d,p]=K.useState(!1),[f,x]=K.useState(""),S=a.map(L=>L.id).filter(Boolean);function v(L,A){s(M=>M.map((O,$)=>$===L?A:O))}function m(L){s(A=>A.filter((M,O)=>O!==L))}function b(){s(L=>[...L,eS()])}function w(L){L!==0&&s(A=>{const M=[...A];return[M[L-1],M[L]]=[M[L],M[L-1]],M})}function _(L){s(A=>{if(L>=A.length-1)return A;const M=[...A];return[M[L],M[L+1]]=[M[L+1],M[L]],M})}async function T(){try{const L=await tS(n,a);x(JSON.stringify(L,null,2)),p(!0)}catch(L){c(L instanceof Error?L.message:String(L))}}async function N(){if(!n.trim()){c("Workflow ID is required");return}if(a.length===0){c("At least one phase is required");return}l(!0),c(null);try{const L=await tS(n.trim(),a);await Ue.createWorkflow(L),e(L)}catch(L){c(L instanceof Error?L.message:String(L))}finally{l(!1)}}const E=K.useRef(null);function k(L){var O;const A=(O=L.target.files)==null?void 0:O[0];if(!A)return;const M=new FileReader;M.onload=$=>{var D;try{const B=JSON.parse((D=$.target)==null?void 0:D.result);i(B.id??""),s(B.phases.map(j=>{const I=j.executor;return{_key:Math.random().toString(36).slice(2),id:j.id,kind:j.kind,execMode:(I==null?void 0:I.type)==="tool"?"command":"agent",cmd:(I==null?void 0:I.type)==="tool"?I.cmd.join(" "):"",script:"",scriptLang:"bash",scriptPath:"",gate:j.gate==="auto"?"auto":typeof j.gate=="object"&&j.gate!==null&&"human_confirm_if"in j.gate?"human_if":"human",role:j.role,dependsOn:j.depends_on,executesCode:j.executes_code,verifiedEvidence:j.verified_evidence}})),c(null)}catch{c("Could not parse workflow JSON")}},M.readAsText(A),L.target.value=""}return y.jsxs("div",{className:"flex flex-col gap-3 min-w-0",children:[y.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[y.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:L=>i(L.target.value),style:Il}),y.jsx("input",{ref:E,type:"file",accept:".json",className:"hidden",onChange:k}),y.jsx("button",{type:"button",onClick:()=>{var L;return(L=E.current)==null?void 0:L.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"}),y.jsx("button",{type:"button",onClick:()=>void T(),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"}),y.jsx("button",{type:"button",onClick:r,className:"text-[11px] px-1 hover:underline",style:{color:"rgba(230,237,243,0.4)"},children:"Cancel"})]}),d&&y.jsxs("div",{className:"relative",children:[y.jsx("pre",{className:"rounded text-[10px] p-3 overflow-auto max-h-48 font-mono",style:{background:"#0d1117",color:"#3fb950"},children:f}),y.jsx("button",{type:"button",onClick:()=>p(!1),className:"absolute top-1 right-1 text-[10px]",style:{color:"rgba(230,237,243,0.4)"},children:"✕"})]}),y.jsx("div",{className:"flex flex-col gap-2",children:a.map((L,A)=>y.jsx(I8,{phase:L,index:A,total:a.length,allIds:S,onChange:M=>v(A,M),onRemove:()=>m(A),onMoveUp:()=>w(A),onMoveDown:()=>_(A)},L._key))}),y.jsx("button",{type:"button",onClick:b,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&&y.jsx("p",{className:"text-[11px]",style:{color:"#f85149"},children:u}),y.jsx("button",{type:"button",onClick:()=>void N(),disabled:o,className:"self-start rounded px-4 py-1.5 text-[11px] font-semibold disabled:opacity-50",style:{background:"#3fb950",color:"#0d1117"},children:o?"Saving…":"Save workflow"})]})}function F8(){const[t,e]=K.useState([]),[r,n]=K.useState(null),[i,a]=K.useState(!0),[s,o]=K.useState(null),[l,u]=K.useState(!1),[c,d]=K.useState(void 0),p=K.useRef(null);p.current=r;const f=K.useCallback(async()=>{var m;a(!0),o(null);try{const{workflows:b}=await Ue.listWorkflows();e(b),b.length>0&&!p.current&&n(((m=b[0])==null?void 0:m.id)??null)}catch(b){o(b instanceof Error?b.message:String(b))}finally{a(!1)}},[]);K.useEffect(()=>{f()},[f]);function x(m){d(m),u(!0)}function S(m){e(b=>b.findIndex(_=>_.id===m.id)>=0?b.map(_=>_.id===m.id?m:_):[...b,m]),n(m.id),u(!1)}const v=t.find(m=>m.id===r)??null;return y.jsxs("div",{className:"flex flex-col gap-4",children:[y.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[y.jsx("h2",{className:"text-sm font-semibold flex-1",style:{color:"#e6edf3"},children:"Workflows"}),!l&&y.jsxs(y.Fragment,{children:[y.jsx("button",{type:"button",onClick:()=>x(),className:"rounded px-3 py-1 text-[11px] font-semibold",style:{background:"#3fb950",color:"#0d1117"},children:"New workflow"}),y.jsx("button",{type:"button",onClick:()=>void f(),className:"text-[10px] hover:underline",style:{color:"rgba(230,237,243,0.4)"},children:"Refresh"})]})]}),i&&y.jsx("p",{className:"text-xs",style:{color:"rgba(230,237,243,0.4)"},children:"Loading workflows…"}),s&&y.jsx("p",{className:"rounded px-2 py-1 text-xs",style:{background:"rgba(248,81,73,0.08)",color:"#f85149"},children:s}),y.jsxs("div",{className:"flex gap-4",children:[!l&&y.jsx("div",{className:"flex flex-col gap-1.5 w-40 shrink-0",children:t.map(m=>y.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:[y.jsx("div",{className:"font-semibold",children:m.id}),y.jsxs("div",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.35)"},children:[m.phases.length," phases"]})]},m.id))}),y.jsx("div",{className:"flex-1 min-w-0",children:l?y.jsx(B8,{...c!==void 0?{initial:c}:{},onSaved:S,onCancel:()=>u(!1)}):v?y.jsxs("div",{className:"flex flex-col gap-2",children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider font-mono",style:{color:"rgba(230,237,243,0.4)"},children:v.id}),y.jsxs("span",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.35)"},children:["— ",v.phases.length," phases"]}),y.jsx("button",{type:"button",onClick:()=>x(v),className:"ml-auto text-[10px] hover:underline",style:{color:"#79c0ff"},children:"Edit"}),y.jsx("button",{type:"button",onClick:()=>x({...v,id:`${v.id}-copy`}),className:"text-[10px] hover:underline",style:{color:"rgba(230,237,243,0.4)"},children:"Duplicate"})]}),v.phases.map(m=>y.jsx(M8,{phase:m},m.id))]}):null})]}),!l&&y.jsxs("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.25)"},children:["Workflows saved to ",y.jsx("span",{style:{color:"rgba(230,237,243,0.4)"},children:"~/.wicked/workflows/"})," and registered immediately. Scripts saved to ",y.jsx("span",{style:{color:"rgba(230,237,243,0.4)"},children:"~/.wicked/scripts/"}),"."]})]})}const eE=t=>["completed","failed","cancelled"].includes(t),wv=t=>!eE(t),Sv=t=>t==="completed",rS=t=>t==="failed"||t==="cancelled",nS=[{id:"all",label:"All"},{id:"active",label:"Active"},{id:"completed",label:"Completed"},{id:"failed",label:"Failed"}];function z8({runs:t,selectedRunId:e,onSelect:r,navigate:n}){const[i,a]=K.useState(""),[s,o]=K.useState("all"),l=K.useRef([]),{range:u,setRange:c,filter:d}=dm("30d"),[p,f]=K.useState(!1),[x,S]=K.useState(null);K.useEffect(()=>{if(!p)return;let M=!1;return Ue.listRuns(!0).then(({runs:O})=>{M||S(O.filter($=>$.session.archived_at!=null))}).catch(()=>{M||S([])}),()=>{M=!0}},[p]);async function v(M){try{await Ue.archiveRun(M,!1),S(O=>O&&O.filter($=>$.session.id!==M))}catch{}}const m=K.useMemo(()=>t.filter(M=>!!M.session.workflow_id&&M.session.workflow_id!=="chat"),[t]),b=K.useMemo(()=>d(m),[m,d]),w=i.toLowerCase(),_=K.useMemo(()=>i?b.filter(M=>M.session.problem.toLowerCase().includes(w)):b,[b,i,w]),T=K.useMemo(()=>{const M=b.length,O=b.filter(F=>wv(F.session.status)).length,$=b.filter(F=>Sv(F.session.status)).length,D=b.filter(F=>eE(F.session.status)).length,B=D>0?`${Math.round($/D*100)}%`:"—",j=new Map;for(const F of b){const P=F.session.workflow_id;P&&P!=="chat"&&!P.startsWith("wf-")&&j.set(P,(j.get(P)??0)+1)}let I="—",U=0;return j.forEach((F,P)=>{F>U&&(U=F,I=P)}),{total:M,active:O,successRate:B,topWorkflow:I}},[b]),N={all:_.length,active:_.filter(M=>wv(M.session.status)).length,completed:_.filter(M=>Sv(M.session.status)).length,failed:_.filter(M=>rS(M.session.status)).length},E=_.filter(M=>wv(M.session.status)),k=_.filter(M=>Sv(M.session.status)),L=_.filter(M=>rS(M.session.status)),A=s==="all"?_:s==="active"?E:s==="completed"?k:L;return y.jsxs("div",{className:"flex flex-col h-full",style:{color:"#e6edf3"},children:[y.jsxs("div",{className:"px-8 pt-8 pb-4 flex items-center gap-4",children:[y.jsx("h1",{className:"text-xl font-semibold font-mono",children:"Work"}),y.jsx("div",{className:"flex-1"}),y.jsx(hm,{value:u,onChange:c}),y.jsx("input",{type:"text",placeholder:"Search work…",value:i,onChange:M=>a(M.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"}}),y.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"})]}),y.jsx("div",{className:"px-8 pb-4 grid gap-3",style:{gridTemplateColumns:"repeat(4, 1fr)"},children:[{label:"Total Runs",value:String(T.total),accent:void 0},{label:"Active",value:String(T.active),accent:"#79c0ff"},{label:"Success Rate",value:T.successRate,accent:"#3fb950"},{label:"Top Workflow",value:T.topWorkflow,accent:void 0}].map(M=>y.jsxs("div",{className:"rounded-xl px-4 py-3",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.07)"},children:[y.jsx("p",{className:"text-[10px] font-mono uppercase tracking-widest",style:{color:"rgba(230,237,243,0.4)",margin:0},children:M.label}),y.jsx("p",{className:"text-xl font-semibold font-mono mt-1 truncate",style:{color:M.accent??"#e6edf3",margin:"4px 0 0"},children:M.value})]},M.label))}),y.jsxs("div",{role:"tablist","aria-label":"Filter by status",className:"px-8 pb-3 flex items-center gap-2",onKeyDown:M=>{var B;const O=nS.map(j=>j.id),$=O.indexOf(s);let D=null;M.key==="ArrowRight"||M.key==="ArrowDown"?(M.preventDefault(),D=($+1)%O.length):(M.key==="ArrowLeft"||M.key==="ArrowUp")&&(M.preventDefault(),D=($-1+O.length)%O.length),D!==null&&(o(O[D]),(B=l.current[D])==null||B.focus())},children:[nS.map((M,O)=>y.jsxs("button",{ref:$=>{l.current[O]=$},id:`work-tab-${M.id}`,type:"button",role:"tab","aria-selected":s===M.id,"aria-controls":`work-panel-${M.id}`,tabIndex:s===M.id?0:-1,onClick:()=>o(M.id),className:"rounded-full px-3 py-1 text-xs font-mono",style:s===M.id?{background:"rgba(230,237,243,0.1)",color:"#e6edf3"}:{color:"rgba(230,237,243,0.4)"},children:[M.label," ",N[M.id]]},M.id)),y.jsx("div",{className:"flex-1"}),y.jsxs("button",{type:"button","aria-pressed":p,onClick:()=>f(M=>!M),className:"rounded-full px-3 py-1 text-xs font-mono",style:p?{background:"rgba(230,237,243,0.1)",color:"#e6edf3",border:"1px dashed rgba(230,237,243,0.3)"}:{color:"rgba(230,237,243,0.4)",border:"1px dashed rgba(230,237,243,0.15)"},children:["Archived",x!==null?` ${x.length}`:""]})]}),y.jsxs("div",{id:`work-panel-${s}`,role:"tabpanel","aria-labelledby":`work-tab-${s}`,className:"flex-1 overflow-y-auto px-5 pb-8 flex flex-col",children:[s==="all"?y.jsxs(y.Fragment,{children:[E.length>0&&y.jsxs(y.Fragment,{children:[y.jsx(rd,{pulse:!0,children:"Active"}),E.map(M=>y.jsx(ji,{view:M,selectedRunId:e,onSelect:r},M.session.id))]}),k.length>0&&y.jsxs(y.Fragment,{children:[y.jsx(rd,{children:"Completed"}),k.map(M=>y.jsx(ji,{view:M,selectedRunId:e,onSelect:r},M.session.id))]}),L.length>0&&y.jsxs(y.Fragment,{children:[y.jsx(rd,{children:"Failed"}),L.map(M=>y.jsx(ji,{view:M,selectedRunId:e,onSelect:r},M.session.id))]}),_.length===0&&y.jsx(iS,{query:i})]}):y.jsx(y.Fragment,{children:A.length===0?y.jsx(iS,{query:i,tab:s}):A.map(M=>y.jsx(ji,{view:M,selectedRunId:e,onSelect:r},M.session.id))}),p&&x!==null&&y.jsxs(y.Fragment,{children:[y.jsx(rd,{children:"Archived"}),x.length===0?y.jsx("p",{className:"px-3 py-3 text-sm font-mono italic",style:{color:"rgba(230,237,243,0.35)"},children:"Nothing archived."}):x.map(M=>y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("div",{className:"flex-1 min-w-0",style:{opacity:.55},children:y.jsx(ji,{view:M,selectedRunId:e,onSelect:r})}),y.jsx("button",{type:"button",onClick:()=>void v(M.session.id),className:"rounded-lg px-2 py-1 text-[11px] font-mono shrink-0",style:{color:"rgba(230,237,243,0.55)",border:"1px solid rgba(230,237,243,0.15)"},children:"Unarchive"})]},M.session.id))]})]})]})}function rd({children:t,pulse:e}){return y.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&&y.jsx("span",{className:"w-1.5 h-1.5 rounded-full animate-pulse shrink-0",style:{background:"#79c0ff"}}),t]})}function iS({query:t,tab:e}){const r=t?`No runs match "${t}".`:e?`No ${e} runs yet.`:"No work sessions yet.";return y.jsx("p",{className:"px-3 py-6 text-sm font-mono italic",style:{color:"rgba(230,237,243,0.35)"},children:r})}const tE="wicked_default_clis";function $8(t){return t.startsWith("/")||t.startsWith("\\\\")||/^[A-Za-z]:[\\/]/.test(t)}function aS({label:t,description:e,children:r}){return y.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:[y.jsxs("div",{className:"flex-1 min-w-0",children:[y.jsx("p",{className:"text-sm font-medium",style:{color:"#e6edf3"},children:t}),y.jsx("p",{className:"text-xs mt-0.5",style:{color:"rgba(230,237,243,0.45)"},children:e})]}),y.jsx("div",{className:"shrink-0",children:r})]})}function H8(t){try{const e=localStorage.getItem(tE);if(e)return new Set(JSON.parse(e))}catch{}return new Set(t.filter(e=>e.enabled_for_council).map(e=>e.key))}function U8(){const[t,e]=K.useState(null),[r,n]=K.useState({}),[i,a]=K.useState(!1),[s,o]=K.useState(!1),[l,u]=K.useState(null),c=K.useRef(null),[d,p]=K.useState([]),[f,x]=K.useState(new Set),[S,v]=K.useState(!1),m=K.useRef(null),[b,w]=K.useState(null),[_,T]=K.useState(null);K.useEffect(()=>{Ue.getSettings().then(({settings:D})=>e(D)).catch(D=>u(String(D))),Ue.getRoster().then(({roster:D})=>{p(D),x(H8(D))}).catch(()=>{})},[]),K.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]);function N(D){x(B=>{const j=new Set(B);return j.has(D)?j.delete(D):j.add(D),j})}function E(){u(null);try{localStorage.setItem(tE,JSON.stringify([...f]))}catch(D){u(String(D));return}v(!0),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>v(!1),2500)}K.useEffect(()=>()=>{c.current&&clearTimeout(c.current)},[]);function k(D,B){n(j=>({...j,[D]:B})),o(!1)}async function L(){if(Object.keys(r).length!==0){a(!0),u(null),T(null);try{const{settings:D}=await Ue.updateSettings(r);e(D),n({}),o(!0),c.current&&clearTimeout(c.current),c.current=setTimeout(()=>o(!1),2500)}catch(D){const B=D instanceof Error?D.message:String(D);"worker_config_root"in r?T(B):u(B)}finally{a(!1)}}}const A={graphNodeLimit:150,...t,...r},M=Object.keys(r).length>0,O=A.worker_config_root??"",$=O!==""&&!$8(O);return y.jsxs("div",{className:"max-w-2xl mx-auto",children:[y.jsxs("div",{className:"mb-6",children:[y.jsx("h1",{className:"text-lg font-semibold",style:{color:"#e6edf3"},children:"System"}),y.jsxs("p",{className:"text-sm mt-1",style:{color:"rgba(230,237,243,0.45)"},children:["Runtime tunables persisted to"," ",y.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&&y.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}),y.jsxs("section",{className:"rounded-xl px-5 mb-6",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.07)"},children:[y.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"}),y.jsx(aS,{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:y.jsx("input",{type:"number",min:20,max:500,step:10,value:A.graphNodeLimit,onChange:D=>{const B=Number(D.target.value);Number.isNaN(B)||k("graphNodeLimit",Math.max(20,Math.min(500,B)))},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"}})})]}),y.jsxs("section",{className:"rounded-xl px-5 mb-6",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.07)"},children:[y.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:"Workers"}),y.jsx(aS,{label:"Worker config root",description:"Base directory for the engine-owned worker CLI config homes (e.g. the claude worker home is <root>/claude). Empty = the engine default ~/.wicked-worker. Must be an absolute path; takes effect on the next worker spawn.",children:y.jsxs("div",{className:"flex flex-col items-end gap-1",children:[y.jsx("input",{type:"text","aria-label":"Worker config root",placeholder:"~/.wicked-worker",value:O,onChange:D=>{T(null),k("worker_config_root",D.target.value)},className:"w-56 rounded px-2 py-1 text-sm font-mono focus:outline-none",style:{background:"#161c26",border:`1px solid ${$||_?"rgba(248,81,73,0.5)":"rgba(230,237,243,0.12)"}`,color:"#e6edf3"}}),$&&y.jsx("p",{className:"text-xs",style:{color:"#f85149"},"data-testid":"worker-root-invalid",children:"Must be empty or an absolute path."}),_&&y.jsx("p",{className:"text-xs",style:{color:"#f85149"},"data-testid":"worker-root-error",children:_})]})})]}),y.jsxs("div",{className:"flex items-center gap-3 mb-8",children:[y.jsx("button",{type:"button",onClick:L,disabled:!M||i,className:"px-4 py-2 rounded-lg text-sm font-medium transition-colors disabled:opacity-40",style:M&&!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"}),s&&y.jsx("span",{className:"text-xs font-medium",style:{color:"#3fb950"},children:"Saved"})]}),y.jsxs("section",{className:"rounded-xl px-5 mb-6",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.07)"},children:[y.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:"CLI seats & sign-in"}),y.jsx("p",{className:"text-xs mb-4",style:{color:"rgba(230,237,243,0.4)"},children:"Checked CLIs are pre-selected when you open the launch form (takes effect on the next new session). The status shows whether each seat looks signed in; Sign in opens that CLI's own login flow in a terminal."}),d.length===0?y.jsx("p",{className:"text-xs italic pb-4 font-mono",style:{color:"rgba(230,237,243,0.3)"},children:"Loading roster…"}):y.jsx("div",{className:"flex flex-col gap-2 pb-4",children:d.map(D=>y.jsxs("div",{className:"flex items-center gap-3",children:[y.jsxs("label",{className:"flex items-center gap-3 cursor-pointer group flex-1 min-w-0",children:[y.jsx("input",{type:"checkbox",checked:f.has(D.key),onChange:()=>N(D.key),className:"accent-[#ffda19] w-3.5 h-3.5 shrink-0"}),y.jsx("span",{className:"text-sm font-mono truncate",style:{color:"#e6edf3"},children:D.display_name})]}),y.jsx("span",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.3)"},children:D.key}),D.signed_in===!0&&y.jsx("span",{className:"text-xs font-mono",style:{color:"#3fb950"},"data-testid":`seat-signin-${D.key}`,children:"✓ signed in"}),D.signed_in===!1&&y.jsx("span",{className:"text-xs font-mono",style:{color:"#f85149"},"data-testid":`seat-signin-${D.key}`,children:"sign in needed"}),D.login_invocation!==void 0&&D.login_invocation!==""&&D.signed_in!==!0&&y.jsx("button",{type:"button",onClick:()=>w(D),"aria-label":`Sign in ${D.display_name}`,className:"px-2.5 py-1 rounded-lg text-xs font-medium shrink-0",style:{background:"rgba(255,218,25,0.15)",color:"#ffda19",border:"1px solid rgba(255,218,25,0.3)"},children:"Sign in"})]},D.key))}),d.length>0&&y.jsxs("div",{className:"flex items-center gap-3 pb-4 pt-2 border-t",style:{borderColor:"rgba(230,237,243,0.07)"},children:[y.jsx("button",{type:"button",onClick:E,className:"px-4 py-2 rounded-lg text-sm font-medium",style:{background:"#ffda19",color:"#0d1117"},children:"Save CLI defaults"}),S&&y.jsx("span",{className:"text-xs font-medium",style:{color:"#3fb950"},children:"Saved"})]})]}),b!==null&&y.jsx(Kv,{title:`Sign in — ${b.display_name}`,onClose:()=>w(null),disableEscapeKey:!0,children:y.jsxs("div",{className:"flex flex-col gap-3",children:[y.jsxs("p",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.5)"},children:["Running"," ",y.jsx("code",{className:"rounded px-1 py-0.5",style:{background:"rgba(230,237,243,0.06)",color:"#e6edf3"},children:b.login_invocation})," ","in your shell — complete the sign-in flow below, then close this panel."]}),y.jsx($C,{cwd:".",initialInput:`${b.login_invocation??""}
|
|
428
|
+
`},b.key)]})})]})}const W8="default",V8=new Set(["crew.run","crew.chat"]);async function G8(t){const{projects:e}=await Ue.listProjects();return(await Promise.all(e.filter(n=>n.id!==W8).map(async n=>{try{const{members:i}=await Ue.listProjectMembers(n.id);return i.some(a=>a.member_ref===t&&V8.has(a.member_kind))?n.id:null}catch{return null}}))).find(n=>n!==null)??null}function q8(t,e){const{panel:r,runId:n,projectId:i,mode:a,showLaunch:s}=t;K.useEffect(()=>{if(a!==null)return;if(i!==null){e(Tn(i,sN(i)),{replace:!0});return}if(r!=="runs"||n===null||s)return;let o=!1;return G8(n).then(l=>{!o&&l!==null&&e(Tn(l,"build",n),{replace:!0})}).catch(()=>{}),()=>{o=!0}},[r,n,i,a,s,e])}function Y8(){const t=Wd(c=>c.status),e=Un(c=>c.setGate),r=Un(c=>c.reconcile),n=nu(c=>c.reconcile),[i,a]=K.useState([]),[s,o]=K.useState(0),l=K.useRef(null),u=K.useCallback(()=>{l.current!==null&&clearTimeout(l.current),l.current=setTimeout(()=>{l.current=null,o(c=>c+1)},400)},[]);return K.useEffect(()=>()=>{l.current!==null&&clearTimeout(l.current)},[]),K.useEffect(()=>{if(t!=="connected")return;let c=!1;return(async()=>{let d;try{({runs:d}=await Ue.listRuns())}catch{return}if(c)return;a(d);const p=d.filter(f=>f.session.status==="awaiting_human").map(f=>f.session.id);r(p),n(d.map(f=>f.session.id));for(const f of p)if(!Un.getState().gates[f])try{const x=await Ue.getGate(f);if(c)return;const S=cS(x);e({runId:x.runId,ord:x.ord,prompt:x.prompt,lifecycle:x.lifecycle,receivedAt:Date.parse(x.receivedAt)||Date.now(),...S!==void 0?{choices:S}:{}})}catch{}})(),()=>{c=!0}},[t,s,e,r,n]),{runs:i,refresh:u}}const K8=new Set(["sessionStarted","unitPlanned","unitDistributed","unitExecuting","gateDecided","unitDone","unitDenied","awaitingHuman","resumed","runCancelled","sessionFailed","sessionCompleted"]);function X8(t,e,r){K.useEffect(()=>{if(!t)return;function n(i){var a,s,o;if((i.ctrlKey||i.metaKey)&&i.key==="k"&&t){const l=((s=(a=i.target)==null?void 0:a.tagName)==null?void 0:s.toLowerCase())??"",u=((o=i.target)==null?void 0:o.isContentEditable)??!1;if(l==="input"||l==="textarea"||l==="select"||u)return;const c=e.find(p=>p.session.id===t);if(!c)return;["completed","cancelled","failed"].includes(c.session.status)||(i.preventDefault(),r(t))}}return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t,e,r])}function Q8(){const{panel:t,runId:e,repoId:r,projectId:n,mode:i,artifactId:a,showLaunch:s,showRegisterRepo:o,chatMode:l,navigate:u,search:c}=uN(),{runs:d,refresh:p}=Y8(),f=Un(W=>W.ingest),x=nu(W=>W.ingest),S=nd(W=>W.ingest),v=Wn(W=>W.ingest),m=ho(W=>W.ingest),b=an(W=>W.ingest),w=K.useCallback(()=>{p()},[p]),_=K.useCallback(()=>{p()},[p]),T=K.useCallback(W=>{f(W),x(W),S(W),v(W),m(W),b(W),K8.has(W.type)&&p()},[f,x,S,v,m,b,p]);Zk(T),q8({panel:t,runId:e,projectId:n,mode:i,showLaunch:s},u),K.useEffect(()=>{if(!e)return;const W=(ho.getState().byRun[e]??[]).length>0,V=Object.keys(Wn.getState().outputs).some(J=>J.startsWith(`${e}:u`));if(W&&V)return;let re=!1;return Ue.getRunEvents(e).then(({events:J})=>{re||(ho.getState().hydrate(e,J),Wn.getState().hydrateOutputs(e,J))}).catch(()=>{}),()=>{re=!0}},[e]);const N=K.useCallback(W=>n&&i?Tn(n,i==="chat"?"chat":"build",W):`/runs/${encodeURIComponent(W)}`,[n,i]),E=K.useCallback(W=>u(N(W)),[u,N]),k=K.useCallback(W=>{p(),u(N(W))},[u,p,N]),L=K.useCallback(()=>u(n&&i?Tn(n,i):"/runs"),[u,n,i]),A=K.useCallback(async W=>{try{await Ue.cancelRun(W),p()}catch{}},[p]);X8(e,d,A);const M=d.find(W=>W.session.id===e)??null,[O,$]=K.useState(null),[D,B]=K.useState(null),j=K.useCallback(W=>{r&&(B(W??null),Ue.listRepos().then(({repos:V})=>{const re=V.find(J=>J.id===r);re&&$(re)}))},[r]),I=()=>y.jsx("div",{className:"flex-1 overflow-y-auto",children:y.jsx(fT,{runs:d,onSelectRun:E,onApproveGate:w,onRejectGate:_,navigate:u})}),U=W=>y.jsx("div",{className:"flex-1 overflow-hidden",children:y.jsx(D8,{repoId:W,onBack:L})}),F=()=>y.jsx("div",{className:"flex-1 overflow-hidden",children:y.jsx(N8,{view:M,chatMode:l,onLaunched:k,onNavigateBack:L,onRefresh:p,onKill:A,navigate:u})});function P(W,V){return W==="document"?y.jsxs(y.Fragment,{children:[y.jsx(ER,{projectId:V,docId:a,version:r1(c),navigate:u}),y.jsx(b1,{projectId:V,docId:a,selectedVersion:r1(c),navigate:u})]}):W==="video"?y.jsxs(y.Fragment,{children:[y.jsx(sL,{projectId:V,demoId:a,navigate:u}),y.jsx(b1,{projectId:V,docId:a,selectedVersion:null,navigate:u,mode:"video"})]}):W==="chat"&&!a?U(null):a?F():I()}function H(){return n!==null&&i!==null?y.jsx(SL,{projectId:n,mode:i,artifactId:a,navigate:u,children:P(i,n)}):t==="home"?y.jsx(jN,{runs:d,navigate:u}):t==="coverage"?y.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:y.jsx(fS,{})}):t==="workflows"?y.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:y.jsx(F8,{})}):t==="domain"?y.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:y.jsx(CT,{})}):t==="policies"?y.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:y.jsx(dL,{})}):t==="rules"?y.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:y.jsx(Sj,{})}):t==="repos"?y.jsx("div",{className:"flex-1 overflow-hidden",children:y.jsx(PL,{onSelectRun:E,autoShowRegister:o,navigate:u})}):t==="repo-detail"&&r?y.jsx("div",{className:"flex-1 overflow-y-auto",children:y.jsx(FL,{repoId:r,onSelectRun:E,navigate:u,onOpenGraph:j})}):t==="chats"?y.jsx("div",{className:"flex-1 overflow-y-auto",children:y.jsx(gT,{runs:d,onSelect:E,navigate:u})}):t==="work"?y.jsx("div",{className:"flex-1 overflow-y-auto",children:y.jsx(z8,{runs:d,selectedRunId:e,onSelect:E,navigate:u})}):t==="projects"?y.jsx("div",{className:"flex-1 overflow-y-auto",children:y.jsx(LL,{navigate:u})}):t==="project-detail"&&n?y.jsx("div",{className:"flex-1 overflow-y-auto",children:y.jsx(EL,{projectId:n,navigate:u})}):t==="system"?y.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:y.jsx(U8,{})}):t==="runs"&&!e&&!M&&!s?I():l&&M===null?U(r):F()}return y.jsxs("div",{className:"flex h-screen overflow-hidden bg-wk-canvas",children:[y.jsx(XN,{runs:d,selectedRunId:e,onSelectRun:E,navigate:u}),y.jsx("div",{className:"flex flex-1 overflow-hidden",children:H()}),M!==null&&y.jsx(xj,{view:M}),t!=="home"&&y.jsx(kT,{onSelect:E,runId:e}),O!==null&&y.jsx(UO,{repo:O,initialFocus:D,onClose:()=>{$(null),B(null)},onSelectRun:E})]})}class Z8 extends K.Component{constructor(){super(...arguments);Cc(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:y.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:[y.jsx("p",{className:"text-sm font-semibold",style:{color:"#f85149"},children:"Something went wrong"}),y.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."}),y.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 rE=document.getElementById("root");if(!rE)throw new Error("Root element not found");Y3.createRoot(rE).render(y.jsx(K.StrictMode,{children:y.jsx(Z8,{children:y.jsx(Q8,{})})}));
|