openfox 1.6.15 → 1.6.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{auto-compaction-JZIM73ZY.js → auto-compaction-VOWM5ZHF.js} +2 -2
- package/dist/{chat-handler-F2A2IMQB.js → chat-handler-7HWNXQ4G.js} +4 -4
- package/dist/{chunk-JFKYCGZ5.js → chunk-EAQNNNUR.js} +2 -2
- package/dist/{chunk-3WHZ47PY.js → chunk-R7U3CD2U.js} +147 -230
- package/dist/{chunk-YM6VHAPM.js → chunk-RPPEIB3F.js} +2 -2
- package/dist/{chunk-G4E72ST3.js → chunk-UJANEDP5.js} +311 -262
- package/dist/cli/dev.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/{orchestrator-SRSG2SIZ.js → orchestrator-DJZZPPE7.js} +3 -3
- package/dist/package.json +2 -2
- package/dist/{processor-H5BQ5HQM.js → processor-PVYCX5GK.js} +2 -2
- package/dist/{serve-5AY7GMN7.js → serve-FEG4BUYZ.js} +4 -4
- package/dist/server/index.js +3 -3
- package/dist/{tools-VOWNOP6V.js → tools-YRDPOS6P.js} +2 -2
- package/dist/web/assets/index-CZBXRYpK.js +150 -0
- package/dist/web/assets/{index-CNeIjdxm.css → index-D4V7Gtvt.css} +1 -1
- package/dist/web/index.html +2 -2
- package/dist/web/sw.js +1 -1
- package/package.json +2 -2
- package/dist/web/assets/index-mBLhctLW.js +0 -150
- /package/dist/{server/commands/defaults → command-defaults}/commit-push.command.md +0 -0
- /package/dist/{server/commands/defaults → command-defaults}/init.command.md +0 -0
- /package/dist/{server/commands/defaults → command-defaults}/test-ui.command.md +0 -0
- /package/dist/{server/skills/defaults → skill-defaults}/browser.skill.md +0 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
var N1=Object.defineProperty;var T1=(e,r,i)=>r in e?N1(e,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[r]=i;var tr=(e,r,i)=>T1(e,typeof r!="symbol"?r+"":r,i);function A1(e,r){for(var i=0;i<r.length;i++){const s=r[i];if(typeof s!="string"&&!Array.isArray(s)){for(const c in s)if(c!=="default"&&!(c in e)){const u=Object.getOwnPropertyDescriptor(s,c);u&&Object.defineProperty(e,c,u.get?u:{enumerable:!0,get:()=>s[c]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))s(c);new MutationObserver(c=>{for(const u of c)if(u.type==="childList")for(const f of u.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&s(f)}).observe(document,{childList:!0,subtree:!0});function i(c){const u={};return c.integrity&&(u.integrity=c.integrity),c.referrerPolicy&&(u.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?u.credentials="include":c.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function s(c){if(c.ep)return;c.ep=!0;const u=i(c);fetch(c.href,u)}})();function Pl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var vd={exports:{}},ja={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var sx;function D1(){if(sx)return ja;sx=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function i(s,c,u){var f=null;if(u!==void 0&&(f=""+u),c.key!==void 0&&(f=""+c.key),"key"in c){u={};for(var l in c)l!=="key"&&(u[l]=c[l])}else u=c;return c=u.ref,{$$typeof:e,type:s,key:f,ref:c!==void 0?c:null,props:u}}return ja.Fragment=r,ja.jsx=i,ja.jsxs=i,ja}var ax;function L1(){return ax||(ax=1,vd.exports=D1()),vd.exports}var o=L1(),bd={exports:{}},Ge={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react.production.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var ox;function R1(){if(ox)return Ge;ox=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),f=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),y=Symbol.iterator;function _(B){return B===null||typeof B!="object"?null:(B=y&&B[y]||B["@@iterator"],typeof B=="function"?B:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,v={};function b(B,W,F){this.props=B,this.context=W,this.refs=v,this.updater=F||k}b.prototype.isReactComponent={},b.prototype.setState=function(B,W){if(typeof B!="object"&&typeof B!="function"&&B!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,B,W,"setState")},b.prototype.forceUpdate=function(B){this.updater.enqueueForceUpdate(this,B,"forceUpdate")};function x(){}x.prototype=b.prototype;function S(B,W,F){this.props=B,this.context=W,this.refs=v,this.updater=F||k}var j=S.prototype=new x;j.constructor=S,C(j,b.prototype),j.isPureReactComponent=!0;var A=Array.isArray;function N(){}var D={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function I(B,W,F){var re=F.ref;return{$$typeof:e,type:B,key:W,ref:re!==void 0?re:null,props:F}}function H(B,W){return I(B.type,W,B.props)}function V(B){return typeof B=="object"&&B!==null&&B.$$typeof===e}function Y(B){var W={"=":"=0",":":"=2"};return"$"+B.replace(/[=:]/g,function(F){return W[F]})}var q=/\/+/g;function O(B,W){return typeof B=="object"&&B!==null&&B.key!=null?Y(""+B.key):W.toString(36)}function U(B){switch(B.status){case"fulfilled":return B.value;case"rejected":throw B.reason;default:switch(typeof B.status=="string"?B.then(N,N):(B.status="pending",B.then(function(W){B.status==="pending"&&(B.status="fulfilled",B.value=W)},function(W){B.status==="pending"&&(B.status="rejected",B.reason=W)})),B.status){case"fulfilled":return B.value;case"rejected":throw B.reason}}throw B}function z(B,W,F,re,Z){var ee=typeof B;(ee==="undefined"||ee==="boolean")&&(B=null);var K=!1;if(B===null)K=!0;else switch(ee){case"bigint":case"string":case"number":K=!0;break;case"object":switch(B.$$typeof){case e:case r:K=!0;break;case g:return K=B._init,z(K(B._payload),W,F,re,Z)}}if(K)return Z=Z(B),K=re===""?"."+O(B,0):re,A(Z)?(F="",K!=null&&(F=K.replace(q,"$&/")+"/"),z(Z,W,F,"",function(ne){return ne})):Z!=null&&(V(Z)&&(Z=H(Z,F+(Z.key==null||B&&B.key===Z.key?"":(""+Z.key).replace(q,"$&/")+"/")+K)),W.push(Z)),1;K=0;var $=re===""?".":re+":";if(A(B))for(var ae=0;ae<B.length;ae++)re=B[ae],ee=$+O(re,ae),K+=z(re,W,F,ee,Z);else if(ae=_(B),typeof ae=="function")for(B=ae.call(B),ae=0;!(re=B.next()).done;)re=re.value,ee=$+O(re,ae++),K+=z(re,W,F,ee,Z);else if(ee==="object"){if(typeof B.then=="function")return z(U(B),W,F,re,Z);throw W=String(B),Error("Objects are not valid as a React child (found: "+(W==="[object Object]"?"object with keys {"+Object.keys(B).join(", ")+"}":W)+"). If you meant to render a collection of children, use an array instead.")}return K}function X(B,W,F){if(B==null)return B;var re=[],Z=0;return z(B,re,"","",function(ee){return W.call(F,ee,Z++)}),re}function Q(B){if(B._status===-1){var W=B._result;W=W(),W.then(function(F){(B._status===0||B._status===-1)&&(B._status=1,B._result=F)},function(F){(B._status===0||B._status===-1)&&(B._status=2,B._result=F)}),B._status===-1&&(B._status=0,B._result=W)}if(B._status===1)return B._result.default;throw B._result}var M=typeof reportError=="function"?reportError:function(B){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var W=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof B=="object"&&B!==null&&typeof B.message=="string"?String(B.message):String(B),error:B});if(!window.dispatchEvent(W))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",B);return}console.error(B)},L={map:X,forEach:function(B,W,F){X(B,function(){W.apply(this,arguments)},F)},count:function(B){var W=0;return X(B,function(){W++}),W},toArray:function(B){return X(B,function(W){return W})||[]},only:function(B){if(!V(B))throw Error("React.Children.only expected to receive a single React element child.");return B}};return Ge.Activity=m,Ge.Children=L,Ge.Component=b,Ge.Fragment=i,Ge.Profiler=c,Ge.PureComponent=S,Ge.StrictMode=s,Ge.Suspense=d,Ge.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=D,Ge.__COMPILER_RUNTIME={__proto__:null,c:function(B){return D.H.useMemoCache(B)}},Ge.cache=function(B){return function(){return B.apply(null,arguments)}},Ge.cacheSignal=function(){return null},Ge.cloneElement=function(B,W,F){if(B==null)throw Error("The argument must be a React element, but you passed "+B+".");var re=C({},B.props),Z=B.key;if(W!=null)for(ee in W.key!==void 0&&(Z=""+W.key),W)!T.call(W,ee)||ee==="key"||ee==="__self"||ee==="__source"||ee==="ref"&&W.ref===void 0||(re[ee]=W[ee]);var ee=arguments.length-2;if(ee===1)re.children=F;else if(1<ee){for(var K=Array(ee),$=0;$<ee;$++)K[$]=arguments[$+2];re.children=K}return I(B.type,Z,re)},Ge.createContext=function(B){return B={$$typeof:f,_currentValue:B,_currentValue2:B,_threadCount:0,Provider:null,Consumer:null},B.Provider=B,B.Consumer={$$typeof:u,_context:B},B},Ge.createElement=function(B,W,F){var re,Z={},ee=null;if(W!=null)for(re in W.key!==void 0&&(ee=""+W.key),W)T.call(W,re)&&re!=="key"&&re!=="__self"&&re!=="__source"&&(Z[re]=W[re]);var K=arguments.length-2;if(K===1)Z.children=F;else if(1<K){for(var $=Array(K),ae=0;ae<K;ae++)$[ae]=arguments[ae+2];Z.children=$}if(B&&B.defaultProps)for(re in K=B.defaultProps,K)Z[re]===void 0&&(Z[re]=K[re]);return I(B,ee,Z)},Ge.createRef=function(){return{current:null}},Ge.forwardRef=function(B){return{$$typeof:l,render:B}},Ge.isValidElement=V,Ge.lazy=function(B){return{$$typeof:g,_payload:{_status:-1,_result:B},_init:Q}},Ge.memo=function(B,W){return{$$typeof:p,type:B,compare:W===void 0?null:W}},Ge.startTransition=function(B){var W=D.T,F={};D.T=F;try{var re=B(),Z=D.S;Z!==null&&Z(F,re),typeof re=="object"&&re!==null&&typeof re.then=="function"&&re.then(N,M)}catch(ee){M(ee)}finally{W!==null&&F.types!==null&&(W.types=F.types),D.T=W}},Ge.unstable_useCacheRefresh=function(){return D.H.useCacheRefresh()},Ge.use=function(B){return D.H.use(B)},Ge.useActionState=function(B,W,F){return D.H.useActionState(B,W,F)},Ge.useCallback=function(B,W){return D.H.useCallback(B,W)},Ge.useContext=function(B){return D.H.useContext(B)},Ge.useDebugValue=function(){},Ge.useDeferredValue=function(B,W){return D.H.useDeferredValue(B,W)},Ge.useEffect=function(B,W){return D.H.useEffect(B,W)},Ge.useEffectEvent=function(B){return D.H.useEffectEvent(B)},Ge.useId=function(){return D.H.useId()},Ge.useImperativeHandle=function(B,W,F){return D.H.useImperativeHandle(B,W,F)},Ge.useInsertionEffect=function(B,W){return D.H.useInsertionEffect(B,W)},Ge.useLayoutEffect=function(B,W){return D.H.useLayoutEffect(B,W)},Ge.useMemo=function(B,W){return D.H.useMemo(B,W)},Ge.useOptimistic=function(B,W){return D.H.useOptimistic(B,W)},Ge.useReducer=function(B,W,F){return D.H.useReducer(B,W,F)},Ge.useRef=function(B){return D.H.useRef(B)},Ge.useState=function(B){return D.H.useState(B)},Ge.useSyncExternalStore=function(B,W,F){return D.H.useSyncExternalStore(B,W,F)},Ge.useTransition=function(){return D.H.useTransition()},Ge.version="19.2.4",Ge}var lx;function Fl(){return lx||(lx=1,bd.exports=R1()),bd.exports}var P=Fl();const dn=Pl(P),M1=A1({__proto__:null,default:dn},[P]);var yd={exports:{}},Na={},_d={exports:{}},Sd={};/**
|
|
18
|
+
* @license React
|
|
19
|
+
* scheduler.production.js
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/var cx;function O1(){return cx||(cx=1,(function(e){function r(z,X){var Q=z.length;z.push(X);e:for(;0<Q;){var M=Q-1>>>1,L=z[M];if(0<c(L,X))z[M]=X,z[Q]=L,Q=M;else break e}}function i(z){return z.length===0?null:z[0]}function s(z){if(z.length===0)return null;var X=z[0],Q=z.pop();if(Q!==X){z[0]=Q;e:for(var M=0,L=z.length,B=L>>>1;M<B;){var W=2*(M+1)-1,F=z[W],re=W+1,Z=z[re];if(0>c(F,Q))re<L&&0>c(Z,F)?(z[M]=Z,z[re]=Q,M=re):(z[M]=F,z[W]=Q,M=W);else if(re<L&&0>c(Z,Q))z[M]=Z,z[re]=Q,M=re;else break e}}return X}function c(z,X){var Q=z.sortIndex-X.sortIndex;return Q!==0?Q:z.id-X.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;e.unstable_now=function(){return u.now()}}else{var f=Date,l=f.now();e.unstable_now=function(){return f.now()-l}}var d=[],p=[],g=1,m=null,y=3,_=!1,k=!1,C=!1,v=!1,b=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,S=typeof setImmediate<"u"?setImmediate:null;function j(z){for(var X=i(p);X!==null;){if(X.callback===null)s(p);else if(X.startTime<=z)s(p),X.sortIndex=X.expirationTime,r(d,X);else break;X=i(p)}}function A(z){if(C=!1,j(z),!k)if(i(d)!==null)k=!0,N||(N=!0,Y());else{var X=i(p);X!==null&&U(A,X.startTime-z)}}var N=!1,D=-1,T=5,I=-1;function H(){return v?!0:!(e.unstable_now()-I<T)}function V(){if(v=!1,N){var z=e.unstable_now();I=z;var X=!0;try{e:{k=!1,C&&(C=!1,x(D),D=-1),_=!0;var Q=y;try{t:{for(j(z),m=i(d);m!==null&&!(m.expirationTime>z&&H());){var M=m.callback;if(typeof M=="function"){m.callback=null,y=m.priorityLevel;var L=M(m.expirationTime<=z);if(z=e.unstable_now(),typeof L=="function"){m.callback=L,j(z),X=!0;break t}m===i(d)&&s(d),j(z)}else s(d);m=i(d)}if(m!==null)X=!0;else{var B=i(p);B!==null&&U(A,B.startTime-z),X=!1}}break e}finally{m=null,y=Q,_=!1}X=void 0}}finally{X?Y():N=!1}}}var Y;if(typeof S=="function")Y=function(){S(V)};else if(typeof MessageChannel<"u"){var q=new MessageChannel,O=q.port2;q.port1.onmessage=V,Y=function(){O.postMessage(null)}}else Y=function(){b(V,0)};function U(z,X){D=b(function(){z(e.unstable_now())},X)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(z){z.callback=null},e.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):T=0<z?Math.floor(1e3/z):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_next=function(z){switch(y){case 1:case 2:case 3:var X=3;break;default:X=y}var Q=y;y=X;try{return z()}finally{y=Q}},e.unstable_requestPaint=function(){v=!0},e.unstable_runWithPriority=function(z,X){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var Q=y;y=z;try{return X()}finally{y=Q}},e.unstable_scheduleCallback=function(z,X,Q){var M=e.unstable_now();switch(typeof Q=="object"&&Q!==null?(Q=Q.delay,Q=typeof Q=="number"&&0<Q?M+Q:M):Q=M,z){case 1:var L=-1;break;case 2:L=250;break;case 5:L=1073741823;break;case 4:L=1e4;break;default:L=5e3}return L=Q+L,z={id:g++,callback:X,priorityLevel:z,startTime:Q,expirationTime:L,sortIndex:-1},Q>M?(z.sortIndex=Q,r(p,z),i(d)===null&&z===i(p)&&(C?(x(D),D=-1):C=!0,U(A,Q-M))):(z.sortIndex=L,r(d,z),k||_||(k=!0,N||(N=!0,Y()))),z},e.unstable_shouldYield=H,e.unstable_wrapCallback=function(z){var X=y;return function(){var Q=y;y=X;try{return z.apply(this,arguments)}finally{y=Q}}}})(Sd)),Sd}var ux;function B1(){return ux||(ux=1,_d.exports=O1()),_d.exports}var wd={exports:{}},sn={};/**
|
|
26
|
+
* @license React
|
|
27
|
+
* react-dom.production.js
|
|
28
|
+
*
|
|
29
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the MIT license found in the
|
|
32
|
+
* LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/var dx;function I1(){if(dx)return sn;dx=1;var e=Fl();function r(d){var p="https://react.dev/errors/"+d;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)p+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+d+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var s={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},c=Symbol.for("react.portal");function u(d,p,g){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:m==null?null:""+m,children:d,containerInfo:p,implementation:g}}var f=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(d,p){if(d==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return sn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,sn.createPortal=function(d,p){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(r(299));return u(d,p,null,g)},sn.flushSync=function(d){var p=f.T,g=s.p;try{if(f.T=null,s.p=2,d)return d()}finally{f.T=p,s.p=g,s.d.f()}},sn.preconnect=function(d,p){typeof d=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,s.d.C(d,p))},sn.prefetchDNS=function(d){typeof d=="string"&&s.d.D(d)},sn.preinit=function(d,p){if(typeof d=="string"&&p&&typeof p.as=="string"){var g=p.as,m=l(g,p.crossOrigin),y=typeof p.integrity=="string"?p.integrity:void 0,_=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;g==="style"?s.d.S(d,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:m,integrity:y,fetchPriority:_}):g==="script"&&s.d.X(d,{crossOrigin:m,integrity:y,fetchPriority:_,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},sn.preinitModule=function(d,p){if(typeof d=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var g=l(p.as,p.crossOrigin);s.d.M(d,{crossOrigin:g,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&s.d.M(d)},sn.preload=function(d,p){if(typeof d=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var g=p.as,m=l(g,p.crossOrigin);s.d.L(d,g,{crossOrigin:m,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},sn.preloadModule=function(d,p){if(typeof d=="string")if(p){var g=l(p.as,p.crossOrigin);s.d.m(d,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:g,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else s.d.m(d)},sn.requestFormReset=function(d){s.d.r(d)},sn.unstable_batchedUpdates=function(d,p){return d(p)},sn.useFormState=function(d,p,g){return f.H.useFormState(d,p,g)},sn.useFormStatus=function(){return f.H.useHostTransitionStatus()},sn.version="19.2.4",sn}var hx;function rb(){if(hx)return wd.exports;hx=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(r){console.error(r)}}return e(),wd.exports=I1(),wd.exports}/**
|
|
34
|
+
* @license React
|
|
35
|
+
* react-dom-client.production.js
|
|
36
|
+
*
|
|
37
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
38
|
+
*
|
|
39
|
+
* This source code is licensed under the MIT license found in the
|
|
40
|
+
* LICENSE file in the root directory of this source tree.
|
|
41
|
+
*/var fx;function z1(){if(fx)return Na;fx=1;var e=B1(),r=Fl(),i=rb();function s(t){var n="https://react.dev/errors/"+t;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)n+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+t+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function u(t){var n=t,a=t;if(t.alternate)for(;n.return;)n=n.return;else{t=n;do n=t,(n.flags&4098)!==0&&(a=n.return),t=n.return;while(t)}return n.tag===3?a:null}function f(t){if(t.tag===13){var n=t.memoizedState;if(n===null&&(t=t.alternate,t!==null&&(n=t.memoizedState)),n!==null)return n.dehydrated}return null}function l(t){if(t.tag===31){var n=t.memoizedState;if(n===null&&(t=t.alternate,t!==null&&(n=t.memoizedState)),n!==null)return n.dehydrated}return null}function d(t){if(u(t)!==t)throw Error(s(188))}function p(t){var n=t.alternate;if(!n){if(n=u(t),n===null)throw Error(s(188));return n!==t?null:t}for(var a=t,h=n;;){var w=a.return;if(w===null)break;var E=w.alternate;if(E===null){if(h=w.return,h!==null){a=h;continue}break}if(w.child===E.child){for(E=w.child;E;){if(E===a)return d(w),t;if(E===h)return d(w),n;E=E.sibling}throw Error(s(188))}if(a.return!==h.return)a=w,h=E;else{for(var R=!1,G=w.child;G;){if(G===a){R=!0,a=w,h=E;break}if(G===h){R=!0,h=w,a=E;break}G=G.sibling}if(!R){for(G=E.child;G;){if(G===a){R=!0,a=E,h=w;break}if(G===h){R=!0,h=E,a=w;break}G=G.sibling}if(!R)throw Error(s(189))}}if(a.alternate!==h)throw Error(s(190))}if(a.tag!==3)throw Error(s(188));return a.stateNode.current===a?t:n}function g(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t;for(t=t.child;t!==null;){if(n=g(t),n!==null)return n;t=t.sibling}return null}var m=Object.assign,y=Symbol.for("react.element"),_=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),v=Symbol.for("react.strict_mode"),b=Symbol.for("react.profiler"),x=Symbol.for("react.consumer"),S=Symbol.for("react.context"),j=Symbol.for("react.forward_ref"),A=Symbol.for("react.suspense"),N=Symbol.for("react.suspense_list"),D=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),H=Symbol.for("react.memo_cache_sentinel"),V=Symbol.iterator;function Y(t){return t===null||typeof t!="object"?null:(t=V&&t[V]||t["@@iterator"],typeof t=="function"?t:null)}var q=Symbol.for("react.client.reference");function O(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===q?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case C:return"Fragment";case b:return"Profiler";case v:return"StrictMode";case A:return"Suspense";case N:return"SuspenseList";case I:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case k:return"Portal";case S:return t.displayName||"Context";case x:return(t._context.displayName||"Context")+".Consumer";case j:var n=t.render;return t=t.displayName,t||(t=n.displayName||n.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case D:return n=t.displayName||null,n!==null?n:O(t.type)||"Memo";case T:n=t._payload,t=t._init;try{return O(t(n))}catch{}}return null}var U=Array.isArray,z=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q={pending:!1,data:null,method:null,action:null},M=[],L=-1;function B(t){return{current:t}}function W(t){0>L||(t.current=M[L],M[L]=null,L--)}function F(t,n){L++,M[L]=t.current,t.current=n}var re=B(null),Z=B(null),ee=B(null),K=B(null);function $(t,n){switch(F(ee,n),F(Z,t),F(re,null),n.nodeType){case 9:case 11:t=(t=n.documentElement)&&(t=t.namespaceURI)?Ng(t):0;break;default:if(t=n.tagName,n=n.namespaceURI)n=Ng(n),t=Tg(n,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}W(re),F(re,t)}function ae(){W(re),W(Z),W(ee)}function ne(t){t.memoizedState!==null&&F(K,t);var n=re.current,a=Tg(n,t.type);n!==a&&(F(Z,t),F(re,a))}function ve(t){Z.current===t&&(W(re),W(Z)),K.current===t&&(W(K),wa._currentValue=Q)}var be,Ae;function Me(t){if(be===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);be=n&&n[1]||"",Ae=-1<a.stack.indexOf(`
|
|
42
|
+
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
+
`+be+t+Ae}var Ie=!1;function Fe(t,n){if(!t||Ie)return"";Ie=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var h={DetermineComponentFrameRoot:function(){try{if(n){var xe=function(){throw Error()};if(Object.defineProperty(xe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(xe,[])}catch(de){var ce=de}Reflect.construct(t,[],xe)}else{try{xe.call()}catch(de){ce=de}t.call(xe.prototype)}}else{try{throw Error()}catch(de){ce=de}(xe=t())&&typeof xe.catch=="function"&&xe.catch(function(){})}}catch(de){if(de&&ce&&typeof de.stack=="string")return[de.stack,ce.stack]}return[null,null]}};h.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var w=Object.getOwnPropertyDescriptor(h.DetermineComponentFrameRoot,"name");w&&w.configurable&&Object.defineProperty(h.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var E=h.DetermineComponentFrameRoot(),R=E[0],G=E[1];if(R&&G){var J=R.split(`
|
|
44
|
+
`),le=G.split(`
|
|
45
|
+
`);for(w=h=0;h<J.length&&!J[h].includes("DetermineComponentFrameRoot");)h++;for(;w<le.length&&!le[w].includes("DetermineComponentFrameRoot");)w++;if(h===J.length||w===le.length)for(h=J.length-1,w=le.length-1;1<=h&&0<=w&&J[h]!==le[w];)w--;for(;1<=h&&0<=w;h--,w--)if(J[h]!==le[w]){if(h!==1||w!==1)do if(h--,w--,0>w||J[h]!==le[w]){var he=`
|
|
46
|
+
`+J[h].replace(" at new "," at ");return t.displayName&&he.includes("<anonymous>")&&(he=he.replace("<anonymous>",t.displayName)),he}while(1<=h&&0<=w);break}}}finally{Ie=!1,Error.prepareStackTrace=a}return(a=t?t.displayName||t.name:"")?Me(a):""}function ke(t,n){switch(t.tag){case 26:case 27:case 5:return Me(t.type);case 16:return Me("Lazy");case 13:return t.child!==n&&n!==null?Me("Suspense Fallback"):Me("Suspense");case 19:return Me("SuspenseList");case 0:case 15:return Fe(t.type,!1);case 11:return Fe(t.type.render,!1);case 1:return Fe(t.type,!0);case 31:return Me("Activity");default:return""}}function ge(t){try{var n="",a=null;do n+=ke(t,a),a=t,t=t.return;while(t);return n}catch(h){return`
|
|
47
|
+
Error generating stack: `+h.message+`
|
|
48
|
+
`+h.stack}}var je=Object.prototype.hasOwnProperty,We=e.unstable_scheduleCallback,Lt=e.unstable_cancelCallback,pe=e.unstable_shouldYield,Ne=e.unstable_requestPaint,Oe=e.unstable_now,lt=e.unstable_getCurrentPriorityLevel,ue=e.unstable_ImmediatePriority,_e=e.unstable_UserBlockingPriority,Te=e.unstable_NormalPriority,Be=e.unstable_LowPriority,Ve=e.unstable_IdlePriority,Ct=e.log,se=e.unstable_setDisableYieldValue,Le=null,$e=null;function at(t){if(typeof Ct=="function"&&se(t),$e&&typeof $e.setStrictMode=="function")try{$e.setStrictMode(Le,t)}catch{}}var qe=Math.clz32?Math.clz32:oi,Ut=Math.log,Rt=Math.LN2;function oi(t){return t>>>=0,t===0?32:31-(Ut(t)/Rt|0)|0}var fe=256,ye=262144,we=4194304;function Ye(t){var n=t&42;if(n!==0)return n;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function rt(t,n,a){var h=t.pendingLanes;if(h===0)return 0;var w=0,E=t.suspendedLanes,R=t.pingedLanes;t=t.warmLanes;var G=h&134217727;return G!==0?(h=G&~E,h!==0?w=Ye(h):(R&=G,R!==0?w=Ye(R):a||(a=G&~t,a!==0&&(w=Ye(a))))):(G=h&~E,G!==0?w=Ye(G):R!==0?w=Ye(R):a||(a=h&~t,a!==0&&(w=Ye(a)))),w===0?0:n!==0&&n!==w&&(n&E)===0&&(E=w&-w,a=n&-n,E>=a||E===32&&(a&4194048)!==0)?n:w}function Ue(t,n){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&n)===0}function Zt(t,n){switch(t){case 1:case 2:case 4:case 8:case 64:return n+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Mt(){var t=we;return we<<=1,(we&62914560)===0&&(we=4194304),t}function $t(t){for(var n=[],a=0;31>a;a++)n.push(t);return n}function Hi(t,n){t.pendingLanes|=n,n!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function ac(t,n,a,h,w,E){var R=t.pendingLanes;t.pendingLanes=a,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=a,t.entangledLanes&=a,t.errorRecoveryDisabledLanes&=a,t.shellSuspendCounter=0;var G=t.entanglements,J=t.expirationTimes,le=t.hiddenUpdates;for(a=R&~a;0<a;){var he=31-qe(a),xe=1<<he;G[he]=0,J[he]=-1;var ce=le[he];if(ce!==null)for(le[he]=null,he=0;he<ce.length;he++){var de=ce[he];de!==null&&(de.lane&=-536870913)}a&=~xe}h!==0&&uf(t,h,0),E!==0&&w===0&&t.tag!==0&&(t.suspendedLanes|=E&~(R&~n))}function uf(t,n,a){t.pendingLanes|=n,t.suspendedLanes&=~n;var h=31-qe(n);t.entangledLanes|=n,t.entanglements[h]=t.entanglements[h]|1073741824|a&261930}function df(t,n){var a=t.entangledLanes|=n;for(t=t.entanglements;a;){var h=31-qe(a),w=1<<h;w&n|t[h]&n&&(t[h]|=n),a&=~w}}function hf(t,n){var a=n&-n;return a=(a&42)!==0?1:oc(a),(a&(t.suspendedLanes|n))!==0?0:a}function oc(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function lc(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function ff(){var t=X.p;return t!==0?t:(t=window.event,t===void 0?32:Qg(t.type))}function pf(t,n){var a=X.p;try{return X.p=t,n()}finally{X.p=a}}var Ar=Math.random().toString(36).slice(2),Qt="__reactFiber$"+Ar,fn="__reactProps$"+Ar,Pi="__reactContainer$"+Ar,cc="__reactEvents$"+Ar,x0="__reactListeners$"+Ar,v0="__reactHandles$"+Ar,mf="__reactResources$"+Ar,zs="__reactMarker$"+Ar;function uc(t){delete t[Qt],delete t[fn],delete t[cc],delete t[x0],delete t[v0]}function Fi(t){var n=t[Qt];if(n)return n;for(var a=t.parentNode;a;){if(n=a[Pi]||a[Qt]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(t=Bg(t);t!==null;){if(a=t[Qt])return a;t=Bg(t)}return n}t=a,a=t.parentNode}return null}function Ui(t){if(t=t[Qt]||t[Pi]){var n=t.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return t}return null}function Hs(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t.stateNode;throw Error(s(33))}function $i(t){var n=t[mf];return n||(n=t[mf]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Yt(t){t[zs]=!0}var gf=new Set,xf={};function li(t,n){qi(t,n),qi(t+"Capture",n)}function qi(t,n){for(xf[t]=n,t=0;t<n.length;t++)gf.add(n[t])}var b0=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),vf={},bf={};function y0(t){return je.call(bf,t)?!0:je.call(vf,t)?!1:b0.test(t)?bf[t]=!0:(vf[t]=!0,!1)}function so(t,n,a){if(y0(n))if(a===null)t.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":t.removeAttribute(n);return;case"boolean":var h=n.toLowerCase().slice(0,5);if(h!=="data-"&&h!=="aria-"){t.removeAttribute(n);return}}t.setAttribute(n,""+a)}}function ao(t,n,a){if(a===null)t.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(n);return}t.setAttribute(n,""+a)}}function lr(t,n,a,h){if(h===null)t.removeAttribute(a);else{switch(typeof h){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(a);return}t.setAttributeNS(n,a,""+h)}}function Mn(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function yf(t){var n=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function _0(t,n,a){var h=Object.getOwnPropertyDescriptor(t.constructor.prototype,n);if(!t.hasOwnProperty(n)&&typeof h<"u"&&typeof h.get=="function"&&typeof h.set=="function"){var w=h.get,E=h.set;return Object.defineProperty(t,n,{configurable:!0,get:function(){return w.call(this)},set:function(R){a=""+R,E.call(this,R)}}),Object.defineProperty(t,n,{enumerable:h.enumerable}),{getValue:function(){return a},setValue:function(R){a=""+R},stopTracking:function(){t._valueTracker=null,delete t[n]}}}}function dc(t){if(!t._valueTracker){var n=yf(t)?"checked":"value";t._valueTracker=_0(t,n,""+t[n])}}function _f(t){if(!t)return!1;var n=t._valueTracker;if(!n)return!0;var a=n.getValue(),h="";return t&&(h=yf(t)?t.checked?"true":"false":t.value),t=h,t!==a?(n.setValue(t),!0):!1}function oo(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var S0=/[\n"\\]/g;function On(t){return t.replace(S0,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function hc(t,n,a,h,w,E,R,G){t.name="",R!=null&&typeof R!="function"&&typeof R!="symbol"&&typeof R!="boolean"?t.type=R:t.removeAttribute("type"),n!=null?R==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+Mn(n)):t.value!==""+Mn(n)&&(t.value=""+Mn(n)):R!=="submit"&&R!=="reset"||t.removeAttribute("value"),n!=null?fc(t,R,Mn(n)):a!=null?fc(t,R,Mn(a)):h!=null&&t.removeAttribute("value"),w==null&&E!=null&&(t.defaultChecked=!!E),w!=null&&(t.checked=w&&typeof w!="function"&&typeof w!="symbol"),G!=null&&typeof G!="function"&&typeof G!="symbol"&&typeof G!="boolean"?t.name=""+Mn(G):t.removeAttribute("name")}function Sf(t,n,a,h,w,E,R,G){if(E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"&&(t.type=E),n!=null||a!=null){if(!(E!=="submit"&&E!=="reset"||n!=null)){dc(t);return}a=a!=null?""+Mn(a):"",n=n!=null?""+Mn(n):a,G||n===t.value||(t.value=n),t.defaultValue=n}h=h??w,h=typeof h!="function"&&typeof h!="symbol"&&!!h,t.checked=G?t.checked:!!h,t.defaultChecked=!!h,R!=null&&typeof R!="function"&&typeof R!="symbol"&&typeof R!="boolean"&&(t.name=R),dc(t)}function fc(t,n,a){n==="number"&&oo(t.ownerDocument)===t||t.defaultValue===""+a||(t.defaultValue=""+a)}function Wi(t,n,a,h){if(t=t.options,n){n={};for(var w=0;w<a.length;w++)n["$"+a[w]]=!0;for(a=0;a<t.length;a++)w=n.hasOwnProperty("$"+t[a].value),t[a].selected!==w&&(t[a].selected=w),w&&h&&(t[a].defaultSelected=!0)}else{for(a=""+Mn(a),n=null,w=0;w<t.length;w++){if(t[w].value===a){t[w].selected=!0,h&&(t[w].defaultSelected=!0);return}n!==null||t[w].disabled||(n=t[w])}n!==null&&(n.selected=!0)}}function wf(t,n,a){if(n!=null&&(n=""+Mn(n),n!==t.value&&(t.value=n),a==null)){t.defaultValue!==n&&(t.defaultValue=n);return}t.defaultValue=a!=null?""+Mn(a):""}function Cf(t,n,a,h){if(n==null){if(h!=null){if(a!=null)throw Error(s(92));if(U(h)){if(1<h.length)throw Error(s(93));h=h[0]}a=h}a==null&&(a=""),n=a}a=Mn(n),t.defaultValue=a,h=t.textContent,h===a&&h!==""&&h!==null&&(t.value=h),dc(t)}function Gi(t,n){if(n){var a=t.firstChild;if(a&&a===t.lastChild&&a.nodeType===3){a.nodeValue=n;return}}t.textContent=n}var w0=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function kf(t,n,a){var h=n.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?h?t.setProperty(n,""):n==="float"?t.cssFloat="":t[n]="":h?t.setProperty(n,a):typeof a!="number"||a===0||w0.has(n)?n==="float"?t.cssFloat=a:t[n]=(""+a).trim():t[n]=a+"px"}function Ef(t,n,a){if(n!=null&&typeof n!="object")throw Error(s(62));if(t=t.style,a!=null){for(var h in a)!a.hasOwnProperty(h)||n!=null&&n.hasOwnProperty(h)||(h.indexOf("--")===0?t.setProperty(h,""):h==="float"?t.cssFloat="":t[h]="");for(var w in n)h=n[w],n.hasOwnProperty(w)&&a[w]!==h&&kf(t,w,h)}else for(var E in n)n.hasOwnProperty(E)&&kf(t,E,n[E])}function pc(t){if(t.indexOf("-")===-1)return!1;switch(t){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 C0=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),k0=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function lo(t){return k0.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function cr(){}var mc=null;function gc(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Vi=null,Yi=null;function jf(t){var n=Ui(t);if(n&&(t=n.stateNode)){var a=t[fn]||null;e:switch(t=n.stateNode,n.type){case"input":if(hc(t,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),n=a.name,a.type==="radio"&&n!=null){for(a=t;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+On(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var h=a[n];if(h!==t&&h.form===t.form){var w=h[fn]||null;if(!w)throw Error(s(90));hc(h,w.value,w.defaultValue,w.defaultValue,w.checked,w.defaultChecked,w.type,w.name)}}for(n=0;n<a.length;n++)h=a[n],h.form===t.form&&_f(h)}break e;case"textarea":wf(t,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&Wi(t,!!a.multiple,n,!1)}}}var xc=!1;function Nf(t,n,a){if(xc)return t(n,a);xc=!0;try{var h=t(n);return h}finally{if(xc=!1,(Vi!==null||Yi!==null)&&(Xo(),Vi&&(n=Vi,t=Yi,Yi=Vi=null,jf(n),t)))for(n=0;n<t.length;n++)jf(t[n])}}function Ps(t,n){var a=t.stateNode;if(a===null)return null;var h=a[fn]||null;if(h===null)return null;a=h[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(h=!h.disabled)||(t=t.type,h=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!h;break e;default:t=!1}if(t)return null;if(a&&typeof a!="function")throw Error(s(231,n,typeof a));return a}var ur=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),vc=!1;if(ur)try{var Fs={};Object.defineProperty(Fs,"passive",{get:function(){vc=!0}}),window.addEventListener("test",Fs,Fs),window.removeEventListener("test",Fs,Fs)}catch{vc=!1}var Dr=null,bc=null,co=null;function Tf(){if(co)return co;var t,n=bc,a=n.length,h,w="value"in Dr?Dr.value:Dr.textContent,E=w.length;for(t=0;t<a&&n[t]===w[t];t++);var R=a-t;for(h=1;h<=R&&n[a-h]===w[E-h];h++);return co=w.slice(t,1<h?1-h:void 0)}function uo(t){var n=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&n===13&&(t=13)):t=n,t===10&&(t=13),32<=t||t===13?t:0}function ho(){return!0}function Af(){return!1}function pn(t){function n(a,h,w,E,R){this._reactName=a,this._targetInst=w,this.type=h,this.nativeEvent=E,this.target=R,this.currentTarget=null;for(var G in t)t.hasOwnProperty(G)&&(a=t[G],this[G]=a?a(E):E[G]);return this.isDefaultPrevented=(E.defaultPrevented!=null?E.defaultPrevented:E.returnValue===!1)?ho:Af,this.isPropagationStopped=Af,this}return m(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=ho)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=ho)},persist:function(){},isPersistent:ho}),n}var ci={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},fo=pn(ci),Us=m({},ci,{view:0,detail:0}),E0=pn(Us),yc,_c,$s,po=m({},Us,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:wc,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==$s&&($s&&t.type==="mousemove"?(yc=t.screenX-$s.screenX,_c=t.screenY-$s.screenY):_c=yc=0,$s=t),yc)},movementY:function(t){return"movementY"in t?t.movementY:_c}}),Df=pn(po),j0=m({},po,{dataTransfer:0}),N0=pn(j0),T0=m({},Us,{relatedTarget:0}),Sc=pn(T0),A0=m({},ci,{animationName:0,elapsedTime:0,pseudoElement:0}),D0=pn(A0),L0=m({},ci,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),R0=pn(L0),M0=m({},ci,{data:0}),Lf=pn(M0),O0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},B0={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"},I0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function z0(t){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(t):(t=I0[t])?!!n[t]:!1}function wc(){return z0}var H0=m({},Us,{key:function(t){if(t.key){var n=O0[t.key]||t.key;if(n!=="Unidentified")return n}return t.type==="keypress"?(t=uo(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?B0[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:wc,charCode:function(t){return t.type==="keypress"?uo(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?uo(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),P0=pn(H0),F0=m({},po,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Rf=pn(F0),U0=m({},Us,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:wc}),$0=pn(U0),q0=m({},ci,{propertyName:0,elapsedTime:0,pseudoElement:0}),W0=pn(q0),G0=m({},po,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),V0=pn(G0),Y0=m({},ci,{newState:0,oldState:0}),K0=pn(Y0),X0=[9,13,27,32],Cc=ur&&"CompositionEvent"in window,qs=null;ur&&"documentMode"in document&&(qs=document.documentMode);var Z0=ur&&"TextEvent"in window&&!qs,Mf=ur&&(!Cc||qs&&8<qs&&11>=qs),Of=" ",Bf=!1;function If(t,n){switch(t){case"keyup":return X0.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function zf(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Ki=!1;function Q0(t,n){switch(t){case"compositionend":return zf(n);case"keypress":return n.which!==32?null:(Bf=!0,Of);case"textInput":return t=n.data,t===Of&&Bf?null:t;default:return null}}function J0(t,n){if(Ki)return t==="compositionend"||!Cc&&If(t,n)?(t=Tf(),co=bc=Dr=null,Ki=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return Mf&&n.locale!=="ko"?null:n.data;default:return null}}var e_={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 Hf(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n==="input"?!!e_[t.type]:n==="textarea"}function Pf(t,n,a,h){Vi?Yi?Yi.push(h):Yi=[h]:Vi=h,n=rl(n,"onChange"),0<n.length&&(a=new fo("onChange","change",null,a,h),t.push({event:a,listeners:n}))}var Ws=null,Gs=null;function t_(t){Sg(t,0)}function mo(t){var n=Hs(t);if(_f(n))return t}function Ff(t,n){if(t==="change")return n}var Uf=!1;if(ur){var kc;if(ur){var Ec="oninput"in document;if(!Ec){var $f=document.createElement("div");$f.setAttribute("oninput","return;"),Ec=typeof $f.oninput=="function"}kc=Ec}else kc=!1;Uf=kc&&(!document.documentMode||9<document.documentMode)}function qf(){Ws&&(Ws.detachEvent("onpropertychange",Wf),Gs=Ws=null)}function Wf(t){if(t.propertyName==="value"&&mo(Gs)){var n=[];Pf(n,Gs,t,gc(t)),Nf(t_,n)}}function n_(t,n,a){t==="focusin"?(qf(),Ws=n,Gs=a,Ws.attachEvent("onpropertychange",Wf)):t==="focusout"&&qf()}function r_(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return mo(Gs)}function i_(t,n){if(t==="click")return mo(n)}function s_(t,n){if(t==="input"||t==="change")return mo(n)}function a_(t,n){return t===n&&(t!==0||1/t===1/n)||t!==t&&n!==n}var Sn=typeof Object.is=="function"?Object.is:a_;function Vs(t,n){if(Sn(t,n))return!0;if(typeof t!="object"||t===null||typeof n!="object"||n===null)return!1;var a=Object.keys(t),h=Object.keys(n);if(a.length!==h.length)return!1;for(h=0;h<a.length;h++){var w=a[h];if(!je.call(n,w)||!Sn(t[w],n[w]))return!1}return!0}function Gf(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Vf(t,n){var a=Gf(t);t=0;for(var h;a;){if(a.nodeType===3){if(h=t+a.textContent.length,t<=n&&h>=n)return{node:a,offset:n-t};t=h}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Gf(a)}}function Yf(t,n){return t&&n?t===n?!0:t&&t.nodeType===3?!1:n&&n.nodeType===3?Yf(t,n.parentNode):"contains"in t?t.contains(n):t.compareDocumentPosition?!!(t.compareDocumentPosition(n)&16):!1:!1}function Kf(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var n=oo(t.document);n instanceof t.HTMLIFrameElement;){try{var a=typeof n.contentWindow.location.href=="string"}catch{a=!1}if(a)t=n.contentWindow;else break;n=oo(t.document)}return n}function jc(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n&&(n==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||n==="textarea"||t.contentEditable==="true")}var o_=ur&&"documentMode"in document&&11>=document.documentMode,Xi=null,Nc=null,Ys=null,Tc=!1;function Xf(t,n,a){var h=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Tc||Xi==null||Xi!==oo(h)||(h=Xi,"selectionStart"in h&&jc(h)?h={start:h.selectionStart,end:h.selectionEnd}:(h=(h.ownerDocument&&h.ownerDocument.defaultView||window).getSelection(),h={anchorNode:h.anchorNode,anchorOffset:h.anchorOffset,focusNode:h.focusNode,focusOffset:h.focusOffset}),Ys&&Vs(Ys,h)||(Ys=h,h=rl(Nc,"onSelect"),0<h.length&&(n=new fo("onSelect","select",null,n,a),t.push({event:n,listeners:h}),n.target=Xi)))}function ui(t,n){var a={};return a[t.toLowerCase()]=n.toLowerCase(),a["Webkit"+t]="webkit"+n,a["Moz"+t]="moz"+n,a}var Zi={animationend:ui("Animation","AnimationEnd"),animationiteration:ui("Animation","AnimationIteration"),animationstart:ui("Animation","AnimationStart"),transitionrun:ui("Transition","TransitionRun"),transitionstart:ui("Transition","TransitionStart"),transitioncancel:ui("Transition","TransitionCancel"),transitionend:ui("Transition","TransitionEnd")},Ac={},Zf={};ur&&(Zf=document.createElement("div").style,"AnimationEvent"in window||(delete Zi.animationend.animation,delete Zi.animationiteration.animation,delete Zi.animationstart.animation),"TransitionEvent"in window||delete Zi.transitionend.transition);function di(t){if(Ac[t])return Ac[t];if(!Zi[t])return t;var n=Zi[t],a;for(a in n)if(n.hasOwnProperty(a)&&a in Zf)return Ac[t]=n[a];return t}var Qf=di("animationend"),Jf=di("animationiteration"),ep=di("animationstart"),l_=di("transitionrun"),c_=di("transitionstart"),u_=di("transitioncancel"),tp=di("transitionend"),np=new Map,Dc="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Dc.push("scrollEnd");function Gn(t,n){np.set(t,n),li(n,[t])}var go=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},Bn=[],Qi=0,Lc=0;function xo(){for(var t=Qi,n=Lc=Qi=0;n<t;){var a=Bn[n];Bn[n++]=null;var h=Bn[n];Bn[n++]=null;var w=Bn[n];Bn[n++]=null;var E=Bn[n];if(Bn[n++]=null,h!==null&&w!==null){var R=h.pending;R===null?w.next=w:(w.next=R.next,R.next=w),h.pending=w}E!==0&&rp(a,w,E)}}function vo(t,n,a,h){Bn[Qi++]=t,Bn[Qi++]=n,Bn[Qi++]=a,Bn[Qi++]=h,Lc|=h,t.lanes|=h,t=t.alternate,t!==null&&(t.lanes|=h)}function Rc(t,n,a,h){return vo(t,n,a,h),bo(t)}function hi(t,n){return vo(t,null,null,n),bo(t)}function rp(t,n,a){t.lanes|=a;var h=t.alternate;h!==null&&(h.lanes|=a);for(var w=!1,E=t.return;E!==null;)E.childLanes|=a,h=E.alternate,h!==null&&(h.childLanes|=a),E.tag===22&&(t=E.stateNode,t===null||t._visibility&1||(w=!0)),t=E,E=E.return;return t.tag===3?(E=t.stateNode,w&&n!==null&&(w=31-qe(a),t=E.hiddenUpdates,h=t[w],h===null?t[w]=[n]:h.push(n),n.lane=a|536870912),E):null}function bo(t){if(50<ga)throw ga=0,Uu=null,Error(s(185));for(var n=t.return;n!==null;)t=n,n=t.return;return t.tag===3?t.stateNode:null}var Ji={};function d_(t,n,a,h){this.tag=t,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=h,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function wn(t,n,a,h){return new d_(t,n,a,h)}function Mc(t){return t=t.prototype,!(!t||!t.isReactComponent)}function dr(t,n){var a=t.alternate;return a===null?(a=wn(t.tag,n,t.key,t.mode),a.elementType=t.elementType,a.type=t.type,a.stateNode=t.stateNode,a.alternate=t,t.alternate=a):(a.pendingProps=n,a.type=t.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=t.flags&65011712,a.childLanes=t.childLanes,a.lanes=t.lanes,a.child=t.child,a.memoizedProps=t.memoizedProps,a.memoizedState=t.memoizedState,a.updateQueue=t.updateQueue,n=t.dependencies,a.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},a.sibling=t.sibling,a.index=t.index,a.ref=t.ref,a.refCleanup=t.refCleanup,a}function ip(t,n){t.flags&=65011714;var a=t.alternate;return a===null?(t.childLanes=0,t.lanes=n,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=a.childLanes,t.lanes=a.lanes,t.child=a.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=a.memoizedProps,t.memoizedState=a.memoizedState,t.updateQueue=a.updateQueue,t.type=a.type,n=a.dependencies,t.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),t}function yo(t,n,a,h,w,E){var R=0;if(h=t,typeof t=="function")Mc(t)&&(R=1);else if(typeof t=="string")R=g1(t,a,re.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case I:return t=wn(31,a,n,w),t.elementType=I,t.lanes=E,t;case C:return fi(a.children,w,E,n);case v:R=8,w|=24;break;case b:return t=wn(12,a,n,w|2),t.elementType=b,t.lanes=E,t;case A:return t=wn(13,a,n,w),t.elementType=A,t.lanes=E,t;case N:return t=wn(19,a,n,w),t.elementType=N,t.lanes=E,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case S:R=10;break e;case x:R=9;break e;case j:R=11;break e;case D:R=14;break e;case T:R=16,h=null;break e}R=29,a=Error(s(130,t===null?"null":typeof t,"")),h=null}return n=wn(R,a,n,w),n.elementType=t,n.type=h,n.lanes=E,n}function fi(t,n,a,h){return t=wn(7,t,h,n),t.lanes=a,t}function Oc(t,n,a){return t=wn(6,t,null,n),t.lanes=a,t}function sp(t){var n=wn(18,null,null,0);return n.stateNode=t,n}function Bc(t,n,a){return n=wn(4,t.children!==null?t.children:[],t.key,n),n.lanes=a,n.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},n}var ap=new WeakMap;function In(t,n){if(typeof t=="object"&&t!==null){var a=ap.get(t);return a!==void 0?a:(n={value:t,source:n,stack:ge(n)},ap.set(t,n),n)}return{value:t,source:n,stack:ge(n)}}var es=[],ts=0,_o=null,Ks=0,zn=[],Hn=0,Lr=null,Zn=1,Qn="";function hr(t,n){es[ts++]=Ks,es[ts++]=_o,_o=t,Ks=n}function op(t,n,a){zn[Hn++]=Zn,zn[Hn++]=Qn,zn[Hn++]=Lr,Lr=t;var h=Zn;t=Qn;var w=32-qe(h)-1;h&=~(1<<w),a+=1;var E=32-qe(n)+w;if(30<E){var R=w-w%5;E=(h&(1<<R)-1).toString(32),h>>=R,w-=R,Zn=1<<32-qe(n)+w|a<<w|h,Qn=E+t}else Zn=1<<E|a<<w|h,Qn=t}function Ic(t){t.return!==null&&(hr(t,1),op(t,1,0))}function zc(t){for(;t===_o;)_o=es[--ts],es[ts]=null,Ks=es[--ts],es[ts]=null;for(;t===Lr;)Lr=zn[--Hn],zn[Hn]=null,Qn=zn[--Hn],zn[Hn]=null,Zn=zn[--Hn],zn[Hn]=null}function lp(t,n){zn[Hn++]=Zn,zn[Hn++]=Qn,zn[Hn++]=Lr,Zn=n.id,Qn=n.overflow,Lr=t}var Jt=null,_t=null,it=!1,Rr=null,Pn=!1,Hc=Error(s(519));function Mr(t){var n=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Xs(In(n,t)),Hc}function cp(t){var n=t.stateNode,a=t.type,h=t.memoizedProps;switch(n[Qt]=t,n[fn]=h,a){case"dialog":Je("cancel",n),Je("close",n);break;case"iframe":case"object":case"embed":Je("load",n);break;case"video":case"audio":for(a=0;a<va.length;a++)Je(va[a],n);break;case"source":Je("error",n);break;case"img":case"image":case"link":Je("error",n),Je("load",n);break;case"details":Je("toggle",n);break;case"input":Je("invalid",n),Sf(n,h.value,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name,!0);break;case"select":Je("invalid",n);break;case"textarea":Je("invalid",n),Cf(n,h.value,h.defaultValue,h.children)}a=h.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||n.textContent===""+a||h.suppressHydrationWarning===!0||Eg(n.textContent,a)?(h.popover!=null&&(Je("beforetoggle",n),Je("toggle",n)),h.onScroll!=null&&Je("scroll",n),h.onScrollEnd!=null&&Je("scrollend",n),h.onClick!=null&&(n.onclick=cr),n=!0):n=!1,n||Mr(t,!0)}function up(t){for(Jt=t.return;Jt;)switch(Jt.tag){case 5:case 31:case 13:Pn=!1;return;case 27:case 3:Pn=!0;return;default:Jt=Jt.return}}function ns(t){if(t!==Jt)return!1;if(!it)return up(t),it=!0,!1;var n=t.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=t.type,a=!(a!=="form"&&a!=="button")||rd(t.type,t.memoizedProps)),a=!a),a&&_t&&Mr(t),up(t),n===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));_t=Og(t)}else if(n===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));_t=Og(t)}else n===27?(n=_t,Yr(t.type)?(t=ld,ld=null,_t=t):_t=n):_t=Jt?Un(t.stateNode.nextSibling):null;return!0}function pi(){_t=Jt=null,it=!1}function Pc(){var t=Rr;return t!==null&&(vn===null?vn=t:vn.push.apply(vn,t),Rr=null),t}function Xs(t){Rr===null?Rr=[t]:Rr.push(t)}var Fc=B(null),mi=null,fr=null;function Or(t,n,a){F(Fc,n._currentValue),n._currentValue=a}function pr(t){t._currentValue=Fc.current,W(Fc)}function Uc(t,n,a){for(;t!==null;){var h=t.alternate;if((t.childLanes&n)!==n?(t.childLanes|=n,h!==null&&(h.childLanes|=n)):h!==null&&(h.childLanes&n)!==n&&(h.childLanes|=n),t===a)break;t=t.return}}function $c(t,n,a,h){var w=t.child;for(w!==null&&(w.return=t);w!==null;){var E=w.dependencies;if(E!==null){var R=w.child;E=E.firstContext;e:for(;E!==null;){var G=E;E=w;for(var J=0;J<n.length;J++)if(G.context===n[J]){E.lanes|=a,G=E.alternate,G!==null&&(G.lanes|=a),Uc(E.return,a,t),h||(R=null);break e}E=G.next}}else if(w.tag===18){if(R=w.return,R===null)throw Error(s(341));R.lanes|=a,E=R.alternate,E!==null&&(E.lanes|=a),Uc(R,a,t),R=null}else R=w.child;if(R!==null)R.return=w;else for(R=w;R!==null;){if(R===t){R=null;break}if(w=R.sibling,w!==null){w.return=R.return,R=w;break}R=R.return}w=R}}function rs(t,n,a,h){t=null;for(var w=n,E=!1;w!==null;){if(!E){if((w.flags&524288)!==0)E=!0;else if((w.flags&262144)!==0)break}if(w.tag===10){var R=w.alternate;if(R===null)throw Error(s(387));if(R=R.memoizedProps,R!==null){var G=w.type;Sn(w.pendingProps.value,R.value)||(t!==null?t.push(G):t=[G])}}else if(w===K.current){if(R=w.alternate,R===null)throw Error(s(387));R.memoizedState.memoizedState!==w.memoizedState.memoizedState&&(t!==null?t.push(wa):t=[wa])}w=w.return}t!==null&&$c(n,t,a,h),n.flags|=262144}function So(t){for(t=t.firstContext;t!==null;){if(!Sn(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function gi(t){mi=t,fr=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function en(t){return dp(mi,t)}function wo(t,n){return mi===null&&gi(t),dp(t,n)}function dp(t,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},fr===null){if(t===null)throw Error(s(308));fr=n,t.dependencies={lanes:0,firstContext:n},t.flags|=524288}else fr=fr.next=n;return a}var h_=typeof AbortController<"u"?AbortController:function(){var t=[],n=this.signal={aborted:!1,addEventListener:function(a,h){t.push(h)}};this.abort=function(){n.aborted=!0,t.forEach(function(a){return a()})}},f_=e.unstable_scheduleCallback,p_=e.unstable_NormalPriority,Ot={$$typeof:S,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function qc(){return{controller:new h_,data:new Map,refCount:0}}function Zs(t){t.refCount--,t.refCount===0&&f_(p_,function(){t.controller.abort()})}var Qs=null,Wc=0,is=0,ss=null;function m_(t,n){if(Qs===null){var a=Qs=[];Wc=0,is=Yu(),ss={status:"pending",value:void 0,then:function(h){a.push(h)}}}return Wc++,n.then(hp,hp),n}function hp(){if(--Wc===0&&Qs!==null){ss!==null&&(ss.status="fulfilled");var t=Qs;Qs=null,is=0,ss=null;for(var n=0;n<t.length;n++)(0,t[n])()}}function g_(t,n){var a=[],h={status:"pending",value:null,reason:null,then:function(w){a.push(w)}};return t.then(function(){h.status="fulfilled",h.value=n;for(var w=0;w<a.length;w++)(0,a[w])(n)},function(w){for(h.status="rejected",h.reason=w,w=0;w<a.length;w++)(0,a[w])(void 0)}),h}var fp=z.S;z.S=function(t,n){Xm=Oe(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&m_(t,n),fp!==null&&fp(t,n)};var xi=B(null);function Gc(){var t=xi.current;return t!==null?t:vt.pooledCache}function Co(t,n){n===null?F(xi,xi.current):F(xi,n.pool)}function pp(){var t=Gc();return t===null?null:{parent:Ot._currentValue,pool:t}}var as=Error(s(460)),Vc=Error(s(474)),ko=Error(s(542)),Eo={then:function(){}};function mp(t){return t=t.status,t==="fulfilled"||t==="rejected"}function gp(t,n,a){switch(a=t[a],a===void 0?t.push(n):a!==n&&(n.then(cr,cr),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,vp(t),t;default:if(typeof n.status=="string")n.then(cr,cr);else{if(t=vt,t!==null&&100<t.shellSuspendCounter)throw Error(s(482));t=n,t.status="pending",t.then(function(h){if(n.status==="pending"){var w=n;w.status="fulfilled",w.value=h}},function(h){if(n.status==="pending"){var w=n;w.status="rejected",w.reason=h}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,vp(t),t}throw bi=n,as}}function vi(t){try{var n=t._init;return n(t._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(bi=a,as):a}}var bi=null;function xp(){if(bi===null)throw Error(s(459));var t=bi;return bi=null,t}function vp(t){if(t===as||t===ko)throw Error(s(483))}var os=null,Js=0;function jo(t){var n=Js;return Js+=1,os===null&&(os=[]),gp(os,t,n)}function ea(t,n){n=n.props.ref,t.ref=n!==void 0?n:null}function No(t,n){throw n.$$typeof===y?Error(s(525)):(t=Object.prototype.toString.call(n),Error(s(31,t==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":t)))}function bp(t){function n(ie,te){if(t){var oe=ie.deletions;oe===null?(ie.deletions=[te],ie.flags|=16):oe.push(te)}}function a(ie,te){if(!t)return null;for(;te!==null;)n(ie,te),te=te.sibling;return null}function h(ie){for(var te=new Map;ie!==null;)ie.key!==null?te.set(ie.key,ie):te.set(ie.index,ie),ie=ie.sibling;return te}function w(ie,te){return ie=dr(ie,te),ie.index=0,ie.sibling=null,ie}function E(ie,te,oe){return ie.index=oe,t?(oe=ie.alternate,oe!==null?(oe=oe.index,oe<te?(ie.flags|=67108866,te):oe):(ie.flags|=67108866,te)):(ie.flags|=1048576,te)}function R(ie){return t&&ie.alternate===null&&(ie.flags|=67108866),ie}function G(ie,te,oe,me){return te===null||te.tag!==6?(te=Oc(oe,ie.mode,me),te.return=ie,te):(te=w(te,oe),te.return=ie,te)}function J(ie,te,oe,me){var ze=oe.type;return ze===C?he(ie,te,oe.props.children,me,oe.key):te!==null&&(te.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===T&&vi(ze)===te.type)?(te=w(te,oe.props),ea(te,oe),te.return=ie,te):(te=yo(oe.type,oe.key,oe.props,null,ie.mode,me),ea(te,oe),te.return=ie,te)}function le(ie,te,oe,me){return te===null||te.tag!==4||te.stateNode.containerInfo!==oe.containerInfo||te.stateNode.implementation!==oe.implementation?(te=Bc(oe,ie.mode,me),te.return=ie,te):(te=w(te,oe.children||[]),te.return=ie,te)}function he(ie,te,oe,me,ze){return te===null||te.tag!==7?(te=fi(oe,ie.mode,me,ze),te.return=ie,te):(te=w(te,oe),te.return=ie,te)}function xe(ie,te,oe){if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return te=Oc(""+te,ie.mode,oe),te.return=ie,te;if(typeof te=="object"&&te!==null){switch(te.$$typeof){case _:return oe=yo(te.type,te.key,te.props,null,ie.mode,oe),ea(oe,te),oe.return=ie,oe;case k:return te=Bc(te,ie.mode,oe),te.return=ie,te;case T:return te=vi(te),xe(ie,te,oe)}if(U(te)||Y(te))return te=fi(te,ie.mode,oe,null),te.return=ie,te;if(typeof te.then=="function")return xe(ie,jo(te),oe);if(te.$$typeof===S)return xe(ie,wo(ie,te),oe);No(ie,te)}return null}function ce(ie,te,oe,me){var ze=te!==null?te.key:null;if(typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint")return ze!==null?null:G(ie,te,""+oe,me);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case _:return oe.key===ze?J(ie,te,oe,me):null;case k:return oe.key===ze?le(ie,te,oe,me):null;case T:return oe=vi(oe),ce(ie,te,oe,me)}if(U(oe)||Y(oe))return ze!==null?null:he(ie,te,oe,me,null);if(typeof oe.then=="function")return ce(ie,te,jo(oe),me);if(oe.$$typeof===S)return ce(ie,te,wo(ie,oe),me);No(ie,oe)}return null}function de(ie,te,oe,me,ze){if(typeof me=="string"&&me!==""||typeof me=="number"||typeof me=="bigint")return ie=ie.get(oe)||null,G(te,ie,""+me,ze);if(typeof me=="object"&&me!==null){switch(me.$$typeof){case _:return ie=ie.get(me.key===null?oe:me.key)||null,J(te,ie,me,ze);case k:return ie=ie.get(me.key===null?oe:me.key)||null,le(te,ie,me,ze);case T:return me=vi(me),de(ie,te,oe,me,ze)}if(U(me)||Y(me))return ie=ie.get(oe)||null,he(te,ie,me,ze,null);if(typeof me.then=="function")return de(ie,te,oe,jo(me),ze);if(me.$$typeof===S)return de(ie,te,oe,wo(te,me),ze);No(te,me)}return null}function De(ie,te,oe,me){for(var ze=null,ct=null,Re=te,Xe=te=0,nt=null;Re!==null&&Xe<oe.length;Xe++){Re.index>Xe?(nt=Re,Re=null):nt=Re.sibling;var ut=ce(ie,Re,oe[Xe],me);if(ut===null){Re===null&&(Re=nt);break}t&&Re&&ut.alternate===null&&n(ie,Re),te=E(ut,te,Xe),ct===null?ze=ut:ct.sibling=ut,ct=ut,Re=nt}if(Xe===oe.length)return a(ie,Re),it&&hr(ie,Xe),ze;if(Re===null){for(;Xe<oe.length;Xe++)Re=xe(ie,oe[Xe],me),Re!==null&&(te=E(Re,te,Xe),ct===null?ze=Re:ct.sibling=Re,ct=Re);return it&&hr(ie,Xe),ze}for(Re=h(Re);Xe<oe.length;Xe++)nt=de(Re,ie,Xe,oe[Xe],me),nt!==null&&(t&&nt.alternate!==null&&Re.delete(nt.key===null?Xe:nt.key),te=E(nt,te,Xe),ct===null?ze=nt:ct.sibling=nt,ct=nt);return t&&Re.forEach(function(Jr){return n(ie,Jr)}),it&&hr(ie,Xe),ze}function Pe(ie,te,oe,me){if(oe==null)throw Error(s(151));for(var ze=null,ct=null,Re=te,Xe=te=0,nt=null,ut=oe.next();Re!==null&&!ut.done;Xe++,ut=oe.next()){Re.index>Xe?(nt=Re,Re=null):nt=Re.sibling;var Jr=ce(ie,Re,ut.value,me);if(Jr===null){Re===null&&(Re=nt);break}t&&Re&&Jr.alternate===null&&n(ie,Re),te=E(Jr,te,Xe),ct===null?ze=Jr:ct.sibling=Jr,ct=Jr,Re=nt}if(ut.done)return a(ie,Re),it&&hr(ie,Xe),ze;if(Re===null){for(;!ut.done;Xe++,ut=oe.next())ut=xe(ie,ut.value,me),ut!==null&&(te=E(ut,te,Xe),ct===null?ze=ut:ct.sibling=ut,ct=ut);return it&&hr(ie,Xe),ze}for(Re=h(Re);!ut.done;Xe++,ut=oe.next())ut=de(Re,ie,Xe,ut.value,me),ut!==null&&(t&&ut.alternate!==null&&Re.delete(ut.key===null?Xe:ut.key),te=E(ut,te,Xe),ct===null?ze=ut:ct.sibling=ut,ct=ut);return t&&Re.forEach(function(j1){return n(ie,j1)}),it&&hr(ie,Xe),ze}function xt(ie,te,oe,me){if(typeof oe=="object"&&oe!==null&&oe.type===C&&oe.key===null&&(oe=oe.props.children),typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case _:e:{for(var ze=oe.key;te!==null;){if(te.key===ze){if(ze=oe.type,ze===C){if(te.tag===7){a(ie,te.sibling),me=w(te,oe.props.children),me.return=ie,ie=me;break e}}else if(te.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===T&&vi(ze)===te.type){a(ie,te.sibling),me=w(te,oe.props),ea(me,oe),me.return=ie,ie=me;break e}a(ie,te);break}else n(ie,te);te=te.sibling}oe.type===C?(me=fi(oe.props.children,ie.mode,me,oe.key),me.return=ie,ie=me):(me=yo(oe.type,oe.key,oe.props,null,ie.mode,me),ea(me,oe),me.return=ie,ie=me)}return R(ie);case k:e:{for(ze=oe.key;te!==null;){if(te.key===ze)if(te.tag===4&&te.stateNode.containerInfo===oe.containerInfo&&te.stateNode.implementation===oe.implementation){a(ie,te.sibling),me=w(te,oe.children||[]),me.return=ie,ie=me;break e}else{a(ie,te);break}else n(ie,te);te=te.sibling}me=Bc(oe,ie.mode,me),me.return=ie,ie=me}return R(ie);case T:return oe=vi(oe),xt(ie,te,oe,me)}if(U(oe))return De(ie,te,oe,me);if(Y(oe)){if(ze=Y(oe),typeof ze!="function")throw Error(s(150));return oe=ze.call(oe),Pe(ie,te,oe,me)}if(typeof oe.then=="function")return xt(ie,te,jo(oe),me);if(oe.$$typeof===S)return xt(ie,te,wo(ie,oe),me);No(ie,oe)}return typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint"?(oe=""+oe,te!==null&&te.tag===6?(a(ie,te.sibling),me=w(te,oe),me.return=ie,ie=me):(a(ie,te),me=Oc(oe,ie.mode,me),me.return=ie,ie=me),R(ie)):a(ie,te)}return function(ie,te,oe,me){try{Js=0;var ze=xt(ie,te,oe,me);return os=null,ze}catch(Re){if(Re===as||Re===ko)throw Re;var ct=wn(29,Re,null,ie.mode);return ct.lanes=me,ct.return=ie,ct}finally{}}}var yi=bp(!0),yp=bp(!1),Br=!1;function Yc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Kc(t,n){t=t.updateQueue,n.updateQueue===t&&(n.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function Ir(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function zr(t,n,a){var h=t.updateQueue;if(h===null)return null;if(h=h.shared,(dt&2)!==0){var w=h.pending;return w===null?n.next=n:(n.next=w.next,w.next=n),h.pending=n,n=bo(t),rp(t,null,a),n}return vo(t,h,n,a),bo(t)}function ta(t,n,a){if(n=n.updateQueue,n!==null&&(n=n.shared,(a&4194048)!==0)){var h=n.lanes;h&=t.pendingLanes,a|=h,n.lanes=a,df(t,a)}}function Xc(t,n){var a=t.updateQueue,h=t.alternate;if(h!==null&&(h=h.updateQueue,a===h)){var w=null,E=null;if(a=a.firstBaseUpdate,a!==null){do{var R={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};E===null?w=E=R:E=E.next=R,a=a.next}while(a!==null);E===null?w=E=n:E=E.next=n}else w=E=n;a={baseState:h.baseState,firstBaseUpdate:w,lastBaseUpdate:E,shared:h.shared,callbacks:h.callbacks},t.updateQueue=a;return}t=a.lastBaseUpdate,t===null?a.firstBaseUpdate=n:t.next=n,a.lastBaseUpdate=n}var Zc=!1;function na(){if(Zc){var t=ss;if(t!==null)throw t}}function ra(t,n,a,h){Zc=!1;var w=t.updateQueue;Br=!1;var E=w.firstBaseUpdate,R=w.lastBaseUpdate,G=w.shared.pending;if(G!==null){w.shared.pending=null;var J=G,le=J.next;J.next=null,R===null?E=le:R.next=le,R=J;var he=t.alternate;he!==null&&(he=he.updateQueue,G=he.lastBaseUpdate,G!==R&&(G===null?he.firstBaseUpdate=le:G.next=le,he.lastBaseUpdate=J))}if(E!==null){var xe=w.baseState;R=0,he=le=J=null,G=E;do{var ce=G.lane&-536870913,de=ce!==G.lane;if(de?(tt&ce)===ce:(h&ce)===ce){ce!==0&&ce===is&&(Zc=!0),he!==null&&(he=he.next={lane:0,tag:G.tag,payload:G.payload,callback:null,next:null});e:{var De=t,Pe=G;ce=n;var xt=a;switch(Pe.tag){case 1:if(De=Pe.payload,typeof De=="function"){xe=De.call(xt,xe,ce);break e}xe=De;break e;case 3:De.flags=De.flags&-65537|128;case 0:if(De=Pe.payload,ce=typeof De=="function"?De.call(xt,xe,ce):De,ce==null)break e;xe=m({},xe,ce);break e;case 2:Br=!0}}ce=G.callback,ce!==null&&(t.flags|=64,de&&(t.flags|=8192),de=w.callbacks,de===null?w.callbacks=[ce]:de.push(ce))}else de={lane:ce,tag:G.tag,payload:G.payload,callback:G.callback,next:null},he===null?(le=he=de,J=xe):he=he.next=de,R|=ce;if(G=G.next,G===null){if(G=w.shared.pending,G===null)break;de=G,G=de.next,de.next=null,w.lastBaseUpdate=de,w.shared.pending=null}}while(!0);he===null&&(J=xe),w.baseState=J,w.firstBaseUpdate=le,w.lastBaseUpdate=he,E===null&&(w.shared.lanes=0),$r|=R,t.lanes=R,t.memoizedState=xe}}function _p(t,n){if(typeof t!="function")throw Error(s(191,t));t.call(n)}function Sp(t,n){var a=t.callbacks;if(a!==null)for(t.callbacks=null,t=0;t<a.length;t++)_p(a[t],n)}var ls=B(null),To=B(0);function wp(t,n){t=wr,F(To,t),F(ls,n),wr=t|n.baseLanes}function Qc(){F(To,wr),F(ls,ls.current)}function Jc(){wr=To.current,W(ls),W(To)}var Cn=B(null),Fn=null;function Hr(t){var n=t.alternate;F(Nt,Nt.current&1),F(Cn,t),Fn===null&&(n===null||ls.current!==null||n.memoizedState!==null)&&(Fn=t)}function eu(t){F(Nt,Nt.current),F(Cn,t),Fn===null&&(Fn=t)}function Cp(t){t.tag===22?(F(Nt,Nt.current),F(Cn,t),Fn===null&&(Fn=t)):Pr()}function Pr(){F(Nt,Nt.current),F(Cn,Cn.current)}function kn(t){W(Cn),Fn===t&&(Fn=null),W(Nt)}var Nt=B(0);function Ao(t){for(var n=t;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||ad(a)||od(a)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var mr=0,Ke=null,mt=null,Bt=null,Do=!1,cs=!1,_i=!1,Lo=0,ia=0,us=null,x_=0;function Et(){throw Error(s(321))}function tu(t,n){if(n===null)return!1;for(var a=0;a<n.length&&a<t.length;a++)if(!Sn(t[a],n[a]))return!1;return!0}function nu(t,n,a,h,w,E){return mr=E,Ke=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,z.H=t===null||t.memoizedState===null?om:xu,_i=!1,E=a(h,w),_i=!1,cs&&(E=Ep(n,a,h,w)),kp(t),E}function kp(t){z.H=oa;var n=mt!==null&&mt.next!==null;if(mr=0,Bt=mt=Ke=null,Do=!1,ia=0,us=null,n)throw Error(s(300));t===null||It||(t=t.dependencies,t!==null&&So(t)&&(It=!0))}function Ep(t,n,a,h){Ke=t;var w=0;do{if(cs&&(us=null),ia=0,cs=!1,25<=w)throw Error(s(301));if(w+=1,Bt=mt=null,t.updateQueue!=null){var E=t.updateQueue;E.lastEffect=null,E.events=null,E.stores=null,E.memoCache!=null&&(E.memoCache.index=0)}z.H=lm,E=n(a,h)}while(cs);return E}function v_(){var t=z.H,n=t.useState()[0];return n=typeof n.then=="function"?sa(n):n,t=t.useState()[0],(mt!==null?mt.memoizedState:null)!==t&&(Ke.flags|=1024),n}function ru(){var t=Lo!==0;return Lo=0,t}function iu(t,n,a){n.updateQueue=t.updateQueue,n.flags&=-2053,t.lanes&=~a}function su(t){if(Do){for(t=t.memoizedState;t!==null;){var n=t.queue;n!==null&&(n.pending=null),t=t.next}Do=!1}mr=0,Bt=mt=Ke=null,cs=!1,ia=Lo=0,us=null}function un(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Bt===null?Ke.memoizedState=Bt=t:Bt=Bt.next=t,Bt}function Tt(){if(mt===null){var t=Ke.alternate;t=t!==null?t.memoizedState:null}else t=mt.next;var n=Bt===null?Ke.memoizedState:Bt.next;if(n!==null)Bt=n,mt=t;else{if(t===null)throw Ke.alternate===null?Error(s(467)):Error(s(310));mt=t,t={memoizedState:mt.memoizedState,baseState:mt.baseState,baseQueue:mt.baseQueue,queue:mt.queue,next:null},Bt===null?Ke.memoizedState=Bt=t:Bt=Bt.next=t}return Bt}function Ro(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function sa(t){var n=ia;return ia+=1,us===null&&(us=[]),t=gp(us,t,n),n=Ke,(Bt===null?n.memoizedState:Bt.next)===null&&(n=n.alternate,z.H=n===null||n.memoizedState===null?om:xu),t}function Mo(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return sa(t);if(t.$$typeof===S)return en(t)}throw Error(s(438,String(t)))}function au(t){var n=null,a=Ke.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var h=Ke.alternate;h!==null&&(h=h.updateQueue,h!==null&&(h=h.memoCache,h!=null&&(n={data:h.data.map(function(w){return w.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),a===null&&(a=Ro(),Ke.updateQueue=a),a.memoCache=n,a=n.data[n.index],a===void 0)for(a=n.data[n.index]=Array(t),h=0;h<t;h++)a[h]=H;return n.index++,a}function gr(t,n){return typeof n=="function"?n(t):n}function Oo(t){var n=Tt();return ou(n,mt,t)}function ou(t,n,a){var h=t.queue;if(h===null)throw Error(s(311));h.lastRenderedReducer=a;var w=t.baseQueue,E=h.pending;if(E!==null){if(w!==null){var R=w.next;w.next=E.next,E.next=R}n.baseQueue=w=E,h.pending=null}if(E=t.baseState,w===null)t.memoizedState=E;else{n=w.next;var G=R=null,J=null,le=n,he=!1;do{var xe=le.lane&-536870913;if(xe!==le.lane?(tt&xe)===xe:(mr&xe)===xe){var ce=le.revertLane;if(ce===0)J!==null&&(J=J.next={lane:0,revertLane:0,gesture:null,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null}),xe===is&&(he=!0);else if((mr&ce)===ce){le=le.next,ce===is&&(he=!0);continue}else xe={lane:0,revertLane:le.revertLane,gesture:null,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null},J===null?(G=J=xe,R=E):J=J.next=xe,Ke.lanes|=ce,$r|=ce;xe=le.action,_i&&a(E,xe),E=le.hasEagerState?le.eagerState:a(E,xe)}else ce={lane:xe,revertLane:le.revertLane,gesture:le.gesture,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null},J===null?(G=J=ce,R=E):J=J.next=ce,Ke.lanes|=xe,$r|=xe;le=le.next}while(le!==null&&le!==n);if(J===null?R=E:J.next=G,!Sn(E,t.memoizedState)&&(It=!0,he&&(a=ss,a!==null)))throw a;t.memoizedState=E,t.baseState=R,t.baseQueue=J,h.lastRenderedState=E}return w===null&&(h.lanes=0),[t.memoizedState,h.dispatch]}function lu(t){var n=Tt(),a=n.queue;if(a===null)throw Error(s(311));a.lastRenderedReducer=t;var h=a.dispatch,w=a.pending,E=n.memoizedState;if(w!==null){a.pending=null;var R=w=w.next;do E=t(E,R.action),R=R.next;while(R!==w);Sn(E,n.memoizedState)||(It=!0),n.memoizedState=E,n.baseQueue===null&&(n.baseState=E),a.lastRenderedState=E}return[E,h]}function jp(t,n,a){var h=Ke,w=Tt(),E=it;if(E){if(a===void 0)throw Error(s(407));a=a()}else a=n();var R=!Sn((mt||w).memoizedState,a);if(R&&(w.memoizedState=a,It=!0),w=w.queue,du(Ap.bind(null,h,w,t),[t]),w.getSnapshot!==n||R||Bt!==null&&Bt.memoizedState.tag&1){if(h.flags|=2048,ds(9,{destroy:void 0},Tp.bind(null,h,w,a,n),null),vt===null)throw Error(s(349));E||(mr&127)!==0||Np(h,n,a)}return a}function Np(t,n,a){t.flags|=16384,t={getSnapshot:n,value:a},n=Ke.updateQueue,n===null?(n=Ro(),Ke.updateQueue=n,n.stores=[t]):(a=n.stores,a===null?n.stores=[t]:a.push(t))}function Tp(t,n,a,h){n.value=a,n.getSnapshot=h,Dp(n)&&Lp(t)}function Ap(t,n,a){return a(function(){Dp(n)&&Lp(t)})}function Dp(t){var n=t.getSnapshot;t=t.value;try{var a=n();return!Sn(t,a)}catch{return!0}}function Lp(t){var n=hi(t,2);n!==null&&bn(n,t,2)}function cu(t){var n=un();if(typeof t=="function"){var a=t;if(t=a(),_i){at(!0);try{a()}finally{at(!1)}}}return n.memoizedState=n.baseState=t,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:gr,lastRenderedState:t},n}function Rp(t,n,a,h){return t.baseState=a,ou(t,mt,typeof h=="function"?h:gr)}function b_(t,n,a,h,w){if(zo(t))throw Error(s(485));if(t=n.action,t!==null){var E={payload:w,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(R){E.listeners.push(R)}};z.T!==null?a(!0):E.isTransition=!1,h(E),a=n.pending,a===null?(E.next=n.pending=E,Mp(n,E)):(E.next=a.next,n.pending=a.next=E)}}function Mp(t,n){var a=n.action,h=n.payload,w=t.state;if(n.isTransition){var E=z.T,R={};z.T=R;try{var G=a(w,h),J=z.S;J!==null&&J(R,G),Op(t,n,G)}catch(le){uu(t,n,le)}finally{E!==null&&R.types!==null&&(E.types=R.types),z.T=E}}else try{E=a(w,h),Op(t,n,E)}catch(le){uu(t,n,le)}}function Op(t,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(h){Bp(t,n,h)},function(h){return uu(t,n,h)}):Bp(t,n,a)}function Bp(t,n,a){n.status="fulfilled",n.value=a,Ip(n),t.state=a,n=t.pending,n!==null&&(a=n.next,a===n?t.pending=null:(a=a.next,n.next=a,Mp(t,a)))}function uu(t,n,a){var h=t.pending;if(t.pending=null,h!==null){h=h.next;do n.status="rejected",n.reason=a,Ip(n),n=n.next;while(n!==h)}t.action=null}function Ip(t){t=t.listeners;for(var n=0;n<t.length;n++)(0,t[n])()}function zp(t,n){return n}function Hp(t,n){if(it){var a=vt.formState;if(a!==null){e:{var h=Ke;if(it){if(_t){t:{for(var w=_t,E=Pn;w.nodeType!==8;){if(!E){w=null;break t}if(w=Un(w.nextSibling),w===null){w=null;break t}}E=w.data,w=E==="F!"||E==="F"?w:null}if(w){_t=Un(w.nextSibling),h=w.data==="F!";break e}}Mr(h)}h=!1}h&&(n=a[0])}}return a=un(),a.memoizedState=a.baseState=n,h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:zp,lastRenderedState:n},a.queue=h,a=im.bind(null,Ke,h),h.dispatch=a,h=cu(!1),E=gu.bind(null,Ke,!1,h.queue),h=un(),w={state:n,dispatch:null,action:t,pending:null},h.queue=w,a=b_.bind(null,Ke,w,E,a),w.dispatch=a,h.memoizedState=t,[n,a,!1]}function Pp(t){var n=Tt();return Fp(n,mt,t)}function Fp(t,n,a){if(n=ou(t,n,zp)[0],t=Oo(gr)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var h=sa(n)}catch(R){throw R===as?ko:R}else h=n;n=Tt();var w=n.queue,E=w.dispatch;return a!==n.memoizedState&&(Ke.flags|=2048,ds(9,{destroy:void 0},y_.bind(null,w,a),null)),[h,E,t]}function y_(t,n){t.action=n}function Up(t){var n=Tt(),a=mt;if(a!==null)return Fp(n,a,t);Tt(),n=n.memoizedState,a=Tt();var h=a.queue.dispatch;return a.memoizedState=t,[n,h,!1]}function ds(t,n,a,h){return t={tag:t,create:a,deps:h,inst:n,next:null},n=Ke.updateQueue,n===null&&(n=Ro(),Ke.updateQueue=n),a=n.lastEffect,a===null?n.lastEffect=t.next=t:(h=a.next,a.next=t,t.next=h,n.lastEffect=t),t}function $p(){return Tt().memoizedState}function Bo(t,n,a,h){var w=un();Ke.flags|=t,w.memoizedState=ds(1|n,{destroy:void 0},a,h===void 0?null:h)}function Io(t,n,a,h){var w=Tt();h=h===void 0?null:h;var E=w.memoizedState.inst;mt!==null&&h!==null&&tu(h,mt.memoizedState.deps)?w.memoizedState=ds(n,E,a,h):(Ke.flags|=t,w.memoizedState=ds(1|n,E,a,h))}function qp(t,n){Bo(8390656,8,t,n)}function du(t,n){Io(2048,8,t,n)}function __(t){Ke.flags|=4;var n=Ke.updateQueue;if(n===null)n=Ro(),Ke.updateQueue=n,n.events=[t];else{var a=n.events;a===null?n.events=[t]:a.push(t)}}function Wp(t){var n=Tt().memoizedState;return __({ref:n,nextImpl:t}),function(){if((dt&2)!==0)throw Error(s(440));return n.impl.apply(void 0,arguments)}}function Gp(t,n){return Io(4,2,t,n)}function Vp(t,n){return Io(4,4,t,n)}function Yp(t,n){if(typeof n=="function"){t=t();var a=n(t);return function(){typeof a=="function"?a():n(null)}}if(n!=null)return t=t(),n.current=t,function(){n.current=null}}function Kp(t,n,a){a=a!=null?a.concat([t]):null,Io(4,4,Yp.bind(null,n,t),a)}function hu(){}function Xp(t,n){var a=Tt();n=n===void 0?null:n;var h=a.memoizedState;return n!==null&&tu(n,h[1])?h[0]:(a.memoizedState=[t,n],t)}function Zp(t,n){var a=Tt();n=n===void 0?null:n;var h=a.memoizedState;if(n!==null&&tu(n,h[1]))return h[0];if(h=t(),_i){at(!0);try{t()}finally{at(!1)}}return a.memoizedState=[h,n],h}function fu(t,n,a){return a===void 0||(mr&1073741824)!==0&&(tt&261930)===0?t.memoizedState=n:(t.memoizedState=a,t=Qm(),Ke.lanes|=t,$r|=t,a)}function Qp(t,n,a,h){return Sn(a,n)?a:ls.current!==null?(t=fu(t,a,h),Sn(t,n)||(It=!0),t):(mr&42)===0||(mr&1073741824)!==0&&(tt&261930)===0?(It=!0,t.memoizedState=a):(t=Qm(),Ke.lanes|=t,$r|=t,n)}function Jp(t,n,a,h,w){var E=X.p;X.p=E!==0&&8>E?E:8;var R=z.T,G={};z.T=G,gu(t,!1,n,a);try{var J=w(),le=z.S;if(le!==null&&le(G,J),J!==null&&typeof J=="object"&&typeof J.then=="function"){var he=g_(J,h);aa(t,n,he,Nn(t))}else aa(t,n,h,Nn(t))}catch(xe){aa(t,n,{then:function(){},status:"rejected",reason:xe},Nn())}finally{X.p=E,R!==null&&G.types!==null&&(R.types=G.types),z.T=R}}function S_(){}function pu(t,n,a,h){if(t.tag!==5)throw Error(s(476));var w=em(t).queue;Jp(t,w,n,Q,a===null?S_:function(){return tm(t),a(h)})}function em(t){var n=t.memoizedState;if(n!==null)return n;n={memoizedState:Q,baseState:Q,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:gr,lastRenderedState:Q},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:gr,lastRenderedState:a},next:null},t.memoizedState=n,t=t.alternate,t!==null&&(t.memoizedState=n),n}function tm(t){var n=em(t);n.next===null&&(n=t.alternate.memoizedState),aa(t,n.next.queue,{},Nn())}function mu(){return en(wa)}function nm(){return Tt().memoizedState}function rm(){return Tt().memoizedState}function w_(t){for(var n=t.return;n!==null;){switch(n.tag){case 24:case 3:var a=Nn();t=Ir(a);var h=zr(n,t,a);h!==null&&(bn(h,n,a),ta(h,n,a)),n={cache:qc()},t.payload=n;return}n=n.return}}function C_(t,n,a){var h=Nn();a={lane:h,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},zo(t)?sm(n,a):(a=Rc(t,n,a,h),a!==null&&(bn(a,t,h),am(a,n,h)))}function im(t,n,a){var h=Nn();aa(t,n,a,h)}function aa(t,n,a,h){var w={lane:h,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(zo(t))sm(n,w);else{var E=t.alternate;if(t.lanes===0&&(E===null||E.lanes===0)&&(E=n.lastRenderedReducer,E!==null))try{var R=n.lastRenderedState,G=E(R,a);if(w.hasEagerState=!0,w.eagerState=G,Sn(G,R))return vo(t,n,w,0),vt===null&&xo(),!1}catch{}finally{}if(a=Rc(t,n,w,h),a!==null)return bn(a,t,h),am(a,n,h),!0}return!1}function gu(t,n,a,h){if(h={lane:2,revertLane:Yu(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},zo(t)){if(n)throw Error(s(479))}else n=Rc(t,a,h,2),n!==null&&bn(n,t,2)}function zo(t){var n=t.alternate;return t===Ke||n!==null&&n===Ke}function sm(t,n){cs=Do=!0;var a=t.pending;a===null?n.next=n:(n.next=a.next,a.next=n),t.pending=n}function am(t,n,a){if((a&4194048)!==0){var h=n.lanes;h&=t.pendingLanes,a|=h,n.lanes=a,df(t,a)}}var oa={readContext:en,use:Mo,useCallback:Et,useContext:Et,useEffect:Et,useImperativeHandle:Et,useLayoutEffect:Et,useInsertionEffect:Et,useMemo:Et,useReducer:Et,useRef:Et,useState:Et,useDebugValue:Et,useDeferredValue:Et,useTransition:Et,useSyncExternalStore:Et,useId:Et,useHostTransitionStatus:Et,useFormState:Et,useActionState:Et,useOptimistic:Et,useMemoCache:Et,useCacheRefresh:Et};oa.useEffectEvent=Et;var om={readContext:en,use:Mo,useCallback:function(t,n){return un().memoizedState=[t,n===void 0?null:n],t},useContext:en,useEffect:qp,useImperativeHandle:function(t,n,a){a=a!=null?a.concat([t]):null,Bo(4194308,4,Yp.bind(null,n,t),a)},useLayoutEffect:function(t,n){return Bo(4194308,4,t,n)},useInsertionEffect:function(t,n){Bo(4,2,t,n)},useMemo:function(t,n){var a=un();n=n===void 0?null:n;var h=t();if(_i){at(!0);try{t()}finally{at(!1)}}return a.memoizedState=[h,n],h},useReducer:function(t,n,a){var h=un();if(a!==void 0){var w=a(n);if(_i){at(!0);try{a(n)}finally{at(!1)}}}else w=n;return h.memoizedState=h.baseState=w,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:w},h.queue=t,t=t.dispatch=C_.bind(null,Ke,t),[h.memoizedState,t]},useRef:function(t){var n=un();return t={current:t},n.memoizedState=t},useState:function(t){t=cu(t);var n=t.queue,a=im.bind(null,Ke,n);return n.dispatch=a,[t.memoizedState,a]},useDebugValue:hu,useDeferredValue:function(t,n){var a=un();return fu(a,t,n)},useTransition:function(){var t=cu(!1);return t=Jp.bind(null,Ke,t.queue,!0,!1),un().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,n,a){var h=Ke,w=un();if(it){if(a===void 0)throw Error(s(407));a=a()}else{if(a=n(),vt===null)throw Error(s(349));(tt&127)!==0||Np(h,n,a)}w.memoizedState=a;var E={value:a,getSnapshot:n};return w.queue=E,qp(Ap.bind(null,h,E,t),[t]),h.flags|=2048,ds(9,{destroy:void 0},Tp.bind(null,h,E,a,n),null),a},useId:function(){var t=un(),n=vt.identifierPrefix;if(it){var a=Qn,h=Zn;a=(h&~(1<<32-qe(h)-1)).toString(32)+a,n="_"+n+"R_"+a,a=Lo++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=x_++,n="_"+n+"r_"+a.toString(32)+"_";return t.memoizedState=n},useHostTransitionStatus:mu,useFormState:Hp,useActionState:Hp,useOptimistic:function(t){var n=un();n.memoizedState=n.baseState=t;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=gu.bind(null,Ke,!0,a),a.dispatch=n,[t,n]},useMemoCache:au,useCacheRefresh:function(){return un().memoizedState=w_.bind(null,Ke)},useEffectEvent:function(t){var n=un(),a={impl:t};return n.memoizedState=a,function(){if((dt&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}},xu={readContext:en,use:Mo,useCallback:Xp,useContext:en,useEffect:du,useImperativeHandle:Kp,useInsertionEffect:Gp,useLayoutEffect:Vp,useMemo:Zp,useReducer:Oo,useRef:$p,useState:function(){return Oo(gr)},useDebugValue:hu,useDeferredValue:function(t,n){var a=Tt();return Qp(a,mt.memoizedState,t,n)},useTransition:function(){var t=Oo(gr)[0],n=Tt().memoizedState;return[typeof t=="boolean"?t:sa(t),n]},useSyncExternalStore:jp,useId:nm,useHostTransitionStatus:mu,useFormState:Pp,useActionState:Pp,useOptimistic:function(t,n){var a=Tt();return Rp(a,mt,t,n)},useMemoCache:au,useCacheRefresh:rm};xu.useEffectEvent=Wp;var lm={readContext:en,use:Mo,useCallback:Xp,useContext:en,useEffect:du,useImperativeHandle:Kp,useInsertionEffect:Gp,useLayoutEffect:Vp,useMemo:Zp,useReducer:lu,useRef:$p,useState:function(){return lu(gr)},useDebugValue:hu,useDeferredValue:function(t,n){var a=Tt();return mt===null?fu(a,t,n):Qp(a,mt.memoizedState,t,n)},useTransition:function(){var t=lu(gr)[0],n=Tt().memoizedState;return[typeof t=="boolean"?t:sa(t),n]},useSyncExternalStore:jp,useId:nm,useHostTransitionStatus:mu,useFormState:Up,useActionState:Up,useOptimistic:function(t,n){var a=Tt();return mt!==null?Rp(a,mt,t,n):(a.baseState=t,[t,a.queue.dispatch])},useMemoCache:au,useCacheRefresh:rm};lm.useEffectEvent=Wp;function vu(t,n,a,h){n=t.memoizedState,a=a(h,n),a=a==null?n:m({},n,a),t.memoizedState=a,t.lanes===0&&(t.updateQueue.baseState=a)}var bu={enqueueSetState:function(t,n,a){t=t._reactInternals;var h=Nn(),w=Ir(h);w.payload=n,a!=null&&(w.callback=a),n=zr(t,w,h),n!==null&&(bn(n,t,h),ta(n,t,h))},enqueueReplaceState:function(t,n,a){t=t._reactInternals;var h=Nn(),w=Ir(h);w.tag=1,w.payload=n,a!=null&&(w.callback=a),n=zr(t,w,h),n!==null&&(bn(n,t,h),ta(n,t,h))},enqueueForceUpdate:function(t,n){t=t._reactInternals;var a=Nn(),h=Ir(a);h.tag=2,n!=null&&(h.callback=n),n=zr(t,h,a),n!==null&&(bn(n,t,a),ta(n,t,a))}};function cm(t,n,a,h,w,E,R){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(h,E,R):n.prototype&&n.prototype.isPureReactComponent?!Vs(a,h)||!Vs(w,E):!0}function um(t,n,a,h){t=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(a,h),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(a,h),n.state!==t&&bu.enqueueReplaceState(n,n.state,null)}function Si(t,n){var a=n;if("ref"in n){a={};for(var h in n)h!=="ref"&&(a[h]=n[h])}if(t=t.defaultProps){a===n&&(a=m({},a));for(var w in t)a[w]===void 0&&(a[w]=t[w])}return a}function dm(t){go(t)}function hm(t){console.error(t)}function fm(t){go(t)}function Ho(t,n){try{var a=t.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(h){setTimeout(function(){throw h})}}function pm(t,n,a){try{var h=t.onCaughtError;h(a.value,{componentStack:a.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(w){setTimeout(function(){throw w})}}function yu(t,n,a){return a=Ir(a),a.tag=3,a.payload={element:null},a.callback=function(){Ho(t,n)},a}function mm(t){return t=Ir(t),t.tag=3,t}function gm(t,n,a,h){var w=a.type.getDerivedStateFromError;if(typeof w=="function"){var E=h.value;t.payload=function(){return w(E)},t.callback=function(){pm(n,a,h)}}var R=a.stateNode;R!==null&&typeof R.componentDidCatch=="function"&&(t.callback=function(){pm(n,a,h),typeof w!="function"&&(qr===null?qr=new Set([this]):qr.add(this));var G=h.stack;this.componentDidCatch(h.value,{componentStack:G!==null?G:""})})}function k_(t,n,a,h,w){if(a.flags|=32768,h!==null&&typeof h=="object"&&typeof h.then=="function"){if(n=a.alternate,n!==null&&rs(n,a,w,!0),a=Cn.current,a!==null){switch(a.tag){case 31:case 13:return Fn===null?Zo():a.alternate===null&&jt===0&&(jt=3),a.flags&=-257,a.flags|=65536,a.lanes=w,h===Eo?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([h]):n.add(h),Wu(t,h,w)),!1;case 22:return a.flags|=65536,h===Eo?a.flags|=16384:(n=a.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([h])},a.updateQueue=n):(a=n.retryQueue,a===null?n.retryQueue=new Set([h]):a.add(h)),Wu(t,h,w)),!1}throw Error(s(435,a.tag))}return Wu(t,h,w),Zo(),!1}if(it)return n=Cn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=w,h!==Hc&&(t=Error(s(422),{cause:h}),Xs(In(t,a)))):(h!==Hc&&(n=Error(s(423),{cause:h}),Xs(In(n,a))),t=t.current.alternate,t.flags|=65536,w&=-w,t.lanes|=w,h=In(h,a),w=yu(t.stateNode,h,w),Xc(t,w),jt!==4&&(jt=2)),!1;var E=Error(s(520),{cause:h});if(E=In(E,a),ma===null?ma=[E]:ma.push(E),jt!==4&&(jt=2),n===null)return!0;h=In(h,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,t=w&-w,a.lanes|=t,t=yu(a.stateNode,h,t),Xc(a,t),!1;case 1:if(n=a.type,E=a.stateNode,(a.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||E!==null&&typeof E.componentDidCatch=="function"&&(qr===null||!qr.has(E))))return a.flags|=65536,w&=-w,a.lanes|=w,w=mm(w),gm(w,t,a,h),Xc(a,w),!1}a=a.return}while(a!==null);return!1}var _u=Error(s(461)),It=!1;function tn(t,n,a,h){n.child=t===null?yp(n,null,a,h):yi(n,t.child,a,h)}function xm(t,n,a,h,w){a=a.render;var E=n.ref;if("ref"in h){var R={};for(var G in h)G!=="ref"&&(R[G]=h[G])}else R=h;return gi(n),h=nu(t,n,a,R,E,w),G=ru(),t!==null&&!It?(iu(t,n,w),xr(t,n,w)):(it&&G&&Ic(n),n.flags|=1,tn(t,n,h,w),n.child)}function vm(t,n,a,h,w){if(t===null){var E=a.type;return typeof E=="function"&&!Mc(E)&&E.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=E,bm(t,n,E,h,w)):(t=yo(a.type,null,h,n,n.mode,w),t.ref=n.ref,t.return=n,n.child=t)}if(E=t.child,!Tu(t,w)){var R=E.memoizedProps;if(a=a.compare,a=a!==null?a:Vs,a(R,h)&&t.ref===n.ref)return xr(t,n,w)}return n.flags|=1,t=dr(E,h),t.ref=n.ref,t.return=n,n.child=t}function bm(t,n,a,h,w){if(t!==null){var E=t.memoizedProps;if(Vs(E,h)&&t.ref===n.ref)if(It=!1,n.pendingProps=h=E,Tu(t,w))(t.flags&131072)!==0&&(It=!0);else return n.lanes=t.lanes,xr(t,n,w)}return Su(t,n,a,h,w)}function ym(t,n,a,h){var w=h.children,E=t!==null?t.memoizedState:null;if(t===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),h.mode==="hidden"){if((n.flags&128)!==0){if(E=E!==null?E.baseLanes|a:a,t!==null){for(h=n.child=t.child,w=0;h!==null;)w=w|h.lanes|h.childLanes,h=h.sibling;h=w&~E}else h=0,n.child=null;return _m(t,n,E,a,h)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},t!==null&&Co(n,E!==null?E.cachePool:null),E!==null?wp(n,E):Qc(),Cp(n);else return h=n.lanes=536870912,_m(t,n,E!==null?E.baseLanes|a:a,a,h)}else E!==null?(Co(n,E.cachePool),wp(n,E),Pr(),n.memoizedState=null):(t!==null&&Co(n,null),Qc(),Pr());return tn(t,n,w,a),n.child}function la(t,n){return t!==null&&t.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function _m(t,n,a,h,w){var E=Gc();return E=E===null?null:{parent:Ot._currentValue,pool:E},n.memoizedState={baseLanes:a,cachePool:E},t!==null&&Co(n,null),Qc(),Cp(n),t!==null&&rs(t,n,h,!0),n.childLanes=w,null}function Po(t,n){return n=Uo({mode:n.mode,children:n.children},t.mode),n.ref=t.ref,t.child=n,n.return=t,n}function Sm(t,n,a){return yi(n,t.child,null,a),t=Po(n,n.pendingProps),t.flags|=2,kn(n),n.memoizedState=null,t}function E_(t,n,a){var h=n.pendingProps,w=(n.flags&128)!==0;if(n.flags&=-129,t===null){if(it){if(h.mode==="hidden")return t=Po(n,h),n.lanes=536870912,la(null,t);if(eu(n),(t=_t)?(t=Mg(t,Pn),t=t!==null&&t.data==="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:Lr!==null?{id:Zn,overflow:Qn}:null,retryLane:536870912,hydrationErrors:null},a=sp(t),a.return=n,n.child=a,Jt=n,_t=null)):t=null,t===null)throw Mr(n);return n.lanes=536870912,null}return Po(n,h)}var E=t.memoizedState;if(E!==null){var R=E.dehydrated;if(eu(n),w)if(n.flags&256)n.flags&=-257,n=Sm(t,n,a);else if(n.memoizedState!==null)n.child=t.child,n.flags|=128,n=null;else throw Error(s(558));else if(It||rs(t,n,a,!1),w=(a&t.childLanes)!==0,It||w){if(h=vt,h!==null&&(R=hf(h,a),R!==0&&R!==E.retryLane))throw E.retryLane=R,hi(t,R),bn(h,t,R),_u;Zo(),n=Sm(t,n,a)}else t=E.treeContext,_t=Un(R.nextSibling),Jt=n,it=!0,Rr=null,Pn=!1,t!==null&&lp(n,t),n=Po(n,h),n.flags|=4096;return n}return t=dr(t.child,{mode:h.mode,children:h.children}),t.ref=n.ref,n.child=t,t.return=n,t}function Fo(t,n){var a=n.ref;if(a===null)t!==null&&t.ref!==null&&(n.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(s(284));(t===null||t.ref!==a)&&(n.flags|=4194816)}}function Su(t,n,a,h,w){return gi(n),a=nu(t,n,a,h,void 0,w),h=ru(),t!==null&&!It?(iu(t,n,w),xr(t,n,w)):(it&&h&&Ic(n),n.flags|=1,tn(t,n,a,w),n.child)}function wm(t,n,a,h,w,E){return gi(n),n.updateQueue=null,a=Ep(n,h,a,w),kp(t),h=ru(),t!==null&&!It?(iu(t,n,E),xr(t,n,E)):(it&&h&&Ic(n),n.flags|=1,tn(t,n,a,E),n.child)}function Cm(t,n,a,h,w){if(gi(n),n.stateNode===null){var E=Ji,R=a.contextType;typeof R=="object"&&R!==null&&(E=en(R)),E=new a(h,E),n.memoizedState=E.state!==null&&E.state!==void 0?E.state:null,E.updater=bu,n.stateNode=E,E._reactInternals=n,E=n.stateNode,E.props=h,E.state=n.memoizedState,E.refs={},Yc(n),R=a.contextType,E.context=typeof R=="object"&&R!==null?en(R):Ji,E.state=n.memoizedState,R=a.getDerivedStateFromProps,typeof R=="function"&&(vu(n,a,R,h),E.state=n.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof E.getSnapshotBeforeUpdate=="function"||typeof E.UNSAFE_componentWillMount!="function"&&typeof E.componentWillMount!="function"||(R=E.state,typeof E.componentWillMount=="function"&&E.componentWillMount(),typeof E.UNSAFE_componentWillMount=="function"&&E.UNSAFE_componentWillMount(),R!==E.state&&bu.enqueueReplaceState(E,E.state,null),ra(n,h,E,w),na(),E.state=n.memoizedState),typeof E.componentDidMount=="function"&&(n.flags|=4194308),h=!0}else if(t===null){E=n.stateNode;var G=n.memoizedProps,J=Si(a,G);E.props=J;var le=E.context,he=a.contextType;R=Ji,typeof he=="object"&&he!==null&&(R=en(he));var xe=a.getDerivedStateFromProps;he=typeof xe=="function"||typeof E.getSnapshotBeforeUpdate=="function",G=n.pendingProps!==G,he||typeof E.UNSAFE_componentWillReceiveProps!="function"&&typeof E.componentWillReceiveProps!="function"||(G||le!==R)&&um(n,E,h,R),Br=!1;var ce=n.memoizedState;E.state=ce,ra(n,h,E,w),na(),le=n.memoizedState,G||ce!==le||Br?(typeof xe=="function"&&(vu(n,a,xe,h),le=n.memoizedState),(J=Br||cm(n,a,J,h,ce,le,R))?(he||typeof E.UNSAFE_componentWillMount!="function"&&typeof E.componentWillMount!="function"||(typeof E.componentWillMount=="function"&&E.componentWillMount(),typeof E.UNSAFE_componentWillMount=="function"&&E.UNSAFE_componentWillMount()),typeof E.componentDidMount=="function"&&(n.flags|=4194308)):(typeof E.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=h,n.memoizedState=le),E.props=h,E.state=le,E.context=R,h=J):(typeof E.componentDidMount=="function"&&(n.flags|=4194308),h=!1)}else{E=n.stateNode,Kc(t,n),R=n.memoizedProps,he=Si(a,R),E.props=he,xe=n.pendingProps,ce=E.context,le=a.contextType,J=Ji,typeof le=="object"&&le!==null&&(J=en(le)),G=a.getDerivedStateFromProps,(le=typeof G=="function"||typeof E.getSnapshotBeforeUpdate=="function")||typeof E.UNSAFE_componentWillReceiveProps!="function"&&typeof E.componentWillReceiveProps!="function"||(R!==xe||ce!==J)&&um(n,E,h,J),Br=!1,ce=n.memoizedState,E.state=ce,ra(n,h,E,w),na();var de=n.memoizedState;R!==xe||ce!==de||Br||t!==null&&t.dependencies!==null&&So(t.dependencies)?(typeof G=="function"&&(vu(n,a,G,h),de=n.memoizedState),(he=Br||cm(n,a,he,h,ce,de,J)||t!==null&&t.dependencies!==null&&So(t.dependencies))?(le||typeof E.UNSAFE_componentWillUpdate!="function"&&typeof E.componentWillUpdate!="function"||(typeof E.componentWillUpdate=="function"&&E.componentWillUpdate(h,de,J),typeof E.UNSAFE_componentWillUpdate=="function"&&E.UNSAFE_componentWillUpdate(h,de,J)),typeof E.componentDidUpdate=="function"&&(n.flags|=4),typeof E.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof E.componentDidUpdate!="function"||R===t.memoizedProps&&ce===t.memoizedState||(n.flags|=4),typeof E.getSnapshotBeforeUpdate!="function"||R===t.memoizedProps&&ce===t.memoizedState||(n.flags|=1024),n.memoizedProps=h,n.memoizedState=de),E.props=h,E.state=de,E.context=J,h=he):(typeof E.componentDidUpdate!="function"||R===t.memoizedProps&&ce===t.memoizedState||(n.flags|=4),typeof E.getSnapshotBeforeUpdate!="function"||R===t.memoizedProps&&ce===t.memoizedState||(n.flags|=1024),h=!1)}return E=h,Fo(t,n),h=(n.flags&128)!==0,E||h?(E=n.stateNode,a=h&&typeof a.getDerivedStateFromError!="function"?null:E.render(),n.flags|=1,t!==null&&h?(n.child=yi(n,t.child,null,w),n.child=yi(n,null,a,w)):tn(t,n,a,w),n.memoizedState=E.state,t=n.child):t=xr(t,n,w),t}function km(t,n,a,h){return pi(),n.flags|=256,tn(t,n,a,h),n.child}var wu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Cu(t){return{baseLanes:t,cachePool:pp()}}function ku(t,n,a){return t=t!==null?t.childLanes&~a:0,n&&(t|=jn),t}function Em(t,n,a){var h=n.pendingProps,w=!1,E=(n.flags&128)!==0,R;if((R=E)||(R=t!==null&&t.memoizedState===null?!1:(Nt.current&2)!==0),R&&(w=!0,n.flags&=-129),R=(n.flags&32)!==0,n.flags&=-33,t===null){if(it){if(w?Hr(n):Pr(),(t=_t)?(t=Mg(t,Pn),t=t!==null&&t.data!=="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:Lr!==null?{id:Zn,overflow:Qn}:null,retryLane:536870912,hydrationErrors:null},a=sp(t),a.return=n,n.child=a,Jt=n,_t=null)):t=null,t===null)throw Mr(n);return od(t)?n.lanes=32:n.lanes=536870912,null}var G=h.children;return h=h.fallback,w?(Pr(),w=n.mode,G=Uo({mode:"hidden",children:G},w),h=fi(h,w,a,null),G.return=n,h.return=n,G.sibling=h,n.child=G,h=n.child,h.memoizedState=Cu(a),h.childLanes=ku(t,R,a),n.memoizedState=wu,la(null,h)):(Hr(n),Eu(n,G))}var J=t.memoizedState;if(J!==null&&(G=J.dehydrated,G!==null)){if(E)n.flags&256?(Hr(n),n.flags&=-257,n=ju(t,n,a)):n.memoizedState!==null?(Pr(),n.child=t.child,n.flags|=128,n=null):(Pr(),G=h.fallback,w=n.mode,h=Uo({mode:"visible",children:h.children},w),G=fi(G,w,a,null),G.flags|=2,h.return=n,G.return=n,h.sibling=G,n.child=h,yi(n,t.child,null,a),h=n.child,h.memoizedState=Cu(a),h.childLanes=ku(t,R,a),n.memoizedState=wu,n=la(null,h));else if(Hr(n),od(G)){if(R=G.nextSibling&&G.nextSibling.dataset,R)var le=R.dgst;R=le,h=Error(s(419)),h.stack="",h.digest=R,Xs({value:h,source:null,stack:null}),n=ju(t,n,a)}else if(It||rs(t,n,a,!1),R=(a&t.childLanes)!==0,It||R){if(R=vt,R!==null&&(h=hf(R,a),h!==0&&h!==J.retryLane))throw J.retryLane=h,hi(t,h),bn(R,t,h),_u;ad(G)||Zo(),n=ju(t,n,a)}else ad(G)?(n.flags|=192,n.child=t.child,n=null):(t=J.treeContext,_t=Un(G.nextSibling),Jt=n,it=!0,Rr=null,Pn=!1,t!==null&&lp(n,t),n=Eu(n,h.children),n.flags|=4096);return n}return w?(Pr(),G=h.fallback,w=n.mode,J=t.child,le=J.sibling,h=dr(J,{mode:"hidden",children:h.children}),h.subtreeFlags=J.subtreeFlags&65011712,le!==null?G=dr(le,G):(G=fi(G,w,a,null),G.flags|=2),G.return=n,h.return=n,h.sibling=G,n.child=h,la(null,h),h=n.child,G=t.child.memoizedState,G===null?G=Cu(a):(w=G.cachePool,w!==null?(J=Ot._currentValue,w=w.parent!==J?{parent:J,pool:J}:w):w=pp(),G={baseLanes:G.baseLanes|a,cachePool:w}),h.memoizedState=G,h.childLanes=ku(t,R,a),n.memoizedState=wu,la(t.child,h)):(Hr(n),a=t.child,t=a.sibling,a=dr(a,{mode:"visible",children:h.children}),a.return=n,a.sibling=null,t!==null&&(R=n.deletions,R===null?(n.deletions=[t],n.flags|=16):R.push(t)),n.child=a,n.memoizedState=null,a)}function Eu(t,n){return n=Uo({mode:"visible",children:n},t.mode),n.return=t,t.child=n}function Uo(t,n){return t=wn(22,t,null,n),t.lanes=0,t}function ju(t,n,a){return yi(n,t.child,null,a),t=Eu(n,n.pendingProps.children),t.flags|=2,n.memoizedState=null,t}function jm(t,n,a){t.lanes|=n;var h=t.alternate;h!==null&&(h.lanes|=n),Uc(t.return,n,a)}function Nu(t,n,a,h,w,E){var R=t.memoizedState;R===null?t.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:h,tail:a,tailMode:w,treeForkCount:E}:(R.isBackwards=n,R.rendering=null,R.renderingStartTime=0,R.last=h,R.tail=a,R.tailMode=w,R.treeForkCount=E)}function Nm(t,n,a){var h=n.pendingProps,w=h.revealOrder,E=h.tail;h=h.children;var R=Nt.current,G=(R&2)!==0;if(G?(R=R&1|2,n.flags|=128):R&=1,F(Nt,R),tn(t,n,h,a),h=it?Ks:0,!G&&t!==null&&(t.flags&128)!==0)e:for(t=n.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&jm(t,a,n);else if(t.tag===19)jm(t,a,n);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===n)break e;for(;t.sibling===null;){if(t.return===null||t.return===n)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(w){case"forwards":for(a=n.child,w=null;a!==null;)t=a.alternate,t!==null&&Ao(t)===null&&(w=a),a=a.sibling;a=w,a===null?(w=n.child,n.child=null):(w=a.sibling,a.sibling=null),Nu(n,!1,w,a,E,h);break;case"backwards":case"unstable_legacy-backwards":for(a=null,w=n.child,n.child=null;w!==null;){if(t=w.alternate,t!==null&&Ao(t)===null){n.child=w;break}t=w.sibling,w.sibling=a,a=w,w=t}Nu(n,!0,a,null,E,h);break;case"together":Nu(n,!1,null,null,void 0,h);break;default:n.memoizedState=null}return n.child}function xr(t,n,a){if(t!==null&&(n.dependencies=t.dependencies),$r|=n.lanes,(a&n.childLanes)===0)if(t!==null){if(rs(t,n,a,!1),(a&n.childLanes)===0)return null}else return null;if(t!==null&&n.child!==t.child)throw Error(s(153));if(n.child!==null){for(t=n.child,a=dr(t,t.pendingProps),n.child=a,a.return=n;t.sibling!==null;)t=t.sibling,a=a.sibling=dr(t,t.pendingProps),a.return=n;a.sibling=null}return n.child}function Tu(t,n){return(t.lanes&n)!==0?!0:(t=t.dependencies,!!(t!==null&&So(t)))}function j_(t,n,a){switch(n.tag){case 3:$(n,n.stateNode.containerInfo),Or(n,Ot,t.memoizedState.cache),pi();break;case 27:case 5:ne(n);break;case 4:$(n,n.stateNode.containerInfo);break;case 10:Or(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,eu(n),null;break;case 13:var h=n.memoizedState;if(h!==null)return h.dehydrated!==null?(Hr(n),n.flags|=128,null):(a&n.child.childLanes)!==0?Em(t,n,a):(Hr(n),t=xr(t,n,a),t!==null?t.sibling:null);Hr(n);break;case 19:var w=(t.flags&128)!==0;if(h=(a&n.childLanes)!==0,h||(rs(t,n,a,!1),h=(a&n.childLanes)!==0),w){if(h)return Nm(t,n,a);n.flags|=128}if(w=n.memoizedState,w!==null&&(w.rendering=null,w.tail=null,w.lastEffect=null),F(Nt,Nt.current),h)break;return null;case 22:return n.lanes=0,ym(t,n,a,n.pendingProps);case 24:Or(n,Ot,t.memoizedState.cache)}return xr(t,n,a)}function Tm(t,n,a){if(t!==null)if(t.memoizedProps!==n.pendingProps)It=!0;else{if(!Tu(t,a)&&(n.flags&128)===0)return It=!1,j_(t,n,a);It=(t.flags&131072)!==0}else It=!1,it&&(n.flags&1048576)!==0&&op(n,Ks,n.index);switch(n.lanes=0,n.tag){case 16:e:{var h=n.pendingProps;if(t=vi(n.elementType),n.type=t,typeof t=="function")Mc(t)?(h=Si(t,h),n.tag=1,n=Cm(null,n,t,h,a)):(n.tag=0,n=Su(null,n,t,h,a));else{if(t!=null){var w=t.$$typeof;if(w===j){n.tag=11,n=xm(null,n,t,h,a);break e}else if(w===D){n.tag=14,n=vm(null,n,t,h,a);break e}}throw n=O(t)||t,Error(s(306,n,""))}}return n;case 0:return Su(t,n,n.type,n.pendingProps,a);case 1:return h=n.type,w=Si(h,n.pendingProps),Cm(t,n,h,w,a);case 3:e:{if($(n,n.stateNode.containerInfo),t===null)throw Error(s(387));h=n.pendingProps;var E=n.memoizedState;w=E.element,Kc(t,n),ra(n,h,null,a);var R=n.memoizedState;if(h=R.cache,Or(n,Ot,h),h!==E.cache&&$c(n,[Ot],a,!0),na(),h=R.element,E.isDehydrated)if(E={element:h,isDehydrated:!1,cache:R.cache},n.updateQueue.baseState=E,n.memoizedState=E,n.flags&256){n=km(t,n,h,a);break e}else if(h!==w){w=In(Error(s(424)),n),Xs(w),n=km(t,n,h,a);break e}else{switch(t=n.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(_t=Un(t.firstChild),Jt=n,it=!0,Rr=null,Pn=!0,a=yp(n,null,h,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(pi(),h===w){n=xr(t,n,a);break e}tn(t,n,h,a)}n=n.child}return n;case 26:return Fo(t,n),t===null?(a=Pg(n.type,null,n.pendingProps,null))?n.memoizedState=a:it||(a=n.type,t=n.pendingProps,h=il(ee.current).createElement(a),h[Qt]=n,h[fn]=t,nn(h,a,t),Yt(h),n.stateNode=h):n.memoizedState=Pg(n.type,t.memoizedProps,n.pendingProps,t.memoizedState),null;case 27:return ne(n),t===null&&it&&(h=n.stateNode=Ig(n.type,n.pendingProps,ee.current),Jt=n,Pn=!0,w=_t,Yr(n.type)?(ld=w,_t=Un(h.firstChild)):_t=w),tn(t,n,n.pendingProps.children,a),Fo(t,n),t===null&&(n.flags|=4194304),n.child;case 5:return t===null&&it&&((w=h=_t)&&(h=r1(h,n.type,n.pendingProps,Pn),h!==null?(n.stateNode=h,Jt=n,_t=Un(h.firstChild),Pn=!1,w=!0):w=!1),w||Mr(n)),ne(n),w=n.type,E=n.pendingProps,R=t!==null?t.memoizedProps:null,h=E.children,rd(w,E)?h=null:R!==null&&rd(w,R)&&(n.flags|=32),n.memoizedState!==null&&(w=nu(t,n,v_,null,null,a),wa._currentValue=w),Fo(t,n),tn(t,n,h,a),n.child;case 6:return t===null&&it&&((t=a=_t)&&(a=i1(a,n.pendingProps,Pn),a!==null?(n.stateNode=a,Jt=n,_t=null,t=!0):t=!1),t||Mr(n)),null;case 13:return Em(t,n,a);case 4:return $(n,n.stateNode.containerInfo),h=n.pendingProps,t===null?n.child=yi(n,null,h,a):tn(t,n,h,a),n.child;case 11:return xm(t,n,n.type,n.pendingProps,a);case 7:return tn(t,n,n.pendingProps,a),n.child;case 8:return tn(t,n,n.pendingProps.children,a),n.child;case 12:return tn(t,n,n.pendingProps.children,a),n.child;case 10:return h=n.pendingProps,Or(n,n.type,h.value),tn(t,n,h.children,a),n.child;case 9:return w=n.type._context,h=n.pendingProps.children,gi(n),w=en(w),h=h(w),n.flags|=1,tn(t,n,h,a),n.child;case 14:return vm(t,n,n.type,n.pendingProps,a);case 15:return bm(t,n,n.type,n.pendingProps,a);case 19:return Nm(t,n,a);case 31:return E_(t,n,a);case 22:return ym(t,n,a,n.pendingProps);case 24:return gi(n),h=en(Ot),t===null?(w=Gc(),w===null&&(w=vt,E=qc(),w.pooledCache=E,E.refCount++,E!==null&&(w.pooledCacheLanes|=a),w=E),n.memoizedState={parent:h,cache:w},Yc(n),Or(n,Ot,w)):((t.lanes&a)!==0&&(Kc(t,n),ra(n,null,null,a),na()),w=t.memoizedState,E=n.memoizedState,w.parent!==h?(w={parent:h,cache:h},n.memoizedState=w,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=w),Or(n,Ot,h)):(h=E.cache,Or(n,Ot,h),h!==w.cache&&$c(n,[Ot],a,!0))),tn(t,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(s(156,n.tag))}function vr(t){t.flags|=4}function Au(t,n,a,h,w){if((n=(t.mode&32)!==0)&&(n=!1),n){if(t.flags|=16777216,(w&335544128)===w)if(t.stateNode.complete)t.flags|=8192;else if(ng())t.flags|=8192;else throw bi=Eo,Vc}else t.flags&=-16777217}function Am(t,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!Wg(n))if(ng())t.flags|=8192;else throw bi=Eo,Vc}function $o(t,n){n!==null&&(t.flags|=4),t.flags&16384&&(n=t.tag!==22?Mt():536870912,t.lanes|=n,ms|=n)}function ca(t,n){if(!it)switch(t.tailMode){case"hidden":n=t.tail;for(var a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?t.tail=null:a.sibling=null;break;case"collapsed":a=t.tail;for(var h=null;a!==null;)a.alternate!==null&&(h=a),a=a.sibling;h===null?n||t.tail===null?t.tail=null:t.tail.sibling=null:h.sibling=null}}function St(t){var n=t.alternate!==null&&t.alternate.child===t.child,a=0,h=0;if(n)for(var w=t.child;w!==null;)a|=w.lanes|w.childLanes,h|=w.subtreeFlags&65011712,h|=w.flags&65011712,w.return=t,w=w.sibling;else for(w=t.child;w!==null;)a|=w.lanes|w.childLanes,h|=w.subtreeFlags,h|=w.flags,w.return=t,w=w.sibling;return t.subtreeFlags|=h,t.childLanes=a,n}function N_(t,n,a){var h=n.pendingProps;switch(zc(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return St(n),null;case 1:return St(n),null;case 3:return a=n.stateNode,h=null,t!==null&&(h=t.memoizedState.cache),n.memoizedState.cache!==h&&(n.flags|=2048),pr(Ot),ae(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(t===null||t.child===null)&&(ns(n)?vr(n):t===null||t.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,Pc())),St(n),null;case 26:var w=n.type,E=n.memoizedState;return t===null?(vr(n),E!==null?(St(n),Am(n,E)):(St(n),Au(n,w,null,h,a))):E?E!==t.memoizedState?(vr(n),St(n),Am(n,E)):(St(n),n.flags&=-16777217):(t=t.memoizedProps,t!==h&&vr(n),St(n),Au(n,w,t,h,a)),null;case 27:if(ve(n),a=ee.current,w=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==h&&vr(n);else{if(!h){if(n.stateNode===null)throw Error(s(166));return St(n),null}t=re.current,ns(n)?cp(n):(t=Ig(w,h,a),n.stateNode=t,vr(n))}return St(n),null;case 5:if(ve(n),w=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==h&&vr(n);else{if(!h){if(n.stateNode===null)throw Error(s(166));return St(n),null}if(E=re.current,ns(n))cp(n);else{var R=il(ee.current);switch(E){case 1:E=R.createElementNS("http://www.w3.org/2000/svg",w);break;case 2:E=R.createElementNS("http://www.w3.org/1998/Math/MathML",w);break;default:switch(w){case"svg":E=R.createElementNS("http://www.w3.org/2000/svg",w);break;case"math":E=R.createElementNS("http://www.w3.org/1998/Math/MathML",w);break;case"script":E=R.createElement("div"),E.innerHTML="<script><\/script>",E=E.removeChild(E.firstChild);break;case"select":E=typeof h.is=="string"?R.createElement("select",{is:h.is}):R.createElement("select"),h.multiple?E.multiple=!0:h.size&&(E.size=h.size);break;default:E=typeof h.is=="string"?R.createElement(w,{is:h.is}):R.createElement(w)}}E[Qt]=n,E[fn]=h;e:for(R=n.child;R!==null;){if(R.tag===5||R.tag===6)E.appendChild(R.stateNode);else if(R.tag!==4&&R.tag!==27&&R.child!==null){R.child.return=R,R=R.child;continue}if(R===n)break e;for(;R.sibling===null;){if(R.return===null||R.return===n)break e;R=R.return}R.sibling.return=R.return,R=R.sibling}n.stateNode=E;e:switch(nn(E,w,h),w){case"button":case"input":case"select":case"textarea":h=!!h.autoFocus;break e;case"img":h=!0;break e;default:h=!1}h&&vr(n)}}return St(n),Au(n,n.type,t===null?null:t.memoizedProps,n.pendingProps,a),null;case 6:if(t&&n.stateNode!=null)t.memoizedProps!==h&&vr(n);else{if(typeof h!="string"&&n.stateNode===null)throw Error(s(166));if(t=ee.current,ns(n)){if(t=n.stateNode,a=n.memoizedProps,h=null,w=Jt,w!==null)switch(w.tag){case 27:case 5:h=w.memoizedProps}t[Qt]=n,t=!!(t.nodeValue===a||h!==null&&h.suppressHydrationWarning===!0||Eg(t.nodeValue,a)),t||Mr(n,!0)}else t=il(t).createTextNode(h),t[Qt]=n,n.stateNode=t}return St(n),null;case 31:if(a=n.memoizedState,t===null||t.memoizedState!==null){if(h=ns(n),a!==null){if(t===null){if(!h)throw Error(s(318));if(t=n.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(557));t[Qt]=n}else pi(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;St(n),t=!1}else a=Pc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=a),t=!0;if(!t)return n.flags&256?(kn(n),n):(kn(n),null);if((n.flags&128)!==0)throw Error(s(558))}return St(n),null;case 13:if(h=n.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(w=ns(n),h!==null&&h.dehydrated!==null){if(t===null){if(!w)throw Error(s(318));if(w=n.memoizedState,w=w!==null?w.dehydrated:null,!w)throw Error(s(317));w[Qt]=n}else pi(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;St(n),w=!1}else w=Pc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=w),w=!0;if(!w)return n.flags&256?(kn(n),n):(kn(n),null)}return kn(n),(n.flags&128)!==0?(n.lanes=a,n):(a=h!==null,t=t!==null&&t.memoizedState!==null,a&&(h=n.child,w=null,h.alternate!==null&&h.alternate.memoizedState!==null&&h.alternate.memoizedState.cachePool!==null&&(w=h.alternate.memoizedState.cachePool.pool),E=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(E=h.memoizedState.cachePool.pool),E!==w&&(h.flags|=2048)),a!==t&&a&&(n.child.flags|=8192),$o(n,n.updateQueue),St(n),null);case 4:return ae(),t===null&&Qu(n.stateNode.containerInfo),St(n),null;case 10:return pr(n.type),St(n),null;case 19:if(W(Nt),h=n.memoizedState,h===null)return St(n),null;if(w=(n.flags&128)!==0,E=h.rendering,E===null)if(w)ca(h,!1);else{if(jt!==0||t!==null&&(t.flags&128)!==0)for(t=n.child;t!==null;){if(E=Ao(t),E!==null){for(n.flags|=128,ca(h,!1),t=E.updateQueue,n.updateQueue=t,$o(n,t),n.subtreeFlags=0,t=a,a=n.child;a!==null;)ip(a,t),a=a.sibling;return F(Nt,Nt.current&1|2),it&&hr(n,h.treeForkCount),n.child}t=t.sibling}h.tail!==null&&Oe()>Yo&&(n.flags|=128,w=!0,ca(h,!1),n.lanes=4194304)}else{if(!w)if(t=Ao(E),t!==null){if(n.flags|=128,w=!0,t=t.updateQueue,n.updateQueue=t,$o(n,t),ca(h,!0),h.tail===null&&h.tailMode==="hidden"&&!E.alternate&&!it)return St(n),null}else 2*Oe()-h.renderingStartTime>Yo&&a!==536870912&&(n.flags|=128,w=!0,ca(h,!1),n.lanes=4194304);h.isBackwards?(E.sibling=n.child,n.child=E):(t=h.last,t!==null?t.sibling=E:n.child=E,h.last=E)}return h.tail!==null?(t=h.tail,h.rendering=t,h.tail=t.sibling,h.renderingStartTime=Oe(),t.sibling=null,a=Nt.current,F(Nt,w?a&1|2:a&1),it&&hr(n,h.treeForkCount),t):(St(n),null);case 22:case 23:return kn(n),Jc(),h=n.memoizedState!==null,t!==null?t.memoizedState!==null!==h&&(n.flags|=8192):h&&(n.flags|=8192),h?(a&536870912)!==0&&(n.flags&128)===0&&(St(n),n.subtreeFlags&6&&(n.flags|=8192)):St(n),a=n.updateQueue,a!==null&&$o(n,a.retryQueue),a=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),h=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(h=n.memoizedState.cachePool.pool),h!==a&&(n.flags|=2048),t!==null&&W(xi),null;case 24:return a=null,t!==null&&(a=t.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),pr(Ot),St(n),null;case 25:return null;case 30:return null}throw Error(s(156,n.tag))}function T_(t,n){switch(zc(n),n.tag){case 1:return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 3:return pr(Ot),ae(),t=n.flags,(t&65536)!==0&&(t&128)===0?(n.flags=t&-65537|128,n):null;case 26:case 27:case 5:return ve(n),null;case 31:if(n.memoizedState!==null){if(kn(n),n.alternate===null)throw Error(s(340));pi()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 13:if(kn(n),t=n.memoizedState,t!==null&&t.dehydrated!==null){if(n.alternate===null)throw Error(s(340));pi()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 19:return W(Nt),null;case 4:return ae(),null;case 10:return pr(n.type),null;case 22:case 23:return kn(n),Jc(),t!==null&&W(xi),t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 24:return pr(Ot),null;case 25:return null;default:return null}}function Dm(t,n){switch(zc(n),n.tag){case 3:pr(Ot),ae();break;case 26:case 27:case 5:ve(n);break;case 4:ae();break;case 31:n.memoizedState!==null&&kn(n);break;case 13:kn(n);break;case 19:W(Nt);break;case 10:pr(n.type);break;case 22:case 23:kn(n),Jc(),t!==null&&W(xi);break;case 24:pr(Ot)}}function ua(t,n){try{var a=n.updateQueue,h=a!==null?a.lastEffect:null;if(h!==null){var w=h.next;a=w;do{if((a.tag&t)===t){h=void 0;var E=a.create,R=a.inst;h=E(),R.destroy=h}a=a.next}while(a!==w)}}catch(G){ft(n,n.return,G)}}function Fr(t,n,a){try{var h=n.updateQueue,w=h!==null?h.lastEffect:null;if(w!==null){var E=w.next;h=E;do{if((h.tag&t)===t){var R=h.inst,G=R.destroy;if(G!==void 0){R.destroy=void 0,w=n;var J=a,le=G;try{le()}catch(he){ft(w,J,he)}}}h=h.next}while(h!==E)}}catch(he){ft(n,n.return,he)}}function Lm(t){var n=t.updateQueue;if(n!==null){var a=t.stateNode;try{Sp(n,a)}catch(h){ft(t,t.return,h)}}}function Rm(t,n,a){a.props=Si(t.type,t.memoizedProps),a.state=t.memoizedState;try{a.componentWillUnmount()}catch(h){ft(t,n,h)}}function da(t,n){try{var a=t.ref;if(a!==null){switch(t.tag){case 26:case 27:case 5:var h=t.stateNode;break;case 30:h=t.stateNode;break;default:h=t.stateNode}typeof a=="function"?t.refCleanup=a(h):a.current=h}}catch(w){ft(t,n,w)}}function Jn(t,n){var a=t.ref,h=t.refCleanup;if(a!==null)if(typeof h=="function")try{h()}catch(w){ft(t,n,w)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(w){ft(t,n,w)}else a.current=null}function Mm(t){var n=t.type,a=t.memoizedProps,h=t.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":a.autoFocus&&h.focus();break e;case"img":a.src?h.src=a.src:a.srcSet&&(h.srcset=a.srcSet)}}catch(w){ft(t,t.return,w)}}function Du(t,n,a){try{var h=t.stateNode;Z_(h,t.type,a,n),h[fn]=n}catch(w){ft(t,t.return,w)}}function Om(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&Yr(t.type)||t.tag===4}function Lu(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Om(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&Yr(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Ru(t,n,a){var h=t.tag;if(h===5||h===6)t=t.stateNode,n?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(t,n):(n=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,n.appendChild(t),a=a._reactRootContainer,a!=null||n.onclick!==null||(n.onclick=cr));else if(h!==4&&(h===27&&Yr(t.type)&&(a=t.stateNode,n=null),t=t.child,t!==null))for(Ru(t,n,a),t=t.sibling;t!==null;)Ru(t,n,a),t=t.sibling}function qo(t,n,a){var h=t.tag;if(h===5||h===6)t=t.stateNode,n?a.insertBefore(t,n):a.appendChild(t);else if(h!==4&&(h===27&&Yr(t.type)&&(a=t.stateNode),t=t.child,t!==null))for(qo(t,n,a),t=t.sibling;t!==null;)qo(t,n,a),t=t.sibling}function Bm(t){var n=t.stateNode,a=t.memoizedProps;try{for(var h=t.type,w=n.attributes;w.length;)n.removeAttributeNode(w[0]);nn(n,h,a),n[Qt]=t,n[fn]=a}catch(E){ft(t,t.return,E)}}var br=!1,zt=!1,Mu=!1,Im=typeof WeakSet=="function"?WeakSet:Set,Kt=null;function A_(t,n){if(t=t.containerInfo,td=dl,t=Kf(t),jc(t)){if("selectionStart"in t)var a={start:t.selectionStart,end:t.selectionEnd};else e:{a=(a=t.ownerDocument)&&a.defaultView||window;var h=a.getSelection&&a.getSelection();if(h&&h.rangeCount!==0){a=h.anchorNode;var w=h.anchorOffset,E=h.focusNode;h=h.focusOffset;try{a.nodeType,E.nodeType}catch{a=null;break e}var R=0,G=-1,J=-1,le=0,he=0,xe=t,ce=null;t:for(;;){for(var de;xe!==a||w!==0&&xe.nodeType!==3||(G=R+w),xe!==E||h!==0&&xe.nodeType!==3||(J=R+h),xe.nodeType===3&&(R+=xe.nodeValue.length),(de=xe.firstChild)!==null;)ce=xe,xe=de;for(;;){if(xe===t)break t;if(ce===a&&++le===w&&(G=R),ce===E&&++he===h&&(J=R),(de=xe.nextSibling)!==null)break;xe=ce,ce=xe.parentNode}xe=de}a=G===-1||J===-1?null:{start:G,end:J}}else a=null}a=a||{start:0,end:0}}else a=null;for(nd={focusedElem:t,selectionRange:a},dl=!1,Kt=n;Kt!==null;)if(n=Kt,t=n.child,(n.subtreeFlags&1028)!==0&&t!==null)t.return=n,Kt=t;else for(;Kt!==null;){switch(n=Kt,E=n.alternate,t=n.flags,n.tag){case 0:if((t&4)!==0&&(t=n.updateQueue,t=t!==null?t.events:null,t!==null))for(a=0;a<t.length;a++)w=t[a],w.ref.impl=w.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&E!==null){t=void 0,a=n,w=E.memoizedProps,E=E.memoizedState,h=a.stateNode;try{var De=Si(a.type,w);t=h.getSnapshotBeforeUpdate(De,E),h.__reactInternalSnapshotBeforeUpdate=t}catch(Pe){ft(a,a.return,Pe)}}break;case 3:if((t&1024)!==0){if(t=n.stateNode.containerInfo,a=t.nodeType,a===9)sd(t);else if(a===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":sd(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(s(163))}if(t=n.sibling,t!==null){t.return=n.return,Kt=t;break}Kt=n.return}}function zm(t,n,a){var h=a.flags;switch(a.tag){case 0:case 11:case 15:_r(t,a),h&4&&ua(5,a);break;case 1:if(_r(t,a),h&4)if(t=a.stateNode,n===null)try{t.componentDidMount()}catch(R){ft(a,a.return,R)}else{var w=Si(a.type,n.memoizedProps);n=n.memoizedState;try{t.componentDidUpdate(w,n,t.__reactInternalSnapshotBeforeUpdate)}catch(R){ft(a,a.return,R)}}h&64&&Lm(a),h&512&&da(a,a.return);break;case 3:if(_r(t,a),h&64&&(t=a.updateQueue,t!==null)){if(n=null,a.child!==null)switch(a.child.tag){case 27:case 5:n=a.child.stateNode;break;case 1:n=a.child.stateNode}try{Sp(t,n)}catch(R){ft(a,a.return,R)}}break;case 27:n===null&&h&4&&Bm(a);case 26:case 5:_r(t,a),n===null&&h&4&&Mm(a),h&512&&da(a,a.return);break;case 12:_r(t,a);break;case 31:_r(t,a),h&4&&Fm(t,a);break;case 13:_r(t,a),h&4&&Um(t,a),h&64&&(t=a.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(a=H_.bind(null,a),s1(t,a))));break;case 22:if(h=a.memoizedState!==null||br,!h){n=n!==null&&n.memoizedState!==null||zt,w=br;var E=zt;br=h,(zt=n)&&!E?Sr(t,a,(a.subtreeFlags&8772)!==0):_r(t,a),br=w,zt=E}break;case 30:break;default:_r(t,a)}}function Hm(t){var n=t.alternate;n!==null&&(t.alternate=null,Hm(n)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(n=t.stateNode,n!==null&&uc(n)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var wt=null,mn=!1;function yr(t,n,a){for(a=a.child;a!==null;)Pm(t,n,a),a=a.sibling}function Pm(t,n,a){if($e&&typeof $e.onCommitFiberUnmount=="function")try{$e.onCommitFiberUnmount(Le,a)}catch{}switch(a.tag){case 26:zt||Jn(a,n),yr(t,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:zt||Jn(a,n);var h=wt,w=mn;Yr(a.type)&&(wt=a.stateNode,mn=!1),yr(t,n,a),ya(a.stateNode),wt=h,mn=w;break;case 5:zt||Jn(a,n);case 6:if(h=wt,w=mn,wt=null,yr(t,n,a),wt=h,mn=w,wt!==null)if(mn)try{(wt.nodeType===9?wt.body:wt.nodeName==="HTML"?wt.ownerDocument.body:wt).removeChild(a.stateNode)}catch(E){ft(a,n,E)}else try{wt.removeChild(a.stateNode)}catch(E){ft(a,n,E)}break;case 18:wt!==null&&(mn?(t=wt,Lg(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,a.stateNode),ws(t)):Lg(wt,a.stateNode));break;case 4:h=wt,w=mn,wt=a.stateNode.containerInfo,mn=!0,yr(t,n,a),wt=h,mn=w;break;case 0:case 11:case 14:case 15:Fr(2,a,n),zt||Fr(4,a,n),yr(t,n,a);break;case 1:zt||(Jn(a,n),h=a.stateNode,typeof h.componentWillUnmount=="function"&&Rm(a,n,h)),yr(t,n,a);break;case 21:yr(t,n,a);break;case 22:zt=(h=zt)||a.memoizedState!==null,yr(t,n,a),zt=h;break;default:yr(t,n,a)}}function Fm(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{ws(t)}catch(a){ft(n,n.return,a)}}}function Um(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{ws(t)}catch(a){ft(n,n.return,a)}}function D_(t){switch(t.tag){case 31:case 13:case 19:var n=t.stateNode;return n===null&&(n=t.stateNode=new Im),n;case 22:return t=t.stateNode,n=t._retryCache,n===null&&(n=t._retryCache=new Im),n;default:throw Error(s(435,t.tag))}}function Wo(t,n){var a=D_(t);n.forEach(function(h){if(!a.has(h)){a.add(h);var w=P_.bind(null,t,h);h.then(w,w)}})}function gn(t,n){var a=n.deletions;if(a!==null)for(var h=0;h<a.length;h++){var w=a[h],E=t,R=n,G=R;e:for(;G!==null;){switch(G.tag){case 27:if(Yr(G.type)){wt=G.stateNode,mn=!1;break e}break;case 5:wt=G.stateNode,mn=!1;break e;case 3:case 4:wt=G.stateNode.containerInfo,mn=!0;break e}G=G.return}if(wt===null)throw Error(s(160));Pm(E,R,w),wt=null,mn=!1,E=w.alternate,E!==null&&(E.return=null),w.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)$m(n,t),n=n.sibling}var Vn=null;function $m(t,n){var a=t.alternate,h=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:gn(n,t),xn(t),h&4&&(Fr(3,t,t.return),ua(3,t),Fr(5,t,t.return));break;case 1:gn(n,t),xn(t),h&512&&(zt||a===null||Jn(a,a.return)),h&64&&br&&(t=t.updateQueue,t!==null&&(h=t.callbacks,h!==null&&(a=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=a===null?h:a.concat(h))));break;case 26:var w=Vn;if(gn(n,t),xn(t),h&512&&(zt||a===null||Jn(a,a.return)),h&4){var E=a!==null?a.memoizedState:null;if(h=t.memoizedState,a===null)if(h===null)if(t.stateNode===null){e:{h=t.type,a=t.memoizedProps,w=w.ownerDocument||w;t:switch(h){case"title":E=w.getElementsByTagName("title")[0],(!E||E[zs]||E[Qt]||E.namespaceURI==="http://www.w3.org/2000/svg"||E.hasAttribute("itemprop"))&&(E=w.createElement(h),w.head.insertBefore(E,w.querySelector("head > title"))),nn(E,h,a),E[Qt]=t,Yt(E),h=E;break e;case"link":var R=$g("link","href",w).get(h+(a.href||""));if(R){for(var G=0;G<R.length;G++)if(E=R[G],E.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&E.getAttribute("rel")===(a.rel==null?null:a.rel)&&E.getAttribute("title")===(a.title==null?null:a.title)&&E.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){R.splice(G,1);break t}}E=w.createElement(h),nn(E,h,a),w.head.appendChild(E);break;case"meta":if(R=$g("meta","content",w).get(h+(a.content||""))){for(G=0;G<R.length;G++)if(E=R[G],E.getAttribute("content")===(a.content==null?null:""+a.content)&&E.getAttribute("name")===(a.name==null?null:a.name)&&E.getAttribute("property")===(a.property==null?null:a.property)&&E.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&E.getAttribute("charset")===(a.charSet==null?null:a.charSet)){R.splice(G,1);break t}}E=w.createElement(h),nn(E,h,a),w.head.appendChild(E);break;default:throw Error(s(468,h))}E[Qt]=t,Yt(E),h=E}t.stateNode=h}else qg(w,t.type,t.stateNode);else t.stateNode=Ug(w,h,t.memoizedProps);else E!==h?(E===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):E.count--,h===null?qg(w,t.type,t.stateNode):Ug(w,h,t.memoizedProps)):h===null&&t.stateNode!==null&&Du(t,t.memoizedProps,a.memoizedProps)}break;case 27:gn(n,t),xn(t),h&512&&(zt||a===null||Jn(a,a.return)),a!==null&&h&4&&Du(t,t.memoizedProps,a.memoizedProps);break;case 5:if(gn(n,t),xn(t),h&512&&(zt||a===null||Jn(a,a.return)),t.flags&32){w=t.stateNode;try{Gi(w,"")}catch(De){ft(t,t.return,De)}}h&4&&t.stateNode!=null&&(w=t.memoizedProps,Du(t,w,a!==null?a.memoizedProps:w)),h&1024&&(Mu=!0);break;case 6:if(gn(n,t),xn(t),h&4){if(t.stateNode===null)throw Error(s(162));h=t.memoizedProps,a=t.stateNode;try{a.nodeValue=h}catch(De){ft(t,t.return,De)}}break;case 3:if(ol=null,w=Vn,Vn=sl(n.containerInfo),gn(n,t),Vn=w,xn(t),h&4&&a!==null&&a.memoizedState.isDehydrated)try{ws(n.containerInfo)}catch(De){ft(t,t.return,De)}Mu&&(Mu=!1,qm(t));break;case 4:h=Vn,Vn=sl(t.stateNode.containerInfo),gn(n,t),xn(t),Vn=h;break;case 12:gn(n,t),xn(t);break;case 31:gn(n,t),xn(t),h&4&&(h=t.updateQueue,h!==null&&(t.updateQueue=null,Wo(t,h)));break;case 13:gn(n,t),xn(t),t.child.flags&8192&&t.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Vo=Oe()),h&4&&(h=t.updateQueue,h!==null&&(t.updateQueue=null,Wo(t,h)));break;case 22:w=t.memoizedState!==null;var J=a!==null&&a.memoizedState!==null,le=br,he=zt;if(br=le||w,zt=he||J,gn(n,t),zt=he,br=le,xn(t),h&8192)e:for(n=t.stateNode,n._visibility=w?n._visibility&-2:n._visibility|1,w&&(a===null||J||br||zt||wi(t)),a=null,n=t;;){if(n.tag===5||n.tag===26){if(a===null){J=a=n;try{if(E=J.stateNode,w)R=E.style,typeof R.setProperty=="function"?R.setProperty("display","none","important"):R.display="none";else{G=J.stateNode;var xe=J.memoizedProps.style,ce=xe!=null&&xe.hasOwnProperty("display")?xe.display:null;G.style.display=ce==null||typeof ce=="boolean"?"":(""+ce).trim()}}catch(De){ft(J,J.return,De)}}}else if(n.tag===6){if(a===null){J=n;try{J.stateNode.nodeValue=w?"":J.memoizedProps}catch(De){ft(J,J.return,De)}}}else if(n.tag===18){if(a===null){J=n;try{var de=J.stateNode;w?Rg(de,!0):Rg(J.stateNode,!1)}catch(De){ft(J,J.return,De)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===t)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break e;for(;n.sibling===null;){if(n.return===null||n.return===t)break e;a===n&&(a=null),n=n.return}a===n&&(a=null),n.sibling.return=n.return,n=n.sibling}h&4&&(h=t.updateQueue,h!==null&&(a=h.retryQueue,a!==null&&(h.retryQueue=null,Wo(t,a))));break;case 19:gn(n,t),xn(t),h&4&&(h=t.updateQueue,h!==null&&(t.updateQueue=null,Wo(t,h)));break;case 30:break;case 21:break;default:gn(n,t),xn(t)}}function xn(t){var n=t.flags;if(n&2){try{for(var a,h=t.return;h!==null;){if(Om(h)){a=h;break}h=h.return}if(a==null)throw Error(s(160));switch(a.tag){case 27:var w=a.stateNode,E=Lu(t);qo(t,E,w);break;case 5:var R=a.stateNode;a.flags&32&&(Gi(R,""),a.flags&=-33);var G=Lu(t);qo(t,G,R);break;case 3:case 4:var J=a.stateNode.containerInfo,le=Lu(t);Ru(t,le,J);break;default:throw Error(s(161))}}catch(he){ft(t,t.return,he)}t.flags&=-3}n&4096&&(t.flags&=-4097)}function qm(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var n=t;qm(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),t=t.sibling}}function _r(t,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)zm(t,n.alternate,n),n=n.sibling}function wi(t){for(t=t.child;t!==null;){var n=t;switch(n.tag){case 0:case 11:case 14:case 15:Fr(4,n,n.return),wi(n);break;case 1:Jn(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&Rm(n,n.return,a),wi(n);break;case 27:ya(n.stateNode);case 26:case 5:Jn(n,n.return),wi(n);break;case 22:n.memoizedState===null&&wi(n);break;case 30:wi(n);break;default:wi(n)}t=t.sibling}}function Sr(t,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var h=n.alternate,w=t,E=n,R=E.flags;switch(E.tag){case 0:case 11:case 15:Sr(w,E,a),ua(4,E);break;case 1:if(Sr(w,E,a),h=E,w=h.stateNode,typeof w.componentDidMount=="function")try{w.componentDidMount()}catch(le){ft(h,h.return,le)}if(h=E,w=h.updateQueue,w!==null){var G=h.stateNode;try{var J=w.shared.hiddenCallbacks;if(J!==null)for(w.shared.hiddenCallbacks=null,w=0;w<J.length;w++)_p(J[w],G)}catch(le){ft(h,h.return,le)}}a&&R&64&&Lm(E),da(E,E.return);break;case 27:Bm(E);case 26:case 5:Sr(w,E,a),a&&h===null&&R&4&&Mm(E),da(E,E.return);break;case 12:Sr(w,E,a);break;case 31:Sr(w,E,a),a&&R&4&&Fm(w,E);break;case 13:Sr(w,E,a),a&&R&4&&Um(w,E);break;case 22:E.memoizedState===null&&Sr(w,E,a),da(E,E.return);break;case 30:break;default:Sr(w,E,a)}n=n.sibling}}function Ou(t,n){var a=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),t=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(t=n.memoizedState.cachePool.pool),t!==a&&(t!=null&&t.refCount++,a!=null&&Zs(a))}function Bu(t,n){t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&Zs(t))}function Yn(t,n,a,h){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Wm(t,n,a,h),n=n.sibling}function Wm(t,n,a,h){var w=n.flags;switch(n.tag){case 0:case 11:case 15:Yn(t,n,a,h),w&2048&&ua(9,n);break;case 1:Yn(t,n,a,h);break;case 3:Yn(t,n,a,h),w&2048&&(t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&Zs(t)));break;case 12:if(w&2048){Yn(t,n,a,h),t=n.stateNode;try{var E=n.memoizedProps,R=E.id,G=E.onPostCommit;typeof G=="function"&&G(R,n.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(J){ft(n,n.return,J)}}else Yn(t,n,a,h);break;case 31:Yn(t,n,a,h);break;case 13:Yn(t,n,a,h);break;case 23:break;case 22:E=n.stateNode,R=n.alternate,n.memoizedState!==null?E._visibility&2?Yn(t,n,a,h):ha(t,n):E._visibility&2?Yn(t,n,a,h):(E._visibility|=2,hs(t,n,a,h,(n.subtreeFlags&10256)!==0||!1)),w&2048&&Ou(R,n);break;case 24:Yn(t,n,a,h),w&2048&&Bu(n.alternate,n);break;default:Yn(t,n,a,h)}}function hs(t,n,a,h,w){for(w=w&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var E=t,R=n,G=a,J=h,le=R.flags;switch(R.tag){case 0:case 11:case 15:hs(E,R,G,J,w),ua(8,R);break;case 23:break;case 22:var he=R.stateNode;R.memoizedState!==null?he._visibility&2?hs(E,R,G,J,w):ha(E,R):(he._visibility|=2,hs(E,R,G,J,w)),w&&le&2048&&Ou(R.alternate,R);break;case 24:hs(E,R,G,J,w),w&&le&2048&&Bu(R.alternate,R);break;default:hs(E,R,G,J,w)}n=n.sibling}}function ha(t,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var a=t,h=n,w=h.flags;switch(h.tag){case 22:ha(a,h),w&2048&&Ou(h.alternate,h);break;case 24:ha(a,h),w&2048&&Bu(h.alternate,h);break;default:ha(a,h)}n=n.sibling}}var fa=8192;function fs(t,n,a){if(t.subtreeFlags&fa)for(t=t.child;t!==null;)Gm(t,n,a),t=t.sibling}function Gm(t,n,a){switch(t.tag){case 26:fs(t,n,a),t.flags&fa&&t.memoizedState!==null&&x1(a,Vn,t.memoizedState,t.memoizedProps);break;case 5:fs(t,n,a);break;case 3:case 4:var h=Vn;Vn=sl(t.stateNode.containerInfo),fs(t,n,a),Vn=h;break;case 22:t.memoizedState===null&&(h=t.alternate,h!==null&&h.memoizedState!==null?(h=fa,fa=16777216,fs(t,n,a),fa=h):fs(t,n,a));break;default:fs(t,n,a)}}function Vm(t){var n=t.alternate;if(n!==null&&(t=n.child,t!==null)){n.child=null;do n=t.sibling,t.sibling=null,t=n;while(t!==null)}}function pa(t){var n=t.deletions;if((t.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var h=n[a];Kt=h,Km(h,t)}Vm(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Ym(t),t=t.sibling}function Ym(t){switch(t.tag){case 0:case 11:case 15:pa(t),t.flags&2048&&Fr(9,t,t.return);break;case 3:pa(t);break;case 12:pa(t);break;case 22:var n=t.stateNode;t.memoizedState!==null&&n._visibility&2&&(t.return===null||t.return.tag!==13)?(n._visibility&=-3,Go(t)):pa(t);break;default:pa(t)}}function Go(t){var n=t.deletions;if((t.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var h=n[a];Kt=h,Km(h,t)}Vm(t)}for(t=t.child;t!==null;){switch(n=t,n.tag){case 0:case 11:case 15:Fr(8,n,n.return),Go(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,Go(n));break;default:Go(n)}t=t.sibling}}function Km(t,n){for(;Kt!==null;){var a=Kt;switch(a.tag){case 0:case 11:case 15:Fr(8,a,n);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var h=a.memoizedState.cachePool.pool;h!=null&&h.refCount++}break;case 24:Zs(a.memoizedState.cache)}if(h=a.child,h!==null)h.return=a,Kt=h;else e:for(a=t;Kt!==null;){h=Kt;var w=h.sibling,E=h.return;if(Hm(h),h===a){Kt=null;break e}if(w!==null){w.return=E,Kt=w;break e}Kt=E}}}var L_={getCacheForType:function(t){var n=en(Ot),a=n.data.get(t);return a===void 0&&(a=t(),n.data.set(t,a)),a},cacheSignal:function(){return en(Ot).controller.signal}},R_=typeof WeakMap=="function"?WeakMap:Map,dt=0,vt=null,Qe=null,tt=0,ht=0,En=null,Ur=!1,ps=!1,Iu=!1,wr=0,jt=0,$r=0,Ci=0,zu=0,jn=0,ms=0,ma=null,vn=null,Hu=!1,Vo=0,Xm=0,Yo=1/0,Ko=null,qr=null,qt=0,Wr=null,gs=null,Cr=0,Pu=0,Fu=null,Zm=null,ga=0,Uu=null;function Nn(){return(dt&2)!==0&&tt!==0?tt&-tt:z.T!==null?Yu():ff()}function Qm(){if(jn===0)if((tt&536870912)===0||it){var t=ye;ye<<=1,(ye&3932160)===0&&(ye=262144),jn=t}else jn=536870912;return t=Cn.current,t!==null&&(t.flags|=32),jn}function bn(t,n,a){(t===vt&&(ht===2||ht===9)||t.cancelPendingCommit!==null)&&(xs(t,0),Gr(t,tt,jn,!1)),Hi(t,a),((dt&2)===0||t!==vt)&&(t===vt&&((dt&2)===0&&(Ci|=a),jt===4&&Gr(t,tt,jn,!1)),er(t))}function Jm(t,n,a){if((dt&6)!==0)throw Error(s(327));var h=!a&&(n&127)===0&&(n&t.expiredLanes)===0||Ue(t,n),w=h?B_(t,n):qu(t,n,!0),E=h;do{if(w===0){ps&&!h&&Gr(t,n,0,!1);break}else{if(a=t.current.alternate,E&&!M_(a)){w=qu(t,n,!1),E=!1;continue}if(w===2){if(E=n,t.errorRecoveryDisabledLanes&E)var R=0;else R=t.pendingLanes&-536870913,R=R!==0?R:R&536870912?536870912:0;if(R!==0){n=R;e:{var G=t;w=ma;var J=G.current.memoizedState.isDehydrated;if(J&&(xs(G,R).flags|=256),R=qu(G,R,!1),R!==2){if(Iu&&!J){G.errorRecoveryDisabledLanes|=E,Ci|=E,w=4;break e}E=vn,vn=w,E!==null&&(vn===null?vn=E:vn.push.apply(vn,E))}w=R}if(E=!1,w!==2)continue}}if(w===1){xs(t,0),Gr(t,n,0,!0);break}e:{switch(h=t,E=w,E){case 0:case 1:throw Error(s(345));case 4:if((n&4194048)!==n)break;case 6:Gr(h,n,jn,!Ur);break e;case 2:vn=null;break;case 3:case 5:break;default:throw Error(s(329))}if((n&62914560)===n&&(w=Vo+300-Oe(),10<w)){if(Gr(h,n,jn,!Ur),rt(h,0,!0)!==0)break e;Cr=n,h.timeoutHandle=Ag(eg.bind(null,h,a,vn,Ko,Hu,n,jn,Ci,ms,Ur,E,"Throttled",-0,0),w);break e}eg(h,a,vn,Ko,Hu,n,jn,Ci,ms,Ur,E,null,-0,0)}}break}while(!0);er(t)}function eg(t,n,a,h,w,E,R,G,J,le,he,xe,ce,de){if(t.timeoutHandle=-1,xe=n.subtreeFlags,xe&8192||(xe&16785408)===16785408){xe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:cr},Gm(n,E,xe);var De=(E&62914560)===E?Vo-Oe():(E&4194048)===E?Xm-Oe():0;if(De=v1(xe,De),De!==null){Cr=E,t.cancelPendingCommit=De(lg.bind(null,t,n,E,a,h,w,R,G,J,he,xe,null,ce,de)),Gr(t,E,R,!le);return}}lg(t,n,E,a,h,w,R,G,J)}function M_(t){for(var n=t;;){var a=n.tag;if((a===0||a===11||a===15)&&n.flags&16384&&(a=n.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var h=0;h<a.length;h++){var w=a[h],E=w.getSnapshot;w=w.value;try{if(!Sn(E(),w))return!1}catch{return!1}}if(a=n.child,n.subtreeFlags&16384&&a!==null)a.return=n,n=a;else{if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Gr(t,n,a,h){n&=~zu,n&=~Ci,t.suspendedLanes|=n,t.pingedLanes&=~n,h&&(t.warmLanes|=n),h=t.expirationTimes;for(var w=n;0<w;){var E=31-qe(w),R=1<<E;h[E]=-1,w&=~R}a!==0&&uf(t,a,n)}function Xo(){return(dt&6)===0?(xa(0),!1):!0}function $u(){if(Qe!==null){if(ht===0)var t=Qe.return;else t=Qe,fr=mi=null,su(t),os=null,Js=0,t=Qe;for(;t!==null;)Dm(t.alternate,t),t=t.return;Qe=null}}function xs(t,n){var a=t.timeoutHandle;a!==-1&&(t.timeoutHandle=-1,e1(a)),a=t.cancelPendingCommit,a!==null&&(t.cancelPendingCommit=null,a()),Cr=0,$u(),vt=t,Qe=a=dr(t.current,null),tt=n,ht=0,En=null,Ur=!1,ps=Ue(t,n),Iu=!1,ms=jn=zu=Ci=$r=jt=0,vn=ma=null,Hu=!1,(n&8)!==0&&(n|=n&32);var h=t.entangledLanes;if(h!==0)for(t=t.entanglements,h&=n;0<h;){var w=31-qe(h),E=1<<w;n|=t[w],h&=~E}return wr=n,xo(),a}function tg(t,n){Ke=null,z.H=oa,n===as||n===ko?(n=xp(),ht=3):n===Vc?(n=xp(),ht=4):ht=n===_u?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,En=n,Qe===null&&(jt=1,Ho(t,In(n,t.current)))}function ng(){var t=Cn.current;return t===null?!0:(tt&4194048)===tt?Fn===null:(tt&62914560)===tt||(tt&536870912)!==0?t===Fn:!1}function rg(){var t=z.H;return z.H=oa,t===null?oa:t}function ig(){var t=z.A;return z.A=L_,t}function Zo(){jt=4,Ur||(tt&4194048)!==tt&&Cn.current!==null||(ps=!0),($r&134217727)===0&&(Ci&134217727)===0||vt===null||Gr(vt,tt,jn,!1)}function qu(t,n,a){var h=dt;dt|=2;var w=rg(),E=ig();(vt!==t||tt!==n)&&(Ko=null,xs(t,n)),n=!1;var R=jt;e:do try{if(ht!==0&&Qe!==null){var G=Qe,J=En;switch(ht){case 8:$u(),R=6;break e;case 3:case 2:case 9:case 6:Cn.current===null&&(n=!0);var le=ht;if(ht=0,En=null,vs(t,G,J,le),a&&ps){R=0;break e}break;default:le=ht,ht=0,En=null,vs(t,G,J,le)}}O_(),R=jt;break}catch(he){tg(t,he)}while(!0);return n&&t.shellSuspendCounter++,fr=mi=null,dt=h,z.H=w,z.A=E,Qe===null&&(vt=null,tt=0,xo()),R}function O_(){for(;Qe!==null;)sg(Qe)}function B_(t,n){var a=dt;dt|=2;var h=rg(),w=ig();vt!==t||tt!==n?(Ko=null,Yo=Oe()+500,xs(t,n)):ps=Ue(t,n);e:do try{if(ht!==0&&Qe!==null){n=Qe;var E=En;t:switch(ht){case 1:ht=0,En=null,vs(t,n,E,1);break;case 2:case 9:if(mp(E)){ht=0,En=null,ag(n);break}n=function(){ht!==2&&ht!==9||vt!==t||(ht=7),er(t)},E.then(n,n);break e;case 3:ht=7;break e;case 4:ht=5;break e;case 7:mp(E)?(ht=0,En=null,ag(n)):(ht=0,En=null,vs(t,n,E,7));break;case 5:var R=null;switch(Qe.tag){case 26:R=Qe.memoizedState;case 5:case 27:var G=Qe;if(R?Wg(R):G.stateNode.complete){ht=0,En=null;var J=G.sibling;if(J!==null)Qe=J;else{var le=G.return;le!==null?(Qe=le,Qo(le)):Qe=null}break t}}ht=0,En=null,vs(t,n,E,5);break;case 6:ht=0,En=null,vs(t,n,E,6);break;case 8:$u(),jt=6;break e;default:throw Error(s(462))}}I_();break}catch(he){tg(t,he)}while(!0);return fr=mi=null,z.H=h,z.A=w,dt=a,Qe!==null?0:(vt=null,tt=0,xo(),jt)}function I_(){for(;Qe!==null&&!pe();)sg(Qe)}function sg(t){var n=Tm(t.alternate,t,wr);t.memoizedProps=t.pendingProps,n===null?Qo(t):Qe=n}function ag(t){var n=t,a=n.alternate;switch(n.tag){case 15:case 0:n=wm(a,n,n.pendingProps,n.type,void 0,tt);break;case 11:n=wm(a,n,n.pendingProps,n.type.render,n.ref,tt);break;case 5:su(n);default:Dm(a,n),n=Qe=ip(n,wr),n=Tm(a,n,wr)}t.memoizedProps=t.pendingProps,n===null?Qo(t):Qe=n}function vs(t,n,a,h){fr=mi=null,su(n),os=null,Js=0;var w=n.return;try{if(k_(t,w,n,a,tt)){jt=1,Ho(t,In(a,t.current)),Qe=null;return}}catch(E){if(w!==null)throw Qe=w,E;jt=1,Ho(t,In(a,t.current)),Qe=null;return}n.flags&32768?(it||h===1?t=!0:ps||(tt&536870912)!==0?t=!1:(Ur=t=!0,(h===2||h===9||h===3||h===6)&&(h=Cn.current,h!==null&&h.tag===13&&(h.flags|=16384))),og(n,t)):Qo(n)}function Qo(t){var n=t;do{if((n.flags&32768)!==0){og(n,Ur);return}t=n.return;var a=N_(n.alternate,n,wr);if(a!==null){Qe=a;return}if(n=n.sibling,n!==null){Qe=n;return}Qe=n=t}while(n!==null);jt===0&&(jt=5)}function og(t,n){do{var a=T_(t.alternate,t);if(a!==null){a.flags&=32767,Qe=a;return}if(a=t.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(t=t.sibling,t!==null)){Qe=t;return}Qe=t=a}while(t!==null);jt=6,Qe=null}function lg(t,n,a,h,w,E,R,G,J){t.cancelPendingCommit=null;do Jo();while(qt!==0);if((dt&6)!==0)throw Error(s(327));if(n!==null){if(n===t.current)throw Error(s(177));if(E=n.lanes|n.childLanes,E|=Lc,ac(t,a,E,R,G,J),t===vt&&(Qe=vt=null,tt=0),gs=n,Wr=t,Cr=a,Pu=E,Fu=w,Zm=h,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,F_(Te,function(){return fg(),null})):(t.callbackNode=null,t.callbackPriority=0),h=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||h){h=z.T,z.T=null,w=X.p,X.p=2,R=dt,dt|=4;try{A_(t,n,a)}finally{dt=R,X.p=w,z.T=h}}qt=1,cg(),ug(),dg()}}function cg(){if(qt===1){qt=0;var t=Wr,n=gs,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=z.T,z.T=null;var h=X.p;X.p=2;var w=dt;dt|=4;try{$m(n,t);var E=nd,R=Kf(t.containerInfo),G=E.focusedElem,J=E.selectionRange;if(R!==G&&G&&G.ownerDocument&&Yf(G.ownerDocument.documentElement,G)){if(J!==null&&jc(G)){var le=J.start,he=J.end;if(he===void 0&&(he=le),"selectionStart"in G)G.selectionStart=le,G.selectionEnd=Math.min(he,G.value.length);else{var xe=G.ownerDocument||document,ce=xe&&xe.defaultView||window;if(ce.getSelection){var de=ce.getSelection(),De=G.textContent.length,Pe=Math.min(J.start,De),xt=J.end===void 0?Pe:Math.min(J.end,De);!de.extend&&Pe>xt&&(R=xt,xt=Pe,Pe=R);var ie=Vf(G,Pe),te=Vf(G,xt);if(ie&&te&&(de.rangeCount!==1||de.anchorNode!==ie.node||de.anchorOffset!==ie.offset||de.focusNode!==te.node||de.focusOffset!==te.offset)){var oe=xe.createRange();oe.setStart(ie.node,ie.offset),de.removeAllRanges(),Pe>xt?(de.addRange(oe),de.extend(te.node,te.offset)):(oe.setEnd(te.node,te.offset),de.addRange(oe))}}}}for(xe=[],de=G;de=de.parentNode;)de.nodeType===1&&xe.push({element:de,left:de.scrollLeft,top:de.scrollTop});for(typeof G.focus=="function"&&G.focus(),G=0;G<xe.length;G++){var me=xe[G];me.element.scrollLeft=me.left,me.element.scrollTop=me.top}}dl=!!td,nd=td=null}finally{dt=w,X.p=h,z.T=a}}t.current=n,qt=2}}function ug(){if(qt===2){qt=0;var t=Wr,n=gs,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=z.T,z.T=null;var h=X.p;X.p=2;var w=dt;dt|=4;try{zm(t,n.alternate,n)}finally{dt=w,X.p=h,z.T=a}}qt=3}}function dg(){if(qt===4||qt===3){qt=0,Ne();var t=Wr,n=gs,a=Cr,h=Zm;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?qt=5:(qt=0,gs=Wr=null,hg(t,t.pendingLanes));var w=t.pendingLanes;if(w===0&&(qr=null),lc(a),n=n.stateNode,$e&&typeof $e.onCommitFiberRoot=="function")try{$e.onCommitFiberRoot(Le,n,void 0,(n.current.flags&128)===128)}catch{}if(h!==null){n=z.T,w=X.p,X.p=2,z.T=null;try{for(var E=t.onRecoverableError,R=0;R<h.length;R++){var G=h[R];E(G.value,{componentStack:G.stack})}}finally{z.T=n,X.p=w}}(Cr&3)!==0&&Jo(),er(t),w=t.pendingLanes,(a&261930)!==0&&(w&42)!==0?t===Uu?ga++:(ga=0,Uu=t):ga=0,xa(0)}}function hg(t,n){(t.pooledCacheLanes&=n)===0&&(n=t.pooledCache,n!=null&&(t.pooledCache=null,Zs(n)))}function Jo(){return cg(),ug(),dg(),fg()}function fg(){if(qt!==5)return!1;var t=Wr,n=Pu;Pu=0;var a=lc(Cr),h=z.T,w=X.p;try{X.p=32>a?32:a,z.T=null,a=Fu,Fu=null;var E=Wr,R=Cr;if(qt=0,gs=Wr=null,Cr=0,(dt&6)!==0)throw Error(s(331));var G=dt;if(dt|=4,Ym(E.current),Wm(E,E.current,R,a),dt=G,xa(0,!1),$e&&typeof $e.onPostCommitFiberRoot=="function")try{$e.onPostCommitFiberRoot(Le,E)}catch{}return!0}finally{X.p=w,z.T=h,hg(t,n)}}function pg(t,n,a){n=In(a,n),n=yu(t.stateNode,n,2),t=zr(t,n,2),t!==null&&(Hi(t,2),er(t))}function ft(t,n,a){if(t.tag===3)pg(t,t,a);else for(;n!==null;){if(n.tag===3){pg(n,t,a);break}else if(n.tag===1){var h=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(qr===null||!qr.has(h))){t=In(a,t),a=mm(2),h=zr(n,a,2),h!==null&&(gm(a,h,n,t),Hi(h,2),er(h));break}}n=n.return}}function Wu(t,n,a){var h=t.pingCache;if(h===null){h=t.pingCache=new R_;var w=new Set;h.set(n,w)}else w=h.get(n),w===void 0&&(w=new Set,h.set(n,w));w.has(a)||(Iu=!0,w.add(a),t=z_.bind(null,t,n,a),n.then(t,t))}function z_(t,n,a){var h=t.pingCache;h!==null&&h.delete(n),t.pingedLanes|=t.suspendedLanes&a,t.warmLanes&=~a,vt===t&&(tt&a)===a&&(jt===4||jt===3&&(tt&62914560)===tt&&300>Oe()-Vo?(dt&2)===0&&xs(t,0):zu|=a,ms===tt&&(ms=0)),er(t)}function mg(t,n){n===0&&(n=Mt()),t=hi(t,n),t!==null&&(Hi(t,n),er(t))}function H_(t){var n=t.memoizedState,a=0;n!==null&&(a=n.retryLane),mg(t,a)}function P_(t,n){var a=0;switch(t.tag){case 31:case 13:var h=t.stateNode,w=t.memoizedState;w!==null&&(a=w.retryLane);break;case 19:h=t.stateNode;break;case 22:h=t.stateNode._retryCache;break;default:throw Error(s(314))}h!==null&&h.delete(n),mg(t,a)}function F_(t,n){return We(t,n)}var el=null,bs=null,Gu=!1,tl=!1,Vu=!1,Vr=0;function er(t){t!==bs&&t.next===null&&(bs===null?el=bs=t:bs=bs.next=t),tl=!0,Gu||(Gu=!0,$_())}function xa(t,n){if(!Vu&&tl){Vu=!0;do for(var a=!1,h=el;h!==null;){if(t!==0){var w=h.pendingLanes;if(w===0)var E=0;else{var R=h.suspendedLanes,G=h.pingedLanes;E=(1<<31-qe(42|t)+1)-1,E&=w&~(R&~G),E=E&201326741?E&201326741|1:E?E|2:0}E!==0&&(a=!0,bg(h,E))}else E=tt,E=rt(h,h===vt?E:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),(E&3)===0||Ue(h,E)||(a=!0,bg(h,E));h=h.next}while(a);Vu=!1}}function U_(){gg()}function gg(){tl=Gu=!1;var t=0;Vr!==0&&J_()&&(t=Vr);for(var n=Oe(),a=null,h=el;h!==null;){var w=h.next,E=xg(h,n);E===0?(h.next=null,a===null?el=w:a.next=w,w===null&&(bs=a)):(a=h,(t!==0||(E&3)!==0)&&(tl=!0)),h=w}qt!==0&&qt!==5||xa(t),Vr!==0&&(Vr=0)}function xg(t,n){for(var a=t.suspendedLanes,h=t.pingedLanes,w=t.expirationTimes,E=t.pendingLanes&-62914561;0<E;){var R=31-qe(E),G=1<<R,J=w[R];J===-1?((G&a)===0||(G&h)!==0)&&(w[R]=Zt(G,n)):J<=n&&(t.expiredLanes|=G),E&=~G}if(n=vt,a=tt,a=rt(t,t===n?a:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),h=t.callbackNode,a===0||t===n&&(ht===2||ht===9)||t.cancelPendingCommit!==null)return h!==null&&h!==null&&Lt(h),t.callbackNode=null,t.callbackPriority=0;if((a&3)===0||Ue(t,a)){if(n=a&-a,n===t.callbackPriority)return n;switch(h!==null&&Lt(h),lc(a)){case 2:case 8:a=_e;break;case 32:a=Te;break;case 268435456:a=Ve;break;default:a=Te}return h=vg.bind(null,t),a=We(a,h),t.callbackPriority=n,t.callbackNode=a,n}return h!==null&&h!==null&&Lt(h),t.callbackPriority=2,t.callbackNode=null,2}function vg(t,n){if(qt!==0&&qt!==5)return t.callbackNode=null,t.callbackPriority=0,null;var a=t.callbackNode;if(Jo()&&t.callbackNode!==a)return null;var h=tt;return h=rt(t,t===vt?h:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),h===0?null:(Jm(t,h,n),xg(t,Oe()),t.callbackNode!=null&&t.callbackNode===a?vg.bind(null,t):null)}function bg(t,n){if(Jo())return null;Jm(t,n,!0)}function $_(){t1(function(){(dt&6)!==0?We(ue,U_):gg()})}function Yu(){if(Vr===0){var t=is;t===0&&(t=fe,fe<<=1,(fe&261888)===0&&(fe=256)),Vr=t}return Vr}function yg(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:lo(""+t)}function _g(t,n){var a=n.ownerDocument.createElement("input");return a.name=n.name,a.value=n.value,t.id&&a.setAttribute("form",t.id),n.parentNode.insertBefore(a,n),t=new FormData(t),a.parentNode.removeChild(a),t}function q_(t,n,a,h,w){if(n==="submit"&&a&&a.stateNode===w){var E=yg((w[fn]||null).action),R=h.submitter;R&&(n=(n=R[fn]||null)?yg(n.formAction):R.getAttribute("formAction"),n!==null&&(E=n,R=null));var G=new fo("action","action",null,h,w);t.push({event:G,listeners:[{instance:null,listener:function(){if(h.defaultPrevented){if(Vr!==0){var J=R?_g(w,R):new FormData(w);pu(a,{pending:!0,data:J,method:w.method,action:E},null,J)}}else typeof E=="function"&&(G.preventDefault(),J=R?_g(w,R):new FormData(w),pu(a,{pending:!0,data:J,method:w.method,action:E},E,J))},currentTarget:w}]})}}for(var Ku=0;Ku<Dc.length;Ku++){var Xu=Dc[Ku],W_=Xu.toLowerCase(),G_=Xu[0].toUpperCase()+Xu.slice(1);Gn(W_,"on"+G_)}Gn(Qf,"onAnimationEnd"),Gn(Jf,"onAnimationIteration"),Gn(ep,"onAnimationStart"),Gn("dblclick","onDoubleClick"),Gn("focusin","onFocus"),Gn("focusout","onBlur"),Gn(l_,"onTransitionRun"),Gn(c_,"onTransitionStart"),Gn(u_,"onTransitionCancel"),Gn(tp,"onTransitionEnd"),qi("onMouseEnter",["mouseout","mouseover"]),qi("onMouseLeave",["mouseout","mouseover"]),qi("onPointerEnter",["pointerout","pointerover"]),qi("onPointerLeave",["pointerout","pointerover"]),li("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),li("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),li("onBeforeInput",["compositionend","keypress","textInput","paste"]),li("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),li("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),li("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var va="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(" "),V_=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(va));function Sg(t,n){n=(n&4)!==0;for(var a=0;a<t.length;a++){var h=t[a],w=h.event;h=h.listeners;e:{var E=void 0;if(n)for(var R=h.length-1;0<=R;R--){var G=h[R],J=G.instance,le=G.currentTarget;if(G=G.listener,J!==E&&w.isPropagationStopped())break e;E=G,w.currentTarget=le;try{E(w)}catch(he){go(he)}w.currentTarget=null,E=J}else for(R=0;R<h.length;R++){if(G=h[R],J=G.instance,le=G.currentTarget,G=G.listener,J!==E&&w.isPropagationStopped())break e;E=G,w.currentTarget=le;try{E(w)}catch(he){go(he)}w.currentTarget=null,E=J}}}}function Je(t,n){var a=n[cc];a===void 0&&(a=n[cc]=new Set);var h=t+"__bubble";a.has(h)||(wg(n,t,2,!1),a.add(h))}function Zu(t,n,a){var h=0;n&&(h|=4),wg(a,t,h,n)}var nl="_reactListening"+Math.random().toString(36).slice(2);function Qu(t){if(!t[nl]){t[nl]=!0,gf.forEach(function(a){a!=="selectionchange"&&(V_.has(a)||Zu(a,!1,t),Zu(a,!0,t))});var n=t.nodeType===9?t:t.ownerDocument;n===null||n[nl]||(n[nl]=!0,Zu("selectionchange",!1,n))}}function wg(t,n,a,h){switch(Qg(n)){case 2:var w=_1;break;case 8:w=S1;break;default:w=fd}a=w.bind(null,n,a,t),w=void 0,!vc||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(w=!0),h?w!==void 0?t.addEventListener(n,a,{capture:!0,passive:w}):t.addEventListener(n,a,!0):w!==void 0?t.addEventListener(n,a,{passive:w}):t.addEventListener(n,a,!1)}function Ju(t,n,a,h,w){var E=h;if((n&1)===0&&(n&2)===0&&h!==null)e:for(;;){if(h===null)return;var R=h.tag;if(R===3||R===4){var G=h.stateNode.containerInfo;if(G===w)break;if(R===4)for(R=h.return;R!==null;){var J=R.tag;if((J===3||J===4)&&R.stateNode.containerInfo===w)return;R=R.return}for(;G!==null;){if(R=Fi(G),R===null)return;if(J=R.tag,J===5||J===6||J===26||J===27){h=E=R;continue e}G=G.parentNode}}h=h.return}Nf(function(){var le=E,he=gc(a),xe=[];e:{var ce=np.get(t);if(ce!==void 0){var de=fo,De=t;switch(t){case"keypress":if(uo(a)===0)break e;case"keydown":case"keyup":de=P0;break;case"focusin":De="focus",de=Sc;break;case"focusout":De="blur",de=Sc;break;case"beforeblur":case"afterblur":de=Sc;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":de=Df;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":de=N0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":de=$0;break;case Qf:case Jf:case ep:de=D0;break;case tp:de=W0;break;case"scroll":case"scrollend":de=E0;break;case"wheel":de=V0;break;case"copy":case"cut":case"paste":de=R0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":de=Rf;break;case"toggle":case"beforetoggle":de=K0}var Pe=(n&4)!==0,xt=!Pe&&(t==="scroll"||t==="scrollend"),ie=Pe?ce!==null?ce+"Capture":null:ce;Pe=[];for(var te=le,oe;te!==null;){var me=te;if(oe=me.stateNode,me=me.tag,me!==5&&me!==26&&me!==27||oe===null||ie===null||(me=Ps(te,ie),me!=null&&Pe.push(ba(te,me,oe))),xt)break;te=te.return}0<Pe.length&&(ce=new de(ce,De,null,a,he),xe.push({event:ce,listeners:Pe}))}}if((n&7)===0){e:{if(ce=t==="mouseover"||t==="pointerover",de=t==="mouseout"||t==="pointerout",ce&&a!==mc&&(De=a.relatedTarget||a.fromElement)&&(Fi(De)||De[Pi]))break e;if((de||ce)&&(ce=he.window===he?he:(ce=he.ownerDocument)?ce.defaultView||ce.parentWindow:window,de?(De=a.relatedTarget||a.toElement,de=le,De=De?Fi(De):null,De!==null&&(xt=u(De),Pe=De.tag,De!==xt||Pe!==5&&Pe!==27&&Pe!==6)&&(De=null)):(de=null,De=le),de!==De)){if(Pe=Df,me="onMouseLeave",ie="onMouseEnter",te="mouse",(t==="pointerout"||t==="pointerover")&&(Pe=Rf,me="onPointerLeave",ie="onPointerEnter",te="pointer"),xt=de==null?ce:Hs(de),oe=De==null?ce:Hs(De),ce=new Pe(me,te+"leave",de,a,he),ce.target=xt,ce.relatedTarget=oe,me=null,Fi(he)===le&&(Pe=new Pe(ie,te+"enter",De,a,he),Pe.target=oe,Pe.relatedTarget=xt,me=Pe),xt=me,de&&De)t:{for(Pe=Y_,ie=de,te=De,oe=0,me=ie;me;me=Pe(me))oe++;me=0;for(var ze=te;ze;ze=Pe(ze))me++;for(;0<oe-me;)ie=Pe(ie),oe--;for(;0<me-oe;)te=Pe(te),me--;for(;oe--;){if(ie===te||te!==null&&ie===te.alternate){Pe=ie;break t}ie=Pe(ie),te=Pe(te)}Pe=null}else Pe=null;de!==null&&Cg(xe,ce,de,Pe,!1),De!==null&&xt!==null&&Cg(xe,xt,De,Pe,!0)}}e:{if(ce=le?Hs(le):window,de=ce.nodeName&&ce.nodeName.toLowerCase(),de==="select"||de==="input"&&ce.type==="file")var ct=Ff;else if(Hf(ce))if(Uf)ct=s_;else{ct=r_;var Re=n_}else de=ce.nodeName,!de||de.toLowerCase()!=="input"||ce.type!=="checkbox"&&ce.type!=="radio"?le&&pc(le.elementType)&&(ct=Ff):ct=i_;if(ct&&(ct=ct(t,le))){Pf(xe,ct,a,he);break e}Re&&Re(t,ce,le),t==="focusout"&&le&&ce.type==="number"&&le.memoizedProps.value!=null&&fc(ce,"number",ce.value)}switch(Re=le?Hs(le):window,t){case"focusin":(Hf(Re)||Re.contentEditable==="true")&&(Xi=Re,Nc=le,Ys=null);break;case"focusout":Ys=Nc=Xi=null;break;case"mousedown":Tc=!0;break;case"contextmenu":case"mouseup":case"dragend":Tc=!1,Xf(xe,a,he);break;case"selectionchange":if(o_)break;case"keydown":case"keyup":Xf(xe,a,he)}var Xe;if(Cc)e:{switch(t){case"compositionstart":var nt="onCompositionStart";break e;case"compositionend":nt="onCompositionEnd";break e;case"compositionupdate":nt="onCompositionUpdate";break e}nt=void 0}else Ki?If(t,a)&&(nt="onCompositionEnd"):t==="keydown"&&a.keyCode===229&&(nt="onCompositionStart");nt&&(Mf&&a.locale!=="ko"&&(Ki||nt!=="onCompositionStart"?nt==="onCompositionEnd"&&Ki&&(Xe=Tf()):(Dr=he,bc="value"in Dr?Dr.value:Dr.textContent,Ki=!0)),Re=rl(le,nt),0<Re.length&&(nt=new Lf(nt,t,null,a,he),xe.push({event:nt,listeners:Re}),Xe?nt.data=Xe:(Xe=zf(a),Xe!==null&&(nt.data=Xe)))),(Xe=Z0?Q0(t,a):J0(t,a))&&(nt=rl(le,"onBeforeInput"),0<nt.length&&(Re=new Lf("onBeforeInput","beforeinput",null,a,he),xe.push({event:Re,listeners:nt}),Re.data=Xe)),q_(xe,t,le,a,he)}Sg(xe,n)})}function ba(t,n,a){return{instance:t,listener:n,currentTarget:a}}function rl(t,n){for(var a=n+"Capture",h=[];t!==null;){var w=t,E=w.stateNode;if(w=w.tag,w!==5&&w!==26&&w!==27||E===null||(w=Ps(t,a),w!=null&&h.unshift(ba(t,w,E)),w=Ps(t,n),w!=null&&h.push(ba(t,w,E))),t.tag===3)return h;t=t.return}return[]}function Y_(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function Cg(t,n,a,h,w){for(var E=n._reactName,R=[];a!==null&&a!==h;){var G=a,J=G.alternate,le=G.stateNode;if(G=G.tag,J!==null&&J===h)break;G!==5&&G!==26&&G!==27||le===null||(J=le,w?(le=Ps(a,E),le!=null&&R.unshift(ba(a,le,J))):w||(le=Ps(a,E),le!=null&&R.push(ba(a,le,J)))),a=a.return}R.length!==0&&t.push({event:n,listeners:R})}var K_=/\r\n?/g,X_=/\u0000|\uFFFD/g;function kg(t){return(typeof t=="string"?t:""+t).replace(K_,`
|
|
49
|
+
`).replace(X_,"")}function Eg(t,n){return n=kg(n),kg(t)===n}function gt(t,n,a,h,w,E){switch(a){case"children":typeof h=="string"?n==="body"||n==="textarea"&&h===""||Gi(t,h):(typeof h=="number"||typeof h=="bigint")&&n!=="body"&&Gi(t,""+h);break;case"className":ao(t,"class",h);break;case"tabIndex":ao(t,"tabindex",h);break;case"dir":case"role":case"viewBox":case"width":case"height":ao(t,a,h);break;case"style":Ef(t,h,E);break;case"data":if(n!=="object"){ao(t,"data",h);break}case"src":case"href":if(h===""&&(n!=="a"||a!=="href")){t.removeAttribute(a);break}if(h==null||typeof h=="function"||typeof h=="symbol"||typeof h=="boolean"){t.removeAttribute(a);break}h=lo(""+h),t.setAttribute(a,h);break;case"action":case"formAction":if(typeof h=="function"){t.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof E=="function"&&(a==="formAction"?(n!=="input"&>(t,n,"name",w.name,w,null),gt(t,n,"formEncType",w.formEncType,w,null),gt(t,n,"formMethod",w.formMethod,w,null),gt(t,n,"formTarget",w.formTarget,w,null)):(gt(t,n,"encType",w.encType,w,null),gt(t,n,"method",w.method,w,null),gt(t,n,"target",w.target,w,null)));if(h==null||typeof h=="symbol"||typeof h=="boolean"){t.removeAttribute(a);break}h=lo(""+h),t.setAttribute(a,h);break;case"onClick":h!=null&&(t.onclick=cr);break;case"onScroll":h!=null&&Je("scroll",t);break;case"onScrollEnd":h!=null&&Je("scrollend",t);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(s(61));if(a=h.__html,a!=null){if(w.children!=null)throw Error(s(60));t.innerHTML=a}}break;case"multiple":t.multiple=h&&typeof h!="function"&&typeof h!="symbol";break;case"muted":t.muted=h&&typeof h!="function"&&typeof h!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(h==null||typeof h=="function"||typeof h=="boolean"||typeof h=="symbol"){t.removeAttribute("xlink:href");break}a=lo(""+h),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":h!=null&&typeof h!="function"&&typeof h!="symbol"?t.setAttribute(a,""+h):t.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":h&&typeof h!="function"&&typeof h!="symbol"?t.setAttribute(a,""):t.removeAttribute(a);break;case"capture":case"download":h===!0?t.setAttribute(a,""):h!==!1&&h!=null&&typeof h!="function"&&typeof h!="symbol"?t.setAttribute(a,h):t.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":h!=null&&typeof h!="function"&&typeof h!="symbol"&&!isNaN(h)&&1<=h?t.setAttribute(a,h):t.removeAttribute(a);break;case"rowSpan":case"start":h==null||typeof h=="function"||typeof h=="symbol"||isNaN(h)?t.removeAttribute(a):t.setAttribute(a,h);break;case"popover":Je("beforetoggle",t),Je("toggle",t),so(t,"popover",h);break;case"xlinkActuate":lr(t,"http://www.w3.org/1999/xlink","xlink:actuate",h);break;case"xlinkArcrole":lr(t,"http://www.w3.org/1999/xlink","xlink:arcrole",h);break;case"xlinkRole":lr(t,"http://www.w3.org/1999/xlink","xlink:role",h);break;case"xlinkShow":lr(t,"http://www.w3.org/1999/xlink","xlink:show",h);break;case"xlinkTitle":lr(t,"http://www.w3.org/1999/xlink","xlink:title",h);break;case"xlinkType":lr(t,"http://www.w3.org/1999/xlink","xlink:type",h);break;case"xmlBase":lr(t,"http://www.w3.org/XML/1998/namespace","xml:base",h);break;case"xmlLang":lr(t,"http://www.w3.org/XML/1998/namespace","xml:lang",h);break;case"xmlSpace":lr(t,"http://www.w3.org/XML/1998/namespace","xml:space",h);break;case"is":so(t,"is",h);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=C0.get(a)||a,so(t,a,h))}}function ed(t,n,a,h,w,E){switch(a){case"style":Ef(t,h,E);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(s(61));if(a=h.__html,a!=null){if(w.children!=null)throw Error(s(60));t.innerHTML=a}}break;case"children":typeof h=="string"?Gi(t,h):(typeof h=="number"||typeof h=="bigint")&&Gi(t,""+h);break;case"onScroll":h!=null&&Je("scroll",t);break;case"onScrollEnd":h!=null&&Je("scrollend",t);break;case"onClick":h!=null&&(t.onclick=cr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!xf.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(w=a.endsWith("Capture"),n=a.slice(2,w?a.length-7:void 0),E=t[fn]||null,E=E!=null?E[a]:null,typeof E=="function"&&t.removeEventListener(n,E,w),typeof h=="function")){typeof E!="function"&&E!==null&&(a in t?t[a]=null:t.hasAttribute(a)&&t.removeAttribute(a)),t.addEventListener(n,h,w);break e}a in t?t[a]=h:h===!0?t.setAttribute(a,""):so(t,a,h)}}}function nn(t,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Je("error",t),Je("load",t);var h=!1,w=!1,E;for(E in a)if(a.hasOwnProperty(E)){var R=a[E];if(R!=null)switch(E){case"src":h=!0;break;case"srcSet":w=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,n));default:gt(t,n,E,R,a,null)}}w&>(t,n,"srcSet",a.srcSet,a,null),h&>(t,n,"src",a.src,a,null);return;case"input":Je("invalid",t);var G=E=R=w=null,J=null,le=null;for(h in a)if(a.hasOwnProperty(h)){var he=a[h];if(he!=null)switch(h){case"name":w=he;break;case"type":R=he;break;case"checked":J=he;break;case"defaultChecked":le=he;break;case"value":E=he;break;case"defaultValue":G=he;break;case"children":case"dangerouslySetInnerHTML":if(he!=null)throw Error(s(137,n));break;default:gt(t,n,h,he,a,null)}}Sf(t,E,G,J,le,R,w,!1);return;case"select":Je("invalid",t),h=R=E=null;for(w in a)if(a.hasOwnProperty(w)&&(G=a[w],G!=null))switch(w){case"value":E=G;break;case"defaultValue":R=G;break;case"multiple":h=G;default:gt(t,n,w,G,a,null)}n=E,a=R,t.multiple=!!h,n!=null?Wi(t,!!h,n,!1):a!=null&&Wi(t,!!h,a,!0);return;case"textarea":Je("invalid",t),E=w=h=null;for(R in a)if(a.hasOwnProperty(R)&&(G=a[R],G!=null))switch(R){case"value":h=G;break;case"defaultValue":w=G;break;case"children":E=G;break;case"dangerouslySetInnerHTML":if(G!=null)throw Error(s(91));break;default:gt(t,n,R,G,a,null)}Cf(t,h,w,E);return;case"option":for(J in a)if(a.hasOwnProperty(J)&&(h=a[J],h!=null))switch(J){case"selected":t.selected=h&&typeof h!="function"&&typeof h!="symbol";break;default:gt(t,n,J,h,a,null)}return;case"dialog":Je("beforetoggle",t),Je("toggle",t),Je("cancel",t),Je("close",t);break;case"iframe":case"object":Je("load",t);break;case"video":case"audio":for(h=0;h<va.length;h++)Je(va[h],t);break;case"image":Je("error",t),Je("load",t);break;case"details":Je("toggle",t);break;case"embed":case"source":case"link":Je("error",t),Je("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(le in a)if(a.hasOwnProperty(le)&&(h=a[le],h!=null))switch(le){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,n));default:gt(t,n,le,h,a,null)}return;default:if(pc(n)){for(he in a)a.hasOwnProperty(he)&&(h=a[he],h!==void 0&&ed(t,n,he,h,a,void 0));return}}for(G in a)a.hasOwnProperty(G)&&(h=a[G],h!=null&>(t,n,G,h,a,null))}function Z_(t,n,a,h){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var w=null,E=null,R=null,G=null,J=null,le=null,he=null;for(de in a){var xe=a[de];if(a.hasOwnProperty(de)&&xe!=null)switch(de){case"checked":break;case"value":break;case"defaultValue":J=xe;default:h.hasOwnProperty(de)||gt(t,n,de,null,h,xe)}}for(var ce in h){var de=h[ce];if(xe=a[ce],h.hasOwnProperty(ce)&&(de!=null||xe!=null))switch(ce){case"type":E=de;break;case"name":w=de;break;case"checked":le=de;break;case"defaultChecked":he=de;break;case"value":R=de;break;case"defaultValue":G=de;break;case"children":case"dangerouslySetInnerHTML":if(de!=null)throw Error(s(137,n));break;default:de!==xe&>(t,n,ce,de,h,xe)}}hc(t,R,G,J,le,he,E,w);return;case"select":de=R=G=ce=null;for(E in a)if(J=a[E],a.hasOwnProperty(E)&&J!=null)switch(E){case"value":break;case"multiple":de=J;default:h.hasOwnProperty(E)||gt(t,n,E,null,h,J)}for(w in h)if(E=h[w],J=a[w],h.hasOwnProperty(w)&&(E!=null||J!=null))switch(w){case"value":ce=E;break;case"defaultValue":G=E;break;case"multiple":R=E;default:E!==J&>(t,n,w,E,h,J)}n=G,a=R,h=de,ce!=null?Wi(t,!!a,ce,!1):!!h!=!!a&&(n!=null?Wi(t,!!a,n,!0):Wi(t,!!a,a?[]:"",!1));return;case"textarea":de=ce=null;for(G in a)if(w=a[G],a.hasOwnProperty(G)&&w!=null&&!h.hasOwnProperty(G))switch(G){case"value":break;case"children":break;default:gt(t,n,G,null,h,w)}for(R in h)if(w=h[R],E=a[R],h.hasOwnProperty(R)&&(w!=null||E!=null))switch(R){case"value":ce=w;break;case"defaultValue":de=w;break;case"children":break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(s(91));break;default:w!==E&>(t,n,R,w,h,E)}wf(t,ce,de);return;case"option":for(var De in a)if(ce=a[De],a.hasOwnProperty(De)&&ce!=null&&!h.hasOwnProperty(De))switch(De){case"selected":t.selected=!1;break;default:gt(t,n,De,null,h,ce)}for(J in h)if(ce=h[J],de=a[J],h.hasOwnProperty(J)&&ce!==de&&(ce!=null||de!=null))switch(J){case"selected":t.selected=ce&&typeof ce!="function"&&typeof ce!="symbol";break;default:gt(t,n,J,ce,h,de)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Pe in a)ce=a[Pe],a.hasOwnProperty(Pe)&&ce!=null&&!h.hasOwnProperty(Pe)&>(t,n,Pe,null,h,ce);for(le in h)if(ce=h[le],de=a[le],h.hasOwnProperty(le)&&ce!==de&&(ce!=null||de!=null))switch(le){case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(s(137,n));break;default:gt(t,n,le,ce,h,de)}return;default:if(pc(n)){for(var xt in a)ce=a[xt],a.hasOwnProperty(xt)&&ce!==void 0&&!h.hasOwnProperty(xt)&&ed(t,n,xt,void 0,h,ce);for(he in h)ce=h[he],de=a[he],!h.hasOwnProperty(he)||ce===de||ce===void 0&&de===void 0||ed(t,n,he,ce,h,de);return}}for(var ie in a)ce=a[ie],a.hasOwnProperty(ie)&&ce!=null&&!h.hasOwnProperty(ie)&>(t,n,ie,null,h,ce);for(xe in h)ce=h[xe],de=a[xe],!h.hasOwnProperty(xe)||ce===de||ce==null&&de==null||gt(t,n,xe,ce,h,de)}function jg(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Q_(){if(typeof performance.getEntriesByType=="function"){for(var t=0,n=0,a=performance.getEntriesByType("resource"),h=0;h<a.length;h++){var w=a[h],E=w.transferSize,R=w.initiatorType,G=w.duration;if(E&&G&&jg(R)){for(R=0,G=w.responseEnd,h+=1;h<a.length;h++){var J=a[h],le=J.startTime;if(le>G)break;var he=J.transferSize,xe=J.initiatorType;he&&jg(xe)&&(J=J.responseEnd,R+=he*(J<G?1:(G-le)/(J-le)))}if(--h,n+=8*(E+R)/(w.duration/1e3),t++,10<t)break}}if(0<t)return n/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var td=null,nd=null;function il(t){return t.nodeType===9?t:t.ownerDocument}function Ng(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Tg(t,n){if(t===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&n==="foreignObject"?0:t}function rd(t,n){return t==="textarea"||t==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var id=null;function J_(){var t=window.event;return t&&t.type==="popstate"?t===id?!1:(id=t,!0):(id=null,!1)}var Ag=typeof setTimeout=="function"?setTimeout:void 0,e1=typeof clearTimeout=="function"?clearTimeout:void 0,Dg=typeof Promise=="function"?Promise:void 0,t1=typeof queueMicrotask=="function"?queueMicrotask:typeof Dg<"u"?function(t){return Dg.resolve(null).then(t).catch(n1)}:Ag;function n1(t){setTimeout(function(){throw t})}function Yr(t){return t==="head"}function Lg(t,n){var a=n,h=0;do{var w=a.nextSibling;if(t.removeChild(a),w&&w.nodeType===8)if(a=w.data,a==="/$"||a==="/&"){if(h===0){t.removeChild(w),ws(n);return}h--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")h++;else if(a==="html")ya(t.ownerDocument.documentElement);else if(a==="head"){a=t.ownerDocument.head,ya(a);for(var E=a.firstChild;E;){var R=E.nextSibling,G=E.nodeName;E[zs]||G==="SCRIPT"||G==="STYLE"||G==="LINK"&&E.rel.toLowerCase()==="stylesheet"||a.removeChild(E),E=R}}else a==="body"&&ya(t.ownerDocument.body);a=w}while(a);ws(n)}function Rg(t,n){var a=t;t=0;do{var h=a.nextSibling;if(a.nodeType===1?n?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(n?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),h&&h.nodeType===8)if(a=h.data,a==="/$"){if(t===0)break;t--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||t++;a=h}while(a)}function sd(t){var n=t.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var a=n;switch(n=n.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":sd(a),uc(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}t.removeChild(a)}}function r1(t,n,a,h){for(;t.nodeType===1;){var w=a;if(t.nodeName.toLowerCase()!==n.toLowerCase()){if(!h&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(h){if(!t[zs])switch(n){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(E=t.getAttribute("rel"),E==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(E!==w.rel||t.getAttribute("href")!==(w.href==null||w.href===""?null:w.href)||t.getAttribute("crossorigin")!==(w.crossOrigin==null?null:w.crossOrigin)||t.getAttribute("title")!==(w.title==null?null:w.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(E=t.getAttribute("src"),(E!==(w.src==null?null:w.src)||t.getAttribute("type")!==(w.type==null?null:w.type)||t.getAttribute("crossorigin")!==(w.crossOrigin==null?null:w.crossOrigin))&&E&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(n==="input"&&t.type==="hidden"){var E=w.name==null?null:""+w.name;if(w.type==="hidden"&&t.getAttribute("name")===E)return t}else return t;if(t=Un(t.nextSibling),t===null)break}return null}function i1(t,n,a){if(n==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!a||(t=Un(t.nextSibling),t===null))return null;return t}function Mg(t,n){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!n||(t=Un(t.nextSibling),t===null))return null;return t}function ad(t){return t.data==="$?"||t.data==="$~"}function od(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function s1(t,n){var a=t.ownerDocument;if(t.data==="$~")t._reactRetry=n;else if(t.data!=="$?"||a.readyState!=="loading")n();else{var h=function(){n(),a.removeEventListener("DOMContentLoaded",h)};a.addEventListener("DOMContentLoaded",h),t._reactRetry=h}}function Un(t){for(;t!=null;t=t.nextSibling){var n=t.nodeType;if(n===1||n===3)break;if(n===8){if(n=t.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return t}var ld=null;function Og(t){t=t.nextSibling;for(var n=0;t;){if(t.nodeType===8){var a=t.data;if(a==="/$"||a==="/&"){if(n===0)return Un(t.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}t=t.nextSibling}return null}function Bg(t){t=t.previousSibling;for(var n=0;t;){if(t.nodeType===8){var a=t.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(n===0)return t;n--}else a!=="/$"&&a!=="/&"||n++}t=t.previousSibling}return null}function Ig(t,n,a){switch(n=il(a),t){case"html":if(t=n.documentElement,!t)throw Error(s(452));return t;case"head":if(t=n.head,!t)throw Error(s(453));return t;case"body":if(t=n.body,!t)throw Error(s(454));return t;default:throw Error(s(451))}}function ya(t){for(var n=t.attributes;n.length;)t.removeAttributeNode(n[0]);uc(t)}var $n=new Map,zg=new Set;function sl(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var kr=X.d;X.d={f:a1,r:o1,D:l1,C:c1,L:u1,m:d1,X:f1,S:h1,M:p1};function a1(){var t=kr.f(),n=Xo();return t||n}function o1(t){var n=Ui(t);n!==null&&n.tag===5&&n.type==="form"?tm(n):kr.r(t)}var ys=typeof document>"u"?null:document;function Hg(t,n,a){var h=ys;if(h&&typeof n=="string"&&n){var w=On(n);w='link[rel="'+t+'"][href="'+w+'"]',typeof a=="string"&&(w+='[crossorigin="'+a+'"]'),zg.has(w)||(zg.add(w),t={rel:t,crossOrigin:a,href:n},h.querySelector(w)===null&&(n=h.createElement("link"),nn(n,"link",t),Yt(n),h.head.appendChild(n)))}}function l1(t){kr.D(t),Hg("dns-prefetch",t,null)}function c1(t,n){kr.C(t,n),Hg("preconnect",t,n)}function u1(t,n,a){kr.L(t,n,a);var h=ys;if(h&&t&&n){var w='link[rel="preload"][as="'+On(n)+'"]';n==="image"&&a&&a.imageSrcSet?(w+='[imagesrcset="'+On(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(w+='[imagesizes="'+On(a.imageSizes)+'"]')):w+='[href="'+On(t)+'"]';var E=w;switch(n){case"style":E=_s(t);break;case"script":E=Ss(t)}$n.has(E)||(t=m({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:t,as:n},a),$n.set(E,t),h.querySelector(w)!==null||n==="style"&&h.querySelector(_a(E))||n==="script"&&h.querySelector(Sa(E))||(n=h.createElement("link"),nn(n,"link",t),Yt(n),h.head.appendChild(n)))}}function d1(t,n){kr.m(t,n);var a=ys;if(a&&t){var h=n&&typeof n.as=="string"?n.as:"script",w='link[rel="modulepreload"][as="'+On(h)+'"][href="'+On(t)+'"]',E=w;switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":E=Ss(t)}if(!$n.has(E)&&(t=m({rel:"modulepreload",href:t},n),$n.set(E,t),a.querySelector(w)===null)){switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Sa(E)))return}h=a.createElement("link"),nn(h,"link",t),Yt(h),a.head.appendChild(h)}}}function h1(t,n,a){kr.S(t,n,a);var h=ys;if(h&&t){var w=$i(h).hoistableStyles,E=_s(t);n=n||"default";var R=w.get(E);if(!R){var G={loading:0,preload:null};if(R=h.querySelector(_a(E)))G.loading=5;else{t=m({rel:"stylesheet",href:t,"data-precedence":n},a),(a=$n.get(E))&&cd(t,a);var J=R=h.createElement("link");Yt(J),nn(J,"link",t),J._p=new Promise(function(le,he){J.onload=le,J.onerror=he}),J.addEventListener("load",function(){G.loading|=1}),J.addEventListener("error",function(){G.loading|=2}),G.loading|=4,al(R,n,h)}R={type:"stylesheet",instance:R,count:1,state:G},w.set(E,R)}}}function f1(t,n){kr.X(t,n);var a=ys;if(a&&t){var h=$i(a).hoistableScripts,w=Ss(t),E=h.get(w);E||(E=a.querySelector(Sa(w)),E||(t=m({src:t,async:!0},n),(n=$n.get(w))&&ud(t,n),E=a.createElement("script"),Yt(E),nn(E,"link",t),a.head.appendChild(E)),E={type:"script",instance:E,count:1,state:null},h.set(w,E))}}function p1(t,n){kr.M(t,n);var a=ys;if(a&&t){var h=$i(a).hoistableScripts,w=Ss(t),E=h.get(w);E||(E=a.querySelector(Sa(w)),E||(t=m({src:t,async:!0,type:"module"},n),(n=$n.get(w))&&ud(t,n),E=a.createElement("script"),Yt(E),nn(E,"link",t),a.head.appendChild(E)),E={type:"script",instance:E,count:1,state:null},h.set(w,E))}}function Pg(t,n,a,h){var w=(w=ee.current)?sl(w):null;if(!w)throw Error(s(446));switch(t){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(n=_s(a.href),a=$i(w).hoistableStyles,h=a.get(n),h||(h={type:"style",instance:null,count:0,state:null},a.set(n,h)),h):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){t=_s(a.href);var E=$i(w).hoistableStyles,R=E.get(t);if(R||(w=w.ownerDocument||w,R={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},E.set(t,R),(E=w.querySelector(_a(t)))&&!E._p&&(R.instance=E,R.state.loading=5),$n.has(t)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},$n.set(t,a),E||m1(w,t,a,R.state))),n&&h===null)throw Error(s(528,""));return R}if(n&&h!==null)throw Error(s(529,""));return null;case"script":return n=a.async,a=a.src,typeof a=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=Ss(a),a=$i(w).hoistableScripts,h=a.get(n),h||(h={type:"script",instance:null,count:0,state:null},a.set(n,h)),h):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,t))}}function _s(t){return'href="'+On(t)+'"'}function _a(t){return'link[rel="stylesheet"]['+t+"]"}function Fg(t){return m({},t,{"data-precedence":t.precedence,precedence:null})}function m1(t,n,a,h){t.querySelector('link[rel="preload"][as="style"]['+n+"]")?h.loading=1:(n=t.createElement("link"),h.preload=n,n.addEventListener("load",function(){return h.loading|=1}),n.addEventListener("error",function(){return h.loading|=2}),nn(n,"link",a),Yt(n),t.head.appendChild(n))}function Ss(t){return'[src="'+On(t)+'"]'}function Sa(t){return"script[async]"+t}function Ug(t,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var h=t.querySelector('style[data-href~="'+On(a.href)+'"]');if(h)return n.instance=h,Yt(h),h;var w=m({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return h=(t.ownerDocument||t).createElement("style"),Yt(h),nn(h,"style",w),al(h,a.precedence,t),n.instance=h;case"stylesheet":w=_s(a.href);var E=t.querySelector(_a(w));if(E)return n.state.loading|=4,n.instance=E,Yt(E),E;h=Fg(a),(w=$n.get(w))&&cd(h,w),E=(t.ownerDocument||t).createElement("link"),Yt(E);var R=E;return R._p=new Promise(function(G,J){R.onload=G,R.onerror=J}),nn(E,"link",h),n.state.loading|=4,al(E,a.precedence,t),n.instance=E;case"script":return E=Ss(a.src),(w=t.querySelector(Sa(E)))?(n.instance=w,Yt(w),w):(h=a,(w=$n.get(E))&&(h=m({},a),ud(h,w)),t=t.ownerDocument||t,w=t.createElement("script"),Yt(w),nn(w,"link",h),t.head.appendChild(w),n.instance=w);case"void":return null;default:throw Error(s(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(h=n.instance,n.state.loading|=4,al(h,a.precedence,t));return n.instance}function al(t,n,a){for(var h=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),w=h.length?h[h.length-1]:null,E=w,R=0;R<h.length;R++){var G=h[R];if(G.dataset.precedence===n)E=G;else if(E!==w)break}E?E.parentNode.insertBefore(t,E.nextSibling):(n=a.nodeType===9?a.head:a,n.insertBefore(t,n.firstChild))}function cd(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.title==null&&(t.title=n.title)}function ud(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.integrity==null&&(t.integrity=n.integrity)}var ol=null;function $g(t,n,a){if(ol===null){var h=new Map,w=ol=new Map;w.set(a,h)}else w=ol,h=w.get(a),h||(h=new Map,w.set(a,h));if(h.has(t))return h;for(h.set(t,null),a=a.getElementsByTagName(t),w=0;w<a.length;w++){var E=a[w];if(!(E[zs]||E[Qt]||t==="link"&&E.getAttribute("rel")==="stylesheet")&&E.namespaceURI!=="http://www.w3.org/2000/svg"){var R=E.getAttribute(n)||"";R=t+R;var G=h.get(R);G?G.push(E):h.set(R,[E])}}return h}function qg(t,n,a){t=t.ownerDocument||t,t.head.insertBefore(a,n==="title"?t.querySelector("head > title"):null)}function g1(t,n,a){if(a===1||n.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return t=n.disabled,typeof n.precedence=="string"&&t==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function Wg(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function x1(t,n,a,h){if(a.type==="stylesheet"&&(typeof h.media!="string"||matchMedia(h.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var w=_s(h.href),E=n.querySelector(_a(w));if(E){n=E._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(t.count++,t=ll.bind(t),n.then(t,t)),a.state.loading|=4,a.instance=E,Yt(E);return}E=n.ownerDocument||n,h=Fg(h),(w=$n.get(w))&&cd(h,w),E=E.createElement("link"),Yt(E);var R=E;R._p=new Promise(function(G,J){R.onload=G,R.onerror=J}),nn(E,"link",h),a.instance=E}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(a,n),(n=a.state.preload)&&(a.state.loading&3)===0&&(t.count++,a=ll.bind(t),n.addEventListener("load",a),n.addEventListener("error",a))}}var dd=0;function v1(t,n){return t.stylesheets&&t.count===0&&ul(t,t.stylesheets),0<t.count||0<t.imgCount?function(a){var h=setTimeout(function(){if(t.stylesheets&&ul(t,t.stylesheets),t.unsuspend){var E=t.unsuspend;t.unsuspend=null,E()}},6e4+n);0<t.imgBytes&&dd===0&&(dd=62500*Q_());var w=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&ul(t,t.stylesheets),t.unsuspend)){var E=t.unsuspend;t.unsuspend=null,E()}},(t.imgBytes>dd?50:800)+n);return t.unsuspend=a,function(){t.unsuspend=null,clearTimeout(h),clearTimeout(w)}}:null}function ll(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ul(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var cl=null;function ul(t,n){t.stylesheets=null,t.unsuspend!==null&&(t.count++,cl=new Map,n.forEach(b1,t),cl=null,ll.call(t))}function b1(t,n){if(!(n.state.loading&4)){var a=cl.get(t);if(a)var h=a.get(null);else{a=new Map,cl.set(t,a);for(var w=t.querySelectorAll("link[data-precedence],style[data-precedence]"),E=0;E<w.length;E++){var R=w[E];(R.nodeName==="LINK"||R.getAttribute("media")!=="not all")&&(a.set(R.dataset.precedence,R),h=R)}h&&a.set(null,h)}w=n.instance,R=w.getAttribute("data-precedence"),E=a.get(R)||h,E===h&&a.set(null,w),a.set(R,w),this.count++,h=ll.bind(this),w.addEventListener("load",h),w.addEventListener("error",h),E?E.parentNode.insertBefore(w,E.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(w,t.firstChild)),n.state.loading|=4}}var wa={$$typeof:S,Provider:null,Consumer:null,_currentValue:Q,_currentValue2:Q,_threadCount:0};function y1(t,n,a,h,w,E,R,G,J){this.tag=1,this.containerInfo=t,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=$t(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=$t(0),this.hiddenUpdates=$t(null),this.identifierPrefix=h,this.onUncaughtError=w,this.onCaughtError=E,this.onRecoverableError=R,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=J,this.incompleteTransitions=new Map}function Gg(t,n,a,h,w,E,R,G,J,le,he,xe){return t=new y1(t,n,a,R,J,le,he,xe,G),n=1,E===!0&&(n|=24),E=wn(3,null,null,n),t.current=E,E.stateNode=t,n=qc(),n.refCount++,t.pooledCache=n,n.refCount++,E.memoizedState={element:h,isDehydrated:a,cache:n},Yc(E),t}function Vg(t){return t?(t=Ji,t):Ji}function Yg(t,n,a,h,w,E){w=Vg(w),h.context===null?h.context=w:h.pendingContext=w,h=Ir(n),h.payload={element:a},E=E===void 0?null:E,E!==null&&(h.callback=E),a=zr(t,h,n),a!==null&&(bn(a,t,n),ta(a,t,n))}function Kg(t,n){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var a=t.retryLane;t.retryLane=a!==0&&a<n?a:n}}function hd(t,n){Kg(t,n),(t=t.alternate)&&Kg(t,n)}function Xg(t){if(t.tag===13||t.tag===31){var n=hi(t,67108864);n!==null&&bn(n,t,67108864),hd(t,67108864)}}function Zg(t){if(t.tag===13||t.tag===31){var n=Nn();n=oc(n);var a=hi(t,n);a!==null&&bn(a,t,n),hd(t,n)}}var dl=!0;function _1(t,n,a,h){var w=z.T;z.T=null;var E=X.p;try{X.p=2,fd(t,n,a,h)}finally{X.p=E,z.T=w}}function S1(t,n,a,h){var w=z.T;z.T=null;var E=X.p;try{X.p=8,fd(t,n,a,h)}finally{X.p=E,z.T=w}}function fd(t,n,a,h){if(dl){var w=pd(h);if(w===null)Ju(t,n,h,hl,a),Jg(t,h);else if(C1(w,t,n,a,h))h.stopPropagation();else if(Jg(t,h),n&4&&-1<w1.indexOf(t)){for(;w!==null;){var E=Ui(w);if(E!==null)switch(E.tag){case 3:if(E=E.stateNode,E.current.memoizedState.isDehydrated){var R=Ye(E.pendingLanes);if(R!==0){var G=E;for(G.pendingLanes|=2,G.entangledLanes|=2;R;){var J=1<<31-qe(R);G.entanglements[1]|=J,R&=~J}er(E),(dt&6)===0&&(Yo=Oe()+500,xa(0))}}break;case 31:case 13:G=hi(E,2),G!==null&&bn(G,E,2),Xo(),hd(E,2)}if(E=pd(h),E===null&&Ju(t,n,h,hl,a),E===w)break;w=E}w!==null&&h.stopPropagation()}else Ju(t,n,h,null,a)}}function pd(t){return t=gc(t),md(t)}var hl=null;function md(t){if(hl=null,t=Fi(t),t!==null){var n=u(t);if(n===null)t=null;else{var a=n.tag;if(a===13){if(t=f(n),t!==null)return t;t=null}else if(a===31){if(t=l(n),t!==null)return t;t=null}else if(a===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;t=null}else n!==t&&(t=null)}}return hl=t,null}function Qg(t){switch(t){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(lt()){case ue:return 2;case _e:return 8;case Te:case Be:return 32;case Ve:return 268435456;default:return 32}default:return 32}}var gd=!1,Kr=null,Xr=null,Zr=null,Ca=new Map,ka=new Map,Qr=[],w1="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Jg(t,n){switch(t){case"focusin":case"focusout":Kr=null;break;case"dragenter":case"dragleave":Xr=null;break;case"mouseover":case"mouseout":Zr=null;break;case"pointerover":case"pointerout":Ca.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":ka.delete(n.pointerId)}}function Ea(t,n,a,h,w,E){return t===null||t.nativeEvent!==E?(t={blockedOn:n,domEventName:a,eventSystemFlags:h,nativeEvent:E,targetContainers:[w]},n!==null&&(n=Ui(n),n!==null&&Xg(n)),t):(t.eventSystemFlags|=h,n=t.targetContainers,w!==null&&n.indexOf(w)===-1&&n.push(w),t)}function C1(t,n,a,h,w){switch(n){case"focusin":return Kr=Ea(Kr,t,n,a,h,w),!0;case"dragenter":return Xr=Ea(Xr,t,n,a,h,w),!0;case"mouseover":return Zr=Ea(Zr,t,n,a,h,w),!0;case"pointerover":var E=w.pointerId;return Ca.set(E,Ea(Ca.get(E)||null,t,n,a,h,w)),!0;case"gotpointercapture":return E=w.pointerId,ka.set(E,Ea(ka.get(E)||null,t,n,a,h,w)),!0}return!1}function ex(t){var n=Fi(t.target);if(n!==null){var a=u(n);if(a!==null){if(n=a.tag,n===13){if(n=f(a),n!==null){t.blockedOn=n,pf(t.priority,function(){Zg(a)});return}}else if(n===31){if(n=l(a),n!==null){t.blockedOn=n,pf(t.priority,function(){Zg(a)});return}}else if(n===3&&a.stateNode.current.memoizedState.isDehydrated){t.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}t.blockedOn=null}function fl(t){if(t.blockedOn!==null)return!1;for(var n=t.targetContainers;0<n.length;){var a=pd(t.nativeEvent);if(a===null){a=t.nativeEvent;var h=new a.constructor(a.type,a);mc=h,a.target.dispatchEvent(h),mc=null}else return n=Ui(a),n!==null&&Xg(n),t.blockedOn=a,!1;n.shift()}return!0}function tx(t,n,a){fl(t)&&a.delete(n)}function k1(){gd=!1,Kr!==null&&fl(Kr)&&(Kr=null),Xr!==null&&fl(Xr)&&(Xr=null),Zr!==null&&fl(Zr)&&(Zr=null),Ca.forEach(tx),ka.forEach(tx)}function pl(t,n){t.blockedOn===n&&(t.blockedOn=null,gd||(gd=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,k1)))}var ml=null;function nx(t){ml!==t&&(ml=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){ml===t&&(ml=null);for(var n=0;n<t.length;n+=3){var a=t[n],h=t[n+1],w=t[n+2];if(typeof h!="function"){if(md(h||a)===null)continue;break}var E=Ui(a);E!==null&&(t.splice(n,3),n-=3,pu(E,{pending:!0,data:w,method:a.method,action:h},h,w))}}))}function ws(t){function n(J){return pl(J,t)}Kr!==null&&pl(Kr,t),Xr!==null&&pl(Xr,t),Zr!==null&&pl(Zr,t),Ca.forEach(n),ka.forEach(n);for(var a=0;a<Qr.length;a++){var h=Qr[a];h.blockedOn===t&&(h.blockedOn=null)}for(;0<Qr.length&&(a=Qr[0],a.blockedOn===null);)ex(a),a.blockedOn===null&&Qr.shift();if(a=(t.ownerDocument||t).$$reactFormReplay,a!=null)for(h=0;h<a.length;h+=3){var w=a[h],E=a[h+1],R=w[fn]||null;if(typeof E=="function")R||nx(a);else if(R){var G=null;if(E&&E.hasAttribute("formAction")){if(w=E,R=E[fn]||null)G=R.formAction;else if(md(w)!==null)continue}else G=R.action;typeof G=="function"?a[h+1]=G:(a.splice(h,3),h-=3),nx(a)}}}function rx(){function t(E){E.canIntercept&&E.info==="react-transition"&&E.intercept({handler:function(){return new Promise(function(R){return w=R})},focusReset:"manual",scroll:"manual"})}function n(){w!==null&&(w(),w=null),h||setTimeout(a,20)}function a(){if(!h&&!navigation.transition){var E=navigation.currentEntry;E&&E.url!=null&&navigation.navigate(E.url,{state:E.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var h=!1,w=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(a,100),function(){h=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),w!==null&&(w(),w=null)}}}function xd(t){this._internalRoot=t}gl.prototype.render=xd.prototype.render=function(t){var n=this._internalRoot;if(n===null)throw Error(s(409));var a=n.current,h=Nn();Yg(a,h,t,n,null,null)},gl.prototype.unmount=xd.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var n=t.containerInfo;Yg(t.current,2,null,t,null,null),Xo(),n[Pi]=null}};function gl(t){this._internalRoot=t}gl.prototype.unstable_scheduleHydration=function(t){if(t){var n=ff();t={blockedOn:null,target:t,priority:n};for(var a=0;a<Qr.length&&n!==0&&n<Qr[a].priority;a++);Qr.splice(a,0,t),a===0&&ex(t)}};var ix=r.version;if(ix!=="19.2.4")throw Error(s(527,ix,"19.2.4"));X.findDOMNode=function(t){var n=t._reactInternals;if(n===void 0)throw typeof t.render=="function"?Error(s(188)):(t=Object.keys(t).join(","),Error(s(268,t)));return t=p(n),t=t!==null?g(t):null,t=t===null?null:t.stateNode,t};var E1={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:z,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var xl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!xl.isDisabled&&xl.supportsFiber)try{Le=xl.inject(E1),$e=xl}catch{}}return Na.createRoot=function(t,n){if(!c(t))throw Error(s(299));var a=!1,h="",w=dm,E=hm,R=fm;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(h=n.identifierPrefix),n.onUncaughtError!==void 0&&(w=n.onUncaughtError),n.onCaughtError!==void 0&&(E=n.onCaughtError),n.onRecoverableError!==void 0&&(R=n.onRecoverableError)),n=Gg(t,1,!1,null,null,a,h,null,w,E,R,rx),t[Pi]=n.current,Qu(t),new xd(n)},Na.hydrateRoot=function(t,n,a){if(!c(t))throw Error(s(299));var h=!1,w="",E=dm,R=hm,G=fm,J=null;return a!=null&&(a.unstable_strictMode===!0&&(h=!0),a.identifierPrefix!==void 0&&(w=a.identifierPrefix),a.onUncaughtError!==void 0&&(E=a.onUncaughtError),a.onCaughtError!==void 0&&(R=a.onCaughtError),a.onRecoverableError!==void 0&&(G=a.onRecoverableError),a.formState!==void 0&&(J=a.formState)),n=Gg(t,1,!0,n,a??null,h,w,J,E,R,G,rx),n.context=Vg(null),a=n.current,h=Nn(),h=oc(h),w=Ir(h),w.callback=null,zr(a,w,h),a=h,n.current.lanes=a,Hi(n,a),er(n),t[Pi]=n.current,Qu(t),new gl(n)},Na.version="19.2.4",Na}var px;function H1(){if(px)return yd.exports;px=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(r){console.error(r)}}return e(),yd.exports=z1(),yd.exports}var P1=H1();const F1=Pl(P1);function U1(e,r){if(e instanceof RegExp)return{keys:!1,pattern:e};var i,s,c,u,f=[],l="",d=e.split("/");for(d[0]||d.shift();c=d.shift();)i=c[0],i==="*"?(f.push(i),l+=c[1]==="?"?"(?:/(.*))?":"/(.*)"):i===":"?(s=c.indexOf("?",1),u=c.indexOf(".",1),f.push(c.substring(1,~s?s:~u?u:c.length)),l+=~s&&!~u?"(?:/([^/]+?))?":"/([^/]+?)",~u&&(l+=(~s?"?":"")+"\\"+c.substring(u))):l+="/"+c;return{keys:f,pattern:new RegExp("^"+l+(r?"(?=$|/)":"/?$"),"i")}}var Cd={exports:{}},kd={};/**
|
|
50
|
+
* @license React
|
|
51
|
+
* use-sync-external-store-shim.production.js
|
|
52
|
+
*
|
|
53
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
54
|
+
*
|
|
55
|
+
* This source code is licensed under the MIT license found in the
|
|
56
|
+
* LICENSE file in the root directory of this source tree.
|
|
57
|
+
*/var mx;function $1(){if(mx)return kd;mx=1;var e=Fl();function r(m,y){return m===y&&(m!==0||1/m===1/y)||m!==m&&y!==y}var i=typeof Object.is=="function"?Object.is:r,s=e.useState,c=e.useEffect,u=e.useLayoutEffect,f=e.useDebugValue;function l(m,y){var _=y(),k=s({inst:{value:_,getSnapshot:y}}),C=k[0].inst,v=k[1];return u(function(){C.value=_,C.getSnapshot=y,d(C)&&v({inst:C})},[m,_,y]),c(function(){return d(C)&&v({inst:C}),m(function(){d(C)&&v({inst:C})})},[m]),f(_),_}function d(m){var y=m.getSnapshot;m=m.value;try{var _=y();return!i(m,_)}catch{return!0}}function p(m,y){return y()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:l;return kd.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,kd}var gx;function q1(){return gx||(gx=1,Cd.exports=$1()),Cd.exports}var W1=q1();const G1=M1.useInsertionEffect,V1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Y1=V1?P.useLayoutEffect:P.useEffect,K1=G1||Y1,ib=e=>{const r=P.useRef([e,(...i)=>r[0](...i)]).current;return K1(()=>{r[0]=e}),r[1]},X1="popstate",gh="pushState",xh="replaceState",Z1="hashchange",xx=[X1,gh,xh,Z1],Q1=e=>{for(const r of xx)addEventListener(r,e);return()=>{for(const r of xx)removeEventListener(r,e)}},sb=(e,r)=>W1.useSyncExternalStore(Q1,e,r),vx=()=>location.search,J1=({ssrSearch:e}={})=>sb(vx,e!=null?()=>e:vx),bx=()=>location.pathname,eS=({ssrPath:e}={})=>sb(bx,e!=null?()=>e:bx),tS=(e,{replace:r=!1,state:i=null}={})=>history[r?xh:gh](i,"",e),nS=(e={})=>[eS(e),tS],yx=Symbol.for("wouter_v3");if(typeof history<"u"&&typeof window[yx]>"u"){for(const e of[gh,xh]){const r=history[e];history[e]=function(){const i=r.apply(this,arguments),s=new Event(e);return s.arguments=arguments,dispatchEvent(s),i}}Object.defineProperty(window,yx,{value:!0})}const rS=(e,r)=>r.toLowerCase().indexOf(e.toLowerCase())?"~"+r:r.slice(e.length)||"/",ab=(e="")=>e==="/"?"":e,iS=(e,r)=>e[0]==="~"?e.slice(1):ab(r)+e,sS=(e="",r)=>rS(_x(ab(e)),_x(r)),_x=e=>{try{return decodeURI(e)}catch{return e}},ob={hook:nS,searchHook:J1,parser:U1,base:"",ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:e=>e,aroundNav:(e,r,i)=>e(r,i)},lb=P.createContext(ob),Os=()=>P.useContext(lb),cb={},ub=P.createContext(cb),aS=()=>P.useContext(ub),Ul=e=>{const[r,i]=e.hook(e);return[sS(e.base,r),ib((s,c)=>e.aroundNav(i,iS(s,e.base),c))]},ar=()=>Ul(Os()),vh=(e,r,i,s)=>{const{pattern:c,keys:u}=r instanceof RegExp?{keys:!1,pattern:r}:e(r||"*",s),f=c.exec(i)||[],[l,...d]=f;return l!==void 0?[!0,(()=>{const p=u!==!1?Object.fromEntries(u.map((m,y)=>[m,d[y]])):f.groups;let g={...d};return p&&Object.assign(g,p),g})(),...s?[l]:[]]:[!1,null]},bh=e=>vh(Os().parser,e,ar()[0]),oS=({children:e,...r})=>{var g,m,y;const i=Os(),s=r.hook?ob:i;let c=s;const[u,f=r.ssrSearch??""]=((g=r.ssrPath)==null?void 0:g.split("?"))??[];u&&(r.ssrSearch=f,r.ssrPath=u),r.hrefs=r.hrefs??((m=r.hook)==null?void 0:m.hrefs),r.searchHook=r.searchHook??((y=r.hook)==null?void 0:y.searchHook);let l=P.useRef({}),d=l.current,p=d;for(let _ in s){const k=_==="base"?s[_]+(r[_]??""):r[_]??s[_];d===p&&k!==p[_]&&(l.current=p={...p}),p[_]=k,(k!==s[_]||k!==c[_])&&(c=p)}return P.createElement(lb.Provider,{value:c,children:e})},Sx=({children:e,component:r},i)=>r?P.createElement(r,{params:i}):typeof e=="function"?e(i):e,lS=e=>{let r=P.useRef(cb);const i=r.current;return r.current=Object.keys(e).length!==Object.keys(i).length||Object.entries(e).some(([s,c])=>c!==i[s])?e:i},Ta=({path:e,nest:r,match:i,...s})=>{const c=Os(),[u]=Ul(c),[f,l,d]=i??vh(c.parser,e,u,r),p=lS({...aS(),...l});if(!f)return null;const g=d?P.createElement(oS,{base:d},Sx(s,p)):Sx(s,p);return P.createElement(ub.Provider,{value:p,children:g})},Ln=P.forwardRef((e,r)=>{const i=Os(),[s,c]=Ul(i),{to:u="",href:f=u,onClick:l,asChild:d,children:p,className:g,replace:m,state:y,transition:_,...k}=e,C=ib(b=>{b.ctrlKey||b.metaKey||b.altKey||b.shiftKey||b.button!==0||(l==null||l(b),b.defaultPrevented||(b.preventDefault(),c(f,e)))}),v=i.hrefs(f[0]==="~"?f.slice(1):i.base+f,i);return d&&P.isValidElement(p)?P.cloneElement(p,{onClick:C,href:v}):P.createElement("a",{...k,onClick:C,href:v,className:g!=null&&g.call?g(s===f):g,children:p,ref:r})}),db=e=>Array.isArray(e)?e.flatMap(r=>db(r&&r.type===P.Fragment?r.props.children:r)):[e],cS=({children:e,location:r})=>{const i=Os(),[s]=Ul(i);for(const c of db(e)){let u=0;if(P.isValidElement(c)&&(u=vh(i.parser,c.props.path,r||s,c.props.nest))[0])return P.cloneElement(c,{match:u})}return null},wx=e=>{let r;const i=new Set,s=(p,g)=>{const m=typeof p=="function"?p(r):p;if(!Object.is(m,r)){const y=r;r=g??(typeof m!="object"||m===null)?m:Object.assign({},r,m),i.forEach(_=>_(r,y))}},c=()=>r,l={setState:s,getState:c,getInitialState:()=>d,subscribe:p=>(i.add(p),()=>i.delete(p))},d=r=e(s,c,l);return l},uS=(e=>e?wx(e):wx),dS=e=>e;function hS(e,r=dS){const i=dn.useSyncExternalStore(e.subscribe,dn.useCallback(()=>r(e.getState()),[e,r]),dn.useCallback(()=>r(e.getInitialState()),[e,r]));return dn.useDebugValue(i),i}const Cx=e=>{const r=uS(e),i=s=>hS(r,s);return Object.assign(i,r),i},Wn=(e=>e?Cx(e):Cx);async function Ce(e,r={}){const i=localStorage.getItem("openfox_token"),s={...r.headers instanceof Headers?Object.fromEntries(r.headers.entries()):r.headers,...i?{"x-session-token":i}:{}};return fetch(e,{...r,headers:s})}function fS(e){return typeof e=="object"&&e!==null&&"type"in e&&"payload"in e}function hb(){if(typeof crypto<"u"&&crypto.randomUUID)try{return crypto.randomUUID()}catch{}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const r=Math.random()*16|0;return(e==="x"?r:r&3|8).toString(16)})}class pS{constructor(r){tr(this,"ws",null);tr(this,"handlers",new Set);tr(this,"statusHandler",null);tr(this,"baseUrl");tr(this,"isReconnecting",!1);tr(this,"connectingPromise",null);tr(this,"lastCloseCode",0);tr(this,"reconnectAttempts",0);tr(this,"manualReconnectScheduled",!1);this.baseUrl=r}getUrl(){const r=localStorage.getItem("openfox_token");if(r){const i=this.baseUrl.includes("?")?"&":"?";return`${this.baseUrl}${i}token=${encodeURIComponent(r)}`}return this.baseUrl}setToken(r){localStorage.setItem("openfox_token",r)}clearToken(){localStorage.removeItem("openfox_token")}hasToken(){return!!localStorage.getItem("openfox_token")}getLastCloseCode(){return this.lastCloseCode}onStatusChange(r){this.statusHandler=r}connect(){var r,i;return((r=this.ws)==null?void 0:r.readyState)===WebSocket.OPEN?Promise.resolve():(this.lastCloseCode=0,this.isReconnecting=!1,this.connectingPromise&&((i=this.ws)==null?void 0:i.readyState)===WebSocket.CONNECTING?this.connectingPromise:(this.connectingPromise=new Promise((s,c)=>{try{const u=this.getUrl();this.ws=new WebSocket(u);const f=setTimeout(()=>{var l;((l=this.ws)==null?void 0:l.readyState)===WebSocket.CONNECTING&&(this.ws.close(),c(new Error("Connection timeout")))},5e3);this.ws.onopen=()=>{var l;clearTimeout(f),this.isReconnecting=!1,this.connectingPromise=null,(l=this.statusHandler)==null||l.call(this,"connected"),s()},this.ws.onclose=l=>{var d,p,g;clearTimeout(f),this.lastCloseCode=l.code,((d=this.ws)==null?void 0:d.readyState)===WebSocket.CONNECTING?(this.connectingPromise=null,(p=this.statusHandler)==null||p.call(this,"disconnected"),c(new Error(`Connection closed: ${l.code}`))):(this.connectingPromise=null,(g=this.statusHandler)==null||g.call(this,"disconnected"),this.attemptReconnect())},this.ws.onerror=l=>{clearTimeout(f),console.error("WebSocket error:",l),this.connectingPromise=null,c(l)},this.ws.onmessage=l=>{try{const d=JSON.parse(l.data);fS(d)&&this.handlers.forEach(p=>p(d))}catch(d){console.error("Failed to parse WebSocket message:",d)}}}catch(u){this.connectingPromise=null,c(u)}}),this.connectingPromise))}attemptReconnect(){var c;if(([1e3,1005,1006,4e3].includes(this.lastCloseCode)||this.lastCloseCode===0)&&this.hasToken()){console.log("[WS] Auth failure or initial failure with token - not auto-reconnecting, awaiting user action");return}if(this.isReconnecting||this.manualReconnectScheduled)return;this.isReconnecting=!0,(c=this.statusHandler)==null||c.call(this,"reconnecting");const s=Math.min(1e3*Math.pow(2,this.reconnectAttempts||0),3e4);this.reconnectAttempts=(this.reconnectAttempts||0)+1,setTimeout(()=>{this.isReconnecting=!1,this.manualReconnectScheduled=!1,this.connect().catch(()=>{})},s)}reconnect(){this.manualReconnectScheduled=!0,this.isReconnecting=!1,this.lastCloseCode=0,this.connectingPromise=null,this.connect().catch(()=>{})}disconnect(){this.isReconnecting=!1,this.reconnectAttempts=0,this.ws&&(this.ws.close(),this.ws=null)}resetReconnectAttempts(){this.reconnectAttempts=0}send(r,i){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)throw new Error("WebSocket not connected");const s=hb(),c={id:s,type:r,payload:i};return this.ws.send(JSON.stringify(c)),s}subscribe(r){return this.handlers.add(r),()=>this.handlers.delete(r)}get isConnected(){var r;return((r=this.ws)==null?void 0:r.readyState)===WebSocket.OPEN}}const mS=`ws://${window.location.hostname}:${window.location.port||"10469"}/ws`,Pt=new pS(mS),si=async(e,r,i)=>{try{const s=await Ce(r,{method:e,headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});return s.ok?{success:!0}:{success:!1,error:(await s.json()).error}}catch{return{success:!1,error:"Network error"}}};function fb(e){let r=null;function i(){r===null&&(r=requestAnimationFrame(()=>{r=null,e()}))}return i}let vl=[];const ir=Wn()((e,r)=>{function i(){if(vl.length===0)return;const c=vl;vl=[],e(u=>({logs:[...u.logs,...c]}))}const s=fb(i);return{workdir:null,status:null,logs:[],config:null,loading:!1,setWorkdir:c=>{r().workdir!==c&&(e({workdir:c,status:null,logs:[],config:null,loading:!0}),c&&(r().fetchStatus(),r().fetchConfig()))},fetchStatus:async()=>{const c=r().workdir;if(c)try{const f=await(await Ce(`/api/dev-server?workdir=${encodeURIComponent(c)}`)).json();e({status:f,loading:!1})}catch{e({loading:!1})}},fetchConfig:async()=>{const c=r().workdir;if(c)try{const f=await(await Ce(`/api/dev-server/config?workdir=${encodeURIComponent(c)}`)).json();e({config:f.config??null})}catch{}},fetchLogs:async()=>{const c=r().workdir;if(c)try{const l=(await(await Ce(`/api/dev-server/logs?workdir=${encodeURIComponent(c)}`)).json()).logs.map(d=>({stream:d.stream,content:d.content}));e({logs:l})}catch{}},start:async()=>{const c=r().workdir;if(c)try{const f=await(await Ce(`/api/dev-server/start?workdir=${encodeURIComponent(c)}`,{method:"POST"})).json();e({status:f,logs:[]})}catch{}},stop:async()=>{const c=r().workdir;if(c)try{const f=await(await Ce(`/api/dev-server/stop?workdir=${encodeURIComponent(c)}`,{method:"POST"})).json();e({status:f})}catch{}},restart:async()=>{const c=r().workdir;if(c)try{const f=await(await Ce(`/api/dev-server/restart?workdir=${encodeURIComponent(c)}`,{method:"POST"})).json();e({status:f,logs:[]})}catch{}},saveConfig:async c=>{const u=r().workdir;if(u)try{const l=await(await Ce(`/api/dev-server/config?workdir=${encodeURIComponent(u)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)})).json();e({config:l.config??c}),r().fetchStatus()}catch{}},handleMessage:c=>{const u=r().workdir;if(u)switch(c.type){case"devServer.output":{const f=c.payload;if(f.workdir!==u)return;vl.push({stream:f.stream,content:f.content}),s();break}case"devServer.state":{const f=c.payload;if(f.workdir!==u)return;e(l=>({status:l.status?{...l.status,state:f.state,errorMessage:f.errorMessage}:l.status}));break}}}}}),gS=3e4;function xS(e){switch(e){case"vllm":return"vLLM";case"sglang":return"SGLang";case"ollama":return"Ollama";case"llamacpp":return"llama.cpp";case"openai":return"OpenAI";case"anthropic":return"Anthropic";case"opencode-go":return"OpenCode Go";case"auto":return"Auto";case"unknown":return""}}const kt=Wn((e,r)=>({version:null,model:null,maxContext:2e5,llmUrl:null,llmStatus:"unknown",backend:"unknown",providers:[],activeProviderId:null,defaultModelSelection:null,loading:!1,activating:!1,error:null,autoRefreshInterval:null,fetchConfig:async()=>{e({loading:!0,error:null});try{const i=await Ce("/api/config");if(!i.ok)throw new Error("Failed to fetch config");const s=await i.json();e({version:s.version,model:s.model,maxContext:s.maxContext,llmUrl:s.llmUrl,llmStatus:s.llmStatus,backend:s.backend,providers:s.providers??[],activeProviderId:s.activeProviderId??null,defaultModelSelection:s.defaultModelSelection??null,loading:!1})}catch(i){e({error:i instanceof Error?i.message:"Unknown error",loading:!1})}},refreshModel:async()=>{try{const i=await Ce("/api/model/refresh",{method:"POST"});if(!i.ok)throw new Error("Failed to refresh model");const s=await i.json(),u=Ee.getState().currentSession;if(u!=null&&u.providerId&&u.providerModel){e({llmStatus:s.llmStatus,backend:s.backend});return}e({model:s.model,llmStatus:s.llmStatus,backend:s.backend})}catch(i){console.error("Failed to refresh model:",i)}},activateProvider:async i=>{const{activeProviderId:s,providers:c}=r();if(i===s)return!0;e({activating:!0,error:null});try{const u=await Ce(`/api/providers/${i}/activate`,{method:"POST"});if(!u.ok){const l=await u.json();throw new Error(l.error??"Failed to activate provider")}const f=await u.json();return e({activeProviderId:f.activeProviderId,model:f.model,backend:f.backend,providers:c.map(l=>({...l,isActive:l.id===f.activeProviderId})),activating:!1}),!0}catch(u){return e({error:u instanceof Error?u.message:"Failed to switch provider",activating:!1}),!1}},syncFromSession:(i,s)=>{const{providers:c}=r();e({activeProviderId:i,model:s,defaultModelSelection:`${i}/${s}`,providers:c.map(u=>({...u,isActive:u.id===i}))})},updateModelContext:async(i,s,c)=>{e({activating:!0,error:null});try{const u=await Ce(`/api/providers/${i}/models/${encodeURIComponent(s)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({contextWindow:c})});if(!u.ok){const d=await u.json();throw new Error(d.error??"Failed to update model context")}const f=await u.json(),{providers:l}=r();return e({providers:l.map(d=>d.id===i?{...d,models:d.models.map(p=>p.id===s?{...p,contextWindow:c,source:"user"}:p)}:d),activating:!1}),f.contextState&&Ee.getState().updateContextState(f.contextState),!0}catch(u){return e({error:u instanceof Error?u.message:"Failed to update model context",activating:!1}),!1}},refreshProviderModels:async i=>{e({activating:!0,error:null});try{const s=await Ce(`/api/providers/${i}/refresh`,{method:"POST"});if(!s.ok){const f=await s.json();throw new Error(f.error??"Failed to refresh models")}const c=await s.json(),{providers:u}=r();return e({providers:u.map(f=>f.id===i?{...f,models:c.models}:f),activating:!1}),!0}catch(s){return e({error:s instanceof Error?s.message:"Failed to refresh models",activating:!1}),!1}},startAutoRefresh:()=>{const{autoRefreshInterval:i,refreshModel:s}=r();if(i)return;const c=setInterval(()=>{s()},gS);e({autoRefreshInterval:c})},stopAutoRefresh:()=>{const{autoRefreshInterval:i}=r();i&&(clearInterval(i),e({autoRefreshInterval:null}))},getActiveProvider:()=>{const{providers:i,activeProviderId:s}=r();return i.find(c=>c.id===s)},getModelContext:i=>{const{providers:s,activeProviderId:c}=r(),u=s.find(l=>l.id===c);if(!u)return 2e5;const f=u.models.find(l=>l.id===i);return(f==null?void 0:f.contextWindow)??2e5}})),Gt=Wn((e,r)=>({projects:[],currentProject:null,loading:!1,listProjects:async()=>{e({loading:!0});try{const s=await(await Ce("/api/projects")).json();e({projects:s.projects??[],loading:!1})}catch{e({loading:!1})}},createProject:async(i,s)=>{try{const c=await Ce("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:i,workdir:s})});if(!c.ok)return null;const u=await c.json();return await r().listProjects(),u.project}catch{return null}},loadProject:async i=>{try{const s=await Ce(`/api/projects/${i}`);if(!s.ok)return null;const c=await s.json();return e({currentProject:c.project}),r().projects.length===0&&await r().listProjects(),c.project}catch{return null}},updateProject:async(i,s)=>{var c;try{const u=await Ce(`/api/projects/${i}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!u.ok)return null;const f=await u.json();return((c=r().currentProject)==null?void 0:c.id)===i&&e({currentProject:f.project}),await r().listProjects(),f.project}catch{return null}},deleteProject:async i=>{var s;try{return(await Ce(`/api/projects/${i}`,{method:"DELETE"})).ok?(await r().listProjects(),((s=r().currentProject)==null?void 0:s.id)===i&&e({currentProject:null}),!0):!1}catch{return!1}},clearProject:()=>{e({currentProject:null})}}));let bl=[];const Pa=Wn()((e,r)=>{function i(){if(bl.length===0)return;const c=bl;bl=[],e(u=>{const f={...u.logs};for(const l of c){const d=f[l.processId]??[];f[l.processId]=[...d,{offset:d.length,content:l.content,timestamp:Date.now(),stream:l.stream}]}return{logs:f}})}const s=fb(i);return{processes:[],logs:{},loading:!1,setProcesses:c=>e({processes:c}),addProcess:c=>e(u=>({processes:[...u.processes,c]})),updateProcess:(c,u)=>e(f=>({processes:f.processes.map(l=>l.id===c?{...l,...u}:l)})),removeProcess:c=>e(u=>({processes:u.processes.filter(f=>f.id!==c),logs:Object.fromEntries(Object.entries(u.logs).filter(([f])=>f!==c))})),stopProcess:async(c,u)=>{try{(await Ce(`/api/sessions/${u}/background-process/${c}/stop`,{method:"POST"})).ok&&r().removeProcess(c)}catch{}},appendLog:(c,u,f)=>{bl.push({processId:c,stream:u,content:f}),s()},setLogs:(c,u)=>e(f=>({logs:{...f.logs,[c]:u}})),clearLogs:c=>e(u=>({logs:{...u.logs,[c]:[]}})),handleMessage:(c,u)=>{switch(c){case"backgroundProcess.started":{const{processId:f,name:l,pid:d,status:p}=u;e(g=>({processes:[...g.processes,{id:f,sessionId:"",name:l,command:"",cwd:"",pid:d,status:p,exitCode:null,createdAt:Date.now(),startedAt:Date.now(),endedAt:null}]}));break}case"backgroundProcess.output":{const f=u.processId,l=u.stream,d=u.content;r().appendLog(f,l,d);break}case"backgroundProcess.exited":{const f=u.processId,l=u.exitCode;e(d=>({processes:d.processes.map(p=>p.id===f?{...p,status:"exited",exitCode:l}:p)}));break}case"backgroundProcess.removed":{const f=u.processId;r().removeProcess(f);break}}}}}),ti={GLOBAL_INSTRUCTIONS:"global_instructions",NOTIFICATION_SETTINGS:"notification_settings"};function yl(e,r){return i=>({loading:{...i.loading,[e]:r}})}function kx(e,r){return i=>({settings:{...i.settings,[e]:r},loading:{...i.loading,[e]:!1}})}const ni=Wn(e=>({settings:{},loading:{},getSetting:async r=>{e(yl(r,!0));try{const s=await(await Ce(`/api/settings/${r}`)).json();return e(kx(r,s.value??"")),s.value}catch{return e(yl(r,!1)),null}},setSetting:async(r,i)=>{e(yl(r,!0));try{const c=await(await Ce(`/api/settings/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:i})})).json();e(kx(r,c.value??""))}catch{e(yl(r,!1))}}})),vS=[{key:"complete",label:"Task Complete",description:"When an agent finishes its work"},{key:"waiting_for_user",label:"Waiting for Input",description:"When the agent needs your input"},{key:"phase_done",label:"Phase Done",description:"When a build phase completes successfully"},{key:"phase_blocked",label:"Phase Blocked",description:"When a build phase is blocked and needs intervention"},{key:"new_message",label:"New Message",description:"When a new assistant message starts arriving"}],bS=[{url:"/sounds/notification.mp3",label:"Notification"},{url:"/sounds/waiting-for-user.mp3",label:"Waiting for User"},{url:"/sounds/achievement.mp3",label:"Achievement"},{url:"/sounds/intervention.mp3",label:"Intervention"},{url:"/sounds/typing.mp3",label:"Typing"}],pb={complete:"/sounds/notification.mp3",waiting_for_user:"/sounds/waiting-for-user.mp3",phase_done:"/sounds/achievement.mp3",phase_blocked:"/sounds/intervention.mp3",new_message:"/sounds/typing.mp3"},ri={soundEnabled:!0,browserNotification:!1,customSoundUrl:null},mb={soundEnabled:!1,browserNotification:!1,customSoundUrl:null},Qd={soundEnabled:!0,browserNotificationEnabled:!1,events:{complete:{...ri},waiting_for_user:{...ri},phase_done:{...ri},phase_blocked:{...ri},new_message:{...mb}},agentOverrides:{}};function gb(e,r,i){var u;const s=e.events[r];if(!i)return s;const c=(u=e.agentOverrides[i])==null?void 0:u[r];return c?{soundEnabled:c.soundEnabled??s.soundEnabled,browserNotification:c.browserNotification??s.browserNotification,customSoundUrl:c.customSoundUrl!==void 0?c.customSoundUrl:s.customSoundUrl}:s}const Ti=Wn((e,r)=>({settings:Qd,loaded:!1,load:()=>{ni.getState().getSetting(ti.NOTIFICATION_SETTINGS);const s=ni.subscribe(u=>{const f=u.settings[ti.NOTIFICATION_SETTINGS];if(f!==void 0)try{const l=JSON.parse(f);e({settings:Ex(l),loaded:!0})}catch{e({loaded:!0})}}),c=ni.getState().settings[ti.NOTIFICATION_SETTINGS];if(c)try{const u=JSON.parse(c);e({settings:Ex(u),loaded:!0})}catch{e({loaded:!0})}return s},update:i=>{e({settings:i}),Ed(i)},updateEvent:(i,s)=>{const c=r().settings,u={...c,events:{...c.events,[i]:{...c.events[i],...s}}};e({settings:u}),Ed(u)},updateAgentOverride:(i,s,c)=>{var d;const u=r().settings,f={...u.agentOverrides};if(c===null){if(f[i]){const p={...f[i]};delete p[s],Object.keys(p).length===0?delete f[i]:f[i]=p}}else f[i]={...f[i],[s]:{...((d=f[i])==null?void 0:d[s])??{},...c}};const l={...u,agentOverrides:f};e({settings:l}),Ed(l)}}));function Ed(e){ni.getState().setSetting(ti.NOTIFICATION_SETTINGS,JSON.stringify(e))}function Ex(e){var r,i,s,c,u;return{soundEnabled:e.soundEnabled??Qd.soundEnabled,browserNotificationEnabled:e.browserNotificationEnabled??Qd.browserNotificationEnabled,events:{complete:{...ri,...(r=e.events)==null?void 0:r.complete},waiting_for_user:{...ri,...(i=e.events)==null?void 0:i.waiting_for_user},phase_done:{...ri,...(s=e.events)==null?void 0:s.phase_done},phase_blocked:{...ri,...(c=e.events)==null?void 0:c.phase_blocked},new_message:{...mb,...(u=e.events)==null?void 0:u.new_message}},agentOverrides:e.agentOverrides??{}}}const jx=new Map;function yS(e){let r=jx.get(e);return r||(r=new Audio(e),r.volume=.5,jx.set(e,r)),r}let xb=typeof Notification<"u"?Notification.permission:"denied";function _S(){return typeof Notification>"u"?Promise.resolve("denied"):Notification.requestPermission().then(e=>(xb=e,e))}const SS={complete:"Task Complete",waiting_for_user:"Waiting for Input",phase_done:"Phase Complete",phase_blocked:"Phase Blocked",new_message:"New Message"},wS={complete:"The agent has finished its work.",waiting_for_user:"The agent needs your input to continue.",phase_done:"The build phase completed successfully.",phase_blocked:"The build phase is blocked and needs intervention.",new_message:"A new assistant message is arriving."};function CS(e){typeof Notification>"u"||xb==="granted"&&(document.hasFocus()||new Notification(SS[e],{body:wS[e],icon:"/fox.svg",tag:`openfox-${e}`}))}function Ja(e,r){const{settings:i}=Ti.getState(),s=gb(i,e,r);if(i.soundEnabled&&s.soundEnabled){const c=s.customSoundUrl??pb[e],u=yS(c);u.currentTime=0,u.play().catch(()=>{})}i.browserNotificationEnabled&&s.browserNotification&&CS(e)}const kS=e=>Ja("complete",e),ES=e=>Ja("phase_done",e),jS=e=>Ja("phase_blocked",e),Nx=e=>Ja("waiting_for_user",e),NS=e=>Ja("new_message",e);let Aa=!1,nr=null;const jd=new Set,Ht={messageId:null,deltaContent:"",thinkingContent:"",toolOutput:[]};let Ds=null,an=null;function Nd(){Ds===null&&(Ds=requestAnimationFrame(()=>{Ds=null,an==null||an()}))}function ki(){Ds!==null&&(cancelAnimationFrame(Ds),Ds=null)}function At(e,r){return r!==null&&e.sessionId===r}function TS(e,r,i){return e.id!==void 0||At(e,r)||i===!0&&e.sessionId!==void 0}function AS(e,r){return e.includes(r)?e:[...e,r]}function Da(e,r){return e.filter(i=>i!==r)}function DS(e,r){const i=e.find(c=>c.id===r.id),s=i?{...i,projectId:r.projectId,workdir:r.workdir,mode:r.mode,phase:r.phase,isRunning:r.isRunning,messageCount:r.messages.length,criteriaCount:r.criteria.length,criteriaCompleted:r.criteria.filter(c=>c.status.type==="passed").length}:{id:r.id,projectId:r.projectId,workdir:r.workdir,mode:r.mode,phase:r.phase,isRunning:r.isRunning,createdAt:"",updatedAt:"",criteriaCount:r.criteria.length,criteriaCompleted:r.criteria.filter(c=>c.status.type==="passed").length,messageCount:r.messages.length};return i?e.map(c=>c.id===r.id?s:c):[s,...e]}function LS(e,r,i){return e.map(s=>{const c=(i==null?void 0:i.id)===s.id?i:null,u=r.find(f=>f.id===s.id);return{...s,title:s.title??(u==null?void 0:u.title),mode:(c==null?void 0:c.mode)??(u==null?void 0:u.mode)??s.mode,phase:(c==null?void 0:c.phase)??(u==null?void 0:u.phase)??s.phase,isRunning:(c==null?void 0:c.isRunning)??(u==null?void 0:u.isRunning)??s.isRunning,messageCount:s.messageCount,recentUserPrompts:s.recentUserPrompts}})}const Tx=new Map;function za(e,r){var u;const i=r===((u=e.currentSession)==null?void 0:u.id)?e.currentSession:null,s=e.sessions.find(f=>f.id===r),c=(i==null?void 0:i.mode)??(s==null?void 0:s.mode);return c==="planner"?"planner":c==="builder"?"build":"planner"}function RS(e,r){if(e.type==="chat.done"){const i=e.payload,s=za(r,e.sessionId),c=i.agentType??s;i.reason==="complete"&&kS(c),i.reason==="waiting_for_user"&&Nx(c);return}if(e.type==="chat.path_confirmation"){const i=za(r,e.sessionId);Nx(i);return}if(e.type==="task.completed"){const i=za(r,e.sessionId);ES(i);return}if(e.type==="phase.changed"&&e.sessionId){const i=e.payload,s=Tx.get(e.sessionId)??null;if(Tx.set(e.sessionId,i.phase),s===i.phase)return;const c=za(r,e.sessionId);i.phase==="blocked"&&jS(c)}}const Ee=Wn((e,r)=>(an=()=>{const i=Ht;if(!i.messageId)return;const s=i.deltaContent.length>0,c=i.thinkingContent.length>0,u=i.toolOutput.length>0;if(!s&&!c&&!u)return;const f=i.deltaContent,l=i.thinkingContent,d=i.toolOutput;i.deltaContent="",i.thinkingContent="",i.toolOutput=[],e(p=>{var m;const g=p.streamingMessage;if(g&&g.id===i.messageId){let y={...g};if(s&&(y.content=y.content+f),c&&(y.thinkingContent=(y.thinkingContent??"")+l),u){const _=new Set;y.toolCalls=(m=y.toolCalls)==null?void 0:m.map(C=>{const v=d.filter(b=>b.callId===C.id);return v.length===0?C:(_.add(C.id),{...C,streamingOutput:[...C.streamingOutput??[],...v.map(b=>({stream:b.stream,content:b.content}))]})});const k=d.filter(C=>!_.has(C.callId));k.length>0&&Ht.toolOutput.push(...k)}return{streamingMessage:y}}if(u){const y=new Set,_=p.messages.map(C=>{var b;if(C.id!==i.messageId)return C;const v=(b=C.toolCalls)==null?void 0:b.map(x=>{const S=d.filter(j=>j.callId===x.id);return S.length===0?x:(y.add(x.id),{...x,streamingOutput:[...x.streamingOutput??[],...S.map(j=>({stream:j.stream,content:j.content}))]})});return{...C,toolCalls:v}}),k=d.filter(C=>!y.has(C.callId));return k.length>0&&Ht.toolOutput.push(...k),{messages:_}}return p})},{connectionStatus:"disconnected",showPasswordModal:!1,passwordModalRetry:!1,sessions:[],currentSession:null,unreadSessionIds:[],messages:[],streamingMessageId:null,streamingMessage:null,currentTodos:[],contextState:null,subAgentContextStates:{},pendingPathConfirmation:null,pendingQuestion:null,visionFallbackByMessage:{},queuedMessages:[],abortInProgress:!1,error:null,sessionsHasMore:!0,sessionsPaginationLoading:!1,pendingSessionCreate:!1,connect:async()=>{const i=r().connectionStatus;if(i==="connected"||i==="reconnecting")return;e({connectionStatus:"reconnecting"});let s=!1;try{s=(await(await Ce("/api/auth")).json()).requiresAuth}catch{}if(s&&!Pt.hasToken()){e({showPasswordModal:!0,passwordModalRetry:!1,connectionStatus:"reconnecting"});return}Pt.onStatusChange(c=>{e({connectionStatus:c}),c==="connected"&&r().listSessions(void 0)});try{if(await Pt.connect(),!Aa){Aa=!0;const c=r().handleServerMessage;nr=Pt.subscribe(c)}}catch(c){console.error("Failed to connect:",c);const u=Pt.getLastCloseCode();if(!Pt.hasToken()&&(u===1006||u===4e3)){e({showPasswordModal:!0,passwordModalRetry:!0,connectionStatus:"reconnecting"});return}nr&&(nr(),nr=null),Aa=!1,e({connectionStatus:"disconnected"})}},reconnect:()=>{Pt.disconnect(),nr&&(nr(),nr=null),Aa=!1,e({connectionStatus:"reconnecting"}),r().connect()},disconnect:()=>{Pt.disconnect(),nr&&(nr(),nr=null),Aa=!1,e({connectionStatus:"disconnected",showPasswordModal:!1})},submitPassword:async i=>{try{const s=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:i})});if(!s.ok){e({showPasswordModal:!0,passwordModalRetry:!0,connectionStatus:"reconnecting"});return}const{token:c}=await s.json();Pt.setToken(c),e({showPasswordModal:!1}),r().connect();const{listProjects:u}=Gt.getState(),{fetchConfig:f}=kt.getState();u(),f(),r().connect()}catch{e({showPasswordModal:!0,passwordModalRetry:!0,connectionStatus:"reconnecting"})}},cancelPassword:()=>{Pt.clearToken(),e({showPasswordModal:!1,connectionStatus:"disconnected"})},createSession:async(i,s)=>{try{e({pendingSessionCreate:!0});const c=await Ce("/api/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:i,title:s})});if(!c.ok)return e({pendingSessionCreate:!1}),null;const u=await c.json();return Pt.send("session.load",{sessionId:u.session.id}),u.session}catch{return e({pendingSessionCreate:!1}),null}},loadSession:async i=>{try{const s=r().currentSession;!s||s.id!==i?(ki(),e({currentSession:null,unreadSessionIds:Da(r().unreadSessionIds,i),subAgentContextStates:{},messages:[],streamingMessageId:null,streamingMessage:null,currentTodos:[],contextState:null,pendingPathConfirmation:null,queuedMessages:[],abortInProgress:!1,error:null})):e({unreadSessionIds:Da(r().unreadSessionIds,i)});const c=await Ce(`/api/sessions/${i}`);if(!c.ok)return;const u=await c.json();e({currentSession:u.session,messages:u.messages??[],contextState:u.contextState,queuedMessages:u.queueState??[]}),Pt.send("session.load",{sessionId:i});try{const f=await Ce(`/api/sessions/${i}/background-processes`);if(f.ok){const l=await f.json();Pa.getState().setProcesses(l.processes??[])}}catch{}}catch{}},listSessions:async(i,s=20)=>{try{const c=new URLSearchParams;c.set("limit",String(s)),i&&c.set("projectId",i);const f=await(await Ce(`/api/sessions?${c.toString()}`)).json();e({sessions:f.sessions??[],sessionsHasMore:i?f.hasMore??!1:!0})}catch{}},loadMoreSessions:async i=>{const s=r();if(!(s.sessionsPaginationLoading||!s.sessionsHasMore)){e({sessionsPaginationLoading:!0});try{const c=new URLSearchParams;c.set("limit","20"),c.set("offset",String(s.sessions.length)),c.set("projectId",i);const f=await(await Ce(`/api/sessions?${c.toString()}`)).json();e(l=>({sessions:[...l.sessions,...f.sessions??[]],sessionsHasMore:f.hasMore??!1,sessionsPaginationLoading:!1}))}catch{e({sessionsPaginationLoading:!1})}}},deleteSession:async i=>{var s;try{return(await Ce(`/api/sessions/${i}`,{method:"DELETE"})).ok?(await r().listSessions(),((s=r().currentSession)==null?void 0:s.id)===i&&r().clearSession(),!0):!1}catch{return!1}},deleteAllSessions:async i=>{try{return(await Ce(`/api/projects/${i}/sessions`,{method:"DELETE"})).ok?(await r().listSessions(),!0):!1}catch{return!1}},clearSession:()=>{ki(),e(i=>({currentSession:null,messages:[],streamingMessageId:null,streamingMessage:null,currentTodos:[],contextState:null,unreadSessionIds:i.currentSession?Da(i.unreadSessionIds,i.currentSession.id):i.unreadSessionIds}))},sendMessage:async(i,s,c)=>{var f;const u=(f=r().currentSession)==null?void 0:f.id;if(u){e({streamingMessageId:null});try{const d=await(await Ce(`/api/sessions/${u}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:i,attachments:s,messageKind:c==null?void 0:c.messageKind})})).json();d.queueState&&e({queuedMessages:d.queueState})}catch(l){console.error("Error sending message:",l)}}},stopGeneration:async()=>{var s;const i=(s=r().currentSession)==null?void 0:s.id;if(i&&!r().abortInProgress){ki(),an==null||an(),e({abortInProgress:!0});try{await Ce(`/api/sessions/${i}/stop`,{method:"POST"})}catch(c){console.error("Error stopping generation:",c)}}},continueGeneration:async()=>{var s;const i=(s=r().currentSession)==null?void 0:s.id;if(i){e({streamingMessageId:null});try{await Ce(`/api/sessions/${i}/continue`,{method:"POST"})}catch(c){console.error("Error continuing generation:",c)}}},launchRunner:(i,s,c)=>{e({streamingMessageId:null});const u={};i!=null&&i.trim()&&(u.content=i),s&&s.length>0&&(u.attachments=s),c&&(u.workflowId=c),Pt.send("runner.launch",u)},switchMode:async i=>{var c;const s=(c=r().currentSession)==null?void 0:c.id;if(s)try{const u=await Ce(`/api/sessions/${s}/mode`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:i})});if(!u.ok){console.error("Failed to switch mode:",await u.json());return}const f=await u.json();f.session&&e({currentSession:f.session})}catch(u){console.error("Error switching mode:",u)}},switchDangerLevel:async i=>{var c;const s=(c=r().currentSession)==null?void 0:c.id;if(s)try{const u=await Ce(`/api/sessions/${s}/danger-level`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({dangerLevel:i})});if(!u.ok){console.error("Failed to switch danger level:",await u.json());return}const f=await u.json();f.session&&e({currentSession:f.session})}catch(u){console.error("Error switching danger level:",u)}},acceptAndBuild:(i,s,c)=>{e({streamingMessageId:null});const u={};i&&(u.workflowId=i),s!=null&&s.trim()&&(u.content=s),c&&c.length>0&&(u.attachments=c),Pt.send("mode.accept",u)},editCriteria:async i=>{var c;const s=(c=r().currentSession)==null?void 0:c.id;if(s)try{const u=await Ce(`/api/sessions/${s}/criteria`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({criteria:i})});u.ok||console.error("Failed to update criteria:",await u.json())}catch(u){console.error("Error updating criteria:",u)}},compactContext:()=>{Pt.send("context.compact",{})},setSessionProvider:async(i,s)=>{var c;try{const u=(c=r().currentSession)==null?void 0:c.id;if(!u)return null;const f=await Ce(`/api/sessions/${u}/provider`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerId:i,...s?{model:s}:{}})});if(!f.ok)return null;const l=await f.json();return e({currentSession:l.session,messages:l.messages??[],contextState:l.contextState}),l.session}catch{return null}},updateContextState:i=>{e({contextState:i})},updateSubAgentContextState:(i,s)=>{e(c=>({subAgentContextStates:{...c.subAgentContextStates,[i]:s}}))},clearSubAgentContextState:i=>{e(s=>{const c={...s.subAgentContextStates};return delete c[i],{subAgentContextStates:c}})},confirmPath:async(i,s,c=!1)=>{var f;const u=(f=r().currentSession)==null?void 0:f.id;if(u)try{await Ce(`/api/sessions/${u}/confirm-path`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({callId:i,approved:s,alwaysAllow:c})})}catch(l){console.error("Error confirming path:",l)}},answerQuestion:async(i,s)=>{var u;const c=(u=r().currentSession)==null?void 0:u.id;if(c){try{await Ce(`/api/sessions/${c}/answer`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({callId:i,answer:s})})}catch(f){console.error("Error answering question:",f)}e({pendingQuestion:null})}},queueAsap:async(i,s,c)=>{var f;const u=(f=r().currentSession)==null?void 0:f.id;if(u)try{const d=await(await Ce(`/api/sessions/${u}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:i,attachments:s,messageKind:c})})).json();d.queueState&&e({queuedMessages:d.queueState})}catch(l){console.error("Error queueing ASAP message:",l)}},queueCompletion:async(i,s,c)=>{var f;const u=(f=r().currentSession)==null?void 0:f.id;if(u)try{const d=await(await Ce(`/api/sessions/${u}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:i,attachments:s,messageKind:c})})).json();d.queueState&&e({queuedMessages:d.queueState})}catch(l){console.error("Error queueing completion message:",l)}},cancelQueued:async i=>{var c;const s=(c=r().currentSession)==null?void 0:c.id;if(s)try{const f=await(await Ce(`/api/sessions/${s}/queue/${i}`,{method:"DELETE"})).json();f.queueState&&e({queuedMessages:f.queueState})}catch(u){console.error("Error canceling queued message:",u)}},clearError:()=>{e({error:null})},resetPendingSessionCreate:()=>{e({pendingSessionCreate:!1})},handleServerMessage:i=>{var f,l,d,p,g,m,y,_,k,C,v,b,x,S,j,A,N,D,T,I,H,V,Y,q;const s=r();RS(i,s);const c=((f=s.currentSession)==null?void 0:f.id)??null,u=()=>{const O=i.sessionId;!O||O===c||e(U=>({unreadSessionIds:AS(U.unreadSessionIds,O)}))};switch(i.type){case"session.state":{const O=i.payload;if(!TS(i,c,s.pendingSessionCreate))break;ki();const U=O.messages.find(L=>L.isStreaming)??null,z=r().pendingSessionCreate===!0,X=O.pendingConfirmations??[],M=s.pendingPathConfirmation??(X.length>0?X[0]??null:null);if(e({currentSession:O.session,sessions:DS(r().sessions,O.session),unreadSessionIds:Da(r().unreadSessionIds,O.session.id),messages:O.messages,streamingMessageId:(U==null?void 0:U.id)??null,streamingMessage:U,currentTodos:[],pendingPathConfirmation:M,error:null,...z?{pendingSessionCreate:O.session.id}:{}}),O.session.providerId&&O.session.providerModel){const L=kt.getState();L.providers.find(W=>W.id===O.session.providerId)&&L.syncFromSession(O.session.providerId,O.session.providerModel)}break}case"session.list":{const O=i.payload;e(U=>({sessions:LS(O.sessions,U.sessions,U.currentSession)}));break}case"session.deleted":{const O=i.payload;e(U=>({unreadSessionIds:Da(U.unreadSessionIds,O.sessionId)})),r().listSessions();break}case"session.deletedAll":{r().listSessions();break}case"session.running":{const O=i.payload,U=i.sessionId,z=(l=r().currentSession)==null?void 0:l.id,X=U&&U!==z;e(Q=>({sessions:Q.sessions.map(M=>M.id===U?{...M,isRunning:O.isRunning}:M)})),X||e(Q=>({currentSession:Q.currentSession?{...Q.currentSession,isRunning:O.isRunning}:null,...O.isRunning?{}:{abortInProgress:!1,queuedMessages:[]}}));break}case"chat.message":{if(!At(i,((d=r().currentSession)==null?void 0:d.id)??null)){u();break}const O=i.payload;e(U=>U.messages.some(z=>z.id===O.message.id)?U:{messages:[...U.messages,O.message],streamingMessageId:O.message.isStreaming?O.message.id:U.streamingMessageId,streamingMessage:O.message.isStreaming?O.message:U.streamingMessage});break}case"chat.message_updated":{if(!At(i,((p=r().currentSession)==null?void 0:p.id)??null)){u();break}const O=i.payload,U=O.updates.isStreaming===!1&&r().streamingMessageId===O.messageId;U&&(ki(),an==null||an()),e(z=>{const X=z.streamingMessage,Q=U;if(X&&X.id===O.messageId){const M={...X,...O.updates};return{messages:z.messages.map(L=>L.id===O.messageId?M:L),streamingMessageId:Q?null:z.streamingMessageId,streamingMessage:Q?null:{...X,...O.updates}}}return{messages:z.messages.map(M=>M.id===O.messageId?{...M,...O.updates}:M),streamingMessageId:Q?null:z.streamingMessageId}});break}case"chat.delta":{if(!At(i,((g=r().currentSession)==null?void 0:g.id)??null)){u();break}const O=i.payload;if(!jd.has(O.messageId)){jd.add(O.messageId);const U=za(r(),i.sessionId);NS(U)}Ht.messageId=O.messageId,Ht.deltaContent+=O.content,Nd();break}case"chat.thinking":{if(!At(i,((m=r().currentSession)==null?void 0:m.id)??null)){u();break}const O=i.payload;Ht.messageId=O.messageId,Ht.thinkingContent+=O.content,Nd();break}case"chat.tool_preparing":{if(!At(i,((y=r().currentSession)==null?void 0:y.id)??null)){u();break}const O=i.payload;e(U=>{const z=U.streamingMessage;return z&&z.id===O.messageId?{streamingMessage:{...z,preparingToolCalls:[...z.preparingToolCalls??[],{index:O.index,name:O.name}]}}:{messages:U.messages.map(X=>X.id===O.messageId?{...X,preparingToolCalls:[...X.preparingToolCalls??[],{index:O.index,name:O.name}]}:X)}});break}case"chat.tool_call":{if(!At(i,((_=r().currentSession)==null?void 0:_.id)??null)){u();break}const O=i.payload,U=z=>{var M;const X=(M=z.preparingToolCalls)==null?void 0:M.filter((L,B)=>{var W;return L.name===O.tool?(W=z.preparingToolCalls)==null?void 0:W.slice(0,B).some(re=>re.name===O.tool):!0}),Q=Ht.toolOutput.filter(L=>L.callId===O.callId);return Q.length>0&&(Ht.toolOutput=Ht.toolOutput.filter(L=>L.callId!==O.callId)),{...z,toolCalls:[...z.toolCalls??[],{id:O.callId,name:O.tool,arguments:O.args,startedAt:Date.now(),...Q.length>0?{streamingOutput:Q.map(L=>({stream:L.stream,content:L.content}))}:{}}],...X&&X.length>0?{preparingToolCalls:X}:{preparingToolCalls:void 0}}};e(z=>{const X=z.streamingMessage;return X&&X.id===O.messageId?{streamingMessage:U(X)}:{messages:z.messages.map(Q=>Q.id===O.messageId?U(Q):Q)}});break}case"chat.tool_output":{if(!At(i,((k=r().currentSession)==null?void 0:k.id)??null)){u();break}const O=i.payload;Ht.messageId=O.messageId,Ht.toolOutput.push({messageId:O.messageId,callId:O.callId,stream:O.stream,content:O.output}),Nd();break}case"chat.tool_result":{if(!At(i,((C=r().currentSession)==null?void 0:C.id)??null)){u();break}const O=i.payload,U=z=>{var Q;const X=(Q=z.toolCalls)==null?void 0:Q.map(M=>M.id===O.callId?{...M,result:O.result}:M);return{...z,toolCalls:X}};e(z=>{const X=z.streamingMessage;return X&&X.id===O.messageId?{streamingMessage:U(X)}:{messages:z.messages.map(Q=>Q.id===O.messageId?U(Q):Q)}});break}case"chat.vision_fallback":{if(!At(i,((v=r().currentSession)==null?void 0:v.id)??null)){u();break}const O=i.payload;e(U=>{const z=`${O.messageId}-${O.attachmentId}`,X={...U.visionFallbackByMessage};return X[z]={type:O.type,attachmentId:O.attachmentId,filename:O.filename,description:O.description},{visionFallbackByMessage:X}});break}case"chat.todo":{if(!At(i,((b=r().currentSession)==null?void 0:b.id)??null)){u();break}const O=i.payload;e({currentTodos:O.todos});break}case"chat.summary":{if(!At(i,((x=r().currentSession)==null?void 0:x.id)??null)){u();break}const O=i.payload;e(U=>({currentSession:U.currentSession?{...U.currentSession,summary:O.summary}:null}));break}case"chat.progress":{if(!At(i,((S=r().currentSession)==null?void 0:S.id)??null)){u();break}const O=i.payload;console.log("Progress:",O.message,O.phase);break}case"chat.format_retry":{if(!At(i,((j=r().currentSession)==null?void 0:j.id)??null)){u();break}const O=i.payload;console.log("Format retry:",O.attempt,"/",O.maxAttempts);break}case"chat.done":{if(!At(i,((A=r().currentSession)==null?void 0:A.id)??null)){u();break}ki(),an==null||an();const O=i.payload,U=O.stats;Ht.messageId=null,Ht.deltaContent="",Ht.thinkingContent="",Ht.toolOutput=[],jd.delete(O.messageId),e(z=>{const X=z.streamingMessage,Q=X&&X.id===O.messageId?{...X,isStreaming:!1,stats:U??X.stats}:null;return{messages:z.messages.map(M=>M.id===O.messageId?Q??{...M,isStreaming:!1,stats:U??M.stats}:M),streamingMessageId:null,streamingMessage:null,visionFallbackByMessage:{}}});break}case"chat.error":{if(!At(i,((N=r().currentSession)==null?void 0:N.id)??null)){u();break}ki(),an==null||an();const O=i.payload;console.error("Chat error:",O.error,"recoverable:",O.recoverable),O.recoverable||(Ht.messageId=null,Ht.deltaContent="",Ht.thinkingContent="",Ht.toolOutput=[]),e(U=>({error:{code:"CHAT_ERROR",message:O.error},streamingMessageId:O.recoverable?U.streamingMessageId:null,...O.recoverable?{}:{messages:U.streamingMessage?U.messages.map(z=>z.id===U.streamingMessage.id?U.streamingMessage:z):U.messages,streamingMessage:null}}));break}case"chat.path_confirmation":{if(!At(i,((D=r().currentSession)==null?void 0:D.id)??null)){u();break}const O=i.payload;e({pendingPathConfirmation:{callId:O.callId,tool:O.tool,paths:O.paths,workdir:O.workdir,reason:O.reason}});break}case"chat.ask_user":{if(!At(i,((T=r().currentSession)==null?void 0:T.id)??null)){u();return}const O=i.payload;e({pendingQuestion:{callId:O.callId,question:O.question}});break}case"mode.changed":{if(!At(i,((I=r().currentSession)==null?void 0:I.id)??null)){u();break}const O=i.payload;e(U=>({currentSession:U.currentSession?{...U.currentSession,mode:O.mode}:null}));break}case"phase.changed":{const O=i.payload,U=i.sessionId,z=(H=r().currentSession)==null?void 0:H.id,X=U&&U!==z;e(Q=>({sessions:Q.sessions.map(M=>M.id===U?{...M,phase:O.phase}:M)})),X||e(Q=>({currentSession:Q.currentSession?{...Q.currentSession,phase:O.phase}:null}));break}case"criteria.updated":{if(!At(i,((V=r().currentSession)==null?void 0:V.id)??null)){u();break}const O=i.payload;e(U=>({currentSession:U.currentSession?{...U.currentSession,criteria:O.criteria}:null}));break}case"context.state":{const O=i.payload,U=At(i,((Y=r().currentSession)==null?void 0:Y.id)??null);O.subAgentId?U&&r().updateSubAgentContextState(O.subAgentId,O.context):U?e({contextState:O.context}):u();break}case"session.name_generated":{const O=i.payload,U=i.sessionId,z=(q=r().currentSession)==null?void 0:q.id;e(X=>{const Q=X.sessions.map(L=>L.id===U?{...L,title:O.name,updatedAt:new Date().toISOString()}:L),M=z===U?X.currentSession?{...X.currentSession,title:O.name,updatedAt:new Date().toISOString()}:null:X.currentSession;return{sessions:Q,currentSession:M}});break}case"queue.state":{const O=i.payload;e({queuedMessages:O.messages});break}case"devServer.output":case"devServer.state":{ir.getState().handleMessage(i);break}case"backgroundProcess.started":case"backgroundProcess.output":case"backgroundProcess.exited":case"backgroundProcess.removed":{Pa.getState().handleMessage(i.type,i.payload);break}case"error":{const O=i.payload;console.error("Server error:",O),e({error:{code:O.code,message:O.message},streamingMessageId:null});break}}}}));function vb(){return Ee(e=>{var r;return((r=e.currentSession)==null?void 0:r.isRunning)??!1})}function MS(){return Ee(e=>e.queuedMessages)}function OS(){return Ee(e=>e.abortInProgress)}function BS(){const e=Ee(s=>s.connect),r=Ee(s=>s.connectionStatus),i=Ti(s=>s.load);return P.useEffect(()=>{e()},[e]),P.useEffect(()=>{r==="connected"&&i()},[r,i]),{connectionStatus:r}}function Jd(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const r=Math.random()*16|0;return(e==="x"?r:r&3|8).toString(16)})}function Ax(e,r){const i=Pt.ws;!i||i.readyState!==WebSocket.OPEN||i.send(JSON.stringify({id:Jd(),type:e,payload:r}))}const sr=Wn((e,r)=>({isOpen:!1,sessions:[],workdir:null,setOpen:i=>e({isOpen:i}),toggleOpen:()=>e(i=>({isOpen:!i.isOpen})),setWorkdir:i=>e({workdir:i}),fetchSessions:async()=>{try{const i=await Ce("/api/terminals");if(i.ok){const s=await i.json();e({sessions:s});const c=Pt.ws;if(c&&c.readyState===WebSocket.OPEN)for(const u of s)c.send(JSON.stringify({id:Jd(),type:"terminal.subscribe",payload:{sessionId:u.id}}))}}catch(i){console.error("Failed to fetch terminals:",i)}},createSession:async i=>{try{const s=await Ce("/api/terminals",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workdir:i??r().workdir??void 0})});if(s.ok){const c=await s.json();e(f=>({sessions:[...f.sessions,c]}));const u=Pt.ws;u&&u.readyState===WebSocket.OPEN&&u.send(JSON.stringify({id:Jd(),type:"terminal.subscribe",payload:{sessionId:c.id}}))}}catch(s){console.error("Failed to create terminal:",s)}},writeSession:(i,s)=>{Ax("terminal.write",{sessionId:i,data:s})},resizeSession:(i,s,c)=>{Ax("terminal.resize",{sessionId:i,cols:s,rows:c})},killSession:async i=>{try{(await Ce(`/api/terminals/${i}`,{method:"DELETE"})).ok&&e(c=>({sessions:c.sessions.filter(u=>u.id!==i)}))}catch(s){console.error("Failed to kill terminal:",s)}},handleMessage:i=>{switch(i.type){case"terminal.exit":{const{sessionId:s}=i.payload||{};s&&e(c=>{const u=c.sessions.filter(f=>f.id!==s);return u.length===0&&c.isOpen?{sessions:[],isOpen:!1}:{sessions:u}});break}}}}));Pt.subscribe(e=>{var r;(r=e.type)!=null&&r.startsWith("terminal.")&&sr.getState().handleMessage(e)});const yh=P.forwardRef(({icon:e,iconSize:r="w-3.5 h-3.5",className:i="",...s},c)=>o.jsx("button",{ref:c,type:"button",className:`p-1 rounded text-text-muted hover:text-text-primary hover:bg-bg-primary transition-colors ${i}`,...s,children:o.jsx("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:e})})}));yh.displayName="IconButton";const IS="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z",Mi=P.forwardRef((e,r)=>o.jsx(yh,{ref:r,icon:IS,title:"Edit",...e}));Mi.displayName="EditButton";const zS="M6 18L18 6M6 6l12 12",$l=P.forwardRef((e,r)=>o.jsx(yh,{ref:r,icon:zS,...e}));$l.displayName="CloseButton";var ql=rb();function ln({isOpen:e,onClose:r,title:i,children:s,size:c="md"}){const u=P.useRef(null),f=P.useRef(null),l=P.useCallback(p=>{p.key==="Escape"&&r()},[r]);if(P.useEffect(()=>{var p,g;return e?(f.current=document.activeElement,(p=u.current)==null||p.focus(),document.body.style.overflow="hidden"):((g=f.current)==null||g.focus(),document.body.style.overflow=""),()=>{document.body.style.overflow=""}},[e]),P.useEffect(()=>{if(e)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[e,l]),!e)return null;const d={sm:"max-w-sm md:max-w-sm",md:"max-w-[90vw] md:max-w-md",lg:"max-w-[90vw] md:max-w-2xl h-[80vh]",xl:"max-w-[90vw] md:max-w-4xl h-[80vh]",full:"max-w-[95vw] h-[90vh]"};return ql.createPortal(o.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[o.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:r}),o.jsxs("div",{ref:u,tabIndex:-1,className:`relative w-full ${d[c]} bg-bg-secondary border border-border rounded shadow-xl flex flex-col max-h-[90vh]`,children:[o.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border flex-shrink-0",children:[o.jsx("h2",{className:"text-lg font-semibold text-text-primary truncate",children:i}),o.jsx($l,{onClick:r,className:"flex-shrink-0","aria-label":"Close modal"})]}),o.jsx("div",{className:"p-4 overflow-y-auto flex-1 min-h-0",children:s})]})]}),document.body)}const st=P.forwardRef(({variant:e="secondary",size:r="md",className:i="",children:s,...c},u)=>{const f="rounded font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed",l={primary:"bg-accent-primary/25 text-white hover:bg-accent-primary/40",secondary:"bg-bg-tertiary text-text-primary hover:bg-border",danger:"bg-accent-error text-white hover:bg-accent-error/80"},d={sm:"px-1.5 py-1 text-xs",md:"px-3 py-1.5 text-sm",lg:"px-4 py-2 text-base"};return o.jsx("button",{ref:u,className:`${f} ${l[e]} ${d[r]} ${i}`,...c,children:s})});st.displayName="Button";function HS({value:e,defaultUrl:r,disabled:i,onChange:s}){const c=e??r;return o.jsxs("div",{className:"relative",children:[o.jsx("select",{value:c,disabled:i,onChange:u=>{const f=u.target.value;s(f===r?null:f)},className:"appearance-none bg-bg-tertiary border border-border rounded px-1.5 pr-5 text-xs focus:outline-none focus:ring-1 focus:ring-accent-primary disabled:opacity-40 cursor-pointer",style:{width:"60px"},children:bS.map(({url:u,label:f})=>o.jsx("option",{value:u,title:f,children:f.split(" ")[0]},u))}),o.jsx("svg",{className:"absolute right-0.5 top-1/2 -translate-y-1/2 w-3 h-3 pointer-events-none text-text-muted",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})}const Dx=[{key:"general",label:"General"},{key:"build",label:"Agent"},{key:"sub-agent",label:"Sub-agent"}];function PS(){const e=Ti(d=>d.settings),r=Ti(d=>d.update),i=Ti(d=>d.updateEvent),s=Ti(d=>d.updateAgentOverride),c=Ti(d=>d.load);P.useEffect(()=>{c()},[c]);const u=async()=>{await _S()==="granted"&&r({...e,browserNotificationEnabled:!0})},f=(d,p,g,m)=>{d==="general"?i(p,{[g]:m}):s(d,p,{[g]:m})},l=(d,p,g)=>{d==="general"?i(p,{customSoundUrl:g}):s(d,p,{customSoundUrl:g})};return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"Master Controls"}),o.jsx(Lx,{label:"Sound notifications",description:"Play sounds when events occur",checked:e.soundEnabled,onChange:d=>r({...e,soundEnabled:d})}),o.jsx(Lx,{label:"Browser notifications",description:"Show desktop notifications when the window is not focused",checked:e.browserNotificationEnabled,onChange:d=>{d&&typeof Notification<"u"&&Notification.permission!=="granted"?u():r({...e,browserNotificationEnabled:d})}}),typeof Notification<"u"&&Notification.permission==="denied"&&e.browserNotificationEnabled&&o.jsx("p",{className:"text-xs text-accent-error ml-6",children:"Browser notifications are blocked. Please enable them in your browser settings."})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"Notification Settings"}),o.jsx("div",{className:"border border-border rounded overflow-hidden",children:o.jsxs("table",{className:"w-full text-sm",children:[o.jsx("thead",{className:"sticky top-0 bg-bg-tertiary",children:o.jsxs("tr",{className:"border-b border-border",children:[o.jsx("th",{className:"text-left px-3 py-2 text-text-primary font-medium w-40",children:"Event"}),Dx.map(d=>o.jsx("th",{className:"text-center px-2 py-2 text-text-primary font-medium",children:d.label},d.key))]})}),o.jsx("tbody",{children:vS.map(d=>o.jsxs("tr",{className:"border-b border-border last:border-b-0 hover:bg-bg-secondary/50",children:[o.jsx("td",{className:"px-3 py-2",children:o.jsx("div",{className:"text-text-primary text-xs",children:d.label})}),Dx.map(p=>{const g=gb(e,d.key,p.key==="general"?void 0:p.key),m=pb[d.key];return o.jsx("td",{className:"px-2 py-2 align-top",children:o.jsxs("div",{className:"flex flex-col items-center gap-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("label",{className:"flex items-center gap-1 text-text-secondary",children:o.jsx("input",{type:"checkbox",checked:g.soundEnabled,onChange:y=>f(p.key,d.key,"soundEnabled",y.target.checked),disabled:!e.soundEnabled,className:"rounded border-border",title:"Sound"})}),o.jsx("label",{className:"flex items-center gap-1 text-text-secondary",children:o.jsx("input",{type:"checkbox",checked:g.browserNotification,onChange:y=>f(p.key,d.key,"browserNotification",y.target.checked),disabled:!e.browserNotificationEnabled,className:"rounded border-border",title:"Browser"})})]}),g.soundEnabled&&e.soundEnabled&&o.jsx(HS,{value:g.customSoundUrl,defaultUrl:m,disabled:!e.soundEnabled,onChange:y=>l(p.key,d.key,y)})]})},p.key)})]},d.key))})]})})]})]})}function Lx({label:e,description:r,checked:i,onChange:s}){return o.jsxs("label",{className:"flex items-start gap-3 cursor-pointer group",children:[o.jsx("div",{className:"pt-0.5",children:o.jsx("div",{className:`relative w-9 h-5 rounded-full transition-colors ${i?"bg-accent-primary":"bg-bg-tertiary border border-border"}`,onClick:c=>{c.preventDefault(),s(!i)},children:o.jsx("div",{className:`absolute top-0.5 w-4 h-4 rounded-full bg-white shadow transition-transform ${i?"translate-x-4":"translate-x-0.5"}`})})}),o.jsxs("div",{children:[o.jsx("div",{className:"text-sm text-text-primary group-hover:text-accent-primary transition-colors",children:e}),o.jsx("div",{className:"text-xs text-text-muted",children:r})]})]})}async function _h(e,r){r({loading:!0});try{const s=await(await Ce(e)).json();r({defaults:s.defaults??[],userItems:s.userItems??[],loading:!1})}catch{r({loading:!1})}}const Er=Wn((e,r)=>({defaults:[],userItems:[],loading:!1,fetchSkills:async()=>{await _h("/api/skills",e)},toggleSkill:async i=>{try{const c=await(await Ce(`/api/skills/${i}/toggle`,{method:"POST"})).json();e(u=>({defaults:u.defaults.map(f=>f.id===i?{...f,enabled:c.enabled}:f),userItems:u.userItems.map(f=>f.id===i?{...f,enabled:c.enabled}:f)}))}catch{}},fetchSkill:async i=>{try{const s=await Ce(`/api/skills/${i}`);return s.ok?await s.json():null}catch{return null}},fetchDefaultContent:async i=>{try{const s=await Ce(`/api/skills/defaults/${i}`);return s.ok?await s.json():null}catch{return null}},createSkill:async i=>{const s=await si("POST","/api/skills",i);return s.success&&await r().fetchSkills(),s},updateSkill:async(i,s)=>{const c=await si("PUT",`/api/skills/${i}`,s);return c.success&&await r().fetchSkills(),c},deleteSkill:async i=>{try{const s=await Ce(`/api/skills/${i}`,{method:"DELETE"}),c=await s.json();return s.ok?(e(u=>({userItems:u.userItems.filter(f=>f.id!==i)})),{success:!0}):{success:!1,error:c.error??"Failed to delete"}}catch{return{success:!1,error:"Network error"}}},duplicateSkill:async i=>{try{const s=await Ce(`/api/skills/${i}/duplicate`,{method:"POST"}),c=await s.json();return s.ok?(await r().fetchSkills(),{success:!0}):{success:!1,error:c.error??"Failed to duplicate"}}catch{return{success:!1,error:"Network error"}}}}));function Sh(){const[e,r]=P.useState({id:null,type:null}),i=P.useCallback(u=>r({id:u,type:"delete"}),[]),s=P.useCallback(()=>r({id:null,type:null}),[]),c=P.useCallback((u,f)=>e.id===u&&e.type===f,[e.id,e.type]);return{requestDelete:i,clearConfirm:s,isConfirming:c}}function wh({onConfirm:e,onCancel:r}){return o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{onClick:e,className:"px-1.5 py-0.5 rounded text-xs hover:opacity-90 transition-colors bg-accent-error/20 text-accent-error hover:bg-accent-error/30",children:"Delete"}),o.jsx("button",{onClick:r,className:"px-1.5 py-0.5 rounded text-text-muted text-xs hover:bg-bg-primary transition-colors",children:"Cancel"})]})}function Ch({onClick:e}){return o.jsx("button",{onClick:e,className:"p-1.5 rounded hover:bg-bg-primary text-text-muted hover:text-accent-error transition-colors",title:"Delete",children:o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})}function Wa({onClick:e}){return o.jsx("button",{onClick:e,className:"p-1.5 rounded hover:bg-bg-primary text-text-muted hover:text-text-primary transition-colors",title:"Duplicate",children:o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})}function Ai({label:e,value:r,onChange:i,placeholder:s,readOnly:c,hint:u,mono:f}){return o.jsxs("div",{children:[o.jsxs("label",{className:"block text-xs text-text-secondary mb-1",children:[e,u&&o.jsx("span",{className:"text-text-muted ml-1",children:u})]}),o.jsx("input",{value:r,onChange:l=>i(l.target.value),readOnly:c,placeholder:s,className:`w-full px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm focus:outline-none focus:ring-1 focus:ring-accent-primary ${f?"font-mono":""} ${c?"opacity-60":""}`})]})}function FS({onCancel:e,onSave:r,saving:i,saveDisabled:s}){return o.jsxs("div",{className:"flex justify-end gap-2 pt-2 border-t border-border",children:[o.jsx(st,{variant:"secondary",onClick:e,children:"Cancel"}),o.jsx(st,{variant:"primary",onClick:r,disabled:i||s,children:i?"Saving...":"Save"})]})}function kh({message:e}){return o.jsx("div",{className:"text-accent-error text-sm px-3 py-2 bg-accent-error/10 rounded",children:e})}function bb({description:e,onNew:r,newLabel:i="+ New"}){return o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsx("p",{className:"text-text-secondary text-sm",children:e}),o.jsx("div",{className:"flex items-center gap-2 flex-shrink-0 ml-3",children:o.jsx(st,{variant:"primary",size:"sm",onClick:r,children:i})})]})}function yb({isBuiltIn:e,isConfirmingDelete:r,onView:i,onEdit:s,onDuplicate:c,onDelete:u,children:f}){return o.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[o.jsx("div",{className:"min-w-0 flex-1 mr-3",children:f}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[e&&i&&o.jsx("button",{onClick:i,className:"p-1.5 rounded text-text-muted hover:text-text-primary hover:bg-bg-primary transition-colors",title:"View",children:o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})})}),o.jsx(Wa,{onClick:c}),!e&&s&&o.jsx(Mi,{onClick:s}),!e&&(r?o.jsx(wh,{onConfirm:()=>{u==null||u()},onCancel:()=>{}}):o.jsx(Ch,{onClick:()=>u==null?void 0:u()}))]})]})}function US({id:e,name:r,description:i,isBuiltIn:s,isConfirmingDelete:c,onView:u,onEdit:f,onDuplicate:l,onDelete:d}){return o.jsxs(yb,{isBuiltIn:s,isConfirmingDelete:c,onView:u,onEdit:f,onDuplicate:l,onDelete:d,children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-text-primary text-sm font-medium",children:r}),o.jsx("span",{className:"text-text-muted text-xs font-mono",children:e})]}),i&&o.jsx("p",{className:"text-text-muted text-xs truncate",children:i})]})}function _b({loading:e,hasItems:r,loadingLabel:i,emptyLabel:s,children:c}){return e&&!r?o.jsx("div",{className:"text-text-muted text-sm",children:i}):r?o.jsx("div",{className:"space-y-4",children:c}):s?o.jsx("div",{className:"text-text-muted text-sm",children:s}):null}function Sb({name:e,id:r,nameLabel:i="Name",idLabel:s="ID",namePlaceholder:c="My Item",idPlaceholder:u="my-item",nameHint:f,readOnlyId:l=!1,readOnlyHint:d="(read-only)",onNameChange:p,onIdChange:g}){return o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(Ai,{label:i,value:e,onChange:p,placeholder:c,hint:f}),o.jsx(Ai,{label:s,value:r,onChange:g,readOnly:l,placeholder:u,hint:l?d:void 0,mono:!0})]})}function wb(e={}){const{initialData:r={}}=e,[i,s]=P.useState("list"),[c,u]=P.useState(null),[f,l]=P.useState(""),[d,p]=P.useState(!1),[g,m]=P.useState(r),y=P.useCallback(()=>{m(r),l(""),u(null)},[r]),_=P.useCallback(b=>{s(b),b==="list"&&y()},[y]),k=P.useCallback(b=>{m(x=>typeof b=="function"?b(x):b)},[]),C=P.useCallback((b,x={})=>{u(b),s("edit"),m({...x}),l("")},[]),v=P.useCallback(()=>{u(null),s("edit"),m(r),l("")},[r]);return{view:i,editingId:c,formError:f,saving:d,formData:g,setView:_,setEditingId:u,setFormError:l,setFormData:k,setSaving:p,resetForm:y,startEditing:C,startNew:v}}function Rx({skill:e,isBuiltIn:r,isConfirmingDelete:i,onView:s,onEdit:c,onDuplicate:u,onDelete:f}){return o.jsx(US,{id:e.id,name:e.name,description:e.description,isBuiltIn:r,isConfirmingDelete:i,onView:s,onEdit:c,onDuplicate:u,onDelete:f})}function $S({isOpen:e}){const r=Er(O=>O.defaults),i=Er(O=>O.userItems),s=Er(O=>O.loading),c=Er(O=>O.fetchSkills),u=Er(O=>O.fetchSkill),f=Er(O=>O.fetchDefaultContent),l=Er(O=>O.createSkill),d=Er(O=>O.updateSkill),p=Er(O=>O.deleteSkill),{view:g,editingId:m,formError:y,saving:_,formData:k,setView:C,setEditingId:v,setFormError:b,setFormData:x,setSaving:S}=wb(),{clearConfirm:j}=Sh();P.useEffect(()=>{e&&(c(),C("list"),v(null),j())},[e,c,j]);const A=(O,U,z,X)=>{x({name:X??O.metadata.name,id:z??O.metadata.id,description:O.metadata.description??"",version:O.metadata.version??"1.0.0",prompt:O.prompt,isReadOnly:U})},N=async O=>{if(r.some(z=>z.id===O)){const z=await f(O);if(!z)return;A(z,!0),v(O),b(""),C("edit")}else{const z=await u(O);if(!z)return;A(z,!0),v(O),b(""),C("edit")}},D=async O=>{const z=r.some(Q=>Q.id===O)?await f(O):await u(O);if(!z)return;const X=`${O}-copy-${Date.now()}`;A(z,!1,X,`${z.metadata.name} (copy)`),v(null),b(""),C("edit")},T=()=>{x({name:"",id:"",description:"",version:"1.0.0",prompt:"",isReadOnly:!1}),C("edit")},I=async O=>{const U=await u(O);U&&(A(U,!1),v(O),b(""),C("edit"))},H=async O=>{await p(O),j()},V=async()=>{const O=m??k.id;if(!O||!k.name||!k.prompt){b("Name, ID, and prompt are required.");return}S(!0),b("");const U={metadata:{id:O,name:k.name,description:k.description,version:k.version},prompt:k.prompt},z=m?await d(m,U):await l(U);if(S(!1),!z.success){b(z.error??"Failed to save skill.");return}C("list")},Y=O=>{x(U=>({...U,name:O})),m||x(U=>({...U,id:O.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}))},q=k.isReadOnly;return g==="edit"?o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"flex justify-between items-center mb-3",children:[o.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:q?k.name:m?"Edit Skill":"New Skill"}),o.jsx("button",{onClick:()=>C("list"),className:"text-text-muted hover:text-text-primary",children:"Cancel"})]}),y&&o.jsx(kh,{message:y}),o.jsxs("div",{className:"space-y-3 mb-3",children:[o.jsx(Sb,{name:k.name,id:k.id,nameLabel:"Name",idLabel:"ID",namePlaceholder:"My Skill",idPlaceholder:"my-skill",readOnlyId:!0,onNameChange:Y,onIdChange:()=>{}}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(Ai,{label:"Description",value:k.description,onChange:O=>x(U=>({...U,description:O})),placeholder:"What this skill does...",readOnly:q}),o.jsx(Ai,{label:"Version",value:k.version,onChange:O=>x(U=>({...U,version:O})),placeholder:"1.0.0",readOnly:q})]})]}),o.jsxs("div",{className:"flex-1 min-h-[120px] border-t border-border pt-3 flex flex-col",children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Prompt"}),o.jsx("textarea",{value:k.prompt,onChange:O=>x(U=>({...U,prompt:O.target.value})),readOnly:q,placeholder:"The system prompt for this skill...",className:"flex-1 w-full px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-none focus:outline-none focus:ring-1 focus:ring-accent-primary"})]}),o.jsxs("div",{className:"flex justify-end gap-2 pt-3 mt-3 border-t border-border flex-shrink-0",children:[o.jsx(st,{variant:"secondary",onClick:()=>C("list"),children:"Cancel"}),q?o.jsx(st,{variant:"primary",onClick:()=>{x(O=>({...O,name:O.name+" (copy)",id:`${m}-copy-${Date.now()}`,isReadOnly:!1})),v(null)},children:"Duplicate & Customize"}):o.jsx(st,{variant:"primary",onClick:V,disabled:_||!k.name||!k.id||!k.prompt,children:_?"Saving...":"Save"})]})]}):o.jsxs("div",{children:[o.jsx(bb,{description:"Skills provide domain-specific knowledge that agents can load on demand.",onNew:T}),o.jsxs(_b,{loading:s,hasItems:r.length>0||i.length>0,loadingLabel:"Loading skills...",emptyLabel:"No skills created yet.",children:[r.length>0&&o.jsxs("div",{children:[o.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Built-in"}),o.jsx("div",{className:"space-y-2",children:r.map(O=>o.jsx(Rx,{skill:O,isBuiltIn:!0,isConfirmingDelete:!1,onView:()=>N(O.id),onDuplicate:()=>D(O.id)},O.id))})]}),i.length>0&&o.jsxs("div",{children:[o.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Custom"}),o.jsx("div",{className:"space-y-2",children:i.map(O=>o.jsx(Rx,{skill:O,isBuiltIn:!1,isConfirmingDelete:!1,onView:()=>N(O.id),onEdit:()=>I(O.id),onDuplicate:()=>D(O.id),onDelete:()=>H(O.id)},O.id))})]})]})]})}function qS({isOpen:e,onClose:r}){const[i,s]=P.useState("instructions");return o.jsx(ln,{isOpen:e,onClose:r,title:"Settings",size:"xl",children:o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"flex border-b border-border mb-4 -mt-1",children:[o.jsx(_l,{label:"Instructions",active:i==="instructions",onClick:()=>s("instructions")}),o.jsx(_l,{label:"Skills",active:i==="skills",onClick:()=>s("skills")}),o.jsx(_l,{label:"Notifications",active:i==="notifications",onClick:()=>s("notifications")}),o.jsx(_l,{label:"Advanced",active:i==="advanced",onClick:()=>s("advanced")})]}),i==="instructions"&&o.jsx(GS,{isOpen:e}),i==="skills"&&o.jsx($S,{isOpen:e}),i==="notifications"&&o.jsx("div",{className:"max-h-[60vh] overflow-y-auto",children:o.jsx(PS,{})}),i==="advanced"&&o.jsx(WS,{onClose:r})]})})}function WS({onClose:e}){const[,r]=ar();function i(){e(),r("/onboarding")}return o.jsx("div",{className:"space-y-6",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-sm font-medium text-text-primary mb-1",children:"Onboarding"}),o.jsx("p",{className:"text-sm text-text-muted mb-4",children:"Reset your OpenFox setup and go through the initial configuration again."}),o.jsx(st,{variant:"secondary",onClick:i,children:"Launch Onboarding"})]})})}function _l({label:e,active:r,onClick:i}){return o.jsx("button",{onClick:i,className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${r?"border-accent-primary text-accent-primary":"border-transparent text-text-muted hover:text-text-secondary hover:border-border"}`,children:e})}function GS({isOpen:e}){const r=ni(v=>v.settings),i=ni(v=>v.loading),s=ni(v=>v.getSetting),c=ni(v=>v.setSetting),u=r[ti.GLOBAL_INSTRUCTIONS]??"",f=i[ti.GLOBAL_INSTRUCTIONS]??!1,[l,d]=P.useState(u),[p,g]=P.useState(!1),[m,y]=P.useState(!1);P.useEffect(()=>{e&&s(ti.GLOBAL_INSTRUCTIONS)},[e,s]),P.useEffect(()=>{d(u),g(!1)},[u]);const _=async()=>{y(!0),c(ti.GLOBAL_INSTRUCTIONS,l),y(!1),g(!1)},k=()=>{d(u),g(!1)},C=f||m;return o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-text-primary mb-2",children:"Global Instructions"}),o.jsx("p",{className:"text-sm text-text-muted mb-2",children:"These instructions are injected into every prompt, regardless of project."}),o.jsx("textarea",{value:l,onChange:v=>{d(v.target.value),g(!0)},placeholder:"Enter global instructions that apply to all projects...",className:"w-full h-64 px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-none focus:outline-none focus:ring-1 focus:ring-accent-primary",disabled:C})]}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(st,{variant:"secondary",onClick:k,disabled:!p,children:"Discard"}),o.jsx(st,{variant:"primary",onClick:_,disabled:!p||C,children:m?"Saving...":"Save"})]})]})}var Td={exports:{}},Mx;function VS(){return Mx||(Mx=1,(function(e,r){(function(i,s){e.exports=s()})(globalThis,(()=>(()=>{var i={4567:function(f,l,d){var p=this&&this.__decorate||function(x,S,j,A){var N,D=arguments.length,T=D<3?S:A===null?A=Object.getOwnPropertyDescriptor(S,j):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(x,S,j,A);else for(var I=x.length-1;I>=0;I--)(N=x[I])&&(T=(D<3?N(T):D>3?N(S,j,T):N(S,j))||T);return D>3&&T&&Object.defineProperty(S,j,T),T},g=this&&this.__param||function(x,S){return function(j,A){S(j,A,x)}};Object.defineProperty(l,"__esModule",{value:!0}),l.AccessibilityManager=void 0;const m=d(9042),y=d(9924),_=d(844),k=d(4725),C=d(2585),v=d(3656);let b=l.AccessibilityManager=class extends _.Disposable{constructor(x,S,j,A){super(),this._terminal=x,this._coreBrowserService=j,this._renderService=A,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 y.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(`
|
|
58
|
+
`)))),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,_.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(x){for(let S=0;S<x;S++)this._handleChar(" ")}_handleChar(x){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==x&&(this._charsToAnnounce+=x):this._charsToAnnounce+=x,x===`
|
|
59
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=m.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(x){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(x)||this._charsToConsume.push(x)}_refreshRows(x,S){this._liveRegionDebouncer.refresh(x,S,this._terminal.rows)}_renderRows(x,S){const j=this._terminal.buffer,A=j.lines.length.toString();for(let N=x;N<=S;N++){const D=j.lines.get(j.ydisp+N),T=[],I=(D==null?void 0:D.translateToString(!0,void 0,void 0,T))||"",H=(j.ydisp+N+1).toString(),V=this._rowElements[N];V&&(I.length===0?(V.innerText=" ",this._rowColumns.set(V,[0,1])):(V.textContent=I,this._rowColumns.set(V,T)),V.setAttribute("aria-posinset",H),V.setAttribute("aria-setsize",A))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(x,S){const j=x.target,A=this._rowElements[S===0?1:this._rowElements.length-2];if(j.getAttribute("aria-posinset")===(S===0?"1":`${this._terminal.buffer.lines.length}`)||x.relatedTarget!==A)return;let N,D;if(S===0?(N=j,D=this._rowElements.pop(),this._rowContainer.removeChild(D)):(N=this._rowElements.shift(),D=j,this._rowContainer.removeChild(N)),N.removeEventListener("focus",this._topBoundaryFocusListener),D.removeEventListener("focus",this._bottomBoundaryFocusListener),S===0){const T=this._createAccessibilityTreeNode();this._rowElements.unshift(T),this._rowContainer.insertAdjacentElement("afterbegin",T)}else{const T=this._createAccessibilityTreeNode();this._rowElements.push(T),this._rowContainer.appendChild(T)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(S===0?-1:1),this._rowElements[S===0?1:this._rowElements.length-2].focus(),x.preventDefault(),x.stopImmediatePropagation()}_handleSelectionChange(){var I;if(this._rowElements.length===0)return;const x=document.getSelection();if(!x)return;if(x.isCollapsed)return void(this._rowContainer.contains(x.anchorNode)&&this._terminal.clearSelection());if(!x.anchorNode||!x.focusNode)return void console.error("anchorNode and/or focusNode are null");let S={node:x.anchorNode,offset:x.anchorOffset},j={node:x.focusNode,offset:x.focusOffset};if((S.node.compareDocumentPosition(j.node)&Node.DOCUMENT_POSITION_PRECEDING||S.node===j.node&&S.offset>j.offset)&&([S,j]=[j,S]),S.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(S={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(S.node))return;const A=this._rowElements.slice(-1)[0];if(j.node.compareDocumentPosition(A)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(j={node:A,offset:((I=A.textContent)==null?void 0:I.length)??0}),!this._rowContainer.contains(j.node))return;const N=({node:H,offset:V})=>{const Y=H instanceof Text?H.parentNode:H;let q=parseInt(Y==null?void 0:Y.getAttribute("aria-posinset"),10)-1;if(isNaN(q))return console.warn("row is invalid. Race condition?"),null;const O=this._rowColumns.get(Y);if(!O)return console.warn("columns is null. Race condition?"),null;let U=V<O.length?O[V]:O.slice(-1)[0]+1;return U>=this._terminal.cols&&(++q,U=0),{row:q,column:U}},D=N(S),T=N(j);if(D&&T){if(D.row>T.row||D.row===T.row&&D.column>=T.column)throw new Error("invalid range");this._terminal.select(D.column,D.row,(T.row-D.row)*this._terminal.cols-D.column+T.column)}}_handleResize(x){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let S=this._rowContainer.children.length;S<this._terminal.rows;S++)this._rowElements[S]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[S]);for(;this._rowElements.length>x;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const x=this._coreBrowserService.mainDocument.createElement("div");return x.setAttribute("role","listitem"),x.tabIndex=-1,this._refreshRowDimensions(x),x}_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 x=0;x<this._terminal.rows;x++)this._refreshRowDimensions(this._rowElements[x])}}_refreshRowDimensions(x){x.style.height=`${this._renderService.dimensions.css.cell.height}px`}};l.AccessibilityManager=b=p([g(1,C.IInstantiationService),g(2,k.ICoreBrowserService),g(3,k.IRenderService)],b)},3614:(f,l)=>{function d(y){return y.replace(/\r?\n/g,"\r")}function p(y,_){return _?"\x1B[200~"+y+"\x1B[201~":y}function g(y,_,k,C){y=p(y=d(y),k.decPrivateModes.bracketedPasteMode&&C.rawOptions.ignoreBracketedPasteMode!==!0),k.triggerDataEvent(y,!0),_.value=""}function m(y,_,k){const C=k.getBoundingClientRect(),v=y.clientX-C.left-10,b=y.clientY-C.top-10;_.style.width="20px",_.style.height="20px",_.style.left=`${v}px`,_.style.top=`${b}px`,_.style.zIndex="1000",_.focus()}Object.defineProperty(l,"__esModule",{value:!0}),l.rightClickHandler=l.moveTextAreaUnderMouseCursor=l.paste=l.handlePasteEvent=l.copyHandler=l.bracketTextForPaste=l.prepareTextForTerminal=void 0,l.prepareTextForTerminal=d,l.bracketTextForPaste=p,l.copyHandler=function(y,_){y.clipboardData&&y.clipboardData.setData("text/plain",_.selectionText),y.preventDefault()},l.handlePasteEvent=function(y,_,k,C){y.stopPropagation(),y.clipboardData&&g(y.clipboardData.getData("text/plain"),_,k,C)},l.paste=g,l.moveTextAreaUnderMouseCursor=m,l.rightClickHandler=function(y,_,k,C,v){m(y,_,k),v&&C.rightClickSelect(y),_.value=C.selectionText,_.select()}},7239:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ColorContrastCache=void 0;const p=d(1505);l.ColorContrastCache=class{constructor(){this._color=new p.TwoKeyMap,this._css=new p.TwoKeyMap}setCss(g,m,y){this._css.set(g,m,y)}getCss(g,m){return this._css.get(g,m)}setColor(g,m,y){this._color.set(g,m,y)}getColor(g,m){return this._color.get(g,m)}clear(){this._color.clear(),this._css.clear()}}},3656:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.addDisposableDomListener=void 0,l.addDisposableDomListener=function(d,p,g,m){d.addEventListener(p,g,m);let y=!1;return{dispose:()=>{y||(y=!0,d.removeEventListener(p,g,m))}}}},3551:function(f,l,d){var p=this&&this.__decorate||function(b,x,S,j){var A,N=arguments.length,D=N<3?x:j===null?j=Object.getOwnPropertyDescriptor(x,S):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(b,x,S,j);else for(var T=b.length-1;T>=0;T--)(A=b[T])&&(D=(N<3?A(D):N>3?A(x,S,D):A(x,S))||D);return N>3&&D&&Object.defineProperty(x,S,D),D},g=this&&this.__param||function(b,x){return function(S,j){x(S,j,b)}};Object.defineProperty(l,"__esModule",{value:!0}),l.Linkifier=void 0;const m=d(3656),y=d(8460),_=d(844),k=d(2585),C=d(4725);let v=l.Linkifier=class extends _.Disposable{get currentLink(){return this._currentLink}constructor(b,x,S,j,A){super(),this._element=b,this._mouseService=x,this._renderService=S,this._bufferService=j,this._linkProviderService=A,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new y.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new y.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,_.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,_.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,m.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,m.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,m.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,m.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(b){this._lastMouseEvent=b;const x=this._positionFromMouseEvent(b,this._element,this._mouseService);if(!x)return;this._isMouseOut=!1;const S=b.composedPath();for(let j=0;j<S.length;j++){const A=S[j];if(A.classList.contains("xterm"))break;if(A.classList.contains("xterm-hover"))return}this._lastBufferCell&&x.x===this._lastBufferCell.x&&x.y===this._lastBufferCell.y||(this._handleHover(x),this._lastBufferCell=x)}_handleHover(b){if(this._activeLine!==b.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(b,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,b)||(this._clearCurrentLink(),this._askForLink(b,!0))}_askForLink(b,x){var j,A;this._activeProviderReplies&&x||((j=this._activeProviderReplies)==null||j.forEach((N=>{N==null||N.forEach((D=>{D.link.dispose&&D.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=b.y);let S=!1;for(const[N,D]of this._linkProviderService.linkProviders.entries())x?(A=this._activeProviderReplies)!=null&&A.get(N)&&(S=this._checkLinkProviderResult(N,b,S)):D.provideLinks(b.y,(T=>{var H,V;if(this._isMouseOut)return;const I=T==null?void 0:T.map((Y=>({link:Y})));(H=this._activeProviderReplies)==null||H.set(N,I),S=this._checkLinkProviderResult(N,b,S),((V=this._activeProviderReplies)==null?void 0:V.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(b.y,this._activeProviderReplies)}))}_removeIntersectingLinks(b,x){const S=new Set;for(let j=0;j<x.size;j++){const A=x.get(j);if(A)for(let N=0;N<A.length;N++){const D=A[N],T=D.link.range.start.y<b?0:D.link.range.start.x,I=D.link.range.end.y>b?this._bufferService.cols:D.link.range.end.x;for(let H=T;H<=I;H++){if(S.has(H)){A.splice(N--,1);break}S.add(H)}}}}_checkLinkProviderResult(b,x,S){var N;if(!this._activeProviderReplies)return S;const j=this._activeProviderReplies.get(b);let A=!1;for(let D=0;D<b;D++)this._activeProviderReplies.has(D)&&!this._activeProviderReplies.get(D)||(A=!0);if(!A&&j){const D=j.find((T=>this._linkAtPosition(T.link,x)));D&&(S=!0,this._handleNewLink(D))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!S)for(let D=0;D<this._activeProviderReplies.size;D++){const T=(N=this._activeProviderReplies.get(D))==null?void 0:N.find((I=>this._linkAtPosition(I.link,x)));if(T){S=!0,this._handleNewLink(T);break}}return S}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(b){if(!this._currentLink)return;const x=this._positionFromMouseEvent(b,this._element,this._mouseService);x&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,x)&&this._currentLink.link.activate(b,this._currentLink.link.text)}_clearCurrentLink(b,x){this._currentLink&&this._lastMouseEvent&&(!b||!x||this._currentLink.link.range.start.y>=b&&this._currentLink.link.range.end.y<=x)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,_.disposeArray)(this._linkCacheDisposables))}_handleNewLink(b){if(!this._lastMouseEvent)return;const x=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);x&&this._linkAtPosition(b.link,x)&&(this._currentLink=b,this._currentLink.state={decorations:{underline:b.link.decorations===void 0||b.link.decorations.underline,pointerCursor:b.link.decorations===void 0||b.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,b.link,this._lastMouseEvent),b.link.decorations={},Object.defineProperties(b.link.decorations,{pointerCursor:{get:()=>{var S,j;return(j=(S=this._currentLink)==null?void 0:S.state)==null?void 0:j.decorations.pointerCursor},set:S=>{var j;(j=this._currentLink)!=null&&j.state&&this._currentLink.state.decorations.pointerCursor!==S&&(this._currentLink.state.decorations.pointerCursor=S,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",S))}},underline:{get:()=>{var S,j;return(j=(S=this._currentLink)==null?void 0:S.state)==null?void 0:j.decorations.underline},set:S=>{var j,A,N;(j=this._currentLink)!=null&&j.state&&((N=(A=this._currentLink)==null?void 0:A.state)==null?void 0:N.decorations.underline)!==S&&(this._currentLink.state.decorations.underline=S,this._currentLink.state.isHovered&&this._fireUnderlineEvent(b.link,S))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((S=>{if(!this._currentLink)return;const j=S.start===0?0:S.start+1+this._bufferService.buffer.ydisp,A=this._bufferService.buffer.ydisp+1+S.end;if(this._currentLink.link.range.start.y>=j&&this._currentLink.link.range.end.y<=A&&(this._clearCurrentLink(j,A),this._lastMouseEvent)){const N=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);N&&this._askForLink(N,!1)}}))))}_linkHover(b,x,S){var j;(j=this._currentLink)!=null&&j.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(x,!0),this._currentLink.state.decorations.pointerCursor&&b.classList.add("xterm-cursor-pointer")),x.hover&&x.hover(S,x.text)}_fireUnderlineEvent(b,x){const S=b.range,j=this._bufferService.buffer.ydisp,A=this._createLinkUnderlineEvent(S.start.x-1,S.start.y-j-1,S.end.x,S.end.y-j-1,void 0);(x?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(A)}_linkLeave(b,x,S){var j;(j=this._currentLink)!=null&&j.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(x,!1),this._currentLink.state.decorations.pointerCursor&&b.classList.remove("xterm-cursor-pointer")),x.leave&&x.leave(S,x.text)}_linkAtPosition(b,x){const S=b.range.start.y*this._bufferService.cols+b.range.start.x,j=b.range.end.y*this._bufferService.cols+b.range.end.x,A=x.y*this._bufferService.cols+x.x;return S<=A&&A<=j}_positionFromMouseEvent(b,x,S){const j=S.getCoords(b,x,this._bufferService.cols,this._bufferService.rows);if(j)return{x:j[0],y:j[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(b,x,S,j,A){return{x1:b,y1:x,x2:S,y2:j,cols:this._bufferService.cols,fg:A}}};l.Linkifier=v=p([g(1,C.IMouseService),g(2,C.IRenderService),g(3,k.IBufferService),g(4,C.ILinkProviderService)],v)},9042:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.tooMuchOutput=l.promptLabel=void 0,l.promptLabel="Terminal input",l.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(f,l,d){var p=this&&this.__decorate||function(C,v,b,x){var S,j=arguments.length,A=j<3?v:x===null?x=Object.getOwnPropertyDescriptor(v,b):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(C,v,b,x);else for(var N=C.length-1;N>=0;N--)(S=C[N])&&(A=(j<3?S(A):j>3?S(v,b,A):S(v,b))||A);return j>3&&A&&Object.defineProperty(v,b,A),A},g=this&&this.__param||function(C,v){return function(b,x){v(b,x,C)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OscLinkProvider=void 0;const m=d(511),y=d(2585);let _=l.OscLinkProvider=class{constructor(C,v,b){this._bufferService=C,this._optionsService=v,this._oscLinkService=b}provideLinks(C,v){var I;const b=this._bufferService.buffer.lines.get(C-1);if(!b)return void v(void 0);const x=[],S=this._optionsService.rawOptions.linkHandler,j=new m.CellData,A=b.getTrimmedLength();let N=-1,D=-1,T=!1;for(let H=0;H<A;H++)if(D!==-1||b.hasContent(H)){if(b.loadCell(H,j),j.hasExtendedAttrs()&&j.extended.urlId){if(D===-1){D=H,N=j.extended.urlId;continue}T=j.extended.urlId!==N}else D!==-1&&(T=!0);if(T||D!==-1&&H===A-1){const V=(I=this._oscLinkService.getLinkData(N))==null?void 0:I.uri;if(V){const Y={start:{x:D+1,y:C},end:{x:H+(T||H!==A-1?0:1),y:C}};let q=!1;if(!(S!=null&&S.allowNonHttpProtocols))try{const O=new URL(V);["http:","https:"].includes(O.protocol)||(q=!0)}catch{q=!0}q||x.push({text:V,range:Y,activate:(O,U)=>S?S.activate(O,U,Y):k(0,U),hover:(O,U)=>{var z;return(z=S==null?void 0:S.hover)==null?void 0:z.call(S,O,U,Y)},leave:(O,U)=>{var z;return(z=S==null?void 0:S.leave)==null?void 0:z.call(S,O,U,Y)}})}T=!1,j.hasExtendedAttrs()&&j.extended.urlId?(D=H,N=j.extended.urlId):(D=-1,N=-1)}}v(x)}};function k(C,v){if(confirm(`Do you want to navigate to ${v}?
|
|
60
|
+
|
|
61
|
+
WARNING: This link could potentially be dangerous`)){const b=window.open();if(b){try{b.opener=null}catch{}b.location.href=v}else console.warn("Opening link blocked as opener could not be cleared")}}l.OscLinkProvider=_=p([g(0,y.IBufferService),g(1,y.IOptionsService),g(2,y.IOscLinkService)],_)},6193:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.RenderDebouncer=void 0,l.RenderDebouncer=class{constructor(d,p){this._renderCallback=d,this._coreBrowserService=p,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(d){return this._refreshCallbacks.push(d),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(d,p,g){this._rowCount=g,d=d!==void 0?d:0,p=p!==void 0?p:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,d):d,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,p):p,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 d=Math.max(this._rowStart,0),p=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(d,p),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const d of this._refreshCallbacks)d(0);this._refreshCallbacks=[]}}},3236:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Terminal=void 0;const p=d(3614),g=d(3656),m=d(3551),y=d(9042),_=d(3730),k=d(1680),C=d(3107),v=d(5744),b=d(2950),x=d(1296),S=d(428),j=d(4269),A=d(5114),N=d(8934),D=d(3230),T=d(9312),I=d(4725),H=d(6731),V=d(8055),Y=d(8969),q=d(8460),O=d(844),U=d(6114),z=d(8437),X=d(2584),Q=d(7399),M=d(5941),L=d(9074),B=d(2585),W=d(5435),F=d(4567),re=d(779);class Z extends Y.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(K={}){super(K),this.browser=U,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new O.MutableDisposable),this._onCursorMove=this.register(new q.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new q.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new q.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new q.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new q.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new q.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new q.EventEmitter),this._onBlur=this.register(new q.EventEmitter),this._onA11yCharEmitter=this.register(new q.EventEmitter),this._onA11yTabEmitter=this.register(new q.EventEmitter),this._onWillOpen=this.register(new q.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(L.DecorationService),this._instantiationService.setService(B.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(re.LinkProviderService),this._instantiationService.setService(I.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(_.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows((($,ae)=>this.refresh($,ae)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport(($=>this._reportWindowsOptions($)))),this.register(this._inputHandler.onColor(($=>this._handleColorEvent($)))),this.register((0,q.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,q.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,q.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,q.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize(($=>this._afterResize($.cols,$.rows)))),this.register((0,O.toDisposable)((()=>{var $,ae;this._customKeyEventHandler=void 0,(ae=($=this.element)==null?void 0:$.parentNode)==null||ae.removeChild(this.element)})))}_handleColorEvent(K){if(this._themeService)for(const $ of K){let ae,ne="";switch($.index){case 256:ae="foreground",ne="10";break;case 257:ae="background",ne="11";break;case 258:ae="cursor",ne="12";break;default:ae="ansi",ne="4;"+$.index}switch($.type){case 0:const ve=V.color.toColorRGB(ae==="ansi"?this._themeService.colors.ansi[$.index]:this._themeService.colors[ae]);this.coreService.triggerDataEvent(`${X.C0.ESC}]${ne};${(0,M.toRgbString)(ve)}${X.C1_ESCAPED.ST}`);break;case 1:if(ae==="ansi")this._themeService.modifyColors((be=>be.ansi[$.index]=V.channels.toColor(...$.color)));else{const be=ae;this._themeService.modifyColors((Ae=>Ae[be]=V.channels.toColor(...$.color)))}break;case 2:this._themeService.restoreColor($.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(K){K?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(F.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(K){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(X.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var K;return(K=this.textarea)==null?void 0:K.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(X.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 K=this.buffer.ybase+this.buffer.y,$=this.buffer.lines.get(K);if(!$)return;const ae=Math.min(this.buffer.x,this.cols-1),ne=this._renderService.dimensions.css.cell.height,ve=$.getWidth(ae),be=this._renderService.dimensions.css.cell.width*ve,Ae=this.buffer.y*this._renderService.dimensions.css.cell.height,Me=ae*this._renderService.dimensions.css.cell.width;this.textarea.style.left=Me+"px",this.textarea.style.top=Ae+"px",this.textarea.style.width=be+"px",this.textarea.style.height=ne+"px",this.textarea.style.lineHeight=ne+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,g.addDisposableDomListener)(this.element,"copy",($=>{this.hasSelection()&&(0,p.copyHandler)($,this._selectionService)})));const K=$=>(0,p.handlePasteEvent)($,this.textarea,this.coreService,this.optionsService);this.register((0,g.addDisposableDomListener)(this.textarea,"paste",K)),this.register((0,g.addDisposableDomListener)(this.element,"paste",K)),U.isFirefox?this.register((0,g.addDisposableDomListener)(this.element,"mousedown",($=>{$.button===2&&(0,p.rightClickHandler)($,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,g.addDisposableDomListener)(this.element,"contextmenu",($=>{(0,p.rightClickHandler)($,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),U.isLinux&&this.register((0,g.addDisposableDomListener)(this.element,"auxclick",($=>{$.button===1&&(0,p.moveTextAreaUnderMouseCursor)($,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,g.addDisposableDomListener)(this.textarea,"keyup",(K=>this._keyUp(K)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"keydown",(K=>this._keyDown(K)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"keypress",(K=>this._keyPress(K)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionupdate",(K=>this._compositionHelper.compositionupdate(K)))),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,g.addDisposableDomListener)(this.textarea,"input",(K=>this._inputEvent(K)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(K){var ae;if(!K)throw new Error("Terminal requires a parent element.");if(K.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((ae=this.element)==null?void 0:ae.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=K.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"),K.appendChild(this.element);const $=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),$.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,g.addDisposableDomListener)(this.screenElement,"mousemove",(ne=>this.updateCursorStyle(ne)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),$.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",y.promptLabel),U.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(A.CoreBrowserService,this.textarea,K.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(I.ICoreBrowserService,this._coreBrowserService),this.register((0,g.addDisposableDomListener)(this.textarea,"focus",(ne=>this._handleTextAreaFocus(ne)))),this.register((0,g.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(S.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(I.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(H.ThemeService),this._instantiationService.setService(I.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(j.CharacterJoinerService),this._instantiationService.setService(I.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(D.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(I.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((ne=>this._onRender.fire(ne)))),this.onResize((ne=>this._renderService.resize(ne.cols,ne.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(b.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(N.MouseService),this._instantiationService.setService(I.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(m.Linkifier,this.screenElement)),this.element.appendChild($);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(k.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((ne=>this.scrollLines(ne.amount,ne.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(T.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(I.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((ne=>this.scrollLines(ne.amount,ne.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((ne=>this._renderService.handleSelectionChanged(ne.start,ne.end,ne.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((ne=>{this.textarea.value=ne,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((ne=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,g.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(C.BufferDecorationRenderer,this.screenElement)),this.register((0,g.addDisposableDomListener)(this.element,"mousedown",(ne=>this._selectionService.handleMouseDown(ne)))),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(F.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(ne=>this._handleScreenReaderModeOptionChange(ne)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(v.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(ne=>{!this._overviewRulerRenderer&&ne&&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(x.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const K=this,$=this.element;function ae(be){const Ae=K._mouseService.getMouseReportCoords(be,K.screenElement);if(!Ae)return!1;let Me,Ie;switch(be.overrideType||be.type){case"mousemove":Ie=32,be.buttons===void 0?(Me=3,be.button!==void 0&&(Me=be.button<3?be.button:3)):Me=1&be.buttons?0:4&be.buttons?1:2&be.buttons?2:3;break;case"mouseup":Ie=0,Me=be.button<3?be.button:3;break;case"mousedown":Ie=1,Me=be.button<3?be.button:3;break;case"wheel":if(K._customWheelEventHandler&&K._customWheelEventHandler(be)===!1||K.viewport.getLinesScrolled(be)===0)return!1;Ie=be.deltaY<0?0:1,Me=4;break;default:return!1}return!(Ie===void 0||Me===void 0||Me>4)&&K.coreMouseService.triggerMouseEvent({col:Ae.col,row:Ae.row,x:Ae.x,y:Ae.y,button:Me,action:Ie,ctrl:be.ctrlKey,alt:be.altKey,shift:be.shiftKey})}const ne={mouseup:null,wheel:null,mousedrag:null,mousemove:null},ve={mouseup:be=>(ae(be),be.buttons||(this._document.removeEventListener("mouseup",ne.mouseup),ne.mousedrag&&this._document.removeEventListener("mousemove",ne.mousedrag)),this.cancel(be)),wheel:be=>(ae(be),this.cancel(be,!0)),mousedrag:be=>{be.buttons&&ae(be)},mousemove:be=>{be.buttons||ae(be)}};this.register(this.coreMouseService.onProtocolChange((be=>{be?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(be)),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&be?ne.mousemove||($.addEventListener("mousemove",ve.mousemove),ne.mousemove=ve.mousemove):($.removeEventListener("mousemove",ne.mousemove),ne.mousemove=null),16&be?ne.wheel||($.addEventListener("wheel",ve.wheel,{passive:!1}),ne.wheel=ve.wheel):($.removeEventListener("wheel",ne.wheel),ne.wheel=null),2&be?ne.mouseup||(ne.mouseup=ve.mouseup):(this._document.removeEventListener("mouseup",ne.mouseup),ne.mouseup=null),4&be?ne.mousedrag||(ne.mousedrag=ve.mousedrag):(this._document.removeEventListener("mousemove",ne.mousedrag),ne.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,g.addDisposableDomListener)($,"mousedown",(be=>{if(be.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(be))return ae(be),ne.mouseup&&this._document.addEventListener("mouseup",ne.mouseup),ne.mousedrag&&this._document.addEventListener("mousemove",ne.mousedrag),this.cancel(be)}))),this.register((0,g.addDisposableDomListener)($,"wheel",(be=>{if(!ne.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(be)===!1)return!1;if(!this.buffer.hasScrollback){const Ae=this.viewport.getLinesScrolled(be);if(Ae===0)return;const Me=X.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(be.deltaY<0?"A":"B");let Ie="";for(let Fe=0;Fe<Math.abs(Ae);Fe++)Ie+=Me;return this.coreService.triggerDataEvent(Ie,!0),this.cancel(be,!0)}return this.viewport.handleWheel(be)?this.cancel(be):void 0}}),{passive:!1})),this.register((0,g.addDisposableDomListener)($,"touchstart",(be=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(be),this.cancel(be)}),{passive:!0})),this.register((0,g.addDisposableDomListener)($,"touchmove",(be=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(be)?void 0:this.cancel(be)}),{passive:!1}))}refresh(K,$){var ae;(ae=this._renderService)==null||ae.refreshRows(K,$)}updateCursorStyle(K){var $;($=this._selectionService)!=null&&$.shouldColumnSelect(K)?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(K,$,ae=0){var ne;ae===1?(super.scrollLines(K,$,ae),this.refresh(0,this.rows-1)):(ne=this.viewport)==null||ne.scrollLines(K)}paste(K){(0,p.paste)(K,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(K){this._customKeyEventHandler=K}attachCustomWheelEventHandler(K){this._customWheelEventHandler=K}registerLinkProvider(K){return this._linkProviderService.registerLinkProvider(K)}registerCharacterJoiner(K){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const $=this._characterJoinerService.register(K);return this.refresh(0,this.rows-1),$}deregisterCharacterJoiner(K){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(K)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(K){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+K)}registerDecoration(K){return this._decorationService.registerDecoration(K)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(K,$,ae){this._selectionService.setSelection(K,$,ae)}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 K;(K=this._selectionService)==null||K.clearSelection()}selectAll(){var K;(K=this._selectionService)==null||K.selectAll()}selectLines(K,$){var ae;(ae=this._selectionService)==null||ae.selectLines(K,$)}_keyDown(K){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(K)===!1)return!1;const $=this.browser.isMac&&this.options.macOptionIsMeta&&K.altKey;if(!$&&!this._compositionHelper.keydown(K))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;$||K.key!=="Dead"&&K.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const ae=(0,Q.evaluateKeyboardEvent)(K,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(K),ae.type===3||ae.type===2){const ne=this.rows-1;return this.scrollLines(ae.type===2?-ne:ne),this.cancel(K,!0)}return ae.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,K)||(ae.cancel&&this.cancel(K,!0),!ae.key||!!(K.key&&!K.ctrlKey&&!K.altKey&&!K.metaKey&&K.key.length===1&&K.key.charCodeAt(0)>=65&&K.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(ae.key!==X.C0.ETX&&ae.key!==X.C0.CR||(this.textarea.value=""),this._onKey.fire({key:ae.key,domEvent:K}),this._showCursor(),this.coreService.triggerDataEvent(ae.key,!0),!this.optionsService.rawOptions.screenReaderMode||K.altKey||K.ctrlKey?this.cancel(K,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(K,$){const ae=K.isMac&&!this.options.macOptionIsMeta&&$.altKey&&!$.ctrlKey&&!$.metaKey||K.isWindows&&$.altKey&&$.ctrlKey&&!$.metaKey||K.isWindows&&$.getModifierState("AltGraph");return $.type==="keypress"?ae:ae&&(!$.keyCode||$.keyCode>47)}_keyUp(K){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(K)===!1||((function($){return $.keyCode===16||$.keyCode===17||$.keyCode===18})(K)||this.focus(),this.updateCursorStyle(K),this._keyPressHandled=!1)}_keyPress(K){let $;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(K)===!1)return!1;if(this.cancel(K),K.charCode)$=K.charCode;else if(K.which===null||K.which===void 0)$=K.keyCode;else{if(K.which===0||K.charCode===0)return!1;$=K.which}return!(!$||(K.altKey||K.ctrlKey||K.metaKey)&&!this._isThirdLevelShift(this.browser,K)||($=String.fromCharCode($),this._onKey.fire({key:$,domEvent:K}),this._showCursor(),this.coreService.triggerDataEvent($,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(K){if(K.data&&K.inputType==="insertText"&&(!K.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const $=K.data;return this.coreService.triggerDataEvent($,!0),this.cancel(K),!0}return!1}resize(K,$){K!==this.cols||$!==this.rows?super.resize(K,$):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(K,$){var ae,ne;(ae=this._charSizeService)==null||ae.measure(),(ne=this.viewport)==null||ne.syncScrollArea(!0)}clear(){var K;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 $=1;$<this.rows;$++)this.buffer.lines.push(this.buffer.getBlankLine(z.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(K=this.viewport)==null||K.reset(),this.refresh(0,this.rows-1)}}reset(){var $,ae;this.options.rows=this.rows,this.options.cols=this.cols;const K=this._customKeyEventHandler;this._setup(),super.reset(),($=this._selectionService)==null||$.reset(),this._decorationService.reset(),(ae=this.viewport)==null||ae.reset(),this._customKeyEventHandler=K,this.refresh(0,this.rows-1)}clearTextureAtlas(){var K;(K=this._renderService)==null||K.clearTextureAtlas()}_reportFocus(){var K;(K=this.element)!=null&&K.classList.contains("focus")?this.coreService.triggerDataEvent(X.C0.ESC+"[I"):this.coreService.triggerDataEvent(X.C0.ESC+"[O")}_reportWindowsOptions(K){if(this._renderService)switch(K){case W.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const $=this._renderService.dimensions.css.canvas.width.toFixed(0),ae=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${X.C0.ESC}[4;${ae};${$}t`);break;case W.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const ne=this._renderService.dimensions.css.cell.width.toFixed(0),ve=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${X.C0.ESC}[6;${ve};${ne}t`)}}cancel(K,$){if(this.options.cancelEvents||$)return K.preventDefault(),K.stopPropagation(),!1}}l.Terminal=Z},9924:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.TimeBasedDebouncer=void 0,l.TimeBasedDebouncer=class{constructor(d,p=1e3){this._renderCallback=d,this._debounceThresholdMS=p,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(d,p,g){this._rowCount=g,d=d!==void 0?d:0,p=p!==void 0?p:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,d):d,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,p):p;const m=Date.now();if(m-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=m,this._innerRefresh();else if(!this._additionalRefreshRequested){const y=m-this._lastRefreshMs,_=this._debounceThresholdMS-y;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),_)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const d=Math.max(this._rowStart,0),p=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(d,p)}}},1680:function(f,l,d){var p=this&&this.__decorate||function(b,x,S,j){var A,N=arguments.length,D=N<3?x:j===null?j=Object.getOwnPropertyDescriptor(x,S):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(b,x,S,j);else for(var T=b.length-1;T>=0;T--)(A=b[T])&&(D=(N<3?A(D):N>3?A(x,S,D):A(x,S))||D);return N>3&&D&&Object.defineProperty(x,S,D),D},g=this&&this.__param||function(b,x){return function(S,j){x(S,j,b)}};Object.defineProperty(l,"__esModule",{value:!0}),l.Viewport=void 0;const m=d(3656),y=d(4725),_=d(8460),k=d(844),C=d(2585);let v=l.Viewport=class extends k.Disposable{constructor(b,x,S,j,A,N,D,T){super(),this._viewportElement=b,this._scrollArea=x,this._bufferService=S,this._optionsService=j,this._charSizeService=A,this._renderService=N,this._coreBrowserService=D,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 _.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,m.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((I=>this._activeBuffer=I.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((I=>this._renderDimensions=I))),this._handleThemeChange(T.colors),this.register(T.onChangeColors((I=>this._handleThemeChange(I)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(b){this._viewportElement.style.backgroundColor=b.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(b){if(b)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 x=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==x&&(this._lastRecordedBufferHeight=x,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const b=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==b&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=b),this._refreshAnimationFrame=null}syncScrollArea(b=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(b);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(b)}_handleScroll(b){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 x=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:x,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const b=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(b*(this._smoothScrollState.target-this._smoothScrollState.origin)),b<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(b,x){const S=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(x<0&&this._viewportElement.scrollTop!==0||x>0&&S<this._lastRecordedBufferHeight)||(b.cancelable&&b.preventDefault(),!1)}handleWheel(b){const x=this._getPixelsScrolled(b);return x!==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+x:this._smoothScrollState.target+=x,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=x,this._bubbleScroll(b,x))}scrollLines(b){if(b!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const x=b*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+x,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:b,suppressScrollEvent:!1})}_getPixelsScrolled(b){if(b.deltaY===0||b.shiftKey)return 0;let x=this._applyScrollModifier(b.deltaY,b);return b.deltaMode===WheelEvent.DOM_DELTA_LINE?x*=this._currentRowHeight:b.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(x*=this._currentRowHeight*this._bufferService.rows),x}getBufferElements(b,x){var T;let S,j="";const A=[],N=x??this._bufferService.buffer.lines.length,D=this._bufferService.buffer.lines;for(let I=b;I<N;I++){const H=D.get(I);if(!H)continue;const V=(T=D.get(I+1))==null?void 0:T.isWrapped;if(j+=H.translateToString(!V),!V||I===D.length-1){const Y=document.createElement("div");Y.textContent=j,A.push(Y),j.length>0&&(S=Y),j=""}}return{bufferElements:A,cursorElement:S}}getLinesScrolled(b){if(b.deltaY===0||b.shiftKey)return 0;let x=this._applyScrollModifier(b.deltaY,b);return b.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(x/=this._currentRowHeight+0,this._wheelPartialScroll+=x,x=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):b.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(x*=this._bufferService.rows),x}_applyScrollModifier(b,x){const S=this._optionsService.rawOptions.fastScrollModifier;return S==="alt"&&x.altKey||S==="ctrl"&&x.ctrlKey||S==="shift"&&x.shiftKey?b*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:b*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(b){this._lastTouchY=b.touches[0].pageY}handleTouchMove(b){const x=this._lastTouchY-b.touches[0].pageY;return this._lastTouchY=b.touches[0].pageY,x!==0&&(this._viewportElement.scrollTop+=x,this._bubbleScroll(b,x))}};l.Viewport=v=p([g(2,C.IBufferService),g(3,C.IOptionsService),g(4,y.ICharSizeService),g(5,y.IRenderService),g(6,y.ICoreBrowserService),g(7,y.IThemeService)],v)},3107:function(f,l,d){var p=this&&this.__decorate||function(C,v,b,x){var S,j=arguments.length,A=j<3?v:x===null?x=Object.getOwnPropertyDescriptor(v,b):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(C,v,b,x);else for(var N=C.length-1;N>=0;N--)(S=C[N])&&(A=(j<3?S(A):j>3?S(v,b,A):S(v,b))||A);return j>3&&A&&Object.defineProperty(v,b,A),A},g=this&&this.__param||function(C,v){return function(b,x){v(b,x,C)}};Object.defineProperty(l,"__esModule",{value:!0}),l.BufferDecorationRenderer=void 0;const m=d(4725),y=d(844),_=d(2585);let k=l.BufferDecorationRenderer=class extends y.Disposable{constructor(C,v,b,x,S){super(),this._screenElement=C,this._bufferService=v,this._coreBrowserService=b,this._decorationService=x,this._renderService=S,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((j=>this._removeDecoration(j)))),this.register((0,y.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 C of this._decorationService.decorations)this._renderDecoration(C);this._dimensionsChanged=!1}_renderDecoration(C){this._refreshStyle(C),this._dimensionsChanged&&this._refreshXPosition(C)}_createElement(C){var x;const v=this._coreBrowserService.mainDocument.createElement("div");v.classList.add("xterm-decoration"),v.classList.toggle("xterm-decoration-top-layer",((x=C==null?void 0:C.options)==null?void 0:x.layer)==="top"),v.style.width=`${Math.round((C.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,v.style.height=(C.options.height||1)*this._renderService.dimensions.css.cell.height+"px",v.style.top=(C.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 b=C.options.x??0;return b&&b>this._bufferService.cols&&(v.style.display="none"),this._refreshXPosition(C,v),v}_refreshStyle(C){const v=C.marker.line-this._bufferService.buffers.active.ydisp;if(v<0||v>=this._bufferService.rows)C.element&&(C.element.style.display="none",C.onRenderEmitter.fire(C.element));else{let b=this._decorationElements.get(C);b||(b=this._createElement(C),C.element=b,this._decorationElements.set(C,b),this._container.appendChild(b),C.onDispose((()=>{this._decorationElements.delete(C),b.remove()}))),b.style.top=v*this._renderService.dimensions.css.cell.height+"px",b.style.display=this._altBufferIsActive?"none":"block",C.onRenderEmitter.fire(b)}}_refreshXPosition(C,v=C.element){if(!v)return;const b=C.options.x??0;(C.options.anchor||"left")==="right"?v.style.right=b?b*this._renderService.dimensions.css.cell.width+"px":"":v.style.left=b?b*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(C){var v;(v=this._decorationElements.get(C))==null||v.remove(),this._decorationElements.delete(C),C.dispose()}};l.BufferDecorationRenderer=k=p([g(1,_.IBufferService),g(2,m.ICoreBrowserService),g(3,_.IDecorationService),g(4,m.IRenderService)],k)},5871:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ColorZoneStore=void 0,l.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(d){if(d.options.overviewRulerOptions){for(const p of this._zones)if(p.color===d.options.overviewRulerOptions.color&&p.position===d.options.overviewRulerOptions.position){if(this._lineIntersectsZone(p,d.marker.line))return;if(this._lineAdjacentToZone(p,d.marker.line,d.options.overviewRulerOptions.position))return void this._addLineToZone(p,d.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=d.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=d.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=d.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=d.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:d.options.overviewRulerOptions.color,position:d.options.overviewRulerOptions.position,startBufferLine:d.marker.line,endBufferLine:d.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(d){this._linePadding=d}_lineIntersectsZone(d,p){return p>=d.startBufferLine&&p<=d.endBufferLine}_lineAdjacentToZone(d,p,g){return p>=d.startBufferLine-this._linePadding[g||"full"]&&p<=d.endBufferLine+this._linePadding[g||"full"]}_addLineToZone(d,p){d.startBufferLine=Math.min(d.startBufferLine,p),d.endBufferLine=Math.max(d.endBufferLine,p)}}},5744:function(f,l,d){var p=this&&this.__decorate||function(S,j,A,N){var D,T=arguments.length,I=T<3?j:N===null?N=Object.getOwnPropertyDescriptor(j,A):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(S,j,A,N);else for(var H=S.length-1;H>=0;H--)(D=S[H])&&(I=(T<3?D(I):T>3?D(j,A,I):D(j,A))||I);return T>3&&I&&Object.defineProperty(j,A,I),I},g=this&&this.__param||function(S,j){return function(A,N){j(A,N,S)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OverviewRulerRenderer=void 0;const m=d(5871),y=d(4725),_=d(844),k=d(2585),C={full:0,left:0,center:0,right:0},v={full:0,left:0,center:0,right:0},b={full:0,left:0,center:0,right:0};let x=l.OverviewRulerRenderer=class extends _.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(S,j,A,N,D,T,I){var V;super(),this._viewportElement=S,this._screenElement=j,this._bufferService=A,this._decorationService=N,this._renderService=D,this._optionsService=T,this._coreBrowserService=I,this._colorZoneStore=new m.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(),(V=this._viewportElement.parentElement)==null||V.insertBefore(this._canvas,this._viewportElement);const H=this._canvas.getContext("2d");if(!H)throw new Error("Ctx cannot be null");this._ctx=H,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,_.toDisposable)((()=>{var Y;(Y=this._canvas)==null||Y.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 S=Math.floor(this._canvas.width/3),j=Math.ceil(this._canvas.width/3);v.full=this._canvas.width,v.left=S,v.center=j,v.right=S,this._refreshDrawHeightConstants(),b.full=0,b.left=0,b.center=v.left,b.right=v.left+v.center}_refreshDrawHeightConstants(){C.full=Math.round(2*this._coreBrowserService.dpr);const S=this._canvas.height/this._bufferService.buffer.lines.length,j=Math.round(Math.max(Math.min(S,12),6)*this._coreBrowserService.dpr);C.left=j,C.center=j,C.right=j}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.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 j of this._decorationService.decorations)this._colorZoneStore.addDecoration(j);this._ctx.lineWidth=1;const S=this._colorZoneStore.zones;for(const j of S)j.position!=="full"&&this._renderColorZone(j);for(const j of S)j.position==="full"&&this._renderColorZone(j);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(S){this._ctx.fillStyle=S.color,this._ctx.fillRect(b[S.position||"full"],Math.round((this._canvas.height-1)*(S.startBufferLine/this._bufferService.buffers.active.lines.length)-C[S.position||"full"]/2),v[S.position||"full"],Math.round((this._canvas.height-1)*((S.endBufferLine-S.startBufferLine)/this._bufferService.buffers.active.lines.length)+C[S.position||"full"]))}_queueRefresh(S,j){this._shouldUpdateDimensions=S||this._shouldUpdateDimensions,this._shouldUpdateAnchor=j||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};l.OverviewRulerRenderer=x=p([g(2,k.IBufferService),g(3,k.IDecorationService),g(4,y.IRenderService),g(5,k.IOptionsService),g(6,y.ICoreBrowserService)],x)},2950:function(f,l,d){var p=this&&this.__decorate||function(C,v,b,x){var S,j=arguments.length,A=j<3?v:x===null?x=Object.getOwnPropertyDescriptor(v,b):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(C,v,b,x);else for(var N=C.length-1;N>=0;N--)(S=C[N])&&(A=(j<3?S(A):j>3?S(v,b,A):S(v,b))||A);return j>3&&A&&Object.defineProperty(v,b,A),A},g=this&&this.__param||function(C,v){return function(b,x){v(b,x,C)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CompositionHelper=void 0;const m=d(4725),y=d(2585),_=d(2584);let k=l.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(C,v,b,x,S,j){this._textarea=C,this._compositionView=v,this._bufferService=b,this._optionsService=x,this._coreService=S,this._renderService=j,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(C){this._compositionView.textContent=C.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(C){if(this._isComposing||this._isSendingComposition){if(C.keyCode===229||C.keyCode===16||C.keyCode===17||C.keyCode===18)return!1;this._finalizeComposition(!1)}return C.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(C){if(this._compositionView.classList.remove("active"),this._isComposing=!1,C){const v={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let b;this._isSendingComposition=!1,v.start+=this._dataAlreadySent.length,b=this._isComposing?this._textarea.value.substring(v.start,v.end):this._textarea.value.substring(v.start),b.length>0&&this._coreService.triggerDataEvent(b,!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 C=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const v=this._textarea.value,b=v.replace(C,"");this._dataAlreadySent=b,v.length>C.length?this._coreService.triggerDataEvent(b,!0):v.length<C.length?this._coreService.triggerDataEvent(`${_.C0.DEL}`,!0):v.length===C.length&&v!==C&&this._coreService.triggerDataEvent(v,!0)}}),0)}updateCompositionElements(C){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const v=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),b=this._renderService.dimensions.css.cell.height,x=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,S=v*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=S+"px",this._compositionView.style.top=x+"px",this._compositionView.style.height=b+"px",this._compositionView.style.lineHeight=b+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const j=this._compositionView.getBoundingClientRect();this._textarea.style.left=S+"px",this._textarea.style.top=x+"px",this._textarea.style.width=Math.max(j.width,1)+"px",this._textarea.style.height=Math.max(j.height,1)+"px",this._textarea.style.lineHeight=j.height+"px"}C||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};l.CompositionHelper=k=p([g(2,y.IBufferService),g(3,y.IOptionsService),g(4,y.ICoreService),g(5,m.IRenderService)],k)},9806:(f,l)=>{function d(p,g,m){const y=m.getBoundingClientRect(),_=p.getComputedStyle(m),k=parseInt(_.getPropertyValue("padding-left")),C=parseInt(_.getPropertyValue("padding-top"));return[g.clientX-y.left-k,g.clientY-y.top-C]}Object.defineProperty(l,"__esModule",{value:!0}),l.getCoords=l.getCoordsRelativeToElement=void 0,l.getCoordsRelativeToElement=d,l.getCoords=function(p,g,m,y,_,k,C,v,b){if(!k)return;const x=d(p,g,m);return x?(x[0]=Math.ceil((x[0]+(b?C/2:0))/C),x[1]=Math.ceil(x[1]/v),x[0]=Math.min(Math.max(x[0],1),y+(b?1:0)),x[1]=Math.min(Math.max(x[1],1),_),x):void 0}},9504:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.moveToCellSequence=void 0;const p=d(2584);function g(v,b,x,S){const j=v-m(v,x),A=b-m(b,x),N=Math.abs(j-A)-(function(D,T,I){let H=0;const V=D-m(D,I),Y=T-m(T,I);for(let q=0;q<Math.abs(V-Y);q++){const O=y(D,T)==="A"?-1:1,U=I.buffer.lines.get(V+O*q);U!=null&&U.isWrapped&&H++}return H})(v,b,x);return C(N,k(y(v,b),S))}function m(v,b){let x=0,S=b.buffer.lines.get(v),j=S==null?void 0:S.isWrapped;for(;j&&v>=0&&v<b.rows;)x++,S=b.buffer.lines.get(--v),j=S==null?void 0:S.isWrapped;return x}function y(v,b){return v>b?"A":"B"}function _(v,b,x,S,j,A){let N=v,D=b,T="";for(;N!==x||D!==S;)N+=j?1:-1,j&&N>A.cols-1?(T+=A.buffer.translateBufferLineToString(D,!1,v,N),N=0,v=0,D++):!j&&N<0&&(T+=A.buffer.translateBufferLineToString(D,!1,0,v+1),N=A.cols-1,v=N,D--);return T+A.buffer.translateBufferLineToString(D,!1,v,N)}function k(v,b){const x=b?"O":"[";return p.C0.ESC+x+v}function C(v,b){v=Math.floor(v);let x="";for(let S=0;S<v;S++)x+=b;return x}l.moveToCellSequence=function(v,b,x,S){const j=x.buffer.x,A=x.buffer.y;if(!x.buffer.hasScrollback)return(function(T,I,H,V,Y,q){return g(I,V,Y,q).length===0?"":C(_(T,I,T,I-m(I,Y),!1,Y).length,k("D",q))})(j,A,0,b,x,S)+g(A,b,x,S)+(function(T,I,H,V,Y,q){let O;O=g(I,V,Y,q).length>0?V-m(V,Y):I;const U=V,z=(function(X,Q,M,L,B,W){let F;return F=g(M,L,B,W).length>0?L-m(L,B):Q,X<M&&F<=L||X>=M&&F<L?"C":"D"})(T,I,H,V,Y,q);return C(_(T,O,H,U,z==="C",Y).length,k(z,q))})(j,A,v,b,x,S);let N;if(A===b)return N=j>v?"D":"C",C(Math.abs(j-v),k(N,S));N=A>b?"D":"C";const D=Math.abs(A-b);return C((function(T,I){return I.cols-T})(A>b?v:j,x)+(D-1)*x.cols+1+((A>b?j:v)-1),k(N,S))}},1296:function(f,l,d){var p=this&&this.__decorate||function(q,O,U,z){var X,Q=arguments.length,M=Q<3?O:z===null?z=Object.getOwnPropertyDescriptor(O,U):z;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(q,O,U,z);else for(var L=q.length-1;L>=0;L--)(X=q[L])&&(M=(Q<3?X(M):Q>3?X(O,U,M):X(O,U))||M);return Q>3&&M&&Object.defineProperty(O,U,M),M},g=this&&this.__param||function(q,O){return function(U,z){O(U,z,q)}};Object.defineProperty(l,"__esModule",{value:!0}),l.DomRenderer=void 0;const m=d(3787),y=d(2550),_=d(2223),k=d(6171),C=d(6052),v=d(4725),b=d(8055),x=d(8460),S=d(844),j=d(2585),A="xterm-dom-renderer-owner-",N="xterm-rows",D="xterm-fg-",T="xterm-bg-",I="xterm-focus",H="xterm-selection";let V=1,Y=l.DomRenderer=class extends S.Disposable{constructor(q,O,U,z,X,Q,M,L,B,W,F,re,Z){super(),this._terminal=q,this._document=O,this._element=U,this._screenElement=z,this._viewportElement=X,this._helperContainer=Q,this._linkifier2=M,this._charSizeService=B,this._optionsService=W,this._bufferService=F,this._coreBrowserService=re,this._themeService=Z,this._terminalClass=V++,this._rowElements=[],this._selectionRenderModel=(0,C.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new x.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(H),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,k.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((ee=>this._injectCss(ee)))),this._injectCss(this._themeService.colors),this._rowFactory=L.createInstance(m.DomRendererRowFactory,document),this._element.classList.add(A+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((ee=>this._handleLinkHover(ee)))),this.register(this._linkifier2.onHideLinkUnderline((ee=>this._handleLinkLeave(ee)))),this.register((0,S.toDisposable)((()=>{this._element.classList.remove(A+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new y.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 q=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*q,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*q),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/q),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/q),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 U of this._rowElements)U.style.width=`${this.dimensions.css.canvas.width}px`,U.style.height=`${this.dimensions.css.cell.height}px`,U.style.lineHeight=`${this.dimensions.css.cell.height}px`,U.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const O=`${this._terminalSelector} .${N} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=O,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(q){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let O=`${this._terminalSelector} .${N} { color: ${q.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;O+=`${this._terminalSelector} .${N} .xterm-dim { color: ${b.color.multiplyOpacity(q.foreground,.5).css};}`,O+=`${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 U=`blink_underline_${this._terminalClass}`,z=`blink_bar_${this._terminalClass}`,X=`blink_block_${this._terminalClass}`;O+=`@keyframes ${U} { 50% { border-bottom-style: hidden; }}`,O+=`@keyframes ${z} { 50% { box-shadow: none; }}`,O+=`@keyframes ${X} { 0% { background-color: ${q.cursor.css}; color: ${q.cursorAccent.css}; } 50% { background-color: inherit; color: ${q.cursor.css}; }}`,O+=`${this._terminalSelector} .${N}.${I} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${U} 1s step-end infinite;}${this._terminalSelector} .${N}.${I} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${z} 1s step-end infinite;}${this._terminalSelector} .${N}.${I} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${X} 1s step-end infinite;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-block { background-color: ${q.cursor.css}; color: ${q.cursorAccent.css};}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${q.cursor.css} !important; color: ${q.cursorAccent.css} !important;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${q.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${q.cursor.css} inset;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${q.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,O+=`${this._terminalSelector} .${H} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${H} div { position: absolute; background-color: ${q.selectionBackgroundOpaque.css};}${this._terminalSelector} .${H} div { position: absolute; background-color: ${q.selectionInactiveBackgroundOpaque.css};}`;for(const[Q,M]of q.ansi.entries())O+=`${this._terminalSelector} .${D}${Q} { color: ${M.css}; }${this._terminalSelector} .${D}${Q}.xterm-dim { color: ${b.color.multiplyOpacity(M,.5).css}; }${this._terminalSelector} .${T}${Q} { background-color: ${M.css}; }`;O+=`${this._terminalSelector} .${D}${_.INVERTED_DEFAULT_COLOR} { color: ${b.color.opaque(q.background).css}; }${this._terminalSelector} .${D}${_.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${b.color.multiplyOpacity(b.color.opaque(q.background),.5).css}; }${this._terminalSelector} .${T}${_.INVERTED_DEFAULT_COLOR} { background-color: ${q.foreground.css}; }`,this._themeStyleElement.textContent=O}_setDefaultSpacing(){const q=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${q}px`,this._rowFactory.defaultSpacing=q}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(q,O){for(let U=this._rowElements.length;U<=O;U++){const z=this._document.createElement("div");this._rowContainer.appendChild(z),this._rowElements.push(z)}for(;this._rowElements.length>O;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(q,O){this._refreshRowElements(q,O),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(I),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(I),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(q,O,U){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(q,O,U),this.renderRows(0,this._bufferService.rows-1),!q||!O)return;this._selectionRenderModel.update(this._terminal,q,O,U);const z=this._selectionRenderModel.viewportStartRow,X=this._selectionRenderModel.viewportEndRow,Q=this._selectionRenderModel.viewportCappedStartRow,M=this._selectionRenderModel.viewportCappedEndRow;if(Q>=this._bufferService.rows||M<0)return;const L=this._document.createDocumentFragment();if(U){const B=q[0]>O[0];L.appendChild(this._createSelectionElement(Q,B?O[0]:q[0],B?q[0]:O[0],M-Q+1))}else{const B=z===Q?q[0]:0,W=Q===X?O[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(Q,B,W));const F=M-Q-1;if(L.appendChild(this._createSelectionElement(Q+1,0,this._bufferService.cols,F)),Q!==M){const re=X===M?O[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(M,0,re))}}this._selectionContainer.appendChild(L)}_createSelectionElement(q,O,U,z=1){const X=this._document.createElement("div"),Q=O*this.dimensions.css.cell.width;let M=this.dimensions.css.cell.width*(U-O);return Q+M>this.dimensions.css.canvas.width&&(M=this.dimensions.css.canvas.width-Q),X.style.height=z*this.dimensions.css.cell.height+"px",X.style.top=q*this.dimensions.css.cell.height+"px",X.style.left=`${Q}px`,X.style.width=`${M}px`,X}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 q of this._rowElements)q.replaceChildren()}renderRows(q,O){const U=this._bufferService.buffer,z=U.ybase+U.y,X=Math.min(U.x,this._bufferService.cols-1),Q=this._optionsService.rawOptions.cursorBlink,M=this._optionsService.rawOptions.cursorStyle,L=this._optionsService.rawOptions.cursorInactiveStyle;for(let B=q;B<=O;B++){const W=B+U.ydisp,F=this._rowElements[B],re=U.lines.get(W);if(!F||!re)break;F.replaceChildren(...this._rowFactory.createRow(re,W,W===z,M,L,X,Q,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${A}${this._terminalClass}`}_handleLinkHover(q){this._setCellUnderline(q.x1,q.x2,q.y1,q.y2,q.cols,!0)}_handleLinkLeave(q){this._setCellUnderline(q.x1,q.x2,q.y1,q.y2,q.cols,!1)}_setCellUnderline(q,O,U,z,X,Q){U<0&&(q=0),z<0&&(O=0);const M=this._bufferService.rows-1;U=Math.max(Math.min(U,M),0),z=Math.max(Math.min(z,M),0),X=Math.min(X,this._bufferService.cols);const L=this._bufferService.buffer,B=L.ybase+L.y,W=Math.min(L.x,X-1),F=this._optionsService.rawOptions.cursorBlink,re=this._optionsService.rawOptions.cursorStyle,Z=this._optionsService.rawOptions.cursorInactiveStyle;for(let ee=U;ee<=z;++ee){const K=ee+L.ydisp,$=this._rowElements[ee],ae=L.lines.get(K);if(!$||!ae)break;$.replaceChildren(...this._rowFactory.createRow(ae,K,K===B,re,Z,W,F,this.dimensions.css.cell.width,this._widthCache,Q?ee===U?q:0:-1,Q?(ee===z?O:X)-1:-1))}}};l.DomRenderer=Y=p([g(7,j.IInstantiationService),g(8,v.ICharSizeService),g(9,j.IOptionsService),g(10,j.IBufferService),g(11,v.ICoreBrowserService),g(12,v.IThemeService)],Y)},3787:function(f,l,d){var p=this&&this.__decorate||function(N,D,T,I){var H,V=arguments.length,Y=V<3?D:I===null?I=Object.getOwnPropertyDescriptor(D,T):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Y=Reflect.decorate(N,D,T,I);else for(var q=N.length-1;q>=0;q--)(H=N[q])&&(Y=(V<3?H(Y):V>3?H(D,T,Y):H(D,T))||Y);return V>3&&Y&&Object.defineProperty(D,T,Y),Y},g=this&&this.__param||function(N,D){return function(T,I){D(T,I,N)}};Object.defineProperty(l,"__esModule",{value:!0}),l.DomRendererRowFactory=void 0;const m=d(2223),y=d(643),_=d(511),k=d(2585),C=d(8055),v=d(4725),b=d(4269),x=d(6171),S=d(3734);let j=l.DomRendererRowFactory=class{constructor(N,D,T,I,H,V,Y){this._document=N,this._characterJoinerService=D,this._optionsService=T,this._coreBrowserService=I,this._coreService=H,this._decorationService=V,this._themeService=Y,this._workCell=new _.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(N,D,T){this._selectionStart=N,this._selectionEnd=D,this._columnSelectMode=T}createRow(N,D,T,I,H,V,Y,q,O,U,z){const X=[],Q=this._characterJoinerService.getJoinedCharacters(D),M=this._themeService.colors;let L,B=N.getNoBgTrimmedLength();T&&B<V+1&&(B=V+1);let W=0,F="",re=0,Z=0,ee=0,K=!1,$=0,ae=!1,ne=0;const ve=[],be=U!==-1&&z!==-1;for(let Ae=0;Ae<B;Ae++){N.loadCell(Ae,this._workCell);let Me=this._workCell.getWidth();if(Me===0)continue;let Ie=!1,Fe=Ae,ke=this._workCell;if(Q.length>0&&Ae===Q[0][0]){Ie=!0;const se=Q.shift();ke=new b.JoinedCellData(this._workCell,N.translateToString(!0,se[0],se[1]),se[1]-se[0]),Fe=se[1]-1,Me=ke.getWidth()}const ge=this._isCellInSelection(Ae,D),je=T&&Ae===V,We=be&&Ae>=U&&Ae<=z;let Lt=!1;this._decorationService.forEachDecorationAtCell(Ae,D,void 0,(se=>{Lt=!0}));let pe=ke.getChars()||y.WHITESPACE_CELL_CHAR;if(pe===" "&&(ke.isUnderline()||ke.isOverline())&&(pe=" "),ne=Me*q-O.get(pe,ke.isBold(),ke.isItalic()),L){if(W&&(ge&&ae||!ge&&!ae&&ke.bg===re)&&(ge&&ae&&M.selectionForeground||ke.fg===Z)&&ke.extended.ext===ee&&We===K&&ne===$&&!je&&!Ie&&!Lt){ke.isInvisible()?F+=y.WHITESPACE_CELL_CHAR:F+=pe,W++;continue}W&&(L.textContent=F),L=this._document.createElement("span"),W=0,F=""}else L=this._document.createElement("span");if(re=ke.bg,Z=ke.fg,ee=ke.extended.ext,K=We,$=ne,ae=ge,Ie&&V>=Ae&&V<=Fe&&(V=Ae),!this._coreService.isCursorHidden&&je&&this._coreService.isCursorInitialized){if(ve.push("xterm-cursor"),this._coreBrowserService.isFocused)Y&&ve.push("xterm-cursor-blink"),ve.push(I==="bar"?"xterm-cursor-bar":I==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(H)switch(H){case"outline":ve.push("xterm-cursor-outline");break;case"block":ve.push("xterm-cursor-block");break;case"bar":ve.push("xterm-cursor-bar");break;case"underline":ve.push("xterm-cursor-underline")}}if(ke.isBold()&&ve.push("xterm-bold"),ke.isItalic()&&ve.push("xterm-italic"),ke.isDim()&&ve.push("xterm-dim"),F=ke.isInvisible()?y.WHITESPACE_CELL_CHAR:ke.getChars()||y.WHITESPACE_CELL_CHAR,ke.isUnderline()&&(ve.push(`xterm-underline-${ke.extended.underlineStyle}`),F===" "&&(F=" "),!ke.isUnderlineColorDefault()))if(ke.isUnderlineColorRGB())L.style.textDecorationColor=`rgb(${S.AttributeData.toColorRGB(ke.getUnderlineColor()).join(",")})`;else{let se=ke.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&ke.isBold()&&se<8&&(se+=8),L.style.textDecorationColor=M.ansi[se].css}ke.isOverline()&&(ve.push("xterm-overline"),F===" "&&(F=" ")),ke.isStrikethrough()&&ve.push("xterm-strikethrough"),We&&(L.style.textDecoration="underline");let Ne=ke.getFgColor(),Oe=ke.getFgColorMode(),lt=ke.getBgColor(),ue=ke.getBgColorMode();const _e=!!ke.isInverse();if(_e){const se=Ne;Ne=lt,lt=se;const Le=Oe;Oe=ue,ue=Le}let Te,Be,Ve,Ct=!1;switch(this._decorationService.forEachDecorationAtCell(Ae,D,void 0,(se=>{se.options.layer!=="top"&&Ct||(se.backgroundColorRGB&&(ue=50331648,lt=se.backgroundColorRGB.rgba>>8&16777215,Te=se.backgroundColorRGB),se.foregroundColorRGB&&(Oe=50331648,Ne=se.foregroundColorRGB.rgba>>8&16777215,Be=se.foregroundColorRGB),Ct=se.options.layer==="top")})),!Ct&&ge&&(Te=this._coreBrowserService.isFocused?M.selectionBackgroundOpaque:M.selectionInactiveBackgroundOpaque,lt=Te.rgba>>8&16777215,ue=50331648,Ct=!0,M.selectionForeground&&(Oe=50331648,Ne=M.selectionForeground.rgba>>8&16777215,Be=M.selectionForeground)),Ct&&ve.push("xterm-decoration-top"),ue){case 16777216:case 33554432:Ve=M.ansi[lt],ve.push(`xterm-bg-${lt}`);break;case 50331648:Ve=C.channels.toColor(lt>>16,lt>>8&255,255<),this._addStyle(L,`background-color:#${A((lt>>>0).toString(16),"0",6)}`);break;default:_e?(Ve=M.foreground,ve.push(`xterm-bg-${m.INVERTED_DEFAULT_COLOR}`)):Ve=M.background}switch(Te||ke.isDim()&&(Te=C.color.multiplyOpacity(Ve,.5)),Oe){case 16777216:case 33554432:ke.isBold()&&Ne<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Ne+=8),this._applyMinimumContrast(L,Ve,M.ansi[Ne],ke,Te,void 0)||ve.push(`xterm-fg-${Ne}`);break;case 50331648:const se=C.channels.toColor(Ne>>16&255,Ne>>8&255,255&Ne);this._applyMinimumContrast(L,Ve,se,ke,Te,Be)||this._addStyle(L,`color:#${A(Ne.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(L,Ve,M.foreground,ke,Te,Be)||_e&&ve.push(`xterm-fg-${m.INVERTED_DEFAULT_COLOR}`)}ve.length&&(L.className=ve.join(" "),ve.length=0),je||Ie||Lt?L.textContent=F:W++,ne!==this.defaultSpacing&&(L.style.letterSpacing=`${ne}px`),X.push(L),Ae=Fe}return L&&W&&(L.textContent=F),X}_applyMinimumContrast(N,D,T,I,H,V){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,x.treatGlyphAsBackgroundColor)(I.getCode()))return!1;const Y=this._getContrastCache(I);let q;if(H||V||(q=Y.getColor(D.rgba,T.rgba)),q===void 0){const O=this._optionsService.rawOptions.minimumContrastRatio/(I.isDim()?2:1);q=C.color.ensureContrastRatio(H||D,V||T,O),Y.setColor((H||D).rgba,(V||T).rgba,q??null)}return!!q&&(this._addStyle(N,`color:${q.css}`),!0)}_getContrastCache(N){return N.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(N,D){N.setAttribute("style",`${N.getAttribute("style")||""}${D};`)}_isCellInSelection(N,D){const T=this._selectionStart,I=this._selectionEnd;return!(!T||!I)&&(this._columnSelectMode?T[0]<=I[0]?N>=T[0]&&D>=T[1]&&N<I[0]&&D<=I[1]:N<T[0]&&D>=T[1]&&N>=I[0]&&D<=I[1]:D>T[1]&&D<I[1]||T[1]===I[1]&&D===T[1]&&N>=T[0]&&N<I[0]||T[1]<I[1]&&D===I[1]&&N<I[0]||T[1]<I[1]&&D===T[1]&&N>=T[0])}};function A(N,D,T){for(;N.length<T;)N=D+N;return N}l.DomRendererRowFactory=j=p([g(1,v.ICharacterJoinerService),g(2,k.IOptionsService),g(3,v.ICoreBrowserService),g(4,k.ICoreService),g(5,k.IDecorationService),g(6,v.IThemeService)],j)},2550:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.WidthCache=void 0,l.WidthCache=class{constructor(d,p){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=d.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 g=d.createElement("span");g.classList.add("xterm-char-measure-element");const m=d.createElement("span");m.classList.add("xterm-char-measure-element"),m.style.fontWeight="bold";const y=d.createElement("span");y.classList.add("xterm-char-measure-element"),y.style.fontStyle="italic";const _=d.createElement("span");_.classList.add("xterm-char-measure-element"),_.style.fontWeight="bold",_.style.fontStyle="italic",this._measureElements=[g,m,y,_],this._container.appendChild(g),this._container.appendChild(m),this._container.appendChild(y),this._container.appendChild(_),p.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(d,p,g,m){d===this._font&&p===this._fontSize&&g===this._weight&&m===this._weightBold||(this._font=d,this._fontSize=p,this._weight=g,this._weightBold=m,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${g}`,this._measureElements[1].style.fontWeight=`${m}`,this._measureElements[2].style.fontWeight=`${g}`,this._measureElements[3].style.fontWeight=`${m}`,this.clear())}get(d,p,g){let m=0;if(!p&&!g&&d.length===1&&(m=d.charCodeAt(0))<256){if(this._flat[m]!==-9999)return this._flat[m];const k=this._measure(d,0);return k>0&&(this._flat[m]=k),k}let y=d;p&&(y+="B"),g&&(y+="I");let _=this._holey.get(y);if(_===void 0){let k=0;p&&(k|=1),g&&(k|=2),_=this._measure(d,k),_>0&&this._holey.set(y,_)}return _}_measure(d,p){const g=this._measureElements[p];return g.textContent=d.repeat(32),g.offsetWidth/32}}},2223:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.TEXT_BASELINE=l.DIM_OPACITY=l.INVERTED_DEFAULT_COLOR=void 0;const p=d(6114);l.INVERTED_DEFAULT_COLOR=257,l.DIM_OPACITY=.5,l.TEXT_BASELINE=p.isFirefox||p.isLegacyEdge?"bottom":"ideographic"},6171:(f,l)=>{function d(g){return 57508<=g&&g<=57558}function p(g){return g>=128512&&g<=128591||g>=127744&&g<=128511||g>=128640&&g<=128767||g>=9728&&g<=9983||g>=9984&&g<=10175||g>=65024&&g<=65039||g>=129280&&g<=129535||g>=127462&&g<=127487}Object.defineProperty(l,"__esModule",{value:!0}),l.computeNextVariantOffset=l.createRenderDimensions=l.treatGlyphAsBackgroundColor=l.allowRescaling=l.isEmoji=l.isRestrictedPowerlineGlyph=l.isPowerlineGlyph=l.throwIfFalsy=void 0,l.throwIfFalsy=function(g){if(!g)throw new Error("value must not be falsy");return g},l.isPowerlineGlyph=d,l.isRestrictedPowerlineGlyph=function(g){return 57520<=g&&g<=57527},l.isEmoji=p,l.allowRescaling=function(g,m,y,_){return m===1&&y>Math.ceil(1.5*_)&&g!==void 0&&g>255&&!p(g)&&!d(g)&&!(function(k){return 57344<=k&&k<=63743})(g)},l.treatGlyphAsBackgroundColor=function(g){return d(g)||(function(m){return 9472<=m&&m<=9631})(g)},l.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}}}},l.computeNextVariantOffset=function(g,m,y=0){return(g-(2*Math.round(m)-y))%(2*Math.round(m))}},6052:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.createSelectionRenderModel=void 0;class d{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(g,m,y,_=!1){if(this.selectionStart=m,this.selectionEnd=y,!m||!y||m[0]===y[0]&&m[1]===y[1])return void this.clear();const k=g.buffers.active.ydisp,C=m[1]-k,v=y[1]-k,b=Math.max(C,0),x=Math.min(v,g.rows-1);b>=g.rows||x<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=_,this.viewportStartRow=C,this.viewportEndRow=v,this.viewportCappedStartRow=b,this.viewportCappedEndRow=x,this.startCol=m[0],this.endCol=y[0])}isCellSelected(g,m,y){return!!this.hasSelection&&(y-=g.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?m>=this.startCol&&y>=this.viewportCappedStartRow&&m<this.endCol&&y<=this.viewportCappedEndRow:m<this.startCol&&y>=this.viewportCappedStartRow&&m>=this.endCol&&y<=this.viewportCappedEndRow:y>this.viewportStartRow&&y<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&y===this.viewportStartRow&&m>=this.startCol&&m<this.endCol||this.viewportStartRow<this.viewportEndRow&&y===this.viewportEndRow&&m<this.endCol||this.viewportStartRow<this.viewportEndRow&&y===this.viewportStartRow&&m>=this.startCol)}}l.createSelectionRenderModel=function(){return new d}},456:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.SelectionModel=void 0,l.SelectionModel=class{constructor(d){this._bufferService=d,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 d=this.selectionStart[0]+this.selectionStartLength;return d>this._bufferService.cols?d%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(d/this._bufferService.cols)-1]:[d%this._bufferService.cols,this.selectionStart[1]+Math.floor(d/this._bufferService.cols)]:[d,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const d=this.selectionStart[0]+this.selectionStartLength;return d>this._bufferService.cols?[d%this._bufferService.cols,this.selectionStart[1]+Math.floor(d/this._bufferService.cols)]:[Math.max(d,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const d=this.selectionStart,p=this.selectionEnd;return!(!d||!p)&&(d[1]>p[1]||d[1]===p[1]&&d[0]>p[0])}handleTrim(d){return this.selectionStart&&(this.selectionStart[1]-=d),this.selectionEnd&&(this.selectionEnd[1]-=d),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(f,l,d){var p=this&&this.__decorate||function(x,S,j,A){var N,D=arguments.length,T=D<3?S:A===null?A=Object.getOwnPropertyDescriptor(S,j):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(x,S,j,A);else for(var I=x.length-1;I>=0;I--)(N=x[I])&&(T=(D<3?N(T):D>3?N(S,j,T):N(S,j))||T);return D>3&&T&&Object.defineProperty(S,j,T),T},g=this&&this.__param||function(x,S){return function(j,A){S(j,A,x)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CharSizeService=void 0;const m=d(2585),y=d(8460),_=d(844);let k=l.CharSizeService=class extends _.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(x,S,j){super(),this._optionsService=j,this.width=0,this.height=0,this._onCharSizeChange=this.register(new y.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new b(this._optionsService))}catch{this._measureStrategy=this.register(new v(x,S,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const x=this._measureStrategy.measure();x.width===this.width&&x.height===this.height||(this.width=x.width,this.height=x.height,this._onCharSizeChange.fire())}};l.CharSizeService=k=p([g(2,m.IOptionsService)],k);class C extends _.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(S,j){S!==void 0&&S>0&&j!==void 0&&j>0&&(this._result.width=S,this._result.height=j)}}class v extends C{constructor(S,j,A){super(),this._document=S,this._parentElement=j,this._optionsService=A,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 b extends C{constructor(S){super(),this._optionsService=S,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const j=this._ctx.measureText("W");if(!("width"in j&&"fontBoundingBoxAscent"in j&&"fontBoundingBoxDescent"in j))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const S=this._ctx.measureText("W");return this._validateAndSet(S.width,S.fontBoundingBoxAscent+S.fontBoundingBoxDescent),this._result}}},4269:function(f,l,d){var p=this&&this.__decorate||function(b,x,S,j){var A,N=arguments.length,D=N<3?x:j===null?j=Object.getOwnPropertyDescriptor(x,S):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(b,x,S,j);else for(var T=b.length-1;T>=0;T--)(A=b[T])&&(D=(N<3?A(D):N>3?A(x,S,D):A(x,S))||D);return N>3&&D&&Object.defineProperty(x,S,D),D},g=this&&this.__param||function(b,x){return function(S,j){x(S,j,b)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CharacterJoinerService=l.JoinedCellData=void 0;const m=d(3734),y=d(643),_=d(511),k=d(2585);class C extends m.AttributeData{constructor(x,S,j){super(),this.content=0,this.combinedData="",this.fg=x.fg,this.bg=x.bg,this.combinedData=S,this._width=j}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(x){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}l.JoinedCellData=C;let v=l.CharacterJoinerService=class Cb{constructor(x){this._bufferService=x,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new _.CellData}register(x){const S={id:this._nextCharacterJoinerId++,handler:x};return this._characterJoiners.push(S),S.id}deregister(x){for(let S=0;S<this._characterJoiners.length;S++)if(this._characterJoiners[S].id===x)return this._characterJoiners.splice(S,1),!0;return!1}getJoinedCharacters(x){if(this._characterJoiners.length===0)return[];const S=this._bufferService.buffer.lines.get(x);if(!S||S.length===0)return[];const j=[],A=S.translateToString(!0);let N=0,D=0,T=0,I=S.getFg(0),H=S.getBg(0);for(let V=0;V<S.getTrimmedLength();V++)if(S.loadCell(V,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==I||this._workCell.bg!==H){if(V-N>1){const Y=this._getJoinedRanges(A,T,D,S,N);for(let q=0;q<Y.length;q++)j.push(Y[q])}N=V,T=D,I=this._workCell.fg,H=this._workCell.bg}D+=this._workCell.getChars().length||y.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-N>1){const V=this._getJoinedRanges(A,T,D,S,N);for(let Y=0;Y<V.length;Y++)j.push(V[Y])}return j}_getJoinedRanges(x,S,j,A,N){const D=x.substring(S,j);let T=[];try{T=this._characterJoiners[0].handler(D)}catch(I){console.error(I)}for(let I=1;I<this._characterJoiners.length;I++)try{const H=this._characterJoiners[I].handler(D);for(let V=0;V<H.length;V++)Cb._mergeRanges(T,H[V])}catch(H){console.error(H)}return this._stringRangesToCellRanges(T,A,N),T}_stringRangesToCellRanges(x,S,j){let A=0,N=!1,D=0,T=x[A];if(T){for(let I=j;I<this._bufferService.cols;I++){const H=S.getWidth(I),V=S.getString(I).length||y.WHITESPACE_CELL_CHAR.length;if(H!==0){if(!N&&T[0]<=D&&(T[0]=I,N=!0),T[1]<=D){if(T[1]=I,T=x[++A],!T)break;T[0]<=D?(T[0]=I,N=!0):N=!1}D+=V}}T&&(T[1]=this._bufferService.cols)}}static _mergeRanges(x,S){let j=!1;for(let A=0;A<x.length;A++){const N=x[A];if(j){if(S[1]<=N[0])return x[A-1][1]=S[1],x;if(S[1]<=N[1])return x[A-1][1]=Math.max(S[1],N[1]),x.splice(A,1),x;x.splice(A,1),A--}else{if(S[1]<=N[0])return x.splice(A,0,S),x;if(S[1]<=N[1])return N[0]=Math.min(S[0],N[0]),x;S[0]<N[1]&&(N[0]=Math.min(S[0],N[0]),j=!0)}}return j?x[x.length-1][1]=S[1]:x.push(S),x}};l.CharacterJoinerService=v=p([g(0,k.IBufferService)],v)},5114:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CoreBrowserService=void 0;const p=d(844),g=d(8460),m=d(3656);class y extends p.Disposable{constructor(C,v,b){super(),this._textarea=C,this._window=v,this.mainDocument=b,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new _(this._window),this._onDprChange=this.register(new g.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new g.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((x=>this._screenDprMonitor.setWindow(x)))),this.register((0,g.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(C){this._window!==C&&(this._window=C,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}}l.CoreBrowserService=y;class _ extends p.Disposable{constructor(C){super(),this._parentWindow=C,this._windowResizeListener=this.register(new p.MutableDisposable),this._onDprChange=this.register(new g.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,p.toDisposable)((()=>this.clearListener())))}setWindow(C){this._parentWindow=C,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,m.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var C;this._outerListener&&((C=this._resolutionMediaMatchList)==null||C.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:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.LinkProviderService=void 0;const p=d(844);class g extends p.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,p.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(y){return this.linkProviders.push(y),{dispose:()=>{const _=this.linkProviders.indexOf(y);_!==-1&&this.linkProviders.splice(_,1)}}}}l.LinkProviderService=g},8934:function(f,l,d){var p=this&&this.__decorate||function(k,C,v,b){var x,S=arguments.length,j=S<3?C:b===null?b=Object.getOwnPropertyDescriptor(C,v):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(k,C,v,b);else for(var A=k.length-1;A>=0;A--)(x=k[A])&&(j=(S<3?x(j):S>3?x(C,v,j):x(C,v))||j);return S>3&&j&&Object.defineProperty(C,v,j),j},g=this&&this.__param||function(k,C){return function(v,b){C(v,b,k)}};Object.defineProperty(l,"__esModule",{value:!0}),l.MouseService=void 0;const m=d(4725),y=d(9806);let _=l.MouseService=class{constructor(k,C){this._renderService=k,this._charSizeService=C}getCoords(k,C,v,b,x){return(0,y.getCoords)(window,k,C,v,b,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,x)}getMouseReportCoords(k,C){const v=(0,y.getCoordsRelativeToElement)(window,k,C);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])}}};l.MouseService=_=p([g(0,m.IRenderService),g(1,m.ICharSizeService)],_)},3230:function(f,l,d){var p=this&&this.__decorate||function(x,S,j,A){var N,D=arguments.length,T=D<3?S:A===null?A=Object.getOwnPropertyDescriptor(S,j):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(x,S,j,A);else for(var I=x.length-1;I>=0;I--)(N=x[I])&&(T=(D<3?N(T):D>3?N(S,j,T):N(S,j))||T);return D>3&&T&&Object.defineProperty(S,j,T),T},g=this&&this.__param||function(x,S){return function(j,A){S(j,A,x)}};Object.defineProperty(l,"__esModule",{value:!0}),l.RenderService=void 0;const m=d(6193),y=d(4725),_=d(8460),k=d(844),C=d(7226),v=d(2585);let b=l.RenderService=class extends k.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(x,S,j,A,N,D,T,I){super(),this._rowCount=x,this._charSizeService=A,this._renderer=this.register(new k.MutableDisposable),this._pausedResizeTask=new C.DebouncedIdleTask,this._observerDisposable=this.register(new k.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 _.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new _.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new _.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new _.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new m.RenderDebouncer(((H,V)=>this._renderRows(H,V)),T),this.register(this._renderDebouncer),this.register(T.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(D.onResize((()=>this._fullRefresh()))),this.register(D.buffers.onBufferActivate((()=>{var H;return(H=this._renderer.value)==null?void 0:H.clear()}))),this.register(j.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(N.onDecorationRegistered((()=>this._fullRefresh()))),this.register(N.onDecorationRemoved((()=>this._fullRefresh()))),this.register(j.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(D.cols,D.rows),this._fullRefresh()}))),this.register(j.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(D.buffer.y,D.buffer.y,!0)))),this.register(I.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(T.window,S),this.register(T.onWindowChange((H=>this._registerIntersectionObserver(H,S))))}_registerIntersectionObserver(x,S){if("IntersectionObserver"in x){const j=new x.IntersectionObserver((A=>this._handleIntersectionChange(A[A.length-1])),{threshold:0});j.observe(S),this._observerDisposable.value=(0,k.toDisposable)((()=>j.disconnect()))}}_handleIntersectionChange(x){this._isPaused=x.isIntersecting===void 0?x.intersectionRatio===0:!x.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(x,S,j=!1){this._isPaused?this._needsFullRefresh=!0:(j||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(x,S,this._rowCount))}_renderRows(x,S){this._renderer.value&&(x=Math.min(x,this._rowCount-1),S=Math.min(S,this._rowCount-1),this._renderer.value.renderRows(x,S),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:x,end:S}),this._onRender.fire({start:x,end:S}),this._isNextRenderRedrawOnly=!0)}resize(x,S){this._rowCount=S,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(x){this._renderer.value=x,this._renderer.value&&(this._renderer.value.onRequestRedraw((S=>this.refreshRows(S.start,S.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(x){return this._renderDebouncer.addRefreshCallback(x)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var x,S;this._renderer.value&&((S=(x=this._renderer.value).clearTextureAtlas)==null||S.call(x),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(x,S){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var j;return(j=this._renderer.value)==null?void 0:j.handleResize(x,S)})):this._renderer.value.handleResize(x,S),this._fullRefresh())}handleCharSizeChanged(){var x;(x=this._renderer.value)==null||x.handleCharSizeChanged()}handleBlur(){var x;(x=this._renderer.value)==null||x.handleBlur()}handleFocus(){var x;(x=this._renderer.value)==null||x.handleFocus()}handleSelectionChanged(x,S,j){var A;this._selectionState.start=x,this._selectionState.end=S,this._selectionState.columnSelectMode=j,(A=this._renderer.value)==null||A.handleSelectionChanged(x,S,j)}handleCursorMove(){var x;(x=this._renderer.value)==null||x.handleCursorMove()}clear(){var x;(x=this._renderer.value)==null||x.clear()}};l.RenderService=b=p([g(2,v.IOptionsService),g(3,y.ICharSizeService),g(4,v.IDecorationService),g(5,v.IBufferService),g(6,y.ICoreBrowserService),g(7,y.IThemeService)],b)},9312:function(f,l,d){var p=this&&this.__decorate||function(T,I,H,V){var Y,q=arguments.length,O=q<3?I:V===null?V=Object.getOwnPropertyDescriptor(I,H):V;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(T,I,H,V);else for(var U=T.length-1;U>=0;U--)(Y=T[U])&&(O=(q<3?Y(O):q>3?Y(I,H,O):Y(I,H))||O);return q>3&&O&&Object.defineProperty(I,H,O),O},g=this&&this.__param||function(T,I){return function(H,V){I(H,V,T)}};Object.defineProperty(l,"__esModule",{value:!0}),l.SelectionService=void 0;const m=d(9806),y=d(9504),_=d(456),k=d(4725),C=d(8460),v=d(844),b=d(6114),x=d(4841),S=d(511),j=d(2585),A=" ",N=new RegExp(A,"g");let D=l.SelectionService=class extends v.Disposable{constructor(T,I,H,V,Y,q,O,U,z){super(),this._element=T,this._screenElement=I,this._linkifier=H,this._bufferService=V,this._coreService=Y,this._mouseService=q,this._optionsService=O,this._renderService=U,this._coreBrowserService=z,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new S.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new C.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new C.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new C.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new C.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=X=>this._handleMouseMove(X),this._mouseUpListener=X=>this._handleMouseUp(X),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((X=>this._handleTrim(X))),this.register(this._bufferService.buffers.onBufferActivate((X=>this._handleBufferActivate(X)))),this.enable(),this._model=new _.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 T=this._model.finalSelectionStart,I=this._model.finalSelectionEnd;return!(!T||!I||T[0]===I[0]&&T[1]===I[1])}get selectionText(){const T=this._model.finalSelectionStart,I=this._model.finalSelectionEnd;if(!T||!I)return"";const H=this._bufferService.buffer,V=[];if(this._activeSelectionMode===3){if(T[0]===I[0])return"";const Y=T[0]<I[0]?T[0]:I[0],q=T[0]<I[0]?I[0]:T[0];for(let O=T[1];O<=I[1];O++){const U=H.translateBufferLineToString(O,!0,Y,q);V.push(U)}}else{const Y=T[1]===I[1]?I[0]:void 0;V.push(H.translateBufferLineToString(T[1],!0,T[0],Y));for(let q=T[1]+1;q<=I[1]-1;q++){const O=H.lines.get(q),U=H.translateBufferLineToString(q,!0);O!=null&&O.isWrapped?V[V.length-1]+=U:V.push(U)}if(T[1]!==I[1]){const q=H.lines.get(I[1]),O=H.translateBufferLineToString(I[1],!0,0,I[0]);q&&q.isWrapped?V[V.length-1]+=O:V.push(O)}}return V.map((Y=>Y.replace(N," "))).join(b.isWindows?`\r
|
|
62
|
+
`:`
|
|
63
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(T){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),b.isLinux&&T&&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(T){const I=this._getMouseBufferCoords(T),H=this._model.finalSelectionStart,V=this._model.finalSelectionEnd;return!!(H&&V&&I)&&this._areCoordsInSelection(I,H,V)}isCellInSelection(T,I){const H=this._model.finalSelectionStart,V=this._model.finalSelectionEnd;return!(!H||!V)&&this._areCoordsInSelection([T,I],H,V)}_areCoordsInSelection(T,I,H){return T[1]>I[1]&&T[1]<H[1]||I[1]===H[1]&&T[1]===I[1]&&T[0]>=I[0]&&T[0]<H[0]||I[1]<H[1]&&T[1]===H[1]&&T[0]<H[0]||I[1]<H[1]&&T[1]===I[1]&&T[0]>=I[0]}_selectWordAtCursor(T,I){var Y,q;const H=(q=(Y=this._linkifier.currentLink)==null?void 0:Y.link)==null?void 0:q.range;if(H)return this._model.selectionStart=[H.start.x-1,H.start.y-1],this._model.selectionStartLength=(0,x.getRangeLength)(H,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const V=this._getMouseBufferCoords(T);return!!V&&(this._selectWordAt(V,I),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(T,I){this._model.clearSelection(),T=Math.max(T,0),I=Math.min(I,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,T],this._model.selectionEnd=[this._bufferService.cols,I],this.refresh(),this._onSelectionChange.fire()}_handleTrim(T){this._model.handleTrim(T)&&this.refresh()}_getMouseBufferCoords(T){const I=this._mouseService.getCoords(T,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(I)return I[0]--,I[1]--,I[1]+=this._bufferService.buffer.ydisp,I}_getMouseEventScrollAmount(T){let I=(0,m.getCoordsRelativeToElement)(this._coreBrowserService.window,T,this._screenElement)[1];const H=this._renderService.dimensions.css.canvas.height;return I>=0&&I<=H?0:(I>H&&(I-=H),I=Math.min(Math.max(I,-50),50),I/=50,I/Math.abs(I)+Math.round(14*I))}shouldForceSelection(T){return b.isMac?T.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:T.shiftKey}handleMouseDown(T){if(this._mouseDownTimeStamp=T.timeStamp,(T.button!==2||!this.hasSelection)&&T.button===0){if(!this._enabled){if(!this.shouldForceSelection(T))return;T.stopPropagation()}T.preventDefault(),this._dragScrollAmount=0,this._enabled&&T.shiftKey?this._handleIncrementalClick(T):T.detail===1?this._handleSingleClick(T):T.detail===2?this._handleDoubleClick(T):T.detail===3&&this._handleTripleClick(T),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(T){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(T))}_handleSingleClick(T){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(T)?3:0,this._model.selectionStart=this._getMouseBufferCoords(T),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const I=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);I&&I.length!==this._model.selectionStart[0]&&I.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(T){this._selectWordAtCursor(T,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(T){const I=this._getMouseBufferCoords(T);I&&(this._activeSelectionMode=2,this._selectLineAt(I[1]))}shouldColumnSelect(T){return T.altKey&&!(b.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(T){if(T.stopImmediatePropagation(),!this._model.selectionStart)return;const I=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(T),!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(T),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const H=this._bufferService.buffer;if(this._model.selectionEnd[1]<H.lines.length){const V=H.lines.get(this._model.selectionEnd[1]);V&&V.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}I&&I[0]===this._model.selectionEnd[0]&&I[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 T=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(T.ydisp+this._bufferService.rows,T.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=T.ydisp),this.refresh()}}_handleMouseUp(T){const I=T.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&I<500&&T.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const H=this._mouseService.getCoords(T,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(H&&H[0]!==void 0&&H[1]!==void 0){const V=(0,y.moveToCellSequence)(H[0]-1,H[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(V,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const T=this._model.finalSelectionStart,I=this._model.finalSelectionEnd,H=!(!T||!I||T[0]===I[0]&&T[1]===I[1]);H?T&&I&&(this._oldSelectionStart&&this._oldSelectionEnd&&T[0]===this._oldSelectionStart[0]&&T[1]===this._oldSelectionStart[1]&&I[0]===this._oldSelectionEnd[0]&&I[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(T,I,H)):this._oldHasSelection&&this._fireOnSelectionChange(T,I,H)}_fireOnSelectionChange(T,I,H){this._oldSelectionStart=T,this._oldSelectionEnd=I,this._oldHasSelection=H,this._onSelectionChange.fire()}_handleBufferActivate(T){this.clearSelection(),this._trimListener.dispose(),this._trimListener=T.activeBuffer.lines.onTrim((I=>this._handleTrim(I)))}_convertViewportColToCharacterIndex(T,I){let H=I;for(let V=0;I>=V;V++){const Y=T.loadCell(V,this._workCell).getChars().length;this._workCell.getWidth()===0?H--:Y>1&&I!==V&&(H+=Y-1)}return H}setSelection(T,I,H){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[T,I],this._model.selectionStartLength=H,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(T){this._isClickInSelection(T)||(this._selectWordAtCursor(T,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(T,I,H=!0,V=!0){if(T[0]>=this._bufferService.cols)return;const Y=this._bufferService.buffer,q=Y.lines.get(T[1]);if(!q)return;const O=Y.translateBufferLineToString(T[1],!1);let U=this._convertViewportColToCharacterIndex(q,T[0]),z=U;const X=T[0]-U;let Q=0,M=0,L=0,B=0;if(O.charAt(U)===" "){for(;U>0&&O.charAt(U-1)===" ";)U--;for(;z<O.length&&O.charAt(z+1)===" ";)z++}else{let re=T[0],Z=T[0];q.getWidth(re)===0&&(Q++,re--),q.getWidth(Z)===2&&(M++,Z++);const ee=q.getString(Z).length;for(ee>1&&(B+=ee-1,z+=ee-1);re>0&&U>0&&!this._isCharWordSeparator(q.loadCell(re-1,this._workCell));){q.loadCell(re-1,this._workCell);const K=this._workCell.getChars().length;this._workCell.getWidth()===0?(Q++,re--):K>1&&(L+=K-1,U-=K-1),U--,re--}for(;Z<q.length&&z+1<O.length&&!this._isCharWordSeparator(q.loadCell(Z+1,this._workCell));){q.loadCell(Z+1,this._workCell);const K=this._workCell.getChars().length;this._workCell.getWidth()===2?(M++,Z++):K>1&&(B+=K-1,z+=K-1),z++,Z++}}z++;let W=U+X-Q+L,F=Math.min(this._bufferService.cols,z-U+Q+M-L-B);if(I||O.slice(U,z).trim()!==""){if(H&&W===0&&q.getCodePoint(0)!==32){const re=Y.lines.get(T[1]-1);if(re&&q.isWrapped&&re.getCodePoint(this._bufferService.cols-1)!==32){const Z=this._getWordAt([this._bufferService.cols-1,T[1]-1],!1,!0,!1);if(Z){const ee=this._bufferService.cols-Z.start;W-=ee,F+=ee}}}if(V&&W+F===this._bufferService.cols&&q.getCodePoint(this._bufferService.cols-1)!==32){const re=Y.lines.get(T[1]+1);if(re!=null&&re.isWrapped&&re.getCodePoint(0)!==32){const Z=this._getWordAt([0,T[1]+1],!1,!1,!0);Z&&(F+=Z.length)}}return{start:W,length:F}}}_selectWordAt(T,I){const H=this._getWordAt(T,I);if(H){for(;H.start<0;)H.start+=this._bufferService.cols,T[1]--;this._model.selectionStart=[H.start,T[1]],this._model.selectionStartLength=H.length}}_selectToWordAt(T){const I=this._getWordAt(T,!0);if(I){let H=T[1];for(;I.start<0;)I.start+=this._bufferService.cols,H--;if(!this._model.areSelectionValuesReversed())for(;I.start+I.length>this._bufferService.cols;)I.length-=this._bufferService.cols,H++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?I.start:I.start+I.length,H]}}_isCharWordSeparator(T){return T.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(T.getChars())>=0}_selectLineAt(T){const I=this._bufferService.buffer.getWrappedRangeForLine(T),H={start:{x:0,y:I.first},end:{x:this._bufferService.cols-1,y:I.last}};this._model.selectionStart=[0,I.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,x.getRangeLength)(H,this._bufferService.cols)}};l.SelectionService=D=p([g(3,j.IBufferService),g(4,j.ICoreService),g(5,k.IMouseService),g(6,j.IOptionsService),g(7,k.IRenderService),g(8,k.ICoreBrowserService)],D)},4725:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ILinkProviderService=l.IThemeService=l.ICharacterJoinerService=l.ISelectionService=l.IRenderService=l.IMouseService=l.ICoreBrowserService=l.ICharSizeService=void 0;const p=d(8343);l.ICharSizeService=(0,p.createDecorator)("CharSizeService"),l.ICoreBrowserService=(0,p.createDecorator)("CoreBrowserService"),l.IMouseService=(0,p.createDecorator)("MouseService"),l.IRenderService=(0,p.createDecorator)("RenderService"),l.ISelectionService=(0,p.createDecorator)("SelectionService"),l.ICharacterJoinerService=(0,p.createDecorator)("CharacterJoinerService"),l.IThemeService=(0,p.createDecorator)("ThemeService"),l.ILinkProviderService=(0,p.createDecorator)("LinkProviderService")},6731:function(f,l,d){var p=this&&this.__decorate||function(D,T,I,H){var V,Y=arguments.length,q=Y<3?T:H===null?H=Object.getOwnPropertyDescriptor(T,I):H;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")q=Reflect.decorate(D,T,I,H);else for(var O=D.length-1;O>=0;O--)(V=D[O])&&(q=(Y<3?V(q):Y>3?V(T,I,q):V(T,I))||q);return Y>3&&q&&Object.defineProperty(T,I,q),q},g=this&&this.__param||function(D,T){return function(I,H){T(I,H,D)}};Object.defineProperty(l,"__esModule",{value:!0}),l.ThemeService=l.DEFAULT_ANSI_COLORS=void 0;const m=d(7239),y=d(8055),_=d(8460),k=d(844),C=d(2585),v=y.css.toColor("#ffffff"),b=y.css.toColor("#000000"),x=y.css.toColor("#ffffff"),S=y.css.toColor("#000000"),j={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};l.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const D=[y.css.toColor("#2e3436"),y.css.toColor("#cc0000"),y.css.toColor("#4e9a06"),y.css.toColor("#c4a000"),y.css.toColor("#3465a4"),y.css.toColor("#75507b"),y.css.toColor("#06989a"),y.css.toColor("#d3d7cf"),y.css.toColor("#555753"),y.css.toColor("#ef2929"),y.css.toColor("#8ae234"),y.css.toColor("#fce94f"),y.css.toColor("#729fcf"),y.css.toColor("#ad7fa8"),y.css.toColor("#34e2e2"),y.css.toColor("#eeeeec")],T=[0,95,135,175,215,255];for(let I=0;I<216;I++){const H=T[I/36%6|0],V=T[I/6%6|0],Y=T[I%6];D.push({css:y.channels.toCss(H,V,Y),rgba:y.channels.toRgba(H,V,Y)})}for(let I=0;I<24;I++){const H=8+10*I;D.push({css:y.channels.toCss(H,H,H),rgba:y.channels.toRgba(H,H,H)})}return D})());let A=l.ThemeService=class extends k.Disposable{get colors(){return this._colors}constructor(D){super(),this._optionsService=D,this._contrastCache=new m.ColorContrastCache,this._halfContrastCache=new m.ColorContrastCache,this._onChangeColors=this.register(new _.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:v,background:b,cursor:x,cursorAccent:S,selectionForeground:void 0,selectionBackgroundTransparent:j,selectionBackgroundOpaque:y.color.blend(b,j),selectionInactiveBackgroundTransparent:j,selectionInactiveBackgroundOpaque:y.color.blend(b,j),ansi:l.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(D={}){const T=this._colors;if(T.foreground=N(D.foreground,v),T.background=N(D.background,b),T.cursor=N(D.cursor,x),T.cursorAccent=N(D.cursorAccent,S),T.selectionBackgroundTransparent=N(D.selectionBackground,j),T.selectionBackgroundOpaque=y.color.blend(T.background,T.selectionBackgroundTransparent),T.selectionInactiveBackgroundTransparent=N(D.selectionInactiveBackground,T.selectionBackgroundTransparent),T.selectionInactiveBackgroundOpaque=y.color.blend(T.background,T.selectionInactiveBackgroundTransparent),T.selectionForeground=D.selectionForeground?N(D.selectionForeground,y.NULL_COLOR):void 0,T.selectionForeground===y.NULL_COLOR&&(T.selectionForeground=void 0),y.color.isOpaque(T.selectionBackgroundTransparent)&&(T.selectionBackgroundTransparent=y.color.opacity(T.selectionBackgroundTransparent,.3)),y.color.isOpaque(T.selectionInactiveBackgroundTransparent)&&(T.selectionInactiveBackgroundTransparent=y.color.opacity(T.selectionInactiveBackgroundTransparent,.3)),T.ansi=l.DEFAULT_ANSI_COLORS.slice(),T.ansi[0]=N(D.black,l.DEFAULT_ANSI_COLORS[0]),T.ansi[1]=N(D.red,l.DEFAULT_ANSI_COLORS[1]),T.ansi[2]=N(D.green,l.DEFAULT_ANSI_COLORS[2]),T.ansi[3]=N(D.yellow,l.DEFAULT_ANSI_COLORS[3]),T.ansi[4]=N(D.blue,l.DEFAULT_ANSI_COLORS[4]),T.ansi[5]=N(D.magenta,l.DEFAULT_ANSI_COLORS[5]),T.ansi[6]=N(D.cyan,l.DEFAULT_ANSI_COLORS[6]),T.ansi[7]=N(D.white,l.DEFAULT_ANSI_COLORS[7]),T.ansi[8]=N(D.brightBlack,l.DEFAULT_ANSI_COLORS[8]),T.ansi[9]=N(D.brightRed,l.DEFAULT_ANSI_COLORS[9]),T.ansi[10]=N(D.brightGreen,l.DEFAULT_ANSI_COLORS[10]),T.ansi[11]=N(D.brightYellow,l.DEFAULT_ANSI_COLORS[11]),T.ansi[12]=N(D.brightBlue,l.DEFAULT_ANSI_COLORS[12]),T.ansi[13]=N(D.brightMagenta,l.DEFAULT_ANSI_COLORS[13]),T.ansi[14]=N(D.brightCyan,l.DEFAULT_ANSI_COLORS[14]),T.ansi[15]=N(D.brightWhite,l.DEFAULT_ANSI_COLORS[15]),D.extendedAnsi){const I=Math.min(T.ansi.length-16,D.extendedAnsi.length);for(let H=0;H<I;H++)T.ansi[H+16]=N(D.extendedAnsi[H],l.DEFAULT_ANSI_COLORS[H+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(D){this._restoreColor(D),this._onChangeColors.fire(this.colors)}_restoreColor(D){if(D!==void 0)switch(D){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[D]=this._restoreColors.ansi[D]}else for(let T=0;T<this._restoreColors.ansi.length;++T)this._colors.ansi[T]=this._restoreColors.ansi[T]}modifyColors(D){D(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(D,T){if(D!==void 0)try{return y.css.toColor(D)}catch{}return T}l.ThemeService=A=p([g(0,C.IOptionsService)],A)},6349:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CircularList=void 0;const p=d(8460),g=d(844);class m extends g.Disposable{constructor(_){super(),this._maxLength=_,this.onDeleteEmitter=this.register(new p.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new p.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new p.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(_){if(this._maxLength===_)return;const k=new Array(_);for(let C=0;C<Math.min(_,this.length);C++)k[C]=this._array[this._getCyclicIndex(C)];this._array=k,this._maxLength=_,this._startIndex=0}get length(){return this._length}set length(_){if(_>this._length)for(let k=this._length;k<_;k++)this._array[k]=void 0;this._length=_}get(_){return this._array[this._getCyclicIndex(_)]}set(_,k){this._array[this._getCyclicIndex(_)]=k}push(_){this._array[this._getCyclicIndex(this._length)]=_,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(_,k,...C){if(k){for(let v=_;v<this._length-k;v++)this._array[this._getCyclicIndex(v)]=this._array[this._getCyclicIndex(v+k)];this._length-=k,this.onDeleteEmitter.fire({index:_,amount:k})}for(let v=this._length-1;v>=_;v--)this._array[this._getCyclicIndex(v+C.length)]=this._array[this._getCyclicIndex(v)];for(let v=0;v<C.length;v++)this._array[this._getCyclicIndex(_+v)]=C[v];if(C.length&&this.onInsertEmitter.fire({index:_,amount:C.length}),this._length+C.length>this._maxLength){const v=this._length+C.length-this._maxLength;this._startIndex+=v,this._length=this._maxLength,this.onTrimEmitter.fire(v)}else this._length+=C.length}trimStart(_){_>this._length&&(_=this._length),this._startIndex+=_,this._length-=_,this.onTrimEmitter.fire(_)}shiftElements(_,k,C){if(!(k<=0)){if(_<0||_>=this._length)throw new Error("start argument out of range");if(_+C<0)throw new Error("Cannot shift elements in list beyond index 0");if(C>0){for(let b=k-1;b>=0;b--)this.set(_+b+C,this.get(_+b));const v=_+k+C-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<k;v++)this.set(_+v+C,this.get(_+v))}}_getCyclicIndex(_){return(this._startIndex+_)%this._maxLength}}l.CircularList=m},1439:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.clone=void 0,l.clone=function d(p,g=5){if(typeof p!="object")return p;const m=Array.isArray(p)?[]:{};for(const y in p)m[y]=g<=1?p[y]:p[y]&&d(p[y],g-1);return m}},8055:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.contrastRatio=l.toPaddedHex=l.rgba=l.rgb=l.css=l.color=l.channels=l.NULL_COLOR=void 0;let d=0,p=0,g=0,m=0;var y,_,k,C,v;function b(S){const j=S.toString(16);return j.length<2?"0"+j:j}function x(S,j){return S<j?(j+.05)/(S+.05):(S+.05)/(j+.05)}l.NULL_COLOR={css:"#00000000",rgba:0},(function(S){S.toCss=function(j,A,N,D){return D!==void 0?`#${b(j)}${b(A)}${b(N)}${b(D)}`:`#${b(j)}${b(A)}${b(N)}`},S.toRgba=function(j,A,N,D=255){return(j<<24|A<<16|N<<8|D)>>>0},S.toColor=function(j,A,N,D){return{css:S.toCss(j,A,N,D),rgba:S.toRgba(j,A,N,D)}}})(y||(l.channels=y={})),(function(S){function j(A,N){return m=Math.round(255*N),[d,p,g]=v.toChannels(A.rgba),{css:y.toCss(d,p,g,m),rgba:y.toRgba(d,p,g,m)}}S.blend=function(A,N){if(m=(255&N.rgba)/255,m===1)return{css:N.css,rgba:N.rgba};const D=N.rgba>>24&255,T=N.rgba>>16&255,I=N.rgba>>8&255,H=A.rgba>>24&255,V=A.rgba>>16&255,Y=A.rgba>>8&255;return d=H+Math.round((D-H)*m),p=V+Math.round((T-V)*m),g=Y+Math.round((I-Y)*m),{css:y.toCss(d,p,g),rgba:y.toRgba(d,p,g)}},S.isOpaque=function(A){return(255&A.rgba)==255},S.ensureContrastRatio=function(A,N,D){const T=v.ensureContrastRatio(A.rgba,N.rgba,D);if(T)return y.toColor(T>>24&255,T>>16&255,T>>8&255)},S.opaque=function(A){const N=(255|A.rgba)>>>0;return[d,p,g]=v.toChannels(N),{css:y.toCss(d,p,g),rgba:N}},S.opacity=j,S.multiplyOpacity=function(A,N){return m=255&A.rgba,j(A,m*N/255)},S.toColorRGB=function(A){return[A.rgba>>24&255,A.rgba>>16&255,A.rgba>>8&255]}})(_||(l.color=_={})),(function(S){let j,A;try{const N=document.createElement("canvas");N.width=1,N.height=1;const D=N.getContext("2d",{willReadFrequently:!0});D&&(j=D,j.globalCompositeOperation="copy",A=j.createLinearGradient(0,0,1,1))}catch{}S.toColor=function(N){if(N.match(/#[\da-f]{3,8}/i))switch(N.length){case 4:return d=parseInt(N.slice(1,2).repeat(2),16),p=parseInt(N.slice(2,3).repeat(2),16),g=parseInt(N.slice(3,4).repeat(2),16),y.toColor(d,p,g);case 5:return d=parseInt(N.slice(1,2).repeat(2),16),p=parseInt(N.slice(2,3).repeat(2),16),g=parseInt(N.slice(3,4).repeat(2),16),m=parseInt(N.slice(4,5).repeat(2),16),y.toColor(d,p,g,m);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 D=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(D)return d=parseInt(D[1]),p=parseInt(D[2]),g=parseInt(D[3]),m=Math.round(255*(D[5]===void 0?1:parseFloat(D[5]))),y.toColor(d,p,g,m);if(!j||!A)throw new Error("css.toColor: Unsupported css format");if(j.fillStyle=A,j.fillStyle=N,typeof j.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(j.fillRect(0,0,1,1),[d,p,g,m]=j.getImageData(0,0,1,1).data,m!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:y.toRgba(d,p,g,m),css:N}}})(k||(l.css=k={})),(function(S){function j(A,N,D){const T=A/255,I=N/255,H=D/255;return .2126*(T<=.03928?T/12.92:Math.pow((T+.055)/1.055,2.4))+.7152*(I<=.03928?I/12.92:Math.pow((I+.055)/1.055,2.4))+.0722*(H<=.03928?H/12.92:Math.pow((H+.055)/1.055,2.4))}S.relativeLuminance=function(A){return j(A>>16&255,A>>8&255,255&A)},S.relativeLuminance2=j})(C||(l.rgb=C={})),(function(S){function j(N,D,T){const I=N>>24&255,H=N>>16&255,V=N>>8&255;let Y=D>>24&255,q=D>>16&255,O=D>>8&255,U=x(C.relativeLuminance2(Y,q,O),C.relativeLuminance2(I,H,V));for(;U<T&&(Y>0||q>0||O>0);)Y-=Math.max(0,Math.ceil(.1*Y)),q-=Math.max(0,Math.ceil(.1*q)),O-=Math.max(0,Math.ceil(.1*O)),U=x(C.relativeLuminance2(Y,q,O),C.relativeLuminance2(I,H,V));return(Y<<24|q<<16|O<<8|255)>>>0}function A(N,D,T){const I=N>>24&255,H=N>>16&255,V=N>>8&255;let Y=D>>24&255,q=D>>16&255,O=D>>8&255,U=x(C.relativeLuminance2(Y,q,O),C.relativeLuminance2(I,H,V));for(;U<T&&(Y<255||q<255||O<255);)Y=Math.min(255,Y+Math.ceil(.1*(255-Y))),q=Math.min(255,q+Math.ceil(.1*(255-q))),O=Math.min(255,O+Math.ceil(.1*(255-O))),U=x(C.relativeLuminance2(Y,q,O),C.relativeLuminance2(I,H,V));return(Y<<24|q<<16|O<<8|255)>>>0}S.blend=function(N,D){if(m=(255&D)/255,m===1)return D;const T=D>>24&255,I=D>>16&255,H=D>>8&255,V=N>>24&255,Y=N>>16&255,q=N>>8&255;return d=V+Math.round((T-V)*m),p=Y+Math.round((I-Y)*m),g=q+Math.round((H-q)*m),y.toRgba(d,p,g)},S.ensureContrastRatio=function(N,D,T){const I=C.relativeLuminance(N>>8),H=C.relativeLuminance(D>>8);if(x(I,H)<T){if(H<I){const q=j(N,D,T),O=x(I,C.relativeLuminance(q>>8));if(O<T){const U=A(N,D,T);return O>x(I,C.relativeLuminance(U>>8))?q:U}return q}const V=A(N,D,T),Y=x(I,C.relativeLuminance(V>>8));if(Y<T){const q=j(N,D,T);return Y>x(I,C.relativeLuminance(q>>8))?V:q}return V}},S.reduceLuminance=j,S.increaseLuminance=A,S.toChannels=function(N){return[N>>24&255,N>>16&255,N>>8&255,255&N]}})(v||(l.rgba=v={})),l.toPaddedHex=b,l.contrastRatio=x},8969:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CoreTerminal=void 0;const p=d(844),g=d(2585),m=d(4348),y=d(7866),_=d(744),k=d(7302),C=d(6975),v=d(8460),b=d(1753),x=d(1480),S=d(7994),j=d(9282),A=d(5435),N=d(5981),D=d(2660);let T=!1;class I extends p.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new v.EventEmitter),this._onScroll.event((V=>{var Y;(Y=this._onScrollApi)==null||Y.fire(V.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(V){for(const Y in V)this.optionsService.options[Y]=V[Y]}constructor(V){super(),this._windowsWrappingHeuristics=this.register(new p.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 m.InstantiationService,this.optionsService=this.register(new k.OptionsService(V)),this._instantiationService.setService(g.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(_.BufferService)),this._instantiationService.setService(g.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(y.LogService)),this._instantiationService.setService(g.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(C.CoreService)),this._instantiationService.setService(g.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(b.CoreMouseService)),this._instantiationService.setService(g.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(x.UnicodeService)),this._instantiationService.setService(g.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(S.CharsetService),this._instantiationService.setService(g.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(D.OscLinkService),this._instantiationService.setService(g.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new A.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((Y=>{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((Y=>{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(((Y,q)=>this._inputHandler.parse(Y,q)))),this.register((0,v.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(V,Y){this._writeBuffer.write(V,Y)}writeSync(V,Y){this._logService.logLevel<=g.LogLevelEnum.WARN&&!T&&(this._logService.warn("writeSync is unreliable and will be removed soon."),T=!0),this._writeBuffer.writeSync(V,Y)}input(V,Y=!0){this.coreService.triggerDataEvent(V,Y)}resize(V,Y){isNaN(V)||isNaN(Y)||(V=Math.max(V,_.MINIMUM_COLS),Y=Math.max(Y,_.MINIMUM_ROWS),this._bufferService.resize(V,Y))}scroll(V,Y=!1){this._bufferService.scroll(V,Y)}scrollLines(V,Y,q){this._bufferService.scrollLines(V,Y,q)}scrollPages(V){this.scrollLines(V*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(V){const Y=V-this._bufferService.buffer.ydisp;Y!==0&&this.scrollLines(Y)}registerEscHandler(V,Y){return this._inputHandler.registerEscHandler(V,Y)}registerDcsHandler(V,Y){return this._inputHandler.registerDcsHandler(V,Y)}registerCsiHandler(V,Y){return this._inputHandler.registerCsiHandler(V,Y)}registerOscHandler(V,Y){return this._inputHandler.registerOscHandler(V,Y)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let V=!1;const Y=this.optionsService.rawOptions.windowsPty;Y&&Y.buildNumber!==void 0&&Y.buildNumber!==void 0?V=Y.backend==="conpty"&&Y.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(V=!0),V?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const V=[];V.push(this.onLineFeed(j.updateWindowsModeWrappedState.bind(null,this._bufferService))),V.push(this.registerCsiHandler({final:"H"},(()=>((0,j.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,p.toDisposable)((()=>{for(const Y of V)Y.dispose()}))}}}l.CoreTerminal=I},8460:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.runAndSubscribe=l.forwardEvent=l.EventEmitter=void 0,l.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=d=>(this._listeners.push(d),{dispose:()=>{if(!this._disposed){for(let p=0;p<this._listeners.length;p++)if(this._listeners[p]===d)return void this._listeners.splice(p,1)}}})),this._event}fire(d,p){const g=[];for(let m=0;m<this._listeners.length;m++)g.push(this._listeners[m]);for(let m=0;m<g.length;m++)g[m].call(void 0,d,p)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},l.forwardEvent=function(d,p){return d((g=>p.fire(g)))},l.runAndSubscribe=function(d,p){return p(void 0),d((g=>p(g)))}},5435:function(f,l,d){var p=this&&this.__decorate||function(Q,M,L,B){var W,F=arguments.length,re=F<3?M:B===null?B=Object.getOwnPropertyDescriptor(M,L):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")re=Reflect.decorate(Q,M,L,B);else for(var Z=Q.length-1;Z>=0;Z--)(W=Q[Z])&&(re=(F<3?W(re):F>3?W(M,L,re):W(M,L))||re);return F>3&&re&&Object.defineProperty(M,L,re),re},g=this&&this.__param||function(Q,M){return function(L,B){M(L,B,Q)}};Object.defineProperty(l,"__esModule",{value:!0}),l.InputHandler=l.WindowsOptionsReportType=void 0;const m=d(2584),y=d(7116),_=d(2015),k=d(844),C=d(482),v=d(8437),b=d(8460),x=d(643),S=d(511),j=d(3734),A=d(2585),N=d(1480),D=d(6242),T=d(6351),I=d(5941),H={"(":0,")":1,"*":2,"+":3,"-":1,".":2},V=131072;function Y(Q,M){if(Q>24)return M.setWinLines||!1;switch(Q){case 1:return!!M.restoreWin;case 2:return!!M.minimizeWin;case 3:return!!M.setWinPosition;case 4:return!!M.setWinSizePixels;case 5:return!!M.raiseWin;case 6:return!!M.lowerWin;case 7:return!!M.refreshWin;case 8:return!!M.setWinSizeChars;case 9:return!!M.maximizeWin;case 10:return!!M.fullscreenWin;case 11:return!!M.getWinState;case 13:return!!M.getWinPosition;case 14:return!!M.getWinSizePixels;case 15:return!!M.getScreenSizePixels;case 16:return!!M.getCellSizePixels;case 18:return!!M.getWinSizeChars;case 19:return!!M.getScreenSizeChars;case 20:return!!M.getIconTitle;case 21:return!!M.getWinTitle;case 22:return!!M.pushTitle;case 23:return!!M.popTitle;case 24:return!!M.setWinLines}return!1}var q;(function(Q){Q[Q.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",Q[Q.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(q||(l.WindowsOptionsReportType=q={}));let O=0;class U extends k.Disposable{getAttrData(){return this._curAttrData}constructor(M,L,B,W,F,re,Z,ee,K=new _.EscapeSequenceParser){super(),this._bufferService=M,this._charsetService=L,this._coreService=B,this._logService=W,this._optionsService=F,this._oscLinkService=re,this._coreMouseService=Z,this._unicodeService=ee,this._parser=K,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new C.StringToUtf32,this._utf8Decoder=new C.Utf8ToUtf32,this._workCell=new S.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 b.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new b.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new b.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new b.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new b.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new b.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new b.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new b.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new b.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new b.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new b.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new b.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new b.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 z(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(($=>this._activeBuffer=$.activeBuffer))),this._parser.setCsiHandlerFallback((($,ae)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString($),params:ae.toArray()})})),this._parser.setEscHandlerFallback(($=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString($)})})),this._parser.setExecuteHandlerFallback(($=>{this._logService.debug("Unknown EXECUTE code: ",{code:$})})),this._parser.setOscHandlerFallback((($,ae,ne)=>{this._logService.debug("Unknown OSC code: ",{identifier:$,action:ae,data:ne})})),this._parser.setDcsHandlerFallback((($,ae,ne)=>{ae==="HOOK"&&(ne=ne.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString($),action:ae,payload:ne})})),this._parser.setPrintHandler((($,ae,ne)=>this.print($,ae,ne))),this._parser.registerCsiHandler({final:"@"},($=>this.insertChars($))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},($=>this.scrollLeft($))),this._parser.registerCsiHandler({final:"A"},($=>this.cursorUp($))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},($=>this.scrollRight($))),this._parser.registerCsiHandler({final:"B"},($=>this.cursorDown($))),this._parser.registerCsiHandler({final:"C"},($=>this.cursorForward($))),this._parser.registerCsiHandler({final:"D"},($=>this.cursorBackward($))),this._parser.registerCsiHandler({final:"E"},($=>this.cursorNextLine($))),this._parser.registerCsiHandler({final:"F"},($=>this.cursorPrecedingLine($))),this._parser.registerCsiHandler({final:"G"},($=>this.cursorCharAbsolute($))),this._parser.registerCsiHandler({final:"H"},($=>this.cursorPosition($))),this._parser.registerCsiHandler({final:"I"},($=>this.cursorForwardTab($))),this._parser.registerCsiHandler({final:"J"},($=>this.eraseInDisplay($,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},($=>this.eraseInDisplay($,!0))),this._parser.registerCsiHandler({final:"K"},($=>this.eraseInLine($,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},($=>this.eraseInLine($,!0))),this._parser.registerCsiHandler({final:"L"},($=>this.insertLines($))),this._parser.registerCsiHandler({final:"M"},($=>this.deleteLines($))),this._parser.registerCsiHandler({final:"P"},($=>this.deleteChars($))),this._parser.registerCsiHandler({final:"S"},($=>this.scrollUp($))),this._parser.registerCsiHandler({final:"T"},($=>this.scrollDown($))),this._parser.registerCsiHandler({final:"X"},($=>this.eraseChars($))),this._parser.registerCsiHandler({final:"Z"},($=>this.cursorBackwardTab($))),this._parser.registerCsiHandler({final:"`"},($=>this.charPosAbsolute($))),this._parser.registerCsiHandler({final:"a"},($=>this.hPositionRelative($))),this._parser.registerCsiHandler({final:"b"},($=>this.repeatPrecedingCharacter($))),this._parser.registerCsiHandler({final:"c"},($=>this.sendDeviceAttributesPrimary($))),this._parser.registerCsiHandler({prefix:">",final:"c"},($=>this.sendDeviceAttributesSecondary($))),this._parser.registerCsiHandler({final:"d"},($=>this.linePosAbsolute($))),this._parser.registerCsiHandler({final:"e"},($=>this.vPositionRelative($))),this._parser.registerCsiHandler({final:"f"},($=>this.hVPosition($))),this._parser.registerCsiHandler({final:"g"},($=>this.tabClear($))),this._parser.registerCsiHandler({final:"h"},($=>this.setMode($))),this._parser.registerCsiHandler({prefix:"?",final:"h"},($=>this.setModePrivate($))),this._parser.registerCsiHandler({final:"l"},($=>this.resetMode($))),this._parser.registerCsiHandler({prefix:"?",final:"l"},($=>this.resetModePrivate($))),this._parser.registerCsiHandler({final:"m"},($=>this.charAttributes($))),this._parser.registerCsiHandler({final:"n"},($=>this.deviceStatus($))),this._parser.registerCsiHandler({prefix:"?",final:"n"},($=>this.deviceStatusPrivate($))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},($=>this.softReset($))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},($=>this.setCursorStyle($))),this._parser.registerCsiHandler({final:"r"},($=>this.setScrollRegion($))),this._parser.registerCsiHandler({final:"s"},($=>this.saveCursor($))),this._parser.registerCsiHandler({final:"t"},($=>this.windowOptions($))),this._parser.registerCsiHandler({final:"u"},($=>this.restoreCursor($))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},($=>this.insertColumns($))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},($=>this.deleteColumns($))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},($=>this.selectProtected($))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},($=>this.requestMode($,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},($=>this.requestMode($,!1))),this._parser.setExecuteHandler(m.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(m.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(m.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(m.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(m.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(m.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(m.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(m.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(m.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(m.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(m.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(m.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new D.OscHandler(($=>(this.setTitle($),this.setIconName($),!0)))),this._parser.registerOscHandler(1,new D.OscHandler(($=>this.setIconName($)))),this._parser.registerOscHandler(2,new D.OscHandler(($=>this.setTitle($)))),this._parser.registerOscHandler(4,new D.OscHandler(($=>this.setOrReportIndexedColor($)))),this._parser.registerOscHandler(8,new D.OscHandler(($=>this.setHyperlink($)))),this._parser.registerOscHandler(10,new D.OscHandler(($=>this.setOrReportFgColor($)))),this._parser.registerOscHandler(11,new D.OscHandler(($=>this.setOrReportBgColor($)))),this._parser.registerOscHandler(12,new D.OscHandler(($=>this.setOrReportCursorColor($)))),this._parser.registerOscHandler(104,new D.OscHandler(($=>this.restoreIndexedColor($)))),this._parser.registerOscHandler(110,new D.OscHandler(($=>this.restoreFgColor($)))),this._parser.registerOscHandler(111,new D.OscHandler(($=>this.restoreBgColor($)))),this._parser.registerOscHandler(112,new D.OscHandler(($=>this.restoreCursorColor($)))),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 $ in y.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:$},(()=>this.selectCharset("("+$))),this._parser.registerEscHandler({intermediates:")",final:$},(()=>this.selectCharset(")"+$))),this._parser.registerEscHandler({intermediates:"*",final:$},(()=>this.selectCharset("*"+$))),this._parser.registerEscHandler({intermediates:"+",final:$},(()=>this.selectCharset("+"+$))),this._parser.registerEscHandler({intermediates:"-",final:$},(()=>this.selectCharset("-"+$))),this._parser.registerEscHandler({intermediates:".",final:$},(()=>this.selectCharset("."+$))),this._parser.registerEscHandler({intermediates:"/",final:$},(()=>this.selectCharset("/"+$)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler(($=>(this._logService.error("Parsing error: ",$),$))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new T.DcsHandler((($,ae)=>this.requestStatusString($,ae))))}_preserveStack(M,L,B,W){this._parseStack.paused=!0,this._parseStack.cursorStartX=M,this._parseStack.cursorStartY=L,this._parseStack.decodedLength=B,this._parseStack.position=W}_logSlowResolvingAsync(M){this._logService.logLevel<=A.LogLevelEnum.WARN&&Promise.race([M,new Promise(((L,B)=>setTimeout((()=>B("#SLOW_TIMEOUT")),5e3)))]).catch((L=>{if(L!=="#SLOW_TIMEOUT")throw L;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(M,L){let B,W=this._activeBuffer.x,F=this._activeBuffer.y,re=0;const Z=this._parseStack.paused;if(Z){if(B=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,L))return this._logSlowResolvingAsync(B),B;W=this._parseStack.cursorStartX,F=this._parseStack.cursorStartY,this._parseStack.paused=!1,M.length>V&&(re=this._parseStack.position+V)}if(this._logService.logLevel<=A.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof M=="string"?` "${M}"`:` "${Array.prototype.map.call(M,($=>String.fromCharCode($))).join("")}"`),typeof M=="string"?M.split("").map(($=>$.charCodeAt(0))):M),this._parseBuffer.length<M.length&&this._parseBuffer.length<V&&(this._parseBuffer=new Uint32Array(Math.min(M.length,V))),Z||this._dirtyRowTracker.clearRange(),M.length>V)for(let $=re;$<M.length;$+=V){const ae=$+V<M.length?$+V:M.length,ne=typeof M=="string"?this._stringDecoder.decode(M.substring($,ae),this._parseBuffer):this._utf8Decoder.decode(M.subarray($,ae),this._parseBuffer);if(B=this._parser.parse(this._parseBuffer,ne))return this._preserveStack(W,F,ne,$),this._logSlowResolvingAsync(B),B}else if(!Z){const $=typeof M=="string"?this._stringDecoder.decode(M,this._parseBuffer):this._utf8Decoder.decode(M,this._parseBuffer);if(B=this._parser.parse(this._parseBuffer,$))return this._preserveStack(W,F,$,0),this._logSlowResolvingAsync(B),B}this._activeBuffer.x===W&&this._activeBuffer.y===F||this._onCursorMove.fire();const ee=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),K=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);K<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(K,this._bufferService.rows-1),Math.min(ee,this._bufferService.rows-1))}print(M,L,B){let W,F;const re=this._charsetService.charset,Z=this._optionsService.rawOptions.screenReaderMode,ee=this._bufferService.cols,K=this._coreService.decPrivateModes.wraparound,$=this._coreService.modes.insertMode,ae=this._curAttrData;let ne=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&B-L>0&&ne.getWidth(this._activeBuffer.x-1)===2&&ne.setCellFromCodepoint(this._activeBuffer.x-1,0,1,ae);let ve=this._parser.precedingJoinState;for(let be=L;be<B;++be){if(W=M[be],W<127&&re){const Fe=re[String.fromCharCode(W)];Fe&&(W=Fe.charCodeAt(0))}const Ae=this._unicodeService.charProperties(W,ve);F=N.UnicodeService.extractWidth(Ae);const Me=N.UnicodeService.extractShouldJoin(Ae),Ie=Me?N.UnicodeService.extractWidth(ve):0;if(ve=Ae,Z&&this._onA11yChar.fire((0,C.stringFromCodePoint)(W)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+F-Ie>ee){if(K){const Fe=ne;let ke=this._activeBuffer.x-Ie;for(this._activeBuffer.x=Ie,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),ne=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),Ie>0&&ne instanceof v.BufferLine&&ne.copyCellsFrom(Fe,ke,0,Ie,!1);ke<ee;)Fe.setCellFromCodepoint(ke++,0,1,ae)}else if(this._activeBuffer.x=ee-1,F===2)continue}if(Me&&this._activeBuffer.x){const Fe=ne.getWidth(this._activeBuffer.x-1)?1:2;ne.addCodepointToCell(this._activeBuffer.x-Fe,W,F);for(let ke=F-Ie;--ke>=0;)ne.setCellFromCodepoint(this._activeBuffer.x++,0,0,ae)}else if($&&(ne.insertCells(this._activeBuffer.x,F-Ie,this._activeBuffer.getNullCell(ae)),ne.getWidth(ee-1)===2&&ne.setCellFromCodepoint(ee-1,x.NULL_CELL_CODE,x.NULL_CELL_WIDTH,ae)),ne.setCellFromCodepoint(this._activeBuffer.x++,W,F,ae),F>0)for(;--F;)ne.setCellFromCodepoint(this._activeBuffer.x++,0,0,ae)}this._parser.precedingJoinState=ve,this._activeBuffer.x<ee&&B-L>0&&ne.getWidth(this._activeBuffer.x)===0&&!ne.hasContent(this._activeBuffer.x)&&ne.setCellFromCodepoint(this._activeBuffer.x,0,1,ae),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(M,L){return M.final!=="t"||M.prefix||M.intermediates?this._parser.registerCsiHandler(M,L):this._parser.registerCsiHandler(M,(B=>!Y(B.params[0],this._optionsService.rawOptions.windowOptions)||L(B)))}registerDcsHandler(M,L){return this._parser.registerDcsHandler(M,new T.DcsHandler(L))}registerEscHandler(M,L){return this._parser.registerEscHandler(M,L)}registerOscHandler(M,L){return this._parser.registerOscHandler(M,new D.OscHandler(L))}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 M;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&&((M=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&M.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);L.hasWidth(this._activeBuffer.x)&&!L.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const M=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-M),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(M=this._bufferService.cols-1){this._activeBuffer.x=Math.min(M,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(M,L){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=M,this._activeBuffer.y=this._activeBuffer.scrollTop+L):(this._activeBuffer.x=M,this._activeBuffer.y=L),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(M,L){this._restrictCursor(),this._setCursor(this._activeBuffer.x+M,this._activeBuffer.y+L)}cursorUp(M){const L=this._activeBuffer.y-this._activeBuffer.scrollTop;return L>=0?this._moveCursor(0,-Math.min(L,M.params[0]||1)):this._moveCursor(0,-(M.params[0]||1)),!0}cursorDown(M){const L=this._activeBuffer.scrollBottom-this._activeBuffer.y;return L>=0?this._moveCursor(0,Math.min(L,M.params[0]||1)):this._moveCursor(0,M.params[0]||1),!0}cursorForward(M){return this._moveCursor(M.params[0]||1,0),!0}cursorBackward(M){return this._moveCursor(-(M.params[0]||1),0),!0}cursorNextLine(M){return this.cursorDown(M),this._activeBuffer.x=0,!0}cursorPrecedingLine(M){return this.cursorUp(M),this._activeBuffer.x=0,!0}cursorCharAbsolute(M){return this._setCursor((M.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(M){return this._setCursor(M.length>=2?(M.params[1]||1)-1:0,(M.params[0]||1)-1),!0}charPosAbsolute(M){return this._setCursor((M.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(M){return this._moveCursor(M.params[0]||1,0),!0}linePosAbsolute(M){return this._setCursor(this._activeBuffer.x,(M.params[0]||1)-1),!0}vPositionRelative(M){return this._moveCursor(0,M.params[0]||1),!0}hVPosition(M){return this.cursorPosition(M),!0}tabClear(M){const L=M.params[0];return L===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:L===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(M){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=M.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(M){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=M.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(M){const L=M.params[0];return L===1&&(this._curAttrData.bg|=536870912),L!==2&&L!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(M,L,B,W=!1,F=!1){const re=this._activeBuffer.lines.get(this._activeBuffer.ybase+M);re.replaceCells(L,B,this._activeBuffer.getNullCell(this._eraseAttrData()),F),W&&(re.isWrapped=!1)}_resetBufferLine(M,L=!1){const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+M);B&&(B.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),L),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+M),B.isWrapped=!1)}eraseInDisplay(M,L=!1){let B;switch(this._restrictCursor(this._bufferService.cols),M.params[0]){case 0:for(B=this._activeBuffer.y,this._dirtyRowTracker.markDirty(B),this._eraseInBufferLine(B++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);B<this._bufferService.rows;B++)this._resetBufferLine(B,L);this._dirtyRowTracker.markDirty(B);break;case 1:for(B=this._activeBuffer.y,this._dirtyRowTracker.markDirty(B),this._eraseInBufferLine(B,0,this._activeBuffer.x+1,!0,L),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(B+1).isWrapped=!1);B--;)this._resetBufferLine(B,L);this._dirtyRowTracker.markDirty(0);break;case 2:for(B=this._bufferService.rows,this._dirtyRowTracker.markDirty(B-1);B--;)this._resetBufferLine(B,L);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(M,L=!1){switch(this._restrictCursor(this._bufferService.cols),M.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,L);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,L)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(M){this._restrictCursor();let L=M.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=this._activeBuffer.ybase+this._activeBuffer.y,W=this._bufferService.rows-1-this._activeBuffer.scrollBottom,F=this._bufferService.rows-1+this._activeBuffer.ybase-W+1;for(;L--;)this._activeBuffer.lines.splice(F-1,1),this._activeBuffer.lines.splice(B,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(M){this._restrictCursor();let L=M.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=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;L--;)this._activeBuffer.lines.splice(B,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(M){this._restrictCursor();const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.insertCells(this._activeBuffer.x,M.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(M){this._restrictCursor();const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.deleteCells(this._activeBuffer.x,M.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(M){let L=M.params[0]||1;for(;L--;)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(M){let L=M.params[0]||1;for(;L--;)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(M){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=M.params[0]||1;for(let B=this._activeBuffer.scrollTop;B<=this._activeBuffer.scrollBottom;++B){const W=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);W.deleteCells(0,L,this._activeBuffer.getNullCell(this._eraseAttrData())),W.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(M){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=M.params[0]||1;for(let B=this._activeBuffer.scrollTop;B<=this._activeBuffer.scrollBottom;++B){const W=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);W.insertCells(0,L,this._activeBuffer.getNullCell(this._eraseAttrData())),W.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(M){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=M.params[0]||1;for(let B=this._activeBuffer.scrollTop;B<=this._activeBuffer.scrollBottom;++B){const W=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);W.insertCells(this._activeBuffer.x,L,this._activeBuffer.getNullCell(this._eraseAttrData())),W.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(M){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=M.params[0]||1;for(let B=this._activeBuffer.scrollTop;B<=this._activeBuffer.scrollBottom;++B){const W=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);W.deleteCells(this._activeBuffer.x,L,this._activeBuffer.getNullCell(this._eraseAttrData())),W.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(M){this._restrictCursor();const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(M.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(M){const L=this._parser.precedingJoinState;if(!L)return!0;const B=M.params[0]||1,W=N.UnicodeService.extractWidth(L),F=this._activeBuffer.x-W,re=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(F),Z=new Uint32Array(re.length*B);let ee=0;for(let $=0;$<re.length;){const ae=re.codePointAt($)||0;Z[ee++]=ae,$+=ae>65535?2:1}let K=ee;for(let $=1;$<B;++$)Z.copyWithin(K,0,ee),K+=ee;return this.print(Z,0,K),!0}sendDeviceAttributesPrimary(M){return M.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(m.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(m.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(M){return M.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(m.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(m.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(M.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(m.C0.ESC+"[>83;40003;0c")),!0}_is(M){return(this._optionsService.rawOptions.termName+"").indexOf(M)===0}setMode(M){for(let L=0;L<M.length;L++)switch(M.params[L]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(M){for(let L=0;L<M.length;L++)switch(M.params[L]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,y.DEFAULT_CHARSET),this._charsetService.setgCharset(1,y.DEFAULT_CHARSET),this._charsetService.setgCharset(2,y.DEFAULT_CHARSET),this._charsetService.setgCharset(3,y.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(M){for(let L=0;L<M.length;L++)switch(M.params[L]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(M){for(let L=0;L<M.length;L++)switch(M.params[L]){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(),M.params[L]===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(M,L){const B=this._coreService.decPrivateModes,{activeProtocol:W,activeEncoding:F}=this._coreMouseService,re=this._coreService,{buffers:Z,cols:ee}=this._bufferService,{active:K,alt:$}=Z,ae=this._optionsService.rawOptions,ne=Me=>Me?1:2,ve=M.params[0];return be=ve,Ae=L?ve===2?4:ve===4?ne(re.modes.insertMode):ve===12?3:ve===20?ne(ae.convertEol):0:ve===1?ne(B.applicationCursorKeys):ve===3?ae.windowOptions.setWinLines?ee===80?2:ee===132?1:0:0:ve===6?ne(B.origin):ve===7?ne(B.wraparound):ve===8?3:ve===9?ne(W==="X10"):ve===12?ne(ae.cursorBlink):ve===25?ne(!re.isCursorHidden):ve===45?ne(B.reverseWraparound):ve===66?ne(B.applicationKeypad):ve===67?4:ve===1e3?ne(W==="VT200"):ve===1002?ne(W==="DRAG"):ve===1003?ne(W==="ANY"):ve===1004?ne(B.sendFocus):ve===1005?4:ve===1006?ne(F==="SGR"):ve===1015?4:ve===1016?ne(F==="SGR_PIXELS"):ve===1048?1:ve===47||ve===1047||ve===1049?ne(K===$):ve===2004?ne(B.bracketedPasteMode):0,re.triggerDataEvent(`${m.C0.ESC}[${L?"":"?"}${be};${Ae}$y`),!0;var be,Ae}_updateAttrColor(M,L,B,W,F){return L===2?(M|=50331648,M&=-16777216,M|=j.AttributeData.fromColorRGB([B,W,F])):L===5&&(M&=-50331904,M|=33554432|255&B),M}_extractColor(M,L,B){const W=[0,0,-1,0,0,0];let F=0,re=0;do{if(W[re+F]=M.params[L+re],M.hasSubParams(L+re)){const Z=M.getSubParams(L+re);let ee=0;do W[1]===5&&(F=1),W[re+ee+1+F]=Z[ee];while(++ee<Z.length&&ee+re+1+F<W.length);break}if(W[1]===5&&re+F>=2||W[1]===2&&re+F>=5)break;W[1]&&(F=1)}while(++re+L<M.length&&re+F<W.length);for(let Z=2;Z<W.length;++Z)W[Z]===-1&&(W[Z]=0);switch(W[0]){case 38:B.fg=this._updateAttrColor(B.fg,W[1],W[3],W[4],W[5]);break;case 48:B.bg=this._updateAttrColor(B.bg,W[1],W[3],W[4],W[5]);break;case 58:B.extended=B.extended.clone(),B.extended.underlineColor=this._updateAttrColor(B.extended.underlineColor,W[1],W[3],W[4],W[5])}return re}_processUnderline(M,L){L.extended=L.extended.clone(),(!~M||M>5)&&(M=1),L.extended.underlineStyle=M,L.fg|=268435456,M===0&&(L.fg&=-268435457),L.updateExtended()}_processSGR0(M){M.fg=v.DEFAULT_ATTR_DATA.fg,M.bg=v.DEFAULT_ATTR_DATA.bg,M.extended=M.extended.clone(),M.extended.underlineStyle=0,M.extended.underlineColor&=-67108864,M.updateExtended()}charAttributes(M){if(M.length===1&&M.params[0]===0)return this._processSGR0(this._curAttrData),!0;const L=M.length;let B;const W=this._curAttrData;for(let F=0;F<L;F++)B=M.params[F],B>=30&&B<=37?(W.fg&=-50331904,W.fg|=16777216|B-30):B>=40&&B<=47?(W.bg&=-50331904,W.bg|=16777216|B-40):B>=90&&B<=97?(W.fg&=-50331904,W.fg|=16777224|B-90):B>=100&&B<=107?(W.bg&=-50331904,W.bg|=16777224|B-100):B===0?this._processSGR0(W):B===1?W.fg|=134217728:B===3?W.bg|=67108864:B===4?(W.fg|=268435456,this._processUnderline(M.hasSubParams(F)?M.getSubParams(F)[0]:1,W)):B===5?W.fg|=536870912:B===7?W.fg|=67108864:B===8?W.fg|=1073741824:B===9?W.fg|=2147483648:B===2?W.bg|=134217728:B===21?this._processUnderline(2,W):B===22?(W.fg&=-134217729,W.bg&=-134217729):B===23?W.bg&=-67108865:B===24?(W.fg&=-268435457,this._processUnderline(0,W)):B===25?W.fg&=-536870913:B===27?W.fg&=-67108865:B===28?W.fg&=-1073741825:B===29?W.fg&=2147483647:B===39?(W.fg&=-67108864,W.fg|=16777215&v.DEFAULT_ATTR_DATA.fg):B===49?(W.bg&=-67108864,W.bg|=16777215&v.DEFAULT_ATTR_DATA.bg):B===38||B===48||B===58?F+=this._extractColor(M,F,W):B===53?W.bg|=1073741824:B===55?W.bg&=-1073741825:B===59?(W.extended=W.extended.clone(),W.extended.underlineColor=-1,W.updateExtended()):B===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.",B);return!0}deviceStatus(M){switch(M.params[0]){case 5:this._coreService.triggerDataEvent(`${m.C0.ESC}[0n`);break;case 6:const L=this._activeBuffer.y+1,B=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${m.C0.ESC}[${L};${B}R`)}return!0}deviceStatusPrivate(M){if(M.params[0]===6){const L=this._activeBuffer.y+1,B=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${m.C0.ESC}[?${L};${B}R`)}return!0}softReset(M){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(M){const L=M.params[0]||1;switch(L){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 B=L%2==1;return this._optionsService.options.cursorBlink=B,!0}setScrollRegion(M){const L=M.params[0]||1;let B;return(M.length<2||(B=M.params[1])>this._bufferService.rows||B===0)&&(B=this._bufferService.rows),B>L&&(this._activeBuffer.scrollTop=L-1,this._activeBuffer.scrollBottom=B-1,this._setCursor(0,0)),!0}windowOptions(M){if(!Y(M.params[0],this._optionsService.rawOptions.windowOptions))return!0;const L=M.length>1?M.params[1]:0;switch(M.params[0]){case 14:L!==2&&this._onRequestWindowsOptionsReport.fire(q.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(q.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${m.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:L!==0&&L!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),L!==0&&L!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:L!==0&&L!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),L!==0&&L!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(M){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(M){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(M){return this._windowTitle=M,this._onTitleChange.fire(M),!0}setIconName(M){return this._iconName=M,!0}setOrReportIndexedColor(M){const L=[],B=M.split(";");for(;B.length>1;){const W=B.shift(),F=B.shift();if(/^\d+$/.exec(W)){const re=parseInt(W);if(X(re))if(F==="?")L.push({type:0,index:re});else{const Z=(0,I.parseColor)(F);Z&&L.push({type:1,index:re,color:Z})}}}return L.length&&this._onColor.fire(L),!0}setHyperlink(M){const L=M.split(";");return!(L.length<2)&&(L[1]?this._createHyperlink(L[0],L[1]):!L[0]&&this._finishHyperlink())}_createHyperlink(M,L){this._getCurrentLinkId()&&this._finishHyperlink();const B=M.split(":");let W;const F=B.findIndex((re=>re.startsWith("id=")));return F!==-1&&(W=B[F].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:W,uri:L}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(M,L){const B=M.split(";");for(let W=0;W<B.length&&!(L>=this._specialColors.length);++W,++L)if(B[W]==="?")this._onColor.fire([{type:0,index:this._specialColors[L]}]);else{const F=(0,I.parseColor)(B[W]);F&&this._onColor.fire([{type:1,index:this._specialColors[L],color:F}])}return!0}setOrReportFgColor(M){return this._setOrReportSpecialColor(M,0)}setOrReportBgColor(M){return this._setOrReportSpecialColor(M,1)}setOrReportCursorColor(M){return this._setOrReportSpecialColor(M,2)}restoreIndexedColor(M){if(!M)return this._onColor.fire([{type:2}]),!0;const L=[],B=M.split(";");for(let W=0;W<B.length;++W)if(/^\d+$/.exec(B[W])){const F=parseInt(B[W]);X(F)&&L.push({type:2,index:F})}return L.length&&this._onColor.fire(L),!0}restoreFgColor(M){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(M){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(M){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,y.DEFAULT_CHARSET),!0}selectCharset(M){return M.length!==2?(this.selectDefaultCharset(),!0):(M[0]==="/"||this._charsetService.setgCharset(H[M[0]],y.CHARSETS[M[1]]||y.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 M=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,M,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(M){return this._charsetService.setgLevel(M),!0}screenAlignmentPattern(){const M=new S.CellData;M.content=4194373,M.fg=this._curAttrData.fg,M.bg=this._curAttrData.bg,this._setCursor(0,0);for(let L=0;L<this._bufferService.rows;++L){const B=this._activeBuffer.ybase+this._activeBuffer.y+L,W=this._activeBuffer.lines.get(B);W&&(W.fill(M),W.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(M,L){const B=this._bufferService.buffer,W=this._optionsService.rawOptions;return(F=>(this._coreService.triggerDataEvent(`${m.C0.ESC}${F}${m.C0.ESC}\\`),!0))(M==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:M==='"p'?'P1$r61;1"p':M==="r"?`P1$r${B.scrollTop+1};${B.scrollBottom+1}r`:M==="m"?"P1$r0m":M===" q"?`P1$r${{block:2,underline:4,bar:6}[W.cursorStyle]-(W.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(M,L){this._dirtyRowTracker.markRangeDirty(M,L)}}l.InputHandler=U;let z=class{constructor(Q){this._bufferService=Q,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(Q){Q<this.start?this.start=Q:Q>this.end&&(this.end=Q)}markRangeDirty(Q,M){Q>M&&(O=Q,Q=M,M=O),Q<this.start&&(this.start=Q),M>this.end&&(this.end=M)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function X(Q){return 0<=Q&&Q<256}z=p([g(0,A.IBufferService)],z)},844:(f,l)=>{function d(p){for(const g of p)g.dispose();p.length=0}Object.defineProperty(l,"__esModule",{value:!0}),l.getDisposeArrayDisposable=l.disposeArray=l.toDisposable=l.MutableDisposable=l.Disposable=void 0,l.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const p of this._disposables)p.dispose();this._disposables.length=0}register(p){return this._disposables.push(p),p}unregister(p){const g=this._disposables.indexOf(p);g!==-1&&this._disposables.splice(g,1)}},l.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(p){var g;this._isDisposed||p===this._value||((g=this._value)==null||g.dispose(),this._value=p)}clear(){this.value=void 0}dispose(){var p;this._isDisposed=!0,(p=this._value)==null||p.dispose(),this._value=void 0}},l.toDisposable=function(p){return{dispose:p}},l.disposeArray=d,l.getDisposeArrayDisposable=function(p){return{dispose:()=>d(p)}}},1505:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.FourKeyMap=l.TwoKeyMap=void 0;class d{constructor(){this._data={}}set(g,m,y){this._data[g]||(this._data[g]={}),this._data[g][m]=y}get(g,m){return this._data[g]?this._data[g][m]:void 0}clear(){this._data={}}}l.TwoKeyMap=d,l.FourKeyMap=class{constructor(){this._data=new d}set(p,g,m,y,_){this._data.get(p,g)||this._data.set(p,g,new d),this._data.get(p,g).set(m,y,_)}get(p,g,m,y){var _;return(_=this._data.get(p,g))==null?void 0:_.get(m,y)}clear(){this._data.clear()}}},6114:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.isChromeOS=l.isLinux=l.isWindows=l.isIphone=l.isIpad=l.isMac=l.getSafariVersion=l.isSafari=l.isLegacyEdge=l.isFirefox=l.isNode=void 0,l.isNode=typeof process<"u"&&"title"in process;const d=l.isNode?"node":navigator.userAgent,p=l.isNode?"node":navigator.platform;l.isFirefox=d.includes("Firefox"),l.isLegacyEdge=d.includes("Edge"),l.isSafari=/^((?!chrome|android).)*safari/i.test(d),l.getSafariVersion=function(){if(!l.isSafari)return 0;const g=d.match(/Version\/(\d+)/);return g===null||g.length<2?0:parseInt(g[1])},l.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(p),l.isIpad=p==="iPad",l.isIphone=p==="iPhone",l.isWindows=["Windows","Win16","Win32","WinCE"].includes(p),l.isLinux=p.indexOf("Linux")>=0,l.isChromeOS=/\bCrOS\b/.test(d)},6106:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.SortedList=void 0;let d=0;l.SortedList=class{constructor(p){this._getKey=p,this._array=[]}clear(){this._array.length=0}insert(p){this._array.length!==0?(d=this._search(this._getKey(p)),this._array.splice(d,0,p)):this._array.push(p)}delete(p){if(this._array.length===0)return!1;const g=this._getKey(p);if(g===void 0||(d=this._search(g),d===-1)||this._getKey(this._array[d])!==g)return!1;do if(this._array[d]===p)return this._array.splice(d,1),!0;while(++d<this._array.length&&this._getKey(this._array[d])===g);return!1}*getKeyIterator(p){if(this._array.length!==0&&(d=this._search(p),!(d<0||d>=this._array.length)&&this._getKey(this._array[d])===p))do yield this._array[d];while(++d<this._array.length&&this._getKey(this._array[d])===p)}forEachByKey(p,g){if(this._array.length!==0&&(d=this._search(p),!(d<0||d>=this._array.length)&&this._getKey(this._array[d])===p))do g(this._array[d]);while(++d<this._array.length&&this._getKey(this._array[d])===p)}values(){return[...this._array].values()}_search(p){let g=0,m=this._array.length-1;for(;m>=g;){let y=g+m>>1;const _=this._getKey(this._array[y]);if(_>p)m=y-1;else{if(!(_<p)){for(;y>0&&this._getKey(this._array[y-1])===p;)y--;return y}g=y+1}}return g}}},7226:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DebouncedIdleTask=l.IdleTaskQueue=l.PriorityTaskQueue=void 0;const p=d(6114);class g{constructor(){this._tasks=[],this._i=0}enqueue(_){this._tasks.push(_),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(_){this._idleCallback=void 0;let k=0,C=0,v=_.timeRemaining(),b=0;for(;this._i<this._tasks.length;){if(k=Date.now(),this._tasks[this._i]()||this._i++,k=Math.max(1,Date.now()-k),C=Math.max(k,C),b=_.timeRemaining(),1.5*C>b)return v-k<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(v-k))}ms`),void this._start();v=b}this.clear()}}class m extends g{_requestCallback(_){return setTimeout((()=>_(this._createDeadline(16))))}_cancelCallback(_){clearTimeout(_)}_createDeadline(_){const k=Date.now()+_;return{timeRemaining:()=>Math.max(0,k-Date.now())}}}l.PriorityTaskQueue=m,l.IdleTaskQueue=!p.isNode&&"requestIdleCallback"in window?class extends g{_requestCallback(y){return requestIdleCallback(y)}_cancelCallback(y){cancelIdleCallback(y)}}:m,l.DebouncedIdleTask=class{constructor(){this._queue=new l.IdleTaskQueue}set(y){this._queue.clear(),this._queue.enqueue(y)}flush(){this._queue.flush()}}},9282:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.updateWindowsModeWrappedState=void 0;const p=d(643);l.updateWindowsModeWrappedState=function(g){const m=g.buffer.lines.get(g.buffer.ybase+g.buffer.y-1),y=m==null?void 0:m.get(g.cols-1),_=g.buffer.lines.get(g.buffer.ybase+g.buffer.y);_&&y&&(_.isWrapped=y[p.CHAR_DATA_CODE_INDEX]!==p.NULL_CELL_CODE&&y[p.CHAR_DATA_CODE_INDEX]!==p.WHITESPACE_CELL_CODE)}},3734:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ExtendedAttrs=l.AttributeData=void 0;class d{constructor(){this.fg=0,this.bg=0,this.extended=new p}static toColorRGB(m){return[m>>>16&255,m>>>8&255,255&m]}static fromColorRGB(m){return(255&m[0])<<16|(255&m[1])<<8|255&m[2]}clone(){const m=new d;return m.fg=this.fg,m.bg=this.bg,m.extended=this.extended.clone(),m}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}}l.AttributeData=d;class p{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(m){this._ext=m}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(m){this._ext&=-469762049,this._ext|=m<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(m){this._ext&=-67108864,this._ext|=67108863&m}get urlId(){return this._urlId}set urlId(m){this._urlId=m}get underlineVariantOffset(){const m=(3758096384&this._ext)>>29;return m<0?4294967288^m:m}set underlineVariantOffset(m){this._ext&=536870911,this._ext|=m<<29&3758096384}constructor(m=0,y=0){this._ext=0,this._urlId=0,this._ext=m,this._urlId=y}clone(){return new p(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}l.ExtendedAttrs=p},9092:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Buffer=l.MAX_BUFFER_SIZE=void 0;const p=d(6349),g=d(7226),m=d(3734),y=d(8437),_=d(4634),k=d(511),C=d(643),v=d(4863),b=d(7116);l.MAX_BUFFER_SIZE=4294967295,l.Buffer=class{constructor(x,S,j){this._hasScrollback=x,this._optionsService=S,this._bufferService=j,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=y.DEFAULT_ATTR_DATA.clone(),this.savedCharset=b.DEFAULT_CHARSET,this.markers=[],this._nullCell=k.CellData.fromCharData([0,C.NULL_CELL_CHAR,C.NULL_CELL_WIDTH,C.NULL_CELL_CODE]),this._whitespaceCell=k.CellData.fromCharData([0,C.WHITESPACE_CELL_CHAR,C.WHITESPACE_CELL_WIDTH,C.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new g.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new p.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(x){return x?(this._nullCell.fg=x.fg,this._nullCell.bg=x.bg,this._nullCell.extended=x.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new m.ExtendedAttrs),this._nullCell}getWhitespaceCell(x){return x?(this._whitespaceCell.fg=x.fg,this._whitespaceCell.bg=x.bg,this._whitespaceCell.extended=x.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new m.ExtendedAttrs),this._whitespaceCell}getBlankLine(x,S){return new y.BufferLine(this._bufferService.cols,this.getNullCell(x),S)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const x=this.ybase+this.y-this.ydisp;return x>=0&&x<this._rows}_getCorrectBufferLength(x){if(!this._hasScrollback)return x;const S=x+this._optionsService.rawOptions.scrollback;return S>l.MAX_BUFFER_SIZE?l.MAX_BUFFER_SIZE:S}fillViewportRows(x){if(this.lines.length===0){x===void 0&&(x=y.DEFAULT_ATTR_DATA);let S=this._rows;for(;S--;)this.lines.push(this.getBlankLine(x))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new p.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(x,S){const j=this.getNullCell(y.DEFAULT_ATTR_DATA);let A=0;const N=this._getCorrectBufferLength(S);if(N>this.lines.maxLength&&(this.lines.maxLength=N),this.lines.length>0){if(this._cols<x)for(let T=0;T<this.lines.length;T++)A+=+this.lines.get(T).resize(x,j);let D=0;if(this._rows<S)for(let T=this._rows;T<S;T++)this.lines.length<S+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new y.BufferLine(x,j)):this.ybase>0&&this.lines.length<=this.ybase+this.y+D+1?(this.ybase--,D++,this.ydisp>0&&this.ydisp--):this.lines.push(new y.BufferLine(x,j)));else for(let T=this._rows;T>S;T--)this.lines.length>S+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(N<this.lines.maxLength){const T=this.lines.length-N;T>0&&(this.lines.trimStart(T),this.ybase=Math.max(this.ybase-T,0),this.ydisp=Math.max(this.ydisp-T,0),this.savedY=Math.max(this.savedY-T,0)),this.lines.maxLength=N}this.x=Math.min(this.x,x-1),this.y=Math.min(this.y,S-1),D&&(this.y+=D),this.savedX=Math.min(this.savedX,x-1),this.scrollTop=0}if(this.scrollBottom=S-1,this._isReflowEnabled&&(this._reflow(x,S),this._cols>x))for(let D=0;D<this.lines.length;D++)A+=+this.lines.get(D).resize(x,j);this._cols=x,this._rows=S,this._memoryCleanupQueue.clear(),A>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let x=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,x=!1);let S=0;for(;this._memoryCleanupPosition<this.lines.length;)if(S+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),S>100)return!0;return x}get _isReflowEnabled(){const x=this._optionsService.rawOptions.windowsPty;return x&&x.buildNumber?this._hasScrollback&&x.backend==="conpty"&&x.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(x,S){this._cols!==x&&(x>this._cols?this._reflowLarger(x,S):this._reflowSmaller(x,S))}_reflowLarger(x,S){const j=(0,_.reflowLargerGetLinesToRemove)(this.lines,this._cols,x,this.ybase+this.y,this.getNullCell(y.DEFAULT_ATTR_DATA));if(j.length>0){const A=(0,_.reflowLargerCreateNewLayout)(this.lines,j);(0,_.reflowLargerApplyNewLayout)(this.lines,A.layout),this._reflowLargerAdjustViewport(x,S,A.countRemoved)}}_reflowLargerAdjustViewport(x,S,j){const A=this.getNullCell(y.DEFAULT_ATTR_DATA);let N=j;for(;N-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<S&&this.lines.push(new y.BufferLine(x,A))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-j,0)}_reflowSmaller(x,S){const j=this.getNullCell(y.DEFAULT_ATTR_DATA),A=[];let N=0;for(let D=this.lines.length-1;D>=0;D--){let T=this.lines.get(D);if(!T||!T.isWrapped&&T.getTrimmedLength()<=x)continue;const I=[T];for(;T.isWrapped&&D>0;)T=this.lines.get(--D),I.unshift(T);const H=this.ybase+this.y;if(H>=D&&H<D+I.length)continue;const V=I[I.length-1].getTrimmedLength(),Y=(0,_.reflowSmallerGetNewLineLengths)(I,this._cols,x),q=Y.length-I.length;let O;O=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+q):Math.max(0,this.lines.length-this.lines.maxLength+q);const U=[];for(let B=0;B<q;B++){const W=this.getBlankLine(y.DEFAULT_ATTR_DATA,!0);U.push(W)}U.length>0&&(A.push({start:D+I.length+N,newLines:U}),N+=U.length),I.push(...U);let z=Y.length-1,X=Y[z];X===0&&(z--,X=Y[z]);let Q=I.length-q-1,M=V;for(;Q>=0;){const B=Math.min(M,X);if(I[z]===void 0)break;if(I[z].copyCellsFrom(I[Q],M-B,X-B,B,!0),X-=B,X===0&&(z--,X=Y[z]),M-=B,M===0){Q--;const W=Math.max(Q,0);M=(0,_.getWrappedLineTrimmedLength)(I,W,this._cols)}}for(let B=0;B<I.length;B++)Y[B]<x&&I[B].setCell(Y[B],j);let L=q-O;for(;L-- >0;)this.ybase===0?this.y<S-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+N)-S&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+q,this.ybase+S-1)}if(A.length>0){const D=[],T=[];for(let z=0;z<this.lines.length;z++)T.push(this.lines.get(z));const I=this.lines.length;let H=I-1,V=0,Y=A[V];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+N);let q=0;for(let z=Math.min(this.lines.maxLength-1,I+N-1);z>=0;z--)if(Y&&Y.start>H+q){for(let X=Y.newLines.length-1;X>=0;X--)this.lines.set(z--,Y.newLines[X]);z++,D.push({index:H+1,amount:Y.newLines.length}),q+=Y.newLines.length,Y=A[++V]}else this.lines.set(z,T[H--]);let O=0;for(let z=D.length-1;z>=0;z--)D[z].index+=O,this.lines.onInsertEmitter.fire(D[z]),O+=D[z].amount;const U=Math.max(0,I+N-this.lines.maxLength);U>0&&this.lines.onTrimEmitter.fire(U)}}translateBufferLineToString(x,S,j=0,A){const N=this.lines.get(x);return N?N.translateToString(S,j,A):""}getWrappedRangeForLine(x){let S=x,j=x;for(;S>0&&this.lines.get(S).isWrapped;)S--;for(;j+1<this.lines.length&&this.lines.get(j+1).isWrapped;)j++;return{first:S,last:j}}setupTabStops(x){for(x!=null?this.tabs[x]||(x=this.prevStop(x)):(this.tabs={},x=0);x<this._cols;x+=this._optionsService.rawOptions.tabStopWidth)this.tabs[x]=!0}prevStop(x){for(x==null&&(x=this.x);!this.tabs[--x]&&x>0;);return x>=this._cols?this._cols-1:x<0?0:x}nextStop(x){for(x==null&&(x=this.x);!this.tabs[++x]&&x<this._cols;);return x>=this._cols?this._cols-1:x<0?0:x}clearMarkers(x){this._isClearing=!0;for(let S=0;S<this.markers.length;S++)this.markers[S].line===x&&(this.markers[S].dispose(),this.markers.splice(S--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let x=0;x<this.markers.length;x++)this.markers[x].dispose(),this.markers.splice(x--,1);this._isClearing=!1}addMarker(x){const S=new v.Marker(x);return this.markers.push(S),S.register(this.lines.onTrim((j=>{S.line-=j,S.line<0&&S.dispose()}))),S.register(this.lines.onInsert((j=>{S.line>=j.index&&(S.line+=j.amount)}))),S.register(this.lines.onDelete((j=>{S.line>=j.index&&S.line<j.index+j.amount&&S.dispose(),S.line>j.index&&(S.line-=j.amount)}))),S.register(S.onDispose((()=>this._removeMarker(S)))),S}_removeMarker(x){this._isClearing||this.markers.splice(this.markers.indexOf(x),1)}}},8437:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferLine=l.DEFAULT_ATTR_DATA=void 0;const p=d(3734),g=d(511),m=d(643),y=d(482);l.DEFAULT_ATTR_DATA=Object.freeze(new p.AttributeData);let _=0;class k{constructor(v,b,x=!1){this.isWrapped=x,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*v);const S=b||g.CellData.fromCharData([0,m.NULL_CELL_CHAR,m.NULL_CELL_WIDTH,m.NULL_CELL_CODE]);for(let j=0;j<v;++j)this.setCell(j,S);this.length=v}get(v){const b=this._data[3*v+0],x=2097151&b;return[this._data[3*v+1],2097152&b?this._combined[v]:x?(0,y.stringFromCodePoint)(x):"",b>>22,2097152&b?this._combined[v].charCodeAt(this._combined[v].length-1):x]}set(v,b){this._data[3*v+1]=b[m.CHAR_DATA_ATTR_INDEX],b[m.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[v]=b[1],this._data[3*v+0]=2097152|v|b[m.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*v+0]=b[m.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|b[m.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 b=this._data[3*v+0];return 2097152&b?this._combined[v].charCodeAt(this._combined[v].length-1):2097151&b}isCombined(v){return 2097152&this._data[3*v+0]}getString(v){const b=this._data[3*v+0];return 2097152&b?this._combined[v]:2097151&b?(0,y.stringFromCodePoint)(2097151&b):""}isProtected(v){return 536870912&this._data[3*v+2]}loadCell(v,b){return _=3*v,b.content=this._data[_+0],b.fg=this._data[_+1],b.bg=this._data[_+2],2097152&b.content&&(b.combinedData=this._combined[v]),268435456&b.bg&&(b.extended=this._extendedAttrs[v]),b}setCell(v,b){2097152&b.content&&(this._combined[v]=b.combinedData),268435456&b.bg&&(this._extendedAttrs[v]=b.extended),this._data[3*v+0]=b.content,this._data[3*v+1]=b.fg,this._data[3*v+2]=b.bg}setCellFromCodepoint(v,b,x,S){268435456&S.bg&&(this._extendedAttrs[v]=S.extended),this._data[3*v+0]=b|x<<22,this._data[3*v+1]=S.fg,this._data[3*v+2]=S.bg}addCodepointToCell(v,b,x){let S=this._data[3*v+0];2097152&S?this._combined[v]+=(0,y.stringFromCodePoint)(b):2097151&S?(this._combined[v]=(0,y.stringFromCodePoint)(2097151&S)+(0,y.stringFromCodePoint)(b),S&=-2097152,S|=2097152):S=b|4194304,x&&(S&=-12582913,S|=x<<22),this._data[3*v+0]=S}insertCells(v,b,x){if((v%=this.length)&&this.getWidth(v-1)===2&&this.setCellFromCodepoint(v-1,0,1,x),b<this.length-v){const S=new g.CellData;for(let j=this.length-v-b-1;j>=0;--j)this.setCell(v+b+j,this.loadCell(v+j,S));for(let j=0;j<b;++j)this.setCell(v+j,x)}else for(let S=v;S<this.length;++S)this.setCell(S,x);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,x)}deleteCells(v,b,x){if(v%=this.length,b<this.length-v){const S=new g.CellData;for(let j=0;j<this.length-v-b;++j)this.setCell(v+j,this.loadCell(v+b+j,S));for(let j=this.length-b;j<this.length;++j)this.setCell(j,x)}else for(let S=v;S<this.length;++S)this.setCell(S,x);v&&this.getWidth(v-1)===2&&this.setCellFromCodepoint(v-1,0,1,x),this.getWidth(v)!==0||this.hasContent(v)||this.setCellFromCodepoint(v,0,1,x)}replaceCells(v,b,x,S=!1){if(S)for(v&&this.getWidth(v-1)===2&&!this.isProtected(v-1)&&this.setCellFromCodepoint(v-1,0,1,x),b<this.length&&this.getWidth(b-1)===2&&!this.isProtected(b)&&this.setCellFromCodepoint(b,0,1,x);v<b&&v<this.length;)this.isProtected(v)||this.setCell(v,x),v++;else for(v&&this.getWidth(v-1)===2&&this.setCellFromCodepoint(v-1,0,1,x),b<this.length&&this.getWidth(b-1)===2&&this.setCellFromCodepoint(b,0,1,x);v<b&&v<this.length;)this.setCell(v++,x)}resize(v,b){if(v===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const x=3*v;if(v>this.length){if(this._data.buffer.byteLength>=4*x)this._data=new Uint32Array(this._data.buffer,0,x);else{const S=new Uint32Array(x);S.set(this._data),this._data=S}for(let S=this.length;S<v;++S)this.setCell(S,b)}else{this._data=this._data.subarray(0,x);const S=Object.keys(this._combined);for(let A=0;A<S.length;A++){const N=parseInt(S[A],10);N>=v&&delete this._combined[N]}const j=Object.keys(this._extendedAttrs);for(let A=0;A<j.length;A++){const N=parseInt(j[A],10);N>=v&&delete this._extendedAttrs[N]}}return this.length=v,4*x*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,b=!1){if(b)for(let x=0;x<this.length;++x)this.isProtected(x)||this.setCell(x,v);else{this._combined={},this._extendedAttrs={};for(let x=0;x<this.length;++x)this.setCell(x,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 b in v._combined)this._combined[b]=v._combined[b];this._extendedAttrs={};for(const b in v._extendedAttrs)this._extendedAttrs[b]=v._extendedAttrs[b];this.isWrapped=v.isWrapped}clone(){const v=new k(0);v._data=new Uint32Array(this._data),v.length=this.length;for(const b in this._combined)v._combined[b]=this._combined[b];for(const b in this._extendedAttrs)v._extendedAttrs[b]=this._extendedAttrs[b];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,b,x,S,j){const A=v._data;if(j)for(let D=S-1;D>=0;D--){for(let T=0;T<3;T++)this._data[3*(x+D)+T]=A[3*(b+D)+T];268435456&A[3*(b+D)+2]&&(this._extendedAttrs[x+D]=v._extendedAttrs[b+D])}else for(let D=0;D<S;D++){for(let T=0;T<3;T++)this._data[3*(x+D)+T]=A[3*(b+D)+T];268435456&A[3*(b+D)+2]&&(this._extendedAttrs[x+D]=v._extendedAttrs[b+D])}const N=Object.keys(v._combined);for(let D=0;D<N.length;D++){const T=parseInt(N[D],10);T>=b&&(this._combined[T-b+x]=v._combined[T])}}translateToString(v,b,x,S){b=b??0,x=x??this.length,v&&(x=Math.min(x,this.getTrimmedLength())),S&&(S.length=0);let j="";for(;b<x;){const A=this._data[3*b+0],N=2097151&A,D=2097152&A?this._combined[b]:N?(0,y.stringFromCodePoint)(N):m.WHITESPACE_CELL_CHAR;if(j+=D,S)for(let T=0;T<D.length;++T)S.push(b);b+=A>>22||1}return S&&S.push(b),j}}l.BufferLine=k},4841:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.getRangeLength=void 0,l.getRangeLength=function(d,p){if(d.start.y>d.end.y)throw new Error(`Buffer range end (${d.end.x}, ${d.end.y}) cannot be before start (${d.start.x}, ${d.start.y})`);return p*(d.end.y-d.start.y)+(d.end.x-d.start.x+1)}},4634:(f,l)=>{function d(p,g,m){if(g===p.length-1)return p[g].getTrimmedLength();const y=!p[g].hasContent(m-1)&&p[g].getWidth(m-1)===1,_=p[g+1].getWidth(0)===2;return y&&_?m-1:m}Object.defineProperty(l,"__esModule",{value:!0}),l.getWrappedLineTrimmedLength=l.reflowSmallerGetNewLineLengths=l.reflowLargerApplyNewLayout=l.reflowLargerCreateNewLayout=l.reflowLargerGetLinesToRemove=void 0,l.reflowLargerGetLinesToRemove=function(p,g,m,y,_){const k=[];for(let C=0;C<p.length-1;C++){let v=C,b=p.get(++v);if(!b.isWrapped)continue;const x=[p.get(C)];for(;v<p.length&&b.isWrapped;)x.push(b),b=p.get(++v);if(y>=C&&y<v){C+=x.length-1;continue}let S=0,j=d(x,S,g),A=1,N=0;for(;A<x.length;){const T=d(x,A,g),I=T-N,H=m-j,V=Math.min(I,H);x[S].copyCellsFrom(x[A],N,j,V,!1),j+=V,j===m&&(S++,j=0),N+=V,N===T&&(A++,N=0),j===0&&S!==0&&x[S-1].getWidth(m-1)===2&&(x[S].copyCellsFrom(x[S-1],m-1,j++,1,!1),x[S-1].setCell(m-1,_))}x[S].replaceCells(j,m,_);let D=0;for(let T=x.length-1;T>0&&(T>S||x[T].getTrimmedLength()===0);T--)D++;D>0&&(k.push(C+x.length-D),k.push(D)),C+=x.length-1}return k},l.reflowLargerCreateNewLayout=function(p,g){const m=[];let y=0,_=g[y],k=0;for(let C=0;C<p.length;C++)if(_===C){const v=g[++y];p.onDeleteEmitter.fire({index:C-k,amount:v}),C+=v-1,k+=v,_=g[++y]}else m.push(C);return{layout:m,countRemoved:k}},l.reflowLargerApplyNewLayout=function(p,g){const m=[];for(let y=0;y<g.length;y++)m.push(p.get(g[y]));for(let y=0;y<m.length;y++)p.set(y,m[y]);p.length=g.length},l.reflowSmallerGetNewLineLengths=function(p,g,m){const y=[],_=p.map(((b,x)=>d(p,x,g))).reduce(((b,x)=>b+x));let k=0,C=0,v=0;for(;v<_;){if(_-v<m){y.push(_-v);break}k+=m;const b=d(p,C,g);k>b&&(k-=b,C++);const x=p[C].getWidth(k-1)===2;x&&k--;const S=x?m-1:m;y.push(S),v+=S}return y},l.getWrappedLineTrimmedLength=d},5295:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferSet=void 0;const p=d(8460),g=d(844),m=d(9092);class y extends g.Disposable{constructor(k,C){super(),this._optionsService=k,this._bufferService=C,this._onBufferActivate=this.register(new p.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 m.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new m.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(k){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(k),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(k,C){this._normal.resize(k,C),this._alt.resize(k,C),this.setupTabStops(k)}setupTabStops(k){this._normal.setupTabStops(k),this._alt.setupTabStops(k)}}l.BufferSet=y},511:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CellData=void 0;const p=d(482),g=d(643),m=d(3734);class y extends m.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new m.ExtendedAttrs,this.combinedData=""}static fromCharData(k){const C=new y;return C.setFromCharData(k),C}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,p.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(k){this.fg=k[g.CHAR_DATA_ATTR_INDEX],this.bg=0;let C=!1;if(k[g.CHAR_DATA_CHAR_INDEX].length>2)C=!0;else if(k[g.CHAR_DATA_CHAR_INDEX].length===2){const v=k[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=v&&v<=56319){const b=k[g.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=b&&b<=57343?this.content=1024*(v-55296)+b-56320+65536|k[g.CHAR_DATA_WIDTH_INDEX]<<22:C=!0}else C=!0}else this.content=k[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|k[g.CHAR_DATA_WIDTH_INDEX]<<22;C&&(this.combinedData=k[g.CHAR_DATA_CHAR_INDEX],this.content=2097152|k[g.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}l.CellData=y},643:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.WHITESPACE_CELL_CODE=l.WHITESPACE_CELL_WIDTH=l.WHITESPACE_CELL_CHAR=l.NULL_CELL_CODE=l.NULL_CELL_WIDTH=l.NULL_CELL_CHAR=l.CHAR_DATA_CODE_INDEX=l.CHAR_DATA_WIDTH_INDEX=l.CHAR_DATA_CHAR_INDEX=l.CHAR_DATA_ATTR_INDEX=l.DEFAULT_EXT=l.DEFAULT_ATTR=l.DEFAULT_COLOR=void 0,l.DEFAULT_COLOR=0,l.DEFAULT_ATTR=256|l.DEFAULT_COLOR<<9,l.DEFAULT_EXT=0,l.CHAR_DATA_ATTR_INDEX=0,l.CHAR_DATA_CHAR_INDEX=1,l.CHAR_DATA_WIDTH_INDEX=2,l.CHAR_DATA_CODE_INDEX=3,l.NULL_CELL_CHAR="",l.NULL_CELL_WIDTH=1,l.NULL_CELL_CODE=0,l.WHITESPACE_CELL_CHAR=" ",l.WHITESPACE_CELL_WIDTH=1,l.WHITESPACE_CELL_CODE=32},4863:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Marker=void 0;const p=d(8460),g=d(844);class m{get id(){return this._id}constructor(_){this.line=_,this.isDisposed=!1,this._disposables=[],this._id=m._nextId++,this._onDispose=this.register(new p.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,g.disposeArray)(this._disposables),this._disposables.length=0)}register(_){return this._disposables.push(_),_}}l.Marker=m,m._nextId=1},7116:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DEFAULT_CHARSET=l.CHARSETS=void 0,l.CHARSETS={},l.DEFAULT_CHARSET=l.CHARSETS.B,l.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:"≥","{":"π","|":"≠","}":"£","~":"·"},l.CHARSETS.A={"#":"£"},l.CHARSETS.B=void 0,l.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},l.CHARSETS.C=l.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},l.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},l.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},l.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},l.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},l.CHARSETS.E=l.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},l.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},l.CHARSETS.H=l.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},l.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(f,l)=>{var d,p,g;Object.defineProperty(l,"__esModule",{value:!0}),l.C1_ESCAPED=l.C1=l.C0=void 0,(function(m){m.NUL="\0",m.SOH="",m.STX="",m.ETX="",m.EOT="",m.ENQ="",m.ACK="",m.BEL="\x07",m.BS="\b",m.HT=" ",m.LF=`
|
|
64
|
+
`,m.VT="\v",m.FF="\f",m.CR="\r",m.SO="",m.SI="",m.DLE="",m.DC1="",m.DC2="",m.DC3="",m.DC4="",m.NAK="",m.SYN="",m.ETB="",m.CAN="",m.EM="",m.SUB="",m.ESC="\x1B",m.FS="",m.GS="",m.RS="",m.US="",m.SP=" ",m.DEL=""})(d||(l.C0=d={})),(function(m){m.PAD="",m.HOP="",m.BPH="",m.NBH="",m.IND="",m.NEL="
",m.SSA="",m.ESA="",m.HTS="",m.HTJ="",m.VTS="",m.PLD="",m.PLU="",m.RI="",m.SS2="",m.SS3="",m.DCS="",m.PU1="",m.PU2="",m.STS="",m.CCH="",m.MW="",m.SPA="",m.EPA="",m.SOS="",m.SGCI="",m.SCI="",m.CSI="",m.ST="",m.OSC="",m.PM="",m.APC=""})(p||(l.C1=p={})),(function(m){m.ST=`${d.ESC}\\`})(g||(l.C1_ESCAPED=g={}))},7399:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.evaluateKeyboardEvent=void 0;const p=d(2584),g={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:["'",'"']};l.evaluateKeyboardEvent=function(m,y,_,k){const C={type:0,cancel:!1,key:void 0},v=(m.shiftKey?1:0)|(m.altKey?2:0)|(m.ctrlKey?4:0)|(m.metaKey?8:0);switch(m.keyCode){case 0:m.key==="UIKeyInputUpArrow"?C.key=y?p.C0.ESC+"OA":p.C0.ESC+"[A":m.key==="UIKeyInputLeftArrow"?C.key=y?p.C0.ESC+"OD":p.C0.ESC+"[D":m.key==="UIKeyInputRightArrow"?C.key=y?p.C0.ESC+"OC":p.C0.ESC+"[C":m.key==="UIKeyInputDownArrow"&&(C.key=y?p.C0.ESC+"OB":p.C0.ESC+"[B");break;case 8:C.key=m.ctrlKey?"\b":p.C0.DEL,m.altKey&&(C.key=p.C0.ESC+C.key);break;case 9:if(m.shiftKey){C.key=p.C0.ESC+"[Z";break}C.key=p.C0.HT,C.cancel=!0;break;case 13:C.key=m.altKey?p.C0.ESC+p.C0.CR:p.C0.CR,C.cancel=!0;break;case 27:C.key=p.C0.ESC,m.altKey&&(C.key=p.C0.ESC+p.C0.ESC),C.cancel=!0;break;case 37:if(m.metaKey)break;v?(C.key=p.C0.ESC+"[1;"+(v+1)+"D",C.key===p.C0.ESC+"[1;3D"&&(C.key=p.C0.ESC+(_?"b":"[1;5D"))):C.key=y?p.C0.ESC+"OD":p.C0.ESC+"[D";break;case 39:if(m.metaKey)break;v?(C.key=p.C0.ESC+"[1;"+(v+1)+"C",C.key===p.C0.ESC+"[1;3C"&&(C.key=p.C0.ESC+(_?"f":"[1;5C"))):C.key=y?p.C0.ESC+"OC":p.C0.ESC+"[C";break;case 38:if(m.metaKey)break;v?(C.key=p.C0.ESC+"[1;"+(v+1)+"A",_||C.key!==p.C0.ESC+"[1;3A"||(C.key=p.C0.ESC+"[1;5A")):C.key=y?p.C0.ESC+"OA":p.C0.ESC+"[A";break;case 40:if(m.metaKey)break;v?(C.key=p.C0.ESC+"[1;"+(v+1)+"B",_||C.key!==p.C0.ESC+"[1;3B"||(C.key=p.C0.ESC+"[1;5B")):C.key=y?p.C0.ESC+"OB":p.C0.ESC+"[B";break;case 45:m.shiftKey||m.ctrlKey||(C.key=p.C0.ESC+"[2~");break;case 46:C.key=v?p.C0.ESC+"[3;"+(v+1)+"~":p.C0.ESC+"[3~";break;case 36:C.key=v?p.C0.ESC+"[1;"+(v+1)+"H":y?p.C0.ESC+"OH":p.C0.ESC+"[H";break;case 35:C.key=v?p.C0.ESC+"[1;"+(v+1)+"F":y?p.C0.ESC+"OF":p.C0.ESC+"[F";break;case 33:m.shiftKey?C.type=2:m.ctrlKey?C.key=p.C0.ESC+"[5;"+(v+1)+"~":C.key=p.C0.ESC+"[5~";break;case 34:m.shiftKey?C.type=3:m.ctrlKey?C.key=p.C0.ESC+"[6;"+(v+1)+"~":C.key=p.C0.ESC+"[6~";break;case 112:C.key=v?p.C0.ESC+"[1;"+(v+1)+"P":p.C0.ESC+"OP";break;case 113:C.key=v?p.C0.ESC+"[1;"+(v+1)+"Q":p.C0.ESC+"OQ";break;case 114:C.key=v?p.C0.ESC+"[1;"+(v+1)+"R":p.C0.ESC+"OR";break;case 115:C.key=v?p.C0.ESC+"[1;"+(v+1)+"S":p.C0.ESC+"OS";break;case 116:C.key=v?p.C0.ESC+"[15;"+(v+1)+"~":p.C0.ESC+"[15~";break;case 117:C.key=v?p.C0.ESC+"[17;"+(v+1)+"~":p.C0.ESC+"[17~";break;case 118:C.key=v?p.C0.ESC+"[18;"+(v+1)+"~":p.C0.ESC+"[18~";break;case 119:C.key=v?p.C0.ESC+"[19;"+(v+1)+"~":p.C0.ESC+"[19~";break;case 120:C.key=v?p.C0.ESC+"[20;"+(v+1)+"~":p.C0.ESC+"[20~";break;case 121:C.key=v?p.C0.ESC+"[21;"+(v+1)+"~":p.C0.ESC+"[21~";break;case 122:C.key=v?p.C0.ESC+"[23;"+(v+1)+"~":p.C0.ESC+"[23~";break;case 123:C.key=v?p.C0.ESC+"[24;"+(v+1)+"~":p.C0.ESC+"[24~";break;default:if(!m.ctrlKey||m.shiftKey||m.altKey||m.metaKey)if(_&&!k||!m.altKey||m.metaKey)!_||m.altKey||m.ctrlKey||m.shiftKey||!m.metaKey?m.key&&!m.ctrlKey&&!m.altKey&&!m.metaKey&&m.keyCode>=48&&m.key.length===1?C.key=m.key:m.key&&m.ctrlKey&&(m.key==="_"&&(C.key=p.C0.US),m.key==="@"&&(C.key=p.C0.NUL)):m.keyCode===65&&(C.type=1);else{const b=g[m.keyCode],x=b==null?void 0:b[m.shiftKey?1:0];if(x)C.key=p.C0.ESC+x;else if(m.keyCode>=65&&m.keyCode<=90){const S=m.ctrlKey?m.keyCode-64:m.keyCode+32;let j=String.fromCharCode(S);m.shiftKey&&(j=j.toUpperCase()),C.key=p.C0.ESC+j}else if(m.keyCode===32)C.key=p.C0.ESC+(m.ctrlKey?p.C0.NUL:" ");else if(m.key==="Dead"&&m.code.startsWith("Key")){let S=m.code.slice(3,4);m.shiftKey||(S=S.toLowerCase()),C.key=p.C0.ESC+S,C.cancel=!0}}else m.keyCode>=65&&m.keyCode<=90?C.key=String.fromCharCode(m.keyCode-64):m.keyCode===32?C.key=p.C0.NUL:m.keyCode>=51&&m.keyCode<=55?C.key=String.fromCharCode(m.keyCode-51+27):m.keyCode===56?C.key=p.C0.DEL:m.keyCode===219?C.key=p.C0.ESC:m.keyCode===220?C.key=p.C0.FS:m.keyCode===221&&(C.key=p.C0.GS)}return C}},482:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Utf8ToUtf32=l.StringToUtf32=l.utf32ToString=l.stringFromCodePoint=void 0,l.stringFromCodePoint=function(d){return d>65535?(d-=65536,String.fromCharCode(55296+(d>>10))+String.fromCharCode(d%1024+56320)):String.fromCharCode(d)},l.utf32ToString=function(d,p=0,g=d.length){let m="";for(let y=p;y<g;++y){let _=d[y];_>65535?(_-=65536,m+=String.fromCharCode(55296+(_>>10))+String.fromCharCode(_%1024+56320)):m+=String.fromCharCode(_)}return m},l.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(d,p){const g=d.length;if(!g)return 0;let m=0,y=0;if(this._interim){const _=d.charCodeAt(y++);56320<=_&&_<=57343?p[m++]=1024*(this._interim-55296)+_-56320+65536:(p[m++]=this._interim,p[m++]=_),this._interim=0}for(let _=y;_<g;++_){const k=d.charCodeAt(_);if(55296<=k&&k<=56319){if(++_>=g)return this._interim=k,m;const C=d.charCodeAt(_);56320<=C&&C<=57343?p[m++]=1024*(k-55296)+C-56320+65536:(p[m++]=k,p[m++]=C)}else k!==65279&&(p[m++]=k)}return m}},l.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(d,p){const g=d.length;if(!g)return 0;let m,y,_,k,C=0,v=0,b=0;if(this.interim[0]){let j=!1,A=this.interim[0];A&=(224&A)==192?31:(240&A)==224?15:7;let N,D=0;for(;(N=63&this.interim[++D])&&D<4;)A<<=6,A|=N;const T=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,I=T-D;for(;b<I;){if(b>=g)return 0;if(N=d[b++],(192&N)!=128){b--,j=!0;break}this.interim[D++]=N,A<<=6,A|=63&N}j||(T===2?A<128?b--:p[C++]=A:T===3?A<2048||A>=55296&&A<=57343||A===65279||(p[C++]=A):A<65536||A>1114111||(p[C++]=A)),this.interim.fill(0)}const x=g-4;let S=b;for(;S<g;){for(;!(!(S<x)||128&(m=d[S])||128&(y=d[S+1])||128&(_=d[S+2])||128&(k=d[S+3]));)p[C++]=m,p[C++]=y,p[C++]=_,p[C++]=k,S+=4;if(m=d[S++],m<128)p[C++]=m;else if((224&m)==192){if(S>=g)return this.interim[0]=m,C;if(y=d[S++],(192&y)!=128){S--;continue}if(v=(31&m)<<6|63&y,v<128){S--;continue}p[C++]=v}else if((240&m)==224){if(S>=g)return this.interim[0]=m,C;if(y=d[S++],(192&y)!=128){S--;continue}if(S>=g)return this.interim[0]=m,this.interim[1]=y,C;if(_=d[S++],(192&_)!=128){S--;continue}if(v=(15&m)<<12|(63&y)<<6|63&_,v<2048||v>=55296&&v<=57343||v===65279)continue;p[C++]=v}else if((248&m)==240){if(S>=g)return this.interim[0]=m,C;if(y=d[S++],(192&y)!=128){S--;continue}if(S>=g)return this.interim[0]=m,this.interim[1]=y,C;if(_=d[S++],(192&_)!=128){S--;continue}if(S>=g)return this.interim[0]=m,this.interim[1]=y,this.interim[2]=_,C;if(k=d[S++],(192&k)!=128){S--;continue}if(v=(7&m)<<18|(63&y)<<12|(63&_)<<6|63&k,v<65536||v>1114111)continue;p[C++]=v}}return C}}},225:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeV6=void 0;const p=d(1480),g=[[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]],m=[[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 y;l.UnicodeV6=class{constructor(){if(this.version="6",!y){y=new Uint8Array(65536),y.fill(1),y[0]=0,y.fill(0,1,32),y.fill(0,127,160),y.fill(2,4352,4448),y[9001]=2,y[9002]=2,y.fill(2,11904,42192),y[12351]=1,y.fill(2,44032,55204),y.fill(2,63744,64256),y.fill(2,65040,65050),y.fill(2,65072,65136),y.fill(2,65280,65377),y.fill(2,65504,65511);for(let _=0;_<g.length;++_)y.fill(0,g[_][0],g[_][1]+1)}}wcwidth(_){return _<32?0:_<127?1:_<65536?y[_]:(function(k,C){let v,b=0,x=C.length-1;if(k<C[0][0]||k>C[x][1])return!1;for(;x>=b;)if(v=b+x>>1,k>C[v][1])b=v+1;else{if(!(k<C[v][0]))return!0;x=v-1}return!1})(_,m)?0:_>=131072&&_<=196605||_>=196608&&_<=262141?2:1}charProperties(_,k){let C=this.wcwidth(_),v=C===0&&k!==0;if(v){const b=p.UnicodeService.extractWidth(k);b===0?v=!1:b>C&&(C=b)}return p.UnicodeService.createPropertyValue(0,C,v)}}},5981:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.WriteBuffer=void 0;const p=d(8460),g=d(844);class m extends g.Disposable{constructor(_){super(),this._action=_,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new p.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(_,k){if(k!==void 0&&this._syncCalls>k)return void(this._syncCalls=0);if(this._pendingData+=_.length,this._writeBuffer.push(_),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let C;for(this._isSyncWriting=!0;C=this._writeBuffer.shift();){this._action(C);const v=this._callbacks.shift();v&&v()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(_,k){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+=_.length,this._writeBuffer.push(_),this._callbacks.push(k),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=_.length,this._writeBuffer.push(_),this._callbacks.push(k)}_innerWrite(_=0,k=!0){const C=_||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const v=this._writeBuffer[this._bufferOffset],b=this._action(v,k);if(b){const S=j=>Date.now()-C>=12?setTimeout((()=>this._innerWrite(0,j))):this._innerWrite(C,j);return void b.catch((j=>(queueMicrotask((()=>{throw j})),Promise.resolve(!1)))).then(S)}const x=this._callbacks[this._bufferOffset];if(x&&x(),this._bufferOffset++,this._pendingData-=v.length,Date.now()-C>=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()}}l.WriteBuffer=m},5941:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.toRgbString=l.parseColor=void 0;const d=/^([\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})$/,p=/^[\da-f]+$/;function g(m,y){const _=m.toString(16),k=_.length<2?"0"+_:_;switch(y){case 4:return _[0];case 8:return k;case 12:return(k+k).slice(0,3);default:return k+k}}l.parseColor=function(m){if(!m)return;let y=m.toLowerCase();if(y.indexOf("rgb:")===0){y=y.slice(4);const _=d.exec(y);if(_){const k=_[1]?15:_[4]?255:_[7]?4095:65535;return[Math.round(parseInt(_[1]||_[4]||_[7]||_[10],16)/k*255),Math.round(parseInt(_[2]||_[5]||_[8]||_[11],16)/k*255),Math.round(parseInt(_[3]||_[6]||_[9]||_[12],16)/k*255)]}}else if(y.indexOf("#")===0&&(y=y.slice(1),p.exec(y)&&[3,6,9,12].includes(y.length))){const _=y.length/3,k=[0,0,0];for(let C=0;C<3;++C){const v=parseInt(y.slice(_*C,_*C+_),16);k[C]=_===1?v<<4:_===2?v:_===3?v>>4:v>>8}return k}},l.toRgbString=function(m,y=16){const[_,k,C]=m;return`rgb:${g(_,y)}/${g(k,y)}/${g(C,y)}`}},5770:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.PAYLOAD_LIMIT=void 0,l.PAYLOAD_LIMIT=1e7},6351:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DcsHandler=l.DcsParser=void 0;const p=d(482),g=d(8742),m=d(5770),y=[];l.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=y,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=y}registerHandler(k,C){this._handlers[k]===void 0&&(this._handlers[k]=[]);const v=this._handlers[k];return v.push(C),{dispose:()=>{const b=v.indexOf(C);b!==-1&&v.splice(b,1)}}}clearHandler(k){this._handlers[k]&&delete this._handlers[k]}setHandlerFallback(k){this._handlerFb=k}reset(){if(this._active.length)for(let k=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;k>=0;--k)this._active[k].unhook(!1);this._stack.paused=!1,this._active=y,this._ident=0}hook(k,C){if(this.reset(),this._ident=k,this._active=this._handlers[k]||y,this._active.length)for(let v=this._active.length-1;v>=0;v--)this._active[v].hook(C);else this._handlerFb(this._ident,"HOOK",C)}put(k,C,v){if(this._active.length)for(let b=this._active.length-1;b>=0;b--)this._active[b].put(k,C,v);else this._handlerFb(this._ident,"PUT",(0,p.utf32ToString)(k,C,v))}unhook(k,C=!0){if(this._active.length){let v=!1,b=this._active.length-1,x=!1;if(this._stack.paused&&(b=this._stack.loopPosition-1,v=C,x=this._stack.fallThrough,this._stack.paused=!1),!x&&v===!1){for(;b>=0&&(v=this._active[b].unhook(k),v!==!0);b--)if(v instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=b,this._stack.fallThrough=!1,v;b--}for(;b>=0;b--)if(v=this._active[b].unhook(!1),v instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=b,this._stack.fallThrough=!0,v}else this._handlerFb(this._ident,"UNHOOK",k);this._active=y,this._ident=0}};const _=new g.Params;_.addParam(0),l.DcsHandler=class{constructor(k){this._handler=k,this._data="",this._params=_,this._hitLimit=!1}hook(k){this._params=k.length>1||k.params[0]?k.clone():_,this._data="",this._hitLimit=!1}put(k,C,v){this._hitLimit||(this._data+=(0,p.utf32ToString)(k,C,v),this._data.length>m.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(k){let C=!1;if(this._hitLimit)C=!1;else if(k&&(C=this._handler(this._data,this._params),C instanceof Promise))return C.then((v=>(this._params=_,this._data="",this._hitLimit=!1,v)));return this._params=_,this._data="",this._hitLimit=!1,C}}},2015:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.EscapeSequenceParser=l.VT500_TRANSITION_TABLE=l.TransitionTable=void 0;const p=d(844),g=d(8742),m=d(6242),y=d(6351);class _{constructor(b){this.table=new Uint8Array(b)}setDefault(b,x){this.table.fill(b<<4|x)}add(b,x,S,j){this.table[x<<8|b]=S<<4|j}addMany(b,x,S,j){for(let A=0;A<b.length;A++)this.table[x<<8|b[A]]=S<<4|j}}l.TransitionTable=_;const k=160;l.VT500_TRANSITION_TABLE=(function(){const v=new _(4095),b=Array.apply(null,Array(256)).map(((D,T)=>T)),x=(D,T)=>b.slice(D,T),S=x(32,127),j=x(0,24);j.push(25),j.push.apply(j,x(28,32));const A=x(0,14);let N;for(N in v.setDefault(1,0),v.addMany(S,0,2,0),A)v.addMany([24,26,153,154],N,3,0),v.addMany(x(128,144),N,3,0),v.addMany(x(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(j,0,3,0),v.addMany(j,1,3,1),v.add(127,1,0,1),v.addMany(j,8,0,8),v.addMany(j,3,3,3),v.add(127,3,0,3),v.addMany(j,4,3,4),v.add(127,4,0,4),v.addMany(j,6,3,6),v.addMany(j,5,3,5),v.add(127,5,0,5),v.addMany(j,2,3,2),v.add(127,2,0,2),v.add(93,1,4,8),v.addMany(S,8,5,8),v.add(127,8,5,8),v.addMany([156,27,24,26,7],8,6,0),v.addMany(x(28,32),8,0,8),v.addMany([88,94,95],1,0,7),v.addMany(S,7,0,7),v.addMany(j,7,0,7),v.add(156,7,0,0),v.add(127,7,0,7),v.add(91,1,11,3),v.addMany(x(64,127),3,7,0),v.addMany(x(48,60),3,8,4),v.addMany([60,61,62,63],3,9,4),v.addMany(x(48,60),4,8,4),v.addMany(x(64,127),4,7,0),v.addMany([60,61,62,63],4,0,6),v.addMany(x(32,64),6,0,6),v.add(127,6,0,6),v.addMany(x(64,127),6,0,0),v.addMany(x(32,48),3,9,5),v.addMany(x(32,48),5,9,5),v.addMany(x(48,64),5,0,6),v.addMany(x(64,127),5,7,0),v.addMany(x(32,48),4,9,5),v.addMany(x(32,48),1,9,2),v.addMany(x(32,48),2,9,2),v.addMany(x(48,127),2,10,0),v.addMany(x(48,80),1,10,0),v.addMany(x(81,88),1,10,0),v.addMany([89,90,92],1,10,0),v.addMany(x(96,127),1,10,0),v.add(80,1,11,9),v.addMany(j,9,0,9),v.add(127,9,0,9),v.addMany(x(28,32),9,0,9),v.addMany(x(32,48),9,9,12),v.addMany(x(48,60),9,8,10),v.addMany([60,61,62,63],9,9,10),v.addMany(j,11,0,11),v.addMany(x(32,128),11,0,11),v.addMany(x(28,32),11,0,11),v.addMany(j,10,0,10),v.add(127,10,0,10),v.addMany(x(28,32),10,0,10),v.addMany(x(48,60),10,8,10),v.addMany([60,61,62,63],10,0,11),v.addMany(x(32,48),10,9,12),v.addMany(j,12,0,12),v.add(127,12,0,12),v.addMany(x(28,32),12,0,12),v.addMany(x(32,48),12,9,12),v.addMany(x(48,64),12,0,11),v.addMany(x(64,127),12,12,13),v.addMany(x(64,127),10,12,13),v.addMany(x(64,127),9,12,13),v.addMany(j,13,13,13),v.addMany(S,13,13,13),v.add(127,13,0,13),v.addMany([27,156,24,26],13,14,0),v.add(k,0,2,0),v.add(k,8,5,8),v.add(k,6,0,6),v.add(k,11,0,11),v.add(k,13,13,13),v})();class C extends p.Disposable{constructor(b=l.VT500_TRANSITION_TABLE){super(),this._transitions=b,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new g.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(x,S,j)=>{},this._executeHandlerFb=x=>{},this._csiHandlerFb=(x,S)=>{},this._escHandlerFb=x=>{},this._errorHandlerFb=x=>x,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,p.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new m.OscParser),this._dcsParser=this.register(new y.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(b,x=[64,126]){let S=0;if(b.prefix){if(b.prefix.length>1)throw new Error("only one byte as prefix supported");if(S=b.prefix.charCodeAt(0),S&&60>S||S>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(b.intermediates){if(b.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let A=0;A<b.intermediates.length;++A){const N=b.intermediates.charCodeAt(A);if(32>N||N>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");S<<=8,S|=N}}if(b.final.length!==1)throw new Error("final must be a single byte");const j=b.final.charCodeAt(0);if(x[0]>j||j>x[1])throw new Error(`final must be in range ${x[0]} .. ${x[1]}`);return S<<=8,S|=j,S}identToString(b){const x=[];for(;b;)x.push(String.fromCharCode(255&b)),b>>=8;return x.reverse().join("")}setPrintHandler(b){this._printHandler=b}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(b,x){const S=this._identifier(b,[48,126]);this._escHandlers[S]===void 0&&(this._escHandlers[S]=[]);const j=this._escHandlers[S];return j.push(x),{dispose:()=>{const A=j.indexOf(x);A!==-1&&j.splice(A,1)}}}clearEscHandler(b){this._escHandlers[this._identifier(b,[48,126])]&&delete this._escHandlers[this._identifier(b,[48,126])]}setEscHandlerFallback(b){this._escHandlerFb=b}setExecuteHandler(b,x){this._executeHandlers[b.charCodeAt(0)]=x}clearExecuteHandler(b){this._executeHandlers[b.charCodeAt(0)]&&delete this._executeHandlers[b.charCodeAt(0)]}setExecuteHandlerFallback(b){this._executeHandlerFb=b}registerCsiHandler(b,x){const S=this._identifier(b);this._csiHandlers[S]===void 0&&(this._csiHandlers[S]=[]);const j=this._csiHandlers[S];return j.push(x),{dispose:()=>{const A=j.indexOf(x);A!==-1&&j.splice(A,1)}}}clearCsiHandler(b){this._csiHandlers[this._identifier(b)]&&delete this._csiHandlers[this._identifier(b)]}setCsiHandlerFallback(b){this._csiHandlerFb=b}registerDcsHandler(b,x){return this._dcsParser.registerHandler(this._identifier(b),x)}clearDcsHandler(b){this._dcsParser.clearHandler(this._identifier(b))}setDcsHandlerFallback(b){this._dcsParser.setHandlerFallback(b)}registerOscHandler(b,x){return this._oscParser.registerHandler(b,x)}clearOscHandler(b){this._oscParser.clearHandler(b)}setOscHandlerFallback(b){this._oscParser.setHandlerFallback(b)}setErrorHandler(b){this._errorHandler=b}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(b,x,S,j,A){this._parseStack.state=b,this._parseStack.handlers=x,this._parseStack.handlerPos=S,this._parseStack.transition=j,this._parseStack.chunkPos=A}parse(b,x,S){let j,A=0,N=0,D=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,D=this._parseStack.chunkPos+1;else{if(S===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const T=this._parseStack.handlers;let I=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(S===!1&&I>-1){for(;I>=0&&(j=T[I](this._params),j!==!0);I--)if(j instanceof Promise)return this._parseStack.handlerPos=I,j}this._parseStack.handlers=[];break;case 4:if(S===!1&&I>-1){for(;I>=0&&(j=T[I](),j!==!0);I--)if(j instanceof Promise)return this._parseStack.handlerPos=I,j}this._parseStack.handlers=[];break;case 6:if(A=b[this._parseStack.chunkPos],j=this._dcsParser.unhook(A!==24&&A!==26,S),j)return j;A===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(A=b[this._parseStack.chunkPos],j=this._oscParser.end(A!==24&&A!==26,S),j)return j;A===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,D=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let T=D;T<x;++T){switch(A=b[T],N=this._transitions.table[this.currentState<<8|(A<160?A:k)],N>>4){case 2:for(let q=T+1;;++q){if(q>=x||(A=b[q])<32||A>126&&A<k){this._printHandler(b,T,q),T=q-1;break}if(++q>=x||(A=b[q])<32||A>126&&A<k){this._printHandler(b,T,q),T=q-1;break}if(++q>=x||(A=b[q])<32||A>126&&A<k){this._printHandler(b,T,q),T=q-1;break}if(++q>=x||(A=b[q])<32||A>126&&A<k){this._printHandler(b,T,q),T=q-1;break}}break;case 3:this._executeHandlers[A]?this._executeHandlers[A]():this._executeHandlerFb(A),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:T,code:A,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const I=this._csiHandlers[this._collect<<8|A];let H=I?I.length-1:-1;for(;H>=0&&(j=I[H](this._params),j!==!0);H--)if(j instanceof Promise)return this._preserveStack(3,I,H,N,T),j;H<0&&this._csiHandlerFb(this._collect<<8|A,this._params),this.precedingJoinState=0;break;case 8:do switch(A){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(A-48)}while(++T<x&&(A=b[T])>47&&A<60);T--;break;case 9:this._collect<<=8,this._collect|=A;break;case 10:const V=this._escHandlers[this._collect<<8|A];let Y=V?V.length-1:-1;for(;Y>=0&&(j=V[Y](),j!==!0);Y--)if(j instanceof Promise)return this._preserveStack(4,V,Y,N,T),j;Y<0&&this._escHandlerFb(this._collect<<8|A),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|A,this._params);break;case 13:for(let q=T+1;;++q)if(q>=x||(A=b[q])===24||A===26||A===27||A>127&&A<k){this._dcsParser.put(b,T,q),T=q-1;break}break;case 14:if(j=this._dcsParser.unhook(A!==24&&A!==26),j)return this._preserveStack(6,[],0,N,T),j;A===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 q=T+1;;q++)if(q>=x||(A=b[q])<32||A>127&&A<k){this._oscParser.put(b,T,q),T=q-1;break}break;case 6:if(j=this._oscParser.end(A!==24&&A!==26),j)return this._preserveStack(5,[],0,N,T),j;A===27&&(N|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&N}}}l.EscapeSequenceParser=C},6242:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.OscHandler=l.OscParser=void 0;const p=d(5770),g=d(482),m=[];l.OscParser=class{constructor(){this._state=0,this._active=m,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(y,_){this._handlers[y]===void 0&&(this._handlers[y]=[]);const k=this._handlers[y];return k.push(_),{dispose:()=>{const C=k.indexOf(_);C!==-1&&k.splice(C,1)}}}clearHandler(y){this._handlers[y]&&delete this._handlers[y]}setHandlerFallback(y){this._handlerFb=y}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=m}reset(){if(this._state===2)for(let y=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;y>=0;--y)this._active[y].end(!1);this._stack.paused=!1,this._active=m,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||m,this._active.length)for(let y=this._active.length-1;y>=0;y--)this._active[y].start();else this._handlerFb(this._id,"START")}_put(y,_,k){if(this._active.length)for(let C=this._active.length-1;C>=0;C--)this._active[C].put(y,_,k);else this._handlerFb(this._id,"PUT",(0,g.utf32ToString)(y,_,k))}start(){this.reset(),this._state=1}put(y,_,k){if(this._state!==3){if(this._state===1)for(;_<k;){const C=y[_++];if(C===59){this._state=2,this._start();break}if(C<48||57<C)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+C-48}this._state===2&&k-_>0&&this._put(y,_,k)}}end(y,_=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let k=!1,C=this._active.length-1,v=!1;if(this._stack.paused&&(C=this._stack.loopPosition-1,k=_,v=this._stack.fallThrough,this._stack.paused=!1),!v&&k===!1){for(;C>=0&&(k=this._active[C].end(y),k!==!0);C--)if(k instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=C,this._stack.fallThrough=!1,k;C--}for(;C>=0;C--)if(k=this._active[C].end(!1),k instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=C,this._stack.fallThrough=!0,k}else this._handlerFb(this._id,"END",y);this._active=m,this._id=-1,this._state=0}}},l.OscHandler=class{constructor(y){this._handler=y,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(y,_,k){this._hitLimit||(this._data+=(0,g.utf32ToString)(y,_,k),this._data.length>p.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(y){let _=!1;if(this._hitLimit)_=!1;else if(y&&(_=this._handler(this._data),_ instanceof Promise))return _.then((k=>(this._data="",this._hitLimit=!1,k)));return this._data="",this._hitLimit=!1,_}}},8742:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Params=void 0;const d=2147483647;class p{static fromArray(m){const y=new p;if(!m.length)return y;for(let _=Array.isArray(m[0])?1:0;_<m.length;++_){const k=m[_];if(Array.isArray(k))for(let C=0;C<k.length;++C)y.addSubParam(k[C]);else y.addParam(k)}return y}constructor(m=32,y=32){if(this.maxLength=m,this.maxSubParamsLength=y,y>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(m),this.length=0,this._subParams=new Int32Array(y),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(m),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const m=new p(this.maxLength,this.maxSubParamsLength);return m.params.set(this.params),m.length=this.length,m._subParams.set(this._subParams),m._subParamsLength=this._subParamsLength,m._subParamsIdx.set(this._subParamsIdx),m._rejectDigits=this._rejectDigits,m._rejectSubDigits=this._rejectSubDigits,m._digitIsSub=this._digitIsSub,m}toArray(){const m=[];for(let y=0;y<this.length;++y){m.push(this.params[y]);const _=this._subParamsIdx[y]>>8,k=255&this._subParamsIdx[y];k-_>0&&m.push(Array.prototype.slice.call(this._subParams,_,k))}return m}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(m){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(m<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=m>d?d:m}}addSubParam(m){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(m<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=m>d?d:m,this._subParamsIdx[this.length-1]++}}hasSubParams(m){return(255&this._subParamsIdx[m])-(this._subParamsIdx[m]>>8)>0}getSubParams(m){const y=this._subParamsIdx[m]>>8,_=255&this._subParamsIdx[m];return _-y>0?this._subParams.subarray(y,_):null}getSubParamsAll(){const m={};for(let y=0;y<this.length;++y){const _=this._subParamsIdx[y]>>8,k=255&this._subParamsIdx[y];k-_>0&&(m[y]=this._subParams.slice(_,k))}return m}addDigit(m){let y;if(this._rejectDigits||!(y=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const _=this._digitIsSub?this._subParams:this.params,k=_[y-1];_[y-1]=~k?Math.min(10*k+m,d):m}}l.Params=p},5741:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.AddonManager=void 0,l.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let d=this._addons.length-1;d>=0;d--)this._addons[d].instance.dispose()}loadAddon(d,p){const g={instance:p,dispose:p.dispose,isDisposed:!1};this._addons.push(g),p.dispose=()=>this._wrappedAddonDispose(g),p.activate(d)}_wrappedAddonDispose(d){if(d.isDisposed)return;let p=-1;for(let g=0;g<this._addons.length;g++)if(this._addons[g]===d){p=g;break}if(p===-1)throw new Error("Could not dispose an addon that has not been loaded");d.isDisposed=!0,d.dispose.apply(d.instance),this._addons.splice(p,1)}}},8771:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferApiView=void 0;const p=d(3785),g=d(511);l.BufferApiView=class{constructor(m,y){this._buffer=m,this.type=y}init(m){return this._buffer=m,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(m){const y=this._buffer.lines.get(m);if(y)return new p.BufferLineApiView(y)}getNullCell(){return new g.CellData}}},3785:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferLineApiView=void 0;const p=d(511);l.BufferLineApiView=class{constructor(g){this._line=g}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(g,m){if(!(g<0||g>=this._line.length))return m?(this._line.loadCell(g,m),m):this._line.loadCell(g,new p.CellData)}translateToString(g,m,y){return this._line.translateToString(g,m,y)}}},8285:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferNamespaceApi=void 0;const p=d(8771),g=d(8460),m=d(844);class y extends m.Disposable{constructor(k){super(),this._core=k,this._onBufferChange=this.register(new g.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new p.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new p.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)}}l.BufferNamespaceApi=y},7975:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ParserApi=void 0,l.ParserApi=class{constructor(d){this._core=d}registerCsiHandler(d,p){return this._core.registerCsiHandler(d,(g=>p(g.toArray())))}addCsiHandler(d,p){return this.registerCsiHandler(d,p)}registerDcsHandler(d,p){return this._core.registerDcsHandler(d,((g,m)=>p(g,m.toArray())))}addDcsHandler(d,p){return this.registerDcsHandler(d,p)}registerEscHandler(d,p){return this._core.registerEscHandler(d,p)}addEscHandler(d,p){return this.registerEscHandler(d,p)}registerOscHandler(d,p){return this._core.registerOscHandler(d,p)}addOscHandler(d,p){return this.registerOscHandler(d,p)}}},7090:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeApi=void 0,l.UnicodeApi=class{constructor(d){this._core=d}register(d){this._core.unicodeService.register(d)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(d){this._core.unicodeService.activeVersion=d}}},744:function(f,l,d){var p=this&&this.__decorate||function(v,b,x,S){var j,A=arguments.length,N=A<3?b:S===null?S=Object.getOwnPropertyDescriptor(b,x):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(v,b,x,S);else for(var D=v.length-1;D>=0;D--)(j=v[D])&&(N=(A<3?j(N):A>3?j(b,x,N):j(b,x))||N);return A>3&&N&&Object.defineProperty(b,x,N),N},g=this&&this.__param||function(v,b){return function(x,S){b(x,S,v)}};Object.defineProperty(l,"__esModule",{value:!0}),l.BufferService=l.MINIMUM_ROWS=l.MINIMUM_COLS=void 0;const m=d(8460),y=d(844),_=d(5295),k=d(2585);l.MINIMUM_COLS=2,l.MINIMUM_ROWS=1;let C=l.BufferService=class extends y.Disposable{get buffer(){return this.buffers.active}constructor(v){super(),this.isUserScrolling=!1,this._onResize=this.register(new m.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new m.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(v.rawOptions.cols||0,l.MINIMUM_COLS),this.rows=Math.max(v.rawOptions.rows||0,l.MINIMUM_ROWS),this.buffers=this.register(new _.BufferSet(v,this))}resize(v,b){this.cols=v,this.rows=b,this.buffers.resize(v,b),this._onResize.fire({cols:v,rows:b})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(v,b=!1){const x=this.buffer;let S;S=this._cachedBlankLine,S&&S.length===this.cols&&S.getFg(0)===v.fg&&S.getBg(0)===v.bg||(S=x.getBlankLine(v,b),this._cachedBlankLine=S),S.isWrapped=b;const j=x.ybase+x.scrollTop,A=x.ybase+x.scrollBottom;if(x.scrollTop===0){const N=x.lines.isFull;A===x.lines.length-1?N?x.lines.recycle().copyFrom(S):x.lines.push(S.clone()):x.lines.splice(A+1,0,S.clone()),N?this.isUserScrolling&&(x.ydisp=Math.max(x.ydisp-1,0)):(x.ybase++,this.isUserScrolling||x.ydisp++)}else{const N=A-j+1;x.lines.shiftElements(j+1,N-1,-1),x.lines.set(A,S.clone())}this.isUserScrolling||(x.ydisp=x.ybase),this._onScroll.fire(x.ydisp)}scrollLines(v,b,x){const S=this.buffer;if(v<0){if(S.ydisp===0)return;this.isUserScrolling=!0}else v+S.ydisp>=S.ybase&&(this.isUserScrolling=!1);const j=S.ydisp;S.ydisp=Math.max(Math.min(S.ydisp+v,S.ybase),0),j!==S.ydisp&&(b||this._onScroll.fire(S.ydisp))}};l.BufferService=C=p([g(0,k.IOptionsService)],C)},7994:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CharsetService=void 0,l.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(d){this.glevel=d,this.charset=this._charsets[d]}setgCharset(d,p){this._charsets[d]=p,this.glevel===d&&(this.charset=p)}}},1753:function(f,l,d){var p=this&&this.__decorate||function(S,j,A,N){var D,T=arguments.length,I=T<3?j:N===null?N=Object.getOwnPropertyDescriptor(j,A):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(S,j,A,N);else for(var H=S.length-1;H>=0;H--)(D=S[H])&&(I=(T<3?D(I):T>3?D(j,A,I):D(j,A))||I);return T>3&&I&&Object.defineProperty(j,A,I),I},g=this&&this.__param||function(S,j){return function(A,N){j(A,N,S)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CoreMouseService=void 0;const m=d(2585),y=d(8460),_=d(844),k={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:S=>S.button!==4&&S.action===1&&(S.ctrl=!1,S.alt=!1,S.shift=!1,!0)},VT200:{events:19,restrict:S=>S.action!==32},DRAG:{events:23,restrict:S=>S.action!==32||S.button!==3},ANY:{events:31,restrict:S=>!0}};function C(S,j){let A=(S.ctrl?16:0)|(S.shift?4:0)|(S.alt?8:0);return S.button===4?(A|=64,A|=S.action):(A|=3&S.button,4&S.button&&(A|=64),8&S.button&&(A|=128),S.action===32?A|=32:S.action!==0||j||(A|=3)),A}const v=String.fromCharCode,b={DEFAULT:S=>{const j=[C(S,!1)+32,S.col+32,S.row+32];return j[0]>255||j[1]>255||j[2]>255?"":`\x1B[M${v(j[0])}${v(j[1])}${v(j[2])}`},SGR:S=>{const j=S.action===0&&S.button!==4?"m":"M";return`\x1B[<${C(S,!0)};${S.col};${S.row}${j}`},SGR_PIXELS:S=>{const j=S.action===0&&S.button!==4?"m":"M";return`\x1B[<${C(S,!0)};${S.x};${S.y}${j}`}};let x=l.CoreMouseService=class extends _.Disposable{constructor(S,j){super(),this._bufferService=S,this._coreService=j,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new y.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const A of Object.keys(k))this.addProtocol(A,k[A]);for(const A of Object.keys(b))this.addEncoding(A,b[A]);this.reset()}addProtocol(S,j){this._protocols[S]=j}addEncoding(S,j){this._encodings[S]=j}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(S){if(!this._protocols[S])throw new Error(`unknown protocol "${S}"`);this._activeProtocol=S,this._onProtocolChange.fire(this._protocols[S].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(S){if(!this._encodings[S])throw new Error(`unknown encoding "${S}"`);this._activeEncoding=S}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(S){if(S.col<0||S.col>=this._bufferService.cols||S.row<0||S.row>=this._bufferService.rows||S.button===4&&S.action===32||S.button===3&&S.action!==32||S.button!==4&&(S.action===2||S.action===3)||(S.col++,S.row++,S.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,S,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(S))return!1;const j=this._encodings[this._activeEncoding](S);return j&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(j):this._coreService.triggerDataEvent(j,!0)),this._lastEvent=S,!0}explainEvents(S){return{down:!!(1&S),up:!!(2&S),drag:!!(4&S),move:!!(8&S),wheel:!!(16&S)}}_equalEvents(S,j,A){if(A){if(S.x!==j.x||S.y!==j.y)return!1}else if(S.col!==j.col||S.row!==j.row)return!1;return S.button===j.button&&S.action===j.action&&S.ctrl===j.ctrl&&S.alt===j.alt&&S.shift===j.shift}};l.CoreMouseService=x=p([g(0,m.IBufferService),g(1,m.ICoreService)],x)},6975:function(f,l,d){var p=this&&this.__decorate||function(x,S,j,A){var N,D=arguments.length,T=D<3?S:A===null?A=Object.getOwnPropertyDescriptor(S,j):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(x,S,j,A);else for(var I=x.length-1;I>=0;I--)(N=x[I])&&(T=(D<3?N(T):D>3?N(S,j,T):N(S,j))||T);return D>3&&T&&Object.defineProperty(S,j,T),T},g=this&&this.__param||function(x,S){return function(j,A){S(j,A,x)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CoreService=void 0;const m=d(1439),y=d(8460),_=d(844),k=d(2585),C=Object.freeze({insertMode:!1}),v=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let b=l.CoreService=class extends _.Disposable{constructor(x,S,j){super(),this._bufferService=x,this._logService=S,this._optionsService=j,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new y.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new y.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new y.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new y.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,m.clone)(C),this.decPrivateModes=(0,m.clone)(v)}reset(){this.modes=(0,m.clone)(C),this.decPrivateModes=(0,m.clone)(v)}triggerDataEvent(x,S=!1){if(this._optionsService.rawOptions.disableStdin)return;const j=this._bufferService.buffer;S&&this._optionsService.rawOptions.scrollOnUserInput&&j.ybase!==j.ydisp&&this._onRequestScrollToBottom.fire(),S&&this._onUserInput.fire(),this._logService.debug(`sending data "${x}"`,(()=>x.split("").map((A=>A.charCodeAt(0))))),this._onData.fire(x)}triggerBinaryEvent(x){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${x}"`,(()=>x.split("").map((S=>S.charCodeAt(0))))),this._onBinary.fire(x))}};l.CoreService=b=p([g(0,k.IBufferService),g(1,k.ILogService),g(2,k.IOptionsService)],b)},9074:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DecorationService=void 0;const p=d(8055),g=d(8460),m=d(844),y=d(6106);let _=0,k=0;class C extends m.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new y.SortedList((x=>x==null?void 0:x.marker.line)),this._onDecorationRegistered=this.register(new g.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new g.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,m.toDisposable)((()=>this.reset())))}registerDecoration(x){if(x.marker.isDisposed)return;const S=new v(x);if(S){const j=S.marker.onDispose((()=>S.dispose()));S.onDispose((()=>{S&&(this._decorations.delete(S)&&this._onDecorationRemoved.fire(S),j.dispose())})),this._decorations.insert(S),this._onDecorationRegistered.fire(S)}return S}reset(){for(const x of this._decorations.values())x.dispose();this._decorations.clear()}*getDecorationsAtCell(x,S,j){let A=0,N=0;for(const D of this._decorations.getKeyIterator(S))A=D.options.x??0,N=A+(D.options.width??1),x>=A&&x<N&&(!j||(D.options.layer??"bottom")===j)&&(yield D)}forEachDecorationAtCell(x,S,j,A){this._decorations.forEachByKey(S,(N=>{_=N.options.x??0,k=_+(N.options.width??1),x>=_&&x<k&&(!j||(N.options.layer??"bottom")===j)&&A(N)}))}}l.DecorationService=C;class v extends m.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=p.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=p.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(x){super(),this.options=x,this.onRenderEmitter=this.register(new g.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new g.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=x.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.InstantiationService=l.ServiceCollection=void 0;const p=d(2585),g=d(8343);class m{constructor(..._){this._entries=new Map;for(const[k,C]of _)this.set(k,C)}set(_,k){const C=this._entries.get(_);return this._entries.set(_,k),C}forEach(_){for(const[k,C]of this._entries.entries())_(k,C)}has(_){return this._entries.has(_)}get(_){return this._entries.get(_)}}l.ServiceCollection=m,l.InstantiationService=class{constructor(){this._services=new m,this._services.set(p.IInstantiationService,this)}setService(y,_){this._services.set(y,_)}getService(y){return this._services.get(y)}createInstance(y,..._){const k=(0,g.getServiceDependencies)(y).sort(((b,x)=>b.index-x.index)),C=[];for(const b of k){const x=this._services.get(b.id);if(!x)throw new Error(`[createInstance] ${y.name} depends on UNKNOWN service ${b.id}.`);C.push(x)}const v=k.length>0?k[0].index:_.length;if(_.length!==v)throw new Error(`[createInstance] First service dependency of ${y.name} at position ${v+1} conflicts with ${_.length} static arguments`);return new y(..._,...C)}}},7866:function(f,l,d){var p=this&&this.__decorate||function(v,b,x,S){var j,A=arguments.length,N=A<3?b:S===null?S=Object.getOwnPropertyDescriptor(b,x):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(v,b,x,S);else for(var D=v.length-1;D>=0;D--)(j=v[D])&&(N=(A<3?j(N):A>3?j(b,x,N):j(b,x))||N);return A>3&&N&&Object.defineProperty(b,x,N),N},g=this&&this.__param||function(v,b){return function(x,S){b(x,S,v)}};Object.defineProperty(l,"__esModule",{value:!0}),l.traceCall=l.setTraceLogger=l.LogService=void 0;const m=d(844),y=d(2585),_={trace:y.LogLevelEnum.TRACE,debug:y.LogLevelEnum.DEBUG,info:y.LogLevelEnum.INFO,warn:y.LogLevelEnum.WARN,error:y.LogLevelEnum.ERROR,off:y.LogLevelEnum.OFF};let k,C=l.LogService=class extends m.Disposable{get logLevel(){return this._logLevel}constructor(v){super(),this._optionsService=v,this._logLevel=y.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),k=this}_updateLogLevel(){this._logLevel=_[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(v){for(let b=0;b<v.length;b++)typeof v[b]=="function"&&(v[b]=v[b]())}_log(v,b,x){this._evalLazyOptionalParams(x),v.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+b,...x)}trace(v,...b){var x;this._logLevel<=y.LogLevelEnum.TRACE&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.trace.bind(this._optionsService.options.logger))??console.log,v,b)}debug(v,...b){var x;this._logLevel<=y.LogLevelEnum.DEBUG&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.debug.bind(this._optionsService.options.logger))??console.log,v,b)}info(v,...b){var x;this._logLevel<=y.LogLevelEnum.INFO&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.info.bind(this._optionsService.options.logger))??console.info,v,b)}warn(v,...b){var x;this._logLevel<=y.LogLevelEnum.WARN&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.warn.bind(this._optionsService.options.logger))??console.warn,v,b)}error(v,...b){var x;this._logLevel<=y.LogLevelEnum.ERROR&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.error.bind(this._optionsService.options.logger))??console.error,v,b)}};l.LogService=C=p([g(0,y.IOptionsService)],C),l.setTraceLogger=function(v){k=v},l.traceCall=function(v,b,x){if(typeof x.value!="function")throw new Error("not supported");const S=x.value;x.value=function(...j){if(k.logLevel!==y.LogLevelEnum.TRACE)return S.apply(this,j);k.trace(`GlyphRenderer#${S.name}(${j.map((N=>JSON.stringify(N))).join(", ")})`);const A=S.apply(this,j);return k.trace(`GlyphRenderer#${S.name} return`,A),A}}},7302:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.OptionsService=l.DEFAULT_OPTIONS=void 0;const p=d(8460),g=d(844),m=d(6114);l.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:m.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const y=["normal","bold","100","200","300","400","500","600","700","800","900"];class _ extends g.Disposable{constructor(C){super(),this._onOptionChange=this.register(new p.EventEmitter),this.onOptionChange=this._onOptionChange.event;const v={...l.DEFAULT_OPTIONS};for(const b in C)if(b in v)try{const x=C[b];v[b]=this._sanitizeAndValidateOption(b,x)}catch(x){console.error(x)}this.rawOptions=v,this.options={...v},this._setupOptions(),this.register((0,g.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(C,v){return this.onOptionChange((b=>{b===C&&v(this.rawOptions[C])}))}onMultipleOptionChange(C,v){return this.onOptionChange((b=>{C.indexOf(b)!==-1&&v()}))}_setupOptions(){const C=b=>{if(!(b in l.DEFAULT_OPTIONS))throw new Error(`No option with key "${b}"`);return this.rawOptions[b]},v=(b,x)=>{if(!(b in l.DEFAULT_OPTIONS))throw new Error(`No option with key "${b}"`);x=this._sanitizeAndValidateOption(b,x),this.rawOptions[b]!==x&&(this.rawOptions[b]=x,this._onOptionChange.fire(b))};for(const b in this.rawOptions){const x={get:C.bind(this,b),set:v.bind(this,b)};Object.defineProperty(this.options,b,x)}}_sanitizeAndValidateOption(C,v){switch(C){case"cursorStyle":if(v||(v=l.DEFAULT_OPTIONS[C]),!(function(b){return b==="block"||b==="underline"||b==="bar"})(v))throw new Error(`"${v}" is not a valid value for ${C}`);break;case"wordSeparator":v||(v=l.DEFAULT_OPTIONS[C]);break;case"fontWeight":case"fontWeightBold":if(typeof v=="number"&&1<=v&&v<=1e3)break;v=y.includes(v)?v:l.DEFAULT_OPTIONS[C];break;case"cursorWidth":v=Math.floor(v);case"lineHeight":case"tabStopWidth":if(v<1)throw new Error(`${C} 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(`${C} cannot be less than 0, value: ${v}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(v<=0)throw new Error(`${C} cannot be less than or equal to 0, value: ${v}`);break;case"rows":case"cols":if(!v&&v!==0)throw new Error(`${C} must be numeric, value: ${v}`);break;case"windowsPty":v=v??{}}return v}}l.OptionsService=_},2660:function(f,l,d){var p=this&&this.__decorate||function(_,k,C,v){var b,x=arguments.length,S=x<3?k:v===null?v=Object.getOwnPropertyDescriptor(k,C):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(_,k,C,v);else for(var j=_.length-1;j>=0;j--)(b=_[j])&&(S=(x<3?b(S):x>3?b(k,C,S):b(k,C))||S);return x>3&&S&&Object.defineProperty(k,C,S),S},g=this&&this.__param||function(_,k){return function(C,v){k(C,v,_)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OscLinkService=void 0;const m=d(2585);let y=l.OscLinkService=class{constructor(_){this._bufferService=_,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(_){const k=this._bufferService.buffer;if(_.id===void 0){const j=k.addMarker(k.ybase+k.y),A={data:_,id:this._nextId++,lines:[j]};return j.onDispose((()=>this._removeMarkerFromLink(A,j))),this._dataByLinkId.set(A.id,A),A.id}const C=_,v=this._getEntryIdKey(C),b=this._entriesWithId.get(v);if(b)return this.addLineToLink(b.id,k.ybase+k.y),b.id;const x=k.addMarker(k.ybase+k.y),S={id:this._nextId++,key:this._getEntryIdKey(C),data:C,lines:[x]};return x.onDispose((()=>this._removeMarkerFromLink(S,x))),this._entriesWithId.set(S.key,S),this._dataByLinkId.set(S.id,S),S.id}addLineToLink(_,k){const C=this._dataByLinkId.get(_);if(C&&C.lines.every((v=>v.line!==k))){const v=this._bufferService.buffer.addMarker(k);C.lines.push(v),v.onDispose((()=>this._removeMarkerFromLink(C,v)))}}getLinkData(_){var k;return(k=this._dataByLinkId.get(_))==null?void 0:k.data}_getEntryIdKey(_){return`${_.id};;${_.uri}`}_removeMarkerFromLink(_,k){const C=_.lines.indexOf(k);C!==-1&&(_.lines.splice(C,1),_.lines.length===0&&(_.data.id!==void 0&&this._entriesWithId.delete(_.key),this._dataByLinkId.delete(_.id)))}};l.OscLinkService=y=p([g(0,m.IBufferService)],y)},8343:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.createDecorator=l.getServiceDependencies=l.serviceRegistry=void 0;const d="di$target",p="di$dependencies";l.serviceRegistry=new Map,l.getServiceDependencies=function(g){return g[p]||[]},l.createDecorator=function(g){if(l.serviceRegistry.has(g))return l.serviceRegistry.get(g);const m=function(y,_,k){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(C,v,b){v[d]===v?v[p].push({id:C,index:b}):(v[p]=[{id:C,index:b}],v[d]=v)})(m,y,k)};return m.toString=()=>g,l.serviceRegistry.set(g,m),m}},2585:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.IDecorationService=l.IUnicodeService=l.IOscLinkService=l.IOptionsService=l.ILogService=l.LogLevelEnum=l.IInstantiationService=l.ICharsetService=l.ICoreService=l.ICoreMouseService=l.IBufferService=void 0;const p=d(8343);var g;l.IBufferService=(0,p.createDecorator)("BufferService"),l.ICoreMouseService=(0,p.createDecorator)("CoreMouseService"),l.ICoreService=(0,p.createDecorator)("CoreService"),l.ICharsetService=(0,p.createDecorator)("CharsetService"),l.IInstantiationService=(0,p.createDecorator)("InstantiationService"),(function(m){m[m.TRACE=0]="TRACE",m[m.DEBUG=1]="DEBUG",m[m.INFO=2]="INFO",m[m.WARN=3]="WARN",m[m.ERROR=4]="ERROR",m[m.OFF=5]="OFF"})(g||(l.LogLevelEnum=g={})),l.ILogService=(0,p.createDecorator)("LogService"),l.IOptionsService=(0,p.createDecorator)("OptionsService"),l.IOscLinkService=(0,p.createDecorator)("OscLinkService"),l.IUnicodeService=(0,p.createDecorator)("UnicodeService"),l.IDecorationService=(0,p.createDecorator)("DecorationService")},1480:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeService=void 0;const p=d(8460),g=d(225);class m{static extractShouldJoin(_){return(1&_)!=0}static extractWidth(_){return _>>1&3}static extractCharKind(_){return _>>3}static createPropertyValue(_,k,C=!1){return(16777215&_)<<3|(3&k)<<1|(C?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new p.EventEmitter,this.onChange=this._onChange.event;const _=new g.UnicodeV6;this.register(_),this._active=_.version,this._activeProvider=_}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(_){if(!this._providers[_])throw new Error(`unknown Unicode version "${_}"`);this._active=_,this._activeProvider=this._providers[_],this._onChange.fire(_)}register(_){this._providers[_.version]=_}wcwidth(_){return this._activeProvider.wcwidth(_)}getStringCellWidth(_){let k=0,C=0;const v=_.length;for(let b=0;b<v;++b){let x=_.charCodeAt(b);if(55296<=x&&x<=56319){if(++b>=v)return k+this.wcwidth(x);const A=_.charCodeAt(b);56320<=A&&A<=57343?x=1024*(x-55296)+A-56320+65536:k+=this.wcwidth(A)}const S=this.charProperties(x,C);let j=m.extractWidth(S);m.extractShouldJoin(S)&&(j-=m.extractWidth(C)),k+=j,C=S}return k}charProperties(_,k){return this._activeProvider.charProperties(_,k)}}l.UnicodeService=m}},s={};function c(f){var l=s[f];if(l!==void 0)return l.exports;var d=s[f]={exports:{}};return i[f].call(d.exports,d,d.exports,c),d.exports}var u={};return(()=>{var f=u;Object.defineProperty(f,"__esModule",{value:!0}),f.Terminal=void 0;const l=c(9042),d=c(3236),p=c(844),g=c(5741),m=c(8285),y=c(7975),_=c(7090),k=["cols","rows"];class C extends p.Disposable{constructor(b){super(),this._core=this.register(new d.Terminal(b)),this._addonManager=this.register(new g.AddonManager),this._publicOptions={...this._core.options};const x=j=>this._core.options[j],S=(j,A)=>{this._checkReadonlyOptions(j),this._core.options[j]=A};for(const j in this._core.options){const A={get:x.bind(this,j),set:S.bind(this,j)};Object.defineProperty(this._publicOptions,j,A)}}_checkReadonlyOptions(b){if(k.includes(b))throw new Error(`Option "${b}" 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 y.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new _.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 m.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const b=this._core.coreService.decPrivateModes;let x="none";switch(this._core.coreMouseService.activeProtocol){case"X10":x="x10";break;case"VT200":x="vt200";break;case"DRAG":x="drag";break;case"ANY":x="any"}return{applicationCursorKeysMode:b.applicationCursorKeys,applicationKeypadMode:b.applicationKeypad,bracketedPasteMode:b.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:x,originMode:b.origin,reverseWraparoundMode:b.reverseWraparound,sendFocusMode:b.sendFocus,wraparoundMode:b.wraparound}}get options(){return this._publicOptions}set options(b){for(const x in b)this._publicOptions[x]=b[x]}blur(){this._core.blur()}focus(){this._core.focus()}input(b,x=!0){this._core.input(b,x)}resize(b,x){this._verifyIntegers(b,x),this._core.resize(b,x)}open(b){this._core.open(b)}attachCustomKeyEventHandler(b){this._core.attachCustomKeyEventHandler(b)}attachCustomWheelEventHandler(b){this._core.attachCustomWheelEventHandler(b)}registerLinkProvider(b){return this._core.registerLinkProvider(b)}registerCharacterJoiner(b){return this._checkProposedApi(),this._core.registerCharacterJoiner(b)}deregisterCharacterJoiner(b){this._checkProposedApi(),this._core.deregisterCharacterJoiner(b)}registerMarker(b=0){return this._verifyIntegers(b),this._core.registerMarker(b)}registerDecoration(b){return this._checkProposedApi(),this._verifyPositiveIntegers(b.x??0,b.width??0,b.height??0),this._core.registerDecoration(b)}hasSelection(){return this._core.hasSelection()}select(b,x,S){this._verifyIntegers(b,x,S),this._core.select(b,x,S)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(b,x){this._verifyIntegers(b,x),this._core.selectLines(b,x)}dispose(){super.dispose()}scrollLines(b){this._verifyIntegers(b),this._core.scrollLines(b)}scrollPages(b){this._verifyIntegers(b),this._core.scrollPages(b)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(b){this._verifyIntegers(b),this._core.scrollToLine(b)}clear(){this._core.clear()}write(b,x){this._core.write(b,x)}writeln(b,x){this._core.write(b),this._core.write(`\r
|
|
65
|
+
`,x)}paste(b){this._core.paste(b)}refresh(b,x){this._verifyIntegers(b,x),this._core.refresh(b,x)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(b){this._addonManager.loadAddon(this,b)}static get strings(){return l}_verifyIntegers(...b){for(const x of b)if(x===1/0||isNaN(x)||x%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...b){for(const x of b)if(x&&(x===1/0||isNaN(x)||x%1!=0||x<0))throw new Error("This API only accepts positive integers")}}f.Terminal=C})(),u})()))})(Td)),Td.exports}var YS=VS();/**
|
|
66
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
67
|
+
* @license MIT
|
|
68
|
+
*
|
|
69
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
70
|
+
* @license MIT
|
|
71
|
+
*
|
|
72
|
+
* Originally forked from (with the author's permission):
|
|
73
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
74
|
+
* http://bellard.org/jslinux/
|
|
75
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
76
|
+
*/var KS=2,XS=1,ZS=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let r=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(r._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){var m;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let r=this._terminal.options.scrollback===0?0:((m=this._terminal.options.overviewRuler)==null?void 0:m.width)||14,i=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(i.getPropertyValue("height")),c=Math.max(0,parseInt(i.getPropertyValue("width"))),u=window.getComputedStyle(this._terminal.element),f={top:parseInt(u.getPropertyValue("padding-top")),bottom:parseInt(u.getPropertyValue("padding-bottom")),right:parseInt(u.getPropertyValue("padding-right")),left:parseInt(u.getPropertyValue("padding-left"))},l=f.top+f.bottom,d=f.right+f.left,p=s-l,g=c-d-r;return{cols:Math.max(KS,Math.floor(g/e.css.cell.width)),rows:Math.max(XS,Math.floor(p/e.css.cell.height))}}};function QS({sessionId:e,onClose:r,onEscape:i,autoFocus:s}){const c=P.useRef(null),u=P.useRef(e),f=P.useRef(null),l=P.useRef(null),d=sr(g=>g.writeSession),p=sr(g=>g.resizeSession);return P.useEffect(()=>{u.current=e},[e]),P.useEffect(()=>{if(!i)return;const g=m=>{(m.key==="²"||m.key==="`")&&(m.preventDefault(),m.stopPropagation(),i())};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[i]),P.useEffect(()=>{if(!c.current)return;const g=new YS.Terminal({fontFamily:'"JetBrains Mono", monospace',fontSize:13,theme:{background:"#1a1a1a",foreground:"#e0e0e0",cursor:"#ffffff",cursorAccent:"#1a1a1a"},cursorBlink:!0,cursorStyle:"bar",convertEol:!0}),m=new ZS;g.loadAddon(m),f.current={term:g,fitAddon:m},c.current.addEventListener("keydown",C=>{(C.key==="²"||C.key==="`")&&i&&(C.preventDefault(),C.stopPropagation(),i())}),g.open(c.current);const y=c.current.querySelector(".xterm");y&&(y.style.padding="8px"),m.fit(),s&&setTimeout(()=>{g.focus()},150);const _=new ResizeObserver(()=>{l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{requestAnimationFrame(()=>{var v;m.fit&&m.fit();const C=(v=f.current)==null?void 0:v.term;C&&C.cols>0&&C.rows>0&&p(u.current,C.cols,C.rows)})},100)});_.observe(c.current),g.onData(C=>{if((C==="\x1B"||C==="²"||C==="`")&&i){i();return}d(u.current,C)}),g.onKey(C=>{(C.key==="\x1B"||C.key==="²"||C.key==="`")&&i&&(C.domEvent.stopPropagation(),i())});const k=Pt.subscribe(C=>{var v,b;if(C.type==="terminal.output"&&((v=C.payload)==null?void 0:v.sessionId)===u.current){const x=(b=C.payload)==null?void 0:b.data;x&&g.write(x)}});return()=>{k(),_.disconnect(),l.current&&clearTimeout(l.current),g.dispose(),f.current=null}},[e,d,p]),o.jsxs("div",{className:"flex flex-col h-full bg-[#1a1a1a]",children:[o.jsxs("div",{className:"flex-shrink-0 flex items-center justify-between px-2 py-1 bg-[#252525] border-b border-[#333]",children:[o.jsx("div",{}),o.jsx("button",{onClick:r,className:"p-1 rounded hover:bg-[#333] text-[#888] hover:text-[#ccc] transition-colors",title:"Close terminal",children:o.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 16 16",fill:"currentColor",children:o.jsx("path",{d:"M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.55.5 0 0 1 0-.708z"})})})]}),o.jsx("div",{ref:c,className:"flex-1 relative overflow-hidden",tabIndex:0,onKeyDown:g=>{(g.key==="²"||g.key==="`")&&i&&(g.preventDefault(),g.stopPropagation(),i())}})]})}function JS(e){return e===1?"grid-cols-1":e===2?"grid-cols-1 lg:grid-cols-2":"grid-cols-1 lg:grid-cols-2 xl:grid-cols-3"}function ew({isOpen:e,onClose:r,onFocusChat:i}){const s=sr(C=>C.createSession),c=sr(C=>C.killSession),u=sr(C=>C.sessions),f=sr(C=>C.setWorkdir),l=sr(C=>C.fetchSessions),d=Gt(C=>C.currentProject),[p,g]=P.useState(!0),m=P.useRef(null),y=P.useRef(!1),_=P.useRef(!1),k=P.useCallback(()=>{r(),i()},[r,i]);return P.useEffect(()=>{d!=null&&d.workdir&&f(d.workdir)},[d==null?void 0:d.workdir,f]),P.useEffect(()=>{e&&(g(!0),l().finally(()=>g(!1)))},[e,l]),P.useEffect(()=>{e&&u.length===0&&!p&&!_.current&&(_.current=!0,s())},[e,u.length,p,s]),P.useEffect(()=>{e?(y.current=!0,setTimeout(()=>{var C;(C=m.current)==null||C.focus(),setTimeout(()=>{y.current=!1},200)},100)):_.current=!1},[e]),P.useEffect(()=>{if(!e)return;const C=v=>{y.current||(v.key==="Escape"||v.key==="²"||v.key==="`")&&(v.preventDefault(),r(),i())};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[e,r,i]),e?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-x-0 top-[50vh] bottom-0 z-[100] bg-black/40",style:{pointerEvents:"auto"},onClick:k}),o.jsxs("div",{ref:m,tabIndex:-1,className:"fixed inset-x-0 top-0 z-[100] h-[50vh] bg-bg-primary border-b border-border flex flex-col animate-slide-down outline-none",onClick:C=>C.stopPropagation(),onKeyDown:C=>{(C.key==="Escape"||C.key==="²"||C.key==="`")&&(C.preventDefault(),k())},children:[o.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border",children:[o.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Terminal"}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{onClick:()=>s(),className:"p-2 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"New terminal",children:o.jsx("svg",{className:"w-5 h-5",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z",clipRule:"evenodd"})})}),o.jsx("button",{onClick:()=>{r(),i()},className:"p-2 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Close (Esc)",children:o.jsx("svg",{className:"w-5 h-5",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]})]}),o.jsx("div",{className:"flex-1 min-h-0 p-2 overflow-auto",children:p?o.jsx("div",{className:"flex items-center justify-center h-full text-text-muted",children:"Loading..."}):u.length===0?o.jsx("div",{className:"flex items-center justify-center h-full text-text-muted",children:o.jsxs("div",{className:"text-center",children:[o.jsx("p",{className:"mb-4",children:"No terminal sessions"}),o.jsx("button",{onClick:()=>s(),className:"px-4 py-2 bg-accent-primary/25 text-white rounded hover:bg-accent-primary/40 transition-colors",children:"Create Terminal"})]})}):o.jsx("div",{className:`grid ${JS(u.length)} gap-2 h-full auto-rows-fr`,children:u.map(C=>o.jsx(QS,{sessionId:C.id,onClose:()=>c(C.id),onEscape:k,autoFocus:u.length===1},C.id))})})]})]}):null}function eo({items:e,trigger:r,minWidth:i="120px"}){const[s,c]=P.useState(!1),[u,f]=P.useState(null),l=P.useRef(null),d=P.useRef(null);P.useEffect(()=>{function y(_){d.current&&!d.current.contains(_.target)&&c(!1)}return s&&document.addEventListener("mousedown",y),()=>{document.removeEventListener("mousedown",y)}},[s]);const p=P.useCallback(()=>{if(!l.current)return;const y=l.current.getBoundingClientRect(),_=200,C=window.innerHeight-y.bottom<_;f({top:C?y.top-_-4:y.bottom+4,left:y.left,alignToTop:C})},[]),g=y=>{y.stopPropagation(),s||p(),c(!s)},m=u&&o.jsx("div",{ref:d,"data-testid":"session-dropdown-menu",className:`fixed bg-bg-secondary border border-border rounded shadow-lg z-50 ${u.alignToTop?"mb-1":"mt-1"}`,style:{top:u.top,left:u.left,minWidth:i},children:e.map((y,_)=>{const k=o.jsxs(o.Fragment,{children:[y.icon&&o.jsx("span",{className:"w-4 h-4 flex-shrink-0",children:y.icon}),y.label]});return y.href?o.jsx(Ln,{href:y.href,onClick:C=>{var v;(v=y.onClick)==null||v.call(y,C),c(!1)},className:`w-full px-3 py-2 text-left text-sm hover:bg-bg-tertiary transition-colors flex items-center gap-2 ${y.danger?"text-accent-error hover:bg-accent-error/10":"text-text-primary"} ${_!==e.length-1?"border-b border-border":""}`,children:k},_):o.jsx("button",{onClick:C=>{var v;(v=y.onClick)==null||v.call(y,C),y.closeOnClick!==!1&&c(!1)},className:`w-full px-3 py-2 text-left text-sm hover:bg-bg-tertiary transition-colors flex items-center gap-2 ${y.danger?"text-accent-error hover:bg-accent-error/10":"text-text-primary"} ${_!==e.length-1?"border-b border-border":""}`,children:k},_)})});return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"relative",children:o.jsx("div",{ref:l,onClick:g,children:r})}),s&&ql.createPortal(m,document.body)]})}function kb({className:e="w-3 h-3"}){return o.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})}function Wl({className:e="w-4 h-4"}){return o.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}function Eb(e){const r=new Date(e),s=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][r.getDay()],c=r.getFullYear(),u=String(r.getMonth()+1).padStart(2,"0"),f=String(r.getDate()).padStart(2,"0");return`${s} ${c}/${u}/${f}`}function Gl(e){const r=new Date(e),i=String(r.getHours()).padStart(2,"0"),s=String(r.getMinutes()).padStart(2,"0");return`${i}:${s}`}function tw(e){const r=new Date(e),i=new Date,s=new Date(i.getFullYear(),i.getMonth(),i.getDate()),c=new Date(r.getFullYear(),r.getMonth(),r.getDate()),u=Math.floor((s.getTime()-c.getTime())/(1e3*60*60*24)),f=Gl(e);if(u===0)return`today ${f}`;if(u===1)return`yesterday ${f}`;if(u<7)return`${u} days ago ${f}`;{const l=r.getFullYear(),d=String(r.getMonth()+1).padStart(2,"0"),p=String(r.getDate()).padStart(2,"0");return`${l}/${d}/${p} ${f}`}}function jb(e){const r=new Date(e);return{year:r.getFullYear(),month:String(r.getMonth()+1).padStart(2,"0"),day:String(r.getDate()).padStart(2,"0")}}function nw(e){const{year:r,month:i,day:s}=jb(e);return`${r}-${i}-${s}`}function Nb(e){const r=new Map;for(const c of e){const u=nw(c.updatedAt);r.has(u)||r.set(u,[]),r.get(u).push(c)}for(const[c,u]of r)u.sort((f,l)=>{const d=new Date(f.updatedAt).getTime();return new Date(l.updatedAt).getTime()-d});const i=Array.from(r.keys()).sort((c,u)=>u.localeCompare(c)),s=new Map;for(const c of i)s.set(c,r.get(c));return s}function rw({items:e,trigger:r,isActive:i=!1}){const[s,c]=P.useState(!1),u=P.useRef(null);return P.useEffect(()=>{function f(l){u.current&&!u.current.contains(l.target)&&c(!1)}if(s)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[s]),o.jsxs("div",{className:"relative",ref:u,children:[o.jsxs("button",{type:"button",onClick:()=>c(!s),className:`flex items-center gap-1 px-1.5 py-0.5 rounded transition-colors ${i?"bg-bg-tertiary":"hover:bg-bg-tertiary"}`,children:[typeof r=="string"?o.jsx("span",{className:"text-sm text-text-secondary font-medium",children:r}):r,o.jsx("svg",{className:"w-3 h-3 text-text-muted flex-shrink-0 transition-transform",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,style:{transform:s?"rotate(180deg)":void 0},children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),s&&e.length>0&&o.jsx("div",{className:"absolute top-full left-0 mt-1 w-56 bg-bg-secondary border border-border rounded-lg shadow-lg overflow-hidden z-50",children:e.map((f,l)=>{const d=f.label&&typeof f.label=="object"&&f.label.type===Ln?f.label:null;if(d){const p=d.props.href||"";return o.jsxs(Ln,{href:p,className:"flex items-center gap-2 px-3 py-2 text-sm border-b border-border hover:bg-bg-tertiary transition-colors",children:[f.icon,d.props.children]},l)}return f.href?o.jsxs("a",{href:f.href,className:"flex items-center gap-2 px-3 py-2 text-sm border-b border-border hover:bg-bg-tertiary transition-colors",children:[f.icon,f.label]},l):o.jsxs("button",{type:"button",onClick:()=>{var p;(p=f.onClick)==null||p.call(f),c(!1)},className:"flex items-center gap-2 px-3 py-2 text-sm w-full text-left border-b border-border hover:bg-bg-tertiary transition-colors",children:[f.icon,f.label]},l)})})]})}function iw({projects:e,currentProject:r}){const i=Gt(u=>u.loadProject),c=[...e].sort((u,f)=>u.name.localeCompare(f.name)).map(u=>({label:u.name,icon:u.id===r.id?o.jsx(Wl,{}):void 0,href:`/p/${u.id}`,onClick:()=>{i(u.id)}}));return o.jsx(eo,{items:c,trigger:o.jsxs("button",{className:"text-text-secondary hover:text-text-primary hover:underline text-sm truncate flex items-center gap-1",title:r.name,children:[r.name,o.jsx(kb,{})]}),minWidth:"250px"})}function sw({currentProject:e,sessions:r,currentSession:i,projectIdFromUrl:s}){if(!(e!=null&&e.id)||e.id!==s)return null;const c=r.filter(f=>f.projectId===e.id).sort((f,l)=>new Date(l.updatedAt).getTime()-new Date(f.updatedAt).getTime()).slice(0,5),u=[{label:o.jsxs(Ln,{href:`/p/${e.id}/new`,className:"flex items-center gap-2",children:[o.jsx("svg",{className:"w-3 h-3 text-accent-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),o.jsx("span",{className:"text-sm",children:"New Session"})]})},...c.map(f=>({label:o.jsx(Ln,{href:`/p/${e.id}/s/${f.id}`,className:"flex items-center gap-2 truncate text-sm",children:o.jsx("span",{children:f.title??f.id.slice(0,8)})}),icon:f.id===(i==null?void 0:i.id)?o.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}):void 0})),{label:o.jsxs(Ln,{href:"/",className:"flex items-center gap-2 text-text-muted hover:text-text-primary",children:[o.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"})}),o.jsx("span",{className:"text-sm",children:"Projects"})]})}];return o.jsx(rw,{items:u,trigger:o.jsx("span",{className:"text-sm text-text-secondary font-medium",children:e.name})})}function aw({sessions:e,currentProject:r,currentSession:i}){var d;const s=Ee(p=>p.loadSession),c=e.filter(p=>p.projectId===r.id).slice(0,15),u=Nb(c),f=[];f.push({label:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("svg",{className:"w-4 h-4 text-accent-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),o.jsx("span",{className:"text-sm",children:"New session"})]}),href:`/p/${r.id}/new`,onClick:()=>{}});for(const[p,g]of u){const m=g[0];if(m){f.push({label:o.jsx("div",{className:"px-3 py-2 text-text-muted text-xs font-medium cursor-default",children:Eb(m.updatedAt)}),onClick:()=>{}});for(const y of g)f.push({label:o.jsxs("div",{className:"min-w-[160px]",children:[o.jsx("div",{className:"truncate text-sm",children:y.title??y.id.slice(0,8)}),o.jsx("div",{className:"text-text-muted text-xs",children:Gl(y.updatedAt)})]}),icon:y.id===(i==null?void 0:i.id)?o.jsx(Wl,{}):void 0,href:`/p/${r.id}/s/${y.id}`,onClick:()=>{s(y.id)}})}}const l=i?((d=i.metadata)==null?void 0:d.title)??i.id.slice(0,8):"No session selected";return o.jsx(eo,{items:f,trigger:o.jsxs("button",{className:"text-text-secondary hover:text-text-primary hover:underline text-sm truncate flex items-center gap-1",title:l,"data-testid":"header-session-dropdown",children:[l,o.jsx(kb,{})]}),minWidth:"280px"})}function ow({onMenuClick:e,onCriteriaToggle:r}){const[i,s]=P.useState(!1),[c]=ar(),u=c.startsWith("/p/"),f=/^\/p\/[^/]+\/s\/[^/]+$/.test(c),l=Ee(v=>v.currentSession),d=Ee(v=>v.sessions),p=Gt(v=>v.currentProject),g=Gt(v=>v.projects),m=kt(v=>v.startAutoRefresh),y=kt(v=>v.stopAutoRefresh),_=sr(v=>v.setOpen),k=sr(v=>v.isOpen),C=P.useCallback(()=>{const v=document.querySelector('textarea[placeholder*="What would you like to build"], textarea[placeholder*="Send a message"]');v&&v.focus()},[]);return P.useEffect(()=>{const v=b=>{(b.key==="²"||b.key==="`")&&(b.preventDefault(),k||_(!0))};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[k,_]),P.useEffect(()=>(m(),()=>y()),[m,y]),o.jsxs("header",{className:"h-8 bg-bg-secondary border-b border-border flex items-center justify-between px-2",children:[o.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[e&&u&&o.jsx("button",{onClick:e,className:"flex-shrink-0 p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Toggle session list",children:o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})}),o.jsx(Ln,{href:"/",className:"text-accent-primary font-semibold text-base hover:underline flex-shrink-0 hidden md:inline",children:"OpenFox"}),p&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"hidden md:inline text-text-muted flex-shrink-0",children:"/"}),o.jsx("span",{className:"hidden md:inline",children:o.jsx(iw,{projects:g,currentProject:p})}),o.jsx("span",{className:"md:hidden",children:o.jsx(sw,{currentProject:p,sessions:d,currentSession:l,projectIdFromUrl:u&&c.split("/")[2]||null},p==null?void 0:p.id)}),o.jsx("span",{className:"hidden md:inline text-text-muted flex-shrink-0",children:"/"}),o.jsx("span",{className:"hidden md:inline",children:o.jsx(aw,{sessions:d,currentProject:p,currentSession:l})})]})]}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[u&&o.jsx("button",{onClick:()=>_(!k),className:`p-2.5 rounded hover:bg-bg-tertiary transition-colors ${k?"text-accent-primary":"text-text-muted hover:text-text-primary"}`,title:"Toggle terminal (²)",children:o.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M2 5a2 2 0 012-2h12a2 2 0 012 2v10a2 2 0 01-2 2H4a2 2 0 01-2-2V5zm3 1h10v1H5V6zm10 7H5v1h10v-1zm-10 2H5v1h10v-1z",clipRule:"evenodd"})})}),o.jsx("button",{onClick:()=>s(!0),className:"p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Settings",children:o.jsxs("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}),o.jsx("button",{onClick:()=>{localStorage.removeItem("openfox_token"),window.location.reload()},className:"p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Logout",children:o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"})})}),r&&f&&o.jsx("button",{onClick:r,className:"p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Toggle summary sidebar",children:o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})})]}),o.jsx(qS,{isOpen:i,onClose:()=>s(!1)}),o.jsx(ew,{isOpen:k,onClose:()=>_(!1),onFocusChat:C})]})}function lw({isOpen:e,onClose:r,title:i,label:s,description:c,placeholder:u,value:f,isLoading:l=!1,onSave:d}){const[p,g]=P.useState(f),[m,y]=P.useState(!1),[_,k]=P.useState(!1);P.useEffect(()=>{g(f),y(!1)},[f]);const C=S=>{g(S.target.value),y(!0)},v=async()=>{k(!0),await d(p),k(!1),y(!1),r()},b=()=>{g(f),y(!1),r()},x=l||_;return o.jsx(ln,{isOpen:e,onClose:b,title:i,size:"lg",children:o.jsxs("div",{className:"flex flex-col h-full -mt-1",children:[o.jsx("label",{className:"block text-sm font-medium text-text-primary mb-1 flex-shrink-0",children:s}),o.jsx("p",{className:"text-sm text-text-muted mb-3 flex-shrink-0",children:c}),o.jsx("div",{className:"flex-1 min-h-[150px]",children:o.jsx("textarea",{value:p,onChange:C,placeholder:u,className:"w-full h-full px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-none focus:outline-none focus:ring-1 focus:ring-accent-primary",disabled:x})}),o.jsxs("div",{className:"flex justify-end gap-2 pt-2 mt-3 border-t border-border flex-shrink-0",children:[o.jsx(st,{variant:"secondary",onClick:b,children:"Cancel"}),o.jsx(st,{variant:"primary",onClick:v,disabled:!m||x,children:_?"Saving...":"Save"})]})]})})}function cw({isOpen:e,onClose:r,project:i}){const s=Gt(u=>u.updateProject),c=async u=>{s(i.id,{customInstructions:u||null}),await new Promise(f=>setTimeout(f,100))};return o.jsx(lw,{isOpen:e,onClose:r,title:`${i.name} Settings`,label:"Project Instructions",description:"These instructions are injected into prompts when working in this project. They are applied after global instructions but before AGENTS.md files.",placeholder:"Enter project-specific instructions...",value:i.customInstructions??"",onSave:c})}const uw={sm:"w-3 h-3",md:"w-4 h-4",lg:"w-5 h-5",xl:"w-6 h-6"};function Rs({onClick:e,className:r="",size:i="md",variant:s="default"}){const c=s==="overlay"?"bg-accent-error text-white rounded-full flex items-center justify-center hover:bg-accent-error/80 transition-colors":s==="sidebar"?"flex-shrink-0 p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors":s==="modal"?"text-text-muted hover:text-text-primary transition-colors":"hover:text-white transition-colors";return o.jsx("button",{onClick:e,className:`${c} ${r}`,title:"Close",children:o.jsx("svg",{className:uw[i],fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})}function Tb({projectId:e,isOpen:r=!0,onClose:i}){const[,s]=ar(),[c,u]=P.useState(!1),f=Ee(j=>j.sessions),l=Ee(j=>j.currentSession),d=Ee(j=>j.unreadSessionIds),p=Ee(j=>j.deleteSession),g=Ee(j=>j.deleteAllSessions),m=Ee(j=>j.loadMoreSessions),y=Ee(j=>j.sessionsHasMore),_=Ee(j=>j.sessionsPaginationLoading),k=Gt(j=>j.currentProject),C=P.useRef(null),v=P.useCallback(()=>{y&&!_&&k&&m(k.id)},[y,_,k,m]);P.useEffect(()=>{if(!C.current||!y)return;const j=new IntersectionObserver(A=>{const N=A[0];N&&N.isIntersecting&&v()},{threshold:.1});return j.observe(C.current),()=>j.disconnect()},[y,v]);const b=f.filter(j=>j.projectId===(k==null?void 0:k.id)),x=(j,A)=>{A==null||A.stopPropagation(),confirm("Delete this session?")&&(p(j),(l==null?void 0:l.id)===j&&s(`/p/${e}`))},S=()=>{confirm("Delete all sessions in this project? This cannot be undone.")&&(g(e),s(`/p/${e}`))};return o.jsxs(o.Fragment,{children:[r&&i&&o.jsx("div",{className:"md:hidden fixed inset-0 bg-black/50 z-40",onClick:i}),o.jsxs("aside",{className:`
|
|
77
|
+
${r?"md:w-[300px] md:shrink-0":"md:w-0 md:shrink-0 md:overflow-hidden"}
|
|
78
|
+
md:relative md:h-auto md:translate-x-0
|
|
79
|
+
|
|
80
|
+
fixed z-50 h-[calc(100vh-32px)]
|
|
81
|
+
w-[300px] bg-bg-secondary border-r border-border flex flex-col
|
|
82
|
+
transition-all duration-300 ease-in-out
|
|
83
|
+
${r?"translate-x-0":"-translate-x-full"}
|
|
84
|
+
`,children:[o.jsxs("div",{className:"p-4 border-b border-border flex gap-2",children:[o.jsx(Ln,{href:`/p/${e}/new`,className:"flex-1 block text-center rounded font-medium transition-colors bg-accent-primary/25 text-white hover:bg-accent-primary/40 px-3 py-1.5 text-sm","data-testid":"sidebar-new-session-button",children:"+ New Session"}),o.jsx(eo,{items:[{label:"Edit project settings",onClick:()=>u(!0)},{label:"Delete all sessions",onClick:S,danger:!0}],trigger:o.jsx("button",{className:"flex-shrink-0 p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Options",children:o.jsxs("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24",children:[o.jsx("circle",{cx:"12",cy:"5",r:"2"}),o.jsx("circle",{cx:"12",cy:"12",r:"2"}),o.jsx("circle",{cx:"12",cy:"19",r:"2"})]})})}),i&&o.jsx(Rs,{onClick:i,className:"md:hidden",variant:"sidebar",size:"md"})]}),k&&o.jsx(cw,{isOpen:c,onClose:()=>u(!1),project:k}),o.jsx("div",{className:"flex-1 overflow-y-auto",children:b.length===0?o.jsx("div",{className:"p-4 text-center text-text-muted text-xs",children:"No sessions"}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"divide-y divide-border",children:dw(b,l,d,x,e)}),_&&o.jsx("div",{className:"p-4 text-center text-text-muted text-xs",children:"Loading more..."}),o.jsx("div",{ref:C,className:"h-px"})]})})]})]})}function dw(e,r,i,s,c){const u=Nb(e);return Array.from(u).map(([f,l])=>{const d=l[0];return d?o.jsxs("div",{children:[o.jsx("div",{className:"px-4 py-2 bg-bg-tertiary/30 text-text-muted text-xs font-medium",children:Eb(d.updatedAt)}),l.map(p=>{const g=(r==null?void 0:r.id)===p.id,m=i.includes(p.id),y=p.isRunning;return o.jsx("div",{className:`w-full px-4 py-3 text-left hover:bg-bg-tertiary/50 transition-colors group ${g?"bg-bg-tertiary":""}`,children:o.jsxs(Ln,{href:`/p/${c}/s/${p.id}`,className:`block ${g?"text-accent-primary":"text-text-primary"} hover:text-accent-primary`,children:[o.jsxs("div",{className:"flex justify-between items-center mb-1",children:[o.jsx("span",{className:`font-medium truncate text-sm ${g?"text-accent-primary":"text-text-primary"}`,children:p.title??p.id.slice(0,6)}),o.jsx(eo,{items:[{label:"Delete session",onClick:_=>s(p.id,_),danger:!0}],trigger:o.jsx("button",{onClick:_=>_.preventDefault(),className:"p-1.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-all",title:"Options",children:o.jsxs("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24",children:[o.jsx("circle",{cx:"12",cy:"5",r:"2"}),o.jsx("circle",{cx:"12",cy:"12",r:"2"}),o.jsx("circle",{cx:"12",cy:"19",r:"2"})]})})})]}),o.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[y?o.jsxs("svg",{"aria-label":"Session running",className:"w-3 h-3 text-blue-400 animate-spin flex-shrink-0",viewBox:"0 0 24 24",fill:"none",children:[o.jsx("title",{children:"Running"}),o.jsx("circle",{className:"opacity-30",cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeWidth:"3"}),o.jsx("path",{d:"M21 12a9 9 0 00-9-9",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]}):m&&!g?o.jsx("span",{"aria-label":"Unread activity",title:"Unread activity",className:"w-2 h-2 rounded-full bg-amber-400 flex-shrink-0"}):null,o.jsx("span",{className:"text-text-muted text-xs flex-shrink-0",children:Gl(p.updatedAt)}),o.jsxs("span",{className:"text-text-muted text-xs flex-shrink-0",children:[p.messageCount," messages"]})]})]})},p.id)})]},f):null})}const Ox=["⠋","⠙","⠹","⠸","⠼","⠴"];function hw(){var l;const e=Gt(d=>d.currentProject),r=Ee(d=>d.currentSession),i=vb(),s=!1,c=P.useRef(0),u=P.useRef(null);P.useEffect(()=>(i?(u.current=window.setInterval(()=>{c.current=(c.current+1)%Ox.length,f()},150),f()):(u.current&&(clearInterval(u.current),u.current=null),f()),()=>{u.current&&(clearInterval(u.current),u.current=null)}),[i,e,r,s]);const f=()=>{var m;const p=(m=r==null?void 0:r.metadata)==null?void 0:m.title,g=i?`${Ox[c.current]} `:"";e&&p?document.title=`${g}${e.name} - ${p} | OpenFox`:e?document.title=`${g}${e.name} | OpenFox`:document.title=`${g}OpenFox`};return typeof window<"u"&&((l=r==null?void 0:r.metadata)!=null&&l.title)&&window.document.documentElement.setAttribute("data-session-title",r.metadata.title),null}const Vl=P.forwardRef(({className:e="",...r},i)=>o.jsx("input",{ref:i,className:`bg-bg-tertiary border border-border rounded px-3 py-2 text-text-primary placeholder-text-muted focus:outline-none focus:ring-2 focus:ring-accent-primary/50 focus:border-accent-primary ${e}`,...r}));Vl.displayName="Input";function fw({isOpen:e,onClose:r,projectName:i,onConfirm:s}){const c=()=>{s(),r()};return o.jsx(ln,{isOpen:e,onClose:r,title:"Delete Project",size:"sm",children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("p",{className:"text-text-secondary",children:["This will permanently delete the project ",o.jsx("span",{className:"font-semibold text-text-primary",children:i})," and all its sessions from OpenFox. The project files on disk will remain untouched."]}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(st,{variant:"secondary",onClick:r,children:"Cancel"}),o.jsx(st,{variant:"danger",onClick:c,children:"Delete"})]})]})})}function pw(e){return!e||e.trim()===""?{valid:!1,error:"Project name cannot be empty"}:/^[a-zA-Z0-9._-]+$/.test(e)?{valid:!0}:{valid:!1,error:"Project name can only contain letters, numbers, hyphens, underscores, and dots"}}function mw({isOpen:e,onClose:r}){const[,i]=ar(),[s,c]=P.useState(""),[u,f]=P.useState(null),[l,d]=P.useState(!1),[p,g]=P.useState(""),m=P.useRef(null);P.useEffect(()=>{e&&(Ce("/api/config").then(C=>C.json()).then(C=>{C.workdir&&g(C.workdir)}),c(""),f(null),d(!1),setTimeout(()=>{var C;(C=m.current)==null||C.focus()},100))},[e]);const y=P.useCallback(async C=>{C.preventDefault();const v=pw(s);if(!v.valid){f(v.error);return}d(!0),f(null);const b=`${p}/${s}`;try{const x=await Ce("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:s,workdir:b})});if(!x.ok){const A=await x.json().catch(()=>({}));throw new Error(A.error||"Failed to create project")}const j=(await x.json()).project;r(),i(`/p/${j.id}`)}catch(x){f(x instanceof Error?x.message:"Failed to create project"),d(!1)}},[s,i,r,p]),_=P.useCallback(()=>{c(""),f(null),r()},[r]),k=s?`${p}/${s}`:"";return o.jsx(ln,{isOpen:e,onClose:_,title:"Create New Project",size:"sm",children:o.jsxs("form",{onSubmit:y,className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{htmlFor:"project-name",className:"block text-sm font-medium text-text-secondary mb-2",children:"Project Name"}),o.jsx(Vl,{ref:m,id:"project-name",value:s,onChange:C=>{c(C.target.value),f(null)},placeholder:"my-project",disabled:l,className:"w-full"}),s&&o.jsxs("div",{className:"mt-2 text-xs text-text-muted",children:["Full path: ",o.jsx("span",{className:"font-mono",children:k})]}),u&&o.jsx("div",{className:"mt-3 p-3 bg-accent-error/10 border border-accent-error/30 rounded text-sm text-accent-error",children:u})]}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(st,{type:"button",variant:"secondary",onClick:_,disabled:l,children:"Cancel"}),o.jsx(st,{type:"submit",variant:"primary",disabled:l||!s.trim(),className:"min-w-[100px]",children:l?o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsxs("svg",{className:"animate-spin h-4 w-4",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Creating..."]}):"Create"})]})]})})}const gw={sm:"w-4 h-4",md:"w-8 h-8",lg:"w-12 h-12"};function Yl({size:e="md",className:r=""}){return o.jsx("div",{className:`animate-spin border-2 border-accent-primary border-t-transparent rounded-full ${gw[e]} ${r}`})}function xw({text:e,...r}){return o.jsxs("div",{className:"text-center",children:[o.jsx(Yl,{...r,className:"mx-auto mb-4"}),e&&o.jsx("div",{className:"text-text-secondary",children:e})]})}function Ab({onSelect:e,onClose:r,initialPath:i}){const[s,c]=P.useState(null),[u,f]=P.useState(!0),l=P.useCallback(async k=>{f(!0);try{const C=k?`/api/directories?path=${encodeURIComponent(k)}`:"/api/directories",b=await(await Ce(C)).json();c(b)}catch(C){console.error("Failed to load directories:",C)}finally{f(!1)}},[]);P.useEffect(()=>{l(i)},[i,l]);const d=k=>{l(k)},p=k=>{e(k)},m=((s==null?void 0:s.current)??"").split("/").filter(Boolean),_=m.map((k,C)=>({name:k,path:"/"+m.slice(0,C+1).join("/")}));return o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50",onClick:r,children:o.jsxs("div",{className:"bg-bg-secondary border border-border rounded-lg w-full max-w-2xl max-h-[80vh] flex flex-col",onClick:k=>k.stopPropagation(),children:[o.jsxs("div",{className:"p-4 border-b border-border flex items-center justify-between",children:[o.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:"Select Folder"}),o.jsx($l,{onClick:r,className:"hover:bg-bg-tertiary"})]}),s&&o.jsx("div",{className:"px-3 py-2 bg-bg-tertiary/30 border-b border-border",children:o.jsxs("div",{className:"flex items-center text-xs overflow-x-auto",children:[_.map((k,C)=>o.jsxs("span",{className:"flex items-center shrink-0",children:[o.jsx("span",{className:"text-text-muted",children:"/"}),o.jsx("button",{onClick:()=>d(k.path),className:`px-1 ${C===_.length-1?"text-accent-primary font-medium":"text-text-secondary hover:text-accent-primary"}`,children:k.name})]},k.path)),_.length===0&&o.jsx("button",{onClick:()=>d("/"),className:"text-text-muted hover:text-accent-primary",children:"/"})]})}),o.jsx("div",{className:"flex-1 overflow-y-auto",children:u?o.jsx("div",{className:"p-8 text-center",children:o.jsx(Yl,{size:"sm"})}):o.jsxs("div",{className:"divide-y divide-border",children:[(s==null?void 0:s.parent)&&o.jsxs("button",{onClick:()=>d(s.parent),className:"w-full p-3 flex items-center gap-3 hover:bg-bg-tertiary/50 text-text-muted",children:[o.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})}),o.jsx("span",{children:".."})]}),s==null?void 0:s.directories.map(k=>o.jsxs("div",{className:"group flex items-center gap-2 hover:bg-bg-tertiary/50",children:[o.jsxs("button",{onClick:()=>d(k.path),className:"flex-1 p-3 flex items-center gap-3 text-left",children:[o.jsx("svg",{className:"w-5 h-5 text-accent-primary",fill:"currentColor",viewBox:"0 0 24 24",children:o.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"})}),o.jsx("span",{children:k.name})]}),o.jsx("button",{onClick:()=>p(k.path),className:"px-3 py-1 text-xs bg-accent-primary/10 text-accent-primary rounded opacity-0 group-hover:opacity-100 transition-opacity mr-3",children:"Select"})]},k.path)),(s==null?void 0:s.directories.length)===0&&o.jsx("div",{className:"p-8 text-center text-text-muted text-sm",children:"No subdirectories"})]})}),o.jsxs("div",{className:"p-4 border-t border-border space-y-2",children:[(s==null?void 0:s.current)&&o.jsx("button",{onClick:()=>p(s.current),className:"w-full px-4 py-2 bg-accent-primary text-white rounded-lg font-medium hover:bg-accent-primary/90 transition-colors",children:"Select this folder"}),o.jsx("button",{onClick:r,className:"w-full text-center text-text-muted hover:text-text-secondary text-sm",children:"Cancel"})]})]})})}async function Ad(e,r){let i="/api/directories";return e?i=`/api/directories?path=${encodeURIComponent(e)}`:r&&(i=`/api/directories?path=${encodeURIComponent(r)}`),(await Ce(i)).json()}function vw({isOpen:e,onClose:r}){const[,i]=ar(),[s,c]=P.useState(!1),[u,f]=P.useState(""),[l,d]=P.useState(null),[p,g]=P.useState(!1),[m,y]=P.useState(null),_=Gt(M=>M.projects),k=Gt(M=>M.createProject),C=Gt(M=>M.listProjects),v=Gt(M=>M.deleteProject),[b,x]=P.useState(null),[S,j]=P.useState(-1),[A,N]=P.useState(null),[D,T]=P.useState(!1),I=P.useRef([]);P.useEffect(()=>{Ce("/api/config").then(M=>M.json()).then(M=>{M.workdir&&y(M.workdir)})},[]);const H=P.useCallback(async M=>{g(!0);try{const L=await Ad(M,m??void 0);d(L)}catch(L){console.error("Failed to load directories:",L)}finally{g(!1)}},[m]);P.useEffect(()=>{e&&m&&(Ad(m),C())},[e,m,H,C]);const V=(l==null?void 0:l.directories.filter(M=>u===""||M.name.toLowerCase().includes(u.toLowerCase())))??[],Y=[...l!=null&&l.parent&&!u?[{type:"parent",path:l.parent,name:".."}]:[],...V.map(M=>({type:"directory",path:M.path,name:M.name}))],q=M=>{i(`/p/${M}`),r()},O=(M,L)=>{L.stopPropagation(),N(M)},U=()=>{A&&(v(A.id),N(null))},z=M=>{const L=M.split("/").filter(Boolean).pop()??"";k(L,M),C(),x(M)};P.useEffect(()=>{if(b){const M=_.find(L=>L.workdir===b);M&&(i(`/p/${M.id}`),r(),x(null))}},[_,b,i,r]),P.useEffect(()=>{j(Y.length>0?0:-1)},[u,Y.length]);const X=M=>{f(""),Ad(M)},Q=P.useCallback(M=>{if(!e)return;if(M.key==="Escape"){r();return}if(!["ArrowDown","ArrowUp","Enter"].includes(M.key))return;const L=document.activeElement;if(!(!L||L.tagName!=="INPUT")){if(M.preventDefault(),M.key==="ArrowDown")j(B=>{const W=B+1;return W>=Y.length?0:W});else if(M.key==="ArrowUp")j(B=>{const W=B-1;return W<0?Y.length-1:W});else if(M.key==="Enter"&&S>=0&&S<Y.length){const B=Y[S];(B==null?void 0:B.type)==="parent"?X(B.path):B&&z(B.path)}}},[e,Y.length,S,X,z,r]);return P.useEffect(()=>{if(e)return document.addEventListener("keydown",Q),()=>document.removeEventListener("keydown",Q)},[e,Q]),P.useEffect(()=>{S>=0&&I.current[S]&&I.current[S].scrollIntoView({behavior:"smooth",block:"nearest"})},[S]),e?o.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50",children:[o.jsxs("div",{className:"bg-bg-secondary border border-border rounded-lg w-full max-w-[90vw] md:max-w-4xl max-h-[90vh] flex flex-col",children:[o.jsxs("div",{className:"p-4 border-b border-border flex items-center justify-between",children:[o.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:"Open Project"}),o.jsx(Rs,{onClick:r,variant:"modal",size:"lg"})]}),o.jsxs("div",{className:"flex-1 flex overflow-hidden min-h-[400px]",children:[o.jsxs("div",{className:"w-1/2 border-r border-border flex flex-col",children:[o.jsx("div",{className:"p-3 border-b border-border bg-bg-tertiary/30",children:o.jsx("h3",{className:"font-medium text-sm text-text-secondary",children:"Recent Projects"})}),o.jsx("div",{className:"flex-1 overflow-y-auto",children:_.length===0?o.jsx("div",{className:"p-4 text-center text-text-muted text-sm",children:"No recent projects"}):o.jsx("div",{className:"divide-y divide-border",children:_.map(M=>o.jsxs("div",{className:"group flex items-center gap-3 p-3 hover:bg-bg-tertiary/50 transition-colors",children:[o.jsxs("button",{onClick:()=>q(M.id),className:"flex-1 flex items-center gap-3 text-left",children:[o.jsx("svg",{className:"w-5 h-5 text-accent-primary",fill:"currentColor",viewBox:"0 0 24 24",children:o.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"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"font-medium truncate",children:M.name}),o.jsx("div",{className:"text-xs text-text-muted truncate",children:M.workdir})]})]}),o.jsx("button",{onClick:L=>O(M,L),className:"opacity-0 group-hover:opacity-100 text-accent-error/70 hover:text-accent-error p-1 transition-opacity",title:"Delete project",children:o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},M.id))})})]}),o.jsxs("div",{className:"w-1/2 flex flex-col",children:[o.jsxs("div",{className:"p-3 border-b border-border bg-bg-tertiary/30 flex items-center justify-between",children:[o.jsx("h3",{className:"font-medium text-sm text-text-secondary",children:"Browse Projects"}),o.jsx("button",{onClick:()=>T(!0),className:"text-xs text-accent-primary hover:underline",children:"Open in dialog"})]}),o.jsx("div",{className:"p-3 border-b border-border",children:o.jsx(Vl,{value:u,onChange:M=>f(M.target.value),placeholder:"Filter directories...",className:"w-full"})}),o.jsx("div",{className:"flex-1 overflow-y-auto",children:p?o.jsx("div",{className:"p-8 text-center text-text-muted",children:o.jsx("div",{className:"animate-spin w-5 h-5 border-2 border-accent-primary border-t-transparent rounded-full mx-auto"})}):Y.length===0?o.jsx("div",{className:"p-8 text-center text-text-muted text-sm",children:u?"No matching directories":"No subdirectories"}):o.jsx("div",{className:"divide-y divide-border",children:Y.map((M,L)=>o.jsxs("button",{ref:B=>{I.current[L]=B},onClick:()=>M.type==="parent"?X(M.path):z(M.path),className:`w-full p-3 flex items-center gap-3 text-left transition-colors ${L===S?"bg-accent-primary/20 text-accent-primary":"hover:bg-bg-tertiary/50"}`,children:[o.jsx("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:o.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"})}),o.jsx("span",{className:"flex-1",children:M.name})]},M.path))})})]})]}),o.jsxs("div",{className:"p-4 border-t border-border flex justify-between gap-2",children:[o.jsx(st,{variant:"secondary",onClick:()=>c(!0),children:"Create Project"}),o.jsx(st,{variant:"secondary",onClick:r,children:"Cancel"})]})]}),s&&o.jsx(mw,{isOpen:s,onClose:()=>c(!1)}),A&&o.jsx(fw,{isOpen:!0,onClose:()=>N(null),projectName:A.name,onConfirm:U}),D&&o.jsx(Ab,{initialPath:m??void 0,onSelect:M=>{z(M),T(!1)},onClose:()=>T(!1)})]}):null}function bw(){const[e,r]=P.useState(!1),i=Ee(g=>g.sessions),s=Gt(g=>g.projects),c=Gt(g=>g.listProjects),u=Ee(g=>g.listSessions),f=Ee(g=>g.connectionStatus);P.useEffect(()=>{f==="connected"&&(c(),u())},[f,c,u]);const l=[...s].sort((g,m)=>{const y=i.filter(v=>v.workdir.startsWith(g.workdir)),_=i.filter(v=>v.workdir.startsWith(m.workdir)),k=y.length>0?new Date(y.reduce((v,b)=>new Date(b.updatedAt)>new Date(v.updatedAt)?b:v).updatedAt).getTime():new Date(g.updatedAt).getTime();return(_.length>0?new Date(_.reduce((v,b)=>new Date(b.updatedAt)>new Date(v.updatedAt)?b:v).updatedAt).getTime():new Date(m.updatedAt).getTime())-k}),d=g=>{const m=s.find(y=>y.id===g);return m?i.filter(y=>y.workdir.startsWith(m.workdir)).sort((y,_)=>new Date(_.updatedAt).getTime()-new Date(y.updatedAt).getTime()).slice(0,5):[]},p=()=>{r(!0)};return o.jsxs("div",{className:"flex-1 flex flex-col overflow-y-auto",children:[o.jsxs("div",{className:"max-w-5xl mx-auto w-full p-4 md:p-8",children:[o.jsxs("div",{className:"mb-6 md:mb-8 flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-3xl font-bold text-accent-primary",children:"OpenFox"}),o.jsx("p",{className:"text-text-secondary",children:"Local LLM-powered coding assistant with contract-driven execution"})]}),o.jsx(st,{variant:"primary",onClick:p,children:"Open Project"})]}),l.map(g=>{const m=d(g.id);return o.jsx("div",{className:"mb-6 md:mb-8",children:o.jsxs("div",{className:"bg-bg-secondary border border-border rounded-lg overflow-hidden",children:[o.jsxs("div",{className:"p-3 md:p-4 border-b border-border flex items-center justify-between gap-2",children:[o.jsxs(Ln,{href:`/p/${g.id}`,className:"flex items-center gap-2 cursor-pointer hover:opacity-80 transition-opacity flex-1",children:[o.jsx("svg",{className:"w-5 h-5 text-accent-primary flex-shrink-0",fill:"currentColor",viewBox:"0 0 24 24",children:o.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"})}),o.jsx("span",{className:"text-text-primary font-semibold",children:g.name})]}),o.jsx(Ln,{href:`/p/${g.id}/new`,className:"rounded font-medium transition-colors bg-accent-primary/25 text-white hover:bg-accent-primary/40 px-1.5 py-1 text-xs",children:"+ New Session"})]}),o.jsx("div",{className:"divide-y divide-border",children:m.length>0?m.map(y=>{const _=s.find(C=>y.workdir.startsWith(C.workdir)),k=_?`/p/${_.id}/s/${y.id}`:"#";return o.jsx(Ln,{href:k,className:"block p-3 md:p-4 hover:bg-bg-tertiary/50 cursor-pointer transition-colors",children:o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:o.jsx("div",{className:"flex-1 min-w-0",children:o.jsx("div",{className:"text-sm text-text-muted truncate",children:y.title??y.id.slice(0,8)})})}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[o.jsx("span",{className:"text-text-muted text-xs",children:tw(y.updatedAt)}),o.jsxs("span",{className:"text-text-muted text-xs",children:[y.messageCount," msgs"]})]})]})},y.id)}):o.jsx("div",{className:"p-3 md:p-4 text-text-muted text-sm",children:"No sessions yet"})})]})},g.id)}),l.length===0&&o.jsx("div",{className:"text-center py-12 text-text-muted",children:"No projects yet. Open a project to get started."})]}),e&&o.jsx(vw,{isOpen:e,onClose:()=>r(!1)})]})}function yw(){const[,e]=bh("/p/:projectId/new"),[,r]=ar(),i=e==null?void 0:e.projectId,s=Ee(c=>c.createSession);return P.useEffect(()=>{i&&(async()=>{const u=await s(i);r(u?`/p/${i}/s/${u.id}`:`/p/${i}`)})()},[i,s,r]),o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Yl,{})})}function _w(){const e=Gt(r=>r.currentProject);return o.jsx("div",{className:"h-full flex flex-col items-center justify-center p-8 text-center",children:o.jsxs("div",{className:"max-w-md",children:[o.jsx("h2",{className:"text-xl font-semibold text-text-primary mb-2",children:(e==null?void 0:e.name)??"Project"}),o.jsx("p",{className:"text-text-secondary mb-6",children:"No session selected"}),o.jsxs("div",{className:"flex flex-col gap-3",children:[e&&o.jsx(Ln,{href:`/p/${e.id}/new`,className:"block w-full rounded font-medium transition-colors bg-accent-primary/25 text-white hover:bg-accent-primary/40 px-3 py-2 text-center",children:"Create New Session"}),o.jsx("p",{className:"text-sm text-text-muted",children:"Or select an existing session from the sidebar"})]})]})})}const La=e=>Math.round(e*10)/10;function eh(e){return{providerId:e.providerId,providerName:e.providerName,backend:e.backend,model:e.model}}function Sw(e){return`${e.providerId}::${e.model}`}function ww(e){return`${e.providerName} > ${e.model}`}function Bx(e){let r=0,i=0,s=0,c=0,u=0,f=0;const l=[],d=[];let p=0;for(const[y,_]of e.entries()){const k=_.stats,C=eh(k);r+=k.totalTime,i+=k.toolTime,s+=k.prefillTokens,c+=k.generationTokens;const v=k.prefillSpeed>0?k.prefillTokens/k.prefillSpeed:0,b=k.generationSpeed>0?k.generationTokens/k.generationSpeed:0;u+=v,f+=b,l.push({messageId:_.id,timestamp:_.timestamp,...C,mode:k.mode,responseIndex:y+1,prefillTokens:k.prefillTokens,generationTokens:k.generationTokens,prefillSpeed:k.prefillSpeed,generationSpeed:k.generationSpeed,totalTime:k.totalTime,aiTime:k.totalTime-k.toolTime,toolTime:k.toolTime});const x=k.llmCalls??[];for(const S of x)p+=1,d.push({messageId:_.id,timestamp:S.timestamp??_.timestamp,providerId:S.providerId,providerName:S.providerName,backend:S.backend,model:S.model,mode:k.mode,responseIndex:y+1,sessionCallIndex:p,callIndex:S.callIndex,promptTokens:S.promptTokens,completionTokens:S.completionTokens,ttft:S.ttft,completionTime:S.completionTime,prefillSpeed:S.prefillSpeed,generationSpeed:S.generationSpeed,totalTime:S.totalTime})}const g=u>0?La(s/u):0,m=f>0?La(c/f):0;return{totalTime:La(r),aiTime:La(r-i),toolTime:La(i),prefillTokens:s,generationTokens:c,avgPrefillSpeed:g,avgGenerationSpeed:m,responseCount:e.length,llmCallCount:d.length,dataPoints:l,callDataPoints:d}}function Cw(e){const r=e.filter(c=>c.stats!==void 0&&c.stats!==null).sort((c,u)=>new Date(c.timestamp).getTime()-new Date(u.timestamp).getTime());if(r.length===0)return null;const i=new Map;for(const c of r){const u=Sw(eh(c.stats)),f=i.get(u)??[];i.set(u,[...f,c])}const s=Array.from(i.entries()).map(([c,u])=>{const f=eh(u[0].stats),l=Bx(u);return{...f,key:c,label:ww(f),...l}});return{...Bx(r),modelGroups:s}}function kw(e){return P.useMemo(()=>Cw(e),[e])}function Ew(e){const[r,i]=P.useState(null),[s,c]=P.useState(!0),[u,f]=P.useState(null),l=e||"";return P.useEffect(()=>{if(!l){c(!1);return}let d=!0,p=null;const g=async()=>{try{const y=await(await Ce(`/api/branch?workdir=${encodeURIComponent(l)}`)).json();d&&(i(y.branch),f(y.error||null),c(!1))}catch(m){d&&(f(m instanceof Error?m.message:"Failed to fetch branch"),c(!1))}};return g(),p=setInterval(g,3e3),()=>{d=!1,p&&clearInterval(p)}},[l]),{branch:r,loading:s,error:u}}function Ll(e){return e.toLocaleString("en-US").replace(/,/g," ")}function Ix(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function jw(e){if(e<60)return`${e.toFixed(1)}s`;const r=Math.floor(e/60),i=Math.round(e%60);return`${r}m${i}s`}const Nw="modulepreload",Tw=function(e){return"/"+e},zx={},Aw=function(r,i,s){let c=Promise.resolve();if(i&&i.length>0){let f=function(p){return Promise.all(p.map(g=>Promise.resolve(g).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),d=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));c=f(i.map(p=>{if(p=Tw(p),p in zx)return;zx[p]=!0;const g=p.endsWith(".css"),m=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${m}`))return;const y=document.createElement("link");if(y.rel=g?"stylesheet":Nw,g||(y.as="script"),y.crossOrigin="",y.href=p,d&&y.setAttribute("nonce",d),document.head.appendChild(y),g)return new Promise((_,k)=>{y.addEventListener("load",_),y.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${p}`)))})}))}function u(f){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=f,window.dispatchEvent(l),!l.defaultPrevented)throw f}return c.then(f=>{for(const l of f||[])l.status==="rejected"&&u(l.reason);return r().catch(u)})},Hx=["▁","▂","▃","▄","▅","▆","▇","█"];function Dw(e,r,i){if(i===r)return 4;const s=(e-r)/(i-r);return Math.min(7,Math.max(0,Math.round(s*7)))}function Lw(e,r){if(e===r){const c=Math.max(Math.abs(e)*.05,1);return{minY:e-c,maxY:r+c}}const i=r-e,s=Math.max(i*.1,.1);return{minY:e-s,maxY:r+s}}function Rw(e,r){if(e.length===0||r<=0)return{blocks:"",minX:0,maxX:0,minY:0,maxY:0};const i=[...e].sort((m,y)=>m.x-y.x),s=i[0].x,c=i[i.length-1].x,u=Math.min(...i.map(m=>m.y)),f=Math.max(...i.map(m=>m.y)),{minY:l,maxY:d}=Lw(u,f),p=Array.from({length:r},()=>" "),g=new Map;for(const m of i){const y=c===s?0:Math.round((m.x-s)/(c-s)*(r-1)),_=g.get(y)??[];g.set(y,[..._,m.y])}for(const[m,y]of g){const _=Math.max(...y);p[m]=Hx[Dw(_,l,d)]??Hx[0]}return{blocks:p.join(""),minX:s,maxX:c,minY:l,maxY:d}}function Px(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function Fx({data:e,width:r=60,height:i=78,label:s,xLabel:c,yLabel:u,showAxes:f=!0,formatY:l=Px,formatX:d=Px}){const p=P.useMemo(()=>{const g=Rw(e,r),m=Math.max(r*6,240),y=10,_=8,C=[...e].sort((S,j)=>S.x-j.x).map(S=>{const j=g.maxX===g.minX?m/2:y+(S.x-g.minX)/(g.maxX-g.minX)*(m-y*2),A=g.maxY===g.minY?i/2:_+(g.maxY-S.y)/(g.maxY-g.minY)*(i-_*2);return{...S,cx:j,cy:A,leftPercent:j/m*100,topPercent:A/i*100}}),v=C.map((S,j)=>`${j===0?"M":"L"} ${S.cx.toFixed(1)} ${S.cy.toFixed(1)}`).join(" "),x=[g.maxY,(g.maxY+g.minY)/2,g.minY].map(S=>({value:S,y:g.maxY===g.minY?i/2:_+(g.maxY-S)/(g.maxY-g.minY)*(i-_*2)}));return{...g,chartWidth:m,points:C,path:v,gridLines:x}},[e,i,r]);return e.length===0?o.jsxs("div",{className:"font-mono text-text-muted text-xs",children:[s&&o.jsx("div",{className:"mb-1",children:s}),o.jsx("div",{children:"No data"})]}):o.jsxs("div",{className:"font-mono text-xs",children:[s&&o.jsx("div",{className:"text-text-secondary mb-2",children:s}),o.jsxs("div",{className:"flex gap-3",children:[f&&o.jsx("div",{className:"w-12 h-[78px] flex flex-col justify-between text-right text-text-muted",children:p.gridLines.map(g=>o.jsx("span",{children:l(g.value)},`${g.value}-${g.y}`))}),o.jsx("div",{className:"flex-1 min-w-0",children:o.jsxs("div",{className:"relative h-[78px]",children:[o.jsxs("svg",{viewBox:`0 0 ${p.chartWidth} ${i}`,className:"w-full h-[78px] overflow-visible",preserveAspectRatio:"none","aria-hidden":"true",children:[p.gridLines.map(g=>o.jsx("line",{x1:"0",x2:p.chartWidth,y1:g.y,y2:g.y,stroke:"currentColor",strokeDasharray:"3 4",className:"text-border/60"},`grid-${g.y}`)),p.points.map(g=>o.jsx("line",{x1:g.cx,x2:g.cx,y1:i-4,y2:g.cy,stroke:"currentColor",className:"text-border/40"},`guide-${g.cx}-${g.cy}`)),p.points.length>1&&o.jsx("path",{d:p.path,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-accent-primary/45"})]}),p.points.map(g=>o.jsx("div",{className:"absolute -translate-x-1/2 -translate-y-1/2",style:{left:`${g.leftPercent}%`,top:`${g.topPercent}%`},title:`${d(g.x)} -> ${l(g.y)}`,children:o.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-accent-primary/20 flex items-center justify-center",children:o.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-accent-primary"})})},`point-${g.x}-${g.y}`))]})})]}),f&&o.jsxs("div",{className:"flex items-start gap-3 text-text-muted mt-1",children:[o.jsx("span",{className:"w-12"}),o.jsxs("span",{className:"flex-1 flex justify-between",children:[o.jsx("span",{children:d(p.minX)}),o.jsx("span",{children:c}),o.jsx("span",{children:d(p.maxX)})]})]}),u&&f&&o.jsx("div",{className:"text-text-muted mt-1 text-center",children:u})]})}function Mw({data:e,prefillLabel:r="Prefill Speed (tok/s) by Response",generationLabel:i="Generation Speed (tok/s) by Response",xLabel:s="response",width:c=60}){const u=e.map(l=>({x:l.x,y:l.ppSpeed})),f=e.map(l=>({x:l.x,y:l.tgSpeed}));return o.jsxs("div",{className:"space-y-5",children:[o.jsx(Fx,{data:u,width:c,label:r,xLabel:s}),o.jsx(Fx,{data:f,width:c,label:i,xLabel:s})]})}function Ow(e){const r=new Map;for(const i of e.callDataPoints){const s=r.get(i.messageId)??[];r.set(i.messageId,[...s,i])}return e.dataPoints.map(i=>{const s=[...r.get(i.messageId)??[]].sort((c,u)=>c.callIndex-u.callIndex);return{...i,callCount:s.length,calls:s,isExpandable:s.length>1}})}function Bw(e){return{mode:"responses",xLabel:"response",prefillLabel:"Prefill Speed (tok/s) by Response",generationLabel:"Generation Speed (tok/s) by Response",points:e.dataPoints.map(r=>({x:r.responseIndex,ppSpeed:r.prefillSpeed,tgSpeed:r.generationSpeed}))}}function Iw(e){return{mode:"calls",xLabel:"context",prefillLabel:"Prefill Speed (tok/s) vs Context",generationLabel:"Generation Speed (tok/s) vs Context",points:e.callDataPoints.map(r=>({x:r.promptTokens,ppSpeed:r.prefillSpeed,tgSpeed:r.generationSpeed}))}}function zw(e){return e.callDataPoints.length>0?Iw(e):Bw(e)}function Dd(e){if(e<60)return`${e.toFixed(1)}s`;const r=Math.floor(e/60),i=e%60;return`${r}m ${i.toFixed(0)}s`}function Di(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toString()}function Ha(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function Hw(e){if(e.length===0)return"0 ctx";const r=Math.min(...e),i=Math.max(...e);return r===i?`${Di(r)} ctx`:`${Di(r)}-${Di(i)} ctx`}function Rl(e){return`${Ha(e)} t/s`}function Db(e){try{return new Date(e).toLocaleTimeString("en-US",{hour12:!1})}catch{return e}}function Pw(e){return{exportedAt:new Date().toISOString(),providerId:e.providerId,providerName:e.providerName,backend:e.backend,model:e.model,label:e.label,summary:{totalTime:e.totalTime,aiTime:e.aiTime,toolTime:e.toolTime,prefillTokens:e.prefillTokens,generationTokens:e.generationTokens,avgPrefillSpeed:e.avgPrefillSpeed,avgGenerationSpeed:e.avgGenerationSpeed,responseCount:e.responseCount,llmCallCount:e.llmCallCount},responses:e.dataPoints.map(r=>({responseIndex:r.responseIndex,timestamp:r.timestamp,mode:r.mode,prefillTokens:r.prefillTokens,generationTokens:r.generationTokens,prefillSpeed:r.prefillSpeed,generationSpeed:r.generationSpeed,totalTime:r.totalTime,aiTime:r.aiTime,toolTime:r.toolTime})),llmCalls:e.callDataPoints.map(r=>({sessionCallIndex:r.sessionCallIndex,responseIndex:r.responseIndex,callIndex:r.callIndex,timestamp:r.timestamp,mode:r.mode,promptTokens:r.promptTokens,completionTokens:r.completionTokens,ttft:r.ttft,completionTime:r.completionTime,prefillSpeed:r.prefillSpeed,generationSpeed:r.generationSpeed,totalTime:r.totalTime}))}}function Fw({isOpen:e,onClose:r,stats:i}){const s=P.useRef(null),[c,u]=P.useState({}),[f,l]=P.useState(()=>{var k;return((k=i.modelGroups[0])==null?void 0:k.key)??""});P.useEffect(()=>{var k;i.modelGroups.some(C=>C.key===f)||l(((k=i.modelGroups[0])==null?void 0:k.key)??"")},[f,i.modelGroups]);const d=P.useMemo(()=>i.modelGroups.find(k=>k.key===f)??i.modelGroups[0],[f,i.modelGroups]),p=P.useMemo(()=>d?Ow(d):[],[d]),g=P.useMemo(()=>d?zw(d):{mode:"responses",xLabel:"response",prefillLabel:"",generationLabel:"",points:[]},[d]),m=P.useCallback(k=>{u(C=>({...C,[k]:!C[k]}))},[]),y=P.useCallback(()=>{if(!d)return;const k=Pw(d);navigator.clipboard.writeText(JSON.stringify(k,null,2)).catch(C=>console.error("Failed to copy:",C))},[d]),_=P.useCallback(async()=>{if(s.current)try{const k=(await Aw(async()=>{const{default:b}=await import("./html2canvas.esm-QH1iLAAe.js");return{default:b}},[])).default,C=await k(s.current,{backgroundColor:"#1a1a1a",scale:2}),v=document.createElement("a");v.download=`openfox-stats-${new Date().toISOString().slice(0,10)}.png`,v.href=C.toDataURL("image/png"),v.click()}catch(k){console.error("Failed to export PNG:",k),y()}},[y]);return o.jsx(ln,{isOpen:e,onClose:r,title:"Session Stats",size:"lg",children:o.jsxs("div",{ref:s,className:"space-y-6",children:[o.jsx("section",{children:o.jsx("div",{className:"flex flex-wrap gap-2",children:i.modelGroups.map(k=>o.jsx("button",{onClick:()=>l(k.key),className:`px-3 py-1.5 rounded border text-xs transition-colors ${k.key===(d==null?void 0:d.key)?"border-accent-primary bg-accent-primary/10 text-accent-primary":"border-border text-text-muted hover:text-text-primary hover:bg-bg-tertiary/40"}`,title:k.label,children:k.label},k.key))})}),d&&o.jsxs("section",{children:[o.jsx("h3",{className:"text-sm font-semibold text-text-secondary mb-3 uppercase tracking-wide",children:"Summary"}),o.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:[o.jsx(jr,{label:"AI Time",value:Dd(d.aiTime)}),o.jsx(jr,{label:"Total Time",value:Dd(d.totalTime)}),o.jsx(jr,{label:"Tool Time",value:Dd(d.toolTime)}),o.jsx(jr,{label:"Responses",value:d.responseCount.toString()}),o.jsx(jr,{label:"LLM Calls",value:d.llmCallCount.toString()})]}),o.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mt-3",children:[o.jsx(jr,{label:"Prefill Tokens",value:Di(d.prefillTokens),subValue:`@ ${Ha(d.avgPrefillSpeed)} tok/s`}),o.jsx(jr,{label:"Gen Tokens",value:Di(d.generationTokens),subValue:`@ ${Ha(d.avgGenerationSpeed)} tok/s`}),o.jsx(jr,{label:"Avg PP Speed",value:`${Ha(d.avgPrefillSpeed)}`,subValue:"tok/s"}),o.jsx(jr,{label:"Avg TG Speed",value:`${Ha(d.avgGenerationSpeed)}`,subValue:"tok/s"})]})]}),d&&g.points.length>1&&o.jsxs("section",{children:[o.jsxs("div",{className:"flex items-center justify-between mb-3",children:[o.jsx("h3",{className:"text-sm font-semibold text-text-secondary uppercase tracking-wide",children:"Performance Progression"}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{onClick:y,className:"px-2 py-1 text-xs text-text-muted hover:text-text-primary hover:bg-bg-tertiary rounded transition-colors",children:"Copy JSON"}),o.jsx("button",{onClick:_,className:"px-2 py-1 text-xs text-text-muted hover:text-text-primary hover:bg-bg-tertiary rounded transition-colors",children:"Save PNG"})]})]}),o.jsx("div",{className:"bg-bg-tertiary/50 rounded p-4",children:o.jsx(Mw,{data:g.points,width:50,prefillLabel:g.prefillLabel,generationLabel:g.generationLabel,xLabel:g.xLabel})})]}),d&&o.jsxs("section",{children:[o.jsxs("h3",{className:"text-sm font-semibold text-text-secondary mb-3 uppercase tracking-wide",children:["Response Log (",d.responseCount," responses)"]}),o.jsx("div",{className:"overflow-y-auto bg-bg-tertiary/30 rounded",children:o.jsxs("table",{className:"w-full table-fixed border-separate border-spacing-0 text-xs",children:[o.jsxs("colgroup",{children:[o.jsx("col",{className:"w-[7%]"}),o.jsx("col",{className:"w-[14%]"}),o.jsx("col",{className:"w-[10%]"}),o.jsx("col",{className:"w-[14%]"}),o.jsx("col",{className:"w-[14%]"}),o.jsx("col",{className:"w-[14%]"}),o.jsx("col",{className:"w-[11%]"}),o.jsx("col",{className:"w-[2%]"})]}),o.jsx("thead",{children:o.jsxs("tr",{className:"text-[10px] uppercase tracking-wide text-text-muted/80",children:[o.jsx("th",{className:"px-3 py-2 text-center font-medium",children:"#"}),o.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"At"}),o.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"Time"}),o.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"Context"}),o.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"PP t/s"}),o.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"TG t/s"}),o.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"Calls"}),o.jsx("th",{className:"px-2 py-2"})]})}),o.jsx("tbody",{children:p.map((k,C)=>o.jsxs(P.Fragment,{children:[o.jsx(Uw,{row:k,index:C,isExpanded:c[k.messageId]??!1,onToggle:k.isExpandable?()=>m(k.messageId):void 0}),(c[k.messageId]??!1)&&k.calls.map((v,b)=>o.jsx($w,{dataPoint:v,index:b},`${v.messageId}-${v.callIndex}`))]},k.messageId))})]})})]})]})})}function jr({label:e,value:r,subValue:i}){return o.jsxs("div",{className:"bg-bg-tertiary/50 rounded p-3",children:[o.jsx("div",{className:"text-text-muted text-xs mb-1",children:e}),o.jsx("div",{className:"text-text-primary text-lg font-semibold",children:r}),i&&o.jsx("div",{className:"text-text-muted text-xs",children:i})]})}function Uw({row:e,index:r,isExpanded:i,onToggle:s}){const c=e.calls.length>0?Hw(e.calls.map(u=>u.promptTokens)):`${Di(e.prefillTokens)} ctx`;return o.jsxs("tr",{onClick:s,className:`${r%2===0?"bg-bg-tertiary/20":""} ${s?"cursor-pointer hover:bg-bg-tertiary/35 transition-colors":""}`,children:[o.jsx("td",{className:"px-3 py-2 text-center text-text-muted align-middle",children:e.responseIndex}),o.jsx("td",{className:"px-2 py-2 text-center text-text-muted font-mono align-middle whitespace-nowrap",children:Db(e.timestamp)}),o.jsxs("td",{className:"px-2 py-2 text-center text-text-muted align-middle whitespace-nowrap",children:[e.totalTime.toFixed(1),"s"]}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:c.replace(/ ctx$/,"")}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Rl(e.prefillSpeed)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Rl(e.generationSpeed)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-muted font-mono align-middle whitespace-nowrap",children:e.callCount}),o.jsx("td",{className:"px-2 py-2 text-center text-text-muted align-middle whitespace-nowrap",children:e.isExpandable?i?"v":">":""})]})}function $w({dataPoint:e,index:r}){return o.jsxs("tr",{className:`${r%2===0?"bg-bg-tertiary/10":"bg-bg-tertiary/5"}`,children:[o.jsxs("td",{className:"px-3 py-2 pl-6 text-center text-text-muted align-middle border-l border-border/60",children:["c",e.callIndex]}),o.jsx("td",{className:"px-2 py-2 text-center text-text-muted font-mono align-middle whitespace-nowrap",children:Db(e.timestamp)}),o.jsxs("td",{className:"px-2 py-2 text-center text-text-muted align-middle whitespace-nowrap",children:[e.totalTime.toFixed(1),"s"]}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Di(e.promptTokens)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Rl(e.prefillSpeed)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Rl(e.generationSpeed)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-muted font-mono align-middle whitespace-nowrap",children:e.callIndex}),o.jsx("td",{className:"px-2 py-2"})]})}const qw={pending:{icon:"○",color:"text-text-muted",label:"Pending"},in_progress:{icon:"●",color:"text-accent-warning",label:"In Progress",animate:!0},completed:{icon:"◉",color:"text-purple-400",label:"Completed"},passed:{icon:"✓",color:"text-accent-success",label:"Passed"},failed:{icon:"✗",color:"text-accent-error",label:"Failed"}},Ww=P.memo(function({criteria:r}){if(r.length===0)return o.jsx("div",{className:"text-text-muted text-sm text-center py-2",children:"No criteria yet"});const i={pending:0,in_progress:0,completed:0,passed:0,failed:0};for(const c of r){const u=c.status.type;u in i&&i[u]++}const s=Object.keys(i).filter(c=>i[c]>0);return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[o.jsx("span",{className:"font-semibold text-text-primary",children:"Total:"}),o.jsx("span",{className:"text-text-secondary",children:r.length})]}),o.jsx("div",{className:"space-y-1",children:s.map(c=>{const u=qw[c];return o.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[o.jsx("span",{className:`${u.color} ${u.animate?"animate-pulse":""} text-sm leading-tight`,children:u.icon}),o.jsxs("span",{className:"text-text-muted",children:[u.label,":"]}),o.jsx("span",{className:"text-text-primary font-medium",children:i[c]})]},c)})})]})});function Gw({isOpen:e,onClose:r}){const i=ir(_=>_.config),s=ir(_=>_.saveConfig),[c,u]=P.useState(""),[f,l]=P.useState(""),[d,p]=P.useState(!1),[g,m]=P.useState(!1);P.useEffect(()=>{e&&(u((i==null?void 0:i.command)??""),l((i==null?void 0:i.url)??""),p((i==null?void 0:i.hotReload)??!1))},[e,i]);const y=async()=>{!c.trim()||!f.trim()||(m(!0),await s({command:c.trim(),url:f.trim(),hotReload:d}),m(!1),r())};return o.jsx(ln,{isOpen:e,onClose:r,title:"Dev Server Config",size:"sm",children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Command"}),o.jsx("input",{className:"input w-full",type:"text",value:c,onChange:_=>u(_.target.value),placeholder:"npm run dev"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Dev URL"}),o.jsx("input",{className:"input w-full",type:"text",value:f,onChange:_=>l(_.target.value),placeholder:"http://localhost:3000"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("input",{type:"checkbox",id:"hotReload",checked:d,onChange:_=>p(_.target.checked),className:"rounded border-border bg-bg-tertiary"}),o.jsx("label",{htmlFor:"hotReload",className:"text-xs text-text-secondary",children:"Hot Reload"})]}),o.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[o.jsx("button",{className:"btn btn-secondary",onClick:r,children:"Cancel"}),o.jsx("button",{className:"btn btn-primary",onClick:y,disabled:g||!c.trim()||!f.trim(),children:g?"Saving...":"Save"})]})]})})}const Ux={30:"text-black",31:"text-red-400",32:"text-accent-success",33:"text-accent-warning",34:"text-blue-400",35:"text-purple-400",36:"text-cyan-400",37:"text-gray-300",90:"text-gray-500",91:"text-red-500",92:"text-green-500",93:"text-yellow-400",94:"text-blue-500",95:"text-pink-400",96:"text-cyan-500",97:"text-white"},Vw={40:"bg-black",41:"bg-red-900",42:"bg-green-900",43:"bg-yellow-900",44:"bg-blue-900",45:"bg-purple-900",46:"bg-cyan-900",47:"bg-gray-700"},$x={1:"font-bold",2:"opacity-75",4:"underline",7:"bg-bg-secondary"},Yw="text-text-primary";function Kw(e){const r=[],i=/\x1b\[([0-9;]+)m/g;let s=0,c="text-text-primary",u;try{for(;(u=i.exec(e))!==null;){if(u.index>s){const p=e.slice(s,u.index);p&&r.push({text:p,className:c})}const f=u[1];if(!f)continue;const l=f.split(";").map(Number);if(l.length===0||l[0]===0){c="text-text-primary";continue}const d=[];for(const p of l)if(p>=30&&p<=37){const g=Ux[p];g&&d.push(g)}else if(p>=40&&p<=47){const g=Vw[p];g&&d.push(g)}else if(p>=90&&p<=97){const g=Ux[p];g&&d.push(g)}else if(p in $x){const g=$x[p];g&&d.push(g)}else p===39?d.push(Yw):p===49&&(c=c.split(" ").filter(g=>!g.startsWith("bg-")).join(" "));d.length>0&&(c=d.join(" ")),s=i.lastIndex}if(s<e.length){const f=e.slice(s);f&&r.push({text:f,className:c})}return r}catch(f){return console.warn("ANSI parsing failed, stripping codes:",f),[{text:Xw(e),className:"text-text-primary"}]}}function Xw(e){return e.replace(/\x1b\[([0-9;]+)m/g,"")}function Ga(e){var i,s;const r=Kw(e);return r.length===1&&((i=r[0])==null?void 0:i.className)==="text-text-primary"?(s=r[0])==null?void 0:s.text:r.map((c,u)=>dn.createElement("span",{key:u,className:c.className},c.text))}const Lb=P.memo(function({title:r,logs:i,onClose:s,preClassName:c="flex-1 overflow-auto p-4 text-sm font-mono text-text-primary"}){const u=P.useRef(null);return P.useEffect(()=>{const f=l=>{l.key==="Escape"&&s()};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[s]),P.useEffect(()=>{u.current&&(u.current.scrollTop=u.current.scrollHeight)},[i]),o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:s,children:o.jsxs("div",{className:"relative w-[90vw] h-[90vh] bg-bg-primary rounded-lg border border-border flex flex-col",onClick:f=>f.stopPropagation(),children:[o.jsxs("div",{className:"flex items-center justify-between p-3 border-b border-border",children:[o.jsx("h3",{className:"text-sm font-semibold text-text-primary truncate",children:r}),o.jsx("button",{onClick:s,className:"p-1.5 rounded hover:bg-bg-tertiary transition-colors text-text-muted",children:o.jsx("svg",{className:"w-5 h-5",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]}),o.jsx("pre",{ref:u,className:c,children:i.length===0?o.jsx("span",{className:"text-text-muted",children:"No output yet"}):i.map((f,l)=>o.jsx("span",{className:f.stream==="stderr"?"text-accent-warning":"",children:Ga(f.content)},l))})]})})}),Zw=P.memo(function({logs:r,anchorRef:i,isHiding:s,onExpand:c,onClose:u}){const[f,l]=P.useState(null),d=P.useRef(null);return P.useEffect(()=>{var g;const p=(g=i.current)==null?void 0:g.getBoundingClientRect();p&&l({bottom:window.innerHeight-p.bottom,right:window.innerWidth-p.right,width:p.width,height:p.height})},[i]),P.useEffect(()=>{d.current&&(d.current.scrollTop=d.current.scrollHeight)},[r]),f?o.jsxs("div",{className:"relative",children:[o.jsx("pre",{ref:d,className:"fixed z-50 text-sm font-mono text-text-primary bg-bg-primary p-2 rounded border border-border overflow-auto transition-all duration-150 ease-out select-text",style:{bottom:f.bottom,right:f.right,width:f.width*2,maxHeight:f.height*3,transformOrigin:"bottom right",transform:s?"scale(0.01)":"scale(1)",opacity:s?0:1},children:r.map((p,g)=>o.jsx("span",{className:p.stream==="stderr"?"text-accent-warning":"",children:Ga(p.content)},g))}),o.jsx("button",{onClick:()=>{u(),c()},className:"fixed z-50 px-2 py-1 rounded text-xs font-medium bg-accent-primary/30 text-white hover:bg-accent-primary/50 transition-colors duration-150",style:{bottom:f.bottom+8,right:f.right+8},children:"Expand"})]}):null}),Qw=P.memo(function({workdir:r}){const i=ir(H=>H.setWorkdir),s=ir(H=>H.status),c=ir(H=>H.config),u=ir(H=>H.logs),f=ir(H=>H.start),l=ir(H=>H.stop),d=ir(H=>H.fetchLogs),[p,g]=P.useState(!1),[m,y]=P.useState(!1),[_,k]=P.useState(!1),[C,v]=P.useState(!1),b=P.useRef(null),x=P.useRef(null),S=P.useRef(null),j=P.useRef(null),A=(s==null?void 0:s.state)??"off",N=c!==null,D=A==="running"||A==="warning";P.useEffect(()=>{i(r??null)},[r,i]),P.useEffect(()=>{D&&d()},[D,d]),P.useEffect(()=>{S.current&&D&&(S.current.scrollTop=S.current.scrollHeight)},[u,D]);const T=()=>{D?l():f()},I=o.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 16 16",fill:"currentColor",children:o.jsx("path",{d:"M8 0a8.2 8.2 0 0 1 .701.031C9.444.095 9.99.645 10.16 1.29l.288 1.107c.018.066.079.158.212.224.231.114.454.243.668.386.123.082.233.09.299.071l1.1-.303c.652-.18 1.37.008 1.755.653a8.043 8.043 0 0 1 .683 1.18c.227.568.096 1.26-.378 1.726l-.812.804a.312.312 0 0 0-.081.283c.024.166.04.335.04.507s-.016.341-.04.507a.312.312 0 0 0 .08.283l.813.804c.474.466.605 1.158.378 1.726a8.07 8.07 0 0 1-.683 1.18c-.385.645-1.103.833-1.755.653l-1.1-.303c-.066-.019-.176-.011-.299.071a5.1 5.1 0 0 1-.668.386c-.133.066-.194.158-.211.224l-.29 1.107c-.168.645-.714 1.196-1.458 1.26a8.094 8.094 0 0 1-1.402 0c-.744-.064-1.29-.615-1.458-1.26l-.29-1.107a.426.426 0 0 0-.211-.224 5.11 5.11 0 0 1-.668-.386c-.123-.082-.233-.09-.299-.071l-1.1.303c-.652.18-1.37-.008-1.755-.653a8.044 8.044 0 0 1-.683-1.18c-.227-.568-.096-1.26.378-1.726l.812-.804a.312.312 0 0 0 .081-.283A5.18 5.18 0 0 1 2.3 8c0-.172.016-.341.04-.507a.312.312 0 0 0-.08-.283l-.813-.804C.973 5.94.842 5.248 1.069 4.68c.181-.452.395-.882.683-1.18.385-.645 1.103-.833 1.755-.653l1.1.303c.066.019.176.011.299-.071.214-.143.437-.272.668-.386a.426.426 0 0 0 .211-.224l.29-1.107C6.009.645 6.556.095 7.299.03 7.53.01 7.764 0 8 0Zm0 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5Z"})});return o.jsxs("div",{className:"mt-2 pt-3 border-t border-border space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:`inline-block w-2.5 h-2.5 rounded-full flex-shrink-0 ${A==="running"?"bg-accent-success":A==="warning"?"bg-accent-warning":A==="error"?"bg-accent-error":"bg-text-muted"}`}),o.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Dev Server"})]}),o.jsx("button",{onClick:()=>g(!0),className:"p-1.5 rounded hover:bg-bg-tertiary transition-colors text-text-muted",title:"Configure dev server",children:I})]}),N?o.jsxs(o.Fragment,{children:[A==="running"||A==="warning"?o.jsxs("div",{className:"flex gap-2",children:[o.jsxs("button",{onClick:T,className:"flex-1 flex items-center justify-center gap-1.5 rounded font-medium text-sm px-3 py-1.5 bg-bg-tertiary text-text-primary hover:bg-border transition-colors",children:[o.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 16 16",fill:"currentColor",children:o.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1"})}),"Stop"]}),(s==null?void 0:s.url)&&o.jsxs("a",{href:s.url,target:"_blank",rel:"noopener noreferrer",className:"flex-1 flex items-center justify-center gap-1.5 rounded font-medium text-sm px-3 py-1.5 bg-accent-primary/25 text-white hover:bg-accent-primary/40 transition-colors",title:s.url,children:[o.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M6.5 3.5H3a1 1 0 0 0-1 1V13a1 1 0 0 0 1 1h8.5a1 1 0 0 0 1-1V9.5"}),o.jsx("path",{d:"M9.5 2h4.5v4.5"}),o.jsx("path",{d:"M14 2L7.5 8.5"})]}),"Open"]})]}):o.jsx("button",{onClick:T,className:"w-full rounded font-medium text-sm px-3 py-1.5 bg-accent-primary/25 text-white hover:bg-accent-primary/40 transition-colors",children:"Start"}),D&&o.jsxs("div",{ref:j,className:"relative",onMouseEnter:()=>{x.current&&clearTimeout(x.current),b.current=setTimeout(()=>{k(!0),v(!1)},500)},onMouseLeave:()=>{b.current&&clearTimeout(b.current),v(!0),x.current=setTimeout(()=>k(!1),150)},children:[o.jsx("pre",{ref:S,className:"text-sm bg-bg-primary p-2 rounded overflow-auto max-h-[200px] border border-border",children:u.length===0?o.jsx("span",{className:"text-text-muted",children:"No output yet"}):u.map((H,V)=>o.jsx("span",{className:H.stream==="stderr"?"text-accent-warning":"",children:Ga(H.content)},V))}),(_||C)&&j.current&&ql.createPortal(o.jsx(Zw,{logs:u,anchorRef:j,isHiding:C,onExpand:()=>y(!0),onClose:()=>k(!1)}),document.body)]})]}):o.jsx("button",{onClick:()=>g(!0),className:"w-full rounded font-medium text-sm px-3 py-1.5 bg-bg-tertiary text-text-muted hover:bg-border transition-colors",children:"Configure"}),o.jsx(Gw,{isOpen:p,onClose:()=>g(!1)}),m&&o.jsx(Lb,{title:"Dev Server Logs",logs:u,onClose:()=>y(!1)})]})}),Jw=P.memo(function({isOpen:r,onClose:i,processName:s,logs:c}){return r?o.jsx(Lb,{title:s,logs:c,onClose:i,preClassName:"flex-1 overflow-auto p-4 text-sm font-mono text-text-primary whitespace-pre-wrap"}):null}),e2=P.memo(function({sessionId:r}){var _;const i=Pa(k=>k.processes),s=Pa(k=>k.stopProcess),[c,u]=P.useState(null),[f,l]=P.useState([]),d=i.filter(k=>k.status!=="exited"),p=d.filter(k=>k.status==="running").length;if(i.length===0)return null;const g=k=>{switch(k){case"running":return"bg-accent-success";case"starting":return"bg-accent-warning";case"stopping":return"bg-accent-warning";case"exited":return"bg-text-muted";default:return"bg-text-muted"}},m=k=>{const C=Pa.getState().logs[k]??[];l(C.map(v=>({content:v.content,stream:v.stream}))),u(k)},y=k=>{r&&s(k,r)};return o.jsxs("div",{className:"mt-2 pt-3 border-t border-border space-y-3",children:[o.jsx("div",{className:"flex items-center justify-between",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"inline-block w-2.5 h-2.5 rounded-full flex-shrink-0 bg-accent-primary"}),o.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Background"}),o.jsxs("span",{className:"text-xs text-text-muted",children:["(",p," running)"]})]})}),o.jsx("div",{className:"space-y-2",children:d.map(k=>o.jsx("div",{className:"border border-border rounded p-2",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[o.jsx("span",{className:`inline-block w-2 h-2 rounded-full flex-shrink-0 ${g(k.status)}`}),o.jsx("span",{className:"text-sm text-text-primary truncate",title:k.name,children:k.name}),o.jsxs("span",{className:"text-xs text-text-muted",children:["[",k.status,"]"]})]}),o.jsxs("div",{className:"flex gap-1 ml-2",children:[o.jsx("button",{onClick:()=>m(k.id),className:"px-2 py-1 text-xs rounded bg-bg-tertiary hover:bg-border text-text-secondary transition-colors",title:"View logs",children:"Logs"}),o.jsx("button",{onClick:()=>y(k.id),className:"px-2 py-1 text-xs rounded bg-bg-tertiary hover:bg-accent-error/20 text-text-secondary hover:text-accent-error transition-colors",title:"Stop process",children:"Stop"})]})]})},k.id))}),c&&o.jsx(Jw,{isOpen:!!c,onClose:()=>{u(null),l([])},processName:((_=d.find(k=>k.id===c))==null?void 0:_.name)??"",logs:f})]})});function qx({summary:e,messages:r,workdir:i}){const[s,c]=P.useState(!1),u=kw(r),{branch:f}=Ew(i),l=kt(p=>p.version),d=Ee(p=>p.currentSession);return o.jsxs("div",{className:"flex flex-col h-full",children:[u&&o.jsxs("div",{className:"mb-4",children:[o.jsx("button",{onClick:()=>c(!0),className:"w-full flex items-center justify-center px-3 py-2 rounded bg-bg-tertiary hover:bg-bg-secondary transition-colors",title:"View detailed response and call-level stats",children:o.jsxs("div",{className:"flex items-center gap-2 text-sm text-text-muted",children:[o.jsx("span",{className:"text-text-secondary",children:jw(u.aiTime)}),o.jsx("span",{className:"w-px h-3 bg-border"}),o.jsx("span",{className:"text-text-secondary",children:Ix(u.avgPrefillSpeed)}),o.jsx("span",{children:"pp"}),o.jsx("span",{className:"w-px h-3 bg-border"}),o.jsx("span",{className:"text-text-secondary",children:Ix(u.avgGenerationSpeed)}),o.jsx("span",{children:"tg"})]})}),o.jsx(Fw,{isOpen:s,onClose:()=>c(!1),stats:u})]}),o.jsxs("div",{className:"flex flex-col flex-1 overflow-y-auto",children:[o.jsx("div",{className:"flex items-center justify-between mb-2",children:o.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Summary"})}),e?o.jsx("p",{className:"text-sm text-text-primary leading-relaxed",children:e}):o.jsx("div",{className:"text-text-muted text-sm text-center py-2",children:"No summary yet"}),o.jsxs("div",{className:"mt-4",children:[o.jsx("h3",{className:"text-sm font-semibold text-text-primary mb-2",children:"Progress"}),o.jsx(Ww,{criteria:(d==null?void 0:d.criteria)??[]})]})]}),f&&o.jsxs("div",{className:"mt-4 flex items-center gap-2 text-sm",children:[o.jsx("svg",{className:"w-4 h-4 flex-shrink-0 text-text-muted",viewBox:"0 0 16 16",fill:"currentColor",children:o.jsx("path",{d:"M9.5 3.25a2.25 2.25 0 1 1 3 2.122V6A2.5 2.5 0 0 1 10 8.5H6a1 1 0 0 0-1 1v1.128a2.251 2.251 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.5 0v1.836A2.493 2.493 0 0 1 6 7h4a1 1 0 0 0 1-1v-.628A2.25 2.25 0 0 1 9.5 3.25Zm-6 0a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Zm8.25-.75a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"})}),o.jsx("span",{className:"truncate text-text-secondary",title:f,children:f})]}),o.jsx(Qw,{workdir:i}),o.jsx(e2,{sessionId:d==null?void 0:d.id}),l&&o.jsxs("div",{className:"mt-4 pt-4 border-t border-border text-center text-xs text-text-muted",children:[o.jsx("a",{href:"https://github.com/co-l/openfox",target:"_blank",rel:"noopener noreferrer",className:"hover:text-accent-primary transition-colors",children:"OpenFox"})," - ",o.jsxs("span",{children:["v",l]})]})]})}function t2({children:e,criteriaSidebarOpen:r=!0,onCriteriaSidebarToggle:i,messages:s}){const c=Ee(u=>u.currentSession);return o.jsxs("div",{className:"relative h-full overflow-hidden",children:[r&&o.jsx("div",{className:"fixed md:hidden inset-0 bg-black/50 z-40",onClick:i}),o.jsxs("div",{className:"flex h-full",children:[o.jsx("div",{className:"flex-1 min-w-0 flex flex-col overflow-hidden",children:e}),r?o.jsx("aside",{className:"hidden md:block w-[320px] shrink-0 border-l border-border p-4 overflow-y-auto bg-bg-secondary",children:o.jsx(qx,{summary:(c==null?void 0:c.summary)??null,messages:s,workdir:c==null?void 0:c.workdir})}):o.jsx("aside",{className:"hidden md:block w-0 shrink-0 overflow-hidden border-l-0"}),o.jsx("aside",{className:`
|
|
85
|
+
md:hidden
|
|
86
|
+
p-4 overflow-y-auto bg-bg-secondary
|
|
87
|
+
transition-all duration-300 ease-in-out
|
|
88
|
+
fixed right-0 top-[32px] h-[calc(100vh-32px)] z-50
|
|
89
|
+
${r?"w-[320px] translate-x-0 border-l border-border":"w-[320px] translate-x-full"}
|
|
90
|
+
`,children:o.jsx(qx,{summary:(c==null?void 0:c.summary)??null,messages:s,workdir:c==null?void 0:c.workdir})})]})]})}function n2(e,r){return r||e>85?"bg-accent-error":e>60?"bg-accent-warning":"bg-accent-success"}function Rb({percent:e,dangerZone:r=!1,size:i="md",className:s=""}){const c=i==="sm"?"w-12":"w-20",u=i==="sm"?"h-1":"h-1.5";return o.jsx("div",{className:`${u} bg-bg-tertiary rounded-full overflow-hidden ${c} ${s}`,children:o.jsx("div",{className:`h-full transition-all duration-300 ${n2(e,r)}`,style:{width:`${Math.min(e,100)}%`}})})}function r2({dangerZone:e,size:r="md"}){return e?o.jsx("span",{className:"text-accent-error animate-pulse text-[10px] font-medium",children:"Low!"}):null}function Wx(e,r){return r||e>85?"text-accent-error":e>60?"text-accent-warning":"text-text-muted"}function i2(){const e=Ee(p=>p.contextState),r=Ee(p=>p.currentSession),i=Ee(p=>p.compactContext);if(!e||!r)return null;const{currentTokens:s,maxTokens:c,compactionCount:u,dangerZone:f}=e,l=Math.round(s/c*100),d=r.isRunning;return o.jsx("div",{className:"flex-shrink-0 px-4 py-1.5 border-b border-border bg-bg-secondary/50",children:o.jsx("div",{className:"flex items-center justify-between gap-4",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("div",{className:"flex items-center gap-1.5 text-sm",children:[o.jsx("span",{className:"text-text-muted",children:"Context:"}),o.jsxs("span",{className:Wx(l,f),children:[Ll(s)," / ",Ll(c)]}),o.jsxs("span",{className:Wx(l,f),children:["(",l,"%)"]})]}),o.jsx(Rb,{percent:l,dangerZone:f}),o.jsx(r2,{dangerZone:f}),u>0&&o.jsxs("span",{className:"text-[10px] text-text-muted bg-bg-tertiary px-1 py-0.5 rounded",children:[u,"x"]}),o.jsx(st,{variant:"secondary",size:"md",onClick:i,disabled:d,title:d?"Cannot compact while running":"Compact context",className:f?"border-accent-error text-accent-error hover:bg-accent-error/10":"",children:"Compact"})]})})})}function Gx(e){const r=[],i=String(e||"");let s=i.indexOf(","),c=0,u=!1;for(;!u;){s===-1&&(s=i.length,u=!0);const f=i.slice(c,s).trim();(f||!u)&&r.push(f),c=s+1,s=i.indexOf(",",c)}return r}function s2(e,r){const i={};return(e[e.length-1]===""?[...e,""]:e).join((i.padRight?" ":"")+","+(i.padLeft===!1?"":" ")).trim()}const a2=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,o2=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,l2={};function Vx(e,r){return(l2.jsx?o2:a2).test(e)}const c2=/[ \t\n\f\r]/g;function u2(e){return typeof e=="object"?e.type==="text"?Yx(e.value):!1:Yx(e)}function Yx(e){return e.replace(c2,"")===""}class to{constructor(r,i,s){this.normal=i,this.property=r,s&&(this.space=s)}}to.prototype.normal={};to.prototype.property={};to.prototype.space=void 0;function Mb(e,r){const i={},s={};for(const c of e)Object.assign(i,c.property),Object.assign(s,c.normal);return new to(i,s,r)}function Va(e){return e.toLowerCase()}class _n{constructor(r,i){this.attribute=i,this.property=r}}_n.prototype.attribute="";_n.prototype.booleanish=!1;_n.prototype.boolean=!1;_n.prototype.commaOrSpaceSeparated=!1;_n.prototype.commaSeparated=!1;_n.prototype.defined=!1;_n.prototype.mustUseProperty=!1;_n.prototype.number=!1;_n.prototype.overloadedBoolean=!1;_n.prototype.property="";_n.prototype.spaceSeparated=!1;_n.prototype.space=void 0;let d2=0;const Ze=Oi(),Ft=Oi(),th=Oi(),Se=Oi(),yt=Oi(),Ls=Oi(),An=Oi();function Oi(){return 2**++d2}const nh=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ze,booleanish:Ft,commaOrSpaceSeparated:An,commaSeparated:Ls,number:Se,overloadedBoolean:th,spaceSeparated:yt},Symbol.toStringTag,{value:"Module"})),Ld=Object.keys(nh);class Eh extends _n{constructor(r,i,s,c){let u=-1;if(super(r,i),Kx(this,"space",c),typeof s=="number")for(;++u<Ld.length;){const f=Ld[u];Kx(this,Ld[u],(s&nh[f])===nh[f])}}}Eh.prototype.defined=!0;function Kx(e,r,i){i&&(e[r]=i)}function Bs(e){const r={},i={};for(const[s,c]of Object.entries(e.properties)){const u=new Eh(s,e.transform(e.attributes||{},s),c,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(u.mustUseProperty=!0),r[s]=u,i[Va(s)]=s,i[Va(u.attribute)]=s}return new to(r,i,e.space)}const Ob=Bs({properties:{ariaActiveDescendant:null,ariaAtomic:Ft,ariaAutoComplete:null,ariaBusy:Ft,ariaChecked:Ft,ariaColCount:Se,ariaColIndex:Se,ariaColSpan:Se,ariaControls:yt,ariaCurrent:null,ariaDescribedBy:yt,ariaDetails:null,ariaDisabled:Ft,ariaDropEffect:yt,ariaErrorMessage:null,ariaExpanded:Ft,ariaFlowTo:yt,ariaGrabbed:Ft,ariaHasPopup:null,ariaHidden:Ft,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:yt,ariaLevel:Se,ariaLive:null,ariaModal:Ft,ariaMultiLine:Ft,ariaMultiSelectable:Ft,ariaOrientation:null,ariaOwns:yt,ariaPlaceholder:null,ariaPosInSet:Se,ariaPressed:Ft,ariaReadOnly:Ft,ariaRelevant:null,ariaRequired:Ft,ariaRoleDescription:yt,ariaRowCount:Se,ariaRowIndex:Se,ariaRowSpan:Se,ariaSelected:Ft,ariaSetSize:Se,ariaSort:null,ariaValueMax:Se,ariaValueMin:Se,ariaValueNow:Se,ariaValueText:null,role:null},transform(e,r){return r==="role"?r:"aria-"+r.slice(4).toLowerCase()}});function Bb(e,r){return r in e?e[r]:r}function Ib(e,r){return Bb(e,r.toLowerCase())}const h2=Bs({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ls,acceptCharset:yt,accessKey:yt,action:null,allow:null,allowFullScreen:Ze,allowPaymentRequest:Ze,allowUserMedia:Ze,alt:null,as:null,async:Ze,autoCapitalize:null,autoComplete:yt,autoFocus:Ze,autoPlay:Ze,blocking:yt,capture:null,charSet:null,checked:Ze,cite:null,className:yt,cols:Se,colSpan:null,content:null,contentEditable:Ft,controls:Ze,controlsList:yt,coords:Se|Ls,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ze,defer:Ze,dir:null,dirName:null,disabled:Ze,download:th,draggable:Ft,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ze,formTarget:null,headers:yt,height:Se,hidden:th,high:Se,href:null,hrefLang:null,htmlFor:yt,httpEquiv:yt,id:null,imageSizes:null,imageSrcSet:null,inert:Ze,inputMode:null,integrity:null,is:null,isMap:Ze,itemId:null,itemProp:yt,itemRef:yt,itemScope:Ze,itemType:yt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ze,low:Se,manifest:null,max:null,maxLength:Se,media:null,method:null,min:null,minLength:Se,multiple:Ze,muted:Ze,name:null,nonce:null,noModule:Ze,noValidate:Ze,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:Ze,optimum:Se,pattern:null,ping:yt,placeholder:null,playsInline:Ze,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ze,referrerPolicy:null,rel:yt,required:Ze,reversed:Ze,rows:Se,rowSpan:Se,sandbox:yt,scope:null,scoped:Ze,seamless:Ze,selected:Ze,shadowRootClonable:Ze,shadowRootDelegatesFocus:Ze,shadowRootMode:null,shape:null,size:Se,sizes:null,slot:null,span:Se,spellCheck:Ft,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Se,step:null,style:null,tabIndex:Se,target:null,title:null,translate:null,type:null,typeMustMatch:Ze,useMap:null,value:Ft,width:Se,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:yt,axis:null,background:null,bgColor:null,border:Se,borderColor:null,bottomMargin:Se,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ze,declare:Ze,event:null,face:null,frame:null,frameBorder:null,hSpace:Se,leftMargin:Se,link:null,longDesc:null,lowSrc:null,marginHeight:Se,marginWidth:Se,noResize:Ze,noHref:Ze,noShade:Ze,noWrap:Ze,object:null,profile:null,prompt:null,rev:null,rightMargin:Se,rules:null,scheme:null,scrolling:Ft,standby:null,summary:null,text:null,topMargin:Se,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Se,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ze,disableRemotePlayback:Ze,prefix:null,property:null,results:Se,security:null,unselectable:null},space:"html",transform:Ib}),f2=Bs({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",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:An,accentHeight:Se,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Se,amplitude:Se,arabicForm:null,ascent:Se,attributeName:null,attributeType:null,azimuth:Se,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Se,by:null,calcMode:null,capHeight:Se,className:yt,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:Se,diffuseConstant:Se,direction:null,display:null,dur:null,divisor:Se,dominantBaseline:null,download:Ze,dx:null,dy:null,edgeMode:null,editable:null,elevation:Se,enableBackground:null,end:null,event:null,exponent:Se,externalResourcesRequired:null,fill:null,fillOpacity:Se,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:Ls,g2:Ls,glyphName:Ls,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Se,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Se,horizOriginX:Se,horizOriginY:Se,id:null,ideographic:Se,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Se,k:Se,k1:Se,k2:Se,k3:Se,k4:Se,kernelMatrix:An,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Se,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Se,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:Se,overlineThickness:Se,paintOrder:null,panose1:null,path:null,pathLength:Se,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:yt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Se,pointsAtY:Se,pointsAtZ:Se,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:An,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:An,rev:An,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:An,requiredFeatures:An,requiredFonts:An,requiredFormats:An,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:Se,specularExponent:Se,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Se,strikethroughThickness:Se,string:null,stroke:null,strokeDashArray:An,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Se,strokeOpacity:Se,strokeWidth:null,style:null,surfaceScale:Se,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:An,tabIndex:Se,tableValues:null,target:null,targetX:Se,targetY:Se,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:An,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Se,underlineThickness:Se,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Se,values:null,vAlphabetic:Se,vMathematical:Se,vectorEffect:null,vHanging:Se,vIdeographic:Se,version:null,vertAdvY:Se,vertOriginX:Se,vertOriginY:Se,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Se,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Bb}),zb=Bs({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,r){return"xlink:"+r.slice(5).toLowerCase()}}),Hb=Bs({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Ib}),Pb=Bs({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,r){return"xml:"+r.slice(3).toLowerCase()}}),p2={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"},m2=/[A-Z]/g,Xx=/-[a-z]/g,g2=/^data[-\w.:]+$/i;function Fb(e,r){const i=Va(r);let s=r,c=_n;if(i in e.normal)return e.property[e.normal[i]];if(i.length>4&&i.slice(0,4)==="data"&&g2.test(r)){if(r.charAt(4)==="-"){const u=r.slice(5).replace(Xx,v2);s="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=r.slice(4);if(!Xx.test(u)){let f=u.replace(m2,x2);f.charAt(0)!=="-"&&(f="-"+f),r="data"+f}}c=Eh}return new c(s,r)}function x2(e){return"-"+e.toLowerCase()}function v2(e){return e.charAt(1).toUpperCase()}const Ub=Mb([Ob,h2,zb,Hb,Pb],"html"),Kl=Mb([Ob,f2,zb,Hb,Pb],"svg");function Zx(e){const r=String(e||"").trim();return r?r.split(/[ \t\n\r\f]+/g):[]}function b2(e){return e.join(" ").trim()}var Cs={},Rd,Qx;function y2(){if(Qx)return Rd;Qx=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,c=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,f=/^[;\s]*/,l=/^\s+|\s+$/g,d=`
|
|
91
|
+
`,p="/",g="*",m="",y="comment",_="declaration";function k(v,b){if(typeof v!="string")throw new TypeError("First argument must be a string");if(!v)return[];b=b||{};var x=1,S=1;function j(O){var U=O.match(r);U&&(x+=U.length);var z=O.lastIndexOf(d);S=~z?O.length-z:S+O.length}function A(){var O={line:x,column:S};return function(U){return U.position=new N(O),I(),U}}function N(O){this.start=O,this.end={line:x,column:S},this.source=b.source}N.prototype.content=v;function D(O){var U=new Error(b.source+":"+x+":"+S+": "+O);if(U.reason=O,U.filename=b.source,U.line=x,U.column=S,U.source=v,!b.silent)throw U}function T(O){var U=O.exec(v);if(U){var z=U[0];return j(z),v=v.slice(z.length),U}}function I(){T(i)}function H(O){var U;for(O=O||[];U=V();)U!==!1&&O.push(U);return O}function V(){var O=A();if(!(p!=v.charAt(0)||g!=v.charAt(1))){for(var U=2;m!=v.charAt(U)&&(g!=v.charAt(U)||p!=v.charAt(U+1));)++U;if(U+=2,m===v.charAt(U-1))return D("End of comment missing");var z=v.slice(2,U-2);return S+=2,j(z),v=v.slice(U),S+=2,O({type:y,comment:z})}}function Y(){var O=A(),U=T(s);if(U){if(V(),!T(c))return D("property missing ':'");var z=T(u),X=O({type:_,property:C(U[0].replace(e,m)),value:z?C(z[0].replace(e,m)):m});return T(f),X}}function q(){var O=[];H(O);for(var U;U=Y();)U!==!1&&(O.push(U),H(O));return O}return I(),q()}function C(v){return v?v.replace(l,m):m}return Rd=k,Rd}var Jx;function _2(){if(Jx)return Cs;Jx=1;var e=Cs&&Cs.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Cs,"__esModule",{value:!0}),Cs.default=i;const r=e(y2());function i(s,c){let u=null;if(!s||typeof s!="string")return u;const f=(0,r.default)(s),l=typeof c=="function";return f.forEach(d=>{if(d.type!=="declaration")return;const{property:p,value:g}=d;l?c(p,g,d):g&&(u=u||{},u[p]=g)}),u}return Cs}var Ra={},ev;function S2(){if(ev)return Ra;ev=1,Object.defineProperty(Ra,"__esModule",{value:!0}),Ra.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,r=/-([a-z])/g,i=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,c=/^-(ms)-/,u=function(p){return!p||i.test(p)||e.test(p)},f=function(p,g){return g.toUpperCase()},l=function(p,g){return"".concat(g,"-")},d=function(p,g){return g===void 0&&(g={}),u(p)?p:(p=p.toLowerCase(),g.reactCompat?p=p.replace(c,l):p=p.replace(s,l),p.replace(r,f))};return Ra.camelCase=d,Ra}var Ma,tv;function w2(){if(tv)return Ma;tv=1;var e=Ma&&Ma.__importDefault||function(c){return c&&c.__esModule?c:{default:c}},r=e(_2()),i=S2();function s(c,u){var f={};return!c||typeof c!="string"||(0,r.default)(c,function(l,d){l&&d&&(f[(0,i.camelCase)(l,u)]=d)}),f}return s.default=s,Ma=s,Ma}var C2=w2();const k2=Pl(C2),$b=qb("end"),jh=qb("start");function qb(e){return r;function r(i){const s=i&&i.position&&i.position[e]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function E2(e){const r=jh(e),i=$b(e);if(r&&i)return{start:r,end:i}}function Fa(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?nv(e.position):"start"in e||"end"in e?nv(e):"line"in e||"column"in e?rh(e):""}function rh(e){return rv(e&&e.line)+":"+rv(e&&e.column)}function nv(e){return rh(e&&e.start)+"-"+rh(e&&e.end)}function rv(e){return e&&typeof e=="number"?e:1}class cn extends Error{constructor(r,i,s){super(),typeof i=="string"&&(s=i,i=void 0);let c="",u={},f=!1;if(i&&("line"in i&&"column"in i?u={place:i}:"start"in i&&"end"in i?u={place:i}:"type"in i?u={ancestors:[i],place:i.position}:u={...i}),typeof r=="string"?c=r:!u.cause&&r&&(f=!0,c=r.message,u.cause=r),!u.ruleId&&!u.source&&typeof s=="string"){const d=s.indexOf(":");d===-1?u.ruleId=s:(u.source=s.slice(0,d),u.ruleId=s.slice(d+1))}if(!u.place&&u.ancestors&&u.ancestors){const d=u.ancestors[u.ancestors.length-1];d&&(u.place=d.position)}const l=u.place&&"start"in u.place?u.place.start:u.place;this.ancestors=u.ancestors||void 0,this.cause=u.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=c,this.line=l?l.line:void 0,this.name=Fa(u.place)||"1:1",this.place=u.place||void 0,this.reason=this.message,this.ruleId=u.ruleId||void 0,this.source=u.source||void 0,this.stack=f&&u.cause&&typeof u.cause.stack=="string"?u.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}cn.prototype.file="";cn.prototype.name="";cn.prototype.reason="";cn.prototype.message="";cn.prototype.stack="";cn.prototype.column=void 0;cn.prototype.line=void 0;cn.prototype.ancestors=void 0;cn.prototype.cause=void 0;cn.prototype.fatal=void 0;cn.prototype.place=void 0;cn.prototype.ruleId=void 0;cn.prototype.source=void 0;const Nh={}.hasOwnProperty,j2=new Map,N2=/[A-Z]/g,T2=new Set(["table","tbody","thead","tfoot","tr"]),A2=new Set(["td","th"]),Wb="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function D2(e,r){if(!r||r.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const i=r.filePath||void 0;let s;if(r.development){if(typeof r.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=H2(i,r.jsxDEV)}else{if(typeof r.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof r.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");s=z2(i,r.jsx,r.jsxs)}const c={Fragment:r.Fragment,ancestors:[],components:r.components||{},create:s,elementAttributeNameCase:r.elementAttributeNameCase||"react",evaluater:r.createEvaluater?r.createEvaluater():void 0,filePath:i,ignoreInvalidStyle:r.ignoreInvalidStyle||!1,passKeys:r.passKeys!==!1,passNode:r.passNode||!1,schema:r.space==="svg"?Kl:Ub,stylePropertyNameCase:r.stylePropertyNameCase||"dom",tableCellAlignToStyle:r.tableCellAlignToStyle!==!1},u=Gb(c,e,void 0);return u&&typeof u!="string"?u:c.create(e,c.Fragment,{children:u||void 0},void 0)}function Gb(e,r,i){if(r.type==="element")return L2(e,r,i);if(r.type==="mdxFlowExpression"||r.type==="mdxTextExpression")return R2(e,r);if(r.type==="mdxJsxFlowElement"||r.type==="mdxJsxTextElement")return O2(e,r,i);if(r.type==="mdxjsEsm")return M2(e,r);if(r.type==="root")return B2(e,r,i);if(r.type==="text")return I2(e,r)}function L2(e,r,i){const s=e.schema;let c=s;r.tagName.toLowerCase()==="svg"&&s.space==="html"&&(c=Kl,e.schema=c),e.ancestors.push(r);const u=Yb(e,r.tagName,!1),f=P2(e,r);let l=Ah(e,r);return T2.has(r.tagName)&&(l=l.filter(function(d){return typeof d=="string"?!u2(d):!0})),Vb(e,f,u,r),Th(f,l),e.ancestors.pop(),e.schema=s,e.create(r,u,f,i)}function R2(e,r){if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}Ya(e,r.position)}function M2(e,r){if(r.data&&r.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(r.data.estree);Ya(e,r.position)}function O2(e,r,i){const s=e.schema;let c=s;r.name==="svg"&&s.space==="html"&&(c=Kl,e.schema=c),e.ancestors.push(r);const u=r.name===null?e.Fragment:Yb(e,r.name,!0),f=F2(e,r),l=Ah(e,r);return Vb(e,f,u,r),Th(f,l),e.ancestors.pop(),e.schema=s,e.create(r,u,f,i)}function B2(e,r,i){const s={};return Th(s,Ah(e,r)),e.create(r,e.Fragment,s,i)}function I2(e,r){return r.value}function Vb(e,r,i,s){typeof i!="string"&&i!==e.Fragment&&e.passNode&&(r.node=s)}function Th(e,r){if(r.length>0){const i=r.length>1?r:r[0];i&&(e.children=i)}}function z2(e,r,i){return s;function s(c,u,f,l){const p=Array.isArray(f.children)?i:r;return l?p(u,f,l):p(u,f)}}function H2(e,r){return i;function i(s,c,u,f){const l=Array.isArray(u.children),d=jh(s);return r(c,u,f,l,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function P2(e,r){const i={};let s,c;for(c in r.properties)if(c!=="children"&&Nh.call(r.properties,c)){const u=U2(e,c,r.properties[c]);if(u){const[f,l]=u;e.tableCellAlignToStyle&&f==="align"&&typeof l=="string"&&A2.has(r.tagName)?s=l:i[f]=l}}if(s){const u=i.style||(i.style={});u[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return i}function F2(e,r){const i={};for(const s of r.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const u=s.data.estree.body[0];u.type;const f=u.expression;f.type;const l=f.properties[0];l.type,Object.assign(i,e.evaluater.evaluateExpression(l.argument))}else Ya(e,r.position);else{const c=s.name;let u;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const l=s.value.data.estree.body[0];l.type,u=e.evaluater.evaluateExpression(l.expression)}else Ya(e,r.position);else u=s.value===null?!0:s.value;i[c]=u}return i}function Ah(e,r){const i=[];let s=-1;const c=e.passKeys?new Map:j2;for(;++s<r.children.length;){const u=r.children[s];let f;if(e.passKeys){const d=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(d){const p=c.get(d)||0;f=d+"-"+p,c.set(d,p+1)}}const l=Gb(e,u,f);l!==void 0&&i.push(l)}return i}function U2(e,r,i){const s=Fb(e.schema,r);if(!(i==null||typeof i=="number"&&Number.isNaN(i))){if(Array.isArray(i)&&(i=s.commaSeparated?s2(i):b2(i)),s.property==="style"){let c=typeof i=="object"?i:$2(e,String(i));return e.stylePropertyNameCase==="css"&&(c=q2(c)),["style",c]}return[e.elementAttributeNameCase==="react"&&s.space?p2[s.property]||s.property:s.attribute,i]}}function $2(e,r){try{return k2(r,{reactCompat:!0})}catch(i){if(e.ignoreInvalidStyle)return{};const s=i,c=new cn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw c.file=e.filePath||void 0,c.url=Wb+"#cannot-parse-style-attribute",c}}function Yb(e,r,i){let s;if(!i)s={type:"Literal",value:r};else if(r.includes(".")){const c=r.split(".");let u=-1,f;for(;++u<c.length;){const l=Vx(c[u])?{type:"Identifier",name:c[u]}:{type:"Literal",value:c[u]};f=f?{type:"MemberExpression",object:f,property:l,computed:!!(u&&l.type==="Literal"),optional:!1}:l}s=f}else s=Vx(r)&&!/^[a-z]/.test(r)?{type:"Identifier",name:r}:{type:"Literal",value:r};if(s.type==="Literal"){const c=s.value;return Nh.call(e.components,c)?e.components[c]:c}if(e.evaluater)return e.evaluater.evaluateExpression(s);Ya(e)}function Ya(e,r){const i=new cn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:r,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=Wb+"#cannot-handle-mdx-estrees-without-createevaluater",i}function q2(e){const r={};let i;for(i in e)Nh.call(e,i)&&(r[W2(i)]=e[i]);return r}function W2(e){let r=e.replace(N2,G2);return r.slice(0,3)==="ms-"&&(r="-"+r),r}function G2(e){return"-"+e.toLowerCase()}const Md={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"]},V2={};function Dh(e,r){const i=V2,s=typeof i.includeImageAlt=="boolean"?i.includeImageAlt:!0,c=typeof i.includeHtml=="boolean"?i.includeHtml:!0;return Kb(e,s,c)}function Kb(e,r,i){if(Y2(e)){if("value"in e)return e.type==="html"&&!i?"":e.value;if(r&&"alt"in e&&e.alt)return e.alt;if("children"in e)return iv(e.children,r,i)}return Array.isArray(e)?iv(e,r,i):""}function iv(e,r,i){const s=[];let c=-1;for(;++c<e.length;)s[c]=Kb(e[c],r,i);return s.join("")}function Y2(e){return!!(e&&typeof e=="object")}const sv=document.createElement("i");function Ka(e){const r="&"+e+";";sv.innerHTML=r;const i=sv.textContent;return i.charCodeAt(i.length-1)===59&&e!=="semi"||i===r?!1:i}function Rn(e,r,i,s){const c=e.length;let u=0,f;if(r<0?r=-r>c?0:c+r:r=r>c?c:r,i=i>0?i:0,s.length<1e4)f=Array.from(s),f.unshift(r,i),e.splice(...f);else for(i&&e.splice(r,i);u<s.length;)f=s.slice(u,u+1e4),f.unshift(r,0),e.splice(...f),u+=1e4,r+=1e4}function qn(e,r){return e.length>0?(Rn(e,e.length,0,r),e):r}const av={}.hasOwnProperty;function Xb(e){const r={};let i=-1;for(;++i<e.length;)K2(r,e[i]);return r}function K2(e,r){let i;for(i in r){const c=(av.call(e,i)?e[i]:void 0)||(e[i]={}),u=r[i];let f;if(u)for(f in u){av.call(c,f)||(c[f]=[]);const l=u[f];X2(c[f],Array.isArray(l)?l:l?[l]:[])}}}function X2(e,r){let i=-1;const s=[];for(;++i<r.length;)(r[i].add==="after"?e:s).push(r[i]);Rn(e,0,0,s)}function Zb(e,r){const i=Number.parseInt(e,r);return i<9||i===11||i>13&&i<32||i>126&&i<160||i>55295&&i<57344||i>64975&&i<65008||(i&65535)===65535||(i&65535)===65534||i>1114111?"�":String.fromCodePoint(i)}function Xn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const hn=ai(/[A-Za-z]/),on=ai(/[\dA-Za-z]/),Z2=ai(/[#-'*+\--9=?A-Z^-~]/);function Ml(e){return e!==null&&(e<32||e===127)}const ih=ai(/\d/),Q2=ai(/[\dA-Fa-f]/),J2=ai(/[!-/:-@[-`{-~]/);function He(e){return e!==null&&e<-2}function bt(e){return e!==null&&(e<0||e===32)}function et(e){return e===-2||e===-1||e===32}const Xl=ai(new RegExp("\\p{P}|\\p{S}","u")),Ri=ai(/\s/);function ai(e){return r;function r(i){return i!==null&&i>-1&&e.test(String.fromCharCode(i))}}function Is(e){const r=[];let i=-1,s=0,c=0;for(;++i<e.length;){const u=e.charCodeAt(i);let f="";if(u===37&&on(e.charCodeAt(i+1))&&on(e.charCodeAt(i+2)))c=2;else if(u<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(u))||(f=String.fromCharCode(u));else if(u>55295&&u<57344){const l=e.charCodeAt(i+1);u<56320&&l>56319&&l<57344?(f=String.fromCharCode(u,l),c=1):f="�"}else f=String.fromCharCode(u);f&&(r.push(e.slice(s,i),encodeURIComponent(f)),s=i+c+1,f=""),c&&(i+=c,c=0)}return r.join("")+e.slice(s)}function ot(e,r,i,s){const c=s?s-1:Number.POSITIVE_INFINITY;let u=0;return f;function f(d){return et(d)?(e.enter(i),l(d)):r(d)}function l(d){return et(d)&&u++<c?(e.consume(d),l):(e.exit(i),r(d))}}const eC={tokenize:tC};function tC(e){const r=e.attempt(this.parser.constructs.contentInitial,s,c);let i;return r;function s(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),ot(e,r,"linePrefix")}function c(l){return e.enter("paragraph"),u(l)}function u(l){const d=e.enter("chunkText",{contentType:"text",previous:i});return i&&(i.next=d),i=d,f(l)}function f(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return He(l)?(e.consume(l),e.exit("chunkText"),u):(e.consume(l),f)}}const nC={tokenize:rC},ov={tokenize:iC};function rC(e){const r=this,i=[];let s=0,c,u,f;return l;function l(S){if(s<i.length){const j=i[s];return r.containerState=j[1],e.attempt(j[0].continuation,d,p)(S)}return p(S)}function d(S){if(s++,r.containerState._closeFlow){r.containerState._closeFlow=void 0,c&&x();const j=r.events.length;let A=j,N;for(;A--;)if(r.events[A][0]==="exit"&&r.events[A][1].type==="chunkFlow"){N=r.events[A][1].end;break}b(s);let D=j;for(;D<r.events.length;)r.events[D][1].end={...N},D++;return Rn(r.events,A+1,0,r.events.slice(j)),r.events.length=D,p(S)}return l(S)}function p(S){if(s===i.length){if(!c)return y(S);if(c.currentConstruct&&c.currentConstruct.concrete)return k(S);r.interrupt=!!(c.currentConstruct&&!c._gfmTableDynamicInterruptHack)}return r.containerState={},e.check(ov,g,m)(S)}function g(S){return c&&x(),b(s),y(S)}function m(S){return r.parser.lazy[r.now().line]=s!==i.length,f=r.now().offset,k(S)}function y(S){return r.containerState={},e.attempt(ov,_,k)(S)}function _(S){return s++,i.push([r.currentConstruct,r.containerState]),y(S)}function k(S){if(S===null){c&&x(),b(0),e.consume(S);return}return c=c||r.parser.flow(r.now()),e.enter("chunkFlow",{_tokenizer:c,contentType:"flow",previous:u}),C(S)}function C(S){if(S===null){v(e.exit("chunkFlow"),!0),b(0),e.consume(S);return}return He(S)?(e.consume(S),v(e.exit("chunkFlow")),s=0,r.interrupt=void 0,l):(e.consume(S),C)}function v(S,j){const A=r.sliceStream(S);if(j&&A.push(null),S.previous=u,u&&(u.next=S),u=S,c.defineSkip(S.start),c.write(A),r.parser.lazy[S.start.line]){let N=c.events.length;for(;N--;)if(c.events[N][1].start.offset<f&&(!c.events[N][1].end||c.events[N][1].end.offset>f))return;const D=r.events.length;let T=D,I,H;for(;T--;)if(r.events[T][0]==="exit"&&r.events[T][1].type==="chunkFlow"){if(I){H=r.events[T][1].end;break}I=!0}for(b(s),N=D;N<r.events.length;)r.events[N][1].end={...H},N++;Rn(r.events,T+1,0,r.events.slice(D)),r.events.length=N}}function b(S){let j=i.length;for(;j-- >S;){const A=i[j];r.containerState=A[1],A[0].exit.call(r,e)}i.length=S}function x(){c.write([null]),u=void 0,c=void 0,r.containerState._closeFlow=void 0}}function iC(e,r,i){return ot(e,e.attempt(this.parser.constructs.document,r,i),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ms(e){if(e===null||bt(e)||Ri(e))return 1;if(Xl(e))return 2}function Zl(e,r,i){const s=[];let c=-1;for(;++c<e.length;){const u=e[c].resolveAll;u&&!s.includes(u)&&(r=u(r,i),s.push(u))}return r}const sh={name:"attention",resolveAll:sC,tokenize:aC};function sC(e,r){let i=-1,s,c,u,f,l,d,p,g;for(;++i<e.length;)if(e[i][0]==="enter"&&e[i][1].type==="attentionSequence"&&e[i][1]._close){for(s=i;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&r.sliceSerialize(e[s][1]).charCodeAt(0)===r.sliceSerialize(e[i][1]).charCodeAt(0)){if((e[s][1]._close||e[i][1]._open)&&(e[i][1].end.offset-e[i][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[i][1].end.offset-e[i][1].start.offset)%3))continue;d=e[s][1].end.offset-e[s][1].start.offset>1&&e[i][1].end.offset-e[i][1].start.offset>1?2:1;const m={...e[s][1].end},y={...e[i][1].start};lv(m,-d),lv(y,d),f={type:d>1?"strongSequence":"emphasisSequence",start:m,end:{...e[s][1].end}},l={type:d>1?"strongSequence":"emphasisSequence",start:{...e[i][1].start},end:y},u={type:d>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[i][1].start}},c={type:d>1?"strong":"emphasis",start:{...f.start},end:{...l.end}},e[s][1].end={...f.start},e[i][1].start={...l.end},p=[],e[s][1].end.offset-e[s][1].start.offset&&(p=qn(p,[["enter",e[s][1],r],["exit",e[s][1],r]])),p=qn(p,[["enter",c,r],["enter",f,r],["exit",f,r],["enter",u,r]]),p=qn(p,Zl(r.parser.constructs.insideSpan.null,e.slice(s+1,i),r)),p=qn(p,[["exit",u,r],["enter",l,r],["exit",l,r],["exit",c,r]]),e[i][1].end.offset-e[i][1].start.offset?(g=2,p=qn(p,[["enter",e[i][1],r],["exit",e[i][1],r]])):g=0,Rn(e,s-1,i-s+3,p),i=s+p.length-g-2;break}}for(i=-1;++i<e.length;)e[i][1].type==="attentionSequence"&&(e[i][1].type="data");return e}function aC(e,r){const i=this.parser.constructs.attentionMarkers.null,s=this.previous,c=Ms(s);let u;return f;function f(d){return u=d,e.enter("attentionSequence"),l(d)}function l(d){if(d===u)return e.consume(d),l;const p=e.exit("attentionSequence"),g=Ms(d),m=!g||g===2&&c||i.includes(d),y=!c||c===2&&g||i.includes(s);return p._open=!!(u===42?m:m&&(c||!y)),p._close=!!(u===42?y:y&&(g||!m)),r(d)}}function lv(e,r){e.column+=r,e.offset+=r,e._bufferIndex+=r}const oC={name:"autolink",tokenize:lC};function lC(e,r,i){let s=0;return c;function c(_){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(_),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),u}function u(_){return hn(_)?(e.consume(_),f):_===64?i(_):p(_)}function f(_){return _===43||_===45||_===46||on(_)?(s=1,l(_)):p(_)}function l(_){return _===58?(e.consume(_),s=0,d):(_===43||_===45||_===46||on(_))&&s++<32?(e.consume(_),l):(s=0,p(_))}function d(_){return _===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(_),e.exit("autolinkMarker"),e.exit("autolink"),r):_===null||_===32||_===60||Ml(_)?i(_):(e.consume(_),d)}function p(_){return _===64?(e.consume(_),g):Z2(_)?(e.consume(_),p):i(_)}function g(_){return on(_)?m(_):i(_)}function m(_){return _===46?(e.consume(_),s=0,g):_===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(_),e.exit("autolinkMarker"),e.exit("autolink"),r):y(_)}function y(_){if((_===45||on(_))&&s++<63){const k=_===45?y:m;return e.consume(_),k}return i(_)}}const no={partial:!0,tokenize:cC};function cC(e,r,i){return s;function s(u){return et(u)?ot(e,c,"linePrefix")(u):c(u)}function c(u){return u===null||He(u)?r(u):i(u)}}const Qb={continuation:{tokenize:dC},exit:hC,name:"blockQuote",tokenize:uC};function uC(e,r,i){const s=this;return c;function c(f){if(f===62){const l=s.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(f),e.exit("blockQuoteMarker"),u}return i(f)}function u(f){return et(f)?(e.enter("blockQuotePrefixWhitespace"),e.consume(f),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),r):(e.exit("blockQuotePrefix"),r(f))}}function dC(e,r,i){const s=this;return c;function c(f){return et(f)?ot(e,u,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f):u(f)}function u(f){return e.attempt(Qb,r,i)(f)}}function hC(e){e.exit("blockQuote")}const Jb={name:"characterEscape",tokenize:fC};function fC(e,r,i){return s;function s(u){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(u),e.exit("escapeMarker"),c}function c(u){return J2(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),r):i(u)}}const ey={name:"characterReference",tokenize:pC};function pC(e,r,i){const s=this;let c=0,u,f;return l;function l(m){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),d}function d(m){return m===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(m),e.exit("characterReferenceMarkerNumeric"),p):(e.enter("characterReferenceValue"),u=31,f=on,g(m))}function p(m){return m===88||m===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(m),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),u=6,f=Q2,g):(e.enter("characterReferenceValue"),u=7,f=ih,g(m))}function g(m){if(m===59&&c){const y=e.exit("characterReferenceValue");return f===on&&!Ka(s.sliceSerialize(y))?i(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),r)}return f(m)&&c++<u?(e.consume(m),g):i(m)}}const cv={partial:!0,tokenize:gC},uv={concrete:!0,name:"codeFenced",tokenize:mC};function mC(e,r,i){const s=this,c={partial:!0,tokenize:A};let u=0,f=0,l;return d;function d(N){return p(N)}function p(N){const D=s.events[s.events.length-1];return u=D&&D[1].type==="linePrefix"?D[2].sliceSerialize(D[1],!0).length:0,l=N,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(N)}function g(N){return N===l?(f++,e.consume(N),g):f<3?i(N):(e.exit("codeFencedFenceSequence"),et(N)?ot(e,m,"whitespace")(N):m(N))}function m(N){return N===null||He(N)?(e.exit("codeFencedFence"),s.interrupt?r(N):e.check(cv,C,j)(N)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),y(N))}function y(N){return N===null||He(N)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(N)):et(N)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ot(e,_,"whitespace")(N)):N===96&&N===l?i(N):(e.consume(N),y)}function _(N){return N===null||He(N)?m(N):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),k(N))}function k(N){return N===null||He(N)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(N)):N===96&&N===l?i(N):(e.consume(N),k)}function C(N){return e.attempt(c,j,v)(N)}function v(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),b}function b(N){return u>0&&et(N)?ot(e,x,"linePrefix",u+1)(N):x(N)}function x(N){return N===null||He(N)?e.check(cv,C,j)(N):(e.enter("codeFlowValue"),S(N))}function S(N){return N===null||He(N)?(e.exit("codeFlowValue"),x(N)):(e.consume(N),S)}function j(N){return e.exit("codeFenced"),r(N)}function A(N,D,T){let I=0;return H;function H(U){return N.enter("lineEnding"),N.consume(U),N.exit("lineEnding"),V}function V(U){return N.enter("codeFencedFence"),et(U)?ot(N,Y,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(U):Y(U)}function Y(U){return U===l?(N.enter("codeFencedFenceSequence"),q(U)):T(U)}function q(U){return U===l?(I++,N.consume(U),q):I>=f?(N.exit("codeFencedFenceSequence"),et(U)?ot(N,O,"whitespace")(U):O(U)):T(U)}function O(U){return U===null||He(U)?(N.exit("codeFencedFence"),D(U)):T(U)}}}function gC(e,r,i){const s=this;return c;function c(f){return f===null?i(f):(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),u)}function u(f){return s.parser.lazy[s.now().line]?i(f):r(f)}}const Od={name:"codeIndented",tokenize:vC},xC={partial:!0,tokenize:bC};function vC(e,r,i){const s=this;return c;function c(p){return e.enter("codeIndented"),ot(e,u,"linePrefix",5)(p)}function u(p){const g=s.events[s.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?f(p):i(p)}function f(p){return p===null?d(p):He(p)?e.attempt(xC,f,d)(p):(e.enter("codeFlowValue"),l(p))}function l(p){return p===null||He(p)?(e.exit("codeFlowValue"),f(p)):(e.consume(p),l)}function d(p){return e.exit("codeIndented"),r(p)}}function bC(e,r,i){const s=this;return c;function c(f){return s.parser.lazy[s.now().line]?i(f):He(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),c):ot(e,u,"linePrefix",5)(f)}function u(f){const l=s.events[s.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?r(f):He(f)?c(f):i(f)}}const yC={name:"codeText",previous:SC,resolve:_C,tokenize:wC};function _C(e){let r=e.length-4,i=3,s,c;if((e[i][1].type==="lineEnding"||e[i][1].type==="space")&&(e[r][1].type==="lineEnding"||e[r][1].type==="space")){for(s=i;++s<r;)if(e[s][1].type==="codeTextData"){e[i][1].type="codeTextPadding",e[r][1].type="codeTextPadding",i+=2,r-=2;break}}for(s=i-1,r++;++s<=r;)c===void 0?s!==r&&e[s][1].type!=="lineEnding"&&(c=s):(s===r||e[s][1].type==="lineEnding")&&(e[c][1].type="codeTextData",s!==c+2&&(e[c][1].end=e[s-1][1].end,e.splice(c+2,s-c-2),r-=s-c-2,s=c+2),c=void 0);return e}function SC(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function wC(e,r,i){let s=0,c,u;return f;function f(m){return e.enter("codeText"),e.enter("codeTextSequence"),l(m)}function l(m){return m===96?(e.consume(m),s++,l):(e.exit("codeTextSequence"),d(m))}function d(m){return m===null?i(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),d):m===96?(u=e.enter("codeTextSequence"),c=0,g(m)):He(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),d):(e.enter("codeTextData"),p(m))}function p(m){return m===null||m===32||m===96||He(m)?(e.exit("codeTextData"),d(m)):(e.consume(m),p)}function g(m){return m===96?(e.consume(m),c++,g):c===s?(e.exit("codeTextSequence"),e.exit("codeText"),r(m)):(u.type="codeTextData",p(m))}}class CC{constructor(r){this.left=r?[...r]:[],this.right=[]}get(r){if(r<0||r>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+r+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return r<this.left.length?this.left[r]:this.right[this.right.length-r+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(r,i){const s=i??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(r,s):r>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-r+this.left.length).reverse():this.left.slice(r).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(r,i,s){const c=i||0;this.setCursor(Math.trunc(r));const u=this.right.splice(this.right.length-c,Number.POSITIVE_INFINITY);return s&&Oa(this.left,s),u.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(r){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(r)}pushMany(r){this.setCursor(Number.POSITIVE_INFINITY),Oa(this.left,r)}unshift(r){this.setCursor(0),this.right.push(r)}unshiftMany(r){this.setCursor(0),Oa(this.right,r.reverse())}setCursor(r){if(!(r===this.left.length||r>this.left.length&&this.right.length===0||r<0&&this.left.length===0))if(r<this.left.length){const i=this.left.splice(r,Number.POSITIVE_INFINITY);Oa(this.right,i.reverse())}else{const i=this.right.splice(this.left.length+this.right.length-r,Number.POSITIVE_INFINITY);Oa(this.left,i.reverse())}}}function Oa(e,r){let i=0;if(r.length<1e4)e.push(...r);else for(;i<r.length;)e.push(...r.slice(i,i+1e4)),i+=1e4}function ty(e){const r={};let i=-1,s,c,u,f,l,d,p;const g=new CC(e);for(;++i<g.length;){for(;i in r;)i=r[i];if(s=g.get(i),i&&s[1].type==="chunkFlow"&&g.get(i-1)[1].type==="listItemPrefix"&&(d=s[1]._tokenizer.events,u=0,u<d.length&&d[u][1].type==="lineEndingBlank"&&(u+=2),u<d.length&&d[u][1].type==="content"))for(;++u<d.length&&d[u][1].type!=="content";)d[u][1].type==="chunkText"&&(d[u][1]._isInFirstContentOfListItem=!0,u++);if(s[0]==="enter")s[1].contentType&&(Object.assign(r,kC(g,i)),i=r[i],p=!0);else if(s[1]._container){for(u=i,c=void 0;u--;)if(f=g.get(u),f[1].type==="lineEnding"||f[1].type==="lineEndingBlank")f[0]==="enter"&&(c&&(g.get(c)[1].type="lineEndingBlank"),f[1].type="lineEnding",c=u);else if(!(f[1].type==="linePrefix"||f[1].type==="listItemIndent"))break;c&&(s[1].end={...g.get(c)[1].start},l=g.slice(c,i),l.unshift(s),g.splice(c,i-c+1,l))}}return Rn(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!p}function kC(e,r){const i=e.get(r)[1],s=e.get(r)[2];let c=r-1;const u=[];let f=i._tokenizer;f||(f=s.parser[i.contentType](i.start),i._contentTypeTextTrailing&&(f._contentTypeTextTrailing=!0));const l=f.events,d=[],p={};let g,m,y=-1,_=i,k=0,C=0;const v=[C];for(;_;){for(;e.get(++c)[1]!==_;);u.push(c),_._tokenizer||(g=s.sliceStream(_),_.next||g.push(null),m&&f.defineSkip(_.start),_._isInFirstContentOfListItem&&(f._gfmTasklistFirstContentOfListItem=!0),f.write(g),_._isInFirstContentOfListItem&&(f._gfmTasklistFirstContentOfListItem=void 0)),m=_,_=_.next}for(_=i;++y<l.length;)l[y][0]==="exit"&&l[y-1][0]==="enter"&&l[y][1].type===l[y-1][1].type&&l[y][1].start.line!==l[y][1].end.line&&(C=y+1,v.push(C),_._tokenizer=void 0,_.previous=void 0,_=_.next);for(f.events=[],_?(_._tokenizer=void 0,_.previous=void 0):v.pop(),y=v.length;y--;){const b=l.slice(v[y],v[y+1]),x=u.pop();d.push([x,x+b.length-1]),e.splice(x,2,b)}for(d.reverse(),y=-1;++y<d.length;)p[k+d[y][0]]=k+d[y][1],k+=d[y][1]-d[y][0]-1;return p}const EC={resolve:NC,tokenize:TC},jC={partial:!0,tokenize:AC};function NC(e){return ty(e),e}function TC(e,r){let i;return s;function s(l){return e.enter("content"),i=e.enter("chunkContent",{contentType:"content"}),c(l)}function c(l){return l===null?u(l):He(l)?e.check(jC,f,u)(l):(e.consume(l),c)}function u(l){return e.exit("chunkContent"),e.exit("content"),r(l)}function f(l){return e.consume(l),e.exit("chunkContent"),i.next=e.enter("chunkContent",{contentType:"content",previous:i}),i=i.next,c}}function AC(e,r,i){const s=this;return c;function c(f){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),ot(e,u,"linePrefix")}function u(f){if(f===null||He(f))return i(f);const l=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?r(f):e.interrupt(s.parser.constructs.flow,i,r)(f)}}function ny(e,r,i,s,c,u,f,l,d){const p=d||Number.POSITIVE_INFINITY;let g=0;return m;function m(b){return b===60?(e.enter(s),e.enter(c),e.enter(u),e.consume(b),e.exit(u),y):b===null||b===32||b===41||Ml(b)?i(b):(e.enter(s),e.enter(f),e.enter(l),e.enter("chunkString",{contentType:"string"}),C(b))}function y(b){return b===62?(e.enter(u),e.consume(b),e.exit(u),e.exit(c),e.exit(s),r):(e.enter(l),e.enter("chunkString",{contentType:"string"}),_(b))}function _(b){return b===62?(e.exit("chunkString"),e.exit(l),y(b)):b===null||b===60||He(b)?i(b):(e.consume(b),b===92?k:_)}function k(b){return b===60||b===62||b===92?(e.consume(b),_):_(b)}function C(b){return!g&&(b===null||b===41||bt(b))?(e.exit("chunkString"),e.exit(l),e.exit(f),e.exit(s),r(b)):g<p&&b===40?(e.consume(b),g++,C):b===41?(e.consume(b),g--,C):b===null||b===32||b===40||Ml(b)?i(b):(e.consume(b),b===92?v:C)}function v(b){return b===40||b===41||b===92?(e.consume(b),C):C(b)}}function ry(e,r,i,s,c,u){const f=this;let l=0,d;return p;function p(_){return e.enter(s),e.enter(c),e.consume(_),e.exit(c),e.enter(u),g}function g(_){return l>999||_===null||_===91||_===93&&!d||_===94&&!l&&"_hiddenFootnoteSupport"in f.parser.constructs?i(_):_===93?(e.exit(u),e.enter(c),e.consume(_),e.exit(c),e.exit(s),r):He(_)?(e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),m(_))}function m(_){return _===null||_===91||_===93||He(_)||l++>999?(e.exit("chunkString"),g(_)):(e.consume(_),d||(d=!et(_)),_===92?y:m)}function y(_){return _===91||_===92||_===93?(e.consume(_),l++,m):m(_)}}function iy(e,r,i,s,c,u){let f;return l;function l(y){return y===34||y===39||y===40?(e.enter(s),e.enter(c),e.consume(y),e.exit(c),f=y===40?41:y,d):i(y)}function d(y){return y===f?(e.enter(c),e.consume(y),e.exit(c),e.exit(s),r):(e.enter(u),p(y))}function p(y){return y===f?(e.exit(u),d(f)):y===null?i(y):He(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),ot(e,p,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(y))}function g(y){return y===f||y===null||He(y)?(e.exit("chunkString"),p(y)):(e.consume(y),y===92?m:g)}function m(y){return y===f||y===92?(e.consume(y),g):g(y)}}function Ua(e,r){let i;return s;function s(c){return He(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),i=!0,s):et(c)?ot(e,s,i?"linePrefix":"lineSuffix")(c):r(c)}}const DC={name:"definition",tokenize:RC},LC={partial:!0,tokenize:MC};function RC(e,r,i){const s=this;let c;return u;function u(_){return e.enter("definition"),f(_)}function f(_){return ry.call(s,e,l,i,"definitionLabel","definitionLabelMarker","definitionLabelString")(_)}function l(_){return c=Xn(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),_===58?(e.enter("definitionMarker"),e.consume(_),e.exit("definitionMarker"),d):i(_)}function d(_){return bt(_)?Ua(e,p)(_):p(_)}function p(_){return ny(e,g,i,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(_)}function g(_){return e.attempt(LC,m,m)(_)}function m(_){return et(_)?ot(e,y,"whitespace")(_):y(_)}function y(_){return _===null||He(_)?(e.exit("definition"),s.parser.defined.push(c),r(_)):i(_)}}function MC(e,r,i){return s;function s(l){return bt(l)?Ua(e,c)(l):i(l)}function c(l){return iy(e,u,i,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function u(l){return et(l)?ot(e,f,"whitespace")(l):f(l)}function f(l){return l===null||He(l)?r(l):i(l)}}const OC={name:"hardBreakEscape",tokenize:BC};function BC(e,r,i){return s;function s(u){return e.enter("hardBreakEscape"),e.consume(u),c}function c(u){return He(u)?(e.exit("hardBreakEscape"),r(u)):i(u)}}const IC={name:"headingAtx",resolve:zC,tokenize:HC};function zC(e,r){let i=e.length-2,s=3,c,u;return e[s][1].type==="whitespace"&&(s+=2),i-2>s&&e[i][1].type==="whitespace"&&(i-=2),e[i][1].type==="atxHeadingSequence"&&(s===i-1||i-4>s&&e[i-2][1].type==="whitespace")&&(i-=s+1===i?2:4),i>s&&(c={type:"atxHeadingText",start:e[s][1].start,end:e[i][1].end},u={type:"chunkText",start:e[s][1].start,end:e[i][1].end,contentType:"text"},Rn(e,s,i-s+1,[["enter",c,r],["enter",u,r],["exit",u,r],["exit",c,r]])),e}function HC(e,r,i){let s=0;return c;function c(g){return e.enter("atxHeading"),u(g)}function u(g){return e.enter("atxHeadingSequence"),f(g)}function f(g){return g===35&&s++<6?(e.consume(g),f):g===null||bt(g)?(e.exit("atxHeadingSequence"),l(g)):i(g)}function l(g){return g===35?(e.enter("atxHeadingSequence"),d(g)):g===null||He(g)?(e.exit("atxHeading"),r(g)):et(g)?ot(e,l,"whitespace")(g):(e.enter("atxHeadingText"),p(g))}function d(g){return g===35?(e.consume(g),d):(e.exit("atxHeadingSequence"),l(g))}function p(g){return g===null||g===35||bt(g)?(e.exit("atxHeadingText"),l(g)):(e.consume(g),p)}}const PC=["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"],dv=["pre","script","style","textarea"],FC={concrete:!0,name:"htmlFlow",resolveTo:qC,tokenize:WC},UC={partial:!0,tokenize:VC},$C={partial:!0,tokenize:GC};function qC(e){let r=e.length;for(;r--&&!(e[r][0]==="enter"&&e[r][1].type==="htmlFlow"););return r>1&&e[r-2][1].type==="linePrefix"&&(e[r][1].start=e[r-2][1].start,e[r+1][1].start=e[r-2][1].start,e.splice(r-2,2)),e}function WC(e,r,i){const s=this;let c,u,f,l,d;return p;function p(F){return g(F)}function g(F){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(F),m}function m(F){return F===33?(e.consume(F),y):F===47?(e.consume(F),u=!0,C):F===63?(e.consume(F),c=3,s.interrupt?r:L):hn(F)?(e.consume(F),f=String.fromCharCode(F),v):i(F)}function y(F){return F===45?(e.consume(F),c=2,_):F===91?(e.consume(F),c=5,l=0,k):hn(F)?(e.consume(F),c=4,s.interrupt?r:L):i(F)}function _(F){return F===45?(e.consume(F),s.interrupt?r:L):i(F)}function k(F){const re="CDATA[";return F===re.charCodeAt(l++)?(e.consume(F),l===re.length?s.interrupt?r:Y:k):i(F)}function C(F){return hn(F)?(e.consume(F),f=String.fromCharCode(F),v):i(F)}function v(F){if(F===null||F===47||F===62||bt(F)){const re=F===47,Z=f.toLowerCase();return!re&&!u&&dv.includes(Z)?(c=1,s.interrupt?r(F):Y(F)):PC.includes(f.toLowerCase())?(c=6,re?(e.consume(F),b):s.interrupt?r(F):Y(F)):(c=7,s.interrupt&&!s.parser.lazy[s.now().line]?i(F):u?x(F):S(F))}return F===45||on(F)?(e.consume(F),f+=String.fromCharCode(F),v):i(F)}function b(F){return F===62?(e.consume(F),s.interrupt?r:Y):i(F)}function x(F){return et(F)?(e.consume(F),x):H(F)}function S(F){return F===47?(e.consume(F),H):F===58||F===95||hn(F)?(e.consume(F),j):et(F)?(e.consume(F),S):H(F)}function j(F){return F===45||F===46||F===58||F===95||on(F)?(e.consume(F),j):A(F)}function A(F){return F===61?(e.consume(F),N):et(F)?(e.consume(F),A):S(F)}function N(F){return F===null||F===60||F===61||F===62||F===96?i(F):F===34||F===39?(e.consume(F),d=F,D):et(F)?(e.consume(F),N):T(F)}function D(F){return F===d?(e.consume(F),d=null,I):F===null||He(F)?i(F):(e.consume(F),D)}function T(F){return F===null||F===34||F===39||F===47||F===60||F===61||F===62||F===96||bt(F)?A(F):(e.consume(F),T)}function I(F){return F===47||F===62||et(F)?S(F):i(F)}function H(F){return F===62?(e.consume(F),V):i(F)}function V(F){return F===null||He(F)?Y(F):et(F)?(e.consume(F),V):i(F)}function Y(F){return F===45&&c===2?(e.consume(F),z):F===60&&c===1?(e.consume(F),X):F===62&&c===4?(e.consume(F),B):F===63&&c===3?(e.consume(F),L):F===93&&c===5?(e.consume(F),M):He(F)&&(c===6||c===7)?(e.exit("htmlFlowData"),e.check(UC,W,q)(F)):F===null||He(F)?(e.exit("htmlFlowData"),q(F)):(e.consume(F),Y)}function q(F){return e.check($C,O,W)(F)}function O(F){return e.enter("lineEnding"),e.consume(F),e.exit("lineEnding"),U}function U(F){return F===null||He(F)?q(F):(e.enter("htmlFlowData"),Y(F))}function z(F){return F===45?(e.consume(F),L):Y(F)}function X(F){return F===47?(e.consume(F),f="",Q):Y(F)}function Q(F){if(F===62){const re=f.toLowerCase();return dv.includes(re)?(e.consume(F),B):Y(F)}return hn(F)&&f.length<8?(e.consume(F),f+=String.fromCharCode(F),Q):Y(F)}function M(F){return F===93?(e.consume(F),L):Y(F)}function L(F){return F===62?(e.consume(F),B):F===45&&c===2?(e.consume(F),L):Y(F)}function B(F){return F===null||He(F)?(e.exit("htmlFlowData"),W(F)):(e.consume(F),B)}function W(F){return e.exit("htmlFlow"),r(F)}}function GC(e,r,i){const s=this;return c;function c(f){return He(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),u):i(f)}function u(f){return s.parser.lazy[s.now().line]?i(f):r(f)}}function VC(e,r,i){return s;function s(c){return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),e.attempt(no,r,i)}}const YC={name:"htmlText",tokenize:KC};function KC(e,r,i){const s=this;let c,u,f;return l;function l(L){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(L),d}function d(L){return L===33?(e.consume(L),p):L===47?(e.consume(L),A):L===63?(e.consume(L),S):hn(L)?(e.consume(L),T):i(L)}function p(L){return L===45?(e.consume(L),g):L===91?(e.consume(L),u=0,k):hn(L)?(e.consume(L),x):i(L)}function g(L){return L===45?(e.consume(L),_):i(L)}function m(L){return L===null?i(L):L===45?(e.consume(L),y):He(L)?(f=m,X(L)):(e.consume(L),m)}function y(L){return L===45?(e.consume(L),_):m(L)}function _(L){return L===62?z(L):L===45?y(L):m(L)}function k(L){const B="CDATA[";return L===B.charCodeAt(u++)?(e.consume(L),u===B.length?C:k):i(L)}function C(L){return L===null?i(L):L===93?(e.consume(L),v):He(L)?(f=C,X(L)):(e.consume(L),C)}function v(L){return L===93?(e.consume(L),b):C(L)}function b(L){return L===62?z(L):L===93?(e.consume(L),b):C(L)}function x(L){return L===null||L===62?z(L):He(L)?(f=x,X(L)):(e.consume(L),x)}function S(L){return L===null?i(L):L===63?(e.consume(L),j):He(L)?(f=S,X(L)):(e.consume(L),S)}function j(L){return L===62?z(L):S(L)}function A(L){return hn(L)?(e.consume(L),N):i(L)}function N(L){return L===45||on(L)?(e.consume(L),N):D(L)}function D(L){return He(L)?(f=D,X(L)):et(L)?(e.consume(L),D):z(L)}function T(L){return L===45||on(L)?(e.consume(L),T):L===47||L===62||bt(L)?I(L):i(L)}function I(L){return L===47?(e.consume(L),z):L===58||L===95||hn(L)?(e.consume(L),H):He(L)?(f=I,X(L)):et(L)?(e.consume(L),I):z(L)}function H(L){return L===45||L===46||L===58||L===95||on(L)?(e.consume(L),H):V(L)}function V(L){return L===61?(e.consume(L),Y):He(L)?(f=V,X(L)):et(L)?(e.consume(L),V):I(L)}function Y(L){return L===null||L===60||L===61||L===62||L===96?i(L):L===34||L===39?(e.consume(L),c=L,q):He(L)?(f=Y,X(L)):et(L)?(e.consume(L),Y):(e.consume(L),O)}function q(L){return L===c?(e.consume(L),c=void 0,U):L===null?i(L):He(L)?(f=q,X(L)):(e.consume(L),q)}function O(L){return L===null||L===34||L===39||L===60||L===61||L===96?i(L):L===47||L===62||bt(L)?I(L):(e.consume(L),O)}function U(L){return L===47||L===62||bt(L)?I(L):i(L)}function z(L){return L===62?(e.consume(L),e.exit("htmlTextData"),e.exit("htmlText"),r):i(L)}function X(L){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),Q}function Q(L){return et(L)?ot(e,M,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):M(L)}function M(L){return e.enter("htmlTextData"),f(L)}}const Lh={name:"labelEnd",resolveAll:JC,resolveTo:ek,tokenize:tk},XC={tokenize:nk},ZC={tokenize:rk},QC={tokenize:ik};function JC(e){let r=-1;const i=[];for(;++r<e.length;){const s=e[r][1];if(i.push(e[r]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const c=s.type==="labelImage"?4:2;s.type="data",r+=c}}return e.length!==i.length&&Rn(e,0,e.length,i),e}function ek(e,r){let i=e.length,s=0,c,u,f,l;for(;i--;)if(c=e[i][1],u){if(c.type==="link"||c.type==="labelLink"&&c._inactive)break;e[i][0]==="enter"&&c.type==="labelLink"&&(c._inactive=!0)}else if(f){if(e[i][0]==="enter"&&(c.type==="labelImage"||c.type==="labelLink")&&!c._balanced&&(u=i,c.type!=="labelLink")){s=2;break}}else c.type==="labelEnd"&&(f=i);const d={type:e[u][1].type==="labelLink"?"link":"image",start:{...e[u][1].start},end:{...e[e.length-1][1].end}},p={type:"label",start:{...e[u][1].start},end:{...e[f][1].end}},g={type:"labelText",start:{...e[u+s+2][1].end},end:{...e[f-2][1].start}};return l=[["enter",d,r],["enter",p,r]],l=qn(l,e.slice(u+1,u+s+3)),l=qn(l,[["enter",g,r]]),l=qn(l,Zl(r.parser.constructs.insideSpan.null,e.slice(u+s+4,f-3),r)),l=qn(l,[["exit",g,r],e[f-2],e[f-1],["exit",p,r]]),l=qn(l,e.slice(f+1)),l=qn(l,[["exit",d,r]]),Rn(e,u,e.length,l),e}function tk(e,r,i){const s=this;let c=s.events.length,u,f;for(;c--;)if((s.events[c][1].type==="labelImage"||s.events[c][1].type==="labelLink")&&!s.events[c][1]._balanced){u=s.events[c][1];break}return l;function l(y){return u?u._inactive?m(y):(f=s.parser.defined.includes(Xn(s.sliceSerialize({start:u.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(y),e.exit("labelMarker"),e.exit("labelEnd"),d):i(y)}function d(y){return y===40?e.attempt(XC,g,f?g:m)(y):y===91?e.attempt(ZC,g,f?p:m)(y):f?g(y):m(y)}function p(y){return e.attempt(QC,g,m)(y)}function g(y){return r(y)}function m(y){return u._balanced=!0,i(y)}}function nk(e,r,i){return s;function s(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),c}function c(m){return bt(m)?Ua(e,u)(m):u(m)}function u(m){return m===41?g(m):ny(e,f,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function f(m){return bt(m)?Ua(e,d)(m):g(m)}function l(m){return i(m)}function d(m){return m===34||m===39||m===40?iy(e,p,i,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):g(m)}function p(m){return bt(m)?Ua(e,g)(m):g(m)}function g(m){return m===41?(e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),e.exit("resource"),r):i(m)}}function rk(e,r,i){const s=this;return c;function c(l){return ry.call(s,e,u,f,"reference","referenceMarker","referenceString")(l)}function u(l){return s.parser.defined.includes(Xn(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?r(l):i(l)}function f(l){return i(l)}}function ik(e,r,i){return s;function s(u){return e.enter("reference"),e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),c}function c(u){return u===93?(e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),e.exit("reference"),r):i(u)}}const sk={name:"labelStartImage",resolveAll:Lh.resolveAll,tokenize:ak};function ak(e,r,i){const s=this;return c;function c(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),u}function u(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),f):i(l)}function f(l){return l===94&&"_hiddenFootnoteSupport"in s.parser.constructs?i(l):r(l)}}const ok={name:"labelStartLink",resolveAll:Lh.resolveAll,tokenize:lk};function lk(e,r,i){const s=this;return c;function c(f){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelLink"),u}function u(f){return f===94&&"_hiddenFootnoteSupport"in s.parser.constructs?i(f):r(f)}}const Bd={name:"lineEnding",tokenize:ck};function ck(e,r){return i;function i(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),ot(e,r,"linePrefix")}}const Nl={name:"thematicBreak",tokenize:uk};function uk(e,r,i){let s=0,c;return u;function u(p){return e.enter("thematicBreak"),f(p)}function f(p){return c=p,l(p)}function l(p){return p===c?(e.enter("thematicBreakSequence"),d(p)):s>=3&&(p===null||He(p))?(e.exit("thematicBreak"),r(p)):i(p)}function d(p){return p===c?(e.consume(p),s++,d):(e.exit("thematicBreakSequence"),et(p)?ot(e,l,"whitespace")(p):l(p))}}const yn={continuation:{tokenize:pk},exit:gk,name:"list",tokenize:fk},dk={partial:!0,tokenize:xk},hk={partial:!0,tokenize:mk};function fk(e,r,i){const s=this,c=s.events[s.events.length-1];let u=c&&c[1].type==="linePrefix"?c[2].sliceSerialize(c[1],!0).length:0,f=0;return l;function l(_){const k=s.containerState.type||(_===42||_===43||_===45?"listUnordered":"listOrdered");if(k==="listUnordered"?!s.containerState.marker||_===s.containerState.marker:ih(_)){if(s.containerState.type||(s.containerState.type=k,e.enter(k,{_container:!0})),k==="listUnordered")return e.enter("listItemPrefix"),_===42||_===45?e.check(Nl,i,p)(_):p(_);if(!s.interrupt||_===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),d(_)}return i(_)}function d(_){return ih(_)&&++f<10?(e.consume(_),d):(!s.interrupt||f<2)&&(s.containerState.marker?_===s.containerState.marker:_===41||_===46)?(e.exit("listItemValue"),p(_)):i(_)}function p(_){return e.enter("listItemMarker"),e.consume(_),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||_,e.check(no,s.interrupt?i:g,e.attempt(dk,y,m))}function g(_){return s.containerState.initialBlankLine=!0,u++,y(_)}function m(_){return et(_)?(e.enter("listItemPrefixWhitespace"),e.consume(_),e.exit("listItemPrefixWhitespace"),y):i(_)}function y(_){return s.containerState.size=u+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,r(_)}}function pk(e,r,i){const s=this;return s.containerState._closeFlow=void 0,e.check(no,c,u);function c(l){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,ot(e,r,"listItemIndent",s.containerState.size+1)(l)}function u(l){return s.containerState.furtherBlankLines||!et(l)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,f(l)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(hk,r,f)(l))}function f(l){return s.containerState._closeFlow=!0,s.interrupt=void 0,ot(e,e.attempt(yn,r,i),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function mk(e,r,i){const s=this;return ot(e,c,"listItemIndent",s.containerState.size+1);function c(u){const f=s.events[s.events.length-1];return f&&f[1].type==="listItemIndent"&&f[2].sliceSerialize(f[1],!0).length===s.containerState.size?r(u):i(u)}}function gk(e){e.exit(this.containerState.type)}function xk(e,r,i){const s=this;return ot(e,c,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function c(u){const f=s.events[s.events.length-1];return!et(u)&&f&&f[1].type==="listItemPrefixWhitespace"?r(u):i(u)}}const hv={name:"setextUnderline",resolveTo:vk,tokenize:bk};function vk(e,r){let i=e.length,s,c,u;for(;i--;)if(e[i][0]==="enter"){if(e[i][1].type==="content"){s=i;break}e[i][1].type==="paragraph"&&(c=i)}else e[i][1].type==="content"&&e.splice(i,1),!u&&e[i][1].type==="definition"&&(u=i);const f={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[c][1].type="setextHeadingText",u?(e.splice(c,0,["enter",f,r]),e.splice(u+1,0,["exit",e[s][1],r]),e[s][1].end={...e[u][1].end}):e[s][1]=f,e.push(["exit",f,r]),e}function bk(e,r,i){const s=this;let c;return u;function u(p){let g=s.events.length,m;for(;g--;)if(s.events[g][1].type!=="lineEnding"&&s.events[g][1].type!=="linePrefix"&&s.events[g][1].type!=="content"){m=s.events[g][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||m)?(e.enter("setextHeadingLine"),c=p,f(p)):i(p)}function f(p){return e.enter("setextHeadingLineSequence"),l(p)}function l(p){return p===c?(e.consume(p),l):(e.exit("setextHeadingLineSequence"),et(p)?ot(e,d,"lineSuffix")(p):d(p))}function d(p){return p===null||He(p)?(e.exit("setextHeadingLine"),r(p)):i(p)}}const yk={tokenize:_k};function _k(e){const r=this,i=e.attempt(no,s,e.attempt(this.parser.constructs.flowInitial,c,ot(e,e.attempt(this.parser.constructs.flow,c,e.attempt(EC,c)),"linePrefix")));return i;function s(u){if(u===null){e.consume(u);return}return e.enter("lineEndingBlank"),e.consume(u),e.exit("lineEndingBlank"),r.currentConstruct=void 0,i}function c(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),r.currentConstruct=void 0,i}}const Sk={resolveAll:ay()},wk=sy("string"),Ck=sy("text");function sy(e){return{resolveAll:ay(e==="text"?kk:void 0),tokenize:r};function r(i){const s=this,c=this.parser.constructs[e],u=i.attempt(c,f,l);return f;function f(g){return p(g)?u(g):l(g)}function l(g){if(g===null){i.consume(g);return}return i.enter("data"),i.consume(g),d}function d(g){return p(g)?(i.exit("data"),u(g)):(i.consume(g),d)}function p(g){if(g===null)return!0;const m=c[g];let y=-1;if(m)for(;++y<m.length;){const _=m[y];if(!_.previous||_.previous.call(s,s.previous))return!0}return!1}}}function ay(e){return r;function r(i,s){let c=-1,u;for(;++c<=i.length;)u===void 0?i[c]&&i[c][1].type==="data"&&(u=c,c++):(!i[c]||i[c][1].type!=="data")&&(c!==u+2&&(i[u][1].end=i[c-1][1].end,i.splice(u+2,c-u-2),c=u+2),u=void 0);return e?e(i,s):i}}function kk(e,r){let i=0;for(;++i<=e.length;)if((i===e.length||e[i][1].type==="lineEnding")&&e[i-1][1].type==="data"){const s=e[i-1][1],c=r.sliceStream(s);let u=c.length,f=-1,l=0,d;for(;u--;){const p=c[u];if(typeof p=="string"){for(f=p.length;p.charCodeAt(f-1)===32;)l++,f--;if(f)break;f=-1}else if(p===-2)d=!0,l++;else if(p!==-1){u++;break}}if(r._contentTypeTextTrailing&&i===e.length&&(l=0),l){const p={type:i===e.length||d||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:u?f:s.start._bufferIndex+f,_index:s.start._index+u,line:s.end.line,column:s.end.column-l,offset:s.end.offset-l},end:{...s.end}};s.end={...p.start},s.start.offset===s.end.offset?Object.assign(s,p):(e.splice(i,0,["enter",p,r],["exit",p,r]),i+=2)}i++}return e}const Ek={42:yn,43:yn,45:yn,48:yn,49:yn,50:yn,51:yn,52:yn,53:yn,54:yn,55:yn,56:yn,57:yn,62:Qb},jk={91:DC},Nk={[-2]:Od,[-1]:Od,32:Od},Tk={35:IC,42:Nl,45:[hv,Nl],60:FC,61:hv,95:Nl,96:uv,126:uv},Ak={38:ey,92:Jb},Dk={[-5]:Bd,[-4]:Bd,[-3]:Bd,33:sk,38:ey,42:sh,60:[oC,YC],91:ok,92:[OC,Jb],93:Lh,95:sh,96:yC},Lk={null:[sh,Sk]},Rk={null:[42,95]},Mk={null:[]},Ok=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Rk,contentInitial:jk,disable:Mk,document:Ek,flow:Tk,flowInitial:Nk,insideSpan:Lk,string:Ak,text:Dk},Symbol.toStringTag,{value:"Module"}));function Bk(e,r,i){let s={_bufferIndex:-1,_index:0,line:i&&i.line||1,column:i&&i.column||1,offset:i&&i.offset||0};const c={},u=[];let f=[],l=[];const d={attempt:D(A),check:D(N),consume:x,enter:S,exit:j,interrupt:D(N,{interrupt:!0})},p={code:null,containerState:{},defineSkip:C,events:[],now:k,parser:e,previous:null,sliceSerialize:y,sliceStream:_,write:m};let g=r.tokenize.call(p,d);return r.resolveAll&&u.push(r),p;function m(V){return f=qn(f,V),v(),f[f.length-1]!==null?[]:(T(r,0),p.events=Zl(u,p.events,p),p.events)}function y(V,Y){return zk(_(V),Y)}function _(V){return Ik(f,V)}function k(){const{_bufferIndex:V,_index:Y,line:q,column:O,offset:U}=s;return{_bufferIndex:V,_index:Y,line:q,column:O,offset:U}}function C(V){c[V.line]=V.column,H()}function v(){let V;for(;s._index<f.length;){const Y=f[s._index];if(typeof Y=="string")for(V=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===V&&s._bufferIndex<Y.length;)b(Y.charCodeAt(s._bufferIndex));else b(Y)}}function b(V){g=g(V)}function x(V){He(V)?(s.line++,s.column=1,s.offset+=V===-3?2:1,H()):V!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===f[s._index].length&&(s._bufferIndex=-1,s._index++)),p.previous=V}function S(V,Y){const q=Y||{};return q.type=V,q.start=k(),p.events.push(["enter",q,p]),l.push(q),q}function j(V){const Y=l.pop();return Y.end=k(),p.events.push(["exit",Y,p]),Y}function A(V,Y){T(V,Y.from)}function N(V,Y){Y.restore()}function D(V,Y){return q;function q(O,U,z){let X,Q,M,L;return Array.isArray(O)?W(O):"tokenize"in O?W([O]):B(O);function B(ee){return K;function K($){const ae=$!==null&&ee[$],ne=$!==null&&ee.null,ve=[...Array.isArray(ae)?ae:ae?[ae]:[],...Array.isArray(ne)?ne:ne?[ne]:[]];return W(ve)($)}}function W(ee){return X=ee,Q=0,ee.length===0?z:F(ee[Q])}function F(ee){return K;function K($){return L=I(),M=ee,ee.partial||(p.currentConstruct=ee),ee.name&&p.parser.constructs.disable.null.includes(ee.name)?Z():ee.tokenize.call(Y?Object.assign(Object.create(p),Y):p,d,re,Z)($)}}function re(ee){return V(M,L),U}function Z(ee){return L.restore(),++Q<X.length?F(X[Q]):z}}}function T(V,Y){V.resolveAll&&!u.includes(V)&&u.push(V),V.resolve&&Rn(p.events,Y,p.events.length-Y,V.resolve(p.events.slice(Y),p)),V.resolveTo&&(p.events=V.resolveTo(p.events,p))}function I(){const V=k(),Y=p.previous,q=p.currentConstruct,O=p.events.length,U=Array.from(l);return{from:O,restore:z};function z(){s=V,p.previous=Y,p.currentConstruct=q,p.events.length=O,l=U,H()}}function H(){s.line in c&&s.column<2&&(s.column=c[s.line],s.offset+=c[s.line]-1)}}function Ik(e,r){const i=r.start._index,s=r.start._bufferIndex,c=r.end._index,u=r.end._bufferIndex;let f;if(i===c)f=[e[i].slice(s,u)];else{if(f=e.slice(i,c),s>-1){const l=f[0];typeof l=="string"?f[0]=l.slice(s):f.shift()}u>0&&f.push(e[c].slice(0,u))}return f}function zk(e,r){let i=-1;const s=[];let c;for(;++i<e.length;){const u=e[i];let f;if(typeof u=="string")f=u;else switch(u){case-5:{f="\r";break}case-4:{f=`
|
|
92
|
+
`;break}case-3:{f=`\r
|
|
93
|
+
`;break}case-2:{f=r?" ":" ";break}case-1:{if(!r&&c)continue;f=" ";break}default:f=String.fromCharCode(u)}c=u===-2,s.push(f)}return s.join("")}function Hk(e){const s={constructs:Xb([Ok,...(e||{}).extensions||[]]),content:c(eC),defined:[],document:c(nC),flow:c(yk),lazy:{},string:c(wk),text:c(Ck)};return s;function c(u){return f;function f(l){return Bk(s,u,l)}}}function Pk(e){for(;!ty(e););return e}const fv=/[\0\t\n\r]/g;function Fk(){let e=1,r="",i=!0,s;return c;function c(u,f,l){const d=[];let p,g,m,y,_;for(u=r+(typeof u=="string"?u.toString():new TextDecoder(f||void 0).decode(u)),m=0,r="",i&&(u.charCodeAt(0)===65279&&m++,i=void 0);m<u.length;){if(fv.lastIndex=m,p=fv.exec(u),y=p&&p.index!==void 0?p.index:u.length,_=u.charCodeAt(y),!p){r=u.slice(m);break}if(_===10&&m===y&&s)d.push(-3),s=void 0;else switch(s&&(d.push(-5),s=void 0),m<y&&(d.push(u.slice(m,y)),e+=y-m),_){case 0:{d.push(65533),e++;break}case 9:{for(g=Math.ceil(e/4)*4,d.push(-2);e++<g;)d.push(-1);break}case 10:{d.push(-4),e=1;break}default:s=!0,e=1}m=y+1}return l&&(s&&d.push(-5),r&&d.push(r),d.push(null)),d}}const Uk=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function $k(e){return e.replace(Uk,qk)}function qk(e,r,i){if(r)return r;if(i.charCodeAt(0)===35){const c=i.charCodeAt(1),u=c===120||c===88;return Zb(i.slice(u?2:1),u?16:10)}return Ka(i)||e}const oy={}.hasOwnProperty;function Wk(e,r,i){return r&&typeof r=="object"&&(i=r,r=void 0),Gk(i)(Pk(Hk(i).document().write(Fk()(e,r,!0))))}function Gk(e){const r={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(je),autolinkProtocol:I,autolinkEmail:I,atxHeading:u(Ie),blockQuote:u(ne),characterEscape:I,characterReference:I,codeFenced:u(ve),codeFencedFenceInfo:f,codeFencedFenceMeta:f,codeIndented:u(ve,f),codeText:u(be,f),codeTextData:I,data:I,codeFlowValue:I,definition:u(Ae),definitionDestinationString:f,definitionLabelString:f,definitionTitleString:f,emphasis:u(Me),hardBreakEscape:u(Fe),hardBreakTrailing:u(Fe),htmlFlow:u(ke,f),htmlFlowData:I,htmlText:u(ke,f),htmlTextData:I,image:u(ge),label:f,link:u(je),listItem:u(Lt),listItemValue:y,listOrdered:u(We,m),listUnordered:u(We),paragraph:u(pe),reference:F,referenceString:f,resourceDestinationString:f,resourceTitleString:f,setextHeading:u(Ie),strong:u(Ne),thematicBreak:u(lt)},exit:{atxHeading:d(),atxHeadingSequence:A,autolink:d(),autolinkEmail:ae,autolinkProtocol:$,blockQuote:d(),characterEscapeValue:H,characterReferenceMarkerHexadecimal:Z,characterReferenceMarkerNumeric:Z,characterReferenceValue:ee,characterReference:K,codeFenced:d(v),codeFencedFence:C,codeFencedFenceInfo:_,codeFencedFenceMeta:k,codeFlowValue:H,codeIndented:d(b),codeText:d(U),codeTextData:H,data:H,definition:d(),definitionDestinationString:j,definitionLabelString:x,definitionTitleString:S,emphasis:d(),hardBreakEscape:d(Y),hardBreakTrailing:d(Y),htmlFlow:d(q),htmlFlowData:H,htmlText:d(O),htmlTextData:H,image:d(X),label:M,labelText:Q,lineEnding:V,link:d(z),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:re,resourceDestinationString:L,resourceTitleString:B,resource:W,setextHeading:d(T),setextHeadingLineSequence:D,setextHeadingText:N,strong:d(),thematicBreak:d()}};ly(r,(e||{}).mdastExtensions||[]);const i={};return s;function s(ue){let _e={type:"root",children:[]};const Te={stack:[_e],tokenStack:[],config:r,enter:l,exit:p,buffer:f,resume:g,data:i},Be=[];let Ve=-1;for(;++Ve<ue.length;)if(ue[Ve][1].type==="listOrdered"||ue[Ve][1].type==="listUnordered")if(ue[Ve][0]==="enter")Be.push(Ve);else{const Ct=Be.pop();Ve=c(ue,Ct,Ve)}for(Ve=-1;++Ve<ue.length;){const Ct=r[ue[Ve][0]];oy.call(Ct,ue[Ve][1].type)&&Ct[ue[Ve][1].type].call(Object.assign({sliceSerialize:ue[Ve][2].sliceSerialize},Te),ue[Ve][1])}if(Te.tokenStack.length>0){const Ct=Te.tokenStack[Te.tokenStack.length-1];(Ct[1]||pv).call(Te,void 0,Ct[0])}for(_e.position={start:ei(ue.length>0?ue[0][1].start:{line:1,column:1,offset:0}),end:ei(ue.length>0?ue[ue.length-2][1].end:{line:1,column:1,offset:0})},Ve=-1;++Ve<r.transforms.length;)_e=r.transforms[Ve](_e)||_e;return _e}function c(ue,_e,Te){let Be=_e-1,Ve=-1,Ct=!1,se,Le,$e,at;for(;++Be<=Te;){const qe=ue[Be];switch(qe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{qe[0]==="enter"?Ve++:Ve--,at=void 0;break}case"lineEndingBlank":{qe[0]==="enter"&&(se&&!at&&!Ve&&!$e&&($e=Be),at=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:at=void 0}if(!Ve&&qe[0]==="enter"&&qe[1].type==="listItemPrefix"||Ve===-1&&qe[0]==="exit"&&(qe[1].type==="listUnordered"||qe[1].type==="listOrdered")){if(se){let Ut=Be;for(Le=void 0;Ut--;){const Rt=ue[Ut];if(Rt[1].type==="lineEnding"||Rt[1].type==="lineEndingBlank"){if(Rt[0]==="exit")continue;Le&&(ue[Le][1].type="lineEndingBlank",Ct=!0),Rt[1].type="lineEnding",Le=Ut}else if(!(Rt[1].type==="linePrefix"||Rt[1].type==="blockQuotePrefix"||Rt[1].type==="blockQuotePrefixWhitespace"||Rt[1].type==="blockQuoteMarker"||Rt[1].type==="listItemIndent"))break}$e&&(!Le||$e<Le)&&(se._spread=!0),se.end=Object.assign({},Le?ue[Le][1].start:qe[1].end),ue.splice(Le||Be,0,["exit",se,qe[2]]),Be++,Te++}if(qe[1].type==="listItemPrefix"){const Ut={type:"listItem",_spread:!1,start:Object.assign({},qe[1].start),end:void 0};se=Ut,ue.splice(Be,0,["enter",Ut,qe[2]]),Be++,Te++,$e=void 0,at=!0}}}return ue[_e][1]._spread=Ct,Te}function u(ue,_e){return Te;function Te(Be){l.call(this,ue(Be),Be),_e&&_e.call(this,Be)}}function f(){this.stack.push({type:"fragment",children:[]})}function l(ue,_e,Te){this.stack[this.stack.length-1].children.push(ue),this.stack.push(ue),this.tokenStack.push([_e,Te||void 0]),ue.position={start:ei(_e.start),end:void 0}}function d(ue){return _e;function _e(Te){ue&&ue.call(this,Te),p.call(this,Te)}}function p(ue,_e){const Te=this.stack.pop(),Be=this.tokenStack.pop();if(Be)Be[0].type!==ue.type&&(_e?_e.call(this,ue,Be[0]):(Be[1]||pv).call(this,ue,Be[0]));else throw new Error("Cannot close `"+ue.type+"` ("+Fa({start:ue.start,end:ue.end})+"): it’s not open");Te.position.end=ei(ue.end)}function g(){return Dh(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function y(ue){if(this.data.expectingFirstListItemValue){const _e=this.stack[this.stack.length-2];_e.start=Number.parseInt(this.sliceSerialize(ue),10),this.data.expectingFirstListItemValue=void 0}}function _(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.lang=ue}function k(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.meta=ue}function C(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ue.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ue.replace(/(\r?\n|\r)$/g,"")}function x(ue){const _e=this.resume(),Te=this.stack[this.stack.length-1];Te.label=_e,Te.identifier=Xn(this.sliceSerialize(ue)).toLowerCase()}function S(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.title=ue}function j(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.url=ue}function A(ue){const _e=this.stack[this.stack.length-1];if(!_e.depth){const Te=this.sliceSerialize(ue).length;_e.depth=Te}}function N(){this.data.setextHeadingSlurpLineEnding=!0}function D(ue){const _e=this.stack[this.stack.length-1];_e.depth=this.sliceSerialize(ue).codePointAt(0)===61?1:2}function T(){this.data.setextHeadingSlurpLineEnding=void 0}function I(ue){const Te=this.stack[this.stack.length-1].children;let Be=Te[Te.length-1];(!Be||Be.type!=="text")&&(Be=Oe(),Be.position={start:ei(ue.start),end:void 0},Te.push(Be)),this.stack.push(Be)}function H(ue){const _e=this.stack.pop();_e.value+=this.sliceSerialize(ue),_e.position.end=ei(ue.end)}function V(ue){const _e=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Te=_e.children[_e.children.length-1];Te.position.end=ei(ue.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&r.canContainEols.includes(_e.type)&&(I.call(this,ue),H.call(this,ue))}function Y(){this.data.atHardBreak=!0}function q(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ue}function O(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ue}function U(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ue}function z(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const _e=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=_e,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function X(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const _e=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=_e,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function Q(ue){const _e=this.sliceSerialize(ue),Te=this.stack[this.stack.length-2];Te.label=$k(_e),Te.identifier=Xn(_e).toLowerCase()}function M(){const ue=this.stack[this.stack.length-1],_e=this.resume(),Te=this.stack[this.stack.length-1];if(this.data.inReference=!0,Te.type==="link"){const Be=ue.children;Te.children=Be}else Te.alt=_e}function L(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.url=ue}function B(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.title=ue}function W(){this.data.inReference=void 0}function F(){this.data.referenceType="collapsed"}function re(ue){const _e=this.resume(),Te=this.stack[this.stack.length-1];Te.label=_e,Te.identifier=Xn(this.sliceSerialize(ue)).toLowerCase(),this.data.referenceType="full"}function Z(ue){this.data.characterReferenceType=ue.type}function ee(ue){const _e=this.sliceSerialize(ue),Te=this.data.characterReferenceType;let Be;Te?(Be=Zb(_e,Te==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Be=Ka(_e);const Ve=this.stack[this.stack.length-1];Ve.value+=Be}function K(ue){const _e=this.stack.pop();_e.position.end=ei(ue.end)}function $(ue){H.call(this,ue);const _e=this.stack[this.stack.length-1];_e.url=this.sliceSerialize(ue)}function ae(ue){H.call(this,ue);const _e=this.stack[this.stack.length-1];_e.url="mailto:"+this.sliceSerialize(ue)}function ne(){return{type:"blockquote",children:[]}}function ve(){return{type:"code",lang:null,meta:null,value:""}}function be(){return{type:"inlineCode",value:""}}function Ae(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Me(){return{type:"emphasis",children:[]}}function Ie(){return{type:"heading",depth:0,children:[]}}function Fe(){return{type:"break"}}function ke(){return{type:"html",value:""}}function ge(){return{type:"image",title:null,url:"",alt:null}}function je(){return{type:"link",title:null,url:"",children:[]}}function We(ue){return{type:"list",ordered:ue.type==="listOrdered",start:null,spread:ue._spread,children:[]}}function Lt(ue){return{type:"listItem",spread:ue._spread,checked:null,children:[]}}function pe(){return{type:"paragraph",children:[]}}function Ne(){return{type:"strong",children:[]}}function Oe(){return{type:"text",value:""}}function lt(){return{type:"thematicBreak"}}}function ei(e){return{line:e.line,column:e.column,offset:e.offset}}function ly(e,r){let i=-1;for(;++i<r.length;){const s=r[i];Array.isArray(s)?ly(e,s):Vk(e,s)}}function Vk(e,r){let i;for(i in r)if(oy.call(r,i))switch(i){case"canContainEols":{const s=r[i];s&&e[i].push(...s);break}case"transforms":{const s=r[i];s&&e[i].push(...s);break}case"enter":case"exit":{const s=r[i];s&&Object.assign(e[i],s);break}}}function pv(e,r){throw e?new Error("Cannot close `"+e.type+"` ("+Fa({start:e.start,end:e.end})+"): a different token (`"+r.type+"`, "+Fa({start:r.start,end:r.end})+") is open"):new Error("Cannot close document, a token (`"+r.type+"`, "+Fa({start:r.start,end:r.end})+") is still open")}function Yk(e){const r=this;r.parser=i;function i(s){return Wk(s,{...r.data("settings"),...e,extensions:r.data("micromarkExtensions")||[],mdastExtensions:r.data("fromMarkdownExtensions")||[]})}}function Kk(e,r){const i={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(r),!0)};return e.patch(r,i),e.applyData(r,i)}function Xk(e,r){const i={type:"element",tagName:"br",properties:{},children:[]};return e.patch(r,i),[e.applyData(r,i),{type:"text",value:`
|
|
94
|
+
`}]}function Zk(e,r){const i=r.value?r.value+`
|
|
95
|
+
`:"",s={},c=r.lang?r.lang.split(/\s+/):[];c.length>0&&(s.className=["language-"+c[0]]);let u={type:"element",tagName:"code",properties:s,children:[{type:"text",value:i}]};return r.meta&&(u.data={meta:r.meta}),e.patch(r,u),u=e.applyData(r,u),u={type:"element",tagName:"pre",properties:{},children:[u]},e.patch(r,u),u}function Qk(e,r){const i={type:"element",tagName:"del",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function Jk(e,r){const i={type:"element",tagName:"em",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function eE(e,r){const i=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(r.identifier).toUpperCase(),c=Is(s.toLowerCase()),u=e.footnoteOrder.indexOf(s);let f,l=e.footnoteCounts.get(s);l===void 0?(l=0,e.footnoteOrder.push(s),f=e.footnoteOrder.length):f=u+1,l+=1,e.footnoteCounts.set(s,l);const d={type:"element",tagName:"a",properties:{href:"#"+i+"fn-"+c,id:i+"fnref-"+c+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(f)}]};e.patch(r,d);const p={type:"element",tagName:"sup",properties:{},children:[d]};return e.patch(r,p),e.applyData(r,p)}function tE(e,r){const i={type:"element",tagName:"h"+r.depth,properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function nE(e,r){if(e.options.allowDangerousHtml){const i={type:"raw",value:r.value};return e.patch(r,i),e.applyData(r,i)}}function cy(e,r){const i=r.referenceType;let s="]";if(i==="collapsed"?s+="[]":i==="full"&&(s+="["+(r.label||r.identifier)+"]"),r.type==="imageReference")return[{type:"text",value:"!["+r.alt+s}];const c=e.all(r),u=c[0];u&&u.type==="text"?u.value="["+u.value:c.unshift({type:"text",value:"["});const f=c[c.length-1];return f&&f.type==="text"?f.value+=s:c.push({type:"text",value:s}),c}function rE(e,r){const i=String(r.identifier).toUpperCase(),s=e.definitionById.get(i);if(!s)return cy(e,r);const c={src:Is(s.url||""),alt:r.alt};s.title!==null&&s.title!==void 0&&(c.title=s.title);const u={type:"element",tagName:"img",properties:c,children:[]};return e.patch(r,u),e.applyData(r,u)}function iE(e,r){const i={src:Is(r.url)};r.alt!==null&&r.alt!==void 0&&(i.alt=r.alt),r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"img",properties:i,children:[]};return e.patch(r,s),e.applyData(r,s)}function sE(e,r){const i={type:"text",value:r.value.replace(/\r?\n|\r/g," ")};e.patch(r,i);const s={type:"element",tagName:"code",properties:{},children:[i]};return e.patch(r,s),e.applyData(r,s)}function aE(e,r){const i=String(r.identifier).toUpperCase(),s=e.definitionById.get(i);if(!s)return cy(e,r);const c={href:Is(s.url||"")};s.title!==null&&s.title!==void 0&&(c.title=s.title);const u={type:"element",tagName:"a",properties:c,children:e.all(r)};return e.patch(r,u),e.applyData(r,u)}function oE(e,r){const i={href:Is(r.url)};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"a",properties:i,children:e.all(r)};return e.patch(r,s),e.applyData(r,s)}function lE(e,r,i){const s=e.all(r),c=i?cE(i):uy(r),u={},f=[];if(typeof r.checked=="boolean"){const g=s[0];let m;g&&g.type==="element"&&g.tagName==="p"?m=g:(m={type:"element",tagName:"p",properties:{},children:[]},s.unshift(m)),m.children.length>0&&m.children.unshift({type:"text",value:" "}),m.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:r.checked,disabled:!0},children:[]}),u.className=["task-list-item"]}let l=-1;for(;++l<s.length;){const g=s[l];(c||l!==0||g.type!=="element"||g.tagName!=="p")&&f.push({type:"text",value:`
|
|
96
|
+
`}),g.type==="element"&&g.tagName==="p"&&!c?f.push(...g.children):f.push(g)}const d=s[s.length-1];d&&(c||d.type!=="element"||d.tagName!=="p")&&f.push({type:"text",value:`
|
|
97
|
+
`});const p={type:"element",tagName:"li",properties:u,children:f};return e.patch(r,p),e.applyData(r,p)}function cE(e){let r=!1;if(e.type==="list"){r=e.spread||!1;const i=e.children;let s=-1;for(;!r&&++s<i.length;)r=uy(i[s])}return r}function uy(e){const r=e.spread;return r??e.children.length>1}function uE(e,r){const i={},s=e.all(r);let c=-1;for(typeof r.start=="number"&&r.start!==1&&(i.start=r.start);++c<s.length;){const f=s[c];if(f.type==="element"&&f.tagName==="li"&&f.properties&&Array.isArray(f.properties.className)&&f.properties.className.includes("task-list-item")){i.className=["contains-task-list"];break}}const u={type:"element",tagName:r.ordered?"ol":"ul",properties:i,children:e.wrap(s,!0)};return e.patch(r,u),e.applyData(r,u)}function dE(e,r){const i={type:"element",tagName:"p",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function hE(e,r){const i={type:"root",children:e.wrap(e.all(r))};return e.patch(r,i),e.applyData(r,i)}function fE(e,r){const i={type:"element",tagName:"strong",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function pE(e,r){const i=e.all(r),s=i.shift(),c=[];if(s){const f={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!0)};e.patch(r.children[0],f),c.push(f)}if(i.length>0){const f={type:"element",tagName:"tbody",properties:{},children:e.wrap(i,!0)},l=jh(r.children[1]),d=$b(r.children[r.children.length-1]);l&&d&&(f.position={start:l,end:d}),c.push(f)}const u={type:"element",tagName:"table",properties:{},children:e.wrap(c,!0)};return e.patch(r,u),e.applyData(r,u)}function mE(e,r,i){const s=i?i.children:void 0,u=(s?s.indexOf(r):1)===0?"th":"td",f=i&&i.type==="table"?i.align:void 0,l=f?f.length:r.children.length;let d=-1;const p=[];for(;++d<l;){const m=r.children[d],y={},_=f?f[d]:void 0;_&&(y.align=_);let k={type:"element",tagName:u,properties:y,children:[]};m&&(k.children=e.all(m),e.patch(m,k),k=e.applyData(m,k)),p.push(k)}const g={type:"element",tagName:"tr",properties:{},children:e.wrap(p,!0)};return e.patch(r,g),e.applyData(r,g)}function gE(e,r){const i={type:"element",tagName:"td",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}const mv=9,gv=32;function xE(e){const r=String(e),i=/\r?\n|\r/g;let s=i.exec(r),c=0;const u=[];for(;s;)u.push(xv(r.slice(c,s.index),c>0,!0),s[0]),c=s.index+s[0].length,s=i.exec(r);return u.push(xv(r.slice(c),c>0,!1)),u.join("")}function xv(e,r,i){let s=0,c=e.length;if(r){let u=e.codePointAt(s);for(;u===mv||u===gv;)s++,u=e.codePointAt(s)}if(i){let u=e.codePointAt(c-1);for(;u===mv||u===gv;)c--,u=e.codePointAt(c-1)}return c>s?e.slice(s,c):""}function vE(e,r){const i={type:"text",value:xE(String(r.value))};return e.patch(r,i),e.applyData(r,i)}function bE(e,r){const i={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(r,i),e.applyData(r,i)}const yE={blockquote:Kk,break:Xk,code:Zk,delete:Qk,emphasis:Jk,footnoteReference:eE,heading:tE,html:nE,imageReference:rE,image:iE,inlineCode:sE,linkReference:aE,link:oE,listItem:lE,list:uE,paragraph:dE,root:hE,strong:fE,table:pE,tableCell:gE,tableRow:mE,text:vE,thematicBreak:bE,toml:Sl,yaml:Sl,definition:Sl,footnoteDefinition:Sl};function Sl(){}const dy=-1,Ql=0,$a=1,Ol=2,Rh=3,Mh=4,Oh=5,Bh=6,hy=7,fy=8,vv=typeof self=="object"?self:globalThis,_E=(e,r)=>{const i=(c,u)=>(e.set(u,c),c),s=c=>{if(e.has(c))return e.get(c);const[u,f]=r[c];switch(u){case Ql:case dy:return i(f,c);case $a:{const l=i([],c);for(const d of f)l.push(s(d));return l}case Ol:{const l=i({},c);for(const[d,p]of f)l[s(d)]=s(p);return l}case Rh:return i(new Date(f),c);case Mh:{const{source:l,flags:d}=f;return i(new RegExp(l,d),c)}case Oh:{const l=i(new Map,c);for(const[d,p]of f)l.set(s(d),s(p));return l}case Bh:{const l=i(new Set,c);for(const d of f)l.add(s(d));return l}case hy:{const{name:l,message:d}=f;return i(new vv[l](d),c)}case fy:return i(BigInt(f),c);case"BigInt":return i(Object(BigInt(f)),c);case"ArrayBuffer":return i(new Uint8Array(f).buffer,f);case"DataView":{const{buffer:l}=new Uint8Array(f);return i(new DataView(l),f)}}return i(new vv[u](f),c)};return s},bv=e=>_E(new Map,e)(0),ks="",{toString:SE}={},{keys:wE}=Object,Ba=e=>{const r=typeof e;if(r!=="object"||!e)return[Ql,r];const i=SE.call(e).slice(8,-1);switch(i){case"Array":return[$a,ks];case"Object":return[Ol,ks];case"Date":return[Rh,ks];case"RegExp":return[Mh,ks];case"Map":return[Oh,ks];case"Set":return[Bh,ks];case"DataView":return[$a,i]}return i.includes("Array")?[$a,i]:i.includes("Error")?[hy,i]:[Ol,i]},wl=([e,r])=>e===Ql&&(r==="function"||r==="symbol"),CE=(e,r,i,s)=>{const c=(f,l)=>{const d=s.push(f)-1;return i.set(l,d),d},u=f=>{if(i.has(f))return i.get(f);let[l,d]=Ba(f);switch(l){case Ql:{let g=f;switch(d){case"bigint":l=fy,g=f.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);g=null;break;case"undefined":return c([dy],f)}return c([l,g],f)}case $a:{if(d){let y=f;return d==="DataView"?y=new Uint8Array(f.buffer):d==="ArrayBuffer"&&(y=new Uint8Array(f)),c([d,[...y]],f)}const g=[],m=c([l,g],f);for(const y of f)g.push(u(y));return m}case Ol:{if(d)switch(d){case"BigInt":return c([d,f.toString()],f);case"Boolean":case"Number":case"String":return c([d,f.valueOf()],f)}if(r&&"toJSON"in f)return u(f.toJSON());const g=[],m=c([l,g],f);for(const y of wE(f))(e||!wl(Ba(f[y])))&&g.push([u(y),u(f[y])]);return m}case Rh:return c([l,f.toISOString()],f);case Mh:{const{source:g,flags:m}=f;return c([l,{source:g,flags:m}],f)}case Oh:{const g=[],m=c([l,g],f);for(const[y,_]of f)(e||!(wl(Ba(y))||wl(Ba(_))))&&g.push([u(y),u(_)]);return m}case Bh:{const g=[],m=c([l,g],f);for(const y of f)(e||!wl(Ba(y)))&&g.push(u(y));return m}}const{message:p}=f;return c([l,{name:d,message:p}],f)};return u},yv=(e,{json:r,lossy:i}={})=>{const s=[];return CE(!(r||i),!!r,new Map,s)(e),s},Bl=typeof structuredClone=="function"?(e,r)=>r&&("json"in r||"lossy"in r)?bv(yv(e,r)):structuredClone(e):(e,r)=>bv(yv(e,r));function kE(e,r){const i=[{type:"text",value:"↩"}];return r>1&&i.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(r)}]}),i}function EE(e,r){return"Back to reference "+(e+1)+(r>1?"-"+r:"")}function jE(e){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=e.options.footnoteBackContent||kE,s=e.options.footnoteBackLabel||EE,c=e.options.footnoteLabel||"Footnotes",u=e.options.footnoteLabelTagName||"h2",f=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let d=-1;for(;++d<e.footnoteOrder.length;){const p=e.footnoteById.get(e.footnoteOrder[d]);if(!p)continue;const g=e.all(p),m=String(p.identifier).toUpperCase(),y=Is(m.toLowerCase());let _=0;const k=[],C=e.footnoteCounts.get(m);for(;C!==void 0&&++_<=C;){k.length>0&&k.push({type:"text",value:" "});let x=typeof i=="string"?i:i(d,_);typeof x=="string"&&(x={type:"text",value:x}),k.push({type:"element",tagName:"a",properties:{href:"#"+r+"fnref-"+y+(_>1?"-"+_:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(d,_),className:["data-footnote-backref"]},children:Array.isArray(x)?x:[x]})}const v=g[g.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const x=v.children[v.children.length-1];x&&x.type==="text"?x.value+=" ":v.children.push({type:"text",value:" "}),v.children.push(...k)}else g.push(...k);const b={type:"element",tagName:"li",properties:{id:r+"fn-"+y},children:e.wrap(g,!0)};e.patch(p,b),l.push(b)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:u,properties:{...Bl(f),id:"footnote-label"},children:[{type:"text",value:c}]},{type:"text",value:`
|
|
98
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
|
|
99
|
+
`}]}}const Jl=(function(e){if(e==null)return DE;if(typeof e=="function")return ec(e);if(typeof e=="object")return Array.isArray(e)?NE(e):TE(e);if(typeof e=="string")return AE(e);throw new Error("Expected function, string, or object as test")});function NE(e){const r=[];let i=-1;for(;++i<e.length;)r[i]=Jl(e[i]);return ec(s);function s(...c){let u=-1;for(;++u<r.length;)if(r[u].apply(this,c))return!0;return!1}}function TE(e){const r=e;return ec(i);function i(s){const c=s;let u;for(u in e)if(c[u]!==r[u])return!1;return!0}}function AE(e){return ec(r);function r(i){return i&&i.type===e}}function ec(e){return r;function r(i,s,c){return!!(LE(i)&&e.call(this,i,typeof s=="number"?s:void 0,c||void 0))}}function DE(){return!0}function LE(e){return e!==null&&typeof e=="object"&&"type"in e}const py=[],RE=!0,ah=!1,ME="skip";function my(e,r,i,s){let c;typeof r=="function"&&typeof i!="function"?(s=i,i=r):c=r;const u=Jl(c),f=s?-1:1;l(e,void 0,[])();function l(d,p,g){const m=d&&typeof d=="object"?d:{};if(typeof m.type=="string"){const _=typeof m.tagName=="string"?m.tagName:typeof m.name=="string"?m.name:void 0;Object.defineProperty(y,"name",{value:"node ("+(d.type+(_?"<"+_+">":""))+")"})}return y;function y(){let _=py,k,C,v;if((!r||u(d,p,g[g.length-1]||void 0))&&(_=OE(i(d,g)),_[0]===ah))return _;if("children"in d&&d.children){const b=d;if(b.children&&_[0]!==ME)for(C=(s?b.children.length:-1)+f,v=g.concat(b);C>-1&&C<b.children.length;){const x=b.children[C];if(k=l(x,C,v)(),k[0]===ah)return k;C=typeof k[1]=="number"?k[1]:C+f}}return _}}}function OE(e){return Array.isArray(e)?e:typeof e=="number"?[RE,e]:e==null?py:[e]}function Ih(e,r,i,s){let c,u,f;typeof r=="function"&&typeof i!="function"?(u=void 0,f=r,c=i):(u=r,f=i,c=s),my(e,u,l,c);function l(d,p){const g=p[p.length-1],m=g?g.children.indexOf(d):void 0;return f(d,m,g)}}const oh={}.hasOwnProperty,BE={};function IE(e,r){const i=r||BE,s=new Map,c=new Map,u=new Map,f={...yE,...i.handlers},l={all:p,applyData:HE,definitionById:s,footnoteById:c,footnoteCounts:u,footnoteOrder:[],handlers:f,one:d,options:i,patch:zE,wrap:FE};return Ih(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const m=g.type==="definition"?s:c,y=String(g.identifier).toUpperCase();m.has(y)||m.set(y,g)}}),l;function d(g,m){const y=g.type,_=l.handlers[y];if(oh.call(l.handlers,y)&&_)return _(l,g,m);if(l.options.passThrough&&l.options.passThrough.includes(y)){if("children"in g){const{children:C,...v}=g,b=Bl(v);return b.children=l.all(g),b}return Bl(g)}return(l.options.unknownHandler||PE)(l,g,m)}function p(g){const m=[];if("children"in g){const y=g.children;let _=-1;for(;++_<y.length;){const k=l.one(y[_],g);if(k){if(_&&y[_-1].type==="break"&&(!Array.isArray(k)&&k.type==="text"&&(k.value=_v(k.value)),!Array.isArray(k)&&k.type==="element")){const C=k.children[0];C&&C.type==="text"&&(C.value=_v(C.value))}Array.isArray(k)?m.push(...k):m.push(k)}}}return m}}function zE(e,r){e.position&&(r.position=E2(e))}function HE(e,r){let i=r;if(e&&e.data){const s=e.data.hName,c=e.data.hChildren,u=e.data.hProperties;if(typeof s=="string")if(i.type==="element")i.tagName=s;else{const f="children"in i?i.children:[i];i={type:"element",tagName:s,properties:{},children:f}}i.type==="element"&&u&&Object.assign(i.properties,Bl(u)),"children"in i&&i.children&&c!==null&&c!==void 0&&(i.children=c)}return i}function PE(e,r){const i=r.data||{},s="value"in r&&!(oh.call(i,"hProperties")||oh.call(i,"hChildren"))?{type:"text",value:r.value}:{type:"element",tagName:"div",properties:{},children:e.all(r)};return e.patch(r,s),e.applyData(r,s)}function FE(e,r){const i=[];let s=-1;for(r&&i.push({type:"text",value:`
|
|
100
|
+
`});++s<e.length;)s&&i.push({type:"text",value:`
|
|
101
|
+
`}),i.push(e[s]);return r&&e.length>0&&i.push({type:"text",value:`
|
|
102
|
+
`}),i}function _v(e){let r=0,i=e.charCodeAt(r);for(;i===9||i===32;)r++,i=e.charCodeAt(r);return e.slice(r)}function Sv(e,r){const i=IE(e,r),s=i.one(e,void 0),c=jE(i),u=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return c&&u.children.push({type:"text",value:`
|
|
103
|
+
`},c),u}function UE(e,r){return e&&"run"in e?async function(i,s){const c=Sv(i,{file:s,...r});await e.run(c,s)}:function(i,s){return Sv(i,{file:s,...e||r})}}function wv(e){if(e)throw e}var Id,Cv;function $E(){if(Cv)return Id;Cv=1;var e=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,s=Object.getOwnPropertyDescriptor,c=function(p){return typeof Array.isArray=="function"?Array.isArray(p):r.call(p)==="[object Array]"},u=function(p){if(!p||r.call(p)!=="[object Object]")return!1;var g=e.call(p,"constructor"),m=p.constructor&&p.constructor.prototype&&e.call(p.constructor.prototype,"isPrototypeOf");if(p.constructor&&!g&&!m)return!1;var y;for(y in p);return typeof y>"u"||e.call(p,y)},f=function(p,g){i&&g.name==="__proto__"?i(p,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):p[g.name]=g.newValue},l=function(p,g){if(g==="__proto__")if(e.call(p,g)){if(s)return s(p,g).value}else return;return p[g]};return Id=function d(){var p,g,m,y,_,k,C=arguments[0],v=1,b=arguments.length,x=!1;for(typeof C=="boolean"&&(x=C,C=arguments[1]||{},v=2),(C==null||typeof C!="object"&&typeof C!="function")&&(C={});v<b;++v)if(p=arguments[v],p!=null)for(g in p)m=l(C,g),y=l(p,g),C!==y&&(x&&y&&(u(y)||(_=c(y)))?(_?(_=!1,k=m&&c(m)?m:[]):k=m&&u(m)?m:{},f(C,{name:g,newValue:d(x,k,y)})):typeof y<"u"&&f(C,{name:g,newValue:y}));return C},Id}var qE=$E();const zd=Pl(qE);function lh(e){if(typeof e!="object"||e===null)return!1;const r=Object.getPrototypeOf(e);return(r===null||r===Object.prototype||Object.getPrototypeOf(r)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function WE(){const e=[],r={run:i,use:s};return r;function i(...c){let u=-1;const f=c.pop();if(typeof f!="function")throw new TypeError("Expected function as last argument, not "+f);l(null,...c);function l(d,...p){const g=e[++u];let m=-1;if(d){f(d);return}for(;++m<c.length;)(p[m]===null||p[m]===void 0)&&(p[m]=c[m]);c=p,g?GE(g,l)(...p):f(null,...p)}}function s(c){if(typeof c!="function")throw new TypeError("Expected `middelware` to be a function, not "+c);return e.push(c),r}}function GE(e,r){let i;return s;function s(...f){const l=e.length>f.length;let d;l&&f.push(c);try{d=e.apply(this,f)}catch(p){const g=p;if(l&&i)throw g;return c(g)}l||(d&&d.then&&typeof d.then=="function"?d.then(u,c):d instanceof Error?c(d):u(d))}function c(f,...l){i||(i=!0,r(f,...l))}function u(f){c(null,f)}}const rr={basename:VE,dirname:YE,extname:KE,join:XE,sep:"/"};function VE(e,r){if(r!==void 0&&typeof r!="string")throw new TypeError('"ext" argument must be a string');ro(e);let i=0,s=-1,c=e.length,u;if(r===void 0||r.length===0||r.length>e.length){for(;c--;)if(e.codePointAt(c)===47){if(u){i=c+1;break}}else s<0&&(u=!0,s=c+1);return s<0?"":e.slice(i,s)}if(r===e)return"";let f=-1,l=r.length-1;for(;c--;)if(e.codePointAt(c)===47){if(u){i=c+1;break}}else f<0&&(u=!0,f=c+1),l>-1&&(e.codePointAt(c)===r.codePointAt(l--)?l<0&&(s=c):(l=-1,s=f));return i===s?s=f:s<0&&(s=e.length),e.slice(i,s)}function YE(e){if(ro(e),e.length===0)return".";let r=-1,i=e.length,s;for(;--i;)if(e.codePointAt(i)===47){if(s){r=i;break}}else s||(s=!0);return r<0?e.codePointAt(0)===47?"/":".":r===1&&e.codePointAt(0)===47?"//":e.slice(0,r)}function KE(e){ro(e);let r=e.length,i=-1,s=0,c=-1,u=0,f;for(;r--;){const l=e.codePointAt(r);if(l===47){if(f){s=r+1;break}continue}i<0&&(f=!0,i=r+1),l===46?c<0?c=r:u!==1&&(u=1):c>-1&&(u=-1)}return c<0||i<0||u===0||u===1&&c===i-1&&c===s+1?"":e.slice(c,i)}function XE(...e){let r=-1,i;for(;++r<e.length;)ro(e[r]),e[r]&&(i=i===void 0?e[r]:i+"/"+e[r]);return i===void 0?".":ZE(i)}function ZE(e){ro(e);const r=e.codePointAt(0)===47;let i=QE(e,!r);return i.length===0&&!r&&(i="."),i.length>0&&e.codePointAt(e.length-1)===47&&(i+="/"),r?"/"+i:i}function QE(e,r){let i="",s=0,c=-1,u=0,f=-1,l,d;for(;++f<=e.length;){if(f<e.length)l=e.codePointAt(f);else{if(l===47)break;l=47}if(l===47){if(!(c===f-1||u===1))if(c!==f-1&&u===2){if(i.length<2||s!==2||i.codePointAt(i.length-1)!==46||i.codePointAt(i.length-2)!==46){if(i.length>2){if(d=i.lastIndexOf("/"),d!==i.length-1){d<0?(i="",s=0):(i=i.slice(0,d),s=i.length-1-i.lastIndexOf("/")),c=f,u=0;continue}}else if(i.length>0){i="",s=0,c=f,u=0;continue}}r&&(i=i.length>0?i+"/..":"..",s=2)}else i.length>0?i+="/"+e.slice(c+1,f):i=e.slice(c+1,f),s=f-c-1;c=f,u=0}else l===46&&u>-1?u++:u=-1}return i}function ro(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const JE={cwd:ej};function ej(){return"/"}function ch(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function tj(e){if(typeof e=="string")e=new URL(e);else if(!ch(e)){const r=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw r.code="ERR_INVALID_ARG_TYPE",r}if(e.protocol!=="file:"){const r=new TypeError("The URL must be of scheme file");throw r.code="ERR_INVALID_URL_SCHEME",r}return nj(e)}function nj(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const r=e.pathname;let i=-1;for(;++i<r.length;)if(r.codePointAt(i)===37&&r.codePointAt(i+1)===50){const s=r.codePointAt(i+2);if(s===70||s===102){const c=new TypeError("File URL path must not include encoded / characters");throw c.code="ERR_INVALID_FILE_URL_PATH",c}}return decodeURIComponent(r)}const Hd=["history","path","basename","stem","extname","dirname"];class gy{constructor(r){let i;r?ch(r)?i={path:r}:typeof r=="string"||rj(r)?i={value:r}:i=r:i={},this.cwd="cwd"in i?"":JE.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<Hd.length;){const u=Hd[s];u in i&&i[u]!==void 0&&i[u]!==null&&(this[u]=u==="history"?[...i[u]]:i[u])}let c;for(c in i)Hd.includes(c)||(this[c]=i[c])}get basename(){return typeof this.path=="string"?rr.basename(this.path):void 0}set basename(r){Fd(r,"basename"),Pd(r,"basename"),this.path=rr.join(this.dirname||"",r)}get dirname(){return typeof this.path=="string"?rr.dirname(this.path):void 0}set dirname(r){kv(this.basename,"dirname"),this.path=rr.join(r||"",this.basename)}get extname(){return typeof this.path=="string"?rr.extname(this.path):void 0}set extname(r){if(Pd(r,"extname"),kv(this.dirname,"extname"),r){if(r.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(r.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=rr.join(this.dirname,this.stem+(r||""))}get path(){return this.history[this.history.length-1]}set path(r){ch(r)&&(r=tj(r)),Fd(r,"path"),this.path!==r&&this.history.push(r)}get stem(){return typeof this.path=="string"?rr.basename(this.path,this.extname):void 0}set stem(r){Fd(r,"stem"),Pd(r,"stem"),this.path=rr.join(this.dirname||"",r+(this.extname||""))}fail(r,i,s){const c=this.message(r,i,s);throw c.fatal=!0,c}info(r,i,s){const c=this.message(r,i,s);return c.fatal=void 0,c}message(r,i,s){const c=new cn(r,i,s);return this.path&&(c.name=this.path+":"+c.name,c.file=this.path),c.fatal=!1,this.messages.push(c),c}toString(r){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(r||void 0).decode(this.value)}}function Pd(e,r){if(e&&e.includes(rr.sep))throw new Error("`"+r+"` cannot be a path: did not expect `"+rr.sep+"`")}function Fd(e,r){if(!e)throw new Error("`"+r+"` cannot be empty")}function kv(e,r){if(!e)throw new Error("Setting `"+r+"` requires `path` to be set too")}function rj(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const ij=(function(e){const s=this.constructor.prototype,c=s[e],u=function(){return c.apply(u,arguments)};return Object.setPrototypeOf(u,s),u}),sj={}.hasOwnProperty;class zh extends ij{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=WE()}copy(){const r=new zh;let i=-1;for(;++i<this.attachers.length;){const s=this.attachers[i];r.use(...s)}return r.data(zd(!0,{},this.namespace)),r}data(r,i){return typeof r=="string"?arguments.length===2?(qd("data",this.frozen),this.namespace[r]=i,this):sj.call(this.namespace,r)&&this.namespace[r]||void 0:r?(qd("data",this.frozen),this.namespace=r,this):this.namespace}freeze(){if(this.frozen)return this;const r=this;for(;++this.freezeIndex<this.attachers.length;){const[i,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const c=i.call(r,...s);typeof c=="function"&&this.transformers.use(c)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(r){this.freeze();const i=Cl(r),s=this.parser||this.Parser;return Ud("parse",s),s(String(i),i)}process(r,i){const s=this;return this.freeze(),Ud("process",this.parser||this.Parser),$d("process",this.compiler||this.Compiler),i?c(void 0,i):new Promise(c);function c(u,f){const l=Cl(r),d=s.parse(l);s.run(d,l,function(g,m,y){if(g||!m||!y)return p(g);const _=m,k=s.stringify(_,y);lj(k)?y.value=k:y.result=k,p(g,y)});function p(g,m){g||!m?f(g):u?u(m):i(void 0,m)}}}processSync(r){let i=!1,s;return this.freeze(),Ud("processSync",this.parser||this.Parser),$d("processSync",this.compiler||this.Compiler),this.process(r,c),jv("processSync","process",i),s;function c(u,f){i=!0,wv(u),s=f}}run(r,i,s){Ev(r),this.freeze();const c=this.transformers;return!s&&typeof i=="function"&&(s=i,i=void 0),s?u(void 0,s):new Promise(u);function u(f,l){const d=Cl(i);c.run(r,d,p);function p(g,m,y){const _=m||r;g?l(g):f?f(_):s(void 0,_,y)}}}runSync(r,i){let s=!1,c;return this.run(r,i,u),jv("runSync","run",s),c;function u(f,l){wv(f),c=l,s=!0}}stringify(r,i){this.freeze();const s=Cl(i),c=this.compiler||this.Compiler;return $d("stringify",c),Ev(r),c(r,s)}use(r,...i){const s=this.attachers,c=this.namespace;if(qd("use",this.frozen),r!=null)if(typeof r=="function")d(r,i);else if(typeof r=="object")Array.isArray(r)?l(r):f(r);else throw new TypeError("Expected usable value, not `"+r+"`");return this;function u(p){if(typeof p=="function")d(p,[]);else if(typeof p=="object")if(Array.isArray(p)){const[g,...m]=p;d(g,m)}else f(p);else throw new TypeError("Expected usable value, not `"+p+"`")}function f(p){if(!("plugins"in p)&&!("settings"in p))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");l(p.plugins),p.settings&&(c.settings=zd(!0,c.settings,p.settings))}function l(p){let g=-1;if(p!=null)if(Array.isArray(p))for(;++g<p.length;){const m=p[g];u(m)}else throw new TypeError("Expected a list of plugins, not `"+p+"`")}function d(p,g){let m=-1,y=-1;for(;++m<s.length;)if(s[m][0]===p){y=m;break}if(y===-1)s.push([p,...g]);else if(g.length>0){let[_,...k]=g;const C=s[y][1];lh(C)&&lh(_)&&(_=zd(!0,C,_)),s[y]=[p,_,...k]}}}}const aj=new zh().freeze();function Ud(e,r){if(typeof r!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function $d(e,r){if(typeof r!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function qd(e,r){if(r)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Ev(e){if(!lh(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function jv(e,r,i){if(!i)throw new Error("`"+e+"` finished async. Use `"+r+"` instead")}function Cl(e){return oj(e)?e:new gy(e)}function oj(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function lj(e){return typeof e=="string"||cj(e)}function cj(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const uj="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Nv=[],Tv={allowDangerousHtml:!0},dj=/^(https?|ircs?|mailto|xmpp)$/i,hj=[{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 fj(e){const r=pj(e),i=mj(e);return gj(r.runSync(r.parse(i),i),e)}function pj(e){const r=e.rehypePlugins||Nv,i=e.remarkPlugins||Nv,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Tv}:Tv;return aj().use(Yk).use(i).use(UE,s).use(r)}function mj(e){const r=e.children||"",i=new gy;return typeof r=="string"&&(i.value=r),i}function gj(e,r){const i=r.allowedElements,s=r.allowElement,c=r.components,u=r.disallowedElements,f=r.skipHtml,l=r.unwrapDisallowed,d=r.urlTransform||xj;for(const g of hj)Object.hasOwn(r,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+uj+g.id,void 0);return Ih(e,p),D2(e,{Fragment:o.Fragment,components:c,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function p(g,m,y){if(g.type==="raw"&&y&&typeof m=="number")return f?y.children.splice(m,1):y.children[m]={type:"text",value:g.value},m;if(g.type==="element"){let _;for(_ in Md)if(Object.hasOwn(Md,_)&&Object.hasOwn(g.properties,_)){const k=g.properties[_],C=Md[_];(C===null||C.includes(g.tagName))&&(g.properties[_]=d(String(k||""),_,g))}}if(g.type==="element"){let _=i?!i.includes(g.tagName):u?u.includes(g.tagName):!1;if(!_&&s&&typeof m=="number"&&(_=!s(g,m,y)),_&&y&&typeof m=="number")return l&&g.children?y.children.splice(m,1,...g.children):y.children.splice(m,1),m}}}function xj(e){const r=e.indexOf(":"),i=e.indexOf("?"),s=e.indexOf("#"),c=e.indexOf("/");return r===-1||c!==-1&&r>c||i!==-1&&r>i||s!==-1&&r>s||dj.test(e.slice(0,r))?e:""}function Av(e,r){const i=String(e);if(typeof r!="string")throw new TypeError("Expected character");let s=0,c=i.indexOf(r);for(;c!==-1;)s++,c=i.indexOf(r,c+r.length);return s}function vj(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function bj(e,r,i){const c=Jl((i||{}).ignore||[]),u=yj(r);let f=-1;for(;++f<u.length;)my(e,"text",l);function l(p,g){let m=-1,y;for(;++m<g.length;){const _=g[m],k=y?y.children:void 0;if(c(_,k?k.indexOf(_):void 0,y))return;y=_}if(y)return d(p,g)}function d(p,g){const m=g[g.length-1],y=u[f][0],_=u[f][1];let k=0;const v=m.children.indexOf(p);let b=!1,x=[];y.lastIndex=0;let S=y.exec(p.value);for(;S;){const j=S.index,A={index:S.index,input:S.input,stack:[...g,p]};let N=_(...S,A);if(typeof N=="string"&&(N=N.length>0?{type:"text",value:N}:void 0),N===!1?y.lastIndex=j+1:(k!==j&&x.push({type:"text",value:p.value.slice(k,j)}),Array.isArray(N)?x.push(...N):N&&x.push(N),k=j+S[0].length,b=!0),!y.global)break;S=y.exec(p.value)}return b?(k<p.value.length&&x.push({type:"text",value:p.value.slice(k)}),m.children.splice(v,1,...x)):x=[p],v+x.length}}function yj(e){const r=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const i=!e[0]||Array.isArray(e[0])?e:[e];let s=-1;for(;++s<i.length;){const c=i[s];r.push([_j(c[0]),Sj(c[1])])}return r}function _j(e){return typeof e=="string"?new RegExp(vj(e),"g"):e}function Sj(e){return typeof e=="function"?e:function(){return e}}const Wd="phrasing",Gd=["autolink","link","image","label"];function wj(){return{transforms:[Aj],enter:{literalAutolink:kj,literalAutolinkEmail:Vd,literalAutolinkHttp:Vd,literalAutolinkWww:Vd},exit:{literalAutolink:Tj,literalAutolinkEmail:Nj,literalAutolinkHttp:Ej,literalAutolinkWww:jj}}}function Cj(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Wd,notInConstruct:Gd},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Wd,notInConstruct:Gd},{character:":",before:"[ps]",after:"\\/",inConstruct:Wd,notInConstruct:Gd}]}}function kj(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Vd(e){this.config.enter.autolinkProtocol.call(this,e)}function Ej(e){this.config.exit.autolinkProtocol.call(this,e)}function jj(e){this.config.exit.data.call(this,e);const r=this.stack[this.stack.length-1];r.type,r.url="http://"+this.sliceSerialize(e)}function Nj(e){this.config.exit.autolinkEmail.call(this,e)}function Tj(e){this.exit(e)}function Aj(e){bj(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Dj],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),Lj]],{ignore:["link","linkReference"]})}function Dj(e,r,i,s,c){let u="";if(!xy(c)||(/^w/i.test(r)&&(i=r+i,r="",u="http://"),!Rj(i)))return!1;const f=Mj(i+s);if(!f[0])return!1;const l={type:"link",title:null,url:u+r+f[0],children:[{type:"text",value:r+f[0]}]};return f[1]?[l,{type:"text",value:f[1]}]:l}function Lj(e,r,i,s){return!xy(s,!0)||/[-\d_]$/.test(i)?!1:{type:"link",title:null,url:"mailto:"+r+"@"+i,children:[{type:"text",value:r+"@"+i}]}}function Rj(e){const r=e.split(".");return!(r.length<2||r[r.length-1]&&(/_/.test(r[r.length-1])||!/[a-zA-Z\d]/.test(r[r.length-1]))||r[r.length-2]&&(/_/.test(r[r.length-2])||!/[a-zA-Z\d]/.test(r[r.length-2])))}function Mj(e){const r=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!r)return[e,void 0];e=e.slice(0,r.index);let i=r[0],s=i.indexOf(")");const c=Av(e,"(");let u=Av(e,")");for(;s!==-1&&c>u;)e+=i.slice(0,s+1),i=i.slice(s+1),s=i.indexOf(")"),u++;return[e,i]}function xy(e,r){const i=e.input.charCodeAt(e.index-1);return(e.index===0||Ri(i)||Xl(i))&&(!r||i!==47)}vy.peek=$j;function Oj(){this.buffer()}function Bj(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Ij(){this.buffer()}function zj(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Hj(e){const r=this.resume(),i=this.stack[this.stack.length-1];i.type,i.identifier=Xn(this.sliceSerialize(e)).toLowerCase(),i.label=r}function Pj(e){this.exit(e)}function Fj(e){const r=this.resume(),i=this.stack[this.stack.length-1];i.type,i.identifier=Xn(this.sliceSerialize(e)).toLowerCase(),i.label=r}function Uj(e){this.exit(e)}function $j(){return"["}function vy(e,r,i,s){const c=i.createTracker(s);let u=c.move("[^");const f=i.enter("footnoteReference"),l=i.enter("reference");return u+=c.move(i.safe(i.associationId(e),{after:"]",before:u})),l(),f(),u+=c.move("]"),u}function qj(){return{enter:{gfmFootnoteCallString:Oj,gfmFootnoteCall:Bj,gfmFootnoteDefinitionLabelString:Ij,gfmFootnoteDefinition:zj},exit:{gfmFootnoteCallString:Hj,gfmFootnoteCall:Pj,gfmFootnoteDefinitionLabelString:Fj,gfmFootnoteDefinition:Uj}}}function Wj(e){let r=!1;return e&&e.firstLineBlank&&(r=!0),{handlers:{footnoteDefinition:i,footnoteReference:vy},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function i(s,c,u,f){const l=u.createTracker(f);let d=l.move("[^");const p=u.enter("footnoteDefinition"),g=u.enter("label");return d+=l.move(u.safe(u.associationId(s),{before:d,after:"]"})),g(),d+=l.move("]:"),s.children&&s.children.length>0&&(l.shift(4),d+=l.move((r?`
|
|
104
|
+
`:" ")+u.indentLines(u.containerFlow(s,l.current()),r?by:Gj))),p(),d}}function Gj(e,r,i){return r===0?e:by(e,r,i)}function by(e,r,i){return(i?"":" ")+e}const Vj=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];yy.peek=Qj;function Yj(){return{canContainEols:["delete"],enter:{strikethrough:Xj},exit:{strikethrough:Zj}}}function Kj(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Vj}],handlers:{delete:yy}}}function Xj(e){this.enter({type:"delete",children:[]},e)}function Zj(e){this.exit(e)}function yy(e,r,i,s){const c=i.createTracker(s),u=i.enter("strikethrough");let f=c.move("~~");return f+=i.containerPhrasing(e,{...c.current(),before:f,after:"~"}),f+=c.move("~~"),u(),f}function Qj(){return"~"}function Jj(e){return e.length}function eN(e,r){const i=r||{},s=(i.align||[]).concat(),c=i.stringLength||Jj,u=[],f=[],l=[],d=[];let p=0,g=-1;for(;++g<e.length;){const C=[],v=[];let b=-1;for(e[g].length>p&&(p=e[g].length);++b<e[g].length;){const x=tN(e[g][b]);if(i.alignDelimiters!==!1){const S=c(x);v[b]=S,(d[b]===void 0||S>d[b])&&(d[b]=S)}C.push(x)}f[g]=C,l[g]=v}let m=-1;if(typeof s=="object"&&"length"in s)for(;++m<p;)u[m]=Dv(s[m]);else{const C=Dv(s);for(;++m<p;)u[m]=C}m=-1;const y=[],_=[];for(;++m<p;){const C=u[m];let v="",b="";C===99?(v=":",b=":"):C===108?v=":":C===114&&(b=":");let x=i.alignDelimiters===!1?1:Math.max(1,d[m]-v.length-b.length);const S=v+"-".repeat(x)+b;i.alignDelimiters!==!1&&(x=v.length+x+b.length,x>d[m]&&(d[m]=x),_[m]=x),y[m]=S}f.splice(1,0,y),l.splice(1,0,_),g=-1;const k=[];for(;++g<f.length;){const C=f[g],v=l[g];m=-1;const b=[];for(;++m<p;){const x=C[m]||"";let S="",j="";if(i.alignDelimiters!==!1){const A=d[m]-(v[m]||0),N=u[m];N===114?S=" ".repeat(A):N===99?A%2?(S=" ".repeat(A/2+.5),j=" ".repeat(A/2-.5)):(S=" ".repeat(A/2),j=S):j=" ".repeat(A)}i.delimiterStart!==!1&&!m&&b.push("|"),i.padding!==!1&&!(i.alignDelimiters===!1&&x==="")&&(i.delimiterStart!==!1||m)&&b.push(" "),i.alignDelimiters!==!1&&b.push(S),b.push(x),i.alignDelimiters!==!1&&b.push(j),i.padding!==!1&&b.push(" "),(i.delimiterEnd!==!1||m!==p-1)&&b.push("|")}k.push(i.delimiterEnd===!1?b.join("").replace(/ +$/,""):b.join(""))}return k.join(`
|
|
105
|
+
`)}function tN(e){return e==null?"":String(e)}function Dv(e){const r=typeof e=="string"?e.codePointAt(0):0;return r===67||r===99?99:r===76||r===108?108:r===82||r===114?114:0}function nN(e,r,i,s){const c=i.enter("blockquote"),u=i.createTracker(s);u.move("> "),u.shift(2);const f=i.indentLines(i.containerFlow(e,u.current()),rN);return c(),f}function rN(e,r,i){return">"+(i?"":" ")+e}function iN(e,r){return Lv(e,r.inConstruct,!0)&&!Lv(e,r.notInConstruct,!1)}function Lv(e,r,i){if(typeof r=="string"&&(r=[r]),!r||r.length===0)return i;let s=-1;for(;++s<r.length;)if(e.includes(r[s]))return!0;return!1}function Rv(e,r,i,s){let c=-1;for(;++c<i.unsafe.length;)if(i.unsafe[c].character===`
|
|
106
|
+
`&&iN(i.stack,i.unsafe[c]))return/[ \t]/.test(s.before)?"":" ";return`\\
|
|
107
|
+
`}function sN(e,r){const i=String(e);let s=i.indexOf(r),c=s,u=0,f=0;if(typeof r!="string")throw new TypeError("Expected substring");for(;s!==-1;)s===c?++u>f&&(f=u):u=1,c=s+r.length,s=i.indexOf(r,c);return f}function aN(e,r){return!!(r.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function oN(e){const r=e.options.fence||"`";if(r!=="`"&&r!=="~")throw new Error("Cannot serialize code with `"+r+"` for `options.fence`, expected `` ` `` or `~`");return r}function lN(e,r,i,s){const c=oN(i),u=e.value||"",f=c==="`"?"GraveAccent":"Tilde";if(aN(e,i)){const m=i.enter("codeIndented"),y=i.indentLines(u,cN);return m(),y}const l=i.createTracker(s),d=c.repeat(Math.max(sN(u,c)+1,3)),p=i.enter("codeFenced");let g=l.move(d);if(e.lang){const m=i.enter(`codeFencedLang${f}`);g+=l.move(i.safe(e.lang,{before:g,after:" ",encode:["`"],...l.current()})),m()}if(e.lang&&e.meta){const m=i.enter(`codeFencedMeta${f}`);g+=l.move(" "),g+=l.move(i.safe(e.meta,{before:g,after:`
|
|
108
|
+
`,encode:["`"],...l.current()})),m()}return g+=l.move(`
|
|
109
|
+
`),u&&(g+=l.move(u+`
|
|
110
|
+
`)),g+=l.move(d),p(),g}function cN(e,r,i){return(i?"":" ")+e}function Hh(e){const r=e.options.quote||'"';if(r!=='"'&&r!=="'")throw new Error("Cannot serialize title with `"+r+"` for `options.quote`, expected `\"`, or `'`");return r}function uN(e,r,i,s){const c=Hh(i),u=c==='"'?"Quote":"Apostrophe",f=i.enter("definition");let l=i.enter("label");const d=i.createTracker(s);let p=d.move("[");return p+=d.move(i.safe(i.associationId(e),{before:p,after:"]",...d.current()})),p+=d.move("]: "),l(),!e.url||/[\0- \u007F]/.test(e.url)?(l=i.enter("destinationLiteral"),p+=d.move("<"),p+=d.move(i.safe(e.url,{before:p,after:">",...d.current()})),p+=d.move(">")):(l=i.enter("destinationRaw"),p+=d.move(i.safe(e.url,{before:p,after:e.title?" ":`
|
|
111
|
+
`,...d.current()}))),l(),e.title&&(l=i.enter(`title${u}`),p+=d.move(" "+c),p+=d.move(i.safe(e.title,{before:p,after:c,...d.current()})),p+=d.move(c),l()),f(),p}function dN(e){const r=e.options.emphasis||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize emphasis with `"+r+"` for `options.emphasis`, expected `*`, or `_`");return r}function Xa(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Il(e,r,i){const s=Ms(e),c=Ms(r);return s===void 0?c===void 0?i==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:c===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:s===1?c===void 0?{inside:!1,outside:!1}:c===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:c===void 0?{inside:!1,outside:!1}:c===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}_y.peek=hN;function _y(e,r,i,s){const c=dN(i),u=i.enter("emphasis"),f=i.createTracker(s),l=f.move(c);let d=f.move(i.containerPhrasing(e,{after:c,before:l,...f.current()}));const p=d.charCodeAt(0),g=Il(s.before.charCodeAt(s.before.length-1),p,c);g.inside&&(d=Xa(p)+d.slice(1));const m=d.charCodeAt(d.length-1),y=Il(s.after.charCodeAt(0),m,c);y.inside&&(d=d.slice(0,-1)+Xa(m));const _=f.move(c);return u(),i.attentionEncodeSurroundingInfo={after:y.outside,before:g.outside},l+d+_}function hN(e,r,i){return i.options.emphasis||"*"}function fN(e,r){let i=!1;return Ih(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return i=!0,ah}),!!((!e.depth||e.depth<3)&&Dh(e)&&(r.options.setext||i))}function pN(e,r,i,s){const c=Math.max(Math.min(6,e.depth||1),1),u=i.createTracker(s);if(fN(e,i)){const g=i.enter("headingSetext"),m=i.enter("phrasing"),y=i.containerPhrasing(e,{...u.current(),before:`
|
|
112
|
+
`,after:`
|
|
113
|
+
`});return m(),g(),y+`
|
|
114
|
+
`+(c===1?"=":"-").repeat(y.length-(Math.max(y.lastIndexOf("\r"),y.lastIndexOf(`
|
|
115
|
+
`))+1))}const f="#".repeat(c),l=i.enter("headingAtx"),d=i.enter("phrasing");u.move(f+" ");let p=i.containerPhrasing(e,{before:"# ",after:`
|
|
116
|
+
`,...u.current()});return/^[\t ]/.test(p)&&(p=Xa(p.charCodeAt(0))+p.slice(1)),p=p?f+" "+p:f,i.options.closeAtx&&(p+=" "+f),d(),l(),p}Sy.peek=mN;function Sy(e){return e.value||""}function mN(){return"<"}wy.peek=gN;function wy(e,r,i,s){const c=Hh(i),u=c==='"'?"Quote":"Apostrophe",f=i.enter("image");let l=i.enter("label");const d=i.createTracker(s);let p=d.move("![");return p+=d.move(i.safe(e.alt,{before:p,after:"]",...d.current()})),p+=d.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=i.enter("destinationLiteral"),p+=d.move("<"),p+=d.move(i.safe(e.url,{before:p,after:">",...d.current()})),p+=d.move(">")):(l=i.enter("destinationRaw"),p+=d.move(i.safe(e.url,{before:p,after:e.title?" ":")",...d.current()}))),l(),e.title&&(l=i.enter(`title${u}`),p+=d.move(" "+c),p+=d.move(i.safe(e.title,{before:p,after:c,...d.current()})),p+=d.move(c),l()),p+=d.move(")"),f(),p}function gN(){return"!"}Cy.peek=xN;function Cy(e,r,i,s){const c=e.referenceType,u=i.enter("imageReference");let f=i.enter("label");const l=i.createTracker(s);let d=l.move("![");const p=i.safe(e.alt,{before:d,after:"]",...l.current()});d+=l.move(p+"]["),f();const g=i.stack;i.stack=[],f=i.enter("reference");const m=i.safe(i.associationId(e),{before:d,after:"]",...l.current()});return f(),i.stack=g,u(),c==="full"||!p||p!==m?d+=l.move(m+"]"):c==="shortcut"?d=d.slice(0,-1):d+=l.move("]"),d}function xN(){return"!"}ky.peek=vN;function ky(e,r,i){let s=e.value||"",c="`",u=-1;for(;new RegExp("(^|[^`])"+c+"([^`]|$)").test(s);)c+="`";for(/[^ \r\n]/.test(s)&&(/^[ \r\n]/.test(s)&&/[ \r\n]$/.test(s)||/^`|`$/.test(s))&&(s=" "+s+" ");++u<i.unsafe.length;){const f=i.unsafe[u],l=i.compilePattern(f);let d;if(f.atBreak)for(;d=l.exec(s);){let p=d.index;s.charCodeAt(p)===10&&s.charCodeAt(p-1)===13&&p--,s=s.slice(0,p)+" "+s.slice(d.index+1)}}return c+s+c}function vN(){return"`"}function Ey(e,r){const i=Dh(e);return!!(!r.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(i===e.url||"mailto:"+i===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}jy.peek=bN;function jy(e,r,i,s){const c=Hh(i),u=c==='"'?"Quote":"Apostrophe",f=i.createTracker(s);let l,d;if(Ey(e,i)){const g=i.stack;i.stack=[],l=i.enter("autolink");let m=f.move("<");return m+=f.move(i.containerPhrasing(e,{before:m,after:">",...f.current()})),m+=f.move(">"),l(),i.stack=g,m}l=i.enter("link"),d=i.enter("label");let p=f.move("[");return p+=f.move(i.containerPhrasing(e,{before:p,after:"](",...f.current()})),p+=f.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=i.enter("destinationLiteral"),p+=f.move("<"),p+=f.move(i.safe(e.url,{before:p,after:">",...f.current()})),p+=f.move(">")):(d=i.enter("destinationRaw"),p+=f.move(i.safe(e.url,{before:p,after:e.title?" ":")",...f.current()}))),d(),e.title&&(d=i.enter(`title${u}`),p+=f.move(" "+c),p+=f.move(i.safe(e.title,{before:p,after:c,...f.current()})),p+=f.move(c),d()),p+=f.move(")"),l(),p}function bN(e,r,i){return Ey(e,i)?"<":"["}Ny.peek=yN;function Ny(e,r,i,s){const c=e.referenceType,u=i.enter("linkReference");let f=i.enter("label");const l=i.createTracker(s);let d=l.move("[");const p=i.containerPhrasing(e,{before:d,after:"]",...l.current()});d+=l.move(p+"]["),f();const g=i.stack;i.stack=[],f=i.enter("reference");const m=i.safe(i.associationId(e),{before:d,after:"]",...l.current()});return f(),i.stack=g,u(),c==="full"||!p||p!==m?d+=l.move(m+"]"):c==="shortcut"?d=d.slice(0,-1):d+=l.move("]"),d}function yN(){return"["}function Ph(e){const r=e.options.bullet||"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bullet`, expected `*`, `+`, or `-`");return r}function _N(e){const r=Ph(e),i=e.options.bulletOther;if(!i)return r==="*"?"-":"*";if(i!=="*"&&i!=="+"&&i!=="-")throw new Error("Cannot serialize items with `"+i+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(i===r)throw new Error("Expected `bullet` (`"+r+"`) and `bulletOther` (`"+i+"`) to be different");return i}function SN(e){const r=e.options.bulletOrdered||".";if(r!=="."&&r!==")")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOrdered`, expected `.` or `)`");return r}function Ty(e){const r=e.options.rule||"*";if(r!=="*"&&r!=="-"&&r!=="_")throw new Error("Cannot serialize rules with `"+r+"` for `options.rule`, expected `*`, `-`, or `_`");return r}function wN(e,r,i,s){const c=i.enter("list"),u=i.bulletCurrent;let f=e.ordered?SN(i):Ph(i);const l=e.ordered?f==="."?")":".":_N(i);let d=r&&i.bulletLastUsed?f===i.bulletLastUsed:!1;if(!e.ordered){const g=e.children?e.children[0]:void 0;if((f==="*"||f==="-")&&g&&(!g.children||!g.children[0])&&i.stack[i.stack.length-1]==="list"&&i.stack[i.stack.length-2]==="listItem"&&i.stack[i.stack.length-3]==="list"&&i.stack[i.stack.length-4]==="listItem"&&i.indexStack[i.indexStack.length-1]===0&&i.indexStack[i.indexStack.length-2]===0&&i.indexStack[i.indexStack.length-3]===0&&(d=!0),Ty(i)===f&&g){let m=-1;for(;++m<e.children.length;){const y=e.children[m];if(y&&y.type==="listItem"&&y.children&&y.children[0]&&y.children[0].type==="thematicBreak"){d=!0;break}}}}d&&(f=l),i.bulletCurrent=f;const p=i.containerFlow(e,s);return i.bulletLastUsed=f,i.bulletCurrent=u,c(),p}function CN(e){const r=e.options.listItemIndent||"one";if(r!=="tab"&&r!=="one"&&r!=="mixed")throw new Error("Cannot serialize items with `"+r+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return r}function kN(e,r,i,s){const c=CN(i);let u=i.bulletCurrent||Ph(i);r&&r.type==="list"&&r.ordered&&(u=(typeof r.start=="number"&&r.start>-1?r.start:1)+(i.options.incrementListMarker===!1?0:r.children.indexOf(e))+u);let f=u.length+1;(c==="tab"||c==="mixed"&&(r&&r.type==="list"&&r.spread||e.spread))&&(f=Math.ceil(f/4)*4);const l=i.createTracker(s);l.move(u+" ".repeat(f-u.length)),l.shift(f);const d=i.enter("listItem"),p=i.indentLines(i.containerFlow(e,l.current()),g);return d(),p;function g(m,y,_){return y?(_?"":" ".repeat(f))+m:(_?u:u+" ".repeat(f-u.length))+m}}function EN(e,r,i,s){const c=i.enter("paragraph"),u=i.enter("phrasing"),f=i.containerPhrasing(e,s);return u(),c(),f}const jN=Jl(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function NN(e,r,i,s){return(e.children.some(function(f){return jN(f)})?i.containerPhrasing:i.containerFlow).call(i,e,s)}function TN(e){const r=e.options.strong||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize strong with `"+r+"` for `options.strong`, expected `*`, or `_`");return r}Ay.peek=AN;function Ay(e,r,i,s){const c=TN(i),u=i.enter("strong"),f=i.createTracker(s),l=f.move(c+c);let d=f.move(i.containerPhrasing(e,{after:c,before:l,...f.current()}));const p=d.charCodeAt(0),g=Il(s.before.charCodeAt(s.before.length-1),p,c);g.inside&&(d=Xa(p)+d.slice(1));const m=d.charCodeAt(d.length-1),y=Il(s.after.charCodeAt(0),m,c);y.inside&&(d=d.slice(0,-1)+Xa(m));const _=f.move(c+c);return u(),i.attentionEncodeSurroundingInfo={after:y.outside,before:g.outside},l+d+_}function AN(e,r,i){return i.options.strong||"*"}function DN(e,r,i,s){return i.safe(e.value,s)}function LN(e){const r=e.options.ruleRepetition||3;if(r<3)throw new Error("Cannot serialize rules with repetition `"+r+"` for `options.ruleRepetition`, expected `3` or more");return r}function RN(e,r,i){const s=(Ty(i)+(i.options.ruleSpaces?" ":"")).repeat(LN(i));return i.options.ruleSpaces?s.slice(0,-1):s}const Dy={blockquote:nN,break:Rv,code:lN,definition:uN,emphasis:_y,hardBreak:Rv,heading:pN,html:Sy,image:wy,imageReference:Cy,inlineCode:ky,link:jy,linkReference:Ny,list:wN,listItem:kN,paragraph:EN,root:NN,strong:Ay,text:DN,thematicBreak:RN};function MN(){return{enter:{table:ON,tableData:Mv,tableHeader:Mv,tableRow:IN},exit:{codeText:zN,table:BN,tableData:Yd,tableHeader:Yd,tableRow:Yd}}}function ON(e){const r=e._align;this.enter({type:"table",align:r.map(function(i){return i==="none"?null:i}),children:[]},e),this.data.inTable=!0}function BN(e){this.exit(e),this.data.inTable=void 0}function IN(e){this.enter({type:"tableRow",children:[]},e)}function Yd(e){this.exit(e)}function Mv(e){this.enter({type:"tableCell",children:[]},e)}function zN(e){let r=this.resume();this.data.inTable&&(r=r.replace(/\\([\\|])/g,HN));const i=this.stack[this.stack.length-1];i.type,i.value=r,this.exit(e)}function HN(e,r){return r==="|"?r:e}function PN(e){const r=e||{},i=r.tableCellPadding,s=r.tablePipeAlign,c=r.stringLength,u=i?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
117
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:y,table:f,tableCell:d,tableRow:l}};function f(_,k,C,v){return p(g(_,C,v),_.align)}function l(_,k,C,v){const b=m(_,C,v),x=p([b]);return x.slice(0,x.indexOf(`
|
|
118
|
+
`))}function d(_,k,C,v){const b=C.enter("tableCell"),x=C.enter("phrasing"),S=C.containerPhrasing(_,{...v,before:u,after:u});return x(),b(),S}function p(_,k){return eN(_,{align:k,alignDelimiters:s,padding:i,stringLength:c})}function g(_,k,C){const v=_.children;let b=-1;const x=[],S=k.enter("table");for(;++b<v.length;)x[b]=m(v[b],k,C);return S(),x}function m(_,k,C){const v=_.children;let b=-1;const x=[],S=k.enter("tableRow");for(;++b<v.length;)x[b]=d(v[b],_,k,C);return S(),x}function y(_,k,C){let v=Dy.inlineCode(_,k,C);return C.stack.includes("tableCell")&&(v=v.replace(/\|/g,"\\$&")),v}}function FN(){return{exit:{taskListCheckValueChecked:Ov,taskListCheckValueUnchecked:Ov,paragraph:$N}}}function UN(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:qN}}}function Ov(e){const r=this.stack[this.stack.length-2];r.type,r.checked=e.type==="taskListCheckValueChecked"}function $N(e){const r=this.stack[this.stack.length-2];if(r&&r.type==="listItem"&&typeof r.checked=="boolean"){const i=this.stack[this.stack.length-1];i.type;const s=i.children[0];if(s&&s.type==="text"){const c=r.children;let u=-1,f;for(;++u<c.length;){const l=c[u];if(l.type==="paragraph"){f=l;break}}f===i&&(s.value=s.value.slice(1),s.value.length===0?i.children.shift():i.position&&s.position&&typeof s.position.start.offset=="number"&&(s.position.start.column++,s.position.start.offset++,i.position.start=Object.assign({},s.position.start)))}}this.exit(e)}function qN(e,r,i,s){const c=e.children[0],u=typeof e.checked=="boolean"&&c&&c.type==="paragraph",f="["+(e.checked?"x":" ")+"] ",l=i.createTracker(s);u&&l.move(f);let d=Dy.listItem(e,r,i,{...s,...l.current()});return u&&(d=d.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,p)),d;function p(g){return g+f}}function WN(){return[wj(),qj(),Yj(),MN(),FN()]}function GN(e){return{extensions:[Cj(),Wj(e),Kj(),PN(e),UN()]}}const VN={tokenize:JN,partial:!0},Ly={tokenize:e3,partial:!0},Ry={tokenize:t3,partial:!0},My={tokenize:n3,partial:!0},YN={tokenize:r3,partial:!0},Oy={name:"wwwAutolink",tokenize:ZN,previous:Iy},By={name:"protocolAutolink",tokenize:QN,previous:zy},Tr={name:"emailAutolink",tokenize:XN,previous:Hy},or={};function KN(){return{text:or}}let Ei=48;for(;Ei<123;)or[Ei]=Tr,Ei++,Ei===58?Ei=65:Ei===91&&(Ei=97);or[43]=Tr;or[45]=Tr;or[46]=Tr;or[95]=Tr;or[72]=[Tr,By];or[104]=[Tr,By];or[87]=[Tr,Oy];or[119]=[Tr,Oy];function XN(e,r,i){const s=this;let c,u;return f;function f(m){return!uh(m)||!Hy.call(s,s.previous)||Fh(s.events)?i(m):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),l(m))}function l(m){return uh(m)?(e.consume(m),l):m===64?(e.consume(m),d):i(m)}function d(m){return m===46?e.check(YN,g,p)(m):m===45||m===95||on(m)?(u=!0,e.consume(m),d):g(m)}function p(m){return e.consume(m),c=!0,d}function g(m){return u&&c&&hn(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),r(m)):i(m)}}function ZN(e,r,i){const s=this;return c;function c(f){return f!==87&&f!==119||!Iy.call(s,s.previous)||Fh(s.events)?i(f):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(VN,e.attempt(Ly,e.attempt(Ry,u),i),i)(f))}function u(f){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),r(f)}}function QN(e,r,i){const s=this;let c="",u=!1;return f;function f(m){return(m===72||m===104)&&zy.call(s,s.previous)&&!Fh(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),c+=String.fromCodePoint(m),e.consume(m),l):i(m)}function l(m){if(hn(m)&&c.length<5)return c+=String.fromCodePoint(m),e.consume(m),l;if(m===58){const y=c.toLowerCase();if(y==="http"||y==="https")return e.consume(m),d}return i(m)}function d(m){return m===47?(e.consume(m),u?p:(u=!0,d)):i(m)}function p(m){return m===null||Ml(m)||bt(m)||Ri(m)||Xl(m)?i(m):e.attempt(Ly,e.attempt(Ry,g),i)(m)}function g(m){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),r(m)}}function JN(e,r,i){let s=0;return c;function c(f){return(f===87||f===119)&&s<3?(s++,e.consume(f),c):f===46&&s===3?(e.consume(f),u):i(f)}function u(f){return f===null?i(f):r(f)}}function e3(e,r,i){let s,c,u;return f;function f(p){return p===46||p===95?e.check(My,d,l)(p):p===null||bt(p)||Ri(p)||p!==45&&Xl(p)?d(p):(u=!0,e.consume(p),f)}function l(p){return p===95?s=!0:(c=s,s=void 0),e.consume(p),f}function d(p){return c||s||!u?i(p):r(p)}}function t3(e,r){let i=0,s=0;return c;function c(f){return f===40?(i++,e.consume(f),c):f===41&&s<i?u(f):f===33||f===34||f===38||f===39||f===41||f===42||f===44||f===46||f===58||f===59||f===60||f===63||f===93||f===95||f===126?e.check(My,r,u)(f):f===null||bt(f)||Ri(f)?r(f):(e.consume(f),c)}function u(f){return f===41&&s++,e.consume(f),c}}function n3(e,r,i){return s;function s(l){return l===33||l===34||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===63||l===95||l===126?(e.consume(l),s):l===38?(e.consume(l),u):l===93?(e.consume(l),c):l===60||l===null||bt(l)||Ri(l)?r(l):i(l)}function c(l){return l===null||l===40||l===91||bt(l)||Ri(l)?r(l):s(l)}function u(l){return hn(l)?f(l):i(l)}function f(l){return l===59?(e.consume(l),s):hn(l)?(e.consume(l),f):i(l)}}function r3(e,r,i){return s;function s(u){return e.consume(u),c}function c(u){return on(u)?i(u):r(u)}}function Iy(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||bt(e)}function zy(e){return!hn(e)}function Hy(e){return!(e===47||uh(e))}function uh(e){return e===43||e===45||e===46||e===95||on(e)}function Fh(e){let r=e.length,i=!1;for(;r--;){const s=e[r][1];if((s.type==="labelLink"||s.type==="labelImage")&&!s._balanced){i=!0;break}if(s._gfmAutolinkLiteralWalkedInto){i=!1;break}}return e.length>0&&!i&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),i}const i3={tokenize:h3,partial:!0};function s3(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:c3,continuation:{tokenize:u3},exit:d3}},text:{91:{name:"gfmFootnoteCall",tokenize:l3},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:a3,resolveTo:o3}}}}function a3(e,r,i){const s=this;let c=s.events.length;const u=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let f;for(;c--;){const d=s.events[c][1];if(d.type==="labelImage"){f=d;break}if(d.type==="gfmFootnoteCall"||d.type==="labelLink"||d.type==="label"||d.type==="image"||d.type==="link")break}return l;function l(d){if(!f||!f._balanced)return i(d);const p=Xn(s.sliceSerialize({start:f.end,end:s.now()}));return p.codePointAt(0)!==94||!u.includes(p.slice(1))?i(d):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),r(d))}}function o3(e,r){let i=e.length;for(;i--;)if(e[i][1].type==="labelImage"&&e[i][0]==="enter"){e[i][1];break}e[i+1][1].type="data",e[i+3][1].type="gfmFootnoteCallLabelMarker";const s={type:"gfmFootnoteCall",start:Object.assign({},e[i+3][1].start),end:Object.assign({},e[e.length-1][1].end)},c={type:"gfmFootnoteCallMarker",start:Object.assign({},e[i+3][1].end),end:Object.assign({},e[i+3][1].end)};c.end.column++,c.end.offset++,c.end._bufferIndex++;const u={type:"gfmFootnoteCallString",start:Object.assign({},c.end),end:Object.assign({},e[e.length-1][1].start)},f={type:"chunkString",contentType:"string",start:Object.assign({},u.start),end:Object.assign({},u.end)},l=[e[i+1],e[i+2],["enter",s,r],e[i+3],e[i+4],["enter",c,r],["exit",c,r],["enter",u,r],["enter",f,r],["exit",f,r],["exit",u,r],e[e.length-2],e[e.length-1],["exit",s,r]];return e.splice(i,e.length-i+1,...l),e}function l3(e,r,i){const s=this,c=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let u=0,f;return l;function l(m){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),d}function d(m){return m!==94?i(m):(e.enter("gfmFootnoteCallMarker"),e.consume(m),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",p)}function p(m){if(u>999||m===93&&!f||m===null||m===91||bt(m))return i(m);if(m===93){e.exit("chunkString");const y=e.exit("gfmFootnoteCallString");return c.includes(Xn(s.sliceSerialize(y)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),r):i(m)}return bt(m)||(f=!0),u++,e.consume(m),m===92?g:p}function g(m){return m===91||m===92||m===93?(e.consume(m),u++,p):p(m)}}function c3(e,r,i){const s=this,c=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let u,f=0,l;return d;function d(k){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),p}function p(k){return k===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",g):i(k)}function g(k){if(f>999||k===93&&!l||k===null||k===91||bt(k))return i(k);if(k===93){e.exit("chunkString");const C=e.exit("gfmFootnoteDefinitionLabelString");return u=Xn(s.sliceSerialize(C)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),y}return bt(k)||(l=!0),f++,e.consume(k),k===92?m:g}function m(k){return k===91||k===92||k===93?(e.consume(k),f++,g):g(k)}function y(k){return k===58?(e.enter("definitionMarker"),e.consume(k),e.exit("definitionMarker"),c.includes(u)||c.push(u),ot(e,_,"gfmFootnoteDefinitionWhitespace")):i(k)}function _(k){return r(k)}}function u3(e,r,i){return e.check(no,r,e.attempt(i3,r,i))}function d3(e){e.exit("gfmFootnoteDefinition")}function h3(e,r,i){const s=this;return ot(e,c,"gfmFootnoteDefinitionIndent",5);function c(u){const f=s.events[s.events.length-1];return f&&f[1].type==="gfmFootnoteDefinitionIndent"&&f[2].sliceSerialize(f[1],!0).length===4?r(u):i(u)}}function f3(e){let i=(e||{}).singleTilde;const s={name:"strikethrough",tokenize:u,resolveAll:c};return i==null&&(i=!0),{text:{126:s},insideSpan:{null:[s]},attentionMarkers:{null:[126]}};function c(f,l){let d=-1;for(;++d<f.length;)if(f[d][0]==="enter"&&f[d][1].type==="strikethroughSequenceTemporary"&&f[d][1]._close){let p=d;for(;p--;)if(f[p][0]==="exit"&&f[p][1].type==="strikethroughSequenceTemporary"&&f[p][1]._open&&f[d][1].end.offset-f[d][1].start.offset===f[p][1].end.offset-f[p][1].start.offset){f[d][1].type="strikethroughSequence",f[p][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},f[p][1].start),end:Object.assign({},f[d][1].end)},m={type:"strikethroughText",start:Object.assign({},f[p][1].end),end:Object.assign({},f[d][1].start)},y=[["enter",g,l],["enter",f[p][1],l],["exit",f[p][1],l],["enter",m,l]],_=l.parser.constructs.insideSpan.null;_&&Rn(y,y.length,0,Zl(_,f.slice(p+1,d),l)),Rn(y,y.length,0,[["exit",m,l],["enter",f[d][1],l],["exit",f[d][1],l],["exit",g,l]]),Rn(f,p-1,d-p+3,y),d=p+y.length-2;break}}for(d=-1;++d<f.length;)f[d][1].type==="strikethroughSequenceTemporary"&&(f[d][1].type="data");return f}function u(f,l,d){const p=this.previous,g=this.events;let m=0;return y;function y(k){return p===126&&g[g.length-1][1].type!=="characterEscape"?d(k):(f.enter("strikethroughSequenceTemporary"),_(k))}function _(k){const C=Ms(p);if(k===126)return m>1?d(k):(f.consume(k),m++,_);if(m<2&&!i)return d(k);const v=f.exit("strikethroughSequenceTemporary"),b=Ms(k);return v._open=!b||b===2&&!!C,v._close=!C||C===2&&!!b,l(k)}}}class p3{constructor(){this.map=[]}add(r,i,s){m3(this,r,i,s)}consume(r){if(this.map.sort(function(u,f){return u[0]-f[0]}),this.map.length===0)return;let i=this.map.length;const s=[];for(;i>0;)i-=1,s.push(r.slice(this.map[i][0]+this.map[i][1]),this.map[i][2]),r.length=this.map[i][0];s.push(r.slice()),r.length=0;let c=s.pop();for(;c;){for(const u of c)r.push(u);c=s.pop()}this.map.length=0}}function m3(e,r,i,s){let c=0;if(!(i===0&&s.length===0)){for(;c<e.map.length;){if(e.map[c][0]===r){e.map[c][1]+=i,e.map[c][2].push(...s);return}c+=1}e.map.push([r,i,s])}}function g3(e,r){let i=!1;const s=[];for(;r<e.length;){const c=e[r];if(i){if(c[0]==="enter")c[1].type==="tableContent"&&s.push(e[r+1][1].type==="tableDelimiterMarker"?"left":"none");else if(c[1].type==="tableContent"){if(e[r-1][1].type==="tableDelimiterMarker"){const u=s.length-1;s[u]=s[u]==="left"?"center":"right"}}else if(c[1].type==="tableDelimiterRow")break}else c[0]==="enter"&&c[1].type==="tableDelimiterRow"&&(i=!0);r+=1}return s}function x3(){return{flow:{null:{name:"table",tokenize:v3,resolveAll:b3}}}}function v3(e,r,i){const s=this;let c=0,u=0,f;return l;function l(H){let V=s.events.length-1;for(;V>-1;){const O=s.events[V][1].type;if(O==="lineEnding"||O==="linePrefix")V--;else break}const Y=V>-1?s.events[V][1].type:null,q=Y==="tableHead"||Y==="tableRow"?N:d;return q===N&&s.parser.lazy[s.now().line]?i(H):q(H)}function d(H){return e.enter("tableHead"),e.enter("tableRow"),p(H)}function p(H){return H===124||(f=!0,u+=1),g(H)}function g(H){return H===null?i(H):He(H)?u>1?(u=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(H),e.exit("lineEnding"),_):i(H):et(H)?ot(e,g,"whitespace")(H):(u+=1,f&&(f=!1,c+=1),H===124?(e.enter("tableCellDivider"),e.consume(H),e.exit("tableCellDivider"),f=!0,g):(e.enter("data"),m(H)))}function m(H){return H===null||H===124||bt(H)?(e.exit("data"),g(H)):(e.consume(H),H===92?y:m)}function y(H){return H===92||H===124?(e.consume(H),m):m(H)}function _(H){return s.interrupt=!1,s.parser.lazy[s.now().line]?i(H):(e.enter("tableDelimiterRow"),f=!1,et(H)?ot(e,k,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(H):k(H))}function k(H){return H===45||H===58?v(H):H===124?(f=!0,e.enter("tableCellDivider"),e.consume(H),e.exit("tableCellDivider"),C):A(H)}function C(H){return et(H)?ot(e,v,"whitespace")(H):v(H)}function v(H){return H===58?(u+=1,f=!0,e.enter("tableDelimiterMarker"),e.consume(H),e.exit("tableDelimiterMarker"),b):H===45?(u+=1,b(H)):H===null||He(H)?j(H):A(H)}function b(H){return H===45?(e.enter("tableDelimiterFiller"),x(H)):A(H)}function x(H){return H===45?(e.consume(H),x):H===58?(f=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(H),e.exit("tableDelimiterMarker"),S):(e.exit("tableDelimiterFiller"),S(H))}function S(H){return et(H)?ot(e,j,"whitespace")(H):j(H)}function j(H){return H===124?k(H):H===null||He(H)?!f||c!==u?A(H):(e.exit("tableDelimiterRow"),e.exit("tableHead"),r(H)):A(H)}function A(H){return i(H)}function N(H){return e.enter("tableRow"),D(H)}function D(H){return H===124?(e.enter("tableCellDivider"),e.consume(H),e.exit("tableCellDivider"),D):H===null||He(H)?(e.exit("tableRow"),r(H)):et(H)?ot(e,D,"whitespace")(H):(e.enter("data"),T(H))}function T(H){return H===null||H===124||bt(H)?(e.exit("data"),D(H)):(e.consume(H),H===92?I:T)}function I(H){return H===92||H===124?(e.consume(H),T):T(H)}}function b3(e,r){let i=-1,s=!0,c=0,u=[0,0,0,0],f=[0,0,0,0],l=!1,d=0,p,g,m;const y=new p3;for(;++i<e.length;){const _=e[i],k=_[1];_[0]==="enter"?k.type==="tableHead"?(l=!1,d!==0&&(Bv(y,r,d,p,g),g=void 0,d=0),p={type:"table",start:Object.assign({},k.start),end:Object.assign({},k.end)},y.add(i,0,[["enter",p,r]])):k.type==="tableRow"||k.type==="tableDelimiterRow"?(s=!0,m=void 0,u=[0,0,0,0],f=[0,i+1,0,0],l&&(l=!1,g={type:"tableBody",start:Object.assign({},k.start),end:Object.assign({},k.end)},y.add(i,0,[["enter",g,r]])),c=k.type==="tableDelimiterRow"?2:g?3:1):c&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")?(s=!1,f[2]===0&&(u[1]!==0&&(f[0]=f[1],m=kl(y,r,u,c,void 0,m),u=[0,0,0,0]),f[2]=i)):k.type==="tableCellDivider"&&(s?s=!1:(u[1]!==0&&(f[0]=f[1],m=kl(y,r,u,c,void 0,m)),u=f,f=[u[1],i,0,0])):k.type==="tableHead"?(l=!0,d=i):k.type==="tableRow"||k.type==="tableDelimiterRow"?(d=i,u[1]!==0?(f[0]=f[1],m=kl(y,r,u,c,i,m)):f[1]!==0&&(m=kl(y,r,f,c,i,m)),c=0):c&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")&&(f[3]=i)}for(d!==0&&Bv(y,r,d,p,g),y.consume(r.events),i=-1;++i<r.events.length;){const _=r.events[i];_[0]==="enter"&&_[1].type==="table"&&(_[1]._align=g3(r.events,i))}return e}function kl(e,r,i,s,c,u){const f=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",l="tableContent";i[0]!==0&&(u.end=Object.assign({},Ts(r.events,i[0])),e.add(i[0],0,[["exit",u,r]]));const d=Ts(r.events,i[1]);if(u={type:f,start:Object.assign({},d),end:Object.assign({},d)},e.add(i[1],0,[["enter",u,r]]),i[2]!==0){const p=Ts(r.events,i[2]),g=Ts(r.events,i[3]),m={type:l,start:Object.assign({},p),end:Object.assign({},g)};if(e.add(i[2],0,[["enter",m,r]]),s!==2){const y=r.events[i[2]],_=r.events[i[3]];if(y[1].end=Object.assign({},_[1].end),y[1].type="chunkText",y[1].contentType="text",i[3]>i[2]+1){const k=i[2]+1,C=i[3]-i[2]-1;e.add(k,C,[])}}e.add(i[3]+1,0,[["exit",m,r]])}return c!==void 0&&(u.end=Object.assign({},Ts(r.events,c)),e.add(c,0,[["exit",u,r]]),u=void 0),u}function Bv(e,r,i,s,c){const u=[],f=Ts(r.events,i);c&&(c.end=Object.assign({},f),u.push(["exit",c,r])),s.end=Object.assign({},f),u.push(["exit",s,r]),e.add(i+1,0,u)}function Ts(e,r){const i=e[r],s=i[0]==="enter"?"start":"end";return i[1][s]}const y3={name:"tasklistCheck",tokenize:S3};function _3(){return{text:{91:y3}}}function S3(e,r,i){const s=this;return c;function c(d){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?i(d):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),u)}function u(d){return bt(d)?(e.enter("taskListCheckValueUnchecked"),e.consume(d),e.exit("taskListCheckValueUnchecked"),f):d===88||d===120?(e.enter("taskListCheckValueChecked"),e.consume(d),e.exit("taskListCheckValueChecked"),f):i(d)}function f(d){return d===93?(e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):i(d)}function l(d){return He(d)?r(d):et(d)?e.check({tokenize:w3},r,i)(d):i(d)}}function w3(e,r,i){return ot(e,s,"whitespace");function s(c){return c===null?i(c):r(c)}}function C3(e){return Xb([KN(),s3(),f3(e),x3(),_3()])}const k3={};function E3(e){const r=this,i=e||k3,s=r.data(),c=s.micromarkExtensions||(s.micromarkExtensions=[]),u=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),f=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);c.push(C3(i)),u.push(WN()),f.push(GN(i))}function j3(e,r){if(e==null)return{};var i={};for(var s in e)if({}.hasOwnProperty.call(e,s)){if(r.indexOf(s)!==-1)continue;i[s]=e[s]}return i}function N3(e,r){if(e==null)return{};var i,s,c=j3(e,r);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(s=0;s<u.length;s++)i=u[s],r.indexOf(i)===-1&&{}.propertyIsEnumerable.call(e,i)&&(c[i]=e[i])}return c}function dh(e,r){(r==null||r>e.length)&&(r=e.length);for(var i=0,s=Array(r);i<r;i++)s[i]=e[i];return s}function T3(e){if(Array.isArray(e))return dh(e)}function A3(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function D3(e,r){if(e){if(typeof e=="string")return dh(e,r);var i={}.toString.call(e).slice(8,-1);return i==="Object"&&e.constructor&&(i=e.constructor.name),i==="Map"||i==="Set"?Array.from(e):i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?dh(e,r):void 0}}function L3(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
119
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hh(e){return T3(e)||A3(e)||D3(e)||L3()}function Za(e){"@babel/helpers - typeof";return Za=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Za(e)}function R3(e,r){if(Za(e)!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var s=i.call(e,r);if(Za(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function M3(e){var r=R3(e,"string");return Za(r)=="symbol"?r:r+""}function Py(e,r,i){return(r=M3(r))in e?Object.defineProperty(e,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[r]=i,e}function fh(){return fh=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var i=arguments[r];for(var s in i)({}).hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},fh.apply(null,arguments)}function Iv(e,r){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);r&&(s=s.filter(function(c){return Object.getOwnPropertyDescriptor(e,c).enumerable})),i.push.apply(i,s)}return i}function As(e){for(var r=1;r<arguments.length;r++){var i=arguments[r]!=null?arguments[r]:{};r%2?Iv(Object(i),!0).forEach(function(s){Py(e,s,i[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):Iv(Object(i)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(i,s))})}return e}function O3(e){var r=e.length;if(r===0||r===1)return e;if(r===2)return[e[0],e[1],"".concat(e[0],".").concat(e[1]),"".concat(e[1],".").concat(e[0])];if(r===3)return[e[0],e[1],e[2],"".concat(e[0],".").concat(e[1]),"".concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[0]),"".concat(e[1],".").concat(e[2]),"".concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[1],".").concat(e[0])];if(r>=4)return[e[0],e[1],e[2],e[3],"".concat(e[0],".").concat(e[1]),"".concat(e[0],".").concat(e[2]),"".concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[0]),"".concat(e[1],".").concat(e[2]),"".concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[1]),"".concat(e[2],".").concat(e[3]),"".concat(e[3],".").concat(e[0]),"".concat(e[3],".").concat(e[1]),"".concat(e[3],".").concat(e[2]),"".concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[1],".").concat(e[3]),"".concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[2],".").concat(e[3]),"".concat(e[0],".").concat(e[3],".").concat(e[1]),"".concat(e[0],".").concat(e[3],".").concat(e[2]),"".concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[1],".").concat(e[2],".").concat(e[3]),"".concat(e[1],".").concat(e[3],".").concat(e[0]),"".concat(e[1],".").concat(e[3],".").concat(e[2]),"".concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[0],".").concat(e[3]),"".concat(e[2],".").concat(e[1],".").concat(e[0]),"".concat(e[2],".").concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[3],".").concat(e[0]),"".concat(e[2],".").concat(e[3],".").concat(e[1]),"".concat(e[3],".").concat(e[0],".").concat(e[1]),"".concat(e[3],".").concat(e[0],".").concat(e[2]),"".concat(e[3],".").concat(e[1],".").concat(e[0]),"".concat(e[3],".").concat(e[1],".").concat(e[2]),"".concat(e[3],".").concat(e[2],".").concat(e[0]),"".concat(e[3],".").concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[1],".").concat(e[2],".").concat(e[3]),"".concat(e[0],".").concat(e[1],".").concat(e[3],".").concat(e[2]),"".concat(e[0],".").concat(e[2],".").concat(e[1],".").concat(e[3]),"".concat(e[0],".").concat(e[2],".").concat(e[3],".").concat(e[1]),"".concat(e[0],".").concat(e[3],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[3],".").concat(e[2],".").concat(e[1]),"".concat(e[1],".").concat(e[0],".").concat(e[2],".").concat(e[3]),"".concat(e[1],".").concat(e[0],".").concat(e[3],".").concat(e[2]),"".concat(e[1],".").concat(e[2],".").concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[2],".").concat(e[3],".").concat(e[0]),"".concat(e[1],".").concat(e[3],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[3],".").concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[0],".").concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[0],".").concat(e[3],".").concat(e[1]),"".concat(e[2],".").concat(e[1],".").concat(e[0],".").concat(e[3]),"".concat(e[2],".").concat(e[1],".").concat(e[3],".").concat(e[0]),"".concat(e[2],".").concat(e[3],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[3],".").concat(e[1],".").concat(e[0]),"".concat(e[3],".").concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[3],".").concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[3],".").concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[3],".").concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[3],".").concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[3],".").concat(e[2],".").concat(e[1],".").concat(e[0])]}var Kd={};function B3(e){if(e.length===0||e.length===1)return e;var r=e.join(".");return Kd[r]||(Kd[r]=O3(e)),Kd[r]}function I3(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0,s=e.filter(function(u){return u!=="token"}),c=B3(s);return c.reduce(function(u,f){return As(As({},u),i[f])},r)}function zv(e){return e.join(" ")}function z3(e,r){var i=0;return function(s){return i+=1,s.map(function(c,u){return Fy({node:c,stylesheet:e,useInlineStyles:r,key:"code-segment-".concat(i,"-").concat(u)})})}}function Fy(e){var r=e.node,i=e.stylesheet,s=e.style,c=s===void 0?{}:s,u=e.useInlineStyles,f=e.key,l=r.properties,d=r.type,p=r.tagName,g=r.value;if(d==="text")return g;if(p){var m=z3(i,u),y;if(!u)y=As(As({},l),{},{className:zv(l.className)});else{var _=Object.keys(i).reduce(function(b,x){return x.split(".").forEach(function(S){b.includes(S)||b.push(S)}),b},[]),k=l.className&&l.className.includes("token")?["token"]:[],C=l.className&&k.concat(l.className.filter(function(b){return!_.includes(b)}));y=As(As({},l),{},{className:zv(C)||void 0,style:I3(l.className,Object.assign({},l.style,c),i)})}var v=m(r.children);return dn.createElement(p,fh({key:f},y),v)}}const H3=(function(e,r){var i=e.listLanguages();return i.indexOf(r)!==-1});var P3=["language","children","style","customStyle","codeTagProps","useInlineStyles","showLineNumbers","showInlineLineNumbers","startingLineNumber","lineNumberContainerStyle","lineNumberStyle","wrapLines","wrapLongLines","lineProps","renderer","PreTag","CodeTag","code","astGenerator"];function Hv(e,r){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);r&&(s=s.filter(function(c){return Object.getOwnPropertyDescriptor(e,c).enumerable})),i.push.apply(i,s)}return i}function ii(e){for(var r=1;r<arguments.length;r++){var i=arguments[r]!=null?arguments[r]:{};r%2?Hv(Object(i),!0).forEach(function(s){Py(e,s,i[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):Hv(Object(i)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(i,s))})}return e}var F3=/\n/g;function U3(e){return e.match(F3)}function $3(e){var r=e.lines,i=e.startingLineNumber,s=e.style;return r.map(function(c,u){var f=u+i;return dn.createElement("span",{key:"line-".concat(u),className:"react-syntax-highlighter-line-number",style:typeof s=="function"?s(f):s},"".concat(f,`
|
|
120
|
+
`))})}function q3(e){var r=e.codeString,i=e.codeStyle,s=e.containerStyle,c=s===void 0?{float:"left",paddingRight:"10px"}:s,u=e.numberStyle,f=u===void 0?{}:u,l=e.startingLineNumber;return dn.createElement("code",{style:Object.assign({},i,c)},$3({lines:r.replace(/\n$/,"").split(`
|
|
121
|
+
`),style:f,startingLineNumber:l}))}function W3(e){return"".concat(e.toString().length,".25em")}function Uy(e,r){return{type:"element",tagName:"span",properties:{key:"line-number--".concat(e),className:["comment","linenumber","react-syntax-highlighter-line-number"],style:r},children:[{type:"text",value:e}]}}function $y(e,r,i){var s={display:"inline-block",minWidth:W3(i),paddingRight:"1em",textAlign:"right",userSelect:"none"},c=typeof e=="function"?e(r):e,u=ii(ii({},s),c);return u}function Tl(e){var r=e.children,i=e.lineNumber,s=e.lineNumberStyle,c=e.largestLineNumber,u=e.showInlineLineNumbers,f=e.lineProps,l=f===void 0?{}:f,d=e.className,p=d===void 0?[]:d,g=e.showLineNumbers,m=e.wrapLongLines,y=e.wrapLines,_=y===void 0?!1:y,k=_?ii({},typeof l=="function"?l(i):l):{};if(k.className=k.className?[].concat(hh(k.className.trim().split(/\s+/)),hh(p)):p,i&&u){var C=$y(s,i,c);r.unshift(Uy(i,C))}return m&g&&(k.style=ii({display:"flex"},k.style)),{type:"element",tagName:"span",properties:k,children:r}}function qy(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];e.length===void 0&&(e=[e]);for(var s=0;s<e.length;s++){var c=e[s];if(c.type==="text")i.push(Tl({children:[c],className:hh(new Set(r))}));else if(c.children){var u,f=r.concat(((u=c.properties)===null||u===void 0?void 0:u.className)||[]);qy(c.children,f).forEach(function(l){return i.push(l)})}}return i}function G3(e,r,i,s,c,u,f,l,d){var p,g=qy(e.value),m=[],y=-1,_=0;function k(A,N){var D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return Tl({children:A,lineNumber:N,lineNumberStyle:l,largestLineNumber:f,showInlineLineNumbers:c,lineProps:i,className:D,showLineNumbers:s,wrapLongLines:d,wrapLines:r})}function C(A,N){if(s&&N&&c){var D=$y(l,N,f);A.unshift(Uy(N,D))}return A}function v(A,N){var D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return r||D.length>0?k(A,N,D):C(A,N)}for(var b=function(){var N=g[_],D=N.children[0].value,T=U3(D);if(T){var I=D.split(`
|
|
122
|
+
`);I.forEach(function(H,V){var Y=s&&m.length+u,q={type:"text",value:"".concat(H,`
|
|
123
|
+
`)};if(V===0){var O=g.slice(y+1,_).concat(Tl({children:[q],className:N.properties.className})),U=v(O,Y);m.push(U)}else if(V===I.length-1){var z=g[_+1]&&g[_+1].children&&g[_+1].children[0],X={type:"text",value:"".concat(H)};if(z){var Q=Tl({children:[X],className:N.properties.className});g.splice(_+1,0,Q)}else{var M=[X],L=v(M,Y,N.properties.className);m.push(L)}}else{var B=[q],W=v(B,Y,N.properties.className);m.push(W)}}),y=_}_++};_<g.length;)b();if(y!==g.length-1){var x=g.slice(y+1,g.length);if(x&&x.length){var S=s&&m.length+u,j=v(x,S);m.push(j)}}return r?m:(p=[]).concat.apply(p,m)}function V3(e){var r=e.rows,i=e.stylesheet,s=e.useInlineStyles;return r.map(function(c,u){return Fy({node:c,stylesheet:i,useInlineStyles:s,key:"code-segment-".concat(u)})})}function Wy(e){return e&&typeof e.highlightAuto<"u"}function Y3(e){var r=e.astGenerator,i=e.language,s=e.code,c=e.defaultCodeValue;if(Wy(r)){var u=H3(r,i);return i==="text"?{value:c,language:"text"}:u?r.highlight(i,s):r.highlightAuto(s)}try{return i&&i!=="text"?{value:r.highlight(s,i)}:{value:c}}catch{return{value:c}}}function K3(e,r){return function(s){var c,u,f=s.language,l=s.children,d=s.style,p=d===void 0?r:d,g=s.customStyle,m=g===void 0?{}:g,y=s.codeTagProps,_=y===void 0?{className:f?"language-".concat(f):void 0,style:ii(ii({},p['code[class*="language-"]']),p['code[class*="language-'.concat(f,'"]')])}:y,k=s.useInlineStyles,C=k===void 0?!0:k,v=s.showLineNumbers,b=v===void 0?!1:v,x=s.showInlineLineNumbers,S=x===void 0?!0:x,j=s.startingLineNumber,A=j===void 0?1:j,N=s.lineNumberContainerStyle,D=s.lineNumberStyle,T=D===void 0?{}:D,I=s.wrapLines,H=s.wrapLongLines,V=H===void 0?!1:H,Y=s.lineProps,q=Y===void 0?{}:Y,O=s.renderer,U=s.PreTag,z=U===void 0?"pre":U,X=s.CodeTag,Q=X===void 0?"code":X,M=s.code,L=M===void 0?(Array.isArray(l)?l[0]:l)||"":M,B=s.astGenerator,W=N3(s,P3);B=B||e;var F=b?dn.createElement(q3,{containerStyle:N,codeStyle:_.style||{},numberStyle:T,startingLineNumber:A,codeString:L}):null,re=p.hljs||p['pre[class*="language-"]']||{backgroundColor:"#fff"},Z=Wy(B)?"hljs":"prismjs",ee=C?Object.assign({},W,{style:Object.assign({},re,m)}):Object.assign({},W,{className:W.className?"".concat(Z," ").concat(W.className):Z,style:Object.assign({},m)});if(V?_.style=ii({whiteSpace:"pre-wrap"},_.style):_.style=ii({whiteSpace:"pre"},_.style),!B)return dn.createElement(z,ee,F,dn.createElement(Q,_,L));(I===void 0&&O||V)&&(I=!0),O=O||V3;var K=[{type:"text",value:L}],$=Y3({astGenerator:B,language:f,code:L,defaultCodeValue:K});$.language===null&&($.value=K);var ae=(c=(u=L.match(/\n/g))===null||u===void 0?void 0:u.length)!==null&&c!==void 0?c:0,ne=A+ae,ve=G3($,I,q,b,S,A,ne,T,V);return dn.createElement(z,ee,dn.createElement(Q,_,!S&&F,O({rows:ve,stylesheet:p,useInlineStyles:C})))}}const Pv=/[#.]/g;function X3(e,r){const i=e||"",s={};let c=0,u,f;for(;c<i.length;){Pv.lastIndex=c;const l=Pv.exec(i),d=i.slice(c,l?l.index:i.length);d&&(u?u==="#"?s.id=d:Array.isArray(s.className)?s.className.push(d):s.className=[d]:f=d,c+=d.length),l&&(u=l[0],c++)}return{type:"element",tagName:f||r||"div",properties:s,children:[]}}function Gy(e,r,i){const s=i?e5(i):void 0;function c(u,f,...l){let d;if(u==null){d={type:"root",children:[]};const p=f;l.unshift(p)}else{d=X3(u,r);const p=d.tagName.toLowerCase(),g=s?s.get(p):void 0;if(d.tagName=g||p,Z3(f))l.unshift(f);else for(const[m,y]of Object.entries(f))Q3(e,d.properties,m,y)}for(const p of l)ph(d.children,p);return d.type==="element"&&d.tagName==="template"&&(d.content={type:"root",children:d.children},d.children=[]),d}return c}function Z3(e){if(e===null||typeof e!="object"||Array.isArray(e))return!0;if(typeof e.type!="string")return!1;const r=e,i=Object.keys(e);for(const s of i){const c=r[s];if(c&&typeof c=="object"){if(!Array.isArray(c))return!0;const u=c;for(const f of u)if(typeof f!="number"&&typeof f!="string")return!0}}return!!("children"in e&&Array.isArray(e.children))}function Q3(e,r,i,s){const c=Fb(e,i);let u;if(s!=null){if(typeof s=="number"){if(Number.isNaN(s))return;u=s}else typeof s=="boolean"?u=s:typeof s=="string"?c.spaceSeparated?u=Zx(s):c.commaSeparated?u=Gx(s):c.commaOrSpaceSeparated?u=Zx(Gx(s).join(" ")):u=Fv(c,c.property,s):Array.isArray(s)?u=[...s]:u=c.property==="style"?J3(s):String(s);if(Array.isArray(u)){const f=[];for(const l of u)f.push(Fv(c,c.property,l));u=f}c.property==="className"&&Array.isArray(r.className)&&(u=r.className.concat(u)),r[c.property]=u}}function ph(e,r){if(r!=null)if(typeof r=="number"||typeof r=="string")e.push({type:"text",value:String(r)});else if(Array.isArray(r))for(const i of r)ph(e,i);else if(typeof r=="object"&&"type"in r)r.type==="root"?ph(e,r.children):e.push(r);else throw new Error("Expected node, nodes, or string, got `"+r+"`")}function Fv(e,r,i){if(typeof i=="string"){if(e.number&&i&&!Number.isNaN(Number(i)))return Number(i);if((e.boolean||e.overloadedBoolean)&&(i===""||Va(i)===Va(r)))return!0}return i}function J3(e){const r=[];for(const[i,s]of Object.entries(e))r.push([i,s].join(": "));return r.join("; ")}function e5(e){const r=new Map;for(const i of e)r.set(i.toLowerCase(),i);return r}const t5=["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","solidColor","textArea","textPath"],n5=Gy(Ub,"div");Gy(Kl,"g",t5);const r5=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],Uv={0:"�",128:"€",130:"‚",131:"ƒ",132:"„",133:"…",134:"†",135:"‡",136:"ˆ",137:"‰",138:"Š",139:"‹",140:"Œ",142:"Ž",145:"‘",146:"’",147:"“",148:"”",149:"•",150:"–",151:"—",152:"˜",153:"™",154:"š",155:"›",156:"œ",158:"ž",159:"Ÿ"};function Vy(e){const r=typeof e=="string"?e.charCodeAt(0):e;return r>=48&&r<=57}function i5(e){const r=typeof e=="string"?e.charCodeAt(0):e;return r>=97&&r<=102||r>=65&&r<=70||r>=48&&r<=57}function s5(e){const r=typeof e=="string"?e.charCodeAt(0):e;return r>=97&&r<=122||r>=65&&r<=90}function $v(e){return s5(e)||Vy(e)}const a5=["","Named character references must be terminated by a semicolon","Numeric character references must be terminated by a semicolon","Named character references cannot be empty","Numeric character references cannot be empty","Named character references must be known","Numeric character references cannot be disallowed","Numeric character references cannot be outside the permissible Unicode range"];function o5(e,r){const i={},s=typeof i.additional=="string"?i.additional.charCodeAt(0):i.additional,c=[];let u=0,f=-1,l="",d,p;i.position&&("start"in i.position||"indent"in i.position?(p=i.position.indent,d=i.position.start):d=i.position);let g=(d?d.line:0)||1,m=(d?d.column:0)||1,y=k(),_;for(u--;++u<=e.length;)if(_===10&&(m=(p?p[f]:0)||1),_=e.charCodeAt(u),_===38){const b=e.charCodeAt(u+1);if(b===9||b===10||b===12||b===32||b===38||b===60||Number.isNaN(b)||s&&b===s){l+=String.fromCharCode(_),m++;continue}const x=u+1;let S=x,j=x,A;if(b===35){j=++S;const q=e.charCodeAt(j);q===88||q===120?(A="hexadecimal",j=++S):A="decimal"}else A="named";let N="",D="",T="";const I=A==="named"?$v:A==="decimal"?Vy:i5;for(j--;++j<=e.length;){const q=e.charCodeAt(j);if(!I(q))break;T+=String.fromCharCode(q),A==="named"&&r5.includes(T)&&(N=T,D=Ka(T))}let H=e.charCodeAt(j)===59;if(H){j++;const q=A==="named"?Ka(T):!1;q&&(N=T,D=q)}let V=1+j-x,Y="";if(!(!H&&i.nonTerminated===!1))if(!T)A!=="named"&&C(4,V);else if(A==="named"){if(H&&!D)C(5,1);else if(N!==T&&(j=S+N.length,V=1+j-S,H=!1),!H){const q=N?1:3;if(i.attribute){const O=e.charCodeAt(j);O===61?(C(q,V),D=""):$v(O)?D="":C(q,V)}else C(q,V)}Y=D}else{H||C(2,V);let q=Number.parseInt(T,A==="hexadecimal"?16:10);if(l5(q))C(7,V),Y="�";else if(q in Uv)C(6,V),Y=Uv[q];else{let O="";c5(q)&&C(6,V),q>65535&&(q-=65536,O+=String.fromCharCode(q>>>10|55296),q=56320|q&1023),Y=O+String.fromCharCode(q)}}if(Y){v(),y=k(),u=j-1,m+=j-x+1,c.push(Y);const q=k();q.offset++,i.reference&&i.reference.call(i.referenceContext||void 0,Y,{start:y,end:q},e.slice(x-1,j)),y=q}else T=e.slice(x-1,j),l+=T,m+=T.length,u=j-1}else _===10&&(g++,f++,m=0),Number.isNaN(_)?v():(l+=String.fromCharCode(_),m++);return c.join("");function k(){return{line:g,column:m,offset:u+((d?d.offset:0)||0)}}function C(b,x){let S;i.warning&&(S=k(),S.column+=x,S.offset+=x,i.warning.call(i.warningContext||void 0,a5[b],S,b))}function v(){l&&(c.push(l),i.text&&i.text.call(i.textContext||void 0,l,{start:y,end:k()}),l="")}}function l5(e){return e>=55296&&e<=57343||e>1114111}function c5(e){return e>=1&&e<=8||e===11||e>=13&&e<=31||e>=127&&e<=159||e>=64976&&e<=65007||(e&65535)===65535||(e&65535)===65534}var u5=0,El={},Xt={util:{type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++u5}),e.__id},clone:function e(r,i){i=i||{};var s,c;switch(Xt.util.type(r)){case"Object":if(c=Xt.util.objId(r),i[c])return i[c];s={},i[c]=s;for(var u in r)r.hasOwnProperty(u)&&(s[u]=e(r[u],i));return s;case"Array":return c=Xt.util.objId(r),i[c]?i[c]:(s=[],i[c]=s,r.forEach(function(f,l){s[l]=e(f,i)}),s);default:return r}}},languages:{plain:El,plaintext:El,text:El,txt:El,extend:function(e,r){var i=Xt.util.clone(Xt.languages[e]);for(var s in r)i[s]=r[s];return i},insertBefore:function(e,r,i,s){s=s||Xt.languages;var c=s[e],u={};for(var f in c)if(c.hasOwnProperty(f)){if(f==r)for(var l in i)i.hasOwnProperty(l)&&(u[l]=i[l]);i.hasOwnProperty(f)||(u[f]=c[f])}var d=s[e];return s[e]=u,Xt.languages.DFS(Xt.languages,function(p,g){g===d&&p!=e&&(this[p]=u)}),u},DFS:function e(r,i,s,c){c=c||{};var u=Xt.util.objId;for(var f in r)if(r.hasOwnProperty(f)){i.call(r,f,r[f],s||f);var l=r[f],d=Xt.util.type(l);d==="Object"&&!c[u(l)]?(c[u(l)]=!0,e(l,i,null,c)):d==="Array"&&!c[u(l)]&&(c[u(l)]=!0,e(l,i,f,c))}}},plugins:{},highlight:function(e,r,i){var s={code:e,grammar:r,language:i};if(Xt.hooks.run("before-tokenize",s),!s.grammar)throw new Error('The language "'+s.language+'" has no grammar.');return s.tokens=Xt.tokenize(s.code,s.grammar),Xt.hooks.run("after-tokenize",s),qa.stringify(Xt.util.encode(s.tokens),s.language)},tokenize:function(e,r){var i=r.rest;if(i){for(var s in i)r[s]=i[s];delete r.rest}var c=new d5;return Al(c,c.head,e),Yy(e,c,r,c.head,0),f5(c)},hooks:{all:{},add:function(e,r){var i=Xt.hooks.all;i[e]=i[e]||[],i[e].push(r)},run:function(e,r){var i=Xt.hooks.all[e];if(!(!i||!i.length))for(var s=0,c;c=i[s++];)c(r)}},Token:qa};function qa(e,r,i,s){this.type=e,this.content=r,this.alias=i,this.length=(s||"").length|0}function qv(e,r,i,s){e.lastIndex=r;var c=e.exec(i);if(c&&s&&c[1]){var u=c[1].length;c.index+=u,c[0]=c[0].slice(u)}return c}function Yy(e,r,i,s,c,u){for(var f in i)if(!(!i.hasOwnProperty(f)||!i[f])){var l=i[f];l=Array.isArray(l)?l:[l];for(var d=0;d<l.length;++d){if(u&&u.cause==f+","+d)return;var p=l[d],g=p.inside,m=!!p.lookbehind,y=!!p.greedy,_=p.alias;if(y&&!p.pattern.global){var k=p.pattern.toString().match(/[imsuy]*$/)[0];p.pattern=RegExp(p.pattern.source,k+"g")}for(var C=p.pattern||p,v=s.next,b=c;v!==r.tail&&!(u&&b>=u.reach);b+=v.value.length,v=v.next){var x=v.value;if(r.length>e.length)return;if(!(x instanceof qa)){var S=1,j;if(y){if(j=qv(C,b,e,m),!j||j.index>=e.length)break;var T=j.index,A=j.index+j[0].length,N=b;for(N+=v.value.length;T>=N;)v=v.next,N+=v.value.length;if(N-=v.value.length,b=N,v.value instanceof qa)continue;for(var D=v;D!==r.tail&&(N<A||typeof D.value=="string");D=D.next)S++,N+=D.value.length;S--,x=e.slice(b,N),j.index-=b}else if(j=qv(C,0,x,m),!j)continue;var T=j.index,I=j[0],H=x.slice(0,T),V=x.slice(T+I.length),Y=b+x.length;u&&Y>u.reach&&(u.reach=Y);var q=v.prev;H&&(q=Al(r,q,H),b+=H.length),h5(r,q,S);var O=new qa(f,g?Xt.tokenize(I,g):I,_,I);if(v=Al(r,q,O),V&&Al(r,v,V),S>1){var U={cause:f+","+d,reach:Y};Yy(e,r,i,v.prev,b,U),u&&U.reach>u.reach&&(u.reach=U.reach)}}}}}}function d5(){var e={value:null,prev:null,next:null},r={value:null,prev:e,next:null};e.next=r,this.head=e,this.tail=r,this.length=0}function Al(e,r,i){var s=r.next,c={value:i,prev:r,next:s};return r.next=c,s.prev=c,e.length++,c}function h5(e,r,i){for(var s=r.next,c=0;c<i&&s!==e.tail;c++)s=s.next;r.next=s,s.prev=r,e.length-=c}function f5(e){for(var r=[],i=e.head.next;i!==e.tail;)r.push(i.value),i=i.next;return r}const Ky=Xt;function Xy(){}Xy.prototype=Ky;const Vt=new Xy;Vt.highlight=p5;Vt.register=m5;Vt.alias=g5;Vt.registered=x5;Vt.listLanguages=v5;Vt.util.encode=b5;Vt.Token.stringify=mh;function p5(e,r){if(typeof e!="string")throw new TypeError("Expected `string` for `value`, got `"+e+"`");let i,s;if(r&&typeof r=="object")i=r;else{if(s=r,typeof s!="string")throw new TypeError("Expected `string` for `name`, got `"+s+"`");if(Object.hasOwn(Vt.languages,s))i=Vt.languages[s];else throw new Error("Unknown language: `"+s+"` is not registered")}return{type:"root",children:Ky.highlight.call(Vt,e,i,s)}}function m5(e){if(typeof e!="function"||!e.displayName)throw new Error("Expected `function` for `syntax`, got `"+e+"`");Object.hasOwn(Vt.languages,e.displayName)||e(Vt)}function g5(e,r){const i=Vt.languages;let s={};typeof e=="string"?r&&(s[e]=r):s=e;let c;for(c in s)if(Object.hasOwn(s,c)){const u=s[c],f=typeof u=="string"?[u]:u;let l=-1;for(;++l<f.length;)i[f[l]]=i[c]}}function x5(e){if(typeof e!="string")throw new TypeError("Expected `string` for `aliasOrLanguage`, got `"+e+"`");return Object.hasOwn(Vt.languages,e)}function v5(){const e=Vt.languages,r=[];let i;for(i in e)Object.hasOwn(e,i)&&typeof e[i]=="object"&&r.push(i);return r}function mh(e,r){if(typeof e=="string")return{type:"text",value:e};if(Array.isArray(e)){const s=[];let c=-1;for(;++c<e.length;)e[c]!==null&&e[c]!==void 0&&e[c]!==""&&s.push(mh(e[c],r));return s}const i={attributes:{},classes:["token",e.type],content:mh(e.content,r),language:r,tag:"span",type:e.type};return e.alias&&i.classes.push(...typeof e.alias=="string"?[e.alias]:e.alias),Vt.hooks.run("wrap",i),n5(i.tag+"."+i.classes.join("."),y5(i.attributes),i.content)}function b5(e){return e}function y5(e){let r;for(r in e)Object.hasOwn(e,r)&&(e[r]=o5(e[r]));return e}var pt=K3(Vt,{});pt.registerLanguage=function(e,r){return Vt.register(r)};pt.alias=function(e,r){return Vt.alias(e,r)};Bi.displayName="markup";Bi.aliases=["atom","html","mathml","rss","ssml","svg","xml"];function Bi(e){e.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},e.languages.markup.tag.inside["attr-value"].inside.entity=e.languages.markup.entity,e.languages.markup.doctype.inside["internal-subset"].inside=e.languages.markup,e.hooks.add("wrap",function(r){r.type==="entity"&&(r.attributes.title=r.content.value.replace(/&/,"&"))}),Object.defineProperty(e.languages.markup.tag,"addInlined",{value:function(i,s){var c={};c["language-"+s]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:e.languages[s]},c.cdata=/^<!\[CDATA\[|\]\]>$/i;var u={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:c}};u["language-"+s]={pattern:/[\s\S]+/,inside:e.languages[s]};var f={};f[i]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return i}),"i"),lookbehind:!0,greedy:!0,inside:u},e.languages.insertBefore("markup","cdata",f)}}),Object.defineProperty(e.languages.markup.tag,"addAttribute",{value:function(r,i){e.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+r+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[i,"language-"+i],inside:e.languages[i]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),e.languages.html=e.languages.markup,e.languages.mathml=e.languages.markup,e.languages.svg=e.languages.markup,e.languages.xml=e.languages.extend("markup",{}),e.languages.ssml=e.languages.xml,e.languages.atom=e.languages.xml,e.languages.rss=e.languages.xml}tc.displayName="css";tc.aliases=[];function tc(e){(function(r){var i=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;r.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+i.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+i.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+i.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+i.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:i,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},r.languages.css.atrule.inside.rest=r.languages.css;var s=r.languages.markup;s&&(s.tag.addInlined("style","css"),s.tag.addAttribute("style","css"))})(e)}Ii.displayName="clike";Ii.aliases=[];function Ii(e){e.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/}}io.displayName="javascript";io.aliases=["js"];function io(e){e.register(Ii),e.languages.javascript=e.languages.extend("clike",{"class-name":[e.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),e.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,e.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:e.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:e.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:e.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:e.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:e.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),e.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:e.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),e.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),e.languages.markup&&(e.languages.markup.tag.addInlined("script","javascript"),e.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),e.languages.js=e.languages.javascript}Uh.displayName="sql";Uh.aliases=[];function Uh(e){e.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/}}nc.displayName="c";nc.aliases=[];function nc(e){e.register(Ii),e.languages.c=e.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),e.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),e.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},e.languages.c.string],char:e.languages.c.char,comment:e.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:e.languages.c}}}}),e.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/}),delete e.languages.c.boolean}$h.displayName="cpp";$h.aliases=[];function $h(e){e.register(nc),(function(r){var i=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,s=/\b(?!<keyword>)\w+(?:\s*\.\s*\w+)*\b/.source.replace(/<keyword>/g,function(){return i.source});r.languages.cpp=r.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source.replace(/<keyword>/g,function(){return i.source})),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:i,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),r.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/<mod-name>(?:\s*:\s*<mod-name>)?|:\s*<mod-name>/.source.replace(/<mod-name>/g,function(){return s})+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),r.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:r.languages.cpp}}}}),r.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),r.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:r.languages.extend("cpp",{})}}),r.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},r.languages.cpp["base-clause"])})(e)}qh.displayName="bash";qh.aliases=["sh","shell"];function qh(e){(function(r){var i="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",s={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},c={bash:s,environment:{pattern:RegExp("\\$"+i),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+i),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};r.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+i),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:c},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:s}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:c},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:c.entity}}],environment:{pattern:RegExp("\\$?"+i),alias:"constant"},variable:c.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},s.inside=r.languages.bash;for(var u=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],f=c.variable[1].inside,l=0;l<u.length;l++)f[u[l]]=r.languages.bash[u[l]];r.languages.sh=r.languages.bash,r.languages.shell=r.languages.bash})(e)}Wh.displayName="yaml";Wh.aliases=["yml"];function Wh(e){(function(r){var i=/[*&][^\s[\]{},]+/,s=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,c="(?:"+s.source+"(?:[ ]+"+i.source+")?|"+i.source+"(?:[ ]+"+s.source+")?)",u=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g,function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source}),f=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function l(d,p){p=(p||"").replace(/m/g,"")+"m";var g=/([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g,function(){return c}).replace(/<<value>>/g,function(){return d});return RegExp(g,p)}r.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g,function(){return c})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g,function(){return c}).replace(/<<key>>/g,function(){return"(?:"+u+"|"+f+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:l(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:l(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:l(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:l(f),lookbehind:!0,greedy:!0},number:{pattern:l(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:s,important:i,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},r.languages.yml=r.languages.yaml})(e)}Gh.displayName="markdown";Gh.aliases=["md"];function Gh(e){e.register(Bi),(function(r){var i=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function s(l){return l=l.replace(/<inner>/g,function(){return i}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+l+")")}var c=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,u=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return c}),f=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;r.languages.markdown=r.languages.extend("markup",{}),r.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:r.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+u+f+"(?:"+u+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+u+f+")(?:"+u+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(c),inside:r.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+u+")"+f+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+u+"$"),inside:{"table-header":{pattern:RegExp(c),alias:"important",inside:r.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:s(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:s(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:s(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:s(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(l){["url","bold","italic","strike","code-snippet"].forEach(function(d){l!==d&&(r.languages.markdown[l].inside.content.inside[d]=r.languages.markdown[d])})}),r.hooks.add("after-tokenize",function(l){if(l.language!=="markdown"&&l.language!=="md")return;function d(p){if(!(!p||typeof p=="string"))for(var g=0,m=p.length;g<m;g++){var y=p[g];if(y.type!=="code"){d(y.content);continue}var _=y.content[1],k=y.content[3];if(_&&k&&_.type==="code-language"&&k.type==="code-block"&&typeof _.content=="string"){var C=_.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp");C=(/[a-z][\w-]*/i.exec(C)||[""])[0].toLowerCase();var v="language-"+C;k.alias?typeof k.alias=="string"?k.alias=[k.alias,v]:k.alias.push(v):k.alias=[v]}}}d(l.tokens)}),r.hooks.add("wrap",function(l){if(l.type==="code-block"){for(var d="",p=0,g=l.classes.length;p<g;p++){var m=l.classes[p],y=/language-(.+)/.exec(m);if(y){d=y[1];break}}var _=r.languages[d];if(_)l.content=r.highlight(l.content.value,_,d);else if(d&&d!=="none"&&r.plugins.autoloader){var k="md-"+new Date().valueOf()+"-"+Math.floor(Math.random()*1e16);l.attributes.id=k,r.plugins.autoloader.loadLanguages(d,function(){var C=document.getElementById(k);C&&(C.innerHTML=r.highlight(C.textContent,r.languages[d],d))})}}}),RegExp(r.languages.markup.tag.pattern.source,"gi"),r.languages.md=r.languages.markdown})(e)}Vh.displayName="ruby";Vh.aliases=["rb"];function Vh(e){e.register(Ii),(function(r){r.languages.ruby=r.languages.extend("clike",{comment:{pattern:/#.*|^=begin\s[\s\S]*?^=end/m,greedy:!0},"class-name":{pattern:/(\b(?:class|module)\s+|\bcatch\s+\()[\w.\\]+|\b[A-Z_]\w*(?=\s*\.\s*new\b)/,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:BEGIN|END|alias|and|begin|break|case|class|def|define_method|defined|do|each|else|elsif|end|ensure|extend|for|if|in|include|module|new|next|nil|not|or|prepend|private|protected|public|raise|redo|require|rescue|retry|return|self|super|then|throw|undef|unless|until|when|while|yield)\b/,operator:/\.{2,3}|&\.|===|<?=>|[!=]?~|(?:&&|\|\||<<|>>|\*\*|[+\-*/%<>!^&|=])=?|[?:]/,punctuation:/[(){}[\].,;]/}),r.languages.insertBefore("ruby","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}});var i={pattern:/((?:^|[^\\])(?:\\{2})*)#\{(?:[^{}]|\{[^{}]*\})*\}/,lookbehind:!0,inside:{content:{pattern:/^(#\{)[\s\S]+(?=\}$)/,lookbehind:!0,inside:r.languages.ruby},delimiter:{pattern:/^#\{|\}$/,alias:"punctuation"}}};delete r.languages.ruby.function;var s="(?:"+[/([^a-zA-Z0-9\s{(\[<=])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/\((?:[^()\\]|\\[\s\S]|\((?:[^()\\]|\\[\s\S])*\))*\)/.source,/\{(?:[^{}\\]|\\[\s\S]|\{(?:[^{}\\]|\\[\s\S])*\})*\}/.source,/\[(?:[^\[\]\\]|\\[\s\S]|\[(?:[^\[\]\\]|\\[\s\S])*\])*\]/.source,/<(?:[^<>\\]|\\[\s\S]|<(?:[^<>\\]|\\[\s\S])*>)*>/.source].join("|")+")",c=/(?:"(?:\\.|[^"\\\r\n])*"|(?:\b[a-zA-Z_]\w*|[^\s\0-\x7F]+)[?!]?|\$.)/.source;r.languages.insertBefore("ruby","keyword",{"regex-literal":[{pattern:RegExp(/%r/.source+s+/[egimnosux]{0,6}/.source),greedy:!0,inside:{interpolation:i,regex:/[\s\S]+/}},{pattern:/(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,lookbehind:!0,greedy:!0,inside:{interpolation:i,regex:/[\s\S]+/}}],variable:/[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,symbol:[{pattern:RegExp(/(^|[^:]):/.source+c),lookbehind:!0,greedy:!0},{pattern:RegExp(/([\r\n{(,][ \t]*)/.source+c+/(?=:(?!:))/.source),lookbehind:!0,greedy:!0}],"method-definition":{pattern:/(\bdef\s+)\w+(?:\s*\.\s*\w+)?/,lookbehind:!0,inside:{function:/\b\w+$/,keyword:/^self\b/,"class-name":/^\w+/,punctuation:/\./}}}),r.languages.insertBefore("ruby","string",{"string-literal":[{pattern:RegExp(/%[qQiIwWs]?/.source+s),greedy:!0,inside:{interpolation:i,string:/[\s\S]+/}},{pattern:/("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,greedy:!0,inside:{interpolation:i,string:/[\s\S]+/}},{pattern:/<<[-~]?([a-z_]\w*)[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?[a-z_]\w*|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?/}},interpolation:i,string:/[\s\S]+/}},{pattern:/<<[-~]?'([a-z_]\w*)'[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?'[a-z_]\w*'|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?'|'$/}},string:/[\s\S]+/}}],"command-literal":[{pattern:RegExp(/%x/.source+s),greedy:!0,inside:{interpolation:i,command:{pattern:/[\s\S]+/,alias:"string"}}},{pattern:/`(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|[^\\`#\r\n])*`/,greedy:!0,inside:{interpolation:i,command:{pattern:/[\s\S]+/,alias:"string"}}}]}),delete r.languages.ruby.string,r.languages.insertBefore("ruby","number",{builtin:/\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Fixnum|Float|Hash|IO|Integer|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|Stat|String|Struct|Symbol|TMS|Thread|ThreadGroup|Time|TrueClass)\b/,constant:/\b[A-Z][A-Z0-9_]*(?:[?!]|\b)/}),r.languages.rb=r.languages.ruby})(e)}Yh.displayName="diff";Yh.aliases=[];function Yh(e){(function(r){r.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var i={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(i).forEach(function(s){var c=i[s],u=[];/^\w+$/.test(s)||u.push(/\w+/.exec(s)[0]),s==="diff"&&u.push("bold"),r.languages.diff[s]={pattern:RegExp("^(?:["+c+`].*(?:\r
|
|
124
|
+
?|
|
|
125
|
+
|(?![\\s\\S])))+`,"m"),alias:u,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(s)[0]}}}}),Object.defineProperty(r.languages.diff,"PREFIXES",{value:i})})(e)}Kh.displayName="docker";Kh.aliases=["dockerfile"];function Kh(e){(function(r){var i=/\\[\r\n](?:\s|\\[\r\n]|#.*(?!.))*(?![\s#]|\\[\r\n])/.source,s=/(?:[ \t]+(?![ \t])(?:<SP_BS>)?|<SP_BS>)/.source.replace(/<SP_BS>/g,function(){return i}),c=/"(?:[^"\\\r\n]|\\(?:\r\n|[\s\S]))*"|'(?:[^'\\\r\n]|\\(?:\r\n|[\s\S]))*'/.source,u=/--[\w-]+=(?:<STR>|(?!["'])(?:[^\s\\]|\\.)+)/.source.replace(/<STR>/g,function(){return c}),f={pattern:RegExp(c),greedy:!0},l={pattern:/(^[ \t]*)#.*/m,lookbehind:!0,greedy:!0};function d(p,g){return p=p.replace(/<OPT>/g,function(){return u}).replace(/<SP>/g,function(){return s}),RegExp(p,g)}r.languages.docker={instruction:{pattern:/(^[ \t]*)(?:ADD|ARG|CMD|COPY|ENTRYPOINT|ENV|EXPOSE|FROM|HEALTHCHECK|LABEL|MAINTAINER|ONBUILD|RUN|SHELL|STOPSIGNAL|USER|VOLUME|WORKDIR)(?=\s)(?:\\.|[^\r\n\\])*(?:\\$(?:\s|#.*$)*(?![\s#])(?:\\.|[^\r\n\\])*)*/im,lookbehind:!0,greedy:!0,inside:{options:{pattern:d(/(^(?:ONBUILD<SP>)?\w+<SP>)<OPT>(?:<SP><OPT>)*/.source,"i"),lookbehind:!0,greedy:!0,inside:{property:{pattern:/(^|\s)--[\w-]+/,lookbehind:!0},string:[f,{pattern:/(=)(?!["'])(?:[^\s\\]|\\.)+/,lookbehind:!0}],operator:/\\$/m,punctuation:/=/}},keyword:[{pattern:d(/(^(?:ONBUILD<SP>)?HEALTHCHECK<SP>(?:<OPT><SP>)*)(?:CMD|NONE)\b/.source,"i"),lookbehind:!0,greedy:!0},{pattern:d(/(^(?:ONBUILD<SP>)?FROM<SP>(?:<OPT><SP>)*(?!--)[^ \t\\]+<SP>)AS/.source,"i"),lookbehind:!0,greedy:!0},{pattern:d(/(^ONBUILD<SP>)\w+/.source,"i"),lookbehind:!0,greedy:!0},{pattern:/^\w+/,greedy:!0}],comment:l,string:f,variable:/\$(?:\w+|\{[^{}"'\\]*\})/,operator:/\\$/m}},comment:l},r.languages.dockerfile=r.languages.docker})(e)}Xh.displayName="go";Xh.aliases=[];function Xh(e){e.register(Ii),e.languages.go=e.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/}),e.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}}),delete e.languages.go["class-name"]}Zh.displayName="graphql";Zh.aliases=[];function Zh(e){e.languages.graphql={comment:/#.*/,description:{pattern:/(?:"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*")(?=\s*[a-z_])/i,greedy:!0,alias:"string",inside:{"language-markdown":{pattern:/(^"(?:"")?)(?!\1)[\s\S]+(?=\1$)/,lookbehind:!0,inside:e.languages.markdown}}},string:{pattern:/"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*"/,greedy:!0},number:/(?:\B-|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,boolean:/\b(?:false|true)\b/,variable:/\$[a-z_]\w*/i,directive:{pattern:/@[a-z_]\w*/i,alias:"function"},"attr-name":{pattern:/\b[a-z_]\w*(?=\s*(?:\((?:[^()"]|"(?:\\.|[^\\"\r\n])*")*\))?:)/i,greedy:!0},"atom-input":{pattern:/\b[A-Z]\w*Input\b/,alias:"class-name"},scalar:/\b(?:Boolean|Float|ID|Int|String)\b/,constant:/\b[A-Z][A-Z_\d]*\b/,"class-name":{pattern:/(\b(?:enum|implements|interface|on|scalar|type|union)\s+|&\s*|:\s*|\[)[A-Z_]\w*/,lookbehind:!0},fragment:{pattern:/(\bfragment\s+|\.{3}\s*(?!on\b))[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},"definition-mutation":{pattern:/(\bmutation\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},"definition-query":{pattern:/(\bquery\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},keyword:/\b(?:directive|enum|extend|fragment|implements|input|interface|mutation|on|query|repeatable|scalar|schema|subscription|type|union)\b/,operator:/[!=|&]|\.{3}/,"property-query":/\w+(?=\s*\()/,object:/\w+(?=\s*\{)/,punctuation:/[!(){}\[\]:=,]/,property:/\w+/},e.hooks.add("after-tokenize",function(i){if(i.language!=="graphql")return;var s=i.tokens.filter(function(v){return typeof v!="string"&&v.type!=="comment"&&v.type!=="scalar"}),c=0;function u(v){return s[c+v]}function f(v,b){b=b||0;for(var x=0;x<v.length;x++){var S=u(x+b);if(!S||S.type!==v[x])return!1}return!0}function l(v,b){for(var x=1,S=c;S<s.length;S++){var j=s[S],A=j.content;if(j.type==="punctuation"&&typeof A=="string"){if(v.test(A))x++;else if(b.test(A)&&(x--,x===0))return S}}return-1}function d(v,b){var x=v.alias;x?Array.isArray(x)||(v.alias=x=[x]):v.alias=x=[],x.push(b)}for(;c<s.length;){var p=s[c++];if(p.type==="keyword"&&p.content==="mutation"){var g=[];if(f(["definition-mutation","punctuation"])&&u(1).content==="("){c+=2;var m=l(/^\($/,/^\)$/);if(m===-1)continue;for(;c<m;c++){var y=u(0);y.type==="variable"&&(d(y,"variable-input"),g.push(y.content))}c=m+1}if(f(["punctuation","property-query"])&&u(0).content==="{"&&(c++,d(u(0),"property-mutation"),g.length>0)){var _=l(/^\{$/,/^\}$/);if(_===-1)continue;for(var k=c;k<_;k++){var C=s[k];C.type==="variable"&&g.indexOf(C.content)>=0&&d(C,"variable-input")}}}}})}Qh.displayName="scss";Qh.aliases=[];function Qh(e){e.register(tc),e.languages.scss=e.languages.extend("css",{comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},atrule:{pattern:/@[\w-](?:\([^()]+\)|[^()\s]|\s+(?!\s))*?(?=\s+[{;])/,inside:{rule:/@[\w-]+/}},url:/(?:[-a-z]+-)?url(?=\()/i,selector:{pattern:/(?=\S)[^@;{}()]?(?:[^@;{}()\s]|\s+(?!\s)|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}][^:{}]*[:{][^}]))/,inside:{parent:{pattern:/&/,alias:"important"},placeholder:/%[-\w]+/,variable:/\$[-\w]+|#\{\$[-\w]+\}/}},property:{pattern:/(?:[-\w]|\$[-\w]|#\{\$[-\w]+\})+(?=\s*:)/,inside:{variable:/\$[-\w]+|#\{\$[-\w]+\}/}}}),e.languages.insertBefore("scss","atrule",{keyword:[/@(?:content|debug|each|else(?: if)?|extend|for|forward|function|if|import|include|mixin|return|use|warn|while)\b/i,{pattern:/( )(?:from|through)(?= )/,lookbehind:!0}]}),e.languages.insertBefore("scss","important",{variable:/\$[-\w]+|#\{\$[-\w]+\}/}),e.languages.insertBefore("scss","function",{"module-modifier":{pattern:/\b(?:as|hide|show|with)\b/i,alias:"keyword"},placeholder:{pattern:/%[-\w]+/,alias:"selector"},statement:{pattern:/\B!(?:default|optional)\b/i,alias:"keyword"},boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"},operator:{pattern:/(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|not|or)(?=\s)/,lookbehind:!0}}),e.languages.scss.atrule.inside.rest=e.languages.scss}Jh.displayName="json";Jh.aliases=["webmanifest"];function Jh(e){e.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}},e.languages.webmanifest=e.languages.json}ef.displayName="java";ef.aliases=[];function ef(e){e.register(Ii),(function(r){var i=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,s=/(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,c={pattern:RegExp(/(^|[^\w.])/.source+s+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};r.languages.java=r.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[c,{pattern:RegExp(/(^|[^\w.])/.source+s+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:c.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+s+/[A-Z]\w*\b/.source),lookbehind:!0,inside:c.inside}],keyword:i,function:[r.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0},constant:/\b[A-Z][A-Z_\d]+\b/}),r.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),r.languages.insertBefore("java","class-name",{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:"punctuation"},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":c,keyword:i,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+s+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:c.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+s+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:c.inside.namespace,static:/\b\w+$/,punctuation:/\./,operator:/\*/,"class-name":/\w+/}}],namespace:{pattern:RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!<keyword>)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(/<keyword>/g,function(){return i.source})),lookbehind:!0,inside:{punctuation:/\./}}})})(e)}rc.displayName="typescript";rc.aliases=["ts"];function rc(e){e.register(io),(function(r){r.languages.typescript=r.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),r.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete r.languages.typescript.parameter,delete r.languages.typescript["literal-property"];var i=r.languages.extend("typescript",{});delete i["class-name"],r.languages.typescript["class-name"].inside=i,r.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:i}}}}),r.languages.ts=r.languages.typescript})(e)}tf.displayName="python";tf.aliases=["py"];function tf(e){e.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern://,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},e.languages.python["string-interpolation"].inside.interpolation.inside.rest=e.languages.python,e.languages.py=e.languages.python}ic.displayName="jsx";ic.aliases=[];function ic(e){e.register(io),e.register(Bi),(function(r){var i=r.util.clone(r.languages.javascript),s=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,c=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,u=/(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;function f(p,g){return p=p.replace(/<S>/g,function(){return s}).replace(/<BRACES>/g,function(){return c}).replace(/<SPREAD>/g,function(){return u}),RegExp(p,g)}u=f(u).source,r.languages.jsx=r.languages.extend("markup",i),r.languages.jsx.tag.pattern=f(/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source),r.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,r.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,r.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,r.languages.jsx.tag.inside.comment=i.comment,r.languages.insertBefore("inside","attr-name",{spread:{pattern:f(/<SPREAD>/.source),inside:r.languages.jsx}},r.languages.jsx.tag),r.languages.insertBefore("inside","special-attr",{script:{pattern:f(/=<BRACES>/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:r.languages.jsx}}},r.languages.jsx.tag);var l=function(p){return p?typeof p=="string"?p:typeof p.content=="string"?p.content:p.content.map(l).join(""):""},d=function(p){for(var g=[],m=0;m<p.length;m++){var y=p[m],_=!1;if(typeof y!="string"&&(y.type==="tag"&&y.content[0]&&y.content[0].type==="tag"?y.content[0].content[0].content==="</"?g.length>0&&g[g.length-1].tagName===l(y.content[0].content[1])&&g.pop():y.content[y.content.length-1].content==="/>"||g.push({tagName:l(y.content[0].content[1]),openedBraces:0}):g.length>0&&y.type==="punctuation"&&y.content==="{"?g[g.length-1].openedBraces++:g.length>0&&g[g.length-1].openedBraces>0&&y.type==="punctuation"&&y.content==="}"?g[g.length-1].openedBraces--:_=!0),(_||typeof y=="string")&&g.length>0&&g[g.length-1].openedBraces===0){var k=l(y);m<p.length-1&&(typeof p[m+1]=="string"||p[m+1].type==="plain-text")&&(k+=l(p[m+1]),p.splice(m+1,1)),m>0&&(typeof p[m-1]=="string"||p[m-1].type==="plain-text")&&(k=l(p[m-1])+k,p.splice(m-1,1),m--),p[m]=new r.Token("plain-text",k,null,k)}y.content&&typeof y.content!="string"&&d(y.content)}};r.hooks.add("after-tokenize",function(p){p.language!=="jsx"&&p.language!=="tsx"||d(p.tokens)})})(e)}nf.displayName="tsx";nf.aliases=[];function nf(e){e.register(ic),e.register(rc),(function(r){var i=r.util.clone(r.languages.typescript);r.languages.tsx=r.languages.extend("jsx",i),delete r.languages.tsx.parameter,delete r.languages.tsx["literal-property"];var s=r.languages.tsx.tag;s.pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+s.pattern.source+")",s.pattern.flags),s.lookbehind=!0})(e)}rf.displayName="rust";rf.aliases=[];function rf(e){(function(r){for(var i=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source,s=0;s<2;s++)i=i.replace(/<self>/g,function(){return i});i=i.replace(/<self>/g,function(){return/[^\s\S]/.source}),r.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+i),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},r.languages.rust["closure-params"].inside.rest=r.languages.rust,r.languages.rust.attribute.inside.string=r.languages.rust.string})(e)}sf.displayName="toml";sf.aliases=[];function sf(e){(function(r){var i=/(?:[\w-]+|'[^'\n\r]*'|"(?:\\.|[^\\"\r\n])*")/.source;function s(c){return c.replace(/__/g,function(){return i})}r.languages.toml={comment:{pattern:/#.*/,greedy:!0},table:{pattern:RegExp(s(/(^[\t ]*\[\s*(?:\[\s*)?)__(?:\s*\.\s*__)*(?=\s*\])/.source),"m"),lookbehind:!0,greedy:!0,alias:"class-name"},key:{pattern:RegExp(s(/(^[\t ]*|[{,]\s*)__(?:\s*\.\s*__)*(?=\s*=)/.source),"m"),lookbehind:!0,greedy:!0,alias:"property"},string:{pattern:/"""(?:\\[\s\S]|[^\\])*?"""|'''[\s\S]*?'''|'[^'\n\r]*'|"(?:\\.|[^\\"\r\n])*"/,greedy:!0},date:[{pattern:/\b\d{4}-\d{2}-\d{2}(?:[T\s]\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?)?\b/i,alias:"number"},{pattern:/\b\d{2}:\d{2}:\d{2}(?:\.\d+)?\b/,alias:"number"}],number:/(?:\b0(?:x[\da-zA-Z]+(?:_[\da-zA-Z]+)*|o[0-7]+(?:_[0-7]+)*|b[10]+(?:_[10]+)*))\b|[-+]?\b\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?\b|[-+]?\b(?:inf|nan)\b/,boolean:/\b(?:false|true)\b/,punctuation:/[.,=[\]{}]/}})(e)}const Dl={'code[class*="language-"]':{background:"hsl(220, 13%, 18%)",color:"hsl(220, 14%, 71%)",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]':{background:"hsl(220, 13%, 18%)",color:"hsl(220, 14%, 71%)",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:"0.5em 0",overflow:"auto",borderRadius:"0.3em"},'code[class*="language-"]::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"] *::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'pre[class*="language-"] *::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"]::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"] *::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'pre[class*="language-"] *::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},':not(pre) > code[class*="language-"]':{padding:"0.2em 0.3em",borderRadius:"0.3em",whiteSpace:"normal"},comment:{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},prolog:{color:"hsl(220, 10%, 40%)"},cdata:{color:"hsl(220, 10%, 40%)"},doctype:{color:"hsl(220, 14%, 71%)"},punctuation:{color:"hsl(220, 14%, 71%)"},entity:{color:"hsl(220, 14%, 71%)",cursor:"help"},"attr-name":{color:"hsl(29, 54%, 61%)"},"class-name":{color:"hsl(29, 54%, 61%)"},boolean:{color:"hsl(29, 54%, 61%)"},constant:{color:"hsl(29, 54%, 61%)"},number:{color:"hsl(29, 54%, 61%)"},atrule:{color:"hsl(29, 54%, 61%)"},keyword:{color:"hsl(286, 60%, 67%)"},property:{color:"hsl(355, 65%, 65%)"},tag:{color:"hsl(355, 65%, 65%)"},symbol:{color:"hsl(355, 65%, 65%)"},deleted:{color:"hsl(355, 65%, 65%)"},important:{color:"hsl(355, 65%, 65%)"},selector:{color:"hsl(95, 38%, 62%)"},string:{color:"hsl(95, 38%, 62%)"},char:{color:"hsl(95, 38%, 62%)"},builtin:{color:"hsl(95, 38%, 62%)"},inserted:{color:"hsl(95, 38%, 62%)"},regex:{color:"hsl(95, 38%, 62%)"},"attr-value":{color:"hsl(95, 38%, 62%)"},"attr-value > .token.punctuation":{color:"hsl(95, 38%, 62%)"},variable:{color:"hsl(207, 82%, 66%)"},operator:{color:"hsl(207, 82%, 66%)"},function:{color:"hsl(207, 82%, 66%)"},url:{color:"hsl(187, 47%, 55%)"},"attr-value > .token.punctuation.attr-equals":{color:"hsl(220, 14%, 71%)"},"special-attr > .token.attr-value > .token.value.css":{color:"hsl(220, 14%, 71%)"},".language-css .token.selector":{color:"hsl(355, 65%, 65%)"},".language-css .token.property":{color:"hsl(220, 14%, 71%)"},".language-css .token.function":{color:"hsl(187, 47%, 55%)"},".language-css .token.url > .token.function":{color:"hsl(187, 47%, 55%)"},".language-css .token.url > .token.string.url":{color:"hsl(95, 38%, 62%)"},".language-css .token.important":{color:"hsl(286, 60%, 67%)"},".language-css .token.atrule .token.rule":{color:"hsl(286, 60%, 67%)"},".language-javascript .token.operator":{color:"hsl(286, 60%, 67%)"},".language-javascript .token.template-string > .token.interpolation > .token.interpolation-punctuation.punctuation":{color:"hsl(5, 48%, 51%)"},".language-json .token.operator":{color:"hsl(220, 14%, 71%)"},".language-json .token.null.keyword":{color:"hsl(29, 54%, 61%)"},".language-markdown .token.url":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url > .token.operator":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url-reference.url > .token.string":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url > .token.content":{color:"hsl(207, 82%, 66%)"},".language-markdown .token.url > .token.url":{color:"hsl(187, 47%, 55%)"},".language-markdown .token.url-reference.url":{color:"hsl(187, 47%, 55%)"},".language-markdown .token.blockquote.punctuation":{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},".language-markdown .token.hr.punctuation":{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},".language-markdown .token.code-snippet":{color:"hsl(95, 38%, 62%)"},".language-markdown .token.bold .token.content":{color:"hsl(29, 54%, 61%)"},".language-markdown .token.italic .token.content":{color:"hsl(286, 60%, 67%)"},".language-markdown .token.strike .token.content":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.strike .token.punctuation":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.list.punctuation":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.title.important > .token.punctuation":{color:"hsl(355, 65%, 65%)"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"},namespace:{Opacity:"0.8"},"token.tab:not(:empty):before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.cr:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.lf:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.space:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item":{marginRight:"0.4em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},".line-highlight.line-highlight":{background:"hsla(220, 100%, 80%, 0.04)"},".line-highlight.line-highlight:before":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 14%, 71%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},".line-highlight.line-highlight[data-end]:after":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 14%, 71%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},"pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before":{backgroundColor:"hsla(220, 100%, 80%, 0.04)"},".line-numbers.line-numbers .line-numbers-rows":{borderRightColor:"hsla(220, 14%, 71%, 0.15)"},".command-line .command-line-prompt":{borderRightColor:"hsla(220, 14%, 71%, 0.15)"},".line-numbers .line-numbers-rows > span:before":{color:"hsl(220, 14%, 45%)"},".command-line .command-line-prompt > span:before":{color:"hsl(220, 14%, 45%)"},".rainbow-braces .token.token.punctuation.brace-level-1":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-5":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-9":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-2":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-6":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-10":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-3":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-7":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-11":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-4":{color:"hsl(286, 60%, 67%)"},".rainbow-braces .token.token.punctuation.brace-level-8":{color:"hsl(286, 60%, 67%)"},".rainbow-braces .token.token.punctuation.brace-level-12":{color:"hsl(286, 60%, 67%)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},".prism-previewer.prism-previewer:before":{borderColor:"hsl(224, 13%, 17%)"},".prism-previewer-gradient.prism-previewer-gradient div":{borderColor:"hsl(224, 13%, 17%)",borderRadius:"0.3em"},".prism-previewer-color.prism-previewer-color:before":{borderRadius:"0.3em"},".prism-previewer-easing.prism-previewer-easing:before":{borderRadius:"0.3em"},".prism-previewer.prism-previewer:after":{borderTopColor:"hsl(224, 13%, 17%)"},".prism-previewer-flipped.prism-previewer-flipped.after":{borderBottomColor:"hsl(224, 13%, 17%)"},".prism-previewer-angle.prism-previewer-angle:before":{background:"hsl(219, 13%, 22%)"},".prism-previewer-time.prism-previewer-time:before":{background:"hsl(219, 13%, 22%)"},".prism-previewer-easing.prism-previewer-easing":{background:"hsl(219, 13%, 22%)"},".prism-previewer-angle.prism-previewer-angle circle":{stroke:"hsl(220, 14%, 71%)",strokeOpacity:"1"},".prism-previewer-time.prism-previewer-time circle":{stroke:"hsl(220, 14%, 71%)",strokeOpacity:"1"},".prism-previewer-easing.prism-previewer-easing circle":{stroke:"hsl(220, 14%, 71%)",fill:"transparent"},".prism-previewer-easing.prism-previewer-easing path":{stroke:"hsl(220, 14%, 71%)"},".prism-previewer-easing.prism-previewer-easing line":{stroke:"hsl(220, 14%, 71%)"}};pt.registerLanguage("typescript",rc);pt.registerLanguage("javascript",io);pt.registerLanguage("tsx",nf);pt.registerLanguage("jsx",ic);pt.registerLanguage("python",tf);pt.registerLanguage("bash",qh);pt.registerLanguage("json",Jh);pt.registerLanguage("css",tc);pt.registerLanguage("html",Bi);pt.registerLanguage("markup",Bi);pt.registerLanguage("xml",Bi);pt.registerLanguage("sql",Uh);pt.registerLanguage("yaml",Wh);pt.registerLanguage("markdown",Gh);pt.registerLanguage("diff",Yh);pt.registerLanguage("rust",rf);pt.registerLanguage("go",Xh);pt.registerLanguage("java",ef);pt.registerLanguage("c",nc);pt.registerLanguage("cpp",$h);pt.registerLanguage("ruby",Vh);pt.registerLanguage("toml",sf);pt.registerLanguage("scss",Qh);pt.registerLanguage("graphql",Zh);pt.registerLanguage("docker",Kh);function Zy(e=2e3){const[r,i]=P.useState(!1),s=P.useCallback(async c=>{try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(c);else{const u=document.createElement("textarea");u.value=c,u.style.position="fixed",u.style.left="-9999px",document.body.appendChild(u),u.select(),document.execCommand("copy"),document.body.removeChild(u)}i(!0),setTimeout(()=>i(!1),e)}catch(u){console.error("Failed to copy:",u)}},[e]);return{copied:r,copy:s}}const _5={code({className:e,children:r,...i}){const s=/language-(\w+)/.exec(e||"");if(!s&&!String(r).includes(`
|
|
126
|
+
`))return o.jsx("code",{className:"bg-bg-tertiary px-1 py-0.5 rounded text-accent-secondary font-mono text-xs",...i,children:r});const u=(s==null?void 0:s[1])||"text",f=String(r).replace(/\n$/,""),{copied:l,copy:d}=Zy();return o.jsxs("div",{className:"relative group my-1.5 rounded overflow-hidden",children:[o.jsxs("div",{className:"absolute bottom-0 right-0 flex items-center gap-2 px-2 py-1 text-xs text-text-muted/70 bg-bg-tertiary/60 rounded-tl rounded-tr z-10",children:[o.jsx("span",{children:u}),o.jsx("button",{type:"button",onClick:p=>{p.preventDefault(),p.stopPropagation(),d(f)},className:"opacity-0 group-hover:opacity-100 transition-opacity hover:text-text-primary p-0.5",title:"Copy code",children:l?o.jsx(Wl,{}):o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})]}),o.jsx("div",{className:"overflow-x-auto",children:o.jsx(pt,{style:Dl,language:u,PreTag:"div",customStyle:{margin:0,fontSize:"0.75rem"},codeTagProps:{style:{whiteSpace:"pre-wrap",wordBreak:"break-word"}},children:f})})]})},p({children:e}){return o.jsx("p",{className:"mb-1.5 last:mb-0 leading-tight",children:e})},ul({children:e}){return o.jsx("ul",{className:"list-disc list-inside mb-1.5 space-y-0.5",children:e})},ol({children:e}){return o.jsx("ol",{className:"list-decimal list-inside mb-1.5 space-y-0.5",children:e})},li({children:e}){return o.jsx("li",{className:"text-text-primary text-sm list-item",children:e})},h1({children:e}){return o.jsx("h1",{className:"text-base font-bold mb-1.5 mt-2 first:mt-0 text-sky-400",children:e})},h2({children:e}){return o.jsx("h2",{className:"text-sm font-bold mb-1.5 mt-2 first:mt-0 text-sky-400",children:e})},h3({children:e}){return o.jsx("h3",{className:"text-sm font-bold mb-1.5 mt-1.5 first:mt-0 text-sky-400",children:e})},h4({children:e}){return o.jsx("h4",{className:"text-sm font-bold mb-1.5 mt-1.5 first:mt-0 text-sky-400",children:e})},strong({children:e}){return o.jsx("strong",{className:"font-bold text-amber-400",children:e})},a({href:e,children:r}){return o.jsx("a",{href:e,className:"text-accent-primary hover:underline text-sm",target:"_blank",rel:"noopener noreferrer",children:r})},blockquote({children:e}){return o.jsx("blockquote",{className:"border-l-2 border-accent-primary pl-2 my-1.5 text-text-secondary italic text-sm",children:e})},table({children:e}){return o.jsx("div",{className:"overflow-x-auto my-1.5",children:o.jsx("table",{className:"min-w-full border border-border",children:e})})},th({children:e}){return o.jsx("th",{className:"border border-border bg-bg-tertiary px-2 py-1 text-left font-semibold text-sm",children:e})},td({children:e}){return o.jsx("td",{className:"border border-border px-2 py-1 text-sm",children:e})},hr(){return o.jsx("hr",{className:"border-border my-2"})},input({checked:e,...r}){return o.jsx("input",{type:"checkbox",checked:e,disabled:!0,className:"mr-1.5 w-3.5 h-3.5",...r})}},zi=P.memo(function({content:r,className:i=""}){const s=P.useMemo(()=>{let c=S5(r);return c=w5(c),c},[r]);return o.jsx("div",{className:`markdown-content [&_li>p]:inline ${i}`,children:o.jsx(fj,{remarkPlugins:[E3],components:_5,children:s})})});function S5(e){let r=e.replace(/^(\s*)•\s/gm,"$1- ");return r=r.replace(/^(\d+)\.\s*\n(?=\S)/gm,"$1. "),r}function w5(e){const r=/```/g,i=e.match(r);if(((i==null?void 0:i.length)??0)%2===1){const c=e.lastIndexOf("```");return e.slice(c+3).includes(`
|
|
127
|
+
`),e+"\n```"}return e}const C5=P.memo(function({content:r,variant:i="default"}){return i==="labeled"?o.jsxs("div",{className:"text-text-muted text-sm italic feed-item",children:[o.jsx("span",{className:"text-purple-400",children:"thinking:"}),o.jsx("div",{className:"ml-1.5 mt-0.5",children:o.jsx(zi,{content:r})})]}):o.jsx("div",{className:"text-text-muted text-sm italic bg-bg-tertiary/50 rounded p-1.5 feed-item whitespace-pre-wrap",children:r})});function Qy({tool:e,className:r="w-4 h-4 text-text-muted flex-shrink-0"}){return e==="glob"||e==="grep"?o.jsx("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}):e==="run_command"||e==="bash"?o.jsx("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})}):o.jsx("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})}const k5={...Dl,'pre[class*="language-"]':{...Dl['pre[class*="language-"]'],background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word",overflowX:"hidden"},'code[class*="language-"]':{...Dl['code[class*="language-"]'],background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word"}},E5={ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",py:"python",rb:"ruby",rs:"rust",go:"go",java:"java",c:"c",cpp:"cpp",h:"c",hpp:"cpp",cs:"csharp",php:"php",swift:"swift",kt:"kotlin",scala:"scala",sh:"bash",bash:"bash",zsh:"bash",fish:"bash",ps1:"powershell",sql:"sql",html:"html",htm:"html",css:"css",scss:"scss",sass:"sass",less:"less",json:"json",yaml:"yaml",yml:"yaml",xml:"xml",md:"markdown",markdown:"markdown",toml:"toml",ini:"ini",conf:"ini",dockerfile:"docker",makefile:"makefile",cmake:"cmake",graphql:"graphql",gql:"graphql",vue:"vue",svelte:"svelte"};function sc(e){var c;if(!e)return"text";const r=e.split("/").pop()??"",i=r.toLowerCase();if(i==="dockerfile")return"docker";if(i==="makefile")return"makefile";if(i==="cmakelists.txt")return"cmake";const s=(c=r.split(".").pop())==null?void 0:c.toLowerCase();return s?E5[s]??"text":"text"}const Jy={margin:0,padding:0,borderRadius:0,fontSize:"0.875rem",lineHeight:"1.5rem",background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word"},j5={...Jy,display:"inline"},N5={margin:0,padding:0,borderRadius:0,fontSize:"0.875rem",lineHeight:"1.5rem",background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word"},Qa=P.memo(function({code:r,language:i,variant:s}){const c=s==="inline"?"span":s==="block-nowrap"?"div":"pre",u=s==="inline"?j5:s==="block-nowrap"?Jy:N5;return o.jsx(pt,{style:k5,language:i,PreTag:c,customStyle:u,children:r})});function e0({src:e,alt:r,isOpen:i,onClose:s}){const c=P.useRef(null);P.useEffect(()=>{if(!i)return;const f=l=>{l.key==="Escape"&&s()};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[i,s]);const u=f=>{f.target===f.currentTarget&&s()};return i?o.jsx("div",{ref:c,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-sm",onClick:u,role:"dialog","aria-modal":"true","aria-label":"Image viewer",children:o.jsxs("div",{className:"relative max-w-[95vw] max-h-[95vh] flex items-center justify-center",children:[o.jsx($l,{onClick:s,className:"absolute -top-12 right-0 text-white hover:text-gray-300 transition-colors","aria-label":"Close image viewer"}),o.jsx("img",{src:e,alt:r,className:"max-w-full max-h-[90vh] object-contain rounded-lg shadow-2xl"})]})}):null}const T5=P.memo(function({oldString:r,newString:i,filePath:s}){const c=P.useMemo(()=>sc(s),[s]),u=r.split(`
|
|
128
|
+
`),f=i.split(`
|
|
129
|
+
`),l=r.length>0,d=i.length>0;return!l&&!d?o.jsx("div",{className:"text-xs text-text-muted italic p-2",children:"No changes"}):o.jsxs("div",{className:"rounded overflow-hidden border border-border grid grid-cols-[3px_1.5rem_1fr]",children:[l&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"bg-red-400/60"}),o.jsx("div",{className:"bg-red-950/30 text-red-400/70 text-sm font-mono text-center",children:u.map((p,g)=>o.jsx("div",{className:"leading-[1.5rem]",children:"-"},g))}),o.jsx("div",{className:"bg-red-950/30 pr-2 line-through decoration-red-400/30 overflow-x-auto min-w-0",children:o.jsx(Qa,{code:r,language:c,variant:"block-nowrap"})})]}),d&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"bg-green-400/60"}),o.jsx("div",{className:"bg-green-950/30 text-green-400/70 text-sm font-mono text-center",children:f.map((p,g)=>o.jsx("div",{className:"leading-[1.5rem]",children:"+"},g))}),o.jsx("div",{className:"bg-green-950/30 pr-2 overflow-x-auto min-w-0",children:o.jsx(Qa,{code:i,language:c,variant:"block-nowrap"})})]})]})}),A5=P.memo(function({content:r,filePath:i}){const s=P.useMemo(()=>sc(i),[i]);return o.jsx("div",{className:"rounded overflow-hidden border border-border max-h-[45vh] overflow-y-auto",children:o.jsxs("div",{className:"grid grid-cols-[3px_1.5rem_1fr]",children:[o.jsx("div",{className:"bg-green-400/60"}),o.jsx("div",{className:"bg-green-950/30 text-green-400/70 text-sm font-mono text-center",children:r.split(`
|
|
130
|
+
`).map((c,u)=>o.jsx("div",{className:"leading-[1.5rem]",children:"+"},u))}),o.jsx("div",{className:"bg-green-950/30 pr-2 min-w-0 overflow-x-hidden",children:o.jsx(Qa,{code:r,language:s,variant:"block"})})]})})}),D5=P.memo(function({regions:r,filePath:i}){const s=P.useMemo(()=>sc(i),[i]);return r.length===0?o.jsx("div",{className:"text-xs text-text-muted italic p-2",children:"No changes"}):o.jsx("div",{className:"space-y-2",children:r.map((c,u)=>o.jsx(L5,{region:c,language:s},u))})}),L5=P.memo(function({region:r,language:i}){const s=R5(r),c=Math.max(...r.beforeContext.map(f=>f.lineNumber),...r.afterContext.map(f=>f.lineNumber),...r.edits.flatMap(f=>[f.startLine,f.endLine])),u=String(c).length;return o.jsx("div",{className:"rounded overflow-hidden border border-border font-mono text-sm",children:s.map((f,l)=>o.jsx(M5,{item:f,language:i,lineNumWidth:u},l))})});function R5(e){const r=[];for(const i of e.beforeContext)r.push({type:"context",lineNumber:i.lineNumber,content:i.content});for(const i of e.edits){const s=i.oldContent.split(`
|
|
131
|
+
`);for(let u=0;u<s.length;u++)r.push({type:"removed",lineNumber:i.startLine+u,content:s[u]});const c=i.newContent.split(`
|
|
132
|
+
`);for(let u=0;u<c.length;u++)r.push({type:"added",lineNumber:i.startLine+u,content:c[u]})}for(const i of e.afterContext)r.push({type:"context",lineNumber:i.lineNumber,content:i.content});return r}const M5=P.memo(function({item:r,language:i,lineNumWidth:s}){const c=String(r.lineNumber).padStart(s," "),u=r.type==="context"?"bg-bg-secondary":r.type==="removed"?"bg-red-950/30":"bg-green-950/30",f=r.type==="context"?"text-text-muted":r.type==="removed"?"text-red-400/70":"text-green-400/70",l=r.type==="context"?" ":r.type==="removed"?"-":"+",d=r.type==="removed"?"line-through decoration-red-400/30":"",p=r.type==="context"?"bg-transparent":r.type==="removed"?"bg-red-400/60":"bg-green-400/60";return o.jsxs("div",{className:`grid grid-cols-[3px_auto_1.25rem_1fr] ${u}`,children:[o.jsx("div",{className:p}),o.jsx("div",{className:"px-2 text-text-muted text-right select-none leading-[1.5rem]",children:c}),o.jsx("div",{className:`text-center select-none leading-[1.5rem] ${f}`,children:l}),o.jsx("div",{className:`pr-2 overflow-x-auto min-w-0 ${d}`,children:o.jsx(Qa,{code:r.content||" ",language:i,variant:"inline"})})]})}),O5=P.memo(function({result:r,metadata:i,filePath:s,heightExpanded:c=!1}){const[u,f]=P.useState(!1),l=P.useMemo(()=>sc(s),[s]),d=i==null?void 0:i.mimeType,p=i==null?void 0:i.base64Data;if(d!=null&&d.startsWith("image/")&&p){const y=`data:${d};base64,${p}`;return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:`rounded overflow-hidden border border-border ${c?"":"max-h-[45vh]"} flex items-center justify-center cursor-pointer hover:border-accent-primary transition-colors`,onClick:()=>f(!0),children:o.jsx("img",{src:y,alt:s,className:"max-w-full max-h-[45vh] object-contain"})}),o.jsx(e0,{src:y,alt:s,isOpen:u,onClose:()=>f(!1)})]})}if(!r)return o.jsx("div",{className:"text-xs text-text-muted italic p-2",children:"Empty file"});const g=r.split(`
|
|
133
|
+
`),m=g.filter(y=>!y.startsWith(`
|
|
134
|
+
[`)&&!y.startsWith("[")).map(y=>y.replace(/^\d+: /,"")).join(`
|
|
135
|
+
`);return o.jsx("div",{className:`rounded overflow-hidden border border-border ${c?"":"max-h-[45vh]"} overflow-y-auto`,children:o.jsxs("div",{className:"grid grid-cols-[2.5rem_1fr]",children:[o.jsx("div",{className:"bg-bg-tertiary text-text-muted text-xs font-mono text-right pr-2 select-none py-0.5",children:g.filter(y=>!y.startsWith(`
|
|
136
|
+
[`)&&!y.startsWith("[")).map((y,_)=>{const k=y.match(/^(\d+): /);return o.jsx("div",{className:"leading-[1.5rem]",children:k?k[1]:_+1},_)})}),o.jsx("div",{className:"min-w-0 overflow-x-hidden py-0.5",children:o.jsx(Qa,{code:m,language:l,variant:"block"})})]})})}),B5={error:{icon:"✗",color:"text-accent-error",bg:"bg-red-500/10",border:"border-red-500/30"},warning:{icon:"⚠",color:"text-accent-warning",bg:"bg-yellow-500/10",border:"border-yellow-500/30"},info:{icon:"ℹ",color:"text-accent-info",bg:"bg-blue-500/10",border:"border-blue-500/30"},hint:{icon:"💡",color:"text-text-muted",bg:"bg-gray-500/10",border:"border-gray-500/30"}},Wv=P.memo(function({diagnostics:r}){if(r.length===0)return null;const i=r.filter(u=>u.severity==="error"),s=r.filter(u=>u.severity==="warning"),c=r.filter(u=>u.severity==="info"||u.severity==="hint");return o.jsxs("div",{className:"rounded border border-border overflow-hidden mt-2",children:[o.jsxs("div",{className:"flex items-center gap-3 px-2 py-1.5 bg-bg-tertiary border-b border-border",children:[o.jsx("span",{className:"text-xs font-medium text-text-secondary",children:"LSP Diagnostics"}),i.length>0&&o.jsxs("span",{className:"text-xs text-accent-error font-medium",children:[i.length," error",i.length!==1?"s":""]}),s.length>0&&o.jsxs("span",{className:"text-xs text-accent-warning font-medium",children:[s.length," warning",s.length!==1?"s":""]}),c.length>0&&o.jsxs("span",{className:"text-xs text-text-muted",children:[c.length," info"]})]}),o.jsx("div",{className:"max-h-48 overflow-y-auto",children:r.map((u,f)=>{const l=B5[u.severity];return o.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${l.bg} border-b border-border last:border-b-0`,children:[o.jsx("span",{className:`${l.color} text-xs flex-shrink-0 w-4 text-center`,children:l.icon}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:["Ln ",u.range.start.line+1,":",u.range.start.character+1]}),u.code&&o.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:["[",u.code,"]"]})]}),o.jsx("div",{className:"text-xs text-text-primary break-words",children:u.message})]})]},f)})})]})}),I5=P.memo(function({command:r,timeout:i,startedAt:s,streamingOutput:c,status:u,result:f,error:l,durationMs:d}){const p=P.useRef(null),[g,m]=P.useState(0);P.useEffect(()=>{p.current&&u==="pending"&&(p.current.scrollTop=p.current.scrollHeight)},[c,u]),P.useEffect(()=>{if(u!=="pending"||!s)return;const C=setInterval(()=>{m(Date.now()-s)},100);return()=>clearInterval(C)},[u,s]);const y=i/1e3,_=u==="pending"?g/1e3:(d??0)/1e3,k=u==="pending"?(c==null?void 0:c.map(C=>C.content).join(""))??"":f??"";return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsxs("div",{className:"flex items-center gap-2 text-xs flex-1 min-w-0",children:[o.jsx("span",{className:"text-text-muted flex-shrink-0",children:"$"}),o.jsx("code",{className:"text-text-primary break-all",children:r})]}),o.jsxs("div",{className:"flex items-center gap-2 text-xs text-text-muted flex-shrink-0",children:[u==="pending"&&o.jsx("span",{className:"animate-pulse text-accent-warning",children:"running"}),u==="interrupted"&&o.jsx("span",{className:"text-red-400",children:"interrupted"}),o.jsxs("span",{className:u==="pending"?"text-text-secondary":"text-text-muted",children:[_.toFixed(1),"s / ",y,"s"]})]})]}),u==="pending"&&o.jsx("div",{className:"h-1 bg-bg-tertiary rounded overflow-hidden",children:o.jsx("div",{className:"h-full bg-accent-warning transition-all duration-100",style:{width:`${Math.min(100,g/i*100)}%`}})}),(k||u==="pending")&&o.jsx("pre",{ref:p,className:`text-xs bg-bg-primary p-2 rounded overflow-auto max-h-64 ${u==="pending"?"border border-accent-warning/30":""}`,children:u==="pending"&&c?c.map((C,v)=>o.jsx("span",{className:C.stream==="stderr"?"text-accent-warning":"",children:Ga(C.content)},v)):Ga(k)}),u==="error"&&l&&o.jsx("div",{className:"text-xs text-accent-error bg-accent-error/10 p-2 rounded",children:l}),u!=="pending"&&d!==void 0&&o.jsxs("div",{className:"text-[10px] text-text-muted",children:["Completed in ",(d/1e3).toFixed(2),"s"]})]})});function z5(e){switch(e){case"sensitive_file":return{title:"Sensitive File Access",description:"Accessing files that may contain secrets"};case"both":return{title:"Sensitive File Access",description:"Accessing sensitive files outside project"};case"dangerous_command":return{title:"Dangerous Command",description:"Running potentially dangerous command"};case"outside_workdir":default:return{title:"Path Access Request",description:"Accessing paths outside project directory"}}}function H5({confirmation:e}){const r=Ee(g=>g.confirmPath),i=Ee(g=>g.currentSession),s=Ee(g=>g.switchDangerLevel),{title:c,description:u}=z5(e.reason),f=e.reason==="sensitive_file"||e.reason==="both",l=f?"border-red-500/50":"border-amber-500/50",d=f?"bg-red-500/10":"bg-amber-500/10",p=()=>{i!=null&&i.id&&s("dangerous"),r(e.callId,!0,!1)};return o.jsxs("div",{className:`border ${l} ${d} rounded p-3 my-2`,children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx("svg",{className:`w-4 h-4 ${f?"text-red-400":"text-amber-400"}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:`text-sm font-medium ${f?"text-red-400":"text-amber-400"}`,children:c}),o.jsx("div",{className:"text-xs text-text-muted",children:u})]})]}),o.jsxs("div",{className:"text-xs text-text-muted mb-2",children:[o.jsx("span",{className:"font-medium",children:e.tool})," ","wants to access:"]}),o.jsx("div",{className:"bg-bg-primary rounded p-2 mb-3 max-h-24 overflow-y-auto",children:o.jsx("ul",{className:"space-y-0.5",children:e.paths.map((g,m)=>o.jsx("li",{className:`text-xs font-mono ${f?"text-red-300":"text-amber-300"} break-all`,children:g},m))})}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("button",{onClick:()=>r(e.callId,!1),className:"flex-1 px-3 py-1.5 text-xs font-medium rounded bg-bg-tertiary hover:bg-bg-tertiary/80 text-text-secondary border border-border transition-colors",children:"Deny"}),o.jsx("button",{onClick:()=>r(e.callId,!0,!1),className:"flex-1 px-3 py-1.5 text-xs font-medium rounded bg-accent-primary hover:bg-accent-primary/80 text-white transition-colors",children:"Allow"}),o.jsx("button",{onClick:p,className:"flex-1 px-3 py-1.5 text-xs font-medium rounded bg-red-600 hover:bg-red-700 text-white transition-colors",title:"Enable dangerous mode and allow this request",children:"Allow Everything"})]})]})}function P5(e,r){if(e==="read_file"){const s=String(r.path??""),c=r.offset,u=r.limit,f=[];return c!==void 0&&c!==1&&f.push(`offset=${c}`),u!==void 0&&f.push(`limit=${u}`),f.length>0?`${s} [${f.join(", ")}]`:s}if(e==="write_file"||e==="edit_file")return String(r.path??"");if(e==="run_command"||e==="bash")return String(r.command??"");if(e==="return_value"){const s=String(r.content??"");return s.length>60?s.slice(0,60)+"...":s}const i=JSON.stringify(r);return i.length>50?i.slice(0,50)+"...":i}function Gv(e,r,i){return P5(e,r)}function F5(e){return JSON.stringify(e,null,2)}const U5={pending:{icon:"●",color:"text-accent-warning",animate:!0},success:{icon:"✓",color:"text-accent-success",animate:!1},error:{icon:"✗",color:"text-accent-error",animate:!1},interrupted:{icon:"✗",color:"text-red-400",animate:!1}},$5=P.memo(function({tool:r,args:i,status:s,variant:c="compact",result:u,error:f,durationMs:l,diagnostics:d,editContext:p,startedAt:g,streamingOutput:m,metadata:y,callId:_}){const k=r==="edit_file"||r==="write_file",C=r==="run_command"&&s==="pending",v=r==="read_file",b=r==="return_value",[x,S]=P.useState(k||C||b),j=U5[s],A=Ee(D=>D.pendingPathConfirmation),N=s==="pending"&&A&&_&&A.callId===_?A:null;return c==="compact"?o.jsxs("div",{className:"flex items-center gap-1.5 text-xs bg-bg-tertiary rounded px-2 py-1.5",children:[o.jsx(Qy,{tool:r}),o.jsx("span",{className:"text-accent-primary font-medium",children:r}),o.jsx("span",{className:"text-text-muted truncate flex-1",children:Gv(r,i)}),o.jsx("span",{className:`${j.color} ${j.animate?"animate-pulse":""}`,children:s==="pending"?"...":"done"})]}):o.jsxs("div",{className:"border border-border rounded overflow-hidden my-1 min-w-0",children:[o.jsxs("button",{className:"w-full flex items-center gap-1.5 p-2 bg-bg-tertiary hover:bg-bg-tertiary/80 text-left",onClick:()=>S(!x),children:[o.jsx("span",{className:`${j.color} ${j.animate?"animate-pulse":""}`,children:j.icon}),o.jsx("span",{className:"font-mono text-accent-primary text-sm",children:r}),o.jsx("span",{className:"text-text-muted text-xs flex-1 truncate",children:Gv(r,i)}),o.jsx("span",{className:"text-text-muted text-xs",children:x?"▼":"▶"})]}),N&&o.jsx(H5,{confirmation:N}),(x||v)&&o.jsxs("div",{className:"p-2 bg-bg-secondary border-t border-border space-y-2 min-w-0",children:[r==="run_command"&&o.jsx(I5,{command:String(i.command??""),timeout:i.timeout??12e4,startedAt:g,streamingOutput:m,status:s,result:u,error:f,durationMs:l}),r==="edit_file"&&s==="success"&&o.jsxs(o.Fragment,{children:[p&&p.regions.length>0?o.jsx(D5,{regions:p.regions,filePath:String(i.path??"")}):o.jsx(T5,{oldString:String(i.old_string??""),newString:String(i.new_string??""),filePath:String(i.path??"")}),d&&d.length>0&&o.jsx(Wv,{diagnostics:d})]}),r==="write_file"&&s==="success"&&o.jsxs(o.Fragment,{children:[o.jsx(A5,{content:String(i.content??""),filePath:String(i.path??"")}),d&&d.length>0&&o.jsx(Wv,{diagnostics:d})]}),r==="read_file"&&s==="success"&&o.jsx(O5,{result:u,metadata:y,filePath:String(i.path??""),heightExpanded:x}),r==="return_value"&&(()=>{const D=(m==null?void 0:m.map(I=>I.content).join(""))??"",T=s==="pending"&&D?D:String(i.content??"");return o.jsxs("div",{children:[o.jsx("div",{className:"text-[10px] text-accent-primary font-medium mb-1 uppercase tracking-wide",children:"Sub-Agent Summary"}),o.jsx("div",{className:"text-xs prose prose-invert prose-sm max-w-none",children:o.jsx(zi,{content:T})})]})})(),r!=="edit_file"&&r!=="write_file"&&r!=="run_command"&&r!=="read_file"&&r!=="return_value"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-[10px] text-text-muted mb-0.5",children:"Arguments:"}),o.jsx("pre",{className:"text-xs bg-bg-primary p-1.5 rounded overflow-x-auto",children:F5(i)})]}),s==="success"&&u!==void 0&&o.jsxs("div",{children:[o.jsxs("div",{className:"text-[10px] text-text-muted mb-0.5",children:["Result",l!==void 0&&` (${l}ms)`,":"]}),o.jsx("pre",{className:"text-xs bg-bg-primary p-1.5 rounded overflow-x-auto max-h-32",children:u||"No output"})]})]}),s==="success"&&(r==="edit_file"||r==="write_file"||r==="read_file")&&l!==void 0&&o.jsxs("div",{className:"text-[10px] text-text-muted",children:["Completed in ",l,"ms"]}),s==="error"&&f&&r!=="run_command"&&o.jsxs("div",{children:[o.jsx("div",{className:"text-[10px] text-accent-error mb-0.5",children:"Error:"}),o.jsx("pre",{className:"text-xs bg-bg-primary p-1.5 rounded text-accent-error",children:f})]})]})]})}),q5={read_file:"Reading file",write_file:"Writing file",edit_file:"Editing file",run_command:"Running command",glob:"Searching files",grep:"Searching content",ask_user:"Asking user",criterion:"Managing criterion",todo_write:"Updating tasks"};function W5(e){return q5[e]??`Preparing ${e}`}const G5=P.memo(function({name:r}){const i=W5(r);return o.jsx("div",{className:"border border-border rounded overflow-hidden my-1 min-w-0 animate-pulse",children:o.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-bg-tertiary",children:[o.jsx("span",{className:"text-accent-warning animate-pulse",children:"..."}),o.jsx(Qy,{tool:r}),o.jsx("span",{className:"font-mono text-accent-primary text-sm",children:r}),o.jsxs("span",{className:"text-text-muted text-xs flex-1",children:[i,"..."]})]})})}),V5={pending:{icon:"○",color:"text-text-muted"},in_progress:{icon:"●",color:"text-accent-warning",animate:!0},completed:{icon:"✓",color:"text-accent-success"}},Y5=P.memo(function({todos:r}){return Array.isArray(r)?r.length===0?o.jsx("div",{className:"text-xs text-text-muted italic my-1",children:"No tasks"}):o.jsxs("div",{className:"my-1 rounded border border-border bg-bg-tertiary overflow-hidden",children:[o.jsx("div",{className:"px-2 py-1.5 border-b border-border bg-bg-secondary",children:o.jsx("span",{className:"text-xs font-medium text-text-muted",children:"Tasks"})}),o.jsx("div",{children:r.map((i,s)=>{const c=V5[i.status];return o.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${s>0?"border-t border-border":""}`,children:[o.jsx("span",{className:`${(c==null?void 0:c.color)??"text-text-muted"} ${c!=null&&c.animate?"animate-pulse":""} text-sm leading-tight`,children:(c==null?void 0:c.icon)??"○"}),o.jsx("span",{className:`text-sm leading-tight ${i.status==="completed"?"text-text-muted":"text-text-primary"}`,children:i.content})]},s)})})]}):o.jsx("div",{className:"text-xs text-accent-warning italic my-1",children:"⚠️ Invalid todos data"})}),Vv={add:{icon:"○",color:"text-text-muted"},update:{icon:"○",color:"text-text-muted"},remove:{icon:"○",color:"text-text-muted"},complete:{icon:"◉",color:"text-purple-400"},pass:{icon:"✓",color:"text-accent-success"},fail:{icon:"✗",color:"text-accent-error"},get:{icon:"○",color:"text-text-muted"}},t0=P.memo(function({toolCalls:r,criteria:i}){if(r.length===0)return null;const s=new Map((i==null?void 0:i.map(u=>[u.id,u]))??[]),c=r.find(u=>{var f,l;return u.arguments.action==="get"&&((f=u.result)==null?void 0:f.success)&&((l=u.result)==null?void 0:l.output)});return o.jsxs("div",{className:"my-1 rounded border border-border bg-bg-tertiary overflow-hidden",children:[o.jsx("div",{className:"px-2 py-1.5 border-b border-border bg-bg-secondary",children:o.jsx("span",{className:"text-xs font-medium text-text-muted",children:"Acceptance Criteria"})}),o.jsx("div",{children:c?(()=>{const u=c.result.output;if(u==="No criteria defined yet.")return o.jsxs("div",{className:"flex items-start gap-2 px-2 py-1.5",children:[o.jsx("span",{className:"text-text-muted text-sm leading-tight flex-shrink-0",children:"○"}),o.jsx("div",{className:"flex-1 min-w-0 text-text-muted text-sm",children:"No criteria defined yet."})]});try{return JSON.parse(u).map((l,d)=>o.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${d>0?"border-t border-border":""}`,children:[o.jsx("span",{className:"text-text-muted text-sm leading-tight flex-shrink-0",children:"○"}),o.jsx("div",{className:"flex-1 min-w-0",children:o.jsx(zi,{content:`[${l.id}] ${l.description}`})})]},l.id??d))}catch{return r.map((f,l)=>o.jsx(Yv,{tc:f,index:l,criteriaMap:s},f.id??l))}})():r.map((u,f)=>o.jsx(Yv,{tc:u,index:f,criteriaMap:s},u.id??f))})]})});function Yv({tc:e,index:r,criteriaMap:i}){const s=e.arguments.action,c=s&&Vv[s]?Vv[s]:{icon:"○",color:"text-text-muted"},u=e.arguments,f=s==="remove",l=u.id,d=u.description,p=l?i.get(l):void 0,g=d??(p==null?void 0:p.description)??(f&&l?`[${l}]`:"Criterion updated"),m=u.reason,y=s==="fail";return o.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${r>0?"border-t border-border":""}`,children:[o.jsx("span",{className:`${c.color} text-sm leading-tight flex-shrink-0`,children:c.icon}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:f?"line-through text-text-muted":"",children:o.jsx(zi,{content:g})}),m&&o.jsxs("div",{className:`mt-1 text-sm ${y?"text-accent-error":"text-text-muted"}`,children:[o.jsx("span",{className:"text-text-muted",children:"└ "}),'"',m,'"']})]})]})}function K5(e){return e==="criterion"}const X5="#6b7280";function zl(e,r){var i;return((i=e.find(s=>s.id===r))==null?void 0:i.color)??X5}const Wt=Wn(e=>{const r=async()=>{await _h("/api/agents",e)};return{defaults:[],userItems:[],loading:!1,fetchAgents:r,fetchAgent:async i=>{try{const s=await Ce(`/api/agents/${i}`);return s.ok?await s.json():null}catch{return null}},fetchDefaultContent:async i=>{try{const s=await Ce(`/api/agents/defaults/${i}`);return s.ok?await s.json():null}catch{return null}},createAgent:async i=>{const s=await si("POST","/api/agents",i);return s.success&&await r(),s},updateAgent:async(i,s)=>{const c=await si("PUT",`/api/agents/${i}`,s);return c.success&&await r(),c},deleteAgent:async i=>{try{const s=await Ce(`/api/agents/${i}`,{method:"DELETE"}),c=await s.json();return s.ok?(e(u=>({userItems:u.userItems.filter(f=>f.id!==i)})),{success:!0}):{success:!1,error:c.error??"Failed to delete"}}catch{return{success:!1,error:"Network error"}}},duplicateAgent:async i=>{try{const s=await Ce(`/api/agents/${i}/duplicate`,{method:"POST"}),c=await s.json();return s.ok?(await r(),{success:!0}):{success:!1,error:c.error??"Failed to duplicate"}}catch{return{success:!1,error:"Network error"}}}}});function Z5(e){const r=[];let i=[];const s=()=>{i.length>0&&(r.push({type:"criteria_group",toolCalls:i}),i=[])};for(const c of e)c.type==="tool_call"&&K5(c.toolCall.name)?i.push(c.toolCall):(s(),r.push(c));return s(),r}function Q5(e,r){if(e.segments&&e.segments.length>0)return J5(e.segments,e.toolCalls??[],e.preparingToolCalls??[],e.stats,r);const i=[];if(e.thinkingContent&&i.push({type:"thinking",content:e.thinkingContent}),e.content&&i.push({type:"text",content:e.content}),e.toolCalls)for(const s of e.toolCalls)i.push({type:"tool_call",toolCall:s});if(e.preparingToolCalls)for(const s of e.preparingToolCalls)i.push({type:"preparing_tool_call",preparing:s});return r&&e.stats&&i.push({type:"stats",stats:e.stats}),i}function J5(e,r,i,s,c){const u=[],f=new Map(r.map(l=>[l.id,l]));for(const l of e)switch(l.type){case"text":u.push({type:"text",content:l.content});break;case"thinking":l.content&&l.content.trim().length>0&&u.push({type:"thinking",content:l.content});break;case"tool_call":{const d=f.get(l.toolCallId);d&&u.push({type:"tool_call",toolCall:d});break}}for(const l of i)u.push({type:"preparing_tool_call",preparing:l});return c&&s&&u.push({type:"stats",stats:s}),u}const af=P.memo(function({message:r,showStats:i=!0}){const s=Ee(p=>{var g;return(g=p.currentSession)==null?void 0:g.criteria}),c=Wt(p=>p.defaults),u=Wt(p=>p.userItems),f=[...c,...u],l=Q5(r,i),d=Z5(l);return d.length===0?null:o.jsx("div",{className:"feed-item",children:o.jsxs("div",{className:"min-w-0",children:[d.map((p,g)=>{var m,y;switch(p.type){case"thinking":return o.jsx(C5,{content:p.content},g);case"text":return o.jsx("div",{className:"prose prose-sm prose-invert max-w-none",children:o.jsx(zi,{content:p.content})},g);case"preparing_tool_call":return o.jsx(G5,{name:p.preparing.name},`preparing-${p.preparing.index}`);case"tool_call":{const _=p.toolCall,k=_.result;if(_.name==="todo_write"){const b=_.arguments.todos,x=Array.isArray(b)?b:[];return o.jsx(Y5,{todos:x},g)}const C=(m=k==null?void 0:k.output)==null?void 0:m.includes("[interrupted by user]"),v=k?C?"interrupted":k.success?"success":"error":"pending";return o.jsx($5,{tool:_.name,args:_.arguments,status:v,variant:"expandable",result:k==null?void 0:k.output,error:k==null?void 0:k.error,durationMs:k==null?void 0:k.durationMs,diagnostics:k==null?void 0:k.diagnostics,editContext:k==null?void 0:k.editContext,startedAt:_.startedAt,streamingOutput:_.streamingOutput,metadata:k==null?void 0:k.metadata,callId:_.id},g)}case"criteria_group":return o.jsx(t0,{toolCalls:p.toolCalls,criteria:s},g);case"stats":{const _=p.stats,k=((y=_.model.split("/").pop())==null?void 0:y.split("-").slice(0,2).join("-"))??_.model,C=zl(f,_.mode),v=x=>x>=1e3?`${(x/1e3).toFixed(1)}k`:x.toString(),b=x=>x>=1e3?`${(x/1e3).toFixed(1)}k`:x.toFixed(1);return o.jsxs("div",{className:"flex items-center justify-center gap-1.5 text-[10px] text-text-muted mt-3",children:[o.jsx("span",{className:"flex-1 h-px bg-border"}),o.jsx("span",{className:"text-text-secondary",children:k}),o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsx("span",{style:{color:C},children:_.mode}),o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsxs("span",{children:[_.totalTime.toFixed(1),"s"]}),_.toolTime>0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsxs("span",{children:[_.toolTime.toFixed(1),"s tools"]})]}),o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsxs("span",{children:[v(_.prefillTokens)," @ ",b(_.prefillSpeed)," pp"]}),o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsxs("span",{children:[v(_.generationTokens)," @ ",b(_.generationSpeed)," tg"]}),o.jsx("span",{className:"flex-1 h-px bg-border"})]},g)}}}),r.partial&&o.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-accent-warning mt-1",children:[o.jsx("svg",{className:"w-2.5 h-2.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),o.jsx("span",{children:"Aborted"})]})]})})}),Dt=Wn((e,r)=>({defaults:[],userItems:[],activeWorkflowId:"default",loading:!1,templateVariables:[],fetchTemplateVariables:async()=>{try{const s=await(await Ce("/api/workflows/template-variables")).json();e({templateVariables:s.variables??[]})}catch{}},fetchWorkflows:async()=>{e({loading:!0});try{const s=await(await Ce("/api/workflows")).json();e({defaults:s.defaults??[],userItems:s.userItems??[],activeWorkflowId:s.activeWorkflowId??"default",loading:!1})}catch{e({loading:!1})}},fetchWorkflow:async i=>{try{const s=await Ce(`/api/workflows/${i}`);return s.ok?await s.json():null}catch{return null}},fetchDefaultContent:async i=>{try{const s=await Ce(`/api/workflows/defaults/${i}`);return s.ok?await s.json():null}catch{return null}},createWorkflow:async i=>{const s=await si("POST","/api/workflows",i);return s.success&&await r().fetchWorkflows(),s},updateWorkflow:async(i,s)=>{const c=await si("PUT",`/api/workflows/${i}`,s);return c.success&&await r().fetchWorkflows(),c},deleteWorkflow:async i=>{try{const s=await Ce(`/api/workflows/${i}`,{method:"DELETE"}),c=await s.json();return s.ok?(e(u=>({userItems:u.userItems.filter(f=>f.id!==i)})),{success:!0}):{success:!1,error:c.error??"Failed to delete"}}catch{return{success:!1,error:"Network error"}}},duplicateWorkflow:async i=>{try{const s=await Ce(`/api/workflows/${i}/duplicate`,{method:"POST"}),c=await s.json();return s.ok?(await r().fetchWorkflows(),{success:!0}):{success:!1,error:c.error??"Failed to duplicate"}}catch{return{success:!1,error:"Network error"}}}}));function Hl(e,r){const i=parseInt(e.slice(1,3),16),s=parseInt(e.slice(3,5),16),c=parseInt(e.slice(5,7),16);return`rgba(${i},${s},${c},${r})`}function eT(e){if(e<60)return`${e}s`;const r=Math.floor(e/60),i=Math.round(e%60);return i>0?`${r}m ${i}s`:`${r}m`}function tT(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}const nT=P.memo(function({data:r}){var f;const i=Dt(l=>l.defaults),s=Dt(l=>l.userItems),u=((f=[...i,...s].find(l=>l.id===r.workflowId))==null?void 0:f.color)??r.workflowColor??"#8b949e";return o.jsxs("div",{className:"feed-item rounded p-3 border",style:{borderColor:Hl(u,.3),backgroundColor:Hl(u,.08)},children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx("svg",{className:"w-3.5 h-3.5 shrink-0",fill:"none",stroke:u,viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),o.jsx("span",{className:"text-sm font-medium",style:{color:u},children:r.workflowName??"Task Completed"})]}),o.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-5 gap-2",children:[o.jsx(Ia,{label:"Iterations",value:String(r.iterations)}),o.jsx(Ia,{label:"Total time",value:eT(r.totalTimeSeconds)}),o.jsx(Ia,{label:"Tool calls",value:String(r.totalToolCalls)}),o.jsx(Ia,{label:"Tokens",value:tT(r.totalTokensGenerated)}),o.jsx(Ia,{label:"Speed",value:r.avgGenerationSpeed>0?`${r.avgGenerationSpeed} tok/s`:"-"})]})]})});function Ia({label:e,value:r}){return o.jsxs("div",{className:"bg-bg-primary/50 rounded px-2 py-1",children:[o.jsx("div",{className:"text-sm text-text-muted",children:e}),o.jsx("div",{className:"text-sm text-text-primary font-medium",children:r})]})}const rT=P.memo(function({data:r}){var f;const i=Dt(l=>l.defaults),s=Dt(l=>l.userItems),u=((f=[...i,...s].find(l=>l.id===r.workflowId))==null?void 0:f.color)??r.workflowColor??"#6b7280";return o.jsxs("div",{className:"feed-item flex items-center gap-2 px-3 py-2 rounded border",style:{borderColor:Hl(u,.3),backgroundColor:Hl(u,.08)},children:[o.jsx("svg",{className:"w-3 h-3 shrink-0",fill:u,viewBox:"0 0 24 24",children:o.jsx("path",{d:"M8 5v14l11-7z"})}),o.jsx("span",{className:"text-sm font-medium",style:{color:u},children:r.workflowName}),o.jsx("span",{className:"text-text-muted text-sm",children:"started"})]})});function iT({attachments:e,messageId:r}){const[i,s]=P.useState(null),c=Ee(g=>g.visionFallbackByMessage),u=Ee(g=>g.messages),f=P.useMemo(()=>{const g=u.findIndex(m=>m.id===r);if(g===-1)return null;for(let m=g+1;m<u.length;m++){const y=u[m];if(y&&y.role==="assistant")return y.id}return null},[u,r]),l=g=>{s(g)},d=()=>{s(null)},p=g=>{const m=`${r}-${g}`;if(c[m])return c[m];if(f){const y=`${f}-${g}`;return c[y]}return null};return e.length===0?null:o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mt-3 flex flex-wrap gap-3",children:e.map(g=>{const m=p(g.id);return o.jsxs("div",{className:"relative inline-block",children:[o.jsxs("button",{onClick:()=>l(g.data),className:"group relative inline-block",title:g.filename,disabled:(m==null?void 0:m.type)==="start",children:[o.jsx("img",{src:g.data,alt:g.filename,className:"max-w-[256px] max-h-[256px] object-contain rounded-lg border border-border hover:border-accent-primary transition-colors cursor-pointer"}),(m==null?void 0:m.type)==="start"&&o.jsx("div",{className:"absolute inset-0 bg-black/60 flex items-center justify-center rounded-lg",children:o.jsx("span",{className:"text-xs text-text-primary animate-pulse",children:"Describing image..."})})]}),(m==null?void 0:m.type)==="done"&&m.description&&o.jsxs("div",{className:"mt-2 p-2 bg-bg-tertiary rounded text-xs text-text-secondary max-w-[256px]",children:[m.description.slice(0,200),m.description.length>200?"...":""]})]},g.id)})}),i&&o.jsx(e0,{src:i,alt:"Attached image",isOpen:!0,onClose:d})]})}function sT({isOpen:e,onClose:r,promptContext:i}){const[s,c]=P.useState({systemPrompt:!1,messages:!0,tools:!0,requestOptions:!0,injectedFiles:!0,userMessage:!0}),u=f=>{c(l=>({...l,[f]:!l[f]}))};return o.jsx(ln,{isOpen:e,onClose:r,title:"Prompt Inspector",size:"lg",children:o.jsxs("div",{className:"space-y-4",children:[o.jsx(Es,{title:"User Message",expanded:s.userMessage??!0,onToggle:()=>u("userMessage"),children:o.jsx("pre",{className:"text-sm text-text-secondary whitespace-pre-wrap bg-bg-tertiary rounded p-3 max-h-48 overflow-auto",children:i.userMessage||"(empty)"})}),i.messages.length>0&&o.jsx(Es,{title:`Prompt Messages (${i.messages.length})`,expanded:s.messages??!0,onToggle:()=>u("messages"),children:o.jsx("div",{className:"space-y-2",children:i.messages.map((f,l)=>o.jsxs("div",{className:"border border-border rounded overflow-hidden",children:[o.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-bg-tertiary/50 text-xs text-text-muted",children:[o.jsx("span",{className:"font-mono text-text-primary",children:f.role}),o.jsx("span",{className:"rounded bg-bg-tertiary px-1.5 py-0.5",children:f.source}),f.toolCallId&&o.jsx("span",{className:"font-mono",children:f.toolCallId}),f.attachments&&f.attachments.length>0&&o.jsxs("span",{className:"rounded bg-bg-tertiary px-1.5 py-0.5",children:[f.attachments.length," attachment",f.attachments.length===1?"":"s"]})]}),f.attachments&&f.attachments.length>0&&o.jsx("div",{className:"border-b border-border px-3 py-2 text-xs text-text-muted",children:f.attachments.map(d=>d.filename).join(", ")}),o.jsx("pre",{className:"text-xs text-text-secondary whitespace-pre-wrap bg-bg-tertiary rounded-b p-3 max-h-64 overflow-auto font-mono",children:f.content||"(empty)"})]},`${f.role}-${l}`))})}),o.jsx(Es,{title:`Tools (${i.tools.length})`,expanded:s.tools??!0,onToggle:()=>u("tools"),children:o.jsxs("div",{className:"space-y-2",children:[i.tools.length===0&&o.jsx("div",{className:"text-sm text-text-muted",children:"No tools sent with this request."}),i.tools.map((f,l)=>o.jsxs("div",{className:"bg-bg-tertiary rounded p-3 space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsx("span",{className:"font-mono text-sm text-text-primary",children:f.name}),o.jsx("span",{className:"text-xs text-text-muted",children:"parameters"})]}),o.jsx("div",{className:"text-sm text-text-secondary",children:f.description}),o.jsx("pre",{className:"text-xs text-text-secondary whitespace-pre-wrap max-h-48 overflow-auto font-mono",children:JSON.stringify(f.parameters,null,2)})]},`${f.name}-${l}`))]})}),o.jsx(Es,{title:"Request Options",expanded:s.requestOptions??!0,onToggle:()=>u("requestOptions"),children:o.jsx("pre",{className:"text-xs text-text-secondary whitespace-pre-wrap bg-bg-tertiary rounded p-3 max-h-48 overflow-auto font-mono lowercase",children:JSON.stringify(i.requestOptions,null,2)})}),i.injectedFiles.length>0&&o.jsx(Es,{title:`Injected Files (${i.injectedFiles.length})`,expanded:s.injectedFiles??!0,onToggle:()=>u("injectedFiles"),children:o.jsx("div",{className:"space-y-2",children:i.injectedFiles.map((f,l)=>o.jsx(aT,{file:f,expanded:s[`file-${l}`]??!1,onToggle:()=>u(`file-${l}`)},l))})}),o.jsx(Es,{title:"System Prompt",expanded:s.systemPrompt??!1,onToggle:()=>u("systemPrompt"),badge:`${Math.round(i.systemPrompt.length/1e3)}K chars`,children:o.jsx("pre",{className:"text-xs text-text-secondary whitespace-pre-wrap bg-bg-tertiary rounded p-3 max-h-96 overflow-auto font-mono",children:i.systemPrompt})})]})})}function aT({file:e,expanded:r,onToggle:i}){return o.jsxs("div",{className:"bg-bg-tertiary rounded overflow-hidden",children:[o.jsxs("button",{onClick:i,className:"w-full flex items-center gap-2 p-2 hover:bg-bg-primary/30 transition-colors",children:[o.jsx("svg",{className:`w-3 h-3 text-text-muted transition-transform ${r?"rotate-90":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),o.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${e.source==="global"?"bg-purple-500/20 text-purple-400":e.source==="project"?"bg-blue-500/20 text-blue-400":"bg-green-500/20 text-green-400"}`,children:e.source}),o.jsx("span",{className:"text-sm text-text-primary font-mono truncate flex-1 text-left",children:e.path}),e.content&&o.jsxs("span",{className:"text-xs text-text-muted",children:[Math.round(e.content.length/1e3),"K chars"]})]}),r&&e.content&&o.jsx("div",{className:"border-t border-border/50 p-2",children:o.jsx("pre",{className:"text-xs text-text-secondary whitespace-pre-wrap max-h-64 overflow-auto font-mono",children:e.content})})]})}function Es({title:e,expanded:r,onToggle:i,badge:s,children:c}){return o.jsxs("div",{className:"border border-border rounded overflow-hidden",children:[o.jsx("button",{onClick:i,className:"w-full flex items-center justify-between p-3 bg-bg-tertiary/50 hover:bg-bg-tertiary transition-colors",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("svg",{className:`w-4 h-4 text-text-muted transition-transform ${r?"rotate-90":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),o.jsx("span",{className:"font-medium text-text-primary",children:e}),s&&o.jsx("span",{className:"text-xs text-text-muted bg-bg-tertiary px-1.5 py-0.5 rounded",children:s})]})}),r&&o.jsx("div",{className:"p-3 border-t border-border",children:c})]})}function oT({content:e,promptContext:r,align:i="right"}){const[s,c]=P.useState(!1),[u,f]=P.useState(!1),[l,d]=P.useState(!1),p=P.useRef(null);P.useEffect(()=>{const y=_=>{p.current&&!p.current.contains(_.target)&&c(!1)};return s&&document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[s]);const g=async()=>{try{if(navigator.clipboard)await navigator.clipboard.writeText(e);else{const y=document.createElement("textarea");y.value=e,y.style.position="fixed",y.style.left="-999999px",document.body.appendChild(y),y.select(),document.execCommand("copy"),document.body.removeChild(y)}d(!0),c(!1),window.setTimeout(()=>d(!1),1500)}catch(y){console.error("Failed to copy:",y)}},m=i==="right";return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:`flex items-start gap-1.5 ${m?"":"order-first"}`,children:[l&&o.jsx("svg",{className:"w-4 h-4 text-accent-success",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),o.jsxs("div",{ref:p,className:"relative",children:[o.jsx("button",{onClick:()=>c(!s),className:"p-1 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary",title:"Message options",children:o.jsxs("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24",children:[o.jsx("circle",{cx:"12",cy:"5",r:"2"}),o.jsx("circle",{cx:"12",cy:"12",r:"2"}),o.jsx("circle",{cx:"12",cy:"19",r:"2"})]})}),s&&o.jsxs("div",{className:`absolute top-full mt-1 bg-bg-secondary border border-border rounded shadow-xl z-50 py-1 min-w-36 ${m?"right-0":"left-0"}`,children:[o.jsxs("button",{onClick:g,className:"w-full px-3 py-1.5 text-left text-sm text-text-primary hover:bg-bg-tertiary flex items-center gap-2",children:[o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})}),"Copy"]}),r&&o.jsxs("button",{onClick:()=>{f(!0),c(!1)},className:"w-full px-3 py-1.5 text-left text-sm text-text-primary hover:bg-bg-tertiary flex items-center gap-2",children:[o.jsxs("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]}),"Inspect"]})]})]})]}),r&&o.jsx(sT,{isOpen:u,onClose:()=>f(!1),promptContext:r})]})}function lT({message:e}){const[r,i]=P.useState(!1);if(e.messageKind!=="auto-prompt")return null;const s=e.metadata,c=(s==null?void 0:s.color)??"#6b7280",u=(s==null?void 0:s.name)??"Agent",f=(s==null?void 0:s.type)??"agent",d={agent:"definition injected",workflow:"instructions",compaction:"prompt injected",subagent:"instructions"}[f]??"injected",p=f==="workflow"||f==="subagent";return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex items-center justify-center gap-1.5 text-[10px] text-text-muted font-mono mt-3 mb-4",children:[o.jsx("span",{className:"flex-1 h-px bg-border"}),o.jsx("span",{className:`w-1.5 h-1.5 rounded-full flex-shrink-0 ${p?"":"cursor-pointer"}`,style:{backgroundColor:c},onClick:()=>!p&&i(!0)}),o.jsx("span",{className:p?"":"cursor-pointer hover:text-text-secondary transition-colors",style:{color:c},onClick:()=>!p&&i(!0),children:u}),o.jsx("span",{children:"·"}),o.jsx("span",{className:p?"":"cursor-pointer hover:text-text-secondary transition-colors",onClick:()=>!p&&i(!0),children:d}),o.jsx("span",{className:"flex-1 h-px bg-border"})]}),p&&o.jsx("div",{className:"flex justify-center feed-item mb-4",children:o.jsx("div",{className:"max-w-[75%] rounded p-3 bg-bg-tertiary/50 text-text-secondary text-sm",style:{borderLeft:`3px solid ${c}`},children:o.jsx("pre",{className:"whitespace-pre-wrap font-mono text-xs",children:e.content})})}),o.jsx(ln,{isOpen:r,onClose:()=>i(!1),title:`${u} Prompt`,size:"lg",children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"w-3 h-3 rounded-full",style:{backgroundColor:c}}),o.jsx("span",{className:"text-sm text-text-primary font-medium",children:u}),o.jsxs("span",{className:"text-xs text-text-muted",children:["(",f,")"]})]}),o.jsx("div",{className:"h-full min-h-96",children:o.jsx("pre",{className:"text-sm text-text-secondary whitespace-pre-wrap bg-bg-tertiary rounded p-4 h-full min-h-96 overflow-auto font-mono",children:e.content})})]})})]})}function cT({message:e,promptContext:r}){const i=e.messageKind==="auto-prompt",s=e.messageKind==="command",c=e.isSystemGenerated;return o.jsxs("div",{className:"flex justify-end items-start gap-1.5 feed-item",children:[!c&&o.jsx(oT,{content:e.content,promptContext:r,align:"right"}),o.jsxs("div",{className:`max-w-[75%] rounded p-2 ${c?s?"bg-teal-500/10 border border-teal-500/30":i?"bg-slate-500/10 border border-slate-500/30":"bg-amber-500/10 border border-amber-500/30":"bg-accent-primary/15 text-white"}`,children:[c&&o.jsx("span",{className:`text-[10px] block mb-0.5 ${s?"text-teal-400":i?"text-slate-400":"text-amber-400"}`,children:s?"Command":i?"Auto":"System"}),o.jsx("div",{className:`whitespace-pre-wrap text-sm ${c?`${s?"text-teal-200":i?"text-slate-200":"text-amber-200 italic"}`:""}`,children:e.content}),e.attachments&&e.attachments.length>0&&o.jsx(iT,{attachments:e.attachments,messageId:e.id})]})]})}const n0=P.memo(function({message:r,isLastAssistantMessage:i=!1,promptContext:s}){const c=r.role==="user",u=r.role==="assistant",f=r.role==="system",l=r.role==="tool";if(u)return o.jsx(af,{message:r,showStats:i});if(f&&r.isCompacted)return o.jsxs("div",{className:"feed-item bg-bg-tertiary/50 border border-border rounded p-2",children:[o.jsx("div",{className:"text-text-muted text-xs mb-0.5",children:"[Compacted]"}),o.jsx("div",{className:"text-text-secondary text-xs whitespace-pre-wrap",children:r.content.replace(`[COMPACTED HISTORY]
|
|
137
|
+
`,"")})]});if(l)return o.jsxs("div",{className:"feed-item bg-bg-tertiary/30 border-l-2 border-accent-primary rounded-r p-2",children:[o.jsxs("div",{className:"text-accent-primary text-xs mb-0.5",children:["Tool: ",r.toolName]}),o.jsxs("pre",{className:"text-text-secondary text-xs whitespace-pre-wrap overflow-x-auto max-h-32",children:[r.content.slice(0,500),r.content.length>500&&"..."]})]});if(r.messageKind==="workflow-started")try{const d=JSON.parse(r.content);return o.jsx(rT,{data:d})}catch{}if(r.messageKind==="task-completed")try{const d=JSON.parse(r.content);return o.jsx(nT,{data:d})}catch{}return r.messageKind==="context-reset"?o.jsxs("div",{className:"flex items-center gap-4 mb-6 text-text-muted text-xs uppercase tracking-wide",children:[o.jsx("div",{className:"flex-1 border-t border-border"}),o.jsx("span",{children:r.content}),o.jsx("div",{className:"flex-1 border-t border-border"})]}):r.messageKind==="auto-prompt"&&r.isSystemGenerated?o.jsx(lT,{message:r}):c?o.jsx(cT,{message:r,promptContext:s}):o.jsx("div",{className:"flex justify-start feed-item",children:o.jsx("div",{className:"max-w-[75%] rounded p-2 bg-bg-tertiary text-text-primary",children:o.jsx(zi,{content:r.content})})})}),r0=(e,r)=>{const i=P.useRef(!0),[s,c]=P.useState(!0),u=()=>{const f=e.current;f&&(f.scrollTop=f.scrollHeight)};return P.useEffect(()=>{const f=e.current;if(!f)return;const l=g=>{if(g.deltaY>0){requestAnimationFrame(()=>requestAnimationFrame(()=>{f.scrollHeight-f.scrollTop-f.offsetHeight<100&&(i.current=!0,c(!0))}));return}i.current=!1,c(!1)},d=new MutationObserver(()=>{i.current&&requestAnimationFrame(u)}),p=setInterval(()=>{i.current&&u()},1e3);return f.addEventListener("wheel",l,{passive:!0}),d.observe(f,{childList:!0,subtree:!0,characterData:!0}),()=>{f.removeEventListener("wheel",l),d.disconnect(),clearInterval(p)}},[r==null?void 0:r.id]),{force_scroll_to_bottom:()=>{i.current=!0,c(!0),u()},isAutoScrollActive:s,setAutoScroll:f=>{i.current=f,c(f),f&&u()}}},uT={verifier:"Verification",code_reviewer:"Code Review",test_generator:"Test Generation",debugger:"Debug"};function dT(e){return{backgroundColor:`${e}20`,color:e,borderColor:`${e}4d`}}function hT(e,r){return r||e>85?"text-accent-error":e>60?"text-accent-warning":"text-text-muted"}function fT({contextState:e}){const{currentTokens:r,maxTokens:i,compactionCount:s,dangerZone:c}=e,u=Math.round(r/i*100);return o.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",children:[o.jsxs("span",{className:hT(u,c),children:[Ll(r),"/",Ll(i)]}),o.jsx(Rb,{percent:u,dangerZone:c,size:"sm"}),c&&o.jsx("span",{className:"text-accent-error animate-pulse",children:"Low!"}),s>0&&o.jsxs("span",{className:"text-text-muted bg-bg-tertiary px-1 rounded",children:[s,"x"]})]})}const pT=P.memo(function({messages:r,subAgentType:i,subAgentId:s,isStreaming:c}){const u=P.useRef(null),f=P.useRef(null),[l,d]=P.useState(!1),p=Wt(A=>A.defaults),g=Wt(A=>A.userItems),m=[...p,...g],y=Ee(A=>A.subAgentContextStates[s]),{isAutoScrollActive:_,setAutoScroll:k}=r0(f,null);P.useEffect(()=>{c||k(!0)},[c]);const C=P.useCallback(()=>{const A=!l;d(A),A&&setTimeout(()=>{var N;(N=u.current)==null||N.scrollIntoView({block:"start",behavior:"smooth"})},220)},[l]),v=m.find(A=>A.id===i),b=(v==null?void 0:v.name)??uT[i]??i,x=zl(m,i),S=dT(x),j=r.filter(A=>A.role!=="tool");return o.jsxs("div",{ref:u,className:"feed-item border border-border rounded overflow-hidden bg-bg-secondary",children:[o.jsxs("div",{className:"w-full flex items-center justify-between px-2 py-1 border-b",style:S,children:[o.jsx("span",{className:"text-xs font-medium",children:b}),o.jsxs("div",{className:"flex items-center gap-2",children:[y&&o.jsx(fT,{contextState:y}),o.jsxs("button",{type:"button",className:"text-sm text-text-muted hover:text-text-primary flex items-center gap-1.5",onClick:()=>k(!_),children:[o.jsx("span",{className:`w-1 h-1 rounded-full ${_?"bg-accent-success":"border border-text-muted"}`}),"live"]}),o.jsxs("button",{type:"button",className:"text-[10px] px-1.5 py-0.5 rounded bg-bg-tertiary",onClick:C,children:[l?"▼":"▶"," Expand"]})]})]}),o.jsx("div",{ref:f,className:`${l?"max-h-[calc(100vh-10rem)]":"max-h-80"} overflow-y-auto p-2 transition-[max-height] duration-200`,children:j.map(A=>A.role==="assistant"?o.jsx(af,{message:A,showStats:!0},A.id):o.jsx(n0,{message:A,isLastAssistantMessage:!1},A.id))})]})});function mT(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_|_$/g,"")}function gT({agent:e,isBuiltIn:r,isConfirmingDelete:i,onView:s,onEdit:c,onDuplicate:u,onDelete:f}){return o.jsxs(yb,{isBuiltIn:r,isConfirmingDelete:i,onView:s,onEdit:c,onDuplicate:u,onDelete:f,children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{backgroundColor:e.color??"#6b7280"}}),o.jsx("span",{className:"text-text-primary text-sm font-medium",children:e.name}),o.jsx("span",{className:"text-text-muted text-xs font-mono",children:e.id}),r&&o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-bg-primary text-text-muted",children:"Built-in"})]}),e.description&&o.jsx("p",{className:"text-text-secondary text-xs mt-0.5 truncate",children:e.description}),o.jsxs("div",{className:"flex flex-wrap gap-1 mt-1",children:[e.allowedTools.slice(0,5).map(l=>o.jsx("span",{className:"text-[10px] font-mono text-text-muted bg-bg-primary px-1 py-0.5 rounded",children:l},l)),e.allowedTools.length>5&&o.jsxs("span",{className:"text-[10px] text-text-muted",children:["+",e.allowedTools.length-5," more"]})]})]})}function Kv({title:e,agents:r,subagents:i,isBuiltIn:s,onView:c,onDuplicate:u,onEdit:f,onDelete:l}){if(r.length===0&&i.length===0)return null;const d=p=>o.jsx(gT,{agent:p,isBuiltIn:s,isConfirmingDelete:!1,onView:()=>c(p.id),onEdit:s?void 0:()=>f==null?void 0:f(p.id),onDuplicate:()=>u(p.id),onDelete:s?void 0:()=>l==null?void 0:l(p.id)},p.id);return o.jsxs("div",{children:[o.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:e}),o.jsxs("div",{className:"space-y-2",children:[r.map(d),i.length>0&&o.jsxs("div",{className:"mt-3",children:[o.jsx("div",{className:"text-xs text-text-muted uppercase tracking-wider mb-1.5",children:"Sub-agents"}),o.jsx("div",{className:"space-y-2",children:i.map(d)})]})]})]})}function xT({isOpen:e,onClose:r,initialEditId:i}){const s=Wt(pe=>pe.defaults),c=Wt(pe=>pe.userItems),u=Wt(pe=>pe.loading),f=Wt(pe=>pe.fetchAgents),l=Wt(pe=>pe.fetchAgent),d=Wt(pe=>pe.fetchDefaultContent),p=Wt(pe=>pe.createAgent),g=Wt(pe=>pe.updateAgent),m=Wt(pe=>pe.deleteAgent),[y,_]=P.useState("list"),[k,C]=P.useState(null),[v,b]=P.useState(!1),[x,S]=P.useState(""),[j,A]=P.useState(""),[N,D]=P.useState(""),[T,I]=P.useState(!0),[H,V]=P.useState([]),[Y,q]=P.useState("#6b7280"),[O,U]=P.useState(""),[z,X]=P.useState(""),[Q,M]=P.useState(!1),[L,B]=P.useState([]);function W(pe){const Ne=new Map;for(const Oe of pe){const lt=Oe.indexOf(":");if(lt===-1)Ne.set(Oe,new Set);else{const ue=Oe.slice(0,lt),Te=Oe.slice(lt+1).split(",").filter(Boolean);Ne.set(ue,new Set(Te))}}return Ne}function F(pe){const Ne=[];for(const[Oe,lt]of pe)lt.size===0?Ne.push(Oe):Ne.push(`${Oe}:${[...lt].join(",")}`);return Ne}const re=W(H),Z=(pe,Ne)=>{const Oe=new Map(re),lt=Oe.get(pe)||new Set,ue=new Set(lt);ue.has(Ne)?ue.delete(Ne):ue.add(Ne),ue.size===0?Oe.set(pe,new Set):Oe.set(pe,ue),V(F(Oe))},ee=pe=>{const Ne=new Map(re);Ne.has(pe)?Ne.delete(pe):Ne.set(pe,new Set),V(F(Ne))},K=pe=>{S(pe.metadata.name),A(pe.metadata.id),D(pe.metadata.description),I(pe.metadata.subagent),V(pe.metadata.allowedTools),q(pe.metadata.color??"#6b7280"),U(pe.prompt),X("")},$=(pe,Ne,Oe)=>{S(pe.metadata.name+" (copy)"),A(`${Ne}-copy-${Date.now()}`),D(pe.metadata.description),I(pe.metadata.subagent),V(pe.metadata.allowedTools),q(pe.metadata.color??"#6b7280"),U(pe.prompt),X(""),C(null),b(!1),_("edit")},ae=(pe,Ne)=>{K(pe),C(Ne),b(!0),_("edit")};P.useEffect(()=>{e&&(f(),Ce("/api/tools").then(pe=>pe.json()).then(pe=>B(pe.tools||[])).catch(()=>B([])),i?s.some(Ne=>Ne.id===i)?d(i).then(Ne=>{Ne&&$(Ne,i)}):l(i).then(Ne=>{Ne&&(K(Ne),C(i),b(!1),_("edit"))}):(_("list"),C(null),b(!1)))},[e,f,l,d,i]);const ne=async pe=>{if(s.some(Oe=>Oe.id===pe)){const Oe=await d(pe);if(!Oe)return;ae(Oe,pe)}else{const Oe=await l(pe);if(!Oe)return;ae(Oe,pe)}},ve=async pe=>{const Ne=await d(pe);Ne&&$(Ne,pe)},be=()=>{C(null),S(""),A(""),D(""),I(!0),V(["read_file"]),q("#6b7280"),U(""),X(""),b(!1),_("edit")},Ae=async pe=>{const Ne=await l(pe);Ne&&(K(Ne),C(pe),b(!1),_("edit"))},Me=async pe=>{await m(pe)},Ie=async()=>{const pe=k??j;if(!pe||!x||!O){X("Name and prompt are required.");return}M(!0),X("");const Ne={metadata:{id:pe,name:x,description:N,subagent:T,allowedTools:H,color:Y},prompt:O},Oe=k?await g(k,Ne):await p(Ne);if(M(!1),!Oe.success){X(Oe.error??"Failed to save agent.");return}i?r():_("list")},Fe=()=>{i?r():(_("list"),b(!1))},ke=pe=>{S(pe),k||A(mT(pe))},ge=s.filter(pe=>pe.subagent),je=s.filter(pe=>!pe.subagent),We=c.filter(pe=>pe.subagent),Lt=c.filter(pe=>!pe.subagent);return y==="edit"?o.jsx(ln,{isOpen:e,onClose:Fe,title:v?`${x}`:k?"Edit Agent":"New Agent",size:"xl",children:o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"space-y-3",children:[z&&o.jsx(kh,{message:z}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(Ai,{label:"Name",value:x,onChange:ke,placeholder:"My Agent",readOnly:v}),o.jsx(Ai,{label:"ID",value:j,onChange:A,readOnly:!0,placeholder:"my_agent",hint:"(read-only)",mono:!0})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(Ai,{label:"Description",value:N,onChange:D,placeholder:"What this agent does",readOnly:v}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Type"}),o.jsxs("div",{className:"flex items-center gap-3 h-[34px]",children:[o.jsx("button",{onClick:()=>!v&&I(!0),className:`px-2.5 py-1 rounded text-xs font-medium transition-colors ${T?"bg-accent-primary/25 text-accent-primary":"bg-bg-tertiary text-text-muted hover:text-text-secondary"} ${v?"pointer-events-none opacity-60":""}`,children:"Sub-agent"}),o.jsx("button",{onClick:()=>!v&&I(!1),className:`px-2.5 py-1 rounded text-xs font-medium transition-colors ${T?"bg-bg-tertiary text-text-muted hover:text-text-secondary":"bg-accent-primary/25 text-accent-primary"} ${v?"pointer-events-none opacity-60":""}`,children:"Top-level"}),o.jsxs("div",{className:"flex items-center gap-1.5 ml-auto",children:[o.jsx("label",{className:"text-xs text-text-secondary",children:"Color"}),o.jsx("input",{type:"color",value:Y,onChange:pe=>!v&&q(pe.target.value),disabled:v,className:"w-6 h-6 rounded cursor-pointer border border-border bg-transparent"})]})]})]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Tools"}),o.jsx("div",{className:"flex flex-wrap gap-1.5 p-2 bg-bg-tertiary border border-border rounded max-h-32 overflow-y-auto",children:L.map(pe=>{const Ne=re.has(pe.name),Oe=pe.actions.length>0,lt=re.get(pe.name)||new Set,ue=o.jsxs("button",{className:`px-1.5 py-0.5 rounded text-xs font-mono transition-colors flex items-center gap-1 ${Ne?"bg-accent-primary/25 text-accent-primary":"bg-bg-primary text-text-muted"}`,children:[o.jsx("span",{children:pe.name}),Oe&&o.jsx("span",{className:`text-[10px] ${Ne&<.size>0?"text-accent-primary":"text-text-muted"}`,children:"*"})]},pe.name);return Oe?v?o.jsxs("button",{className:"px-1.5 py-0.5 rounded text-xs font-mono flex items-center gap-1 bg-bg-primary text-text-muted pointer-events-none opacity-60",children:[o.jsx("span",{children:pe.name}),o.jsx("span",{className:"text-[10px]",children:"*"})]},pe.name):o.jsx(eo,{trigger:ue,minWidth:"160px",items:[...pe.actions.map(_e=>({label:o.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",htmlFor:`${pe.name}-${_e}`,children:[o.jsx("input",{type:"checkbox",id:`${pe.name}-${_e}`,checked:lt.has(_e),onChange:()=>Z(pe.name,_e),disabled:v,className:"w-3 h-3 rounded accent-accent-primary"}),o.jsx("span",{children:_e})]}),closeOnClick:!1})),{label:Ne?"Deselect all":"Select all",closeOnClick:!1,onClick:()=>{if(Ne)ee(pe.name);else{const _e=new Map(re);_e.set(pe.name,new Set(pe.actions)),V(F(_e))}}}]},pe.name):o.jsx("button",{onClick:()=>!v&&ee(pe.name),className:`px-1.5 py-0.5 rounded text-xs font-mono transition-colors flex items-center gap-1 ${Ne?"bg-accent-primary/25 text-accent-primary":"bg-bg-primary text-text-muted hover:text-text-secondary"} ${v?"pointer-events-none":"cursor-pointer"}`,children:o.jsx("span",{children:pe.name})},pe.name)})})]})]}),o.jsxs("div",{className:"flex-1 min-h-[150px] border-t border-border pt-3 flex flex-col",children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Prompt"}),o.jsx("textarea",{value:O,onChange:pe=>!v&&U(pe.target.value),readOnly:v,placeholder:"Instructions for this agent...",className:`flex-1 w-full px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-none focus:outline-none focus:ring-1 focus:ring-accent-primary ${v?"opacity-60":""}`})]}),o.jsx(FS,{onCancel:Fe,onSave:Ie,saving:Q,saveDisabled:!x||!O||v}),v&&o.jsx("div",{className:"flex justify-end mt-2",children:o.jsx(st,{variant:"primary",onClick:()=>{S(x+" (copy)"),A(`${k}-copy-${Date.now()}`),C(null),b(!1)},children:"Duplicate & Customize"})})]})}):o.jsxs(ln,{isOpen:e,onClose:r,title:"Agents",size:"lg",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsx("p",{className:"text-text-secondary text-sm",children:"Agents define behavior, tools, and prompts for top-level modes and sub-agents."}),o.jsx("div",{className:"flex items-center gap-2 flex-shrink-0 ml-3",children:o.jsx(st,{variant:"primary",size:"sm",onClick:be,children:"+ New"})})]}),u&&s.length===0&&c.length===0?o.jsx("div",{className:"text-text-muted text-sm",children:"Loading agents..."}):s.length===0&&c.length===0?o.jsx("div",{className:"text-text-muted text-sm",children:"No agents defined."}):o.jsxs("div",{className:"space-y-4",children:[s.length>0&&o.jsx(Kv,{title:"Built-in",agents:je,subagents:ge,isBuiltIn:!0,onView:ne,onDuplicate:ve}),c.length>0&&o.jsx(Kv,{title:"Custom",agents:Lt,subagents:We,isBuiltIn:!1,onView:ne,onDuplicate:ve,onEdit:Ae,onDelete:Me})]})]})}function vT(){const e=Ee(b=>{var x;return(x=b.currentSession)==null?void 0:x.mode}),r=Ee(b=>b.switchMode),i=Wt(b=>b.defaults),s=Wt(b=>b.userItems),c=Wt(b=>b.fetchAgents),u=[...i,...s],[f,l]=P.useState(!1),[d,p]=P.useState(!1),[g,m]=P.useState(null),y=P.useRef(null);if(P.useEffect(()=>{c()},[c]),P.useEffect(()=>{function b(x){y.current&&!y.current.contains(x.target)&&l(!1)}return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[]),!e)return null;const _=u.filter(b=>!b.subagent),k=_.find(b=>b.id===e),C=(k==null?void 0:k.name)??e,v=zl(u,e);return o.jsxs("div",{className:"relative",ref:y,children:[o.jsxs("button",{type:"button",onClick:()=>l(!f),className:"flex items-center gap-1 px-1.5 py-0.5 rounded hover:bg-bg-tertiary transition-colors",title:"Switch agent",children:[o.jsx("span",{className:"text-sm font-medium",style:{color:v},children:C}),o.jsx("svg",{className:`w-3 h-3 text-text-muted transition-transform ${f?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),f&&_.length>0&&o.jsxs("div",{className:"absolute bottom-full left-0 mb-1 w-56 bg-bg-secondary border border-border rounded-lg shadow-lg overflow-hidden z-50",children:[_.map(b=>{const x=b.id===e,S=zl(u,b.id);return o.jsxs("div",{className:`flex items-center gap-2 px-3 py-2 text-sm transition-colors group ${x?"bg-bg-tertiary":"hover:bg-bg-tertiary cursor-pointer"}`,children:[o.jsxs("button",{type:"button",onClick:()=>{x||r(b.id),l(!1)},className:"flex-1 text-left flex items-center gap-2",children:[o.jsx("span",{className:"font-medium",style:{color:S},children:b.name}),x&&o.jsx("svg",{className:"w-3.5 h-3.5 text-text-muted ml-auto",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})]}),o.jsx(Mi,{className:"opacity-0 group-hover:opacity-100",onClick:j=>{j.stopPropagation(),l(!1),m(b.id),p(!0)}})]},b.id)}),o.jsx("div",{className:"border-t border-border p-1",children:o.jsx("button",{type:"button",onClick:()=>{l(!1),p(!0)},className:"w-full text-left px-3 py-1.5 rounded text-sm text-text-muted hover:text-text-primary hover:bg-bg-tertiary transition-colors",children:"Manage Agents..."})})]}),o.jsx(xT,{isOpen:d,onClose:()=>{p(!1),m(null)},initialEditId:g})]})}function bT(){const e=Ee(s=>s.currentSession),r=Ee(s=>s.switchDangerLevel);if(!e)return null;const i=e.dangerLevel??"normal";return o.jsxs("div",{className:"flex items-center gap-1 px-1.5 py-0.5 rounded bg-bg-tertiary/50",children:[o.jsx("button",{type:"button",onClick:()=>r("normal"),className:`px-2 py-0.5 text-xs font-medium rounded transition-colors ${i==="normal"?"bg-accent-success/20 text-accent-success":"text-text-muted hover:text-text-primary hover:bg-bg-tertiary"}`,title:"Normal mode - requires path confirmation",children:"Normal"}),o.jsx("button",{type:"button",onClick:()=>r("dangerous"),className:`px-2 py-0.5 text-xs font-medium rounded transition-colors ${i==="dangerous"?"bg-red-500/20 text-red-400":"text-text-muted hover:text-text-primary hover:bg-bg-tertiary"}`,title:"Dangerous mode - bypasses all confirmations",children:"Dangerous"})]})}function yT({question:e}){const r=Ee(p=>p.answerQuestion),i=P.useRef(null),s=P.useRef(null),[c,u]=P.useState(""),f=P.useCallback(p=>{p.key},[]);P.useEffect(()=>{var p;return s.current=document.activeElement,(p=i.current)==null||p.focus(),document.body.style.overflow="hidden",()=>{var g;(g=s.current)==null||g.focus(),document.body.style.overflow=""}},[]),P.useEffect(()=>(document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)),[f]);const l=()=>{r(e.callId,c)},d=p=>{p.key==="Enter"&&!p.shiftKey&&(p.preventDefault(),l())};return ql.createPortal(o.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[o.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm"}),o.jsxs("div",{ref:i,tabIndex:-1,className:"relative w-full max-w-[90vw] md:max-w-md bg-bg-secondary border border-border rounded shadow-xl flex flex-col max-h-[90vh]",children:[o.jsx("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border flex-shrink-0",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("svg",{className:"w-5 h-5 text-text-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.592.115-1.207.532-1.207 1.093 0 .56.41.978 1.002 1.093 1.728.332 3.006 1.507 3.006 2.907 0 1.657-1.79 3-4 3-1.742 0-3.223-.835-3.772-2m-3.772 2v-2m1.772-12h1.594l1.414 1.414M3 12h.01M21 12h.01M12 3v2m0 14v2M3 6h.01M21 6h.01M3 18h.01M21 18h.01"})}),o.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:"Question from Agent"})]})}),o.jsxs("div",{className:"p-4 overflow-y-auto flex-1 min-h-0 space-y-4",children:[o.jsx("p",{className:"text-sm text-text-primary",children:e.question}),o.jsx("textarea",{value:c,onChange:p=>u(p.target.value),onKeyDown:d,placeholder:"Type your answer here...",className:"w-full min-h-[120px] px-3 py-2 bg-bg-tertiary border border-border rounded text-sm text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-accent-primary/50 resize-y",autoFocus:!0})]}),o.jsxs("div",{className:"px-4 py-3 border-t border-border flex justify-end gap-2 flex-shrink-0",children:[o.jsx(st,{variant:"secondary",size:"sm",onClick:()=>r(e.callId,""),children:"Skip"}),o.jsx(st,{variant:"primary",size:"sm",onClick:l,children:"Send Answer"})]})]})]}),document.body)}function _T(){const e=Ee(s=>s.connectionStatus),r=Ee(s=>s.reconnect);if(e==="connected")return null;const i=e==="reconnecting";return o.jsxs("div",{className:`
|
|
138
|
+
flex items-center justify-between px-4 py-2
|
|
139
|
+
text-sm font-medium
|
|
140
|
+
${i?"bg-amber-500/15 border-b border-amber-500/30 text-amber-300":"bg-red-500/15 border-b border-red-500/30 text-red-300"}
|
|
141
|
+
`,children:[o.jsx("div",{className:"flex items-center gap-2",children:i?o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"flex gap-1",children:[o.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse"}),o.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse",style:{animationDelay:"150ms"}}),o.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse",style:{animationDelay:"300ms"}})]}),o.jsx("span",{children:"Reconnecting to server..."})]}):o.jsxs(o.Fragment,{children:[o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),o.jsx("span",{children:"Connection lost"})]})}),o.jsx("button",{onClick:()=>r(),disabled:i,className:`
|
|
142
|
+
px-3 py-1 rounded text-xs font-medium
|
|
143
|
+
transition-colors
|
|
144
|
+
${i?"bg-amber-500/20 text-amber-400 cursor-not-allowed opacity-50":"bg-red-500/20 text-red-300 hover:bg-red-500/30 hover:text-red-200"}
|
|
145
|
+
`,children:i?"Reconnecting...":"Reconnect"})]})}function ST(){const e=OS(),r=e?"bg-amber-400":"bg-accent-primary";return o.jsxs("div",{className:"flex items-center gap-3 text-xs text-text-muted py-2",children:[o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsxs("span",{className:"flex gap-0.5",children:[o.jsx("span",{className:`w-1 h-1 rounded-full animate-bounce ${r}`,style:{animationDelay:"0ms"}}),o.jsx("span",{className:`w-1 h-1 rounded-full animate-bounce ${r}`,style:{animationDelay:"150ms"}}),o.jsx("span",{className:`w-1 h-1 rounded-full animate-bounce ${r}`,style:{animationDelay:"300ms"}})]}),o.jsx("span",{className:"text-text-secondary",children:e?"Running... (abort in progress)":"Running"})]}),!e&&o.jsx("span",{className:"text-text-muted",children:"esc to interrupt"})]})}function wT({attachment:e,onRemove:r}){const i=s=>s<1024?`${s} B`:s<1048576?`${(s/1024).toFixed(1)} KB`:`${(s/1048576).toFixed(1)} MB`;return o.jsxs("div",{className:"relative inline-flex flex-col items-center p-2 bg-bg-tertiary rounded-lg border border-border",children:[o.jsx(Rs,{onClick:()=>r(e.id),className:"absolute -top-2 -right-2",size:"sm",variant:"overlay","aria-label":`Remove ${e.filename}`}),o.jsx("img",{src:e.data,alt:e.filename,className:"w-16 h-16 object-cover rounded-md bg-bg-secondary"}),o.jsx("div",{className:"mt-1 text-xs text-text-muted text-center max-w-16 truncate",title:e.filename,children:e.filename}),o.jsx("div",{className:"text-[10px] text-text-muted",children:i(e.size)})]})}function CT({history:e,selectedIndex:r,onSelect:i,onEscape:s,onNavigate:c}){const u=P.useRef(null),f=P.useRef(null);P.useEffect(()=>{f.current&&u.current&&f.current.scrollIntoView({block:"nearest",behavior:"smooth"})},[r]);const l=p=>{switch(p.key){case"Enter":p.preventDefault(),e[r]&&i(e[r].content);break;case"Escape":p.preventDefault(),s();break;case"ArrowUp":p.preventDefault(),c("up");break;case"ArrowDown":p.preventDefault(),c("down");break}},d=p=>{i(p)};return o.jsx("div",{ref:u,role:"list",className:"mb-2 p-2 bg-bg-secondary border border-border rounded-lg overflow-y-auto max-h-64",onKeyDown:l,children:e.map((p,g)=>o.jsxs("div",{ref:g===r?f:null,role:"listitem",onClick:()=>d(p.content),className:`
|
|
146
|
+
p-2 rounded cursor-pointer transition-colors
|
|
147
|
+
${g===r?"bg-accent-primary/20 border border-accent-primary":"hover:bg-bg-tertiary"}
|
|
148
|
+
`,children:[o.jsxs("div",{className:"text-xs text-text-muted font-mono",children:[p.formattedTimestamp,p.sessionName&&o.jsxs(o.Fragment,{children:[" | ",o.jsx("span",{className:"text-accent-primary font-medium",children:p.sessionName})]})]}),o.jsx("div",{className:"text-sm text-text-primary mt-1",children:p.trimmedContent})]},p.id))})}const kT={maxWidth:1920,maxHeight:1920,quality:.85,maxSizeBytes:1048576};async function ET(e,r={}){const i={...kT,...r};if(!e.type.startsWith("image/"))throw new Error("File is not an image");if(!["image/png","image/jpeg","image/gif"].includes(e.type))throw new Error(`Unsupported image format: ${e.type}. Only PNG, JPG, and GIF are supported.`);if(e.size<=i.maxSizeBytes){const c=await e.arrayBuffer(),u=RT(c),f=`data:${e.type};base64,${u}`,l=await i0(f);return{dataUrl:f,mimeType:e.type,size:e.size,width:l.width,height:l.height}}return await jT(e,i)}async function jT(e,r){const i=await TT(e),s=await i0(i),{width:c,height:u}=NT(s.width,s.height,r.maxWidth,r.maxHeight),f=AT();f.width=c,f.height=u;const l=f.getContext("2d");if(!l)throw new Error("Failed to get canvas context");l.imageSmoothingEnabled=!0,l.imageSmoothingQuality="high",l.drawImage(s,0,0,c,u);let d=r.quality,p;do{if(p=f.toDataURL(e.type.startsWith("image/gif")?"image/png":e.type,d),Xv(p)<=r.maxSizeBytes||d<=.3)break;d-=.1}while(!0);const g=Xv(p);return{dataUrl:p,mimeType:e.type.startsWith("image/gif")?"image/png":e.type,size:g,width:c,height:u}}function NT(e,r,i,s){const c=e/r;return e>r&&e>i?{width:i,height:Math.round(i/c)}:r>e&&r>s?{width:Math.round(s*c),height:s}:{width:e,height:r}}function TT(e){return new Promise((r,i)=>{const s=LT(),c=new s;c.onload=()=>r(c.result),c.onerror=()=>i(new Error("Failed to read file")),c.readAsDataURL(e)})}function i0(e){return new Promise((r,i)=>{const s=DT(),c=new s;c.onload=()=>r(c),c.onerror=()=>i(new Error("Failed to load image")),c.src=e})}function AT(){var r;const e=of();if(!((r=e.document)!=null&&r.createElement))throw new Error("Image compression requires browser canvas APIs");return e.document.createElement("canvas")}function DT(){const e=of();if(!e.Image)throw new Error("Image compression requires browser image APIs");return e.Image}function LT(){const e=of();if(!e.FileReader)throw new Error("Image compression requires browser file APIs");return e.FileReader}function of(){return globalThis}function RT(e){const r=new Uint8Array(e);let i="";for(let s=0;s<r.byteLength;s++){const c=r[s];c!==void 0&&(i+=String.fromCharCode(c))}return btoa(i)}function Xv(e){const i=e.split(",")[1];return i?Math.round(i.length*3/4):0}function MT(e){return["image/png","image/jpeg","image/gif"].includes(e.type)}function OT(e,r=50*1024*1024){return e.size>r?{valid:!1,error:`Image file is too large (${Zv(e.size)}). Maximum size is ${Zv(r)}.`}:{valid:!0}}function Zv(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}async function Xd(e,r,i,s={}){const{maxSizeBytes:c=50*1024*1024,filename:u}=s;if(!MT(e)){i(`Unsupported file type: ${e.type}. Only PNG, JPG, and GIF are supported.`);return}const f=OT(e,c);if(!f.valid){i(f.error??"Image file is too large");return}try{const l=await ET(e,{maxWidth:1920,maxHeight:1920,quality:.85,maxSizeBytes:1048576}),d={id:hb(),filename:u??e.name,mimeType:l.mimeType,size:l.size,data:l.dataUrl};r(d)}catch(l){const d=l instanceof Error?l.message??"Failed to process image":"Failed to process image";i(d)}}function BT(e){const r={};let i=null;for(const s of e){if(s.role==="user"&&!s.isSystemGenerated){i=s.id;continue}s.role==="assistant"&&s.promptContext&&i&&r[i]===void 0&&(r[i]=s.promptContext)}return r}function IT({isOpen:e,onClose:r,providerId:i,model:s}){const[c,u]=P.useState(s.contextWindow),[f,l]=P.useState(!1),d=kt(m=>m.updateModelContext);if(P.useEffect(()=>{u(s.contextWindow)},[s]),!e)return null;const p=async()=>{c<1024||c>1e7||(l(!0),await d(i,s.id,c),l(!1),r())},g=()=>{u(s.contextWindow),r()};return o.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:o.jsxs("div",{className:"bg-bg-secondary rounded-lg shadow-xl max-w-md w-full mx-4 border border-border",children:[o.jsx("div",{className:"px-6 py-4 border-b border-border",children:o.jsx("h3",{className:"text-lg font-medium text-text-primary",children:"Model Properties"})}),o.jsxs("div",{className:"px-6 py-4 space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-text-secondary mb-1",children:"Model Name"}),o.jsx("p",{className:"text-text-primary bg-bg-tertiary px-3 py-2 rounded",children:s.id})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-text-secondary mb-1",children:"Context Window"}),o.jsx("input",{type:"number",min:1024,max:1e7,value:c,onChange:m=>u(parseInt(m.target.value)||0),className:"w-full bg-bg-tertiary border border-border rounded px-3 py-2 text-text-primary focus:outline-none focus:border-accent-primary"}),o.jsx("p",{className:"text-xs text-text-muted mt-1",children:"Range: 1,024 - 10,000,000 tokens"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-text-secondary mb-1",children:"Source"}),o.jsxs("p",{className:"text-text-primary bg-bg-tertiary px-3 py-2 rounded",children:[s.source==="backend"&&"Auto-detected from backend",s.source==="user"&&"Manually set",s.source==="default"&&"Default value"]})]})]}),o.jsxs("div",{className:"px-6 py-4 border-t border-border flex justify-end gap-3",children:[o.jsx("button",{type:"button",onClick:g,disabled:f,className:"px-4 py-2 text-text-secondary hover:text-text-primary transition-colors disabled:opacity-50",children:"Cancel"}),o.jsx("button",{type:"button",onClick:p,disabled:f||c<1024||c>1e7,className:"px-4 py-2 bg-accent-primary text-white rounded hover:opacity-90 transition-opacity disabled:opacity-50 disabled:cursor-not-allowed",children:f?"Saving...":"Save"})]})]})})}function zT(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(0)}K`:`${e}`}function HT(){var U;const[,e]=ar(),r=Ee(z=>z.currentSession),i=Ee(z=>z.setSessionProvider),[s,c]=P.useState(!1),[u,f]=P.useState([]),[l,d]=P.useState(null),p=P.useRef(null),[g,m]=P.useState(null),y=P.useRef(new Set),_=kt(z=>z.providers),k=kt(z=>z.activeProviderId),C=kt(z=>z.model);kt(z=>z.backend);const v=kt(z=>z.llmStatus),b=kt(z=>z.activating),x=kt(z=>z.activateProvider),S=kt(z=>z.refreshModel),j=kt(z=>z.refreshProviderModels);P.useEffect(()=>{function z(X){p.current&&!p.current.contains(X.target)&&(c(!1),f([]),y.current=new Set)}return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[]),P.useEffect(()=>{if(s){const z=_.map(X=>X.id);f(z),z.forEach(X=>{y.current.has(X)||(y.current.add(X),D(X))})}},[s,_]),_.find(z=>z.id===k);const A=v==="disconnected",N=C?((U=C.split("/").pop())==null?void 0:U.replace(/-/g," "))??C:"detecting...",D=async z=>{d(z);try{await j(z)}catch{}finally{d(null)}},T=z=>{u.includes(z.id)?f(u.filter(X=>X!==z.id)):(f([...u,z.id]),D(z.id))},I=async z=>{if(z.id===k){T(z);return}r?(i(z.id,void 0),kt.getState().syncFromSession(z.id,""),c(!1),f([])):await x(z.id)&&(c(!1),f([]))},H=z=>{T(z)},V=async(z,X)=>{z.stopPropagation(),y.current.delete(X),await j(X),await D(X)},Y=(z,X)=>{m({providerId:z,model:X})},q=()=>{m(null)},O=async(z,X)=>{if(console.log("[ProviderSelector.handleModelClick] providerId:",z,"model:",X),r){console.log("[ProviderSelector.handleModelClick] Calling setSessionProvider"),i(z,X),kt.getState().syncFromSession(z,X),f([]),c(!1);return}d("activating");try{(await Ce(`/api/providers/${z}/activate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:X})})).ok&&(await kt.getState().fetchConfig(),f([]),c(!1))}catch{}finally{d(null)}};return _.length===0?o.jsxs("button",{type:"button",onClick:()=>S(),className:"flex items-center gap-1 px-1.5 py-0.5 rounded hover:bg-bg-tertiary transition-colors group",title:A?"LLM server is offline. Click to retry.":C??"Click to refresh model",children:[A?o.jsx("span",{className:"text-sm text-accent-error animate-pulse",children:"LLM offline"}):o.jsx("span",{className:"text-sm text-accent-primary",children:N}),o.jsx("span",{className:"text-text-muted opacity-0 group-hover:opacity-100 transition-opacity",children:"↻"})]}):o.jsxs("div",{className:"relative",ref:p,children:[o.jsxs("button",{type:"button",onClick:()=>c(!s),className:"flex items-center gap-1 px-1.5 py-0.5 rounded hover:bg-bg-tertiary transition-colors group",title:"Click to switch provider or model",children:[A?o.jsx("span",{className:"text-sm text-accent-error animate-pulse",children:"offline"}):o.jsx("span",{className:"text-sm text-accent-primary",children:N}),o.jsx("svg",{className:`w-3 h-3 text-text-muted transition-transform ${s?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),s&&o.jsxs("div",{className:"absolute bottom-full right-0 mb-1 w-72 bg-bg-secondary border border-border rounded-lg shadow-lg z-50 overflow-hidden",children:[o.jsx("div",{className:"py-1",children:_.map(z=>{var X;return o.jsxs("div",{children:[o.jsxs("div",{className:`px-3 py-2 flex items-center justify-between ${z.id===k?"bg-bg-tertiary":"hover:bg-bg-tertiary"} ${b?"opacity-50 cursor-wait":"cursor-pointer"}`,children:[o.jsxs("div",{onClick:()=>!b&&I(z),className:"flex flex-col min-w-0 flex-1 cursor-pointer",children:[o.jsx("span",{className:`text-sm font-medium truncate ${z.id===k?"text-accent-primary":"text-text-primary"}`,children:z.name}),o.jsx("span",{className:"text-xs text-text-muted truncate",children:z.backend!=="auto"&&xS(z.backend)})]}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[z.id===k?o.jsx("span",{className:"text-accent-success",title:"Active",children:o.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})}):o.jsx("span",{className:"w-4"}),o.jsx("button",{type:"button",onClick:Q=>{Q.stopPropagation(),V(Q,z.id)},className:"p-0.5 hover:bg-bg-tertiary rounded transition-colors",title:"Refresh models",children:o.jsx("svg",{className:`w-4 h-4 ${l===z.id?"animate-spin":""} ${z.id===k?"text-accent-primary":"text-text-muted"}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})}),o.jsx("button",{type:"button",onClick:Q=>{Q.stopPropagation(),H(z)},className:"p-0.5 hover:bg-bg-tertiary rounded transition-colors",title:"Show models",children:o.jsx("svg",{className:`w-4 h-4 transition-transform ${u.includes(z.id)?"rotate-180":""} ${z.id===k?"text-accent-primary":"text-text-muted"}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]})]}),u.includes(z.id)&&o.jsx("div",{className:"bg-bg-primary border-t border-border",children:l===z.id?o.jsx("div",{className:"px-4 py-2 text-xs text-text-muted",children:"Loading models..."}):(X=z.models)!=null&&X.length?z.models.map(Q=>{var M;return o.jsxs("button",{type:"button",onClick:()=>O(z.id,Q.id),disabled:l==="activating",className:`w-full px-4 py-1.5 text-left hover:bg-bg-tertiary transition-colors text-sm flex items-center justify-between group ${l==="activating"?"opacity-50 cursor-wait":""} ${C===Q.id?"text-accent-primary":"text-text-secondary"}`,children:[o.jsx("span",{className:"truncate flex-1",children:((M=Q.id.split("/").pop())==null?void 0:M.replace(/-/g," "))??Q.id}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[o.jsx("span",{className:"text-xs text-text-muted",children:zT(Q.contextWindow)}),o.jsx("button",{type:"button",onClick:L=>{L.stopPropagation(),Y(z.id,Q)},className:"opacity-0 group-hover:opacity-100 p-0.5 hover:bg-bg-tertiary rounded transition-opacity",title:"Edit model context",children:o.jsx("svg",{className:"w-3 h-3 text-text-muted",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})})]}),C===Q.id&&o.jsx("span",{className:"text-accent-success flex-shrink-0 ml-1",children:o.jsx("svg",{className:"w-3.5 h-3.5",fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})})]},Q.id)}):o.jsx("div",{className:"px-4 py-2 text-xs text-text-muted",children:"No models available"})})]},z.id)})}),o.jsx("div",{className:"border-t border-border px-3 py-2",children:o.jsx("button",{onClick:()=>e("/onboarding"),className:"text-xs text-accent-primary hover:underline",children:"Manage providers"})})]}),g&&o.jsx(IT,{isOpen:!0,onClose:q,providerId:g.providerId,model:g.model})]})}const Dn=Wn((e,r)=>({defaults:[],userItems:[],loading:!1,fetchCommands:async()=>{await _h("/api/commands",e)},fetchCommand:async i=>{try{const s=await Ce(`/api/commands/${i}`);return s.ok?await s.json():null}catch{return null}},fetchDefaultContent:async i=>{try{const s=await Ce(`/api/commands/defaults/${i}`);return s.ok?await s.json():null}catch{return null}},createCommand:async i=>{const s=await si("POST","/api/commands",i);return s.success&&await r().fetchCommands(),s},updateCommand:async(i,s)=>{const c=await si("PUT",`/api/commands/${i}`,s);return c.success&&await r().fetchCommands(),c},deleteCommand:async i=>{try{const s=await Ce(`/api/commands/${i}`,{method:"DELETE"}),c=await s.json();return s.ok?(e(u=>({userItems:u.userItems.filter(f=>f.id!==i)})),{success:!0}):{success:!1,error:c.error??"Failed to delete"}}catch{return{success:!1,error:"Network error"}}},duplicateCommand:async i=>{try{const s=await Ce(`/api/commands/${i}/duplicate`,{method:"POST"}),c=await s.json();return s.ok?(await r().fetchCommands(),{success:!0}):{success:!1,error:c.error??"Failed to duplicate"}}catch{return{success:!1,error:"Network error"}}}}));function PT(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}const FT="M15 12a3 3 0 11-6 0 3 3 0 016 0z M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z";function UT({onClick:e}){return o.jsx("button",{type:"button",onClick:e,className:"p-1.5 rounded text-text-muted hover:text-text-primary hover:bg-bg-primary transition-colors",title:"View",children:o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:FT})})})}function s0({isOpen:e,onClose:r,initialEditId:i}){const s=Dn(ge=>ge.defaults),c=Dn(ge=>ge.userItems),u=Dn(ge=>ge.loading),f=Dn(ge=>ge.fetchCommands),l=Dn(ge=>ge.fetchCommand),d=Dn(ge=>ge.fetchDefaultContent),p=Dn(ge=>ge.createCommand),g=Dn(ge=>ge.updateCommand),m=Dn(ge=>ge.deleteCommand),[y,_]=P.useState(null),[k,C]=P.useState(null),{view:v,editingId:b,formError:x,saving:S,formData:j,setView:A,setEditingId:N,setFormError:D,setFormData:T,setSaving:I}=wb(),{requestDelete:H,clearConfirm:V,isConfirming:Y}=Sh(),q=P.useRef(!1),O=Wt(ge=>ge.defaults),U=Wt(ge=>ge.userItems),z=Wt(ge=>ge.fetchAgents),Q=[...O,...U].filter(ge=>!ge.subagent),M=P.useRef(f),L=P.useRef(z),B=P.useRef(l),W=P.useRef(d),F=P.useRef(i),re=P.useRef(A),Z=P.useRef(N),ee=P.useRef(D),K=P.useRef(V);P.useEffect(()=>{M.current=f,L.current=z,B.current=l,W.current=d,F.current=i,re.current=A,Z.current=N,ee.current=D,K.current=V}),P.useEffect(()=>{if(e)if(M.current(),L.current(),q.current||(K.current(),q.current=!0),F.current){const ge=s.some(je=>je.id===F.current);re.current("edit"),Z.current(F.current),ee.current(""),ge?W.current(F.current).then(je=>{je&&T({name:je.metadata.name+" (copy)",id:`${F.current}-copy-${Date.now()}`,prompt:je.prompt,agentMode:je.metadata.agentMode??"",isDefault:!0})}):B.current(F.current).then(je=>{je&&T({name:je.metadata.name,id:je.metadata.id,prompt:je.prompt,agentMode:je.metadata.agentMode??"",isDefault:!1})})}else re.current("list"),Z.current(null);else q.current=!1},[e]);const $=async ge=>{_(ge);const je=await d(ge);C((je==null?void 0:je.prompt)??null)},ae=async ge=>{if(s.some(We=>We.id===ge)){const We=await d(ge);We&&(N(null),T({name:`${We.metadata.name} (copy)`,id:`${ge}-copy-${Date.now()}`,prompt:We.prompt,agentMode:We.metadata.agentMode??"",isDefault:!0}),D(""),A("edit"))}else{const We=await l(ge);We&&(N(null),T({name:`${We.metadata.name} (copy)`,id:`${ge}-copy-${Date.now()}`,prompt:We.prompt,agentMode:We.metadata.agentMode??"",isDefault:!1}),D(""),A("edit"))}},ne=()=>{T({name:"",id:"",prompt:"",agentMode:"",isDefault:!1}),N(null),A("edit")},ve=async ge=>{const je=await l(ge);je&&(N(ge),T({name:je.metadata.name,id:je.metadata.id,prompt:je.prompt,agentMode:je.metadata.agentMode??"",isDefault:!1}),D(""),A("edit"))},be=async ge=>{await m(ge),V()},Ae=async()=>{const ge=b??j.id;if(!ge||!j.name||!j.prompt){D("Name and message are required.");return}I(!0),D("");const je={metadata:{id:ge,name:j.name,...j.agentMode?{agentMode:j.agentMode}:{}},prompt:j.prompt},We=b?await g(b,je):await p(je);if(I(!1),!We.success){D(We.error??"Failed to save command.");return}i?r():A("list")},Me=()=>{i?r():(A("list"),_(null),C(null))},Ie=ge=>{T(je=>({...je,name:ge})),(!b||j.isDefault)&&T(je=>({...je,id:PT(ge)}))},Fe=()=>{_(null),C(null),A("list")},ke=()=>{y&&(_(null),A("edit"),N(y),d(y).then(ge=>{ge&&T({name:`${ge.metadata.name} (copy)`,id:`${y}-copy-${Date.now()}`,prompt:ge.prompt,agentMode:ge.metadata.agentMode??"",isDefault:!0})}))};if(y){const ge=s.find(je=>je.id===y);return o.jsx(ln,{isOpen:e,onClose:Fe,title:`Default: ${(ge==null?void 0:ge.name)??y}`,size:"xl",children:o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"space-y-3 mb-3",children:[o.jsxs("div",{className:"flex items-center gap-2 text-xs text-text-muted",children:[o.jsx("span",{className:"px-1.5 py-0.5 rounded bg-bg-tertiary text-text-secondary",children:"Built-in"}),o.jsx("span",{className:"font-mono",children:y})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Name"}),o.jsx("div",{className:"px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm",children:ge==null?void 0:ge.name})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Agent Mode"}),o.jsx("div",{className:"px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm text-text-muted",children:(ge==null?void 0:ge.agentMode)||"None"})]})]}),o.jsxs("div",{className:"flex-1 min-h-[120px] border-t border-border pt-3 flex flex-col",children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Message"}),o.jsx("textarea",{value:k??"",readOnly:!0,placeholder:"...",className:"flex-1 w-full px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-none opacity-60"})]}),o.jsxs("div",{className:"flex justify-end gap-2 pt-3 mt-3 border-t border-border flex-shrink-0",children:[o.jsx(st,{variant:"secondary",onClick:Fe,children:"Close"}),o.jsx(st,{variant:"primary",onClick:ke,children:"Duplicate & Customize"})]})]})})}return v==="edit"?o.jsx(ln,{isOpen:e,onClose:Me,title:b?"Edit Command":"New Command",size:"xl",children:o.jsxs("div",{className:"flex flex-col h-full",children:[x&&o.jsx(kh,{message:x}),o.jsxs("div",{className:"space-y-3 mb-3",children:[o.jsx(Sb,{name:j.name,id:j.id,nameLabel:"Name",idLabel:"ID",namePlaceholder:"My Command",idPlaceholder:"my-command",readOnlyId:!!b&&!j.isDefault,onNameChange:Ie,onIdChange:ge=>T(je=>({...je,id:ge}))}),o.jsxs("div",{children:[o.jsxs("label",{className:"block text-xs text-text-secondary mb-1",children:["Agent Mode ",o.jsx("span",{className:"text-text-muted",children:"(optional)"})]}),o.jsxs("select",{value:j.agentMode,onChange:ge=>T(je=>({...je,agentMode:ge.target.value})),className:"w-full px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm focus:outline-none focus:ring-1 focus:ring-accent-primary",children:[o.jsx("option",{value:"",children:"None (keep current mode)"}),Q.map(ge=>o.jsx("option",{value:ge.id,children:ge.name},ge.id))]})]})]}),o.jsxs("div",{className:"flex-1 min-h-[120px] border-t border-border pt-3 flex flex-col",children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Message"}),o.jsx("textarea",{value:j.prompt,onChange:ge=>T(je=>({...je,prompt:ge.target.value})),placeholder:"The message that will be sent when this command is triggered...",className:"flex-1 w-full px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-none focus:outline-none focus:ring-1 focus:ring-accent-primary"})]}),o.jsxs("div",{className:"flex justify-end gap-2 pt-3 mt-3 border-t border-border flex-shrink-0",children:[o.jsx(st,{variant:"secondary",onClick:Me,children:"Cancel"}),o.jsx(st,{variant:"primary",onClick:Ae,disabled:S||!j.name||!j.prompt,children:S?"Saving...":"Save"})]})]})}):o.jsxs(ln,{isOpen:e,onClose:r,title:"Commands",size:"lg",children:[o.jsx(bb,{description:"Commands are pre-defined messages you can send with a single click.",onNew:ne}),o.jsxs(_b,{loading:u,hasItems:s.length>0||c.length>0,loadingLabel:"Loading commands...",emptyLabel:"No commands created yet.",children:[s.length>0&&o.jsxs("div",{children:[o.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Built-in"}),o.jsx("div",{className:"space-y-2",children:s.map(ge=>o.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[o.jsx("div",{className:"min-w-0 flex-1 mr-3",children:o.jsx("span",{className:"text-text-primary text-sm font-medium",children:ge.name})}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[o.jsx(UT,{onClick:()=>$(ge.id)}),o.jsx(Wa,{onClick:()=>ae(ge.id)})]})]},ge.id))})]}),c.length>0&&o.jsxs("div",{children:[o.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Custom"}),o.jsx("div",{className:"space-y-2",children:c.map(ge=>o.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[o.jsx("div",{className:"min-w-0 flex-1 mr-3",children:o.jsx("div",{className:"flex items-center gap-2",children:o.jsx("span",{className:"text-text-primary text-sm font-medium",children:ge.name})})}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[o.jsx(Mi,{onClick:()=>ve(ge.id)}),o.jsx(Wa,{onClick:()=>ae(ge.id)}),Y(ge.id,"delete")?o.jsx(wh,{onConfirm:()=>be(ge.id),onCancel:V}):o.jsx(Ch,{onClick:()=>H(ge.id)})]})]},ge.id))})]})]})]})}function a0({items:e,isOpen:r,onOpen:i,onClose:s,filterFn:c}){const[u,f]=P.useState(""),[l,d]=P.useState(0),p=P.useRef(null),g=P.useRef(null);P.useEffect(()=>{r&&(f(""),d(0),requestAnimationFrame(()=>{var v;return(v=g.current)==null?void 0:v.focus()}))},[r]),P.useEffect(()=>{if(!r)return;const v=b=>{p.current&&!p.current.contains(b.target)&&s()};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[r,s]);const m=P.useCallback(()=>{r?s():i()},[r,i,s]),y=P.useCallback(v=>{f(v),d(0)},[]),_=P.useCallback(v=>{const b=e.filter(x=>c(x,u));switch(v.key){case"ArrowDown":v.preventDefault(),d(x=>Math.min(x+1,b.length-1));break;case"ArrowUp":v.preventDefault(),d(x=>Math.max(x-1,0));break;case"Enter":v.preventDefault();break;case"Escape":v.preventDefault(),s();break}},[e,u,c,s]),k=P.useCallback(()=>{d(0)},[]),C=e.filter(v=>c(v,u));return{isOpen:r,search:u,selectedIndex:l,filtered:C,containerRef:p,searchRef:g,handleToggle:m,handleSearchChange:y,handleKeyDown:_,setSelectedIndex:d,resetSelection:k}}function o0({label:e,isOpen:r,onClick:i,className:s=""}){return o.jsxs("button",{type:"button",onClick:i,className:`flex items-center gap-1 text-sm text-text-muted hover:text-text-primary transition-colors ${s}`,children:[e,o.jsx("svg",{className:`w-3 h-3 transition-transform ${r?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]})}function l0({value:e,onChange:r,onKeyDown:i,ref:s,placeholder:c}){return o.jsx("div",{className:"p-2 border-b border-border",children:o.jsx("input",{ref:s,value:e,onChange:u=>r(u.target.value),onKeyDown:i,placeholder:c,className:"w-full px-2 py-1 bg-bg-tertiary border border-border rounded text-sm focus:outline-none focus:ring-1 focus:ring-accent-primary"})})}function c0({children:e,maxHeight:r="max-h-64"}){return o.jsx("div",{className:`overflow-y-auto ${r} p-1`,children:e})}function u0({hasItems:e,message:r}){return o.jsx("div",{className:"px-3 py-2 text-text-muted text-sm",children:e?"No matches":r})}function d0({label:e,onClick:r}){return o.jsx("div",{className:"border-t border-border p-1",children:o.jsx("button",{type:"button",onClick:r,className:"w-full text-left px-3 py-1.5 rounded text-sm text-text-muted hover:text-text-primary hover:bg-bg-tertiary transition-colors",children:e})})}function $T({onSendCommand:e,onOpenManager:r,textareaContent:i,attachments:s}){const[c,u]=P.useState(!1),[f,l]=P.useState(null),d=Dn(D=>D.defaults),p=Dn(D=>D.userItems),g=Dn(D=>D.fetchCommands),m=[...d,...p],{isOpen:y,search:_,selectedIndex:k,filtered:C,containerRef:v,searchRef:b,handleToggle:x,handleSearchChange:S,handleKeyDown:j}=a0({items:m,isOpen:c,onOpen:()=>u(!0),onClose:()=>u(!1),filterFn:(D,T)=>!T||D.name.toLowerCase().includes(T.toLowerCase())});P.useEffect(()=>{c&&g()},[c,g]);const A=async D=>{const T=await Dn.getState().fetchCommand(D);T&&e(T.prompt,T.metadata.agentMode,i,s),u(!1)},N=()=>{u(!1),r()};return o.jsxs("div",{ref:v,className:"relative",children:[o.jsx(o0,{label:"Commands",isOpen:y,onClick:x}),y&&o.jsxs("div",{className:"absolute bottom-full right-0 mb-1 w-72 bg-bg-secondary border border-border rounded-lg shadow-xl z-50",onKeyDown:j,children:[o.jsx(l0,{value:_,onChange:S,onKeyDown:j,ref:b,placeholder:"Search commands..."}),o.jsx(c0,{children:C.length===0?o.jsx(u0,{hasItems:m.length>0,message:"No commands yet"}):C.map((D,T)=>o.jsxs("div",{className:`flex items-center gap-1 px-3 py-2 rounded transition-colors group ${T===k?"bg-accent-primary/20":"hover:bg-bg-tertiary"}`,children:[o.jsx("button",{type:"button",onClick:()=>A(D.id),className:"flex-1 text-left",children:o.jsx("div",{className:"text-sm text-text-primary font-medium",children:D.name})}),o.jsx(Mi,{className:"opacity-0 group-hover:opacity-100",onClick:I=>{I.stopPropagation(),u(!1),l(D.id)}})]},D.id))}),o.jsx(d0,{label:"Manage Commands...",onClick:N})]}),o.jsx(s0,{isOpen:!!f,onClose:()=>l(null),initialEditId:f})]})}function qT(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function WT(e){let r=1;for(;e.some(i=>i.id===`s${r}`);)r++;return`s${r}`}const GT=[{value:"agent",label:"Agent"},{value:"sub_agent",label:"Sub-Agent"},{value:"shell",label:"Shell"}],h0={all_criteria_passed:"All passed",all_criteria_completed_or_passed:"All completed",any_criteria_blocked:"Blocked",has_pending_criteria:"Pending/Failed",step_result:"Result",always:"Always"},f0=[{value:"all_criteria_passed",label:"All criteria passed"},{value:"all_criteria_completed_or_passed",label:"All criteria completed or passed"},{value:"any_criteria_blocked",label:"Any criteria blocked (retry limit)"},{value:"has_pending_criteria",label:"Has pending or failed criteria"},{value:"step_result",label:"Step result is..."},{value:"always",label:"Always (fallback)"}],ji=150,Nr=54,js=80,Tn=30,Ns=70,Qv=100,Ni=50,jl=50,Jv=4;function lf(e,r){if(e.type==="agent"){const i=r.find(s=>s.id===e.toolMode);return{name:(i==null?void 0:i.name)??(e.toolMode||"Agent"),color:(i==null?void 0:i.color)||"#3b82f6"}}if(e.type==="sub_agent"){const i=r.find(s=>s.id===e.subAgentType);return{name:(i==null?void 0:i.name)??(e.subAgentType||"Sub-Agent"),color:(i==null?void 0:i.color)||"#a855f7"}}return{name:"Shell",color:"#22c55e"}}function VT(e,r,i,s){const c=jl+Ni+ji+Qv+ji+Ni+jl,u=c/2,f=jl+Ni+ji/2,l=jl+Ni+ji+Qv+ji/2,d=[],p=[],g=new Map,m=e.filter(O=>O.type==="agent"||O.type==="shell"),y=e.filter(O=>O.type==="sub_agent"),_=y.length>0,k=_?f:u,C=m.length>0?l:u,v=Ni+Tn/2;if(d.push({id:"$start",type:"terminal",label:"Start",cx:k,cy:v,w:js,h:Tn}),g.set("$start",{cx:k,cy:v,w:js,h:Tn}),e.length===0){const O=v+Tn/2+Ns*2+Tn/2;return d.push({id:"$done",type:"terminal",label:"Done",cx:k,cy:O,w:js,h:Tn}),g.set("$done",{cx:k,cy:O,w:js,h:Tn}),{nodes:d,edges:p,width:c,height:O+Tn/2+Ni,posMap:g}}const b=v+Tn/2+Ns,x=(O,U)=>{O.forEach((z,X)=>{const Q=b+X*(Nr+Ns)+Nr/2,{name:M,color:L}=lf(z,s);d.push({id:z.id,type:"step",label:M,color:L,cx:U,cy:Q,w:ji,h:Nr}),g.set(z.id,{cx:U,cy:Q,w:ji,h:Nr})})};x(m,k),x(y,C);const S=m.length>0?b+(m.length-1)*(Nr+Ns)+Nr/2:v,j=_?b+(y.length-1)*(Nr+Ns)+Nr/2:v,A=Math.max(S,j)+Nr/2+Ns+Tn/2;d.push({id:"$done",type:"terminal",label:"Done",cx:k,cy:A,w:js,h:Tn}),g.set("$done",{cx:k,cy:A,w:js,h:Tn});const N=[];r&&g.has(r)&&N.push({from:"$start",to:r,label:i,edgeKey:"start",direction:"down",backEdgeIndex:0});let D=0;for(const O of e)O.transitions.forEach((U,z)=>{if(!U.goto||!g.has(U.goto))return;const X=g.get(O.id),Q=g.get(U.goto),M=U.when.type==="step_result"?`${U.when.result}`:h0[U.when.type]??U.when.type,L=O.id===U.goto;let B;L?B="back":Q.cy>X.cy+1?B="down":Q.cy<X.cy-1?B="back":B="same",N.push({from:O.id,to:U.goto,label:M,edgeKey:`${O.id}:${z}`,direction:B,backEdgeIndex:B==="back"?D++:0})});const T=new Map,I=new Map,H=new Map,V=new Map;for(const O of N)O.direction==="down"&&(T.set(O.from,(T.get(O.from)??0)+1),I.set(O.to,(I.get(O.to)??0)+1));const Y=new Map,q=new Map;for(const O of N){if(O.direction!=="same")continue;const U=[O.from,O.to].sort().join("|");Y.set(U,(Y.get(U)??0)+1)}for(const O of N){if(O.direction==="back"||O.direction==="same"){let B=0;if(O.direction==="same"){const W=[O.from,O.to].sort().join("|");B=q.get(W)??0,q.set(W,B+1)}p.push({...O,fromPort:0,toPort:0,sameEdgeIndex:B});continue}const U=T.get(O.from)??1,z=I.get(O.to)??1,X=H.get(O.from)??0,Q=V.get(O.to)??0;H.set(O.from,X+1),V.set(O.to,Q+1);const M=U===1?0:-.6+1.2*X/(U-1),L=z===1?0:-.6+1.2*Q/(z-1);p.push({...O,fromPort:M,toPort:L,sameEdgeIndex:0})}return{nodes:d,edges:p,width:c,height:A+Tn/2+Ni,posMap:g}}function YT({steps:e,entryStep:r,selectedNodeId:i,selectedEdgeKey:s,startConditionLabel:c,agentTypes:u,isReadOnly:f,onSelectNode:l,onSelectEdge:d,onRemoveStep:p,onCreateTransition:g,onReconnectTo:m,onReconnectFrom:y,onDeleteTransition:_}){const k=P.useRef(null),C=P.useRef(!1),[v,b]=P.useState(null),[x,S]=P.useState(null),[j,A]=P.useState(null),{nodes:N,edges:D,width:T,height:I,posMap:H}=P.useMemo(()=>VT(e,r,c,u),[e,r,c,u]),V=P.useCallback(Z=>{var ne;const ee=k.current;if(!ee)return{x:0,y:0};const K=ee.createSVGPoint();K.x=Z.clientX,K.y=Z.clientY;const $=(ne=ee.getScreenCTM())==null?void 0:ne.inverse();if(!$)return{x:0,y:0};const ae=K.matrixTransform($);return{x:ae.x,y:ae.y}},[]),Y=P.useCallback(Z=>!Z||!x||Z==="$start"?!1:x.type==="reconnect-from"?Z!=="$done":!0,[x]),q=P.useCallback((Z,ee)=>{if(f)return;Z.stopPropagation(),Z.preventDefault();const K=V(Z);S({type:"new",fromNodeId:ee,mouseX:K.x,mouseY:K.y})},[V,f]),O=P.useCallback((Z,ee)=>{if(f)return;Z.stopPropagation(),Z.preventDefault();const K=V(Z);S({type:"reconnect-to",fromNodeId:ee.from,edgeKey:ee.edgeKey,mouseX:K.x,mouseY:K.y})},[V,f]),U=P.useCallback((Z,ee)=>{if(f)return;Z.stopPropagation(),Z.preventDefault();const K=V(Z);S({type:"reconnect-from",fromNodeId:ee.from,fixedTargetId:ee.to,edgeKey:ee.edgeKey,mouseX:K.x,mouseY:K.y})},[V,f]),z=P.useCallback(Z=>{if(!x)return;const ee=V(Z);S(K=>K?{...K,mouseX:ee.x,mouseY:ee.y}:null)},[x,V]),X=P.useCallback(()=>{x&&(C.current=!0,j&&Y(j)&&(x.type==="new"?g(x.fromNodeId,j):x.type==="reconnect-to"?m(x.edgeKey,j):x.type==="reconnect-from"&&y(x.edgeKey,j)),S(null),A(null))},[x,j,Y,g,m,y]),Q=P.useCallback(()=>{if(C.current){C.current=!1;return}l(null),d(null)},[l,d]);P.useEffect(()=>{if(f)return;const Z=ee=>{ee.target instanceof HTMLInputElement||ee.target instanceof HTMLTextAreaElement||ee.target instanceof HTMLSelectElement||(ee.key==="Delete"||ee.key==="Backspace")&&s&&s!=="start"&&(ee.preventDefault(),_(s),d(null))};return document.addEventListener("keydown",Z),()=>document.removeEventListener("keydown",Z)},[f,s,_,d]);const M=Z=>{const ee=H.get(Z.from),K=H.get(Z.to);if(!ee||!K)return null;let $,ae,ne,ve="middle",be,Ae;if(Z.direction==="down"){const Me=ee.cx+Z.fromPort*(ee.w/2-10),Ie=ee.cy+ee.h/2,Fe=K.cx+Z.toPort*(K.w/2-10),ke=K.cy-K.h/2,ge=ke-Ie,je=Fe-Me;$=`M ${Me} ${Ie} C ${Me} ${Ie+ge*.4}, ${Fe-je*.2} ${ke-ge*.1}, ${Fe} ${ke}`,ae=Me+(Fe-Me)*.5,ne=Ie+ge*.6,be={x:Me,y:Ie},Ae={x:Fe,y:ke}}else if(Z.direction==="back"){const Me=Z.from===Z.to,Ie=ee.cx>=T/2,Fe=Z.backEdgeIndex*16,ke=Ie?T-20-Fe:20+Fe;if(Me){const ge=ee.cx>=T/2,je=30+Z.backEdgeIndex*14,We=ee.cy-ee.h/2,Lt=ge?ee.cx+ee.w/2:ee.cx-ee.w/2,pe=ge?Lt+je:Lt-je,Ne=ee.cx+(ge?ee.w/4:-ee.w/4),Oe=We-20-Z.backEdgeIndex*10;$=`M ${Lt} ${ee.cy} C ${pe} ${ee.cy}, ${pe} ${Oe}, ${Ne} ${We}`,ae=pe+10,ne=Oe+4,ve="middle",be={x:Lt,y:ee.cy},Ae={x:Ne,y:We}}else{const ge=Ie?ee.cx+ee.w/2:ee.cx-ee.w/2,je=K.cx+(Ie?K.w/4:-K.w/4),We=Math.min(ee.cy,K.cy)-K.h/2-18-Z.backEdgeIndex*14;$=`M ${ge} ${ee.cy} L ${ke} ${ee.cy} L ${ke} ${We} L ${je} ${We} L ${je} ${K.cy-K.h/2}`,ae=ke,ne=(ee.cy+We)/2,ve=Ie?"start":"end",be={x:ge,y:ee.cy},Ae={x:je,y:K.cy-K.h/2}}}else{const Me=K.cx>ee.cx,Ie=Z.sameEdgeIndex===0?-12:12,Fe=Me?ee.cx+ee.w/2:ee.cx-ee.w/2,ke=Me?K.cx-K.w/2:K.cx+K.w/2,ge=ee.cy+Ie,je=K.cy+Ie,We=(Fe+ke)/2;$=`M ${Fe} ${ge} C ${We} ${ge}, ${We} ${je}, ${ke} ${je}`,ae=We,ne=(ge+je)/2-6,be={x:Fe,y:ge},Ae={x:ke,y:je}}return{path:$,labelX:ae,labelY:ne,labelAnchor:ve,fromPt:be,toPt:Ae}},L=(Z,ee)=>{const K=M(Z);if(!K)return null;const{path:$,labelX:ae,labelY:ne,labelAnchor:ve}=K,be=s===Z.edgeKey,Ae=Z.label&&!(Z.from==="$start"&&Z.label==="Always");return o.jsxs("g",{children:[o.jsx("path",{d:$,fill:"none",stroke:"transparent",strokeWidth:14,className:"cursor-pointer",onClick:Me=>{Me.stopPropagation(),d(be?null:Z.edgeKey)}}),o.jsx("path",{d:$,fill:"none",stroke:be?"#58a6ff":"#484f58",strokeWidth:be?2.2:1.2,markerEnd:be?"url(#arrow-selected)":"url(#arrow)",pointerEvents:"none"}),Ae&&o.jsx("text",{x:ae+(ve==="start"?5:ve==="end"?-5:0),y:ne+3,textAnchor:ve,className:"text-[8px]",fill:be?"#79c0ff":"#8b949e",style:{paintOrder:"stroke",stroke:"#0d1117",strokeWidth:3,strokeLinejoin:"round"},pointerEvents:"none",children:Z.label})]},ee)},B=()=>{if(!s||x)return null;const Z=D.find(ne=>ne.edgeKey===s);if(!Z)return null;const ee=M(Z);if(!ee)return null;const{fromPt:K,toPt:$}=ee,ae=6;return o.jsxs(o.Fragment,{children:[Z.edgeKey!=="start"&&o.jsx("circle",{cx:K.x,cy:K.y,r:ae,fill:"#58a6ff",fillOpacity:.25,stroke:"#58a6ff",strokeWidth:2,strokeOpacity:.8,className:"cursor-grab",onMouseDown:ne=>U(ne,Z)}),o.jsx("circle",{cx:$.x,cy:$.y,r:ae,fill:"#58a6ff",fillOpacity:.25,stroke:"#58a6ff",strokeWidth:2,strokeOpacity:.8,className:"cursor-grab",onMouseDown:ne=>O(ne,Z)})]})},W=()=>{if(!x)return null;let Z,ee,K,$;if(x.type==="reconnect-from"){const ve=H.get(x.fixedTargetId);if(!ve)return null;Z=x.mouseX,ee=x.mouseY,K=ve.cx,$=ve.cy-ve.h/2}else{const ve=H.get(x.fromNodeId);if(!ve)return null;Z=ve.cx,ee=ve.cy+ve.h/2,K=x.mouseX,$=x.mouseY}const ae=$-ee,ne=Math.abs(ae)>10?`M ${Z} ${ee} C ${Z} ${ee+ae*.4}, ${K} ${$-ae*.4}, ${K} ${$}`:`M ${Z} ${ee} L ${K} ${$}`;return o.jsx("path",{d:ne,fill:"none",stroke:"#58a6ff",strokeWidth:2,strokeDasharray:"6 3",strokeOpacity:.7,pointerEvents:"none"})},F=Z=>{const ee=Z.cy+Z.h/2,K=(x==null?void 0:x.fromNodeId)===Z.id;return o.jsx("circle",{cx:Z.cx,cy:ee,r:Jv,fill:K?"#58a6ff":"#1c2128",stroke:K?"#58a6ff":"#484f58",strokeWidth:1.5,strokeOpacity:K?1:.5,className:"cursor-crosshair",onMouseDown:$=>q($,Z.id)})},re=Z=>{const ee=Z.cy-Z.h/2,K=x&&j===Z.id&&Y(Z.id);return o.jsx("circle",{cx:Z.cx,cy:ee,r:Jv,fill:K?"#3fb950":"#1c2128",stroke:K?"#3fb950":"#484f58",strokeWidth:1.5,strokeOpacity:K?1:.5})};return o.jsxs("svg",{ref:k,viewBox:`0 0 ${T} ${I}`,className:"block w-full",preserveAspectRatio:"xMidYMin meet",onMouseMove:z,onMouseUp:X,onClick:Q,children:[o.jsxs("defs",{children:[o.jsx("marker",{id:"arrow",viewBox:"0 0 10 7",refX:"10",refY:"3.5",markerWidth:"7",markerHeight:"5",orient:"auto",children:o.jsx("polygon",{points:"0 0, 10 3.5, 0 7",fill:"#484f58"})}),o.jsx("marker",{id:"arrow-selected",viewBox:"0 0 10 7",refX:"10",refY:"3.5",markerWidth:"7",markerHeight:"5",orient:"auto",children:o.jsx("polygon",{points:"0 0, 10 3.5, 0 7",fill:"#58a6ff"})})]}),D.map((Z,ee)=>L(Z,ee)),N.map(Z=>{const ee=i===Z.id,K=Z.cx-Z.w/2,$=Z.cy-Z.h/2,ae=v===Z.id,ne=x&&j===Z.id&&Y(Z.id);if(Z.type==="terminal"){const be=Z.id==="$start",Ae=be?"#58a6ff":"#3fb950",Me=be,Ie=!be;return o.jsxs("g",{onClick:Fe=>{Fe.stopPropagation(),be&&!f&&d("start")},className:be&&!f?"cursor-pointer":void 0,children:[ne&&o.jsx("rect",{x:K-3,y:$-3,width:Z.w+6,height:Z.h+6,rx:Z.h/2+3,fill:"none",stroke:"#3fb950",strokeOpacity:.6,strokeWidth:2}),be&&s==="start"&&o.jsx("rect",{x:K-3,y:$-3,width:Z.w+6,height:Z.h+6,rx:Z.h/2+3,fill:"none",stroke:"#58a6ff",strokeOpacity:.5,strokeWidth:2}),o.jsx("rect",{x:K,y:$,width:Z.w,height:Z.h,rx:Z.h/2,fill:Ae,fillOpacity:.08,stroke:Ae,strokeOpacity:.4,strokeWidth:1.5}),o.jsx("text",{x:Z.cx,y:Z.cy+4,textAnchor:"middle",fill:Ae,className:"text-[10px] font-medium",pointerEvents:"none",children:Z.label}),Me&&F(Z),Ie&&re(Z)]},Z.id)}const ve=Z.color??"#6b7280";return o.jsxs("g",{onClick:be=>{be.stopPropagation(),f||l(ee?null:Z.id)},onMouseEnter:()=>b(Z.id),onMouseLeave:()=>b(null),className:f?void 0:"cursor-pointer",children:[ne&&o.jsx("rect",{x:K-3,y:$-3,width:Z.w+6,height:Z.h+6,rx:12,fill:"none",stroke:"#3fb950",strokeOpacity:.6,strokeWidth:2}),ee&&o.jsx("rect",{x:K-3,y:$-3,width:Z.w+6,height:Z.h+6,rx:12,fill:"none",stroke:"#58a6ff",strokeOpacity:.5,strokeWidth:2}),o.jsx("rect",{x:K,y:$,width:Z.w,height:Z.h,rx:10,fill:ve,fillOpacity:.08,stroke:ve,strokeOpacity:.6,strokeWidth:ee?2:1.5}),o.jsx("text",{x:Z.cx,y:Z.cy+4,textAnchor:"middle",fill:"#c9d1d9",className:"text-[11px] font-medium",pointerEvents:"none",children:Z.label}),!f&&F(Z),!f&&re(Z),ae&&!x&&!f&&o.jsxs("g",{onClick:be=>{be.stopPropagation(),p(Z.id)},className:"cursor-pointer",children:[o.jsx("circle",{cx:K+Z.w-2,cy:$+2,r:8,fill:"#0d1117",fillOpacity:.9,stroke:"#f85149",strokeOpacity:.5,strokeWidth:1}),o.jsx("line",{x1:K+Z.w-5,y1:$-1,x2:K+Z.w+1,y2:$+5,stroke:"#f85149",strokeWidth:1.5,strokeLinecap:"round"}),o.jsx("line",{x1:K+Z.w+1,y1:$-1,x2:K+Z.w-5,y2:$+5,stroke:"#f85149",strokeWidth:1.5,strokeLinecap:"round"})]})]},Z.id)}),x&&N.map(Z=>Y(Z.id)?o.jsx("rect",{x:Z.cx-Z.w/2-8,y:Z.cy-Z.h/2-8,width:Z.w+16,height:Z.h+16,fill:"transparent",rx:12,onMouseEnter:()=>A(Z.id),onMouseLeave:()=>A(null),onMouseUp:ee=>{ee.stopPropagation(),X()}},`drop-${Z.id}`):null),W(),B()]})}const Kn="w-full px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm focus:outline-none focus:ring-1 focus:ring-accent-primary",Li="w-full px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm focus:outline-none focus:ring-1 focus:ring-accent-primary",rn="block text-[11px] text-text-secondary mb-0.5";function KT({fromLabel:e,toLabel:r,condition:i,fromStep:s,agentTypes:c,onUpdateCondition:u,onDelete:f}){const l=s&&(s.type==="sub_agent"||s.type==="agent")?c.find(p=>p.id===(s.type==="sub_agent"?s.subAgentType:s.toolMode)):void 0,d=(l==null?void 0:l.results)&&l.results.length>0;return o.jsxs("div",{className:"space-y-3 text-sm",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold bg-blue-500/15 text-blue-300",children:"Transition"}),o.jsx("button",{onClick:f,className:"p-1 rounded text-text-muted hover:text-accent-error text-xs",children:"Delete"})]}),o.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-text-secondary",children:[o.jsx("span",{className:"font-medium text-text-primary",children:e}),o.jsx("svg",{className:"w-3.5 h-3.5 shrink-0 text-text-muted",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M14 5l7 7m0 0l-7 7m7-7H3"})}),o.jsx("span",{className:"font-medium text-text-primary",children:r})]}),o.jsxs("div",{children:[o.jsx("label",{className:rn,children:"Condition"}),o.jsx("select",{value:i.type,onChange:p=>{u(p.target.value==="step_result"?{type:"step_result",result:"success"}:{type:p.target.value})},className:Li,children:f0.map(p=>o.jsx("option",{value:p.value,children:p.label},p.value))})]}),i.type==="step_result"&&o.jsxs("div",{children:[o.jsx("label",{className:rn,children:"Result"}),d?o.jsx("select",{value:i.result??l.results[0],onChange:p=>{u({type:"step_result",result:p.target.value})},className:Li,children:l.results.map(p=>o.jsx("option",{value:p,children:p},p))}):o.jsx("input",{type:"text",value:i.result??"success",onChange:p=>u({type:"step_result",result:p.target.value}),placeholder:"e.g. success, passed, failed",className:Kn})]}),o.jsx("p",{className:"text-text-muted text-[10px]",children:"Drag handles to reconnect. Press Delete to remove."})]})}function Zd({variables:e,onInsert:r}){return e.length===0?null:o.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:e.map(i=>o.jsx("button",{type:"button",onClick:()=>r(i.name),title:i.description,className:"px-1.5 py-0.5 rounded text-[10px] font-mono bg-bg-primary border border-border text-text-secondary hover:text-accent-primary hover:border-accent-primary/40 transition-colors",children:`{{${i.name}}}`},i.name))})}function XT({step:e,isEntry:r,agentTypes:i,transitionCount:s,templateVariables:c,onUpdate:u,onRemove:f,onSetEntry:l}){const{color:d,name:p}=lf(e,i);return o.jsxs("div",{className:"space-y-3 text-sm",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold",style:{backgroundColor:d+"20",color:d},children:p}),r&&o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold bg-accent-primary/15 text-accent-primary",children:"Entry"})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[!r&&o.jsx("button",{onClick:l,className:"p-1 rounded text-text-muted hover:text-accent-primary text-xs",children:"Set entry"}),o.jsx("button",{onClick:f,className:"p-1 rounded text-text-muted hover:text-accent-error text-xs",children:"Delete"})]})]}),o.jsxs("div",{children:[o.jsx("label",{className:rn,children:"Type"}),o.jsx("select",{value:e.type,onChange:g=>{const m=g.target.value,y=m==="sub_agent"?"verification":"build";if(m==="agent"){const _=i.find(k=>!k.subagent);u({...e,type:m,phase:y,toolMode:(_==null?void 0:_.id)??"builder",name:(_==null?void 0:_.name)??"Agent"})}else if(m==="sub_agent"){const _=i.find(k=>k.subagent);u({...e,type:m,phase:y,subAgentType:(_==null?void 0:_.id)??"",name:(_==null?void 0:_.name)??"Sub-Agent"})}else u({...e,type:m,phase:y,name:"Shell"})},className:Li,children:GT.map(g=>o.jsx("option",{value:g.value,children:g.label},g.value))})]}),e.type==="agent"&&o.jsxs("div",{children:[o.jsx("label",{className:rn,children:"Agent Type"}),o.jsx("select",{value:e.toolMode??"builder",onChange:g=>{const m=i.find(y=>y.id===g.target.value);u({...e,toolMode:g.target.value,name:(m==null?void 0:m.name)??g.target.value})},className:Li,children:i.filter(g=>!g.subagent).map(g=>o.jsx("option",{value:g.id,children:g.name},g.id))})]}),e.type==="sub_agent"&&o.jsxs("div",{children:[o.jsx("label",{className:rn,children:"Sub-Agent Type"}),o.jsxs("select",{value:e.subAgentType??"",onChange:g=>{const m=i.find(y=>y.id===g.target.value);u({...e,subAgentType:g.target.value,name:(m==null?void 0:m.name)??g.target.value})},className:Li,children:[o.jsx("option",{value:"",children:"— select —"}),i.filter(g=>g.subagent).map(g=>o.jsx("option",{value:g.id,children:g.name},g.id))]})]}),(e.type==="agent"||e.type==="sub_agent")&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("label",{className:rn,children:"Prompt"}),o.jsx("textarea",{value:e.prompt??"",onChange:g=>u({...e,prompt:g.target.value||void 0}),rows:6,className:`${Kn} resize-y text-xs`,placeholder:"Injected on first entry..."}),o.jsx(Zd,{variables:c,onInsert:g=>u({...e,prompt:(e.prompt??"")+`{{${g}}}`})})]}),o.jsxs("div",{children:[o.jsx("label",{className:rn,children:"Nudge Prompt"}),o.jsx("textarea",{value:e.nudgePrompt??"",onChange:g=>u({...e,nudgePrompt:g.target.value||void 0}),rows:6,className:`${Kn} resize-y text-xs`,placeholder:"Injected on re-entry..."}),o.jsx(Zd,{variables:c,onInsert:g=>u({...e,nudgePrompt:(e.nudgePrompt??"")+`{{${g}}}`})})]})]}),e.type==="shell"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("label",{className:rn,children:"Command"}),o.jsx("textarea",{value:e.command??"",onChange:g=>u({...e,command:g.target.value}),rows:3,className:`${Kn} font-mono text-xs resize-y`,placeholder:"cd {{workdir}} && npm run lint"}),o.jsx(Zd,{variables:c,onInsert:g=>u({...e,command:(e.command??"")+`{{${g}}}`})})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{children:[o.jsx("label",{className:rn,children:"Timeout (ms)"}),o.jsx("input",{type:"number",value:e.timeout??6e4,onChange:g=>u({...e,timeout:Number(g.target.value)}),className:`${Kn} font-mono text-xs`})]}),o.jsxs("div",{children:[o.jsx("label",{className:rn,children:"Success Codes"}),o.jsx("input",{value:(e.successExitCodes??[0]).join(", "),onChange:g=>u({...e,successExitCodes:g.target.value.split(",").map(m=>Number(m.trim())).filter(m=>!isNaN(m))}),className:`${Kn} font-mono text-xs`})]})]})]}),o.jsx("div",{className:"pt-1 border-t border-border/50",children:o.jsxs("p",{className:"text-text-muted text-[10px]",children:[s," outgoing transition",s!==1?"s":""," — drag from the bottom port to connect."]})})]})}const eb=[];function p0({isOpen:e,onClose:r,initialEditId:i}){const s=Dt(fe=>fe.defaults),c=Dt(fe=>fe.userItems),u=Dt(fe=>fe.loading),f=Dt(fe=>fe.templateVariables),l=Dt(fe=>fe.fetchWorkflows),d=Dt(fe=>fe.fetchWorkflow),p=Dt(fe=>fe.fetchDefaultContent),g=Dt(fe=>fe.fetchTemplateVariables),m=Dt(fe=>fe.createWorkflow),y=Dt(fe=>fe.updateWorkflow),_=Dt(fe=>fe.deleteWorkflow),{requestDelete:k,clearConfirm:C,isConfirming:v}=Sh(),[b,x]=P.useState("list"),[S,j]=P.useState(null),[A,N]=P.useState(!1),[D,T]=P.useState(null),[I,H]=P.useState(null),[V,Y]=P.useState(""),[q,O]=P.useState(""),[U,z]=P.useState(""),[X,Q]=P.useState("1.0.0"),[M,L]=P.useState("#3b82f6"),[B,W]=P.useState(""),[F,re]=P.useState(50),[Z,ee]=P.useState(eb),[K,$]=P.useState({type:"always"}),[ae,ne]=P.useState(""),[ve,be]=P.useState(!1),[Ae,Me]=P.useState([]),[Ie]=P.useState(null);P.useEffect(()=>{e&&(l(),g(),Ce("/api/agents").then(fe=>fe.json()).then(fe=>Me(fe.agents??[])).catch(()=>{}),T(null),H(null),i?s.some(ye=>ye.id===i)?p(i).then(ye=>{ye&&(Y(ye.metadata.name+" (copy)"),O(`${i}-copy-${Date.now()}`),z(ye.metadata.description),Q(ye.metadata.version),L(ye.metadata.color??"#3b82f6"),W(ye.entryStep),re(ye.settings.maxIterations),ee(ye.steps),$(ye.startCondition??{type:"always"}),ne(""),j(null),N(!1),x("edit"))}):d(i).then(ye=>{ye&&(Y(ye.metadata.name),O(ye.metadata.id),z(ye.metadata.description),Q(ye.metadata.version),L(ye.metadata.color??"#3b82f6"),W(ye.entryStep),re(ye.settings.maxIterations),ee(ye.steps),$(ye.startCondition??{type:"always"}),ne(""),j(i),N(!1),x("edit"))}):(x("list"),j(null),N(!1)))},[e,l,d,p,g,i]);const Fe=async fe=>{const ye=await d(fe);ye&&(j(fe),Y(ye.metadata.name),O(ye.metadata.id),z(ye.metadata.description),Q(ye.metadata.version),L(ye.metadata.color??"#3b82f6"),W(ye.entryStep),re(ye.settings.maxIterations),ee(ye.steps),$(ye.startCondition??{type:"always"}),ne(""),T(null),H(null),x("edit"))},ke=async()=>{var rt;const fe=S??q;if(!fe||!V)return ne("Name is required."),!1;if(Z.length===0)return ne("Add at least one step."),!1;let ye=B;if(!ye||!Z.some(Ue=>Ue.id===ye)){if(ye=((rt=Z.find(Ue=>Ue.id))==null?void 0:rt.id)??"",!ye)return ne("All steps need an ID."),!1;W(ye)}be(!0),ne("");const we={metadata:{id:fe,name:V,description:U,version:X||"1.0.0",color:M},entryStep:ye,settings:{maxIterations:F},steps:Z,startCondition:K},Ye=S?await y(S,we):await m(we);return be(!1),Ye.success?(S||j(fe),!0):(ne(Ye.error??"Failed to save."),!1)},ge=async()=>{await ke()},je=async()=>{await ke()&&(i?r():x("list"))},We=()=>{i?r():x("list")},Lt=fe=>{Y(fe),S||O(qT(fe))},pe=async fe=>{if(s.some(we=>we.id===fe)){const we=await p(fe);if(!we)return;Y(we.metadata.name),O(we.metadata.id),z(we.metadata.description),Q(we.metadata.version),L(we.metadata.color??"#3b82f6"),W(we.entryStep),re(we.settings.maxIterations),ee(we.steps),$(we.startCondition??{type:"always"}),ne(""),j(fe),N(!0)}else{const we=await d(fe);if(!we)return;Y(we.metadata.name),O(we.metadata.id),z(we.metadata.description),Q(we.metadata.version),L(we.metadata.color??"#3b82f6"),W(we.entryStep),re(we.settings.maxIterations),ee(we.steps),$(we.startCondition??{type:"always"}),ne(""),j(fe),N(!0)}x("edit")},Ne=async fe=>{const we=s.some(Ye=>Ye.id===fe)?await p(fe):await d(fe);we&&(Y(we.metadata.name+" (copy)"),O(`${fe}-copy-${Date.now()}`),z(we.metadata.description),Q(we.metadata.version),L(we.metadata.color??"#3b82f6"),W(we.entryStep),re(we.settings.maxIterations),ee(we.steps),$(we.startCondition??{type:"always"}),ne(""),j(null),N(!1),x("edit"))},Oe=()=>{j(null),Y(""),O(""),z(""),Q("1.0.0"),L("#3b82f6"),W(""),re(50),ee(structuredClone(eb)),$({type:"always"}),ne(""),T(null),H(null),N(!1),x("edit")},lt=async fe=>{await _(fe),C()},ue=P.useCallback(fe=>{T(fe),H(null)},[]),_e=P.useCallback(fe=>{H(fe),T(null)},[]),Te=D!==null?Number(D):-1,Be=Te>=0?Z[Te]??null:null,Ve=P.useCallback(fe=>{ee(ye=>ye.map((we,Ye)=>Ye===Te?fe:we))},[Te]),Ct=K.type==="step_result"?`${K.result}`:h0[K.type]??K.type,se=()=>{const fe=Z.length,ye=WT(Z),we=Ae.find(Ye=>!Ye.subagent);ee([...Z,{id:ye,name:(we==null?void 0:we.name)??"Agent",type:"agent",phase:"build",toolMode:(we==null?void 0:we.id)??"builder",transitions:[]}]),B||W(ye),ue(String(fe))},Le=P.useCallback((fe,ye)=>{fe==="$start"?(W(ye),_e("start")):ee(we=>{const Ye=we.find(Ue=>Ue.id===fe),rt=Ye?Ye.transitions.length:0;return _e(`${fe}:${rt}`),we.map(Ue=>Ue.id===fe?{...Ue,transitions:[...Ue.transitions,{when:{type:"always"},goto:ye}]}:Ue)})},[_e]),$e=P.useCallback((fe,ye)=>{if(fe==="start")W(ye);else{const we=fe.lastIndexOf(":"),Ye=fe.slice(0,we),rt=parseInt(fe.slice(we+1));ee(Ue=>Ue.map(Zt=>Zt.id===Ye?{...Zt,transitions:Zt.transitions.map((Mt,$t)=>$t===rt?{...Mt,goto:ye}:Mt)}:Zt))}},[]),at=P.useCallback((fe,ye)=>{const we=fe.lastIndexOf(":"),Ye=fe.slice(0,we),rt=parseInt(fe.slice(we+1));ee(Ue=>{const Zt=Ue.find($t=>$t.id===Ye);if(!Zt)return Ue;const Mt=Zt.transitions[rt];return Mt?Ue.map($t=>$t.id===Ye?{...$t,transitions:$t.transitions.filter((Hi,ac)=>ac!==rt)}:$t.id===ye?{...$t,transitions:[...$t.transitions,Mt]}:$t):Ue}),H(null)},[]),qe=P.useCallback(fe=>{if(fe==="start")W("");else{const ye=fe.lastIndexOf(":"),we=fe.slice(0,ye),Ye=parseInt(fe.slice(ye+1));ee(rt=>rt.map(Ue=>Ue.id===we?{...Ue,transitions:Ue.transitions.filter((Zt,Mt)=>Mt!==Ye)}:Ue))}H(null)},[]),Ut=P.useCallback((fe,ye)=>{if(fe==="start")$(ye);else{const we=fe.lastIndexOf(":"),Ye=fe.slice(0,we),rt=parseInt(fe.slice(we+1));ee(Ue=>Ue.map(Zt=>Zt.id===Ye?{...Zt,transitions:Zt.transitions.map((Mt,$t)=>$t===rt?{...Mt,when:ye}:Mt)}:Zt))}},[]),Rt=fe=>lf(fe,Ae).name,oi=()=>{if(!I)return null;if(I==="start"){const Mt=Z.find($t=>$t.id===B);return{type:"start",fromLabel:"Start",toLabel:Mt?Rt(Mt):"(none)",condition:K}}const fe=I.lastIndexOf(":"),ye=I.slice(0,fe),we=parseInt(I.slice(fe+1)),Ye=Z.find(Mt=>Mt.id===ye);if(!Ye)return null;const rt=Ye.transitions[we];if(!rt)return null;const Ue=Z.find(Mt=>Mt.id===rt.goto),Zt=rt.goto==="$done"?"Done":Ue?Rt(Ue):rt.goto;return{type:"step",fromLabel:Rt(Ye),toLabel:Zt,condition:rt.when}};if(b==="edit"){const fe=oi();return o.jsxs(ln,{isOpen:e,onClose:We,title:A?V:S?"Edit Workflow":"New Workflow",size:"full",children:[ae&&o.jsx("div",{className:"text-accent-error text-sm px-3 py-2 bg-accent-error/10 rounded mb-3",children:ae}),o.jsxs("div",{className:"flex items-end gap-3 mb-3 pb-3 border-b border-border flex-wrap",children:[o.jsxs("div",{className:"min-w-[140px]",children:[o.jsx("label",{className:rn,children:"Name"}),o.jsx("input",{value:V,onChange:ye=>Lt(ye.target.value),placeholder:"Workflow name",className:`${Kn} ${A?"opacity-50":""}`,readOnly:A})]}),o.jsxs("div",{className:"min-w-[100px]",children:[o.jsx("label",{className:rn,children:"ID"}),o.jsx("input",{value:q,readOnly:!0,className:`${Kn} font-mono opacity-50`})]}),o.jsxs("div",{className:"flex-1 min-w-[140px]",children:[o.jsx("label",{className:rn,children:"Description"}),o.jsx("input",{value:U,onChange:ye=>!A&&z(ye.target.value),readOnly:A,placeholder:"What does this workflow do?",className:`${Kn} ${A?"opacity-50":""}`})]}),o.jsxs("div",{className:"w-20",children:[o.jsx("label",{className:rn,children:"Max Iter."}),o.jsx("input",{type:"number",value:F,onChange:ye=>!A&&re(Number(ye.target.value)),readOnly:A,className:`${Kn} font-mono ${A?"opacity-50":""}`})]}),o.jsxs("div",{children:[o.jsx("label",{className:rn,children:"Color"}),o.jsx("input",{type:"color",value:M,onChange:ye=>!A&&L(ye.target.value),disabled:A,className:`w-8 h-8 rounded border border-border bg-transparent ${A?"opacity-50":"cursor-pointer"}`})]})]}),o.jsxs("div",{className:"flex gap-3",style:{height:"calc(90vh - 220px)",minHeight:300},children:[o.jsxs("div",{className:"flex-1 min-w-0 bg-bg-primary/50 border border-border rounded-lg flex flex-col overflow-hidden",children:[o.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-border/50 shrink-0",children:[o.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider font-medium",children:"Flow"}),!A&&o.jsx("button",{onClick:se,className:"text-[11px] text-accent-primary hover:text-accent-primary/80",children:"+ Add Step"})]}),o.jsxs("div",{className:"flex-1 min-h-0 p-2 overflow-auto",children:[o.jsx(YT,{steps:Z,entryStep:B,selectedNodeId:(Be==null?void 0:Be.id)??null,selectedEdgeKey:I,startConditionLabel:Ct,agentTypes:Ae,isReadOnly:A,onSelectNode:ye=>{if(ye===null){ue(null);return}const we=Z.findIndex(Ye=>Ye.id===ye);ue(we>=0?String(we):null)},onSelectEdge:_e,onRemoveStep:ye=>{var Ye;const we=Z.findIndex(rt=>rt.id===ye);if(ee(rt=>rt.filter(Ue=>Ue.id!==ye)),Te===we&&ue(null),B===ye){const rt=Z.filter(Ue=>Ue.id!==ye);W(((Ye=rt[0])==null?void 0:Ye.id)??"")}},onCreateTransition:Le,onReconnectTo:$e,onReconnectFrom:at,onDeleteTransition:qe}),Z.length===0&&o.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-text-muted",children:[o.jsx("p",{className:"text-xs mb-2",children:"No steps yet"}),o.jsx("button",{onClick:se,className:"px-3 py-1.5 rounded bg-accent-primary/10 text-accent-primary text-xs hover:bg-accent-primary/20",children:"+ Add your first step"})]})]})]}),o.jsxs("div",{className:"w-[300px] shrink-0 border border-border rounded-lg bg-bg-secondary flex flex-col overflow-hidden",children:[o.jsx("div",{className:"px-3 py-1.5 border-b border-border shrink-0",children:o.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider font-medium",children:"Properties"})}),o.jsx("div",{className:"p-3 overflow-y-auto flex-1 min-h-0",children:A&&(fe||Be)?o.jsx("p",{className:"text-text-muted text-xs text-center py-8",children:'View only — click "Duplicate & Customize" to edit.'}):fe?fe.type==="start"?o.jsxs("div",{className:"space-y-3 text-sm",children:[o.jsx("div",{className:"flex items-center gap-2",children:o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold bg-blue-500/20 text-blue-300",children:"Start"})}),B&&o.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-text-secondary",children:[o.jsx("span",{className:"text-text-primary font-medium",children:"Start"}),o.jsx("svg",{className:"w-3.5 h-3.5 shrink-0 text-text-muted",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M14 5l7 7m0 0l-7 7m7-7H3"})}),o.jsx("span",{className:"text-text-primary font-medium",children:fe.toLabel})]}),o.jsxs("div",{children:[o.jsx("label",{className:rn,children:"Activation Condition"}),o.jsx("select",{value:K.type,onChange:ye=>$(ye.target.value==="step_result"?{type:"step_result",result:"success"}:{type:ye.target.value}),className:Li,children:f0.map(ye=>o.jsx("option",{value:ye.value,children:ye.label},ye.value))})]}),K.type==="step_result"&&o.jsxs("div",{children:[o.jsx("label",{className:rn,children:"Result"}),B&&(()=>{const ye=Z.find(Ue=>Ue.id===B),we=ye&&(ye.type==="sub_agent"||ye.type==="agent")?Ae.find(Ue=>Ue.id===(ye.type==="sub_agent"?ye.subAgentType:ye.toolMode)):void 0,Ye=(we==null?void 0:we.results)&&we.results.length>0,rt=(we==null?void 0:we.results)??[];return Ye?o.jsx("select",{value:K.result??rt[0],onChange:Ue=>$({type:"step_result",result:Ue.target.value}),className:Li,children:rt.map(Ue=>o.jsx("option",{value:Ue,children:Ue},Ue))}):o.jsx("input",{type:"text",value:K.result??"success",onChange:Ue=>$({type:"step_result",result:Ue.target.value}),placeholder:"e.g. success, passed, failed",className:Kn})})()]}),o.jsx("p",{className:"text-text-muted text-[10px]",children:"Workflow only proceeds when this condition is met. Drag the target handle to change entry step."})]}):o.jsx(KT,{fromLabel:fe.fromLabel,toLabel:fe.toLabel,condition:fe.condition,fromStep:fe.type==="step"?Z.find(ye=>ye.id===fe.fromLabel):void 0,agentTypes:Ae,onUpdateCondition:ye=>Ut(I,ye),onDelete:()=>qe(I)}):Be?o.jsx(XT,{step:Be,isEntry:Be.id===B,agentTypes:Ae,transitionCount:Be.transitions.length,templateVariables:f,onUpdate:Ve,onRemove:()=>{var ye;if(Be&&(ee(Z.filter((we,Ye)=>Ye!==Te)),ue(null),B===Be.id)){const we=Z.filter((Ye,rt)=>rt!==Te);W(((ye=we[0])==null?void 0:ye.id)??"")}},onSetEntry:()=>W(Be.id)}):o.jsxs("p",{className:"text-text-muted text-xs text-center py-8",children:["Click a node or edge to edit.",o.jsx("br",{}),"Drag from a port to connect."]})})]})]}),o.jsxs("div",{className:"flex justify-end gap-2 pt-3 mt-3 border-t border-border",children:[o.jsx(st,{variant:"secondary",onClick:We,children:"Close"}),A?o.jsx(st,{variant:"primary",onClick:()=>{Y(V+" (copy)"),O(`${S}-copy-${Date.now()}`),j(null),N(!1)},children:"Duplicate & Customize"}):o.jsxs(o.Fragment,{children:[o.jsx(st,{variant:"secondary",onClick:ge,disabled:ve||!V,children:ve?"Saving...":"Save"}),o.jsx(st,{variant:"primary",onClick:je,disabled:ve||!V,children:"Save & Close"})]})]})]})}return o.jsxs(ln,{isOpen:e,onClose:r,title:"Workflows",size:"lg",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsx("p",{className:"text-text-secondary text-sm",children:"Workflows define the orchestrator's step sequence when running tasks."}),o.jsx("div",{className:"flex items-center gap-2 flex-shrink-0 ml-3",children:o.jsx(st,{variant:"primary",size:"sm",onClick:Oe,children:"+ New"})})]}),u&&s.length===0&&c.length===0?o.jsx("div",{className:"text-text-muted text-sm",children:"Loading workflows..."}):s.length===0&&c.length===0?o.jsx("div",{className:"text-text-muted text-sm",children:"No workflows installed."}):o.jsxs("div",{className:"space-y-4",children:[s.length>0&&o.jsxs("div",{children:[o.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Built-in"}),o.jsx("div",{className:"space-y-2",children:s.map(fe=>o.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[o.jsxs("div",{className:"min-w-0 flex-1 mr-3",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-text-primary text-sm font-medium",children:fe.name}),o.jsxs("span",{className:"text-text-muted text-xs",children:["v",fe.version]})]}),o.jsx("p",{className:"text-text-secondary text-xs mt-0.5 truncate",children:fe.description})]}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[o.jsx("button",{onClick:()=>pe(fe.id),className:"p-1.5 rounded text-text-muted hover:text-text-primary hover:bg-bg-primary transition-colors",title:"View",children:o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})})}),o.jsx(Wa,{onClick:()=>Ne(fe.id)})]})]},fe.id))})]}),c.length>0&&o.jsxs("div",{children:[o.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Custom"}),o.jsx("div",{className:"space-y-2",children:c.map(fe=>o.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[o.jsxs("div",{className:"min-w-0 flex-1 mr-3",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-text-primary text-sm font-medium",children:fe.name}),o.jsxs("span",{className:"text-text-muted text-xs",children:["v",fe.version]})]}),o.jsx("p",{className:"text-text-secondary text-xs mt-0.5 truncate",children:fe.description})]}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[o.jsx(Wa,{onClick:()=>Ne(fe.id)}),o.jsx(Mi,{onClick:()=>Fe(fe.id)}),v(fe.id,"delete")?o.jsx(wh,{onConfirm:()=>lt(fe.id),onCancel:()=>{}}):o.jsx(Ch,{onClick:()=>k(fe.id)})]})]},fe.id))})]})]})]})}function ZT(e,r){const i=e.startCondition;if(!i||i.type==="always")return!0;switch(i.type){case"has_pending_criteria":return r.some(s=>s.status.type!=="passed");case"all_criteria_passed":return r.length===0||r.every(s=>s.status.type==="passed");case"all_criteria_completed_or_passed":return r.every(s=>s.status.type==="completed"||s.status.type==="passed");case"any_criteria_blocked":return r.some(s=>s.status.type==="failed"&&s.attempts.filter(c=>c.status==="failed").length>=4);case"step_result":return null;default:return null}}function QT({onSelectWorkflow:e,onOpenManager:r,criteria:i}){const[s,c]=P.useState(!1),[u,f]=P.useState(null),l=Dt(N=>N.defaults),d=Dt(N=>N.userItems),p=Dt(N=>N.fetchWorkflows),g=[...l,...d],{isOpen:m,search:y,selectedIndex:_,filtered:k,containerRef:C,searchRef:v,handleToggle:b,handleSearchChange:x,handleKeyDown:S}=a0({items:g,isOpen:s,onOpen:()=>c(!0),onClose:()=>c(!1),filterFn:(N,D)=>!D||N.name.toLowerCase().includes(D.toLowerCase())});P.useEffect(()=>{s&&p()},[s,p]);const j=N=>{e(N),c(!1)},A=()=>{c(!1),r()};return o.jsxs("div",{ref:C,className:"relative",children:[o.jsx(o0,{label:"Workflows",isOpen:m,onClick:b}),m&&o.jsxs("div",{className:"absolute bottom-full right-0 mb-1 w-72 bg-bg-secondary border border-border rounded-lg shadow-xl z-50",onKeyDown:S,children:[o.jsx(l0,{value:y,onChange:x,onKeyDown:S,ref:v,placeholder:"Search workflows..."}),o.jsx(c0,{children:k.length===0?o.jsx(u0,{hasItems:g.length>0,message:"No workflows yet"}):k.map((N,D)=>{const T=ZT(N,i),I=N.color??"#3b82f6";return o.jsxs("div",{className:`flex items-center gap-2 px-3 py-2 rounded transition-colors group ${D===_?"bg-accent-primary/20":"hover:bg-bg-tertiary"}`,children:[o.jsxs("button",{type:"button",onClick:()=>j(N.id),className:"flex-1 text-left flex items-center gap-2",children:[o.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{backgroundColor:I}}),o.jsx("span",{className:"text-sm text-text-primary font-medium flex-1",children:N.name}),T!==null&&o.jsx("span",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0",style:{backgroundColor:T?"#22c55e":"#6b7280"},title:T?"Entry condition met":"Entry condition not met"})]}),o.jsx(Mi,{className:"opacity-0 group-hover:opacity-100",onClick:H=>{H.stopPropagation(),c(!1),f(N.id)}})]},N.id)})}),o.jsx(d0,{label:"Manage Workflows...",onClick:A})]}),o.jsx(p0,{isOpen:!!u,onClose:()=>f(null),initialEditId:u})]})}function JT(e){return e==="criterion"}function eA(e){var r,i;return e.role!=="assistant"||e.subAgentId||(r=e.content)!=null&&r.trim()||(i=e.thinkingContent)!=null&&i.trim()||!e.toolCalls||e.toolCalls.length===0?!1:e.toolCalls.every(s=>JT(s.name))}function tA(e,r=[]){const i=[];let s=null,c=[],u,f=1;const l=new Map,d=new Map,p=[];for(const _ of r)_.type==="message"?l.set(_.message.id,_):_.type==="subagent"?d.set(_.subAgentId,_):_.type==="criteria-batch"&&p.push(_);let g=0;const m=()=>{if(c.length>0){const _=p[g];_&&_.type==="criteria-batch"&&_.toolCalls.length===c.length&&_.toolCalls.every((C,v)=>{var b;return C.id===((b=c[v])==null?void 0:b.id)})?i.push(_):i.push({type:"criteria-batch",toolCalls:[...c]}),g++,c=[]}},y=()=>{if(!s)return;const _=s,k=d.get(_.subAgentId);k&&k.type==="subagent"&&k.messages.length===_.messages.length&&k.messages.every((v,b)=>v===_.messages[b])?i.push(k):i.push({type:"subagent",subAgentId:_.subAgentId,subAgentType:_.subAgentType,messages:_.messages}),s=null};for(const _ of e)if(_.role!=="tool"){if(_.contextWindowId&&u&&_.contextWindowId!==u&&(m(),y(),f++,i.push({type:"context-divider",windowSequence:f})),u=_.contextWindowId,eA(_)){y();for(const k of _.toolCalls)c.push(k);continue}if(m(),_.subAgentId&&_.subAgentType)s&&s.subAgentId===_.subAgentId?s.messages.push(_):(y(),s={subAgentId:_.subAgentId,subAgentType:_.subAgentType,messages:[_]});else{y();const k=l.get(_.id);k&&k.type==="message"&&k.message===_?i.push(k):i.push({type:"message",message:_})}}return m(),y(),i}function nA(e){const{year:r,month:i,day:s}=jb(e);return`${r}/${i}/${s} ${Gl(e)}`}function rA(e,r){return e.length<=r?e:e.substring(0,r)+"..."}const iA=10,sA=150;function aA(e){const r=[];if(e.recentUserPrompts)for(const i of e.recentUserPrompts)r.push({id:i.id,content:i.content,timestamp:i.timestamp,sessionId:e.id,sessionName:e.title||e.id});return r}function oA(e){return[...e].sort((s,c)=>new Date(c.timestamp).getTime()-new Date(s.timestamp).getTime()).slice(0,iA).reverse().map(s=>({id:s.id,content:s.content,timestamp:s.timestamp,formattedTimestamp:nA(s.timestamp),trimmedContent:rA(s.content,sA),sessionId:s.sessionId,sessionName:s.sessionName}))}function lA(e,r,i){const s=[],c=e.filter(u=>u.role==="user"&&!u.isSystemGenerated&&u.messageKind!=="auto-prompt");for(const u of c)s.push({id:u.id,content:u.content,timestamp:u.timestamp,sessionId:i??"",sessionName:"This session"});for(const u of r)i&&u.id===i||s.push(...aA(u));return oA(s)}function cA(e,r=[],i=null){const[s,c]=P.useState(0),[u,f]=P.useState(!1),l=P.useMemo(()=>lA(e,r,i),[e,r,i]),d=P.useCallback(()=>{l.length>0&&(c(l.length-1),f(!0))},[l.length]),p=P.useCallback(()=>{f(!1),c(0)},[]),g=P.useCallback(()=>{c(_=>l.length===0?_:_===0?l.length-1:_-1)},[l.length]),m=P.useCallback(()=>{c(_=>l.length===0?_:_===l.length-1?0:_+1)},[l.length]),y=P.useCallback(()=>{if(l.length===0||!u)return null;const _=l[s];return(_==null?void 0:_.content)??null},[l,s,u]);return{history:l,selectedIndex:s,showHistory:u,openHistory:d,closeHistory:p,navigateUp:g,navigateDown:m,selectCurrent:y}}function uA({criteriaSidebarOpen:e,onCriteriaSidebarToggle:r}={}){const i=e??!0,[s,c]=P.useState(""),[u,f]=P.useState([]),[l,d]=P.useState(!1),[p,g]=P.useState(null),[m,y]=P.useState(!1),[_,k]=P.useState(!1),C=P.useRef(null),v=P.useRef(null),b=P.useRef(null),x=Ee(se=>se.currentSession),S=Ee(se=>se.messages),j=Ee(se=>se.streamingMessage),A=Ee(se=>se.sessions),N=Ee(se=>se.error),D=Ee(se=>se.pendingQuestion),T=vb(),I=Ee(se=>se.sendMessage),H=Ee(se=>se.clearError),V=Ee(se=>se.acceptAndBuild),Y=Ee(se=>se.stopGeneration),q=Ee(se=>se.launchRunner),O=Ee(se=>se.cancelQueued),U=MS(),z=Dt(se=>se.defaults),X=Dt(se=>se.userItems),Q=[...z,...X],M=Dt(se=>se.fetchWorkflows);P.useEffect(()=>{M()},[M]);const{history:L,selectedIndex:B,showHistory:W,openHistory:F,closeHistory:re,navigateUp:Z,navigateDown:ee,selectCurrent:K}=cA(S,A,x==null?void 0:x.id),$=P.useMemo(()=>j?S.map(se=>se.id===j.id?j:se):S,[S,j]),ae=P.useRef([]),ne=P.useMemo(()=>{const se=tA($,ae.current);return ae.current=se,se},[$]),ve=P.useMemo(()=>BT(S),[S]),{force_scroll_to_bottom:be,isAutoScrollActive:Ae,setAutoScroll:Me}=r0(C,x),Ie=P.useCallback(()=>{const se=v.current;if(!se)return;se.style.height="auto";const Le=Math.min(200,se.scrollHeight);se.style.height=`${Le}px`},[]);P.useEffect(()=>{if(!(x!=null&&x.id))return;const se=`openfox:draft:${x.id}`,Le=localStorage.getItem(se);Le!==null&&c(Le)},[x==null?void 0:x.id]),P.useEffect(()=>{var se;(se=v.current)==null||se.focus(),Ie()},[x==null?void 0:x.id,Ie]),P.useEffect(()=>{if(!(x!=null&&x.id))return;const se=`openfox:draft:${x.id}`,Le=setTimeout(()=>{s?localStorage.setItem(se,s):localStorage.removeItem(se)},500);return()=>clearTimeout(Le)},[x==null?void 0:x.id,s]),P.useEffect(()=>{Ie()},[s,Ie]),P.useEffect(()=>{const se=Le=>{Le.key==="Escape"&&T&&Y(),Le.key==="ScrollLock"&&Me(!Ae)};return window.addEventListener("keydown",se),()=>window.removeEventListener("keydown",se)},[T,Y,Ae]),P.useEffect(()=>{const se=v.current;if(!se)return;const Le=async $e=>{var qe;if(document.activeElement!==se)return;const at=(qe=$e.clipboardData)==null?void 0:qe.items;if(at){for(const Ut of Array.from(at))if(Ut.type.startsWith("image/")){$e.preventDefault();const Rt=Ut.getAsFile();if(!Rt)continue;await Xd(Rt,oi=>f(fe=>[...fe,oi]),g,{filename:"pasted-image"})}}};return se.addEventListener("paste",Le),()=>se.removeEventListener("paste",Le)},[]);const Fe=()=>{c(""),f([]),x!=null&&x.id&&localStorage.removeItem(`openfox:draft:${x.id}`)},ke=async se=>{se.preventDefault(),!(!s.trim()&&u.length===0)&&(be(),I(s,u.length>0?u:void 0),Fe())},ge=se=>{if(W)switch(se.key){case"Enter":se.preventDefault();const Le=K();Le&&(c(Le),re());return;case"Escape":se.preventDefault(),re(),T&&Y();return;case"ArrowUp":se.preventDefault(),Z();return;case"ArrowDown":se.preventDefault(),ee();return}if(se.key==="ArrowUp"&&s.trim()===""&&!W){se.preventDefault(),F();return}se.key==="Enter"&&!se.shiftKey&&(se.preventDefault(),ke(se))},je=P.useCallback(async se=>{const Le=se.target.files;if(!(!Le||Le.length===0)){g(null);for(const $e of Array.from(Le))await Xd($e,at=>f(qe=>[...qe,at]),g);b.current&&(b.current.value="")}},[]),We=P.useCallback(se=>{se.preventDefault(),se.stopPropagation(),d(!0)},[]),Lt=P.useCallback(se=>{se.preventDefault(),se.stopPropagation(),d(!1)},[]),pe=P.useCallback(async se=>{se.preventDefault(),se.stopPropagation(),d(!1),g(null);const Le=se.dataTransfer.files;if(!(!Le||Le.length===0))for(const $e of Array.from(Le))await Xd($e,at=>f(qe=>[...qe,at]),g)},[]),Ne=P.useCallback(se=>{f(Le=>Le.filter($e=>$e.id!==se))},[]),Oe=P.useCallback(()=>{var se;(se=b.current)==null||se.click()},[]),lt=(x==null?void 0:x.mode)==="planner",ue=(x==null?void 0:x.mode)==="builder",_e=((x==null?void 0:x.criteria.length)??0)>0,Te=(x==null?void 0:x.phase)==="done",Be=ne.some(se=>se.type==="message"&&se.message.role==="assistant"),Ve=lt&&_e&&!T&&Be&&!Te,Ct=se=>{const Le=s.trim()?s:void 0,$e=u.length>0?u:void 0;lt?V(se,Le,$e):ue&&q(Le,$e,se),Fe()};return o.jsxs(t2,{criteriaSidebarOpen:i,onCriteriaSidebarToggle:r,messages:$,children:[D&&o.jsx(yT,{question:D}),o.jsx(i2,{}),o.jsx(_T,{}),o.jsxs("div",{ref:C,"data-testid":"chat-scroll-container",className:"flex-1 min-w-0 overflow-y-auto relative",children:[o.jsx("div",{className:"pt-4",children:ne.map((se,Le)=>{if(se.type==="context-divider")return o.jsxs("div",{className:"flex items-center gap-2 feed-item px-2 md:px-4",children:[o.jsx("div",{className:"flex-1 border-t border-border"}),o.jsx("span",{className:"text-[10px] text-text-muted font-medium px-2",children:"Earlier context summarized"}),o.jsx("div",{className:"flex-1 border-t border-border"})]},Le);if(se.type==="subagent"){const at=se.messages.some(qe=>qe.isStreaming);return o.jsx("div",{className:"px-2 md:px-4",children:o.jsx(pT,{messages:se.messages,subAgentType:se.subAgentType,subAgentId:se.subAgentId,isStreaming:at})},Le)}if(se.type==="criteria-batch")return o.jsx("div",{className:"feed-item px-2 md:px-4",children:o.jsx(t0,{toolCalls:se.toolCalls,criteria:x==null?void 0:x.criteria})},Le);const $e=se.message;return $e.role==="assistant"?o.jsx("div",{className:"px-2 md:px-4",children:o.jsx(af,{message:$e,showStats:!0})},Le):o.jsx("div",{className:"px-2 md:px-4",children:o.jsx(n0,{message:$e,isLastAssistantMessage:!1,promptContext:$e.role==="user"?ve[$e.id]:void 0})},Le)})}),o.jsxs("div",{className:"px-2 md:px-4 pb-4",children:[N&&o.jsx("div",{className:"feed-item bg-red-500/10 border border-red-500/50 rounded p-2",children:o.jsxs("div",{className:"flex items-start justify-between gap-2",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-red-400 text-sm font-medium",children:N.code}),o.jsx("div",{className:"text-red-300 text-xs mt-0.5",children:N.message})]}),o.jsx(Rs,{onClick:H,className:"text-red-400 hover:text-red-300 p-0.5",size:"sm"})]})}),Ve&&o.jsx("div",{className:"flex justify-center gap-2 feed-item flex-wrap",children:Q.map(se=>{const Le=se.color??"#3b82f6",$e=parseInt(Le.slice(1,3),16),at=parseInt(Le.slice(3,5),16),qe=parseInt(Le.slice(5,7),16),Ut=`rgba(${$e},${at},${qe},0.12)`,Rt=`rgba(${$e},${at},${qe},0.22)`,oi=`rgba(${$e},${at},${qe},0.25)`;return o.jsxs("button",{onClick:()=>V(se.id),className:"px-4 py-1.5 rounded text-sm font-medium transition-colors",style:{backgroundColor:Ut,color:Le,border:`1px solid ${oi}`},onMouseEnter:fe=>{fe.currentTarget.style.backgroundColor=Rt},onMouseLeave:fe=>{fe.currentTarget.style.backgroundColor=Ut},children:["▶ ",se.name]},se.id)})}),T&&o.jsx(ST,{})]})]}),o.jsxs("form",{onSubmit:ke,className:"relative p-2 md:p-4 border-t border-border bg-gradient-to-t from-bg-secondary/50 to-transparent",children:[o.jsxs("button",{type:"button",className:"absolute -top-8 right-2 md:right-4 text-sm text-text-muted hover:text-text-primary z-10 flex items-center gap-1.5",onClick:()=>Me(!Ae),children:[o.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${Ae?"bg-accent-success":"border border-text-muted"}`}),"live"]}),o.jsx("input",{ref:b,type:"file",accept:".png,.jpg,.jpeg,.gif",onChange:je,className:"hidden",multiple:!0}),p&&o.jsx("div",{className:"mb-2 p-2 bg-red-500/10 border border-red-500/50 rounded text-red-300 text-sm",children:p}),u.length>0&&o.jsx("div",{className:"mb-3 flex flex-wrap gap-2",children:u.map(se=>o.jsx(wT,{attachment:se,onRemove:Ne},se.id))}),W&&o.jsx(CT,{history:L,selectedIndex:B,onSelect:se=>{c(se),re()},onEscape:re,onNavigate:se=>{se==="up"?Z():ee()}}),U.length>0&&o.jsx("div",{className:"mb-2 flex flex-wrap gap-1.5",children:U.map(se=>o.jsxs("div",{className:`inline-flex items-center gap-1.5 px-2 py-1 rounded text-xs ${se.mode==="asap"?"bg-amber-500/15 text-amber-300 border border-amber-500/30":"bg-blue-500/15 text-blue-300 border border-blue-500/30"}`,children:[o.jsxs("span",{className:"font-medium",children:[se.mode==="asap"?"ASAP":"Queue",":"]}),o.jsx("span",{className:"truncate max-w-[200px]",children:se.content}),o.jsx(Rs,{onClick:()=>O(se.queueId),size:"sm"})]},se.queueId))}),o.jsxs("div",{className:`flex items-end gap-3 p-3 rounded border transition-colors ${l?"border-accent-primary/50 bg-accent-primary/10":"border-border bg-bg-tertiary/50"}`,onDragOver:We,onDragLeave:Lt,onDrop:pe,children:[o.jsx("button",{type:"button",onClick:Oe,className:"p-3 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Attach image file",children:o.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.172 7l-6.586 6.586a2 2 0 102.828 2.828l6.414-6.586a4 4 0 00-5.656-5.656l-6.415 6.585a6 6 0 108.486 8.486L20.5 13"})})}),o.jsx("textarea",{ref:v,value:s,onChange:se=>{c(se.target.value),W&&re()},onKeyDown:ge,placeholder:lt?"What would you like to build?":"Send a message...",className:"flex-1 bg-transparent text-sm placeholder:text-text-muted resize-none overflow-y-auto focus:outline-none",style:{minHeight:"24px",maxHeight:"200px"}}),o.jsxs("div",{className:"flex flex-col items-end gap-1",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx($T,{onSendCommand:(se,Le,$e,at)=>{var Ut;Le&&(x==null?void 0:x.mode)!==Le&&Ee.getState().switchMode(Le);const qe=$e&&$e.trim()?`${$e.trim()}
|
|
149
|
+
|
|
150
|
+
${se}`:se;(Ut=C.current)==null||Ut.scrollTo({top:C.current.scrollHeight,behavior:"smooth"}),I(qe,at!=null&&at.length?at:void 0,{messageKind:"command",isSystemGenerated:!0}),Fe()},onOpenManager:()=>y(!0),textareaContent:s,attachments:u.length>0?u:void 0}),o.jsx(QT,{onSelectWorkflow:Ct,onOpenManager:()=>k(!0),criteria:(x==null?void 0:x.criteria)??[]})]}),o.jsx("div",{className:"flex items-center gap-2",children:o.jsx("button",{type:"button",onClick:()=>{var se;!s.trim()&&u.length===0||((se=C.current)==null||se.scrollTo({top:C.current.scrollHeight,behavior:"smooth"}),I(s,u),Fe())},disabled:!s.trim()&&u.length===0,className:"px-4 py-1.5 rounded bg-accent-primary/20 text-sm text-accent-primary font-medium hover:bg-accent-primary/30 disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:"Send"})})]})]}),o.jsxs("div",{className:"mt-3 flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(vT,{}),o.jsx(bT,{})]}),o.jsx(HT,{})]})]}),o.jsx(s0,{isOpen:m,onClose:()=>y(!1)}),o.jsx(p0,{isOpen:_,onClose:()=>k(!1)})]})}P.memo(function({item:r}){const[i,s]=P.useState(!1);return r.type==="start"?o.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-amber-500/10 border border-amber-500/30 rounded text-amber-300 text-sm",children:[o.jsx("span",{className:"animate-pulse",children:"●"}),o.jsx("span",{children:"Delegating image to fallback vision model..."}),r.filename&&o.jsxs("span",{className:"text-amber-400/70",children:["(",r.filename,")"]})]}):o.jsxs("div",{className:"flex items-start gap-2 px-3 py-2 bg-accent-success/10 border border-accent-success/30 rounded",children:[o.jsx("span",{className:"text-accent-success",children:"✓"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("span",{className:"text-accent-success text-sm",children:"Image description done"}),o.jsx("button",{type:"button",onClick:()=>s(!i),className:"text-xs text-accent-primary hover:text-accent-primary/80 transition-colors",children:i?"Hide":"Show"})]}),i&&r.description&&o.jsx("div",{className:"mt-2 text-xs prose prose-invert prose-sm max-w-none",children:o.jsx(zi,{content:r.description})})]})]})});function tb({isOpen:e,isRetry:r,onSubmit:i,onCancel:s}){const[c,u]=P.useState(""),f=P.useRef(null);P.useEffect(()=>{e&&(u(""),setTimeout(()=>{var d;return(d=f.current)==null?void 0:d.focus()},100))},[e]);const l=d=>{d.preventDefault(),c.trim()&&i(c)};return o.jsx(ln,{isOpen:e,onClose:s,title:r?"Invalid Password":"Password Required",size:"sm",children:o.jsxs("form",{onSubmit:l,className:"space-y-4",children:[o.jsx("p",{className:"text-text-secondary text-sm",children:r?"The password you entered was incorrect. Please try again.":"This server requires a password to connect."}),o.jsx(Vl,{ref:f,type:"password",value:c,onChange:d=>u(d.target.value),placeholder:"Enter password",autoFocus:!0}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(st,{type:"button",variant:"secondary",onClick:s,children:"Cancel"}),o.jsx(st,{type:"submit",disabled:!c.trim(),children:r?"Try Again":"Connect"})]})]})})}const dA=[8e3,11434,8080],hA=[{name:"OpenCode Go",url:"https://opencode.ai/zen/go/v1",backend:"opencode-go"}];function nb(e){switch(e){case"vllm":return"vLLM";case"sglang":return"SGLang";case"ollama":return"Ollama";case"llamacpp":return"llama.cpp";case"openai":return"OpenAI";case"anthropic":return"Anthropic";case"opencode-go":return"OpenCode Go";case"auto":return"Auto";case"unknown":return"Unknown";default:return e}}function m0({size:e="md"}){const r=e==="sm"?"w-4 h-4":"w-6 h-6";return o.jsxs("svg",{className:`animate-spin ${r} text-text-muted`,fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}function fA(){return o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})})}function pA(){return o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})}function mA({currentStep:e,totalSteps:r,labels:i,onStepClick:s}){return o.jsx("div",{className:"flex justify-center py-6",children:o.jsx("div",{className:"flex items-center",children:Array.from({length:r},(c,u)=>{const f=u+1,l=f<e,d=f===e;return o.jsxs("div",{className:"flex items-center",children:[o.jsx("button",{onClick:()=>s==null?void 0:s(f),className:`size-8 rounded-full flex items-center justify-center text-sm font-medium transition-colors shrink-0 ${l?"bg-accent-primary text-white hover:opacity-80":d?"bg-accent-primary text-white":"bg-bg-tertiary text-text-muted"}`,children:l?"✓":f}),o.jsx("button",{onClick:()=>s==null?void 0:s(f),className:`ml-2 mr-4 text-sm whitespace-nowrap hidden sm:block ${d?"text-text-primary font-medium":"text-text-muted hover:text-text-secondary"}`,children:i[u]}),u<r-1&&o.jsx("div",{className:`w-12 sm:w-20 h-0.5 mr-4 ${l?"bg-accent-primary":"bg-border"}`})]},u)})})})}function gA({onNext:e}){const[r,i]=P.useState([]),[s,c]=P.useState([]),[u,f]=P.useState(!1),[l,d]=P.useState(""),[p,g]=P.useState(""),[m,y]=P.useState(""),[_,k]=P.useState("auto"),[C,v]=P.useState(!1),[b,x]=P.useState(null),[S,j]=P.useState(null),[A,N]=P.useState(null),[D,T]=P.useState("");P.useEffect(()=>{I()},[]);async function I(){try{const U=await Ce("/api/providers");if(U.ok){const X=(await U.json()).providers.map(Q=>({id:Q.id,name:Q.name,url:Q.url,backend:Q.backend,model:null,apiKey:Q.apiKey}));i(X),c(X)}}catch{}}async function H(U){v(!0),x(null);const z=_!=="auto";try{const Q=await(await Ce("/api/providers/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:U,skipBackendDetection:z})})).json();Q.success?(z||k(Q.backend??"auto"),x({success:!0,model:Q.model??void 0})):x({success:!1,error:Q.error??"Connection failed"})}catch(X){x({success:!1,error:X instanceof Error?X.message:"Connection failed"})}v(!1)}function V(){if(!p)return;const U=l||`Provider ${s.length+1}`,z={id:`temp-${Date.now()}`,name:U,url:p,backend:b!=null&&b.success?_:"auto",model:b!=null&&b.success?b.model??null:null,apiKey:m||void 0};c([...s,z]),d(""),g(""),y(""),x(null)}function Y(U){j(U),r.some(X=>X.id===U)?Ce(`/api/providers/${U}`,{method:"DELETE"}).then(()=>{c(s.filter(X=>X.id!==U)),i(r.filter(X=>X.id!==U)),j(null)}).catch(()=>{j(null)}):(c(s.filter(X=>X.id!==U)),j(null))}async function q(){for(const z of s)(z.id.startsWith("temp-")||!r.some(X=>X.id===z.id))&&((await Ce("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:z.name,url:z.url,backend:z.backend,model:z.model,apiKey:z.apiKey})})).ok||console.error("Failed to add provider",z));const U=s.filter(z=>!z.id.startsWith("temp-"));e({providers:U})}const O=s.length>0;return o.jsxs("div",{className:"max-w-xl mx-auto",children:[o.jsx("h2",{className:"text-2xl font-bold text-text-primary mb-2",children:"LLM Providers"}),o.jsx("p",{className:"text-text-secondary mb-8",children:"Manage your LLM server connections"}),o.jsxs("div",{className:"space-y-4",children:[s.length>0?o.jsx("div",{className:"space-y-2",children:s.map(U=>o.jsxs("div",{className:"flex items-center justify-between bg-bg-secondary rounded-lg p-4 border border-border",children:[o.jsxs("div",{className:"flex-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"px-2 py-0.5 bg-accent-primary/25 text-accent-primary rounded text-xs font-medium",children:nb(U.backend)}),A===U.id?o.jsx("input",{type:"text",value:D,onChange:z=>T(z.target.value),onKeyDown:z=>{z.key==="Enter"&&(c(s.map(X=>X.id===U.id?{...X,name:D}:X)),N(null)),z.key==="Escape"&&N(null)},onBlur:()=>{c(s.map(z=>z.id===U.id?{...z,name:D}:z)),N(null)},className:"px-2 py-0.5 bg-bg-primary border border-accent-primary rounded text-text-primary text-sm focus:outline-none",autoFocus:!0}):o.jsx("span",{className:"text-text-primary font-medium cursor-pointer hover:text-accent-primary",onClick:()=>{N(U.id),T(U.name)},title:"Click to edit",children:U.name})]}),o.jsx("p",{className:"text-text-muted text-sm mt-1",children:U.url}),U.model&&o.jsxs("p",{className:"text-text-secondary text-xs mt-0.5",children:["Model: ",U.model]})]}),o.jsx("button",{onClick:()=>Y(U.id),disabled:S===U.id,className:"p-2 text-text-muted hover:text-red-500 transition-colors disabled:opacity-50",title:"Remove provider",children:o.jsx(pA,{})})]},U.id))}):o.jsx("div",{className:"bg-bg-secondary rounded-lg p-8 text-center border border-border",children:o.jsx("p",{className:"text-text-muted",children:"No providers configured yet"})}),u?o.jsxs("form",{onSubmit:U=>{U.preventDefault(),p&&V()},className:"space-y-4 p-4 bg-bg-tertiary rounded-lg",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-2",children:"Service Presets"}),o.jsx("div",{className:"grid grid-cols-2 gap-2",children:hA.map(U=>o.jsx("button",{type:"button",onClick:()=>{d(U.name),g(U.url),k(U.backend),x(null)},className:`p-2 rounded border text-center text-sm transition-colors ${p===U.url?"border-accent-primary bg-accent-primary/10 text-accent-primary":"border-border hover:border-text-muted text-text-secondary"}`,children:U.name},U.name))})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-2",children:"Local Presets"}),o.jsx("div",{className:"grid grid-cols-3 gap-2",children:dA.map(U=>o.jsxs("button",{type:"button",onClick:()=>{d(""),g(`http://localhost:${U}`),k("auto"),x(null)},className:`p-2 rounded border text-center text-sm transition-colors ${p===`http://localhost:${U}`?"border-accent-primary bg-accent-primary/10 text-accent-primary":"border-border hover:border-text-muted text-text-secondary"}`,children:["localhost:",U]},U))})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Or enter address manually"}),o.jsx("input",{type:"text",name:"url",value:p,onChange:U=>{g(U.target.value),x(null)},onKeyDown:U=>{U.key==="Enter"&&(U.preventDefault(),H(p))},placeholder:"http://localhost:8000",className:"w-full px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Provider name (optional)"}),o.jsx("input",{type:"text",name:"name",value:l,onChange:U=>d(U.target.value),onKeyDown:U=>{U.key==="Enter"&&(U.preventDefault(),V())},placeholder:"My LLM Server",className:"w-full px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"API key (optional)"}),o.jsx("input",{type:"password",name:"apiKey",value:m,onChange:U=>y(U.target.value),placeholder:"sk-...",className:"w-full px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"})]}),b&&o.jsx("div",{className:`p-3 rounded-lg ${b.success?"bg-accent-primary/10":"bg-red-500/10"}`,children:b.success?o.jsxs("p",{className:"text-accent-primary font-medium",children:["✓ Connected to ",nb(_),b.model&&` (${b.model})`]}):o.jsx("p",{className:"text-red-500",children:b.error})}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("button",{type:"button",onClick:()=>H(p),disabled:!p||C,className:"flex-1 px-4 py-2 bg-bg-secondary border border-border rounded-lg hover:border-text-muted disabled:opacity-50",children:C?o.jsx(m0,{size:"sm"}):"Test Connection"}),o.jsx("button",{type:"submit",disabled:!p,className:"flex-1 px-4 py-2 bg-accent-primary text-white rounded-lg hover:bg-accent-primary/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors font-medium",children:b!=null&&b.success?"Add Provider ✓":"Add Provider"})]}),o.jsx("button",{type:"button",onClick:()=>{f(!1),d(""),g(""),x(null)},className:"w-full text-center text-text-muted hover:text-text-secondary text-sm",children:"Cancel"})]}):o.jsxs("button",{onClick:()=>f(!0),className:"w-full flex items-center justify-center gap-2 px-4 py-3 bg-bg-secondary border border-dashed border-border rounded-lg text-text-secondary hover:text-text-primary hover:border-text-muted transition-colors",children:[o.jsx(fA,{}),"Add Provider"]}),o.jsx("button",{onClick:q,disabled:!O,className:"w-full mt-6 px-6 py-3 bg-accent-primary text-white rounded-lg font-medium hover:bg-accent-primary/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Continue"})]})]})}function xA({onNext:e}){const[r,i]=P.useState(""),[s,c]=P.useState(!1);return P.useEffect(()=>{Ce("/api/config").then(u=>u.json()).then(u=>{u.workdir?i(u.workdir):fetch("/api/directories?path="+encodeURIComponent("/home")).then(f=>f.json()).then(f=>{f.current&&i(f.current)}).catch(()=>{})}).catch(()=>{fetch("/api/directories?path="+encodeURIComponent("/home")).then(u=>u.json()).then(u=>{u.current&&i(u.current)}).catch(()=>{})})},[]),o.jsxs("div",{className:"max-w-xl mx-auto",children:[o.jsx("h2",{className:"text-2xl font-bold text-text-primary mb-2",children:"Your Projects Folder"}),o.jsx("p",{className:"text-text-secondary mb-8",children:"Where should OpenFox create project folders?"}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Workspace directory"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("input",{type:"text",value:r,onChange:u=>i(u.target.value),placeholder:"/home/user/projects",className:"flex-1 px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"}),o.jsx("button",{onClick:()=>c(!0),className:"px-4 py-2 bg-bg-secondary border border-border rounded-lg hover:border-text-muted",children:"Browse"})]})]}),s&&o.jsx(Ab,{initialPath:r||void 0,onSelect:u=>{i(u),c(!1)},onClose:()=>c(!1)}),o.jsx("button",{onClick:()=>e({workdir:r}),disabled:!r,className:"w-full mt-6 px-6 py-3 bg-accent-primary text-white rounded-lg font-medium hover:bg-accent-primary/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Continue"})]})]})}function vA({onNext:e}){const[r,i]=P.useState(!1),[s,c]=P.useState("http://localhost:11434"),[u,f]=P.useState("qwen3-vl:2b"),{copied:l,copy:d}=Zy();P.useEffect(()=>{Ce("/api/config").then(g=>g.json()).then(g=>{g.visionFallback&&(i(g.visionFallback.enabled),c(g.visionFallback.url),f(g.visionFallback.model))}).catch(()=>{})},[]);function p(g){if(g){e({});return}e({visionFallback:{enabled:r,url:s,model:u,timeout:120}})}return o.jsxs("div",{className:"max-w-xl mx-auto",children:[o.jsx("h2",{className:"text-2xl font-bold text-text-primary mb-2",children:"Vision (Optional)"}),o.jsx("p",{className:"text-text-secondary mb-8",children:"Configure a vision model for non-vision models"}),o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"bg-bg-secondary rounded-lg p-4 border border-border",children:[o.jsx("p",{className:"text-text-secondary text-sm mb-2",children:"To enable vision support, you need an Ollama server with a vision model:"}),o.jsx("a",{href:"https://ollama.com/download",target:"_blank",rel:"noopener noreferrer",className:"text-accent-primary hover:underline text-sm",children:"Download Ollama"}),o.jsxs("div",{className:"mt-3 p-2 bg-bg-primary rounded border border-border flex items-center justify-between gap-2",children:[o.jsx("code",{className:"text-text-secondary text-xs",children:"ollama pull qwen3-vl:2b"}),o.jsx("button",{onClick:()=>d("ollama pull qwen3-vl:2b"),className:"text-text-muted hover:text-text-primary transition-colors",title:"Copy",children:l?o.jsx(Wl,{className:"w-4 h-4 text-accent-primary"}):o.jsxs("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[o.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",strokeWidth:"2"}),o.jsx("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1",strokeWidth:"2"})]})})]})]}),o.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[o.jsx("input",{type:"checkbox",checked:r,onChange:g=>i(g.target.checked),className:"w-5 h-5 rounded border-border bg-bg-secondary text-accent-primary focus:ring-accent-primary"}),o.jsx("span",{className:"text-text-primary",children:"Enable vision fallback for non-vision models"})]}),r&&o.jsxs("div",{className:"space-y-4 pl-8",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Vision server URL"}),o.jsx("input",{type:"text",value:s,onChange:g=>c(g.target.value),placeholder:"http://localhost:11434",className:"w-full px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Vision model name"}),o.jsx("input",{type:"text",value:u,onChange:g=>f(g.target.value),placeholder:"qwen3-vl:2b",className:"w-full px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"})]})]}),o.jsxs("div",{className:"flex items-center justify-between pt-4",children:[o.jsx("button",{onClick:()=>p(!0),className:"text-text-muted hover:text-text-secondary text-sm underline",children:"Skip for now"}),o.jsx("button",{onClick:()=>p(!1),className:"px-6 py-3 bg-accent-primary text-white rounded-lg font-medium hover:bg-accent-primary/90 transition-colors",children:"Finish Setup"})]})]})]})}function bA({onComplete:e}){const[r,i]=P.useState(1),[s,c]=P.useState(!1),[u,f]=P.useState({});async function l(m){f(y=>({...y,providers:m.providers})),i(2)}async function d(m){f(y=>({...y,...m})),i(3)}async function p(m){c(!0);try{if(!(await Ce("/api/init/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workdir:u.workdir,visionFallback:m.visionFallback})})).ok)throw new Error("Failed to save config");e()}catch(y){console.error("Failed to save onboarding data:",y),c(!1)}}const g=m=>{i(m)};return o.jsxs("div",{className:"w-full max-w-xl mx-auto px-6 py-16 relative",children:[o.jsx(Rs,{onClick:e,className:"absolute top-4 right-4 p-2",variant:"modal",size:"xl"}),o.jsx(mA,{currentStep:r,totalSteps:3,labels:["LLM Server","Projects Folder","Vision"],onStepClick:g}),o.jsx("div",{className:"max-w-xl mx-auto",children:s?o.jsxs("div",{className:"text-center",children:[o.jsx(m0,{size:"md"}),o.jsx("p",{className:"mt-4 text-text-secondary",children:"Saving your settings..."})]}):o.jsxs(o.Fragment,{children:[r===1&&o.jsx(gA,{onNext:l}),r===2&&o.jsx(xA,{onNext:d}),r===3&&o.jsx(vA,{onNext:p})]})})]})}function cf(){return typeof window>"u"?!1:localStorage.getItem("openfox_token")!==null}function g0(){return o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Yl,{})})}function yA({sidebarOpen:e,onSidebarToggle:r}){const[,i]=bh("/p/:projectId"),s=i==null?void 0:i.projectId,c=Ee(m=>m.connectionStatus),u=Ee(m=>m.listSessions),f=Ee(m=>m.clearSession),l=Gt(m=>m.currentProject),d=Gt(m=>m.loadProject),p=cf(),g=c==="connected"||p;return P.useEffect(()=>{g&&s&&((l==null?void 0:l.id)!==s&&d(s),u(s),f())},[g,s,l==null?void 0:l.id,d,u,f]),!l||l.id!==s?o.jsx(g0,{}):o.jsxs(o.Fragment,{children:[o.jsx(Tb,{projectId:s,isOpen:e,onClose:r}),o.jsx("div",{className:"flex-1 min-w-0 bg-bg-primary",children:o.jsx(_w,{})})]})}function _A({sidebarOpen:e,onSidebarToggle:r,rightSidebarOpen:i,onRightSidebarToggle:s}){const[,c]=bh("/p/:projectId/s/:sessionId"),u=c==null?void 0:c.projectId,f=c==null?void 0:c.sessionId,[,l]=ar(),d=Ee(S=>S.connectionStatus),p=Ee(S=>S.currentSession),g=Ee(S=>S.loadSession),m=Ee(S=>S.listSessions),y=Ee(S=>S.pendingSessionCreate),_=Ee(S=>S.error),k=Ee(S=>S.clearError),C=Gt(S=>S.currentProject),v=Gt(S=>S.loadProject),b=cf(),x=d==="connected"||b;return P.useEffect(()=>{x&&u&&(C==null?void 0:C.id)!==u&&v(u)},[x,u,C==null?void 0:C.id,v]),P.useEffect(()=>{x&&f&&(p==null?void 0:p.id)!==f&&!y&&g(f),x&&u&&m(u)},[x,f,p==null?void 0:p.id,g,m,y,u]),P.useEffect(()=>{(_==null?void 0:_.code)==="NOT_FOUND"&&u&&(k(),l(`/p/${u}`))},[_,u,k,l]),!C||C.id!==u?o.jsx(g0,{}):o.jsxs(o.Fragment,{children:[o.jsx(Tb,{projectId:u,isOpen:e,onClose:r}),o.jsx("div",{className:"flex-1 min-w-0 bg-bg-primary",children:o.jsx(uA,{criteriaSidebarOpen:i,onCriteriaSidebarToggle:s})})]})}function SA(){const e=kt(i=>i.fetchConfig);function r(){e(),window.history.back()}return o.jsx("div",{className:"flex-1 overflow-y-auto",children:o.jsx(bA,{onComplete:r})})}function wA(){const{connectionStatus:e}=BS(),r=kt(q=>q.fetchConfig),i=kt(q=>q.refreshProviderModels),s=kt(q=>q.providers),c=kt(q=>q.activeProviderId),[,u]=ar(),f=cf(),[l,d]=P.useState(!1);P.useEffect(()=>{(e==="connected"||f)&&r().then(()=>{d(!0)})},[e,f,r]),P.useEffect(()=>{l&&c&&i(c).then(()=>{r()})},[l,c,i,r]),P.useEffect(()=>{l&&s.length===0&&u("/onboarding")},[l,s.length]);const p=()=>{const q=localStorage.getItem("openfox:leftSidebar");return q!==null?q==="true":!1},g=()=>{const q=localStorage.getItem("openfox:rightSidebar");return q!==null?q==="true":!0},[m,y]=P.useState(p),[_,k]=P.useState(g),[C,v]=P.useState(!1),[b,x]=P.useState(!1),[S,j]=P.useState(!1);P.useEffect(()=>{const q=()=>{j(window.innerWidth<768)};return q(),window.addEventListener("resize",q),()=>window.removeEventListener("resize",q)},[]);const A=S?C:m,N=S?b:_,D=()=>{S?v(!C):y(!m)},T=()=>{S?x(!b):k(!_)};P.useEffect(()=>{S||localStorage.setItem("openfox:leftSidebar",String(m))},[m,S]),P.useEffect(()=>{S||localStorage.setItem("openfox:rightSidebar",String(_))},[_,S]),P.useEffect(()=>{(e==="connected"||f)&&r()},[e,r,f]);const I=Ee(q=>q.showPasswordModal),H=Ee(q=>q.passwordModalRetry),V=Ee(q=>q.submitPassword),Y=Ee(q=>q.cancelPassword);return e!=="connected"&&!I&&!f?o.jsxs(o.Fragment,{children:[o.jsx(tb,{isOpen:!0,isRetry:H,onSubmit:V,onCancel:Y}),o.jsx("div",{className:"h-screen flex items-center justify-center",children:o.jsx(xw,{text:"Connecting to server..."})})]}):o.jsxs(o.Fragment,{children:[o.jsx(tb,{isOpen:I,isRetry:H,onSubmit:V,onCancel:Y}),o.jsxs("div",{className:"h-screen flex flex-col",children:[o.jsx(hw,{}),o.jsx(ow,{onMenuClick:D,onCriteriaToggle:T}),o.jsx("div",{className:"flex-1 flex overflow-hidden",children:o.jsxs(cS,{children:[o.jsx(Ta,{path:"/onboarding",children:o.jsx(SA,{})}),o.jsx(Ta,{path:"/p/:projectId/s/:sessionId",children:o.jsx(_A,{sidebarOpen:A,onSidebarToggle:D,rightSidebarOpen:N,onRightSidebarToggle:T})}),o.jsx(Ta,{path:"/p/:projectId/new",children:o.jsx(yw,{})}),o.jsx(Ta,{path:"/p/:projectId",children:o.jsx(yA,{sidebarOpen:A,onSidebarToggle:D})}),o.jsx(Ta,{path:"/",children:o.jsx(bw,{})})]})})]})]})}F1.createRoot(document.getElementById("root")).render(o.jsx(dn.StrictMode,{children:o.jsx(wA,{})}));
|